Slackware

Slackware Logo

How to repair a boot record

What we're doing here is making a parallel Linux directory structure, and then making it the root directory. We can then edit lilo.conf and have its changes affect booting correctly.

    cd /mnt
    mkdir /mnt/slack
    mount /dev/sda1 /mnt/slack
    mkdir -p dev proc sys
    mount --bind /dev dev
    mount --bind /proc proc
    mount --bind /sys sys
    chroot .
    vi /etc/lilo.conf
    /sbin/lilo -C /etc/lilo.conf

Another more descriptive method can be found in the Slackware Wiki.

Kernel upgrades

The default Slackware kernel has almost every module under the sun compiled into it. That makes it very versatile, but there are a lot of modules that get loaded unnecessarily. I like to use the "generic" Slackware kernel instead. This kernel requires an "initrd.gz" RAM disk though, since there are some modules that have to be loaded at boot time, ahead of the kernel itself. For example, my /boot partition runs on an EXT4 volume so I need to include the EXT4 module in the ramdisk in order to boot successfully.

Slackware has a tool included with it that is called mkinitrd. This tool will create the ramdisk for you, provided you tell it which kernel you want to build a ramdisk for. Here's the command that I use:

# mkinitrd -c -k 4.4.38-smp -m ext4

I run this from the /boot directory as root. This is telling the tool to clear the initrd tree (-c), the kernel I'm running (-k), and the modules I know I need. The tool does a pretty good job of finding out what you'll need, but if you know ahead of time, that'll help. Make sure and run lilo afterwards, and make sure your lilo.conf lists the initrd.gz file that you want to load.