Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Installing Gentoo
  • Search

grub2 - vmlinuz not found? [SOLVED]

Having problems with the Gentoo Handbook? If you're still working your way through it, or just need some info before you start your install, this is the place. All other questions go elsewhere.
Post Reply
Advanced search
26 posts
  • 1
  • 2
  • Next
Author
Message
whitt
Apprentice
Apprentice
Posts: 156
Joined: Mon Dec 28, 2020 10:56 pm

grub2 - vmlinuz not found? [SOLVED]

  • Quote

Post by whitt » Sun Jan 10, 2021 1:25 am

alright, just shoot me... I boot from M2 NVME, UEFI seems to be working fine, ubuntu boots fine.

I used ubuntu to set up my gentoo installation since I couldn't get the gentoo installation liveUSB image to set up my networking. Ubuntu works right out of the box, running 5.8.x.

My partitions are:
/dev/sda1 - EFI
/dev/sda2 - Swap
/dev/sda3 - /boot (shared between Ubuntu and Gentoo)
/dev/sda4 - Ubuntu /
/dev/sda5 - Gentoo /

At first, I compiled the latest ~amd64 kernel. /boot was mounted, I checked vmlinuz was there, and I created an initramfs, I verified it was there, following the Gentoo handbook...

I ran update-grub2 from within Ubuntu, and it listed the Ubuntu kernel and my Gentoo 5.10.6, all seemed good. I rebooted, and things get weird:

The Ubuntu Grub menu entry points to my 5.10.6 kernel, but the kernel boots and runs the ubuntu root. The UUIDs all point to the Ubuntu partition.

I tried again, this time installing the latest binary kernel for a safe option and more grub menu entries to play with. Ran update-grub from within Ubuntu, and same thing... The grub menu is getting tweaked to run the gentoo kernels in the ubuntu environment.

Is there a multi-boot walkthrough that I can trust to get me through this without needing handholding?
Last edited by whitt on Wed Jan 13, 2021 1:32 am, edited 1 time in total.
Top
alamahant
Advocate
Advocate
Posts: 4034
Joined: Sat Mar 23, 2019 12:12 pm

  • Quote

Post by alamahant » Sun Jan 10, 2021 9:40 am

Hi
First of all you need to have installed and updated grub
from inside the chroot in Gentoo also.

Code: Select all

grub-install --target=x86_64-efi --boot-directory=/boot/efi --bootloader-id=gentoo --recheck
#####You need to have emerged grub with the option
 #### GRUB_PLATFORMS="efi-64" in make.conf
grub-mkconfig -o /boot/grub/grub.cfg
This will make the Gentoo grub to appear FIRST when booting your machine.
If you have problems use
efibootmgr
efibootmgr -n xxxx
to choose your next boot.

Furthermore in both Gentoo and Ubuntu you need to have

Code: Select all

GRUB_DISABLE_OS_PROBER="false"
in
/etc/default/grub
Make sure to install
sys-boot/os-prober

If the Ubuntu grub can not lboot Gentoo still it point to some misconfiguration inside Gentoo.
Inside Ubuntu run "efibootmgr" and check if there is a Gentoo entry.
If there is then run
efibootmgr -n <gentoo-number>
and reboot.
If you manage to boot into Gentoo then all is ok.
If not then your Gentoo installation is probably misconfigured for boot.
:)
Top
Goverp
Advocate
Advocate
User avatar
Posts: 2402
Joined: Wed Mar 07, 2007 6:41 pm

  • Quote

Post by Goverp » Sun Jan 10, 2021 11:12 am

The basic problem is the grub-mkconfig script. It's located your Gentoo kernels, but it down't know how to locate your rootfs. AFAIR there's an option to make it pass file system labels instead of UUIDs; that might be a better way, as you could label them as UbuntuRoot and GentooRoot or similar. That's not necessarily enough though.

Did you create any stanzas in /etc/defaults/grub to define your Gentoo system? I think you probably need one. Running grub-mkconfig inside Ubuntu will locate your Gentoo kernels, but there's nothing in the kernel that tells it which rootfs to use, so it will logically use the Ubuntu one. You could code the internal kernel command line parameters in .config to specify the right rootfs, but that sort of negates the external configuration that grub is permitting.
Greybeard
Top
szatox
Advocate
Advocate
Posts: 3858
Joined: Tue Aug 27, 2013 12:35 pm

  • Quote

Post by szatox » Sun Jan 10, 2021 12:36 pm

alright, just shoot me... I boot from M2 NVME, UEFI seems to be working fine, ubuntu boots fine.
Use refind. It only requires you to provide command line options in its config file (unless you want to create kernel-specific entries in which case using more edvanced configuration would make the resulting menu easier to navigate)
The Ubuntu Grub menu entry points to my 5.10.6 kernel, but the kernel boots and runs the ubuntu root. The UUIDs all point to the Ubuntu partition.
Yes, because mkconfig is not aware of an alternative root you can boot into.
However, AFAIR there is a bunch of config files under /boot/grub (or maybe /etc/grub, but I think grub likes to keep its stuff in /boot). I mean the template files, those with names like "2 digits, dash, description".
You can create a static entry there and have it included in the resulting grub config.

There is also the oldschool way with chainloading bootloaders. I used to do that with grub-legacy, I'm pretty sure grub2 can do that too (probably using the same files I mentioned above), refind can detect other bootloaders in runtime and add them do the boot menu. Pick whatever you like
Top
whitt
Apprentice
Apprentice
Posts: 156
Joined: Mon Dec 28, 2020 10:56 pm

  • Quote

Post by whitt » Sun Jan 10, 2021 5:40 pm

I'll try refind and see what it does.

I did what was recommended by alamahant, however the chrooted gentoo barfed an EFI related error when I ran efibootmgr. I didn't write down what it was, and decided - I'll just let Ubuntu handle the boot loader, since I could see the kernels and initramfs were copied over. Well, I suppose nothing is ever simple.

It seems like the gentoo system is having trouble with EFI... I'd hoped I could just use the Ubuntu loader to manage both systems. Let me see if I can figure out what's going on with the chroot - maybe it's a problem with Ubuntu...
Top
pietinger
Administrator
Administrator
Posts: 6628
Joined: Tue Oct 17, 2006 5:11 pm
Location: Bavaria

  • Quote

Post by pietinger » Sun Jan 10, 2021 5:49 pm

whitt wrote:[...] however the chrooted gentoo barfed an EFI related error when I ran efibootmgr. [...]
efibootmgr needs a mounted (and writeable) efivarfs. You can check with "mount" and "ls /sys/firmware/efi" (must exist).
You will get it only if 1.) UEFI is enabled in your BIOS AND 2.) CSM is disabled in your BIOS AND 3.) you boot with the correct installation CD (old gentoo installation CD does no UEFI boot).
Top
whitt
Apprentice
Apprentice
Posts: 156
Joined: Mon Dec 28, 2020 10:56 pm

  • Quote

Post by whitt » Sun Jan 10, 2021 6:00 pm

When you say "old gentoo installation cd" do you mean the current / latest image? Because I ran into a load of problems with that, not just my networking not working, but being unable to make a bootable system after copying everything over to the image from another machine. This is why I'm using ubuntu now - at least I've got a recoverable *nix system running on a rescue partition, provided I don't jack up the bootloader...

As far as efivars - I'm in the Gentoo chroot now, and I see /sys/firmware/efi/efivars now, and it's loaded with a ton of I don't know what.

Almost a moot point at the moment. The Gentoo kernels both had problems with the display - I've got to recompile and figure out what I missed anyway...

I'm debating copying the config and building an identical kernel to what Ubuntu is running now, just to get the Gentoo system running. Is there a simple way to turn the Ubuntu Kconfig into a .config I can copy to gentoo, then use to run make-oldconfig?
Top
pietinger
Administrator
Administrator
Posts: 6628
Joined: Tue Oct 17, 2006 5:11 pm
Location: Bavaria

  • Quote

Post by pietinger » Sun Jan 10, 2021 7:03 pm

whitt wrote:When you say "old gentoo installation cd" do you mean the current / latest image? [...]
No, current CD boots fine with UEFI.
whitt wrote:Because I ran into a load of problems with that, not just my networking not working, [...]
This should be caused from an older kernel used there. When I did my last gentoo installation I had the same problem with a very new ethernet chip and I had to use the rescue-CD with a newer kernel.
whitt wrote:[...] but being unable to make a bootable system after copying everything over to the image from another machine. [...]
This is always dangerous ...
whitt wrote:As far as efivars - I'm in the Gentoo chroot now, and I see /sys/firmware/efi/efivars now, [...]
You can check with "mount" if it is mounted "rw" or "ro". If "rw" and you have problems with efibootmgr, then you probably used wrong agruments. Just give us the exact command and the error message of it.
Top
whitt
Apprentice
Apprentice
Posts: 156
Joined: Mon Dec 28, 2020 10:56 pm

  • Quote

Post by whitt » Sun Jan 10, 2021 7:49 pm

The current live image boots fine, but I haven't been able to write to the drive and achieve a boot. I've gone through the handbook w/out errors twice now. I copied the stage-3 tarball to the usb, along with kernel sources and a binary. I got through the handbook w/out any problems, reboot, and the system goes to the BIOS... I had the same experience with an Arch live USB, a Zen Arch live image too. Ubuntu is the only one I've tried that results in a system that boots into the bootloader. I have no idea why, and don't really care to be honest - I just want it to work.

The kernel version on the gentoo live image is part of my problem - seems like >5.8 gets my network up and running.

As far as the commands used, the last two attempts were performed in the ubuntu installation with networking. I'm literally highlighting the text, and middle-clicking to paste in the chrooted terminal.

I'm waiting on the gentoo chroot to build zen-sources and the mountain of default modules. I'll go through the grub setup after and post back... I haven't done anything to change Ubuntu, so if it works this time... I'll be even more confused, but grateful!
Top
whitt
Apprentice
Apprentice
Posts: 156
Joined: Mon Dec 28, 2020 10:56 pm

  • Quote

Post by whitt » Sun Jan 10, 2021 9:01 pm

Inside the gentoo chroot, I run:

Code: Select all

grub-install --target=x86-64_efi --boot-directory=/boot/efi --bootloader-id=gentoo --recheck
and I get:

Code: Select all

grub-install: error: /usr/lib/grub/x86-64_efi/modinfo.sh doesn't exist.  Please specify --target or --directory.
And make.conf actually has two lines at the end reading: GRUB_PLATFORMS="efi-64"
because I followed directions...

So now what?

This is the loop I'm stuck in - I do ten minutes work, walk away while he machine runs, then come back, post in the forum, and wander off hoping a superhero comes along, then after a time totally out of my control, I come back and try something recommended... this is brutal - thanks for the help.

one question - I'm pointing to /boot/efi in the arguments to grub-install, but I haven't mounted the EFI partition at /boot/efi... Should I? I see "efivars /sys/firmware/efi/efivars type efivars (rw,nosuid,nodev,noexec,relatime)" when I `mount|grep efi` for whatever that's worth. I don't see how that relates to the missing file though...
Top
pietinger
Administrator
Administrator
Posts: 6628
Joined: Tue Oct 17, 2006 5:11 pm
Location: Bavaria

  • Quote

Post by pietinger » Sun Jan 10, 2021 9:06 pm

whitt wrote:

Code: Select all

grub-install --target=x86-64_efi --boot-directory=/boot/efi --bootloader-id=gentoo --recheck
just a typo ... :-)

Try: --target=x86_64-efi

(https://wiki.gentoo.org/wiki/Handbook:A ... Bootloader)
Top
pietinger
Administrator
Administrator
Posts: 6628
Joined: Tue Oct 17, 2006 5:11 pm
Location: Bavaria

  • Quote

Post by pietinger » Sun Jan 10, 2021 9:10 pm

whitt wrote:one question - I'm pointing to /boot/efi in the arguments to grub-install, but I haven't mounted the EFI partition at /boot/efi... Should I? I see "efivars /sys/firmware/efi/efivars type efivars (rw,nosuid,nodev,noexec,relatime)" when I `mount|grep efi` for whatever that's worth. I don't see how that relates to the missing file though...
Yes, you should mount your ESP to /boot ... before
(forget efivarfs; efibootmgr needs it only to talk with UEFI for setting a new boot entry; the third for you; grub2-installation-routine does internal call efibootmgr; you wont see it)
Top
whitt
Apprentice
Apprentice
Posts: 156
Joined: Mon Dec 28, 2020 10:56 pm

  • Quote

Post by whitt » Sun Jan 10, 2021 9:21 pm

OK - so my /dev/sda1 is mounted as /boot/efi. I knew it would be a typo... And this is the one time I'm using my laptop to transcribe from one box to another! Gah!

Now that's fixed, I get:

Code: Select all

echeck
Installing for x86_64-efi platform.
grub-install: error: cannot find EFI directory.
??
Top
pietinger
Administrator
Administrator
Posts: 6628
Joined: Tue Oct 17, 2006 5:11 pm
Location: Bavaria

  • Quote

Post by pietinger » Sun Jan 10, 2021 9:28 pm

whitt wrote:??
Did you mount it to your /boot or did you a mkdir /boot/efi and mounted it to /boot/efi ?

Try this: Mount your /dev/sda1 (your ESP) to /boot and check what is inside your ESP. You should already have a folder named "efi" (or Efi or EFI). This is the folder where your UEFI searches bootable programms.
Top
whitt
Apprentice
Apprentice
Posts: 156
Joined: Mon Dec 28, 2020 10:56 pm

  • Quote

Post by whitt » Sun Jan 10, 2021 9:31 pm

No way - there are howtos out there telling me to mount it to /boot/efi...

Still no dice:

Code: Select all

(chroot) mrblack /usr/src/linux # umount /boot
(chroot) mrblack /usr/src/linux # mount /dev/sda1 /boot
(chroot) mrblack /usr/src/linux # grub-install --target=x86_64-efi --boot-directory=/boot/efi --bootloader-id=gentoo --recheck
Installing for x86_64-efi platform.
grub-install: error: cannot find EFI directory.
(chroot) mrblack /usr/src/linux # ls /boot
EFI  grub
ANd if it's interesting:

Code: Select all

(chroot) mrblack /usr/src/linux # mount |grep efi
efivarfs on /sys/firmware/efi/efivars type efivarfs (rw,nosuid,nodev,noexec,relatime)
(chroot) mrblack /usr/src/linux # mount |grep boot
/dev/sda1 on /boot type vfat (rw,relatime,fmask=0077,dmask=0077,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro)
Top
pietinger
Administrator
Administrator
Posts: 6628
Joined: Tue Oct 17, 2006 5:11 pm
Location: Bavaria

  • Quote

Post by pietinger » Sun Jan 10, 2021 9:46 pm

whitt wrote:No way - there are howtos out there telling me to mount it to /boot/efi...
Dont believe every howto ...

You have two possibilities:

1) Standard installation: Only One ESP mounted to /boot and all inside you need: The folder /efi (with subfolders like windows or gentoo; in these you will find executable files ending ending with xxxx.efi). A second folder for grub or refind, or ...

2) "Naked" ESP only with /efi and nothing else; grub and other stuff in a second partition. This is more complicated ... but if you like this ...

As far as I see you already have a /grub directory in your ESP beside your /EFI. So maybe you should try:

(after already mounted your /sda1 to /boot)

Code: Select all

grub-install --target=x86_64-efi --efi-directory=/boot --removable
read in the wiki (link above) what removable does.
Top
whitt
Apprentice
Apprentice
Posts: 156
Joined: Mon Dec 28, 2020 10:56 pm

  • Quote

Post by whitt » Sun Jan 10, 2021 9:54 pm

OH MY GOD!

So, I'm ashamed to say I didn't go so far in the handbook as to read the "some motherboards..." section...

Code: Select all

Installation finished.  No error reported
I'm sure I'll be back with more stupid questions, thanks a lot for help!

And FWIW, I am assuming the next steps in the handbook are referring to the /dev/sda3 ext4 partition where the kernel and initramfs are located. Handbook doesn't say that, but I'm going to umount the EPS and mount /dev/sda3 as my /boot again.

In case things go sideways, this may be why...
Top
whitt
Apprentice
Apprentice
Posts: 156
Joined: Mon Dec 28, 2020 10:56 pm

  • Quote

Post by whitt » Sun Jan 10, 2021 10:01 pm

I realize now I'm at the point where I exit and reboot...

I'm going to let my last comment hang in the air for a bit while I eat dinner. If anyone has an opinion as to what should be mounted at /boot when I run grub-mkconfig, let me know... maybe you'll prevent me having a bad evening ;)
Top
pietinger
Administrator
Administrator
Posts: 6628
Joined: Tue Oct 17, 2006 5:11 pm
Location: Bavaria

  • Quote

Post by pietinger » Sun Jan 10, 2021 10:05 pm

whitt wrote:[...] mount /dev/sda3 as my /boot again.
Why you want do this ? (I dont understand)

Your ESP is the correct partition which should be mounted to /boot.

If you have another partition try to mount it somewhere (e.g. /mnt/mysecondpartition) and look inside what you have there ...
Top
pietinger
Administrator
Administrator
Posts: 6628
Joined: Tue Oct 17, 2006 5:11 pm
Location: Bavaria

  • Quote

Post by pietinger » Sun Jan 10, 2021 10:11 pm

whitt wrote:[...] If anyone has an opinion as to what should be mounted at /boot when I run grub-mkconfig, let me know... maybe you'll prevent me having a bad evening ;)
For now you should mount /dev/sda1 to your /boot and run grub-mkconfig IF your kernel is also there

If you want to have possibility 2 (later) you can always switch to it (with some copying of needed files and doing some configurations for grub2). But for this I am out of order (I have only a standard grub2-installation as backup, because for daily work I am (secure-)booting a signed stub kernel directly from UEFI).
Top
whitt
Apprentice
Apprentice
Posts: 156
Joined: Mon Dec 28, 2020 10:56 pm

  • Quote

Post by whitt » Sun Jan 10, 2021 10:28 pm

OH what sweet, sweet success!

First, that whole EFI bootloader config process is whack. It isn't very well documented... The jumping from partitions and options in the handbook is handled very poorly...

That said - I just rebooted, and have gentoo up and running with zen 5.9.13. lsmod tells me the the correct (I hope) modules for wifi are loaded, so maybe after I eat I'll be able to get it online.

But now grub doesn't list Ubuntu : ) I'll have to figure that out without breaking anything...

I really appreciate the help!
Top
pietinger
Administrator
Administrator
Posts: 6628
Joined: Tue Oct 17, 2006 5:11 pm
Location: Bavaria

  • Quote

Post by pietinger » Sun Jan 10, 2021 11:42 pm

whitt wrote:OH what sweet, sweet success!
Great to hear that.
whitt wrote:[...] The jumping from partitions and options in the handbook is handled very poorly...
Did you read only the amd64 handbook or also the wiki entries ?

e.g. https://wiki.gentoo.org/wiki/GRUB2

at the end of this document you will find the chapter: "See also" ... with more links

Maybe you are interested in this doc:

https://wiki.gentoo.org/wiki/EFI_stub_kernel

at the end of this document you will find the chapter: "Optional: Secure boot" ... click on the first link to "forums post" ... ;-)

Have fun,
Peter
Top
Goverp
Advocate
Advocate
User avatar
Posts: 2402
Joined: Wed Mar 07, 2007 6:41 pm

  • Quote

Post by Goverp » Mon Jan 11, 2021 9:07 am

whitt wrote:...First, that whole EFI bootloader config process is whack. It isn't very well documented...
I'm currently in the aftermath of changing my laptop to use EFI booting direct to my kernel built with the EFI stub loader support, so I feel your pain.

The trouble isn't so much the quality of the documentation, it's the signal-to-noise ratio on the web. For every correct document, there are hundreds of crap answers from idiots who generalize from ignorance and/or legacy grub and BIOS setups, and get it totally wrong. E.g. people saying "you need the boot flag on your partition". Also, even the good stuff is often based on a misreading of the UEFI spec (at 2,000 pages, that's not a surprise). And the BIOS implementers may be getting it wrong, though not as often as stated on the web.

My latest learning point: my laptop's BIOS deletes efibootmgr items that point to missing boot loaders. I create a vmlinuz.new.efi on installation, and if it works, rename it to vmlinuz.efi. Turns out the BIOS now spots that vmlinuz.new.efi is no longer there, so it deletes the record, so next time I try to boot it, the entry is missing from the boot order. (And on that subject, I'm not sure if the spec requires the boot order managed by efibootmgr to be the list BIOS produces when you hit the special key to choose a boot device; on my box it is, but I think that's a coincidence, not a requirement.)
Greybeard
Top
pietinger
Administrator
Administrator
Posts: 6628
Joined: Tue Oct 17, 2006 5:11 pm
Location: Bavaria

  • Quote

Post by pietinger » Mon Jan 11, 2021 11:09 am

Goverp wrote:[...] my laptop's BIOS deletes efibootmgr items that point to missing boot loaders. [...]
The same here with a gigabyte z270x-gaming k5 mainboard and newest bios.
Top
GDH-gentoo
Advocate
Advocate
User avatar
Posts: 2113
Joined: Sat Jul 20, 2019 7:02 pm
Location: South America

  • Quote

Post by GDH-gentoo » Mon Jan 11, 2021 1:40 pm

whitt wrote:No way - there are howtos out there telling me to mount it to /boot/efi...
That's because, in that case, specifying the --efi-directory option to grub-install is not needed. It's the place where grub-install looks for a mounted FAT filesystem by default (and will assume it's the ESP if it finds one).

As a side effect, it also keeps kernels off the ESP. And yes, it means that there is going to be a /boot/efi/EFI directory.
Goverp wrote:E.g. people saying "you need the boot flag on your partition".
If "your partition" means the ESP, it might be a consequence of GNU Parted's set boot command doing different things for a MS-DOS partition table and a GPT (it is a synonym of set esp for the latter).
Top
Post Reply

26 posts
  • 1
  • 2
  • Next

Return to “Installing Gentoo”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic