Can't install `avrdude`. It says there are unmet dependencies

What is the problem?

Can't install avrdude. It says there are unmet dependencies.

What did you already try to solve it?

I ran sudo apt --fix-broken install as suggested.
That didn't work either.

Have you tried running in safe mode?

Yes

Did running in safe mode solve the problem?

no

Systeminfo Bundle

octoprint-systeminfo-20220104005958.zip (22.7 KB)

Additional information about your setup

OctoPrint version 1.7.2, OctoPi Version 0.18.0, running on Raspberry Pi 3 Model B Rev 1.2, Prusa Mk3s

I'm running Octoprint on a RPi and can't install avrdude.

All was well until I needed to update to Python3. I followed the instructions here to backup and restore a few months ago. That went well, except when I went to update the Prusa Firmware today I found that avrdude isn't installed.

So I SSH in and sudo apt update works fine, although it says there are 123 packages that can be upgraded.
When I do sudo apt install avrdude it says there are unmet dependencies

pi@raspberrypi:~ $ sudo apt install avrdude
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 avrdude : Depends: libftdi1 but it is not going to be installed
           Depends: libhidapi-libusb0 (>= 0.8.0~rc1+git20140201.3a66d4e+dfsg) but it is not going to be installed
 python3.7 : Depends: libpython3.7-stdlib (= 3.7.3-2+deb10u2) but 3.7.3-2+deb10u3 is to be installed
 python3.7-dev : Depends: libpython3.7-dev (= 3.7.3-2+deb10u2) but 3.7.3-2+deb10u3 is to be installed
                 Depends: libpython3.7 (= 3.7.3-2+deb10u2) but 3.7.3-2+deb10u3 is to be installed
 python3.7-minimal : Depends: libpython3.7-minimal (= 3.7.3-2+deb10u2) but 3.7.3-2+deb10u3 is to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

however, sudo apt --fix-broken install' doesn't resolve the problem.

pi@raspberrypi:~ $ sudo apt --fix-broken install
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
  python3.7 python3.7-dev python3.7-minimal
Suggested packages:
  python3.7-venv python3.7-doc binfmt-support
The following packages will be upgraded:
  python3.7 python3.7-dev python3.7-minimal
3 upgraded, 0 newly installed, 0 to remove and 120 not upgraded.
Need to get 0 B/2,306 kB of archives.
After this operation, 9,216 B disk space will be freed.
Do you want to continue? [Y/n] y
Reading changelogs... Done
dpkg: warning: files list file for package 'adduser' missing; assuming package has 
no files currently installed
dpkg: warning: files list file for package 'alsa-utils' missing; assuming package h
as no files currently installed
dpkg: warning: files list file for package 'apt-listchanges' missing; assuming pack
age has no files currently installed
(Reading database ... 46585 files and directories currently installed.)
Preparing to unpack .../python3.7-dev_3.7.3-2+deb10u3_armhf.deb ...
Unpacking python3.7-dev (3.7.3-2+deb10u3) over (3.7.3-2+deb10u2) ...
dpkg: error processing archive /var/cache/apt/archives/python3.7-dev_3.7.3-2+deb10u
3_armhf.deb (--unpack):
 unable to create '/usr/share/doc/python3.7/HISTORY.gz.dpkg-new' (while processing 
'./usr/share/doc/python3.7/HISTORY.gz'): Structure needs cleaning
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Preparing to unpack .../python3.7_3.7.3-2+deb10u3_armhf.deb ...
Unpacking python3.7 (3.7.3-2+deb10u3) over (3.7.3-2+deb10u2) ...
dpkg: error processing archive /var/cache/apt/archives/python3.7_3.7.3-2+deb10u3_ar
mhf.deb (--unpack):
 unable to create '/usr/share/doc/python3.7/ACKS.gz.dpkg-new' (while processing './
usr/share/doc/python3.7/ACKS.gz'): Structure needs cleaning
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Preparing to unpack .../python3.7-minimal_3.7.3-2+deb10u3_armhf.deb ...
Unpacking python3.7-minimal (3.7.3-2+deb10u3) over (3.7.3-2+deb10u2) ...
dpkg: error processing archive /var/cache/apt/archives/python3.7-minimal_3.7.3-2+de
b10u3_armhf.deb (--unpack):
 unable to create '/usr/share/doc/python3.7-minimal/README.Debian.dpkg-new' (while 
processing './usr/share/doc/python3.7-minimal/README.Debian'): Structure needs clea
ning
Errors were encountered while processing:
 /var/cache/apt/archives/python3.7-dev_3.7.3-2+deb10u3_armhf.deb
 /var/cache/apt/archives/python3.7_3.7.3-2+deb10u3_armhf.deb
 /var/cache/apt/archives/python3.7-minimal_3.7.3-2+deb10u3_armhf.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

Run sudo apt update followed by sudo apt upgrade, this will update quite a few packages, at least 120 based on your output above. Then try installing avrdude again.

1 Like

Thanks TTalkington, but sudo apt upgrade doesn't work. I see the same "unmet dependencies"

pi@raspberrypi:~ $ sudo apt update
Hit:1 http://raspbian.raspberrypi.org/raspbian buster InRelease
Hit:2 http://archive.raspberrypi.org/debian buster InRelease
Reading package lists... Done
Building dependency tree       
Reading state information... Done
123 packages can be upgraded. Run 'apt list --upgradable' to see them.

pi@raspberrypi:~ $ sudo apt upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 python3.7 : Depends: libpython3.7-stdlib (= 3.7.3-2+deb10u2) but 3.7.3-2+deb10u3 is installed
 python3.7-dev : Depends: libpython3.7-dev (= 3.7.3-2+deb10u2) but 3.7.3-2+deb10u3 is installed
                 Depends: libpython3.7 (= 3.7.3-2+deb10u2) but 3.7.3-2+deb10u3 is installed
 python3.7-minimal : Depends: libpython3.7-minimal (= 3.7.3-2+deb10u2) but 3.7.3-2+deb10u3 is installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
pi@raspberrypi:~ $

Since you've done the update try sudo apt --fix-broken install again. Apt can get out of sync if you try to install something without running sudo apt update first - it uses stale package info and when it tries to install the old versions of packages it can't find them because only the new versions exist. Update should have fixed the local info, but apt still needs to fix itself internally.

Thanks, but that gives the same result.

pi@raspberrypi:~ $ sudo apt --fix-broken install
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
  python3.7 python3.7-dev python3.7-minimal
Suggested packages:
  python3.7-venv python3.7-doc binfmt-support
The following packages will be upgraded:
  python3.7 python3.7-dev python3.7-minimal
3 upgraded, 0 newly installed, 0 to remove and 120 not upgraded.
Need to get 0 B/2,306 kB of archives.
After this operation, 9,216 B disk space will be freed.
Do you want to continue? [Y/n] y
Reading changelogs... Done
dpkg: warning: files list file for package 'adduser' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'alsa-utils' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'apt-listchanges' missing; assuming package has no files currently installed
(Reading database ... 46585 files and directories currently installed.)
Preparing to unpack .../python3.7-dev_3.7.3-2+deb10u3_armhf.deb ...
Unpacking python3.7-dev (3.7.3-2+deb10u3) over (3.7.3-2+deb10u2) ...
dpkg: error processing archive /var/cache/apt/archives/python3.7-dev_3.7.3-2+deb10u3_armhf.deb (--unpack):
 unable to create '/usr/share/doc/python3.7/HISTORY.gz.dpkg-new' (while processing './usr/share/doc/python3.7/HISTORY.gz
'): Structure needs cleaning
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Preparing to unpack .../python3.7_3.7.3-2+deb10u3_armhf.deb ...
Unpacking python3.7 (3.7.3-2+deb10u3) over (3.7.3-2+deb10u2) ...
dpkg: error processing archive /var/cache/apt/archives/python3.7_3.7.3-2+deb10u3_armhf.deb (--unpack):
 unable to create '/usr/share/doc/python3.7/ACKS.gz.dpkg-new' (while processing './usr/share/doc/python3.7/ACKS.gz'): St
ructure needs cleaning
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Preparing to unpack .../python3.7-minimal_3.7.3-2+deb10u3_armhf.deb ...
Unpacking python3.7-minimal (3.7.3-2+deb10u3) over (3.7.3-2+deb10u2) ...
dpkg: error processing archive /var/cache/apt/archives/python3.7-minimal_3.7.3-2+deb10u3_armhf.deb (--unpack):
 unable to create '/usr/share/doc/python3.7-minimal/README.Debian.dpkg-new' (while processing './usr/share/doc/python3.7
-minimal/README.Debian'): Structure needs cleaning
Errors were encountered while processing:
 /var/cache/apt/archives/python3.7-dev_3.7.3-2+deb10u3_armhf.deb
 /var/cache/apt/archives/python3.7_3.7.3-2+deb10u3_armhf.deb
 /var/cache/apt/archives/python3.7-minimal_3.7.3-2+deb10u3_armhf.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
pi@raspberrypi:~ $

It sounds like dpkg is in an unstable state. If I were sitting infront of it I could probably get it worked out, but it would take some trial and error and I don't want to just keep feeding you commands try at this point!

Perhaps someone has an exact method for resolving this.

So what are my options from here?
Backup and reinstall?
Anything else I can do?

I did a backup and reinstalled from scratch with rpi-imager and everything is back to normal.
All the updates and upgrades worked successfully and I was able to install avrdude and I'm updating the firmware now.

I don't understand how this happened and how I can prevent it from happening again in the future.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.