Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
grub-mkconfig does not detect any kernel
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
ifranco
n00b
n00b


Joined: 07 Dec 2024
Posts: 9

PostPosted: Sat Dec 07, 2024 11:51 am    Post subject: grub-mkconfig does not detect any kernel Reply with quote

Hello, this is my first time installing Gentoo and I had a problem while installing and configuring GRUB.

While executing the command:
Code:
grub-mkconfig -o /boot/grub/grub.cfg


I got this output:
Code:
Generating grub configuration file ...
Warning: os-prober will not be executed to detect other bootable partitions.
Systems on them will not be added to the GRUB boot configuration.
Check GRUB_DISABLE_OS_PROBER documentation entry.
Adding boot menu entry for UEFI Firmware Settings ...
done


and when listing the contents of the /boot folder the only folder is grub. However when I list the contents of the /efi/EFI/Gentoo/ folder this is what I see:
Code:
config-6.6.62-gentoo-dist
config-6.6.62-gentoo-dist.old
grubx64.efi
initramfs-6.6.62-gentoo-dist.img
initramfs-6.6.62-gentoo-dist.img.old
System.map-6.6.62-gentoo-dist.img.old
System.map-6.6.62-gentoo-dist.img.old
vmlinuz-6.6.62-gentoo-dist.efi
vmlinuz-6.6.62-gentoo-dist-old.efi


This should be in the /boot folder according to the guide.

this is the content of the /etc/fstab file
Code:
/dev/vda1      /efi      vfat      defaults   0 2
/dev/vda2      none      swap      sw      0 0
/dev/vda3      /      xfs      defaults,noatime             0 1
/dev/cdrom      /mnt/cdrom   auto      noauto,user   0 0


and this is the content of the /etc/portage/make.conf file
Code:
COMMON_FLAGS="-march=native -O2 -pipe"
CFLAGS="${COMMON_FLAGS}"
CXXFLAGS="${COMMON_FLAGS}"
FCFLAGS="${COMMON_FLAGS}"
FFLAGS="${COMMON_FLAGS}"
RUSTFLAGS="${RUSTFLAGS} -C target-cpu=native"

# NOTE: This stage was built with the bindist USE flag enabled

# This sets the language of build output to English.
# Please keep this setting intact when reporting bugs.
LC_MESSAGES=C.utf8

GENTOO_MIRRORS="https://gentoo.zero.com.ar/gentoo/ \
    rsync://gentoo.zero.com.ar/gentoo \
    https://gentoo.c3sl.ufpr.br/ \
    http://gentoo.c3sl.ufpr.br/ \
    rsync://gentoo.c3sl.ufpr.br/gentoo/ \
    https://mirror.clarkson.edu/gentoo/ \
    http://mirror.clarkson.edu/gentoo/ \
    rsync://mirror.clarkson.edu/gentoo/ \
    http://www.gtlib.gatech.edu/pub/gentoo \
    rsync://rsync.gtlib.gatech.edu/gentoo \
    https://mirrors.mit.edu/gentoo-distfiles/ \
    http://mirrors.mit.edu/gentoo-distfiles/ \
    rsync://mirrors.mit.edu/gentoo-distfiles/ \
    https://gentoo.osuosl.org/ \
    http://gentoo.osuosl.org/ \
    https://mirrors.rit.edu/gentoo/ \
    http://mirrors.rit.edu/gentoo/ \
    ftp://mirrors.rit.edu/gentoo/ \
    rsync://mirrors.rit.edu/gentoo/ \
    https://mirror.servaxnet.com/gentoo/ \
    http://mirror.servaxnet.com/gentoo/ \
    http://gentoo-mirror.flux.utah.edu/"

USE="dist-kernel -kde -qt5 -qt6 -kf6compat -calligra -wxwidgets -kdepim -handbook -systemd
     accessibility apparmor audit bluetooth cairo colord cups dbus
     consolekit gstreamer gtk introspection networkmanager
     pipewire pulseaudio screencast openrc
     X alsa amd64 branding bzip2 encode exif flac iconv icu ipv6
     jpeg mad mp3 mp4 multilib nls ogg opengl openmp pam pdf
     png policykit spell ssl svg truetype udev unicode upower
     usb vorbis vulkan xattr xcb xml"

VIDEO_CARDS="xql"
GRUB_PLATFORMS="efi-64"


I would appreciate any help
Back to top
View user's profile Send private message
GDH-gentoo
Veteran
Veteran


Joined: 20 Jul 2019
Posts: 1779
Location: South America

PostPosted: Sat Dec 07, 2024 12:53 pm    Post subject: Reply with quote

grub-mkconfig expects to find kernels in /boot, not /efi.
_________________
NeddySeagoon wrote:
I'm not a witch, I'm a retired electronics engineer :)
Ionen wrote:
As a packager I just don't want things to get messier with weird build systems and multiple toolchains requirements though :)
Back to top
View user's profile Send private message
ifranco
n00b
n00b


Joined: 07 Dec 2024
Posts: 9

PostPosted: Sat Dec 07, 2024 12:59 pm    Post subject: Reply with quote

GDH-gentoo wrote:
grub-mkconfig expects to find kernels in /boot, not /efi.

Can I just move those files to /boot with the mv command?
Back to top
View user's profile Send private message
sMueggli
Guru
Guru


Joined: 03 Sep 2022
Posts: 516

PostPosted: Sat Dec 07, 2024 1:11 pm    Post subject: Reply with quote

/boot is a directory for the operating system and normally the kernel and initramfs and some Grub stuff goes there (it is possible to [ab]use the ESP as /boot).

The ESP is meant to store the EFI binaries that can be found and loaded by the firmware. In your case the firmware will load the Grub EFI binary. And then Grub takes care of loading the kernel and initramfs.

How did you end up storing the kernel and initramfs on /efi and not /boot?

Do you use "installkernel"? If so check "emerge -pv installkernel" and see also https://wiki.gentoo.org/wiki/Installkernel for more information.

Yes, you should be able to "mv" the files from /efi to /boot.
Back to top
View user's profile Send private message
GDH-gentoo
Veteran
Veteran


Joined: 20 Jul 2019
Posts: 1779
Location: South America

PostPosted: Sat Dec 07, 2024 1:14 pm    Post subject: Reply with quote

sMueggli wrote:
Yes, you should be able to "mv" the files from /efi to /boot.

Except /efi/EFI/Gentoo/grubx64.efi, that should stay where it is now (presumably the EFI System Partition).

sMueggli wrote:
Do you use "installkernel"? If so check "emerge -pv installkernel" and see also https://wiki.gentoo.org/wiki/Installkernel for more information.

Yes, ifranco, do that.
_________________
NeddySeagoon wrote:
I'm not a witch, I'm a retired electronics engineer :)
Ionen wrote:
As a packager I just don't want things to get messier with weird build systems and multiple toolchains requirements though :)
Back to top
View user's profile Send private message
ifranco
n00b
n00b


Joined: 07 Dec 2024
Posts: 9

PostPosted: Sat Dec 07, 2024 1:30 pm    Post subject: Reply with quote

sMueggli wrote:
Do you use "installkernel"? If so check "emerge -pv installkernel" and see also https://wiki.gentoo.org/wiki/Installkernel for more information.


yes, i used installkernel, when I run that command, this is the output:

Code:
These are the packages that would be merged, in order:

Calculating dependencies \

!!! Problem resolving dependencies for sys-kernel/installkernel
... done!
Dependency resolution took 0.63 s (backtrack: 0/20).


!!! The ebuild selected to satisfy "installkernel" has unmet requirements.
- sys-kernel/installkernel-48-r1::gentoo USE="dracut efistub grub -refind -systemd -systemd-boot -ugrd -uki -ukify" ABI_X86="(64)"

  The following REQUIRED_USE flag constraints are unsatisfied:
    at-most-one-of ( efistub grub systemd-boot )

  The above constraints are a subset of the following complete expression:
    at-most-one-of ( efistub grub systemd-boot ) refind? ( !systemd-boot !grub ) systemd-boot? ( systemd ) ukify? ( uki ) at-most-one-of ( dracut ugrd )


 * IMPORTANT: 22 news items need reading for repository 'gentoo'.
 * Use eselect news read to view new items.


I thought I had fulfilled the requirements by adding this in the /etc/portage/package.use/installkernel file
Code:
sys-kernel/installkernel efistub dracut grub
Back to top
View user's profile Send private message
GDH-gentoo
Veteran
Veteran


Joined: 20 Jul 2019
Posts: 1779
Location: South America

PostPosted: Sat Dec 07, 2024 1:38 pm    Post subject: Reply with quote

ifranco wrote:
Code:
  The following REQUIRED_USE flag constraints are unsatisfied:
    at-most-one-of ( efistub grub systemd-boot )

The efistub and grub USE flags are mutually exclusive. You are using GRUB, so unset efistub.
_________________
NeddySeagoon wrote:
I'm not a witch, I'm a retired electronics engineer :)
Ionen wrote:
As a packager I just don't want things to get messier with weird build systems and multiple toolchains requirements though :)
Back to top
View user's profile Send private message
ifranco
n00b
n00b


Joined: 07 Dec 2024
Posts: 9

PostPosted: Sat Dec 07, 2024 1:59 pm    Post subject: Reply with quote

Code:
The efistub and grub USE flags are mutually exclusive. You are using GRUB, so unset efistub.


after removing “efistub”, this is the output:

Code:
These are the packages that would be merged, in order:

Calculating dependencies... done!
Dependency resolution took 2.57 s (backtrack: 0/20).

[ebuild   R    ] sys-kernel/installkernel-48-r1::gentoo  USE="dracut grub* -efistub* -refind -systemd -systemd-boot -ugrd -uki -ukify" 0 KiB

Total: 1 package (1 reinstall), Size of downloads: 0 KiB

 * IMPORTANT: 22 news items need reading for repository 'gentoo'.
 * Use eselect news read to view new items.


and then run the following command
Code:
emerge -v installkernel

but I would like to know how I could have installed the kernel in /efi instead of /boot, why could that have happened?
Back to top
View user's profile Send private message
sMueggli
Guru
Guru


Joined: 03 Sep 2022
Posts: 516

PostPosted: Sat Dec 07, 2024 2:21 pm    Post subject: Reply with quote

I do not know all the details of installkernel, but I suspect the "efistub" flag is responsible to move/install the EFI stub files to the ESP.

Now that you have settled installkernel you can reinstall the kernel (and check the timestamps of the files in /boot). Then please reinstall Grub ("grub-install --efi-directory=/efi") and after that recreate the grub.cfg with "grub-mkconfig".
Back to top
View user's profile Send private message
GDH-gentoo
Veteran
Veteran


Joined: 20 Jul 2019
Posts: 1779
Location: South America

PostPosted: Sat Dec 07, 2024 2:23 pm    Post subject: Reply with quote

ifranco wrote:
but I would like to know how I could have installed the kernel in /efi instead of /boot, why could that have happened?

According to the "*" in the following output (which marks USE flag changes):

ifranco wrote:
Code:
[ebuild   R    ] sys-kernel/installkernel-48-r1::gentoo  USE="dracut grub* -efistub* -refind -systemd -systemd-boot -ugrd -uki -ukify" 0 KiB

installkernel had the exact opposite setup: this one is for the case where you want to have the UEFI firmware boot EFI stub kernels directly, without a bootloader.

ifranco wrote:
Code:
 * IMPORTANT: 22 news items need reading for repository 'gentoo'.
 * Use eselect news read to view new items.

You should do that as well.
_________________
NeddySeagoon wrote:
I'm not a witch, I'm a retired electronics engineer :)
Ionen wrote:
As a packager I just don't want things to get messier with weird build systems and multiple toolchains requirements though :)
Back to top
View user's profile Send private message
ifranco
n00b
n00b


Joined: 07 Dec 2024
Posts: 9

PostPosted: Sat Dec 07, 2024 2:29 pm    Post subject: Reply with quote

Quote:
Now that you have settled installkernel you can reinstall the kernel (and check the timestamps of the files in /boot). Then please reinstall Grub ("grub-install --efi-directory=/efi") and after that recreate the grub.cfg with "grub-mkconfig".


I tried to do that, but it still doesn't work :/
Back to top
View user's profile Send private message
ifranco
n00b
n00b


Joined: 07 Dec 2024
Posts: 9

PostPosted: Sat Dec 07, 2024 2:32 pm    Post subject: Reply with quote

Quote:
installkernel had the exact opposite setup: this one is for the case where you want to have the UEFI firmware boot EFI stub kernels directly, without a bootloader.

then I should add efistub to /etc/portage/package.use/installkernel and remove grub?
Back to top
View user's profile Send private message
sMueggli
Guru
Guru


Joined: 03 Sep 2022
Posts: 516

PostPosted: Sat Dec 07, 2024 2:36 pm    Post subject: Reply with quote

No, you should share all the commands and outputs, so that we can help you.

Of course you can "try-and-error" all combinations until you find a working setup. But usually it is better to follow one clear target and eliminate the errors. This way you will learn how to debug and how your system is working.
Back to top
View user's profile Send private message
GDH-gentoo
Veteran
Veteran


Joined: 20 Jul 2019
Posts: 1779
Location: South America

PostPosted: Sat Dec 07, 2024 2:43 pm    Post subject: Reply with quote

ifranco wrote:
then I should add efistub to /etc/portage/package.use/installkernel and remove grub?

Without invalidating sMueggli's answer: your kernels might be EFI stubs, but again, you are using GRUB —or else why would you be setting it up with grub-mkconfig?— instead of having the UEFI firmware boot the stubs directly, so no.

It's one thing or the other.
_________________
NeddySeagoon wrote:
I'm not a witch, I'm a retired electronics engineer :)
Ionen wrote:
As a packager I just don't want things to get messier with weird build systems and multiple toolchains requirements though :)


Last edited by GDH-gentoo on Sat Dec 07, 2024 2:45 pm; edited 1 time in total
Back to top
View user's profile Send private message
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 5289
Location: Bavaria

PostPosted: Sat Dec 07, 2024 2:44 pm    Post subject: Reply with quote

ifranco,

perhaps you are not aware of what “efistub” means. You have two possibilities to boot a kernel:

1. a bootloader/bootmanager (like "grub") starts the kernel, or
2. the UEFI starts an “efistub” kernel directly (instead of the bootloader/bootmanager).

This is the reason why “efistub” and “grub” are mutually exclusive.

I use option 2, for example; you may want to read this to better understand a UEFI boot: https://wiki.gentoo.org/wiki/User:Pietinger/Tutorials/Boot_kernel_via_UEFI
This is a manually way to install it - the other way is using "installkernel" ... I suggest to install "efibootmgr" and run it to see your current settings.
_________________
https://wiki.gentoo.org/wiki/User:Pietinger
Back to top
View user's profile Send private message
ifranco
n00b
n00b


Joined: 07 Dec 2024
Posts: 9

PostPosted: Sat Dec 07, 2024 3:06 pm    Post subject: Reply with quote

pietinger wrote:
ifranco,

perhaps you are not aware of what “efistub” means. You have two possibilities to boot a kernel:

1. a bootloader/bootmanager (like "grub") starts the kernel, or
2. the UEFI starts an “efistub” kernel directly (instead of the bootloader/bootmanager).

This is the reason why “efistub” and “grub” are mutually exclusive.

I use option 2, for example; you may want to read this to better understand a UEFI boot: https://wiki.gentoo.org/wiki/User:Pietinger/Tutorials/Boot_kernel_via_UEFI
This is a manually way to install it - the other way is using "installkernel" ... I suggest to install "efibootmgr" and run it to see your current settings.


Thanks for the clarification!
Yes, I would like to use grub, but if I can't get it to work I will have to use efistub.

I installed efibootmgr, and this is what it shows me:
Code:
BootCurrent: 0001
Timeout: 3 seconds
BootOrder: 0003,0001,0002,0000
Boot0000* UiApp   FvVol(7cb8bdc9-f8eb-4f34-aaea-3ee4af6516a1)/FvFile(462caa21-7614-4503-836e-8ab6f4662331)
Boot0001* UEFI QEMU DVD-ROM QM00001    PciRoot(0x0)/Pci(0x1f,0x2)/Sata(0,65535,0){auto_created_boot_option}
Boot0002* UEFI Misc Device   PciRoot(0x0)/Pci(0x2,0x3)/Pci(0x0,0x0){auto_created_boot_option}
Boot0003* gentoo   HD(1,GPT,1b5a07a7-d336-452f-ae88-27f4501c61e6,0x800,0x200000)/\EFI\gentoo\grubx64.efi
Back to top
View user's profile Send private message
GDH-gentoo
Veteran
Veteran


Joined: 20 Jul 2019
Posts: 1779
Location: South America

PostPosted: Sat Dec 07, 2024 3:22 pm    Post subject: Reply with quote

ifranco wrote:
Yes, I would like to use grub, but if I can't get it to work I will have to use efistub.

Then I suggest you start with GRUB, stick to the set of instructions that describe how to set up a Gentoo system with GRUB so that you don't get confused, and if that doesn't work, then we'll see what we can do. You can always use the installation medium to boot the computer, chroot and fix your nonworking Gentoo.

This includes reinstalling sys-kernel/installkernel with USE="grub -efistub":

/etc/portage/package.use
Code:
sys-kernel/installkernel dracut grub

Code:
# emerge --ask sys-kernel/installkernel

Then I'd do what sMueggli suggested:

sMueggli wrote:
Now that you have settled installkernel you can reinstall the kernel (and check the timestamps of the files in /boot). Then please reinstall Grub ("grub-install --efi-directory=/efi") and after that recreate the grub.cfg with "grub-mkconfig".

You don't need to rebuild the kernel, just reinstall it.
_________________
NeddySeagoon wrote:
I'm not a witch, I'm a retired electronics engineer :)
Ionen wrote:
As a packager I just don't want things to get messier with weird build systems and multiple toolchains requirements though :)
Back to top
View user's profile Send private message
ifranco
n00b
n00b


Joined: 07 Dec 2024
Posts: 9

PostPosted: Sat Dec 07, 2024 4:55 pm    Post subject: Reply with quote

well, I reinstalled everything and now it works, thank you all so much :D
Back to top
View user's profile Send private message
keekkenen
n00b
n00b


Joined: 05 Oct 2024
Posts: 27

PostPosted: Sun Dec 08, 2024 6:15 pm    Post subject: Reply with quote

ifranco wrote:
well, I reinstalled everything and now it works, thank you all so much :D

What is your final configuration ?
_________________
7950x3d / x670e MSI Tomagawk / Sapphire RX 7800XT 16Gb / G.Skill 64Gb 5600 / A-Data Legend 960 2Tb (x2), A-Data SX8200PNP 256Gb
Back to top
View user's profile Send private message
ifranco
n00b
n00b


Joined: 07 Dec 2024
Posts: 9

PostPosted: Sun Dec 08, 2024 7:03 pm    Post subject: Reply with quote

Quote:
What is your final configuration ?

I did not change any configuration files. The only thing I did was to try to remove the packages and install them again.

These were the last commands I executed.

Code:
emerge --deselect sys-kernel/gentoo-kernel-bin
emerge --ask --depclean
emerge --ask --verbose --depclean sys-kernel/gentoo-kernel-bin
emerge --ask sys-kernel/gentoo-kernel-bin
emerge --ask @module-rebuild
mount /dev/vda1 /efi
emerge sys-kernel/linux-firmware
emerge --ask sys-kernel/gentoo-kernel-bin
grub-install --efi-directory=/efi
grub-mkconfig -o /boot/grub/grub.cfg


Yes, I should have read better what the commands did, but I was a bit tired and just wanted it to let me reinstall the packages and ran some commands without really understanding what they did.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum