-1

I'm getting the following error on sudo apt-get upgrade:

Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these.
The following packages have unmet dependencies:
 linux-headers-generic : Depends: linux-headers-4.4.0-151-generic but it is not installed
 linux-image-generic : Depends: linux-modules-extra-4.4.0-151-generic but it is not installed
                       Recommends: thermald but it is not installed
E: Unmet dependencies. Try using -f.

I then tried sudo apt-get -f install. That gives me another error:

The following additional packages will be installed:
  linux-headers-4.4.0-210 linux-headers-4.4.0-210-generic linux-modules-extra-4.4.0-210-generic
The following NEW packages will be installed:
  linux-headers-4.4.0-210 linux-headers-4.4.0-210-generic linux-modules-extra-4.4.0-210-generic
0 upgraded, 3 newly installed, 0 to remove and 235 not upgraded.
8 not fully installed or removed.
Need to get 47.4 MB of archives.
After this operation, 235 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 linux-modules-extra-4.4.0-210-generic amd64 4.4.0-210.242 [36.6 MB]
Get:2 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 linux-headers-4.4.0-210 all 4.4.0-210.242 [10.0 MB]
Get:3 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 linux-headers-4.4.0-210-generic amd64 4.4.0-210.242 [786 kB]
Fetched 47.4 MB in 4s (11.0 MB/s)
(Reading database ... 1423830 files and directories currently installed.)
Preparing to unpack .../linux-modules-extra-4.4.0-210-generic_4.4.0-210.242_amd64.deb ...
Unpacking linux-modules-extra-4.4.0-210-generic (4.4.0-210.242) ...
dpkg: error processing archive /var/cache/apt/archives/linux-modules-extra-4.4.0-210-generic_4.4.0-210.242_amd64.deb (--unpack):
 unable to create '/lib/modules/4.4.0-210-generic/kernel/drivers/media/usb/dvb-usb-v2/dvb-usb-az6007.ko.dpkg-new' (while processing './lib/modules/4.4.0-210-generic/kernel/drivers/media/usb/dvb-usb-v2/dvb-usb-az6007.ko'): No space left on device
No apport report written because the error message indicates a disk full error
                                                                              dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)

I have read this post. The accepted answer doesn't work b/c sudo apt-get remove linux-image-VERSION gives me the same error as sudo apt-get -f install. I tried the second most upvoted answer and it freed some space:

df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            3.9G     0  3.9G   0% /dev
tmpfs           799M   17M  782M   3% /run
/dev/sda1        22G   19G  2.3G  90% /
tmpfs           3.9G     0  3.9G   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           3.9G     0  3.9G   0% /sys/fs/cgroup
tmpfs           799M     0  799M   0% /run/user/1000

to:

df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            3.9G     0  3.9G   0% /dev
tmpfs           799M   17M  782M   3% /run
/dev/sda1        22G   17G  4.1G  80% /
tmpfs           3.9G     0  3.9G   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           3.9G     0  3.9G   0% /sys/fs/cgroup
tmpfs           799M     0  799M   0% /run/user/1000

After that, I ran sudo apt-get clean, sudo apt-get autoclean and then sudo apt-get -f install as suggested in this answer. But I'm getting the same error. What can I do to resolve this issue?

Update

The output of df -ih is:

Filesystem     Inodes IUsed IFree IUse% Mounted on
udev             993K   411  993K    1% /dev
tmpfs            998K   570  998K    1% /run
/dev/sda1        1.4M  1.4M  1.8K  100% /
tmpfs            998K     1  998K    1% /dev/shm
tmpfs            998K     3  998K    1% /run/lock
tmpfs            998K    16  998K    1% /sys/fs/cgroup
tmpfs            998K     4  998K    1% /run/user/1000
James
  • 101
  • 235 not upgraded - This likely means that your system is severely out of date. Did this problem start because you tried to install new software without updating first? FYI: you need to always run sudo apt update before you do anything else in apt. This gets the list of available software. If you're performing apt commands with an outdated list, you can break your package management. Also, can you tell us what version of Ubuntu you are using? Kernel 4.4 suggests that you are running 16.04 which no longer receives community support. In that case you need to install a supported release – Nmath Mar 06 '22 at 20:21
  • 1
    The xenial in your output also shows that you are using sources from 16.04. If you added xenial sources to another version of Ubuntu, this will also break your system. Never add sources from another distribution or from another Ubuntu release version. – Nmath Mar 06 '22 at 20:22
  • If you use aptitude it will automaticly download dependencies. Just install it with apt or apt-get. – Joepie Es Mar 06 '22 at 20:35
  • @JoepieEs In this situation it's highly unlikely anything can be installed before the mess is corrected. And, honestly, there's a reason why aptitude is no longer installed by default since MANY years ago. – ChanganAuto Mar 06 '22 at 20:42
  • @Nmath - It's running 16.04. I haven't added sources from another version of Ubuntu. I always will issue an apt-get update prior to apt-get install and apt-get upgrade. – James Mar 06 '22 at 21:17
  • Ubuntu 16.04 LTS has reached the end of it's standard support life thus is now off-topic here unless your question is specific to helping you move to a supported release of Ubuntu. Ubuntu 16.04 ESM support is available, but not on-topic here, see https://askubuntu.com/help/on-topic See also https://ubuntu.com/blog/ubuntu-16-04-lts-transitions-to-extended-security-maintenance-esm – guiverc Mar 06 '22 at 21:30
  • 1
    In that case you need to install a supported release. 16.04 has not received community support since April 2021. ESM is available, but ESM is really only intended for complex deployments in mission critical operations. ESM is free for individuals, however the free subscription only includes access to critical and security updates. Any additional support can be purchased. In most cases, it's better to install a supported release rather than transition to ESM. See: https://ubuntu.com/blog/ubuntu-16-04-lts-transitions-to-extended-security-maintenance-esm – Nmath Mar 06 '22 at 21:38
  • 1
    Your output clearly says No space left on device. Check df -i. Seems like you have not yet freed up enough space. – user535733 Mar 06 '22 at 21:43
  • @user535733 - You're right. When I run that, I see IUse% = 100%. Updated OP with output. I suppose now I need to find how to resolve that. Deleting files as noted in OP didn't seem to help. I plan to eventually install a newer supported version of the OS (as recommended by other) but need to patch for now. So, thanks for your help here. – James Mar 06 '22 at 21:50
  • 1
    The usual way to run out of inodes is to have packages with LOTS of files installed -- the classic example is kernel source code, which has many thousands of tiny files. The solution is to locate and uninstall those packages. Some users experiment with rolling their own kernels, and forget to remove all those packages when they lose interest. – user535733 Mar 06 '22 at 21:59
  • @user535733 - You're right again. I see a lot of inodes (1516-1525) being allocated to ./usr/src/linux-headers-4.4.0-XX-generic/include/config. where XX ranges from 62-150. uname -r shows me 4.4.0-150-generic. So I think it should be safe to delete the others (perhaps also keeping the preceding two). If you want to create an answer, I'll mark it as the solution and upvote. Thanks. – James Mar 06 '22 at 22:39

1 Answers1

2

There are some key clues in your output.

No space left on device can happen for two reasons: Out of space and/or out of inodes.

  • Folks run out of space for the usual reasons: Too many movies and other large files. Occasionally a runaway logfile.
  • Folks run out of inodes when they have too many (thousands) of small files. The classic example is too many kernel header and/or kernel source files.

Your output and troubleshooting seem to have led you to the safe, correct conclusion that inodes are the problem. (Well done!)

  • Look for unused (older) kernel source and kernel header packages. Uninstall them.
  • Some folks install kernel files from non-package sources. Those count against inodes too. If you did so, time to clean them out.

Once your inodes are a bit lower, apt will work again.

user535733
  • 62,253