How to run update-initramfs from bootable usb?

30,197

Solution 1

I had a similar issue involving the update-initramfs is disabled since running on read-only media error message. If you look at the script you can see that it is just a wrapper script to mkinitramfs.

whereis update-initramfs
update-initramfs: /usr/sbin/update-initramfs …
gedit /usr/sbin/update-initramfs

So you could call mkinitramfs directly:

mkinitramfs -o /boot/initrd.img-${kernel_ver}-generic ${kernel_ver}-generic

More details about reinstalling kernel and initrd images from live media/chroot in the link above.

Solution 2

You mention chrooting into new ubuntu install. Run

sudo update-initramfs -u -k all

all FROM INSIDE the chroot

Share:
30,197

Related videos on Youtube

Josh
Author by

Josh

Updated on September 18, 2022

Comments

  • Josh
    Josh almost 2 years

    My computer froze during an upgrade from ubuntu 12.04 to 14.04.

    This resulted in a kernel panic upon reboot.

    /sbin/init: relocation error: /lib/i386-linux-gnu/librt.so.1: symbol__clock_nanosleep, version GLIBC_PRIVATE not defined in file libc.so.6 with link time reference.
    

    [followed by some kernel panic stuff]

    I booted from usb and finished the upgrade via by chroot into the drive and running: sudo apt-get dist-upgrade (as well as a few other commands as described in: Recover from shutdown during Ubuntu distribution upgrade)

    Basically it appears to have finished the upgrade, but it did not produce a new boot image: update-initramfs is disabled since running on read-only media

    Since I cannot boot into older kernel versions, is there a way to produce a new boot image (i.e. something that would be in /boot/) from the usb.

    As further clarification, when chrooted, uname -a yields the updated kernel, but no corresponding kernel image is in the /boot of the drive.

    Could use some advice.

  • Josh
    Josh about 9 years
    Thanks for your answer. At the time of my original post, I had tried running "sudo update-initramfs" from inside the chroot. When within "sudo apt-get dist-upgrade", it uses initramfs, it gave an error and if I tried directly using "sudo update-initramfs", the same error came up then as while it was running.
  • linuxdev2013
    linuxdev2013 about 9 years
    still having issues or did you get it sorted out? If not, try adding mount --bind /run /sys /mntpt/{dev,sys}
  • Josh
    Josh about 9 years
    I did a fresh install, so I didn't really answer my original question. I played around with "--bind" when I mounted, but I still had trouble running update-initramfs even when I mounted that way and was in chroot. Perhaps, if done correctly, that would have worked?
  • linuxdev2013
    linuxdev2013 about 9 years
    feel free to reference my write up which shows way to do it (substitute drive / mount points as suits your needs... for this particular question lines 89-91 are showing mount --bind properly done. gist.github.com/linux-modder/55e49074ff947ca0f97c
  • Gabriel Staples
    Gabriel Staples almost 5 years