How to run update-initramfs from bootable usb?

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.


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