LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   LUKS encrypted HD and kernel updates (https://www.linuxquestions.org/questions/slackware-14/luks-encrypted-hd-and-kernel-updates-4175579861/)

l0rddarkf0rce 05-15-2016 03:08 PM

LUKS encrypted HD and kernel updates
 
I have a laptop that has the whole disk encrypted (work requirement) and therefore makes upgrading the kernel a major pain in the a**. I am not using LVM I have everything in just one partition (just to make it easier). The only unencrypted partition is /boot which needs to be like that. So my question is if I want to install the newest kernel (right now I have the stock 14.1 kernel) what would the process be to get this done? The reason that I ask is because I am certain that if I just run

# slackpkg upgrade-all

my old kernel will go bye-bye and therefore the initrd file will no longer be valid and the system will not boot. I am sure I can boot it from CD/chroot and go from there, but i want to safe myself the headache if I can.

TIA for any help/pointers.

gegechris99 05-15-2016 04:13 PM

After you upgrade the packages, you'll need to create a new initrd valid for your new kernel.

If you upgrade using "slackpkg upgrade-all", just don't run lilo when prompted by the script.

To create a new initrd file (after the slackpkg command), run the following command:

Code:

/usr/share/mkinitrd/mkinitrd_command_generator.sh --run /boot/vmlinuz-generic-4.4.10
Replace the last argument by the correct kernel file if kernel is upgraded after this post.

The above command will display the appropriate "mkinitrd" command that you need to run to create a new initrd file consistent with your upgraded system (you should see a "-C" option as you're using an encrypted filesystem).
If you are using a non-english keyboard, you will need to add a "-l fr" option to the "mkinitrd" command (replace fr by your own keyboard layout).

Run the "mkinitrd" command.

Then run:
Code:

/usr/share/mkinitrd/mkinitrd_command_generator.sh --lilo /boot/vmlinuz-generic-4.4.10
to display the section that you have to copy into your /etc/lilo.conf.

After editing /etc/lilo.conf (don't forget to remove any invalid entry like the entry for the previous version of the kernel), run lilo and you should have a functioning kernel upon reboot.

Ilgar 05-16-2016 12:11 AM

Quote:

Originally Posted by l0rddarkf0rce (Post 5545934)
I am certain that if I just run

# slackpkg upgrade-all

my old kernel will go bye-bye

You can also copy your current kernel file (vmlinuz) and initrd under /boot with new names as backups (do this before starting the upgrade of course!), then add the relevant lines back to lilo.conf after the upgrade. If something with the new initrd goes wrong, you can safely boot with the old kernel. Due to the removal of hte /lib/modules/linux-[old kernel] directory, if you boot with the old kernel your system may not be fully functional. To save your old modules you can copy the directory /lib/modules/linux-[old kernel] somewhere else then rename it back before rebooting after the upgrade.


All times are GMT -5. The time now is 06:46 AM.