Unable to complete updates - Sub-process /usr/bin/dpkg returned an error code (1)

level42

New Member
Aug 1, 2024
6
1
3
I have a Proxmox installation that sat dormant for a couple of months. I've recently rebooted the server and I'm attempting to complete some updates, however I'm getting stuck removing 2 packages, and installing 1.

Code:
root@R730xd:~# apt update && apt dist-upgrade
Hit:1 http://security.debian.org/debian-security bookworm-security InRelease
Hit:2 http://deb.debian.org/debian bookworm InRelease
Hit:3 http://deb.debian.org/debian bookworm-updates InRelease
Hit:4 http://download.proxmox.com/debian/pve bookworm InRelease
Reading package lists... Done         
Building dependency tree... Done
Reading state information... Done
All packages are up to date.
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.
Need to get 0 B/99.9 MB of archives.
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.142+deb12u1) ...
update-initramfs: deferring update (trigger activated)
Processing triggers for initramfs-tools (0.142+deb12u1) ...
update-initramfs: Generating /boot/initrd.img-6.8.12-7-pve
Running hook script 'zz-proxmox-boot'..
Re-executing '/etc/kernel/postinst.d/zz-proxmox-boot' in new private mount namespace..
Copying and configuring kernels on /dev/disk/by-uuid/B09D-7752
        Copying kernel and creating boot-entry for 6.8.12-2-pve
cp: preserving times for '/var/tmp/espmounts/B09D-7752/EFI/proxmox/6.8.12-2-pve/vmlinuz-6.8.12-2-pve': Read-only file system
run-parts: /etc/initramfs/post-update.d//proxmox-boot-sync exited with return code 1
dpkg: error processing package initramfs-tools (--configure):
 installed initramfs-tools package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 initramfs-tools
E: Sub-process /usr/bin/dpkg returned an error code (1)

I've been googling lines from my output for a couple of hours now trying various things, but I can't seem to progress at all.

Here is some further output information that may help.

---

I ran this and removed all other Kernels from my host: https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/kernel-clean.sh

Code:
root@R730xd:~# apt-get auto-remove && apt-get clean
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages will be REMOVED:
  proxmox-kernel-6.5.13-5-pve-signed
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
2 not fully installed or removed.
After this operation, 560 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 92081 files and directories currently installed.)
Removing proxmox-kernel-6.5.13-5-pve-signed (6.5.13-5) ...
Examining /etc/kernel/postrm.d.
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 6.5.13-5-pve /boot/vmlinuz-6.5.13-5-pve
update-initramfs: Deleting /boot/initrd.img-6.5.13-5-pve
run-parts: executing /etc/kernel/postrm.d/proxmox-auto-removal 6.5.13-5-pve /boot/vmlinuz-6.5.13-5-pve
run-parts: executing /etc/kernel/postrm.d/zz-proxmox-boot 6.5.13-5-pve /boot/vmlinuz-6.5.13-5-pve
Re-executing '/etc/kernel/postrm.d/zz-proxmox-boot' in new private mount namespace..
Copying and configuring kernels on /dev/disk/by-uuid/B09D-7752
        Copying kernel and creating boot-entry for 6.8.12-2-pve
cp: preserving times for '/var/tmp/espmounts/B09D-7752/EFI/proxmox/6.8.12-2-pve/vmlinuz-6.8.12-2-pve': Read-only file system
run-parts: /etc/kernel/postrm.d/zz-proxmox-boot exited with return code 1
Failed to process /etc/kernel/postrm.d at /var/lib/dpkg/info/proxmox-kernel-6.5.13-5-pve-signed.postrm line 15.
dpkg: error processing package proxmox-kernel-6.5.13-5-pve-signed (--remove):
 installed proxmox-kernel-6.5.13-5-pve-signed package post-removal script subprocess returned error exit status 1
dpkg: too many errors, stopping
Errors were encountered while processing:
 proxmox-kernel-6.5.13-5-pve-signed
Processing was halted because there were too many errors.
E: Sub-process /usr/bin/dpkg returned an error code (1)

Code:
root@R730xd:~# df -h
Filesystem                    Size  Used Avail Use% Mounted on
udev                           63G     0   63G   0% /dev
tmpfs                          13G  4.6M   13G   1% /run
rpool/ROOT/pve-1              193G  3.8G  190G   2% /
tmpfs                          63G   37M   63G   1% /dev/shm
tmpfs                         5.0M     0  5.0M   0% /run/lock
efivarfs                      304K  138K  162K  47% /sys/firmware/efi/efivars
rpool                         190G  128K  190G   1% /rpool
rpool/var-lib-vz              205G   16G  190G   8% /var/lib/vz
rpool/ROOT                    190G  128K  190G   1% /rpool/ROOT
rpool/data                    190G  128K  190G   1% /rpool/data
rpool/data/subvol-100-disk-0  2.0G  570M  1.5G  28% /rpool/data/subvol-100-disk-0
rpool/data/subvol-104-disk-0  4.0G  1.2G  2.9G  28% /rpool/data/subvol-104-disk-0
rpool/data/subvol-105-disk-0  4.0G  1.3G  2.8G  31% /rpool/data/subvol-105-disk-0
Media                          26T  256K   26T   1% /Media
/dev/fuse                     128M   20K  128M   1% /etc/pve
tmpfs                          13G     0   13G   0% /run/user/0

Code:
root@R730xd:~# cat /etc/default/grub
# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
#   info -f grub -n 'Simple configuration'

GRUB_DEFAULT=0
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet"
GRUB_CMDLINE_LINUX=""

# If your computer has multiple operating systems installed, then you
# probably want to run os-prober. However, if your computer is a host
# for guest OSes installed via LVM or raw disk devices, running
# os-prober can cause damage to those guest OSes as it mounts
# filesystems to look for things.
#GRUB_DISABLE_OS_PROBER=false

# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"

# Uncomment to disable graphical terminal
#GRUB_TERMINAL=console

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
#GRUB_GFXMODE=640x480

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true

# Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_RECOVERY="true"

# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"

Code:
root@R730xd:~# dkms remove vendor-reset/0.1.1 --all
-bash: dkms: command not found

If there is anything else that I can provide to assist, please let me know.
 
cp: preserving times for '/var/tmp/espmounts/B09D-7752/EFI/proxmox/6.8.12-2-pve/vmlinuz-6.8.12-2-pve': Read-only file system
Thats the error and it seems you have a problem with your disk or filesystem. Please have a look at the output of dmesg, there are most probably filesystem errors displayed.
 
Thats the error and it seems you have a problem with your disk or filesystem. Please have a look at the output of dmesg, there are most probably filesystem errors displayed.
I appreciate your response. I wasn't aware of the dmesg command.

When I run it, I get a very large output, but I suspect that this is the error in question (as it's repeated several times).

Code:
[ 3039.646202] FAT-fs (sdm2): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
[ 3039.656303] FAT-fs (sdm2): error, fat_free_clusters: deleting FAT entry beyond EOF
[ 3039.658641] FAT-fs (sdm2): Filesystem has been set read-only

At this point though, I'm not sure what drive this is, partition, etc. or what to do about it.

It mentions that I should run fsck, but when I do, I just get the following:

Code:
root@R730xd:~# fsck
fsck from util-linux 2.38.1

I suspect there's some flags or something that I should be appending to this command to help resolve the issue. At the very least, this give me another angle to research and troubleshoot from.

---

[Edit] Quick Google search tells me I should point it to the affected partition, in doing so, I'm presented with an option I don't know how to proceed from.

I suspect I should restore from backup in this case, since the current boot sector seems borked?

Code:
root@R730xd:~# fsck /dev/sdm2
fsck from util-linux 2.38.1
fsck.fat 4.2 (2021-01-31)
There are differences between boot sector and its backup.
This is mostly harmless. Differences: (offset:original/backup)
  65:01/00
1) Copy original to backup
2) Copy backup to original
3) No action
[123?q]?
 
Last edited:
you can either finish the fsck and see if it works again then, or you can just reinitialize that ESP using proxmox-boot-tool:

Code:
proxmox-boot-tool format /dev/sdm2
proxmox-boot-tool init /dev/sdm2
proxmox-boot-tool status

the ESP just contains the bootloader and copies of the kernel and initrd, which are also stored on the / partition, so you can recreate it at any time.
 
you can either finish the fsck and see if it works again then, or you can just reinitialize that ESP using proxmox-boot-tool:

Code:
proxmox-boot-tool format /dev/sdm2
proxmox-boot-tool init /dev/sdm2
proxmox-boot-tool status

the ESP just contains the bootloader and copies of the kernel and initrd, which are also stored on the / partition, so you can recreate it at any time.
Thank you! I have proceeded with restoring the boot sector from the backup with fsck! Server was then successfully able to cleanup the old kernels, and complete the pending update :)

I appreciate the assistance from you both!
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!