LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 06-10-2023, 12:28 PM   #1
mfoley
Senior Member
 
Registered: Oct 2008
Location: Columbus, Ohio USA
Distribution: Slackware
Posts: 2,569

Rep: Reputation: 177Reputation: 177
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:
Code:
/dev/sda1        swap             swap        defaults         0   0
/dev/sda3        /                ext4        defaults         1   1
/dev/sda2        /boot/efi        vfat        defaults         1   0
I then mounted:
Code:
mount /dev/sda3 /mnt
mount /dev/sda2 /mnt/boot/efi
I then restored the backup of my MBR system:
Code:
cd /mnt
tar -xvf backup.tar.bz2
I then copied files to /mnt/boot/efi:
Code:
ls -l /boot/efi/EFI/Slackware/
total 11564
-rwxr-xr-x 1 root root      153 2023-04-01 22:11 elilo.conf*
-rwxr-xr-x 1 root root   238531 2018-06-12 19:01 elilo.efi*
-rwxr-xr-x 1 root root 11593312 2023-02-18 00:26 vmlinuz*
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.

What am I missing?

Last edited by mfoley; 06-10-2023 at 12:47 PM.
 
Old 06-10-2023, 02:32 PM   #2
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,360

Rep: Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591
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
 
Old 06-10-2023, 03:28 PM   #3
mfoley
Senior Member
 
Registered: Oct 2008
Location: Columbus, Ohio USA
Distribution: Slackware
Posts: 2,569

Original Poster
Rep: Reputation: 177Reputation: 177
Thanks!
Quote:
Originally Posted by colorpurple21859 View Post
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,
Tried that. When it booted I got the "GNU GRUB version 2.06" menu with:
Code:
Slackware-15.0 GNU/Linux
Advanced options for Slackware-15.0 GNU/Linux
3 seconds later it took the default (1st) option. That gave me:
Code:
Booting `Slackware-15.0 GNU/Linux'

Loading Linux 5.15.94 ...
Loading initial ramdisk ...
It started booting, but ended with:
Code:
:
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:
Code:
chooser=simple
delay=1
timeout=1
#
image=vmlinuz
     label=vmlinuz
     read-only
     append="root=/dev/sda3 vt.default_utf8=1 vga=normal ro"
I tried copying that elilo.conf and vmlinux to slackware-15.0, but same error.

Last edited by mfoley; 06-10-2023 at 03:30 PM.
 
Old 06-10-2023, 04:11 PM   #4
Loomx
Member
 
Registered: Sep 2012
Distribution: Slackware
Posts: 184

Rep: Reputation: Disabled
Are you wanting to use grub or elilo?

Do you have an initrd.gz?
 
Old 06-10-2023, 04:46 PM   #5
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,360

Rep: Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591
Quote:
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.
 
Old 06-10-2023, 05:54 PM   #6
mfoley
Senior Member
 
Registered: Oct 2008
Location: Columbus, Ohio USA
Distribution: Slackware
Posts: 2,569

Original Poster
Rep: Reputation: 177Reputation: 177
Quote:
Originally Posted by Loomx View Post
Are you wanting to use grub or elilo?
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 View Post
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:
Code:
chooser=simple
delay=1
timeout=1
#
image=vmlinuz
     label=vmlinuz
     read-only
     append="root=/dev/sda3 vt.default_utf8=1 vga=normal ro"
fstab:
Code:
/dev/sda1        swap             swap        defaults         0   0
/dev/sda2        /boot/efi        vfat        defaults         1   0
/dev/sda3        /                ext4        defaults         1   1
#/dev/cdrom      /mnt/cdrom       auto        noauto,owner,ro,comment=x-gvfs-show 0   0
/dev/fd0         /mnt/floppy      auto        noauto,owner     0   0
devpts           /dev/pts         devpts      gid=5,mode=620   0   0
proc             /proc            proc        defaults         0   0
tmpfs            /dev/shm         tmpfs       nosuid,nodev,noexec 0   0
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

Last edited by mfoley; 06-10-2023 at 06:11 PM.
 
Old 06-10-2023, 06:04 PM   #7
Loomx
Member
 
Registered: Sep 2012
Distribution: Slackware
Posts: 184

Rep: Reputation: Disabled
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.

Last edited by Loomx; 06-10-2023 at 06:06 PM.
 
Old 06-10-2023, 07:10 PM   #8
JayByrd
Member
 
Registered: Aug 2021
Location: Seattle, WA
Distribution: Slackware
Posts: 300

Rep: Reputation: 309Reputation: 309Reputation: 309Reputation: 309
Quote:
Originally Posted by mfoley View Post
...

I did post the /boot/efi/EFI/Slackware/elilo.conf in my last post, but here it is:
Code:
chooser=simple
delay=1
timeout=1
#
image=vmlinuz
     label=vmlinuz
     read-only
     append="root=/dev/sda3 vt.default_utf8=1 vga=normal ro"
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.

Sorry for the noise.

Last edited by JayByrd; 06-10-2023 at 07:25 PM.
 
Old 06-10-2023, 08:17 PM   #9
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,360

Rep: Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591
At the grub menu press e for edit
change the linux line to
Code:
linux /boot/vmlinuz-huge root=/dev/sda3 ro
ctrl-x to boot.

Last edited by colorpurple21859; 06-10-2023 at 08:38 PM.
 
Old 06-10-2023, 11:36 PM   #10
enorbet
Senior Member
 
Registered: Jun 2003
Location: Virginia
Distribution: Slackware = Main OpSys
Posts: 4,785

Rep: Reputation: 4435Reputation: 4435Reputation: 4435Reputation: 4435Reputation: 4435Reputation: 4435Reputation: 4435Reputation: 4435Reputation: 4435Reputation: 4435Reputation: 4435
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.
 
Old 06-11-2023, 05:52 AM   #11
henca
Member
 
Registered: Aug 2007
Location: Linköping, Sweden
Distribution: Slackware
Posts: 976

Rep: Reputation: 665Reputation: 665Reputation: 665Reputation: 665Reputation: 665Reputation: 665
Quote:
Originally Posted by mfoley View Post
Code:
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 View Post
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?

Quote:
Originally Posted by mfoley View Post
Code:
chooser=simple
delay=1
timeout=1
#
image=vmlinuz
     label=vmlinuz
     read-only
     append="root=/dev/sda3 vt.default_utf8=1 vga=normal ro"
fstab:
Code:
/dev/sda1        swap             swap        defaults         0   0
/dev/sda2        /boot/efi        vfat        defaults         1   0
/dev/sda3        /                ext4        defaults         1   1
#/dev/cdrom      /mnt/cdrom       auto        noauto,owner,ro,comment=x-gvfs-show 0   0
/dev/fd0         /mnt/floppy      auto        noauto,owner     0   0
devpts           /dev/pts         devpts      gid=5,mode=620   0   0
proc             /proc            proc        defaults         0   0
tmpfs            /dev/shm         tmpfs       nosuid,nodev,noexec 0   0
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.

regards Henrik
 
Old 06-11-2023, 07:04 AM   #12
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,360

Rep: Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591
Quote:
haven't used elilo or grub much myself though.
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.
 
Old 06-12-2023, 04:51 PM   #13
mfoley
Senior Member
 
Registered: Oct 2008
Location: Columbus, Ohio USA
Distribution: Slackware
Posts: 2,569

Original Poster
Rep: Reputation: 177Reputation: 177
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.
 
Old 06-13-2023, 02:35 PM   #14
mfoley
Senior Member
 
Registered: Oct 2008
Location: Columbus, Ohio USA
Distribution: Slackware
Posts: 2,569

Original Poster
Rep: Reputation: 177Reputation: 177
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.

Thanks

Last edited by mfoley; 06-13-2023 at 03:14 PM.
 
Old 06-13-2023, 08:34 PM   #15
Loomx
Member
 
Registered: Sep 2012
Distribution: Slackware
Posts: 184

Rep: Reputation: Disabled
Are these assumptions correct?
- you are using elilo?
- you are booting the huge kernel?
- you are not using an initrd?

If so, all you need to do is put the new kernel where elilo can find it, i.e. copy the new huge kernel over the old one in the EFI partition.
Code:
cp /boot/vmlinuz-huge /boot/efi/EFI/Slackware/vmlinuz
 
  


Reply

Tags
mbr, uefi



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Converting between UEFI and Legacy boot mfoley Slackware 32 04-06-2023 11:02 AM
UEFI Class 3 :: To use UEFI, or not to use UEFI? jheengut Slackware 19 12-30-2020 09:24 AM
LXer: PXE booting with UEFI hardware continued LXer Syndicated Linux News 0 03-27-2020 04:52 AM
Dual boot legacy and UEFI CodeMan99 Linux - Software 1 11-05-2018 07:11 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 05:50 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration