0

I was upgrading my python3 from 3.8.5 to 3.9, so I (probably shouldn't have) ended up apt removing python-apt. After that, I tried reinstalling it but this error came up:

$ sudo apt-get install python3-apt
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  apg app-install-data apport-symptoms appstream-data-pop appstream-data-pop-icons apt-config-icons-hidpi
  apt-config-icons-large apt-config-icons-large-hidpi aptdaemon-data avahi-utils cabextract cups-pk-helper
  firmware-manager-notify firmware-manager-shared gir1.2-flatpak-1.0 gir1.2-goa-1.0 gir1.2-ostree-1.0
  gir1.2-packagekitglib-1.0 gir1.2-snapd-1 gnome-control-center-faces gnome-shell-extension-alt-tab-raise-first-window
  gnome-shell-extension-always-show-workspaces gnome-shell-extension-appindicator gnome-shell-extension-desktop-icons
  gnome-shell-extension-pop-battery-icon-fix gnome-shell-extension-pop-shop-details gtk2-engines-murrine icu-devtools
  ippusbxd libcolord-gtk1 libfirmware-manager libflatpak-dev libflatpak0 libgsound0 libhandy-1-0 libicu-dev libmspack0
  libostree-dev libpop-upgrade-gtk libqt5designer5 libqt5help5 librygel-core-2.6-2 librygel-db-2.6-2 librygel-renderer-2.6-2
  librygel-server-2.6-2 libs76-hidpi-widget libsbc1 libwhoopsie-preferences0 libwhoopsie0 libxatracker2 libxml2-dev
  mobile-broadband-provider-info network-manager-gnome pop-gnome-shell-theme pop-gtk-theme pop-icon-theme pop-shell
  pop-shell-shortcuts pop-sound-theme pop-theme pop-upgrade pulseaudio-module-bluetooth python3-blinker python3-click
  python3-colorama python3-cups python3-cupshelpers python3-dateutil python3-debconf python3-defer python3-distro-info
  python3-entrypoints python3-gdbm python3-httplib2 python3-jwt python3-keyring python3-launchpadlib
  python3-lazr.restfulclient python3-lazr.uri python3-oauthlib python3-problem-report python3-pyflatpak python3-pyqt5
  python3-requests-unixsocket python3-secretstorage python3-simplejson python3-sip python3-wadllib rygel
  system-config-printer system-config-printer-common system-config-printer-udev whoopsie-preferences x11-apps
  x11-session-utils xbitmaps xinit xinput xserver-xorg-input-all xserver-xorg-input-libinput xserver-xorg-video-all
  xserver-xorg-video-amdgpu xserver-xorg-video-ati xserver-xorg-video-fbdev xserver-xorg-video-nouveau
  xserver-xorg-video-radeon xserver-xorg-video-vesa xserver-xorg-video-vmware xwayland
Use 'sudo apt autoremove' to remove them.
Suggested packages:
  python3-apt-dbg python-apt-doc
The following NEW packages will be installed
  python3-apt
0 to upgrade, 1 to newly install, 0 to remove and 21 not to upgrade.
1 not fully installed or removed.
Need to get 152 kB of archives.
After this operation, 694 kB of additional disk space will be used.
Get:1 http://ppa.launchpad.net/system76/pop/ubuntu focal/main amd64 python3-apt amd64 2.1.2pop0~1587756471~20.04~cd2988e [152 kB]
Fetched 152 kB in 1s (132 kB/s)       
Selecting previously unselected package python3-apt.
(Reading database ... 295195 files and directories currently installed.)
Preparing to unpack .../python3-apt_2.1.2pop0~1587756471~20.04~cd2988e_amd64.deb ...
Unpacking python3-apt (2.1.2pop0~1587756471~20.04~cd2988e) ...
Setting up initramfs-tools (0.136ubuntu6.3) ...
update-initramfs: deferring update (trigger activated)
Setting up python3-apt (2.1.2pop0~1587756471~20.04~cd2988e) ...
Processing triggers for initramfs-tools (0.136ubuntu6.3) ...
update-initramfs: Generating /boot/initrd.img-5.8.16-xanmod1
cryptsetup: WARNING: Resume target cryptswap uses a key file
kernelstub.Config    : INFO     Looking for configuration...
kernelstub           : INFO     System information: 

    OS:..................Ubuntu 20.04
    Root partition:....../dev/dm-1
    Root FS UUID:........4270b8f1-42f2-41af-b42c-e6963dcf34be
    ESP Path:............/boot/efi
    ESP Partition:......./dev/sda1
    ESP Partition #:.....1
    NVRAM entry #:.......-1
    Boot Variable #:.....0000
    Kernel Boot Options:.quiet loglevel=0 systemd.show_status=false splash
    Kernel Image Path:.../boot/vmlinuz-5.8.16-xanmod1
    Initrd Image Path:.../boot/initrd.img-5.8.16-xanmod1
    Force-overwrite:.....False

kernelstub.Installer : INFO     Copying Kernel into ESP
kernelstub.Installer : INFO     Copying initrd.img into ESP
kernelstub.Installer : INFO     Setting up loader.conf configuration
kernelstub.Installer : INFO     Making entry file for Ubuntu
kernelstub.Installer : INFO     Backing up old kernel
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/kernelstub/installer.py", line 247, in copy_files
    shutil.copy(src, dest)
  File "/usr/lib/python3.9/shutil.py", line 415, in copy
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "/usr/lib/python3.9/shutil.py", line 272, in copyfile
    _fastcopy_sendfile(fsrc, fdst)
  File "/usr/lib/python3.9/shutil.py", line 163, in _fastcopy_sendfile
    raise err from None
  File "/usr/lib/python3.9/shutil.py", line 149, in _fastcopy_sendfile
    sent = os.sendfile(outfd, infd, offset, blocksize)
OSError: [Errno 28] No space left on device: '/proc/cmdline' -> '/boot/efi/EFI/Ubuntu-4270b8f1-42f2-41af-b42c-e6963dcf34be/cmdline'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/kernelstub", line 244, in <module>
    main()
  File "/usr/bin/kernelstub", line 241, in main
    kernelstub.main(args)
  File "/usr/lib/python3/dist-packages/kernelstub/application.py", line 346, in main
    installer.copy_cmdline(simulate=no_run)
  File "/usr/lib/python3/dist-packages/kernelstub/installer.py", line 214, in copy_cmdline
    self.copy_files(
  File "/usr/lib/python3/dist-packages/kernelstub/installer.py", line 251, in copy_files
    raise FileOpsError("Could not copy one or more files.")
kernelstub.installer.FileOpsError: Could not copy one or more files.
run-parts: /etc/initramfs/post-update.d//zz-kernelstub 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)

So I tried a variety of stuff, including -but not limited to-:

  • dpkg --configure -a (same error).
  • sudo killall dpkg, which returned dpkg: no process found
  • update-initramfs -u. Returned:
$ update-initramfs -u
update-initramfs: Generating /boot/initrd.img-5.8.16-xanmod1
I: The initramfs will attempt to resume from /dev/sda4
I: (UUID=cac83f23-4172-4dac-93f5-9cda57338121)
I: Set the RESUME variable to override this.
kernelstub.Config    : INFO     Looking for configuration...
kernelstub           : INFO     System information: 

    OS:..................Ubuntu 20.04
    Root partition:....../dev/dm-1
    Root FS UUID:........4270b8f1-42f2-41af-b42c-e6963dcf34be
    ESP Path:............/boot/efi
    ESP Partition:......./dev/sda1
    ESP Partition #:.....1
    NVRAM entry #:.......-1
    Boot Variable #:.....0000
    Kernel Boot Options:.quiet loglevel=0 systemd.show_status=false splash
    Kernel Image Path:.../boot/vmlinuz-5.8.16-xanmod1
    Initrd Image Path:.../boot/initrd.img-5.8.16-xanmod1
    Force-overwrite:.....False

kernelstub.Installer : INFO     Copying Kernel into ESP
kernelstub.Installer : ERROR    Couldn't copy the kernel onto the ESP!
This is a critical error and we cannot continue. Check your settings to see if there is a typo. Otherwise, check permissions and try again.
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/kernelstub/installer.py", line 247, in copy_files
    shutil.copy(src, dest)
  File "/usr/lib/python3.9/shutil.py", line 415, in copy
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "/usr/lib/python3.9/shutil.py", line 272, in copyfile
    _fastcopy_sendfile(fsrc, fdst)
  File "/usr/lib/python3.9/shutil.py", line 163, in _fastcopy_sendfile
    raise err from None
  File "/usr/lib/python3.9/shutil.py", line 149, in _fastcopy_sendfile
    sent = os.sendfile(outfd, infd, offset, blocksize)
OSError: [Errno 28] No space left on device: '/boot/vmlinuz-5.8.16-xanmod1' -> '/boot/efi/EFI/Ubuntu-4270b8f1-42f2-41af-b42c-e6963dcf34be/vmlinuz.efi'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/kernelstub/installer.py", line 121, in setup_kernel
    self.copy_files(
  File "/usr/lib/python3/dist-packages/kernelstub/installer.py", line 251, in copy_files
    raise FileOpsError("Could not copy one or more files.")
kernelstub.installer.FileOpsError: Could not copy one or more files.
run-parts: /etc/initramfs/post-update.d//zz-kernelstub exited with return code 170
  • Purge older kernels. Currently I'm at:
root@jeffs-workstation:/boot# ls -l
total 324360
-rw-r--r-- 1 root root    249178 Oct 18 07:31 config-5.8.16-xanmod1
drwx------ 5 root root      4096 Dec 31  1969 efi
-rw-r--r-- 1 root root  96567350 Oct 29 17:18 initrd.img-5.8.16-xanmod1
-rw-r--r-- 1 root root  96567347 Oct 29 17:17 initrd.img-5.8.16-xanmod1.dpkg-bak
-rw-r--r-- 1 root root 118900024 Oct 29 17:13 initrd.img-5.8.17-xanmod1
lrwxrwxrwx 1 root root        25 Oct 29 15:14 initrd.img.old -> initrd.img-5.8.16-xanmod1
-rw-r--r-- 1 root root   5334591 Oct 18 07:31 System.map-5.8.16-xanmod1
-rw-r--r-- 1 root root  14497152 Oct 18 07:31 vmlinuz-5.8.16-xanmod1
lrwxrwxrwx 1 root root        22 Oct 29 15:14 vmlinuz.old -> vmlinuz-5.8.16-xanmod1
  • Reconfigure cryptswap, as it was another error (update-initramfs: Generating /boot/initrd.img-5.8.16-xanmod1 cryptsetup: WARNING: Resume target cryptswap uses a key file). After that cryptswap hasn't complained ever since:
root@jeffs-workstation:/boot# sudo swapoff -a
root@jeffs-workstation:/boot# sudo cryptsetup remove /dev/mapper/cryptswap
root@jeffs-workstation:/boot# sudo vim /etc/crypttab
root@jeffs-workstation:/boot# /sbin/mkswap /dev/sda4
mkswap: /dev/sda4: warning: wiping old swap signature.
Setting up swapspace version 1, size = 4 GiB (4294959104 bytes)
no label, UUID=cac83f23-4172-4dac-93f5-9cda57338121
root@jeffs-workstation:/boot# swapon /dev/sda4
root@jeffs-workstation:/boot# vim /etc/fstab
  • apt install -f also returns the same error.
  • apt-get autoclean, clean, autoremove, remove, etc. Encounter the same error.
  • fdisk -l returns this:
root@jeffs-workstation:/boot# fdisk -l
Disk /dev/loop0: 97.76 MiB, 102486016 bytes, 200168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/loop1: 55.37 MiB, 58052608 bytes, 113384 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/loop2: 162.89 MiB, 170778624 bytes, 333552 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/loop3: 62.9 MiB, 65105920 bytes, 127160 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/loop4: 66.72 MiB, 69947392 bytes, 136616 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/sda: 1.84 TiB, 2000398934016 bytes, 3907029168 sectors
Disk model: ST2000DM001-1ER1
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: D0A60BA4-4AC7-4CB0-AC4C-0BDC43CAAE4E

Device          Start        End    Sectors  Size Type
/dev/sda1        4096    1023998    1019903  498M EFI System
/dev/sda2     1024000    9412606    8388607    4G Microsoft basic data
/dev/sda3     9412608 3898636462 3889223855  1.8T Linux filesystem
/dev/sda4  3898636464 3907025070    8388607    4G Linux swap

Disk /dev/sdb: 29.84 GiB, 32017047552 bytes, 62533296 sectors
Disk model: LITEONIT LMS-32S
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/mapper/cryptdata: 1.83 TiB, 1991265836544 bytes, 3889191087 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk /dev/mapper/data-root: 1.83 TiB, 1991262601216 bytes, 3889184768 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Also, /boot/efi is empty, according to a desktop notification.

What can I do?

0

I had gotten the same issue, after looking at my partitions, i saw that my EFI partition was full (try the df command), after looking around i found this guide, and after looking at my /boot/efi/EFI folder i seemed to have an unneeded folder (the one labeled "Ubuntu") efi folder after deleting that folder, it seemed to have fixed it and i was able to run apt commands again

2
  • 1
    Is this likely to be the actual answer, given that the question says /boot/efi is empty? – Toby Speight Apr 19 at 20:44
  • This just really helped me as I was having a similar issue. So thank you! – JBGruber May 5 at 8:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.