Score:0

Stuck on "update-initramfs: Generating /boot/initrd.img-5.4.0-92-generic"

cn flag

I have a problem with uninstalling packages on my server(20.04 LTS).

When I run apt remove metricbeat receive this message:

root@elk:/home/elk# apt remove metricbeat
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  metricbeat
0 upgraded, 0 newly installed, 1 to remove and 183 not upgraded.
1 not fully installed or removed.
After this operation, 182 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 151385 files and directories currently installed.)
Removing metricbeat (7.16.2) ...
Setting up linux-image-5.4.0-92-generic (5.4.0-92.103) ...
Processing triggers for linux-image-5.4.0-92-generic (5.4.0-92.103) ...
/etc/kernel/postinst.d/initramfs-tools:
update-initramfs: Generating /boot/initrd.img-5.4.0-92-generic

Progress: [ 80%] [############################################.......] 

It freezes on this step, ctrl+c ctrl+z didn't work. I open another ssh connection and run again apt remove metricbeat and receive this message:

^Citing for cache lock: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 1890890 (apt)... 1s

I found apt PID with ps -aux | grep apt and kill it. Then run again remove command now:

root@elk:/home/elk# apt remove metricbeat
^Citing for cache lock: Could not get lock /var/lib/dpkg/lock. It is held by process 1891272 (dpkg)... 1s

dpkg running processes:

root     1891272  0.0  0.0  11136  5328 ?        Ss   14:47   0:00 /usr/bin/dpkg --status-fd 42 --configure --pending
root     1891282  0.0  0.0   2608   608 ?        S    14:47   0:00 /bin/sh /var/lib/dpkg/info/linux-image-5.4.0-92-generic.postinst triggered linux-update-5.4.0-92-generic

after killing those process run again package remove command and get:

E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem. 

so I ran sudo dpkg --configure -a and it stuck on this step:

root@elk:/home/elk# dpkg --configure -a
Setting up linux-image-5.4.0-92-generic (5.4.0-92.103) ...
Processing triggers for linux-image-5.4.0-92-generic (5.4.0-92.103) ...
/etc/kernel/postinst.d/initramfs-tools:
update-initramfs: Generating /boot/initrd.img-5.4.0-92-generic

By ctrl+c :

error processing package linux-image-5.4.0-92-generic (--configure):
 installed linux-image-5.4.0-92-generic package post-installation script subprocess was interrupted
Errors were encountered while processing:
 linux-image-5.4.0-92-generic

I checked the /boot :

root@elk:/boot# ls -lh
total 218M
-rw-r--r-- 1 root root 233K Apr 20  2020 config-5.4.0-26-generic
-rw-r--r-- 1 root root 233K Nov  5 16:02 config-5.4.0-91-generic
-rw-r--r-- 1 root root 233K Nov 26 14:42 config-5.4.0-92-generic
drwxr-xr-x 4 root root 4.0K Apr  9 08:14 grub
lrwxrwxrwx 1 root root   27 Apr  9 08:14 initrd.img -> initrd.img-5.4.0-92-generic
-rw-r--r-- 1 root root  78M Feb 15  2021 initrd.img-5.4.0-26-generic
-rw-r--r-- 1 root root  81M Dec  9 06:37 initrd.img-5.4.0-91-generic
-rw-r--r-- 1 root root    0 Apr  9 14:58 initrd.img-5.4.0-92-generic.new
lrwxrwxrwx 1 root root   27 Jan  5 06:48 initrd.img.old -> initrd.img-5.4.0-91-generic
-rw------- 1 root root 4.6M Apr 20  2020 System.map-5.4.0-26-generic
-rw------- 1 root root 4.6M Nov  5 16:02 System.map-5.4.0-91-generic
-rw------- 1 root root 4.6M Nov 26 14:42 System.map-5.4.0-92-generic
lrwxrwxrwx 1 root root   24 Jan  5 06:48 vmlinuz -> vmlinuz-5.4.0-92-generic
-rw------- 1 root root  12M Apr 20  2020 vmlinuz-5.4.0-26-generic
-rw------- 1 root root  12M Nov  5 16:04 vmlinuz-5.4.0-91-generic
-rw------- 1 root root  14M Nov 26 14:45 vmlinuz-5.4.0-92-generic
lrwxrwxrwx 1 root root   24 Jan  5 06:48 vmlinuz.old -> vmlinuz-5.4.0-91-generic
root@elk:/boot# 

I think it has some problems with initrd.img-5.4.0-92-generic and I don't know how can I solve it. this cycle happened again and again.

A.B avatar
cl flag
A.B
Just to be clear: the problem is not about installing or uninstalling (that's a consequence). The problem is about a package not completing its installation: `1 not fully installed or removed.` for `linux-image-5.4.0-92-generic` so you can focus the topic.
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.