vmlinuz is missing from my system, how to fix it?

13,230
apt-get install --reinstall linux-image-generic

Will only reinstall an empty package which doesn't contain actual kernel code, but exists only for the dependencies it pulls.

What should be (re)installed instead to recover missing /boot files is the package currently pointed as dependency by linux-image-generic. Today that is linux-image-4.15.0-20-generic. So:

apt-get install --reinstall linux-image-4.15.0-20-generic

should make the missing files (re)appear. Actually it contains only the minimally needed file: /boot/vmlinuz-4.15.0-20-generic. Also reinstalling its dependency linux-modules-4.15.0-20-generic will recover a few other missing files in /boot (according to the list):

/boot/System.map-4.15.0-20-generic
/boot/abi-4.15.0-20-generic
/boot/config-4.15.0-20-generic
/boot/retpoline-4.15.0-20-generic
Share:
13,230

Related videos on Youtube

xpt
Author by

xpt

Updated on September 18, 2022

Comments

  • xpt
    xpt over 1 year

    All Linux should come with vmlinuz under "/", and "/boot/" as well. However, my system doesn't have it:

    % ls -l /vmlinuz* /initrd* /boot/vmlinuz*
    ls: cannot access '/vmlinuz*': No such file or directory
    ls: cannot access '/initrd*': No such file or directory
    ls: cannot access '/boot/vmlinuz*': No such file or directory
    

    How can I get all three back?

    I tried,

    apt-get install --reinstall linux-image-generic linux-headers-generic
    update-initramfs -u
    

    Which should have fixed the problem according to the articles I read, because the actual packages do get reinstalled too:

    % apt-get install --reinstall linux-image-generic linux-headers-generic 
    Preparing to unpack .../linux-headers-generic_4.15.0.20.23_amd64.deb ...
    Unpacking linux-headers-generic (4.15.0.20.23) over (4.15.0.20.23) ...
    Preparing to unpack .../linux-image-generic_4.15.0.20.23_amd64.deb ...
    Unpacking linux-image-generic (4.15.0.20.23) over (4.15.0.20.23) ...
    Processing triggers for ureadahead (0.100.0-20) ...
    Processing triggers for install-info (6.5.0.dfsg.1-2) ...
    Processing triggers for systemd (237-3ubuntu10) ...
    Processing triggers for man-db (2.8.3-2) ...
    Setting up linux-image-generic (4.15.0.20.23) ...
    Setting up linux-headers-generic (4.15.0.20.23) ...
    Processing triggers for ureadahead (0.100.0-20) ...
    Processing triggers for systemd (237-3ubuntu10) ...
    

    but I'm still missing the above three files afterwards.

    • A.B
      A.B about 6 years
      Is that after a mistake that deleted those files, or has the system been working without ever having those files? For the second case, I'd suspect the system to be running inside a container (eg a VPS) and then not needing them. Can you tell which case it is?
    • xpt
      xpt about 6 years
      Oh, that's a long story @A.B, but since you asked, no, this is a fresh new system which has never been booted. I get it by copying the Ubuntu Live system onto my HD myself. why i'm doing that is another long story, but in brief, having made such copy, both /vmlinuz and /initrd.img are pointing to the files that are not exist. Thus, in summary, I need to get all three back. Thx.
    • lucidbrot
      lucidbrot about 4 years
      I had a similar problem when I was working with a modified squashfs. The problem happened min my case because I passed -e boot to mksquashfs
  • xpt
    xpt about 6 years
    Please explain again why linux-image-generic_4.15.0.20.23_amd64.deb is not OK again please as the comment has been deleted. I.e., in my OP, there is a line, unpack .../linux-image-generic_4.15.0.20.23_amd64.deb however it didn't work.
  • A.B
    A.B about 6 years
    According to the linked pages, the package linux-image-generic's size once unpacked is 14kb. Following the links, there are two files: /usr/share/doc/linux-image-generic/changelog.gz and /usr/share/doc/linux-image-generic/copyright . On the other hand, the other package, while containing only 3 files, does contain this file: /boot/vmlinuz-4.15.0-20-generic: the kernel. This is enough to trigger the rebuild of the associated initramfs file by update-initramfs -u . The probable reason it was "lost" when copying the image, is that /boot is a separate partition.
  • A.B
    A.B about 6 years
    There's an other (sub-)dependency which contains all kernel modules: linux-modules-4.15.0-20-generic packages.ubuntu.com/bionic/amd64/… . But this was properly copied from the image, so it was not needed to reinstall it. Anyway there are a few /boot files in it (like /boot/System.map*), so I will add it to the answer.