Upgrading the Linux Kernel when Using a USB Boot Disk
2013-May-10, Friday 22:42![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
In order to protect any sensitive data on my work laptop, I use full-drive encryption. To aid recovery in case of theft, it normally boots to a honeypot installation of Windows with Prey installed. To boot into Linux, one must use a USB boot disk[1] which contains the contents of /boot.
Once in a while, it is necessary to upgrade the kernel. I don't do this very often, so it seems like the sort of process which should be documented.
- Mount /boot read-write:
`mount -o rw /boot`
I generally have /boot mounted read-only, in part because I don't usually have the thumbdrive plugged in (I don't boot very often, after all), and to ensure I don't accidentally make changes to it without being prepared to undergo this full process. - Install kernel updates:
`sudo aptitude full-upgrade`
- Reboot. Pray it works.
- Insert backup boot disk. (Just in case the thumbdrive on my keychain goes bad or gets lost.)
- Copy files from the updated boot disk to the backup:
`rsync -av /boot /media/usb2`
- Remove the original boot disk. This will help prevent unfortunate mistakes.
- Alter grub.cfg of backup boot disk to refer to the proper UUID:
`sudo sed -i s/$UUID_OF_BOOT/$UUID_OF_BACKUP/ grub/grub.cfg`
`blkid`
comes in handy for finding the relevant UUIDs. - Reboot. Pray it works.
Assuming both boot disks successfully boot the machine with the updated kernel, congratulations! You have successfully updated the kernel!
[1] It's not quite as much a waste of a thumbdrive as you might think. The sticks have a FAT partition of ~90% or so of the advertised capacity, so they can still be used to transfer files between computers or for data storage.
linux boot key
Date: 2013-May-30, Thursday 03:08 (UTC)Re: linux boot key
Date: 2013-Jun-01, Saturday 02:58 (UTC)It was a while ago, so my memory's a bit hazy, but I'm pretty sure all I did was tell the Debian installer to make a partition on /dev/usbN and put /boot there. Next time I install a machine with a USB boot disk I'll write down what I did, but it's not something I do regularly.
Though the backup boot thumbdrive was a bit more involved. IIRC, had to run grub-install for that (presumably I could have just copied the raw device of the original stick onto the backup, but that did not occur to me at the time).
Re: linux boot key
Date: 2013-Jun-17, Monday 04:47 (UTC)I ended up having to redo my backup boot disk due to a Debian Squeeze to Wheezy upgrade, and documented the process. Hopefully that helps.