This is an old revision of the document!
Table of Contents
Switching from Lilo to Grub2 (legacy/mode bios mbr)
Introduction
If you use UEFI and/or GPT, then don't use this. If you still want to use it, you can probably set your UEFI to BIOS legacy mode and deactivate GPT. This is meant to be simple. For now it's how to do it after you installed and booted into your new Slackware installation. I'll add later extra steps how to do it in a shell after the installation but before rebooting.
Summary:
cd /etc/grub.d/ chmod -x 20_linux_xen 30_os_prober 30_uefi_firmware 41_custom nano /etc/grub.d/40_custom grub-mkconfig -o /boot/grub/grub.cfg nano /boot/grub/grub.cfg grub-install /dev/sda
Preparations
cd /etc/grub.d
Deactivate autoconfig files according to your need, example:
chmod -x 20_linux_xen 30_os_prober 30_uefi_firmware 41_custom
Generating a useful template (optional)
Grub2 is not very intuitive to write a config entries for, so you can modify a good example to your need instead. Pipe some examples to a file:
grub-mkconfig > examples.file
Copy one of the examples to another file or overwrite the current file with one example only. (Including curly brackets)
Then append the example in the file to the custom grub entry file: (You need to append the info into the file, as you need to preserve the uncommented info already there, lest it should not work.)
cat examples.file >> 40_custom
Edit custom config
Edit the custom entry to fit whatever you want to do..
nano /etc/grub.d/40_custom
Some useful tools you can use for info here: blkid, fstab
huge.s root=/dev/sdaX initrd= ro
Ps. By root is meant the location of your Slackware root and could be for example /dev/sda5
Config
Once you are ready or think so, you can prepare grub: (this generates the config file from any executable files in /etc/grub.d/ and replaces editing menu.lst from grub1)
grub-mkconfig -o /boot/grub/grub.cfg
The above generates the necessary files in /boot/grub including the config file. Every time you CHANGE anything in the config folder /etc/grub.d/, you need to run the above command again for it to take effect. You can now inspect the /boot/grub/grub.cfg file to evaluate if it looks right.
Install
Then INSTALL grub: (this example installs to master boot record on the first disk, you could install it to a boot disk or elsewhere instead..)
grub-install /dev/sda
You should be given feedback about it being successfull or not. Then cross your fingers and reboot.
Doing these steps during your Slackware installation
You can do these steps when you install and set up Slackware with a CD or USB, by dropping into a shell after the installation. Simply “finish” the installation and don't reboot or exit, but select the shell option. The Slackware installation has already mounted your root filesystem and any other partitions you used during the installation into /mnt. You can also do that manually if you reboot and boot into the cd/usb again, or if something is not right.
mount /dev/sdaX /mnt
Once that is done, all you need to do is set up a proper working environment by mounting /dev, /proc and /sys into the root filesystem on /mnt, before chrooting into it.
mount -o bind /dev/ /mnt/dev/ mount -o bind /proc/ /mnt/proc/ mount -o bind /sys/ /mnt/sys/
If all went well, you can change root into your Slackware root filesystem currently on /mnt (or any other location you may have used instead)..
chroot /mnt
Once this is done, you can proceed to do configuration and installation of Grub2 as described above.
Sources
* Originally written by zeebra