Score:0

E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution)

za flag
shiyi@shiyi-VM42:$ cat /etc/os-release

NAME="Ubuntu"
VERSION="20.04 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal

I am trying to update my system with the following commands:

shiyi@shiyi-VM42:$ sudo apt update

Hit:1 http://dl.google.com/linux/chrome/deb stable InRelease
Hit:2 http://us.archive.ubuntu.com/ubuntu focal InRelease                                
Get:3 http://us.archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]                              
Get:4 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]                                         
Get:5 http://us.archive.ubuntu.com/ubuntu focal-backports InRelease [108 kB]                                      
Fetched 336 kB in 1s (297 kB/s)                                                              
Traceback (most recent call last):
  File "/usr/lib/cnf-update-db", line 8, in <module>
    from CommandNotFound.db.creator import DbCreator
  File "/usr/lib/python3/dist-packages/CommandNotFound/db/creator.py", line 11, in <module>
    import apt_pkg
ImportError: libapt-pkg.so.6.0: cannot open shared object file: No such file or directory
Reading package lists... Done
E: Problem executing scripts APT::Update::Post-Invoke-Success 'if /usr/bin/test -w /var/lib/command-not-found/ -a -e /usr/lib/cnf-update-db; then /usr/lib/cnf-update-db > /dev/null; fi'
E: Sub-process returned an error code

This is the error I am receiving:

shiyi@shiyi-VM42:$ sudo apt-get upgrade

You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 aptdaemon : Depends: python3-aptdaemon (= 1.1.1+bzr982-0ubuntu32) but 1.1.1+bzr982-0ubuntu19.2 is installed
 dirmngr : Depends: init-system-helpers (>= 1.52) but 1.51 is installed
 gir1.2-gtk-3.0 : Depends: gir1.2-gdkpixbuf-2.0 (>= 2.40.0) but 2.36.11-2 is installed
                  Depends: gir1.2-pango-1.0 (>= 1.41.0) but 1.40.14-1ubuntu0.1 is installed
                  Depends: libgtk-3-0 (>= 3.24.7) but 3.22.30-1ubuntu4 is installed
 gnupg : Depends: gpgv (>= 2.2.19-3ubuntu2)
 gpg-agent : Depends: init-system-helpers (>= 1.52) but 1.51 is installed
 hplip : Depends: hplip-data (= 3.20.3+dfsg0-2) but 3.17.10+repack0-5 is installed
         Depends: libhpmud0 (= 3.20.3+dfsg0-2) but 3.17.10+repack0-5 is installed
         Depends: printer-driver-hpcups (= 3.20.3+dfsg0-2) but 3.17.10+repack0-5 is installed
         Depends: libpython3.8 (>= 3.8.2) but it is not installed
 libsane-hpaio : Depends: libhpmud0 (>= 3.20.3+dfsg0) but 3.17.10+repack0-5 is installed
 python-apt : Depends: python2 (< 2.8) but it is not installed
              Depends: python2 (>= 2.7~) but it is not installed
              Depends: python2:any (< 2.8)
              Depends: python2:any (>= 2.7~)
              Depends: libapt-pkg6.0 (>= 1.9.11~) but it is not installed
 python3-apt : Depends: libapt-pkg6.0 (>= 1.9.11~) but it is not installed
 python3-brlapi : Depends: libbrlapi0.7 but it is not installed
 python3-gi : Depends: libgirepository-1.0-1 (>= 1.62.0-4~) but 1.56.1-1 is installed
 python3-pil : Depends: libfreetype6 (>= 2.9.1) but 2.8.1-2ubuntu2 is installed
               Depends: libimagequant0 (>= 2.11.10) but it is not installed
 python3-protobuf : Depends: libprotobuf17 but it is not installed
 rhythmbox-plugins : Depends: librhythmbox-core10 (= 3.4.4-1ubuntu2) but 3.4.2-4ubuntu1 is installed
                     Depends: rhythmbox (= 3.4.4-1ubuntu2) but 3.4.2-4ubuntu1 is installed
                     Depends: gir1.2-rb-3.0 (= 3.4.4-1ubuntu2) but 3.4.2-4ubuntu1 is installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

How can I fix this?

guiverc avatar
cn flag
You've not provided any OS/release details, which are the starting point for package issues (*deb packages are built for a specific release so release is required detail; snap packages work on all*). A quick look at one picked at random shows https://packages.ubuntu.com/search?keywords=librhythmbox-core10&searchon=names&suite=all&section=all but I don't know your release details! so can do no more. If you're using a *supported* release & match that data, I'd suggest starting with the command `sudo apt update` & peruse the output, any warnings, missing lines etc.
guiverc avatar
cn flag
If you read the link I provided; your pasted details provide no clues as package versions match multiple releases, highlighting you need to examine what you're actually running, plus your sources (ie. the `sudo apt update` is the likely place to start once you work out what you're actually running, as you didn't tell us we're rather limited). A 2020 install is only helpful if we know what was installed; an old release? a new release? a respin of an old release? etc
Shiyi YIN Eleven avatar
za flag
my updates are too long to post in comments, I adjusted my original question
Shiyi YIN Eleven avatar
za flag
File "/usr/lib/python3/dist-packages/CommandNotFound/db/creator.py", line 11, in <module> import apt_pkg ImportError: libapt-pkg.so.6.0: cannot open shared object file: No such file or directory I think maybe this is a problem? I can run python2 and python3, when I try import apt_pkg, I got the same error. But I cant install python-pip, since my apt-get update is not even working
Shiyi YIN Eleven avatar
za flag
http://archive.ubuntu.com/ubuntu/pool/main/a/apt/libapt-pkg6.0_2.0.2_amd64.deb I was able to install this, then the sudo apt-get update runs fine now
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.