Score:1

update-initramfs: failed

cn flag
2.1

Recently I restored accidentally deleted /share folder of Ubuntu-21.04 by copying it from a live Ubuntu-21.04, and somehow managed to start the computer. Since then Computer is working fine, but following is the issue:

Part-1

My computer (Ubuntu-21.04) boots only in kernal 5.11.0-25, out of three kernels 5.11.0-37, 5.11.0-34, and 5.11.0-25.

Boot gets stuck in Kernels (*37*, *34*), gives the error:

end kernel panic -not sync: vfs : unable to mount root fs on unknown block [0 0]

Part-2

If I boot in the kernel 5.11.0-25, then problem is that I am unable to install any packages, or upgrade the ubunutu. It gives following set of errors for any installation or upgradation.

Output of sudo apt update

Hit:1 http://in.archive.ubuntu.com/ubuntu hirsute InRelease
Hit:2 http://in.archive.ubuntu.com/ubuntu hirsute-updates    InRelease
Hit:3 http://in.archive.ubuntu.com/ubuntu hirsute-backports InRelease
Hit:4 http://archive.ubuntu.com/ubuntu groovy InRelease
Get:5 http://security.ubuntu.com/ubuntu hirsute-security InRelease [110 kB]
Fetched 110 kB in 1s (146 kB/s)   
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
All packages are up to date.

Output of sudo apt upgrade:

 Reading package lists... Done
 Building dependency tree... Done
 Reading state information... Done
 Calculating upgrade... Done
 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
 2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up initramfs-tools (0.139ubuntu3) ...
update-initramfs: deferring update (trigger activated)
Setting up linux-image-5.11.0-37-generic (5.11.0-37.41) ...
Processing triggers for initramfs-tools (0.139ubuntu3) ...
update-initramfs: Generating /boot/initrd.img-5.11.0-25-generic
Error: /sbin/zdb is not executable.
Error: /sbin/zpool is not executable.
Error: /sbin/zfs is not executable.
Error: /sbin/mount.zfs is not executable.
Error: /lib/udev/vdev_id is not executable.
Error: /lib/udev/zvol_id is not executable.
E: /usr/share/initramfs-tools/hooks/zfs failed with return 2.
update-initramfs: failed for /boot/initrd.img-5.11.0-25-generic    with 2.
dpkg: error processing package initramfs-tools (--configure):
installed initramfs-tools package post-installation script    subprocess returned error exit status 2
Processing triggers for linux-image-5.11.0-37-generic    (5.11.0-37.41) ...
/etc/kernel/postinst.d/initramfs-tools:
update-initramfs: Generating /boot/initrd.img-5.11.0-37-generic
Error: /sbin/zdb is not executable.
Error: /sbin/zpool is not executable.
Error: /sbin/zfs is not executable.
Error: /sbin/mount.zfs is not executable.
Error: /lib/udev/vdev_id is not executable.
Error: /lib/udev/zvol_id is not executable.
E: /usr/share/initramfs-tools/hooks/zfs failed with return 2.
update-initramfs: failed for /boot/initrd.img-5.11.0-37-generic    with 2.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with    return code 2
dpkg: error processing package linux-image-5.11.0-37-generic    (--configure):
installed linux-image-5.11.0-37-generic package post-installation    script subprocess returned error exit 
status 1
 Errors were encountered while processing:
initramfs-tools
 linux-image-5.11.0-37-generic
 E: Sub-process /usr/bin/dpkg returned an error code (1)

File system

/dev/sdb2 ext4 19G 16G 1.6G 92% /

/dev/sdb1 vfat 380M 6.9M 373M 2% /boot/efi

2.1 avatar
cn flag
2.1
@Nmath, Ubuntu version is mentioned on top of post. I have mentioned that I get the same set of errors while installing any package or upgrading.
2.1 avatar
cn flag
2.1
@Nmath Updated Question for more clarity
2.1 avatar
cn flag
2.1
@Nmath. I have answerd your all three question in post. Request you to see the post again
Nmath avatar
ng flag
Based on this info I think you might need a clean install. A lot of files needed by the system and software would have been under `/usr/share` which I think you are referring to as the directory you accidentally deleted. Although it was a good idea to try to copy the files from another installation, those files wouldn't exactly replace what existed on your installed system, assuming you've made updates, added/removed software. Your mistake may have been fatal and you might need to perform a clean installation in order to get your system fully functional again.
2.1 avatar
cn flag
2.1
@Nmath Clean installation will be very time consuming as I will have to install all the packages again for my use. Do You think of any other alternate ?
Nmath avatar
ng flag
The two packages that are "not fully installed or removed" appear to be `initramfs-tools` and `linux-image-5.11.0-37-generic`. Maybe you could try to `sudo apt purge` those packages and reinstall them, but I'm not certain it would fix the problem and might cause other issues. Definitely make sure your backups are in a good place
2.1 avatar
cn flag
2.1
OK, I will try, thanks
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.