moving from lilo boot to grub2...how to? Safely?

I have a lilo install that no longer works for adding new kernels. So was suggested I move to grub2. I found rpms and installed, but now what? Anything for grub2 to take defaults from lilo? Or, how do I configure grub2 to boot my existing images? A reminder... a lilo entry that works (running off of now): image = /boot/vmlinuz-5.14.7-Ish-Van label = 5147-Ish-Van append = "rw showopts console=ttyS0,115200n8 console=tty0 printk.time=1 initcall_debug i8042.noaux net.ifnames=0 biosdevname=0 mitigations=off nsmap" root = /dev/sdd2 How would I get grub2 to do the same? Is there a way to setup grub to offer a menu of several previous kernels as well? Also, right now, some of the labels use different root devices (like /dev/sdc2 instead of /dev/sdd2). These are for error recovery when a missing disk has resulted in the root being on a different device. Does grub have something similar to allow me to boot off a different device? Also, FWIW, my previous routine after copying a new kernel to /boot and its modules to /lib/modules, was to run lilo, to update the kernel maps (didn't really care about the modules). That was it. There is no ram disk that it copied or booted from -- it just booted from the raw device. I'd prefer to keep it simple and not use a ram disk as lilo just used the BIOS disk read routines to read the needed sectors into memory and any other devices were built-in to the kernel. Can grub handle that? Thanks much!

On 2023-03-30 03:29, L. A. Walsh wrote:
I have a lilo install that no longer works for adding new kernels.
So was suggested I move to grub2. I found rpms and installed, but now what?
Anything for grub2 to take defaults from lilo? Or, how do I configure grub2 to boot my existing images?
In the past, when YaST supported both for a while, it could be done. Now, dunno. However, you can use YaST to generate a grub2 config from scratch. It will insist on using initrd, though. Maybe you can accept that it does, and later you remove that after the machine boots and runs.
A reminder... a lilo entry that works (running off of now):
image = /boot/vmlinuz-5.14.7-Ish-Van label = 5147-Ish-Van append = "rw showopts console=ttyS0,115200n8 console=tty0 printk.time=1 initcall_debug i8042.noaux net.ifnames=0 biosdevname=0 mitigations=off nsmap" root = /dev/sdd2
How would I get grub2 to do the same?
Not sure. Rather, dunno.
Is there a way to setup grub to offer a menu of several previous kernels as well?
In "/boot/grub2/custom.cfg" you can put your own entries. For example: menuentry 'Auxiliary (por uuid)' --id cer-aux-001 { insmod part_gpt insmod ext2 set root='hd1,gpt3' if search --no-floppy --fs-uuid --set=root f0b68654-... ; then chainloader +1 else echo Could not find this OS instance, will not boot (1) sleep 1 fi } This loads another grub2 pertaining to another openSUSE install. Not directly a kernel. The string "f0b68654-..." is the UUID of that partition, which is "nvme0n1p3", but it is in fact ext4. Correcting that now. I can mail you offlist my file so you can see some more examples. Another entry, for a traditional partitioning: menuentry 'oS 12.3, sda1 (label aux_extrasys)' --id cer-sda1-001 { insmod part_msdos insmod ext2 set root='hd0,msdos1' if search --no-floppy --fs-uuid --set=root 3f875e95-... ; then chainloader +1 else echo Could not find this OS instance, will not boot (3) sleep 1 fi } The entry is obsolete, I no longer have that UUID. Actually, those are the two types of entries I have, there is no point in seeing the rest of the file. I don't have entries that load a kernel, because those change on every update. However, you can see how YaST does it, in a very convoluted manner, in /boot/grub2/grub.cfg. For example, the entry for booting the currently running system in this desktop machine is (I post as quoted, because that way Thunderbird doesn't wrap the lines):
menuentry 'main-os' --class main_os --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-ac173013-...' { load_video set gfxpayload=keep insmod gzio insmod part_gpt insmod ext2 search --no-floppy --fs-uuid --set=root a977c5c3-... echo 'Loading Linux 5.14.21-150400.24.46-default ...' linux /vmlinuz-5.14.21-150400.24.46-default root=UUID=ac173013-... resume=/dev/disk/by-label/nvme-swap splash=verbose verbose echo 'Loading initial ramdisk ...' initrd /initrd-5.14.21-150400.24.46-default }
The string "main-os" comes from "/etc/default/grub": GRUB_DISTRIBUTOR="main-os" That string also names the entry in the ESP partition: Telcontar:~ # ls /boot/efi/EFI/ auxiliary boot main-os Telcontar:~ #
Also, right now, some of the labels use different root devices (like /dev/sdc2 instead of /dev/sdd2). These are for error recovery when a missing disk has resulted in the root being on a different device. Does grub have something similar to allow me to boot off a different device?
Yes.
Also, FWIW, my previous routine after copying a new kernel to /boot and its modules to /lib/modules, was to run lilo, to update the kernel maps (didn't really care about the modules). That was it. There is no ram disk that it copied or booted from -- it just booted from the raw device. I'd prefer to keep it simple and not use a ram disk as lilo just used the BIOS disk read routines to read the needed sectors into memory and any other devices were built-in to the kernel. Can grub handle that?
I suppose it can, but the thing is, the automated way when a kernel is installed/updated by yast/zypper/rpm "simply works". It involves using initrd, sorry. If you want to see a menuentry for a machine with separate /boot partition, I think my old laptop has it. Just ask and I'll boot it to see. No GPT. -- Cheers / Saludos, Carlos E. R. (from 15.4 x86_64 at Telcontar)
participants (2)
-
Carlos E. R.
-
L. A. Walsh