Converting between UEFI and Legacy boot, continued
SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Converting between UEFI and Legacy boot, continued
I've just attempted to convert a MBR system to UEFI. It's not entirely working. I booted the Slackware 15.0 installation disk and created the needful partitions:
That's all I did. I tried rebooting. To start, I got a "GNU GRUB version 2.06" screen with the following selections:
Code:
Slackware 15.0 huge.s kernel
Slackware 15.0 huge.s kernel (use KMS console)
Detect/boot any installed operation system
I selected "Detect/boot any installed operation system". I got another GRUB 2.06 screen with:
Code:
Linux /boot/vmlinuz-huge
Linux /boot/vmlinuz-huge (single)
Linux /boot/vmlinuz-huge-5.15.94
Linux /boot/vmlinuz-huge-5.15.94 (single)
Linux /boot/vmlinuz-generic
Linux /boot/vmlinuz-generic (single)
Linux /boot/vmlinuz-generic-5.15.94
Linux /boot/vmlinuz-generic-5.15.94 (single)
Linux /boot/vmlinuz-generic
(hd0,gpt2)/efi/Slackware/elilo.efi
I selected "(hd0,gpt2)/efi/Slackware/elilo.efi". I got:
Code:
(a bunch of the following starting with ram1)
010f 16384 ram15
(driver?)
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
CPU: 4 PID: 1 Comm: swapper/0 Not tainted 5.15.94 #1
Hardware name: Microsoft Corporation Virtual Machine/Virtual Machine, BIOS Hyper-V UEFI Release v4.1 12/03/2020
Call Trace:
<TASK>
dump_stack_lvl+0x34/0x48
panic+0x107/0x2be
mount_block_root+0x13f/0x16a
prepare_namespace+0x13b/0x16a
? reset_init+0xd0/0xd0
kernel_init+0x16/0x120
ret_from_fork+0x1f/0x30
</TASK>
Kernel Offset: 0x11000000 (relocation range: 0xfffffff80000000-0xffffffffbfffffff)
---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0) ]---
On scratch-installed UEFI systems I get none of those GRUB screens, it just boots.
This is the first time I've attempted to convert a MBR boot system to UEFI. Obviously I'm missing something. When I used to do restores like this of MBR boot system backup I had to do:
Code:
mount --bind /dev /mnt/dev
mount --bind /proc /mnt/proc
mount --bind /sys /mnt/sys
chroot /mnt
lilo
exit
I've done nothing like that here. No lilo, no elilo, no grub, just copying those files to /boot/efi/EFI/Slackware.
Now, I could run the DVD setup program, then restore from the backup excluding /boot, but I do this restore procedure often enough I'd like to not have to do it that way.
mount /dev/sda3 /mnt
mount /dev/sda2 /mnt/boot/efi
mount --bind /dev /mnt/dev
mount --bind /proc /mnt/proc
mount --bind /sys /mnt/sys
chroot /mnt
grub-install —target=x86_64-efi
grub-mkconfig -o /boot/grub/grub.cfg
exit
Reboot,
If you have option on bios to boot from file, navigate to efi/slackware-15.0/grubx86.efi
:
Run /init as init process
udevd[250]: starting eudev-3.2.11
No kernel modules found for Linux 5.15.94.
mount: can't find /mnt in /etc/fstab
ERROR: No /sbin/init found on rootdev (or not mounted). Trouble ahead.
You can try to fix it. Type 'exit' when things are done.
/bin/sh: can't access tty: job control turned off
/ #
Quote:
If you have option on bios to boot from file, navigate to efi/slackware-15.0/grubx86.efi
I do have a 'boot from file' which is set to grubx64.efi, and I can't navigate to something else.
I did see that your suggested procedure created another directory on the efi partition:
Code:
# This one I had created originally
/boot/efi/EFI/Slackware/
elilo.conf
elilo.efi
vmlinuz
# This one appeared after your GRUB procedure
/boot/efi/EFI/slackware-15.0/
grubx64.efi
The new folder has no elilo.conf or vmlinuz. My original elilo.conf has:
The new folder has no elilo.conf or vmlinuz. My original elilo.conf has:
Elilo and grub are two different boot loaders and don't work the same way. Elilo needs elilo.conf elilo.efi vmlinuz and initrd.gz to be on the efi partition. With slackware grub only needs the grubx64.efi on the efi partition. Some of the other distros also need the grub.cfg along with grubx64.efi file.
Quote:
It started booting, but ended with:
You may need to rerun mkinitrd or genmkinitrd.
Try one of the menu entries under advance options.
edit: what is the contents of elilo.conf on the efi partition and what is in
/etc/fstab of the installed system?
Last edited by colorpurple21859; 06-10-2023 at 05:06 PM.
Well, I used elilo on the working UEFI computer I have, and I'm kind of used to lilo generally. Plus, I've read that [e]lilo is best for RAID configs, but I haven't gotten that far yet.
Quote:
Do you have an initrd.gz?
No, I don't bother with initrd. I just use the Huge kernel ... if we're talking about the same thing. On my working elilo UEFI system I removed the initrd line from elilo.conf. I copied /boot/vmlinuz-huge-5.15.94 to /boot/efi/EFI/Slackware/vmlinuz, both on my working UEFI and this new one I'm trying to install.
Quote:
Originally Posted by colorpurple21859
Elilo and grub are two different boot loaders and don't work the same way. Elilo needs elilo.conf elilo.efi vmlinuz and initrd.gz to be on the efi partition.
That is exactly what I had before making my initial post (less the initrd.gz), but didn't work as described in post #1.
Quote:
With slackware grub only needs the grubx64.efi on the efi partition. Some of the other distros also need the grub.cfg along with grubx64.efi file.
Well, after following your instructions for grub, that grubx64.efi was the only file in /boot/efi/EFI/slackware-15.0/, as I hope was clear in my last post.
Quote:
You may need to rerun mkinitrd or genmkinitrd.
Can I forego initrd?
Quote:
Try one of the menu entries under advance options.
Did that. Same result.
Quote:
edit: what is the contents of elilo.conf on the efi partition and what is in
/etc/fstab of the installed system?
I did post the /boot/efi/EFI/Slackware/elilo.conf in my last post, but here it is:
I just tried chroot to the new system (on /mnt), running eliloconfig, copying vmlinuz-huge-5.15.94 to /boot/efi/EFI/Slackware/vmlinuz and removing the initrd line from /boot/efi/Slackware/elilo.conf, just like I did on my running system, but it still comes up with the GRUB menu
It looks to me like you are keen to keep things as simple as possible (good plan!), i.e. using the huge kernel, using elilo due to it being similar to lilo.
With that in mind, I would suggest this slight adaption to your previous lilo workflow:
Code:
mount --bind /dev /mnt/dev
mount --bind /proc /mnt/proc
mount --bind /sys /mnt/sys
chroot /mnt
eliloconfig ## this is the only change ##
exit
eliloconfig is just a script you can examine. It install elilo and also does a few extra crucial steps such as using `efibootmgr' to add a UEFI boot entry for Slackware.
If it asks you any questions, go with what it recommends.
ps Make sure your /boot/vmlinuz symlink points to the huge kernel first.
This is just a shot in the dark, but I notice one small difference between your elilo.conf and the docs at slackware. Namely, in the example, "root=/dev/sda3" has its own line in the elilo.conf stanza, (as opposed to part of the kernel command line "append.")
Perhaps elilo itself needs to be passed the rootdev for some reason.This may explain the error from your previous post:
Quote:
Code:
No kernel modules found for Linux 5.15.94.
mount: can't find /mnt in /etc/fstab
ERROR: No /sbin/init found on rootdev (or not mounted).
Again, I'm not sure if this is the problem, not having much UEFI experience myself, but I figure it's worth a shot.
EDIT: Please kindly disregard, as I just booted up my only working UEFI box and found that elilo works just fine with "root=/dev/sdX" as part of the append line... oops.
If, by chance, you're not wanting to learn grub, you could just install rEFInd from SBo which has a nearly identical syntax to elilo but will search for any bootable kernels (if you so desire), handles RAID (if you wish it to), handles multibooting even of the same device with different kernels or other systems entirely, and much more.
BTW rEFInd is not only human readable but the included default "/EFI/refind/refind.conf" has verbose explanations of each option as well as examples for different systems and options.
It might also be useful either when chroot-ing in or installing to run "efibootmgr" to get an entry in firmware. I like a bit of redundancy but that's totally up to you as rEFInd doesn't need it.
Run /init as init process
udevd[250]: starting eudev-3.2.11
No kernel modules found for Linux 5.15.94.
mount: can't find /mnt in /etc/fstab
ERROR: No /sbin/init found on rootdev (or not mounted). Trouble ahead.
You can try to fix it. Type 'exit' when things are done.
Quote:
Originally Posted by mfoley
No, I don't bother with initrd. I just use the Huge kernel ...
There is something odd going on here... During boot, your kernel tries to mount something below /mnt, but it doesn't find /mnt in fstab. Are you sure that you have given a huge kernel and no initrd to the boot loader? Maybe that kind of error message could come even with a huge kernel if it is booted with a more or less broken initrd?
I just tried chroot to the new system (on /mnt), running eliloconfig, copying vmlinuz-huge-5.15.94 to /boot/efi/EFI/Slackware/vmlinuz and removing the initrd line from /boot/efi/Slackware/elilo.conf, just like I did on my running system, but it still comes up with the GRUB menu
The above seems fine, but somehow your currently installed boot loader seems broken.
I haven't used elilo or grub much myself though. Usually I prefer MBR boot, but if I have to do UEFI I usually use syslinux/extlinux.
grub-mkconfig defaults to root=uuid=xxxx therefore requires an initrd. Changing the grub menu entry to root=/dev/xxxx overcomes the no initrd problem if there are no other problems with the system. The vmlinuz-huge points to the huge kernel and grub-mkconfig doesn't need to be run with kernel upgrades.
Last edited by colorpurple21859; 06-11-2023 at 07:08 AM.
Sorry for the delay in replying on this thread. The server I'm trying to set up is on a remote host and I've lost connection to it. The administrator for that machine has been on a camping trip. As soon as I regain connection. I'll get back into this thread. Thanks for your help so far.
System is back. I checked all the possibilities you all raised. I could not find any reference to /mnt. I tried several different way of converting my BIOS MBR system to UEFI, all failed. I decided to give up and install from scratch from the installation DVD. That worked just fine. So for now, an easy way to convert from MBR to UEFI is not within reach.
One last question on this. The installation DVD setup program did install initrd in /boot/efi/EFI/Slackware. I am doing a 'slackpkg ugrade-all' right now, which will install a new kernel. What do I have to do the reference the new kernel and/or initrd? I've never upgraded UEFI before, nor ever used initrd. With the MBR/lilo system I had to run lilo after a kernel upgrade or the system would not boot.
Following the upgrade it says,
Quote:
Your System has been updated and lilo does not appear to be used on your system. You may need to adjust your boot manager (like GRUB) to boot the appropriate kernel (after generating an initrd if required). Press enter to continue.
I'm not going to try rebooting until I hear back on what the "adjusting boot manager" and "generating initrd" procedures are ... if any.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.