E: Sub-process /usr/bin/dpkg returned an error code (1) dpkg error
The first I think:
- Do you have enough space in boot partition?. Can you paste the output of:
df -h
Also:
df -ih
You can get old kernels removed by this command:
sudo apt --purge autoremove
What version of Ubuntu are you using?.
Edit: After seeing your df -h I can see that /boot is 99% full:
/dev/sdb1 467M 427M 5.4M 99% /boot
You only have 5.4 MB available.
You can manually delete unused or very old kernel in /boot but this has to be very carefully done or you can loss the ability to boot. Also some files can be moved and symbolic links can be created and keep the files in a mountpoint with enough space and after that run
sudo apt --purge autoremove
I can assist if you provide the output of:
ls -alh /boot
Edit 2020-08-25: First see what is your Kernel:
uname -r
You can see the kernels installed in your system with:
dpkg --list | egrep -i 'linux-image|linux-headers'
The kernels that are older, specially if they are very much older, are the first candidates to be deleted. I recommend you to uninstall few of them, two or three only, until you can update your system and after run autopurge.
sudo apt --purge autoremove
You can remove one specific kernel with:
apt-get --purge remove fullkernelname
Normally you'll have to do it in pairs. For example:
apt-get --purge remove linux-headers-4.15.0-111
apt-get --purge remove linux-image-4.15.0-111-generic
Edit 2020-09-01: As you're using Kernel 34 we are going to move two that you are not using:
Type those commands:
sudo mkdir /root/old_kernels
sudo mv /boot/linux-headers-5.4.0-7626* /root/old_kernels/
sudo mv /boot/linux-headers-5.4.0-7629* /root/old_kernels/
sudo ln -s /root/old_kernels/* /boot/
After this you'll have some free space in /boot with the kernel files not deleted, but linked with a symbolic link. This is important so dkpg can find them in order to do autoremove. Now do:
sudo apt update
and after it runs successfully:
sudo apt --purge autoremove
Cheers
The Exodia
Updated on September 18, 2022Comments
-
The Exodia over 1 year
I'm getting this error when running
sudo apt upgrade
:Error 24 : Write error : cannot write compressed block E: mkinitramfs failure cpio 141 lz4 -9 -l 24 update-initramfs: failed for /boot/initrd.img-5.4.0-7634-generic with 1. dpkg: error processing package linux-firmware (--configure): installed linux-firmware package post-installation script subprocess returned error exit status 1 Errors were encountered while processing: linux-firmware E: Sub-process /usr/bin/dpkg returned an error code (1)
I tried the following:
sudo apt-get clean sudo apt upgrade sudo apt install -f sudo apt-get dist-upgrade
I also tried
flatpak update
$ df -h Filesystem Size Used Avail Use% Mounted on udev 1.9G 0 1.9G 0% /dev tmpfs 390M 1.9M 388M 1% /run /dev/mapper/data-root 106G 89G 12G 89% / tmpfs 2.0G 53M 1.9G 3% /dev/shm tmpfs 5.0M 0 5.0M 0% /run/lock tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup /dev/loop2 56M 56M 0 100% /snap/core18/1885 /dev/loop1 97M 97M 0 100% /snap/core/9665 /dev/loop3 161M 161M 0 100% /snap/gnome-3-28-1804/116 /dev/loop4 162M 162M 0 100% /snap/gnome-3-28-1804/128 /dev/loop5 128K 128K 0 100% /snap/hello-world/29 /dev/loop0 97M 97M 0 100% /snap/core/9804 /dev/loop6 44M 44M 0 100% /snap/snap-store/415 /dev/loop7 227M 227M 0 100% /snap/wine-platform-runtime/145 /dev/loop8 55M 55M 0 100% /snap/core18/1880 /dev/loop9 63M 63M 0 100% /snap/gtk-common-themes/1506 /dev/loop10 227M 227M 0 100% /snap/wine-platform-runtime/136 /dev/sdb1 467M 427M 5.4M 99% /boot tmpfs 390M 20K 390M 1% /run/user/120 tmpfs 390M 60K 390M 1% /run/user/1000 /dev/sdc1 467M 131M 301M 31% /media/pappkozos/34c06214-5cb6-42b6-b033-9c53b228a584 /dev/sr0 7.5G 7.5G 0 100% /media/pappkozos/empire_disc1 /dev/sdc2 928G 46G 882G 5% /media/pappkozos/Merevlemez
$ df -ih Filesystem Size Used Avail Use% Mounted on udev 1.9G 0 1.9G 0% /dev tmpfs 390M 1.9M 388M 1% /run /dev/mapper/data-root 106G 89G 12G 89% / tmpfs 2.0G 53M 1.9G 3% /dev/shm tmpfs 5.0M 0 5.0M 0% /run/lock tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup /dev/loop2 56M 56M 0 100% /snap/core18/1885 /dev/loop1 97M 97M 0 100% /snap/core/9665 /dev/loop3 161M 161M 0 100% /snap/gnome-3-28-1804/116 /dev/loop4 162M 162M 0 100% /snap/gnome-3-28-1804/128 /dev/loop5 128K 128K 0 100% /snap/hello-world/29 /dev/loop0 97M 97M 0 100% /snap/core/9804 /dev/loop6 44M 44M 0 100% /snap/snap-store/415 /dev/loop7 227M 227M 0 100% /snap/wine-platform-runtime/145 /dev/loop8 55M 55M 0 100% /snap/core18/1880 /dev/loop9 63M 63M 0 100% /snap/gtk-common-themes/1506 /dev/loop10 227M 227M 0 100% /snap/wine-platform-runtime/136 /dev/sdb1 467M 427M 5.4M 99% /boot tmpfs 390M 20K 390M 1% /run/user/120 tmpfs 390M 60K 390M 1% /run/user/1000 /dev/sdc1 467M 131M 301M 31% /media/pappkozos/34c06214-5cb6-42b6-b033-9c53b228a584 /dev/sr0 7.5G 7.5G 0 100% /media/pappkozos/empire_disc1 /dev/sdc2 928G 46G 882G 5% /media/pappkozos/Merevlemez pappkozos@terminator:~$ df -ih Filesystem Inodes IUsed IFree IUse% Mounted on udev 476K 607 476K 1% /dev tmpfs 487K 1.2K 486K 1% /run /dev/mapper/data-root 6.8M 632K 6.1M 10% / tmpfs 487K 75 487K 1% /dev/shm tmpfs 487K 3 487K 1% /run/lock tmpfs 487K 18 487K 1% /sys/fs/cgroup /dev/loop2 11K 11K 0 100% /snap/core18/1885 /dev/loop1 13K 13K 0 100% /snap/core/9665 /dev/loop3 28K 28K 0 100% /snap/gnome-3-28-1804/116 /dev/loop4 28K 28K 0 100% /snap/gnome-3-28-1804/128 /dev/loop5 10 10 0 100% /snap/hello-world/29 /dev/loop0 13K 13K 0 100% /snap/core/9804 /dev/loop6 15K 15K 0 100% /snap/snap-store/415 /dev/loop7 28K 28K 0 100% /snap/wine-platform-runtime/145 /dev/loop8 11K 11K 0 100% /snap/core18/1880 /dev/loop9 61K 61K 0 100% /snap/gtk-common-themes/1506 /dev/loop10 28K 28K 0 100% /snap/wine-platform-runtime/136 /dev/sdb1 125K 324 125K 1% /boot tmpfs 487K 69 487K 1% /run/user/120 tmpfs 487K 103 487K 1% /run/user/1000 /dev/sdc1 125K 20 125K 1% /media/pappkozos/34c06214-5cb6-42b6-b033-9c53b228a584 /dev/sr0 0 0 0 - /media/pappkozos/empire_disc1 /dev/sdc2 882M 26K 882M 1% /media/pappkozos/Merevlemez
My kernel: 5.4.0-7634-generic
My installed kernels:
dpkg --list | egrep -i 'linux-image|linux-headers' ii linux-headers-5.3.0-7648 5.3.0-7648.41~1586789791~19.10~9593806 all Header files related to Linux kernel version 5.3.0 ii linux-headers-5.3.0-7648-generic 5.3.0-7648.41~1586789791~19.10~9593806 amd64 Linux kernel headers for version 5.3.0 on 64 bit x86 SMP ii linux-headers-5.4.0-7626 5.4.0-7626.30~1588169883~20.04~bbe668a all Header files related to Linux kernel version 5.4.0 ii linux-headers-5.4.0-7626-generic 5.4.0-7626.30~1588169883~20.04~bbe668a amd64 Linux kernel headers for version 5.4.0 on 64 bit x86 SMP ii linux-headers-5.4.0-7629 5.4.0-7629.33~1589834512~20.04~ff6e79e all Header files related to Linux kernel version 5.4.0 ii linux-headers-5.4.0-7629-generic 5.4.0-7629.33~1589834512~20.04~ff6e79e amd64 Linux kernel headers for version 5.4.0 on 64 bit x86 SMP ii linux-headers-5.4.0-7634 5.4.0-7634.38~1592497129~20.04~9a1ea2e all Header files related to Linux kernel version 5.4.0 ii linux-headers-5.4.0-7634-generic 5.4.0-7634.38~1592497129~20.04~9a1ea2e amd64 Linux kernel headers for version 5.4.0 on 64 bit x86 SMP ii linux-headers-generic 5.4.0.7634.38~1592497129~20.04~9a1ea2e amd64 Generic Linux kernel headers ii linux-image-5.3.0-7648-generic 5.3.0-7648.41~1586789791~19.10~9593806 amd64 Linux kernel image for version 5.3.0 on 64 bit x86 SMP ii linux-image-5.4.0-7626-generic 5.4.0-7626.30~1588169883~20.04~bbe668a amd64 Linux kernel image for version 5.4.0 on 64 bit x86 SMP ii linux-image-5.4.0-7629-generic 5.4.0-7629.33~1589834512~20.04~ff6e79e amd64 Linux kernel image for version 5.4.0 on 64 bit x86 SMP it linux-image-5.4.0-7634-generic 5.4.0-7634.38~1592497129~20.04~9a1ea2e amd64 Linux kernel image for version 5.4.0 on 64 bit x86 SMP ii linux-image-generic 5.4.0.7634.38~1592497129~20.04~9a1ea2e amd64 Generic Linux kernel image
$ ls -alh /boot total 226M drwxr-xr-x 3 root root 4.0K Sep 6 18:18 . drwxr-xr-x 18 root root 4.0K Sep 6 18:16 .. -rw-r--r-- 1 root root 231K Apr 13 16:56 config-5.3.0-7648-generic -rw-r--r-- 1 root root 233K Aug 28 17:31 config-5.4.0-7642-generic drwxr-xr-x 4 root root 4.0K Sep 6 18:14 grub lrwxrwxrwx 1 root root 29 Sep 6 17:44 initrd.img -> initrd.img-5.4.0-7642-generic -rw-r--r-- 1 root root 21M Apr 16 00:08 initrd.img-5.3.0-7642-generic -rw-r--r-- 1 root root 94M Sep 6 18:18 initrd.img-5.3.0-7648-generic -rw-r--r-- 1 root root 81M Sep 6 18:18 initrd.img-5.4.0-7642-generic lrwxrwxrwx 1 root root 29 Apr 15 23:48 initrd.img.old -> initrd.img-5.3.0-7648-generic -rw------- 1 root root 4.5M Apr 13 16:56 System.map-5.3.0-7648-generic -rw------- 1 root root 4.6M Aug 28 17:31 System.map-5.4.0-7642-generic lrwxrwxrwx 1 root root 26 Sep 6 17:44 vmlinuz -> vmlinuz-5.4.0-7642-generic -rw------- 1 root root 11M Apr 13 16:56 vmlinuz-5.3.0-7648-generic -rw------- 1 root root 12M Aug 28 17:31 vmlinuz-5.4.0-7642-generic lrwxrwxrwx 1 root root 26 Apr 15 23:48 vmlinuz.old -> vmlinuz-5.3.0-7648-generic
-
The Exodia over 3 yearsI posted it I'm using POP OS_ 20.04
-
The Exodia over 3 yearsI tried the $ sudo apt --purge autoremove but it gives the same error mentioned in the post. I think my boot may have low space but I just dont know what to delete and autoremoving just gives this error.
-
The Exodia over 3 yearsI have posted it I just don't know what I can delete and
apt --purge autoremove
Runs in the same error -
The Exodia over 3 yearsOr no it gives this:
apt --purge autoremove E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied) E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?
-
Carles Mateo over 3 yearsDid you use sudo in front? This typically happens when you cannot get access to dpkg lock because another processes is trying to update the system, or you don't have permissions.
-
Carles Mateo over 3 yearsI don't recommend you to delete from /boot because later the package manager will fail as not finding installed dependencies. Also if you delete the wrong files your system can stop booting.
-
Carles Mateo over 3 yearsI'm editing my answer to add the commands to list your installed kernels and how to delete them.
-
The Exodia over 3 yearsI tried it both ways but it didn't work. Which kernels should I delete? I'm new to linux and don't really understand this boot stuff yet.
-
The Exodia over 3 yearsI edited my post to show the kernel list
-
The Exodia over 3 yearsI don't know what to delete
-
Carles Mateo over 3 yearsI edited my answer so you have the specific commands for your case. They are at the bottom, under edited 2020-09-01.
-
The Exodia over 3 yearsAfter I typed in
sudo mv linux-headers-5.4.0-7626* /root/old_kernels/
it says this:mv: cannot stat 'linux-headers-5.4.0-7629*': No such file or directory
I checked the kernel list but it's still there. Why can't it locate it? -
Carles Mateo over 3 yearsWrite first: cd /boot or add /boot/ to the mv commands.
-
The Exodia over 3 yearsIt still cant find it:
cd /boot
/boot$ sudo mkdir /root/old_kernels
/boot$ sudo mv /boot/linux-headers-5.4.0-7626* /root/old_kernels/ mv: cannot stat '/boot/linux-headers-5.4.0-7626*': No such file or directory
-
The Exodia over 3 yearsWait maybe it moved it because it says now at
df -h
/dev/sdb1 467M 752K 431M 1% /boot
-
The Exodia over 3 yearsI ran
sudo apt update
andsudo apt --purge autoremove
but I don't know if autoremove ran succesfully. It didn't say any error but after it said:cryptsetup: WARNING: Resume target cryptswap uses a key file
it stopped but no error. Does it mean that it ran down succesfully and now I can dosudo apt upgrade
? -
The Exodia over 3 yearsUmm... Something went wrong
-
The Exodia over 3 yearsSo yesterday I got on boot like a lot of storage like I wrote there. I dont know what caused it but I thought it was just the old roots moved around because I only typed the commands you wrote here. Then I proceeded with purge and update and everything seemed fine. But today when I booted it said this:
error: file '/grub/i386-pc/normal.mod' not found Entering rescue mode... grub rescue> _
-
Carles Mateo over 3 yearsAre you using dual boot, so having Windows and Linux on the same machine?. What exact commands did you use for purging?. Maybe you deleted your actual kernel. To try to locate normal.mod there is a nice explanation here: askubuntu.com/questions/266429/….
-
Carles Mateo over 3 yearsPlease provide the outputs of: ls -alh /boot
-
The Exodia over 3 yearsNo I'm not using dual boot. I used this code to purge
sudo apt --purge autoremove
-
The Exodia over 3 yearsI made a fresh install but there's a problem with communicating with TPM chip. I tried to find and disable TPM in BIOS but I couldn't seem to find it and after running the current kernel it let me in Ubuntu 20.04 loading. After that I pressed F2 and it let me in the system. But it's different because I can't seem to find the boot in
df -ih
. But I provided thels -alh
-
Carles Mateo over 3 yearsIf you don't see /boot when you df is because instead of using a different partition for boot you have /boot as a folder in /root partition. Like that you'll not get out of space as long as root partition has enough space. So you're good. You should be able to disable TPM in BIOS, security section.
-
The Exodia over 3 yearsOkay thank you :)