How to restore deleted files in /boot? (vmlinuz missing, system does not boot)
Solution 1:
vmlinuz
is the Linux kernel image itself (the z indicates that it is compressed).
Reinstalling the kernel package that is currently referenced by linux-image-generic (or your HWE kernel) and probably linux-singed-image-generic in UEFI secure boot environments should solve your issue.
Reinstalling a kernel from a chroot
Preferably boot live media of the same version and mount the partition of your installation (you can do that with Nautilus, it will be something like /media/ubuntu/…
then) or your /boot
partition (this will be a bit more complex). This will be ${my_installation}
in the following instructions.
Look into /lib/modules/
of your installation (${my_installation}/lib/modules/
) for the particular kernel versions that were installed and pick the latest version number you can find, this is referenced as ${kernel_ver}
in the following instructions, in my test VM it was 3.16.0-46.
As I stated in a comment before, the procedure is very similar to reinstalling Grub in chroot, so let me quote this answer with some slight modifications:
Bind mount some other necessary stuff:
for i in /sys /proc /run /dev; do sudo mount --bind "$i" "${my_installation}$i"; done
chroot
into your Ubuntu install:sudo chroot ${my_installation}
At this point, you're in your install, not the live session, and running as root. …
Now reinstall your kernel (the signed
package is for UEFI secure boot):
apt-get install --reinstall linux-image-${kernel_ver}-generic linux-signed-image-${kernel_ver}-generic
Check the /boot
directory if the initrd
for this kernel is still missing. To generate it manually run:
mkinitramfs -o /boot/initrd.img-${kernel_ver}-generic ${kernel_ver}-generic
My example:
mkinitramfs -o /boot/initrd.img-3.16.0-46-generic 3.16.0-46-generic
Then run update-grub
like in the quoted answer so that you can be sure that the "new" kernel and initrd are included.
If you need to reinstall Grub too you can follow the the remaining steps. Remember that these instructions were written for MBR, if you have UEFI (where bootloaders from different OSes shouldn't overwrite each other) you need to check that grub-efi-amd64-bin
is installed install before reinstalling Grub.