unable to use apt package manager

Asked by Emma Carlton

I believe this issue began when I tried to install mailutils earlier today using apt-get. the installation seemed to be going normally until I got a pop up in my terminal about the configuration file/config options. I was unable to interact with the message. I don't have a screenshot because I forgot to take one but it was the different config options with "Ok" at the bottom. since I was unable to interact with it I just closed it and went about what I was doing. I then tried to install tmux using apt-get and received this error message:
synth@ai:~$ sudo apt-get install tmux
[sudo] password for synth:
E: Could not get lock /var/lib/dpkg/lock-frontend - open (11: Resource temporarily unavailable)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it?

upon googling it I was sent to https://help.ubuntu.com/community/PackageManagerTroubleshootingProcedure which told me to copy the output of these commands:
ubuntu-support-status

cat /etc/dpkg/dpkg.cfg.d/multiarch

dpkg --print-foreign-architectures

sudo grep -R roxy /etc/apt/*

grep roxy /etc/environment

echo $http_proxy

echo $ftp_proxy

grep roxy /etc/bash.bashrc

grep roxy ~/.bashrc

cat /etc/apt/apt.conf

sudo fuser -vvv /var/lib/dpkg/lock

sudo fuser -vvv /var/cache/apt/archives/lock

cat /etc/lsb-release

uname -a

sudo rm /var/lib/apt/lists/lock

sudo rm /var/cache/apt/archives/lock

sudo rm /var/lib/dpkg/lock

sudo cp -arf /var/lib/dpkg /var/lib/dpkg.backup

sudo mv /var/lib/dpkg/status /var/lib/dpkg/status-bad

sudo cp /var/lib/dpkg/status-old /var/lib/dpkg/status || sudo cp /var/backups/dpkg.status.0 /var/lib/dpkg/status

sudo mv /var/lib/dpkg/available /var/lib/dpkg/available-bad

sudo cp /var/lib/dpkg/available-old /var/lib/dpkg/available

sudo rm -rf /var/lib/dpkg/updates/*

sudo rm -rf /var/lib/apt/lists

sudo rm /var/cache/apt/*.bin

sudo mkdir /var/lib/apt/lists

sudo mkdir /var/lib/apt/lists/partial

LANG=C;sudo apt-get clean

LANG=C;sudo apt-get autoclean

sudo dpkg --configure -a

sudo dpkg --clear-avail

LANG=C;sudo apt-get -f install

LANG=C;sudo apt-get --fix-missing install

LANG=C;sudo apt-get --purge autoremove

LANG=C;sudo apt-get --fix-missing update -o APT::Cache-Limit=100000000

LANG=C;sudo apt-get update -o APT::Cache-Limit=100000000 && sudo apt-get dist-upgrade

find /etc/apt -name '*.list' -exec bash -c 'echo -e "\n$1\n"; cat -n "$1"' _ '{}' \;

sudo dpkg --audit

which are as follows:

synth@ai:~$ ubuntu-support-status
Traceback (most recent call last):
  File "/usr/bin/ubuntu-support-status", line 147, in <module>
    with apt.Cache() as cache:
  File "/usr/lib/python3/dist-packages/apt/cache.py", line 136, in __init__
    self.open(progress)
  File "/usr/lib/python3/dist-packages/apt/cache.py", line 192, in open
    self._depcache = apt_pkg.DepCache(self._cache)
apt_pkg.Error: E:The package postfix needs to be reinstalled, but I can't find an archive for it.
synth@ai:~$
synth@ai:~$ cat /etc/dpkg/dpkg.cfg.d/multiarch
cat: /etc/dpkg/dpkg.cfg.d/multiarch: No such file or directory
synth@ai:~$
synth@ai:~$ dpkg --print-foreign-architectures
i386
synth@ai:~$
synth@ai:~$ sudo grep -R roxy /etc/apt/*
synth@ai:~$
synth@ai:~$ grep roxy /etc/environment
synth@ai:~$
synth@ai:~$ echo $http_proxy

synth@ai:~$
synth@ai:~$ echo $ftp_proxy

synth@ai:~$
synth@ai:~$ grep roxy /etc/bash.bashrc
synth@ai:~$
synth@ai:~$ grep roxy ~/.bashrc
synth@ai:~$
synth@ai:~$ cat /etc/apt/apt.conf
cat: /etc/apt/apt.conf: No such file or directory
synth@ai:~$
synth@ai:~$ sudo fuser -vvv /var/lib/dpkg/lock
synth@ai:~$
synth@ai:~$ sudo fuser -vvv /var/cache/apt/archives/lock
synth@ai:~$
synth@ai:~$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.1 LTS"
synth@ai:~$
synth@ai:~$ uname -a
Linux ai 4.15.0-42-generic #45-Ubuntu SMP Thu Nov 15 19:32:57 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
synth@ai:~$
synth@ai:~$ sudo rm /var/lib/apt/lists/lock
synth@ai:~$
synth@ai:~$ sudo rm /var/cache/apt/archives/lock
synth@ai:~$
synth@ai:~$ sudo rm /var/lib/dpkg/lock
synth@ai:~$
synth@ai:~$ sudo cp -arf /var/lib/dpkg /var/lib/dpkg.backup
synth@ai:~$
synth@ai:~$ sudo mv /var/lib/dpkg/status /var/lib/dpkg/status-bad
synth@ai:~$
synth@ai:~$ sudo cp /var/lib/dpkg/status-old /var/lib/dpkg/status || sudo cp /var/backups/dpkg.status.0 /var/lib/dpkg/status
synth@ai:~$
synth@ai:~$ sudo mv /var/lib/dpkg/available /var/lib/dpkg/available-bad
mv: cannot stat '/var/lib/dpkg/available': No such file or directory
synth@ai:~$
synth@ai:~$ sudo cp /var/lib/dpkg/available-old /var/lib/dpkg/available
cp: cannot stat '/var/lib/dpkg/available-old': No such file or directory
synth@ai:~$
synth@ai:~$ sudo rm -rf /var/lib/dpkg/updates/*
synth@ai:~$
synth@ai:~$ sudo rm -rf /var/lib/apt/lists
synth@ai:~$
synth@ai:~$ sudo rm /var/cache/apt/*.bin
synth@ai:~$
synth@ai:~$ sudo mkdir /var/lib/apt/lists
synth@ai:~$
synth@ai:~$ sudo mkdir /var/lib/apt/lists/partial
synth@ai:~$
synth@ai:~$ LANG=C;sudo apt-get clean
synth@ai:~$
synth@ai:~$ LANG=C;sudo apt-get autoclean
Reading package lists... Done
Building dependency tree
Reading state information... Done
synth@ai:~$
synth@ai:~$ sudo dpkg --configure -a
dpkg: error: dpkg frontend is locked by another process
synth@ai:~$
synth@ai:~$ sudo dpkg --clear-avail
dpkg: error: dpkg frontend is locked by another process
synth@ai:~$
synth@ai:~$ LANG=C;sudo apt-get -f install
E: Could not get lock /var/lib/dpkg/lock-frontend - open (11: Resource temporarily unavailable)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it?
synth@ai:~$
synth@ai:~$ LANG=C;sudo apt-get --fix-missing install
E: Could not get lock /var/lib/dpkg/lock-frontend - open (11: Resource temporarily unavailable)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it?
synth@ai:~$
synth@ai:~$ LANG=C;sudo apt-get --purge autoremove
E: Could not get lock /var/lib/dpkg/lock-frontend - open (11: Resource temporarily unavailable)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it?
synth@ai:~$
synth@ai:~$ LANG=C;sudo apt-get --fix-missing update -o APT::Cache-Limit=100000000
Get:1 http://us.archive.ubuntu.com/ubuntu bionic InRelease [242 kB]
Get:2 https://dl.yarnpkg.com/debian stable InRelease [13.3 kB]
Get:3 https://dl.yarnpkg.com/debian stable/main all Packages [8,242 B]
Get:4 https://dl.yarnpkg.com/debian stable/main amd64 Packages [8,242 B]
Get:5 https://dl.yarnpkg.com/debian stable/main i386 Packages [8,242 B]
Get:6 http://us.archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
Get:7 http://us.archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]
Get:8 http://us.archive.ubuntu.com/ubuntu bionic-security InRelease [83.2 kB]
Get:9 http://us.archive.ubuntu.com/ubuntu bionic/main i386 Packages [1,007 kB]
Get:10 http://us.archive.ubuntu.com/ubuntu bionic/main amd64 Packages [1,019 kB]
Get:11 http://us.archive.ubuntu.com/ubuntu bionic/main Translation-en [516 kB]
Get:12 http://us.archive.ubuntu.com/ubuntu bionic/main amd64 DEP-11 Metadata [477 kB]
Get:13 http://us.archive.ubuntu.com/ubuntu bionic/main DEP-11 48x48 Icons [118 kB]
Get:14 http://us.archive.ubuntu.com/ubuntu bionic/main DEP-11 64x64 Icons [245 kB]
Get:15 http://us.archive.ubuntu.com/ubuntu bionic/restricted i386 Packages [9,156 B]
Get:16 http://us.archive.ubuntu.com/ubuntu bionic/restricted amd64 Packages [9,184 B]
Get:17 http://us.archive.ubuntu.com/ubuntu bionic/restricted Translation-en [3,584 B]
Get:18 http://us.archive.ubuntu.com/ubuntu bionic/universe amd64 Packages [8,570 kB]
Get:19 http://us.archive.ubuntu.com/ubuntu bionic/universe i386 Packages [8,531 kB]
Get:20 http://us.archive.ubuntu.com/ubuntu bionic/universe Translation-en [4,941 kB]
Get:21 http://us.archive.ubuntu.com/ubuntu bionic/universe amd64 DEP-11 Metadata [3,287 kB]
Get:22 http://us.archive.ubuntu.com/ubuntu bionic/universe DEP-11 48x48 Icons [2,151 kB]
Get:23 http://us.archive.ubuntu.com/ubuntu bionic/universe DEP-11 64x64 Icons [8,420 kB]
Get:24 http://us.archive.ubuntu.com/ubuntu bionic/multiverse i386 Packages [144 kB]
Get:25 http://us.archive.ubuntu.com/ubuntu bionic/multiverse amd64 Packages [151 kB]
Get:26 http://us.archive.ubuntu.com/ubuntu bionic/multiverse Translation-en [108 kB]
Get:27 http://us.archive.ubuntu.com/ubuntu bionic/multiverse amd64 DEP-11 Metadata [49.7 kB]
Get:28 http://us.archive.ubuntu.com/ubuntu bionic/multiverse DEP-11 48x48 Icons [8,931 B]
Get:29 http://us.archive.ubuntu.com/ubuntu bionic/multiverse DEP-11 64x64 Icons [225 kB]
Get:30 http://us.archive.ubuntu.com/ubuntu bionic-updates/main i386 Packages [400 kB]
Get:31 http://us.archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages [457 kB]
Get:32 http://us.archive.ubuntu.com/ubuntu bionic-updates/main Translation-en [171 kB]
Get:33 http://us.archive.ubuntu.com/ubuntu bionic-updates/main amd64 DEP-11 Metadata [245 kB]
Get:34 http://us.archive.ubuntu.com/ubuntu bionic-updates/main DEP-11 48x48 Icons [55.7 kB]
Get:35 http://us.archive.ubuntu.com/ubuntu bionic-updates/main DEP-11 64x64 Icons [105 kB]
Get:36 http://us.archive.ubuntu.com/ubuntu bionic-updates/restricted i386 Packages [6,928 B]
Get:37 http://us.archive.ubuntu.com/ubuntu bionic-updates/restricted amd64 Packages [6,992 B]
Get:38 http://us.archive.ubuntu.com/ubuntu bionic-updates/restricted Translation-en [3,076 B]
Get:39 http://us.archive.ubuntu.com/ubuntu bionic-updates/universe i386 Packages [587 kB]
Get:40 http://us.archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages [593 kB]
Get:41 http://us.archive.ubuntu.com/ubuntu bionic-updates/universe Translation-en [166 kB]
Get:42 http://us.archive.ubuntu.com/ubuntu bionic-updates/universe amd64 DEP-11 Metadata [199 kB]
Get:43 http://us.archive.ubuntu.com/ubuntu bionic-updates/universe DEP-11 48x48 Icons [185 kB]
Get:44 http://us.archive.ubuntu.com/ubuntu bionic-updates/universe DEP-11 64x64 Icons [328 kB]
Get:45 http://us.archive.ubuntu.com/ubuntu bionic-updates/multiverse i386 Packages [6,524 B]
Get:46 http://us.archive.ubuntu.com/ubuntu bionic-updates/multiverse amd64 Packages [6,372 B]
Get:47 http://us.archive.ubuntu.com/ubuntu bionic-updates/multiverse Translation-en [3,356 B]
Get:48 http://us.archive.ubuntu.com/ubuntu bionic-updates/multiverse amd64 DEP-11 Metadata [2,468 B]
Get:49 http://us.archive.ubuntu.com/ubuntu bionic-updates/multiverse DEP-11 48x48 Icons [29 B]
Get:50 http://us.archive.ubuntu.com/ubuntu bionic-updates/multiverse DEP-11 64x64 Icons [2,638 B]
Get:51 http://us.archive.ubuntu.com/ubuntu bionic-backports/universe amd64 Packages [3,468 B]
Get:52 http://us.archive.ubuntu.com/ubuntu bionic-backports/universe i386 Packages [3,476 B]
Get:53 http://us.archive.ubuntu.com/ubuntu bionic-backports/universe Translation-en [1,604 B]
Get:54 http://us.archive.ubuntu.com/ubuntu bionic-backports/universe amd64 DEP-11 Metadata [5,816 B]
Get:55 http://us.archive.ubuntu.com/ubuntu bionic-backports/universe DEP-11 48x48 Icons [29 B]
Get:56 http://us.archive.ubuntu.com/ubuntu bionic-backports/universe DEP-11 64x64 Icons [29 B]
Get:57 http://us.archive.ubuntu.com/ubuntu bionic-security/main i386 Packages [169 kB]
Get:58 http://us.archive.ubuntu.com/ubuntu bionic-security/main amd64 Packages [219 kB]
Get:59 http://us.archive.ubuntu.com/ubuntu bionic-security/main Translation-en [84.3 kB]
Get:60 http://us.archive.ubuntu.com/ubuntu bionic-security/main amd64 DEP-11 Metadata [204 B]
Get:61 http://us.archive.ubuntu.com/ubuntu bionic-security/main DEP-11 48x48 Icons [29 B]
Get:62 http://us.archive.ubuntu.com/ubuntu bionic-security/main DEP-11 64x64 Icons [29 B]
Get:63 http://us.archive.ubuntu.com/ubuntu bionic-security/universe i386 Packages [105 kB]
Get:64 http://us.archive.ubuntu.com/ubuntu bionic-security/universe amd64 Packages [106 kB]
Get:65 http://us.archive.ubuntu.com/ubuntu bionic-security/universe Translation-en [60.7 kB]
Get:66 http://us.archive.ubuntu.com/ubuntu bionic-security/universe amd64 DEP-11 Metadata [14.5 kB]
Get:67 http://us.archive.ubuntu.com/ubuntu bionic-security/universe DEP-11 48x48 Icons [9,088 B]
Get:68 http://us.archive.ubuntu.com/ubuntu bionic-security/universe DEP-11 64x64 Icons [36.7 kB]
Get:69 http://us.archive.ubuntu.com/ubuntu bionic-security/multiverse i386 Packages [1,608 B]
Get:70 http://us.archive.ubuntu.com/ubuntu bionic-security/multiverse amd64 Packages [1,440 B]
Get:71 http://us.archive.ubuntu.com/ubuntu bionic-security/multiverse Translation-en [996 B]
Fetched 44.9 MB in 1min 2s (721 kB/s)
Reading package lists... Done
synth@ai:~$
synth@ai:~$ LANG=C;sudo apt-get update -o APT::Cache-Limit=100000000 && sudo apt-get dist-upgrade
Hit:1 http://us.archive.ubuntu.com/ubuntu bionic InRelease
Hit:2 https://dl.yarnpkg.com/debian stable InRelease
Hit:3 http://us.archive.ubuntu.com/ubuntu bionic-updates InRelease
Hit:4 http://us.archive.ubuntu.com/ubuntu bionic-backports InRelease
Hit:5 http://us.archive.ubuntu.com/ubuntu bionic-security InRelease
Reading package lists... Done
E: Could not get lock /var/lib/dpkg/lock-frontend - open (11: Resource temporarily unavailable)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it?
synth@ai:~$
synth@ai:~$ find /etc/apt -name '*.list' -exec bash -c 'echo -e "\n$1\n"; cat -n "$1"' _ '{}' \;

/etc/apt/sources.list.d/alexlarsson-ubuntu-flatpak-bionic.list

     1 # deb http://ppa.launchpad.net/alexlarsson/flatpak/ubuntu bionic main
     2 # deb-src http://ppa.launchpad.net/alexlarsson/flatpak/ubuntu bionic main

/etc/apt/sources.list.d/system76-ubuntu-pop-bionic.list

     1 # deb http://ppa.launchpad.net/system76/pop/ubuntu bionic main
     2 # deb-src http://ppa.launchpad.net/system76/pop/ubuntu bionic main

/etc/apt/sources.list.d/ubuntu-toolchain-r-ubuntu-test-bionic.list

     1 # deb http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu bionic main
     2 # deb-src http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu bionic main
     3 # deb-src http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu bionic main
     4 # deb-src http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu bionic main

/etc/apt/sources.list.d/yarn.list

     1 deb https://dl.yarnpkg.com/debian/ stable main

/etc/apt/sources.list

     1 # deb cdrom:[Ubuntu 18.04.1 LTS _Bionic Beaver_ - Release amd64 (20180725)]/ bionic main restricted
     2
     3 # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
     4 # newer versions of the distribution.
     5 deb http://us.archive.ubuntu.com/ubuntu/ bionic main restricted
     6 # deb-src http://ca.archive.ubuntu.com/ubuntu/ bionic main restricted
     7
     8 ## Major bug fix updates produced after the final release of the
     9 ## distribution.
    10 deb http://us.archive.ubuntu.com/ubuntu/ bionic-updates main restricted
    11 # deb-src http://ca.archive.ubuntu.com/ubuntu/ bionic-updates main restricted
    12
    13 ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
    14 ## team. Also, please note that software in universe WILL NOT receive any
    15 ## review or updates from the Ubuntu security team.
    16 deb http://us.archive.ubuntu.com/ubuntu/ bionic universe
    17 # deb-src http://ca.archive.ubuntu.com/ubuntu/ bionic universe
    18 deb http://us.archive.ubuntu.com/ubuntu/ bionic-updates universe
    19 # deb-src http://ca.archive.ubuntu.com/ubuntu/ bionic-updates universe
    20
    21 ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
    22 ## team, and may not be under a free licence. Please satisfy yourself as to
    23 ## your rights to use the software. Also, please note that software in
    24 ## multiverse WILL NOT receive any review or updates from the Ubuntu
    25 ## security team.
    26 deb http://us.archive.ubuntu.com/ubuntu/ bionic multiverse
    27 # deb-src http://ca.archive.ubuntu.com/ubuntu/ bionic multiverse
    28 deb http://us.archive.ubuntu.com/ubuntu/ bionic-updates multiverse
    29 # deb-src http://ca.archive.ubuntu.com/ubuntu/ bionic-updates multiverse
    30
    31 ## N.B. software from this repository may not have been tested as
    32 ## extensively as that contained in the main release, although it includes
    33 ## newer versions of some applications which may provide useful features.
    34 ## Also, please note that software in backports WILL NOT receive any review
    35 ## or updates from the Ubuntu security team.
    36 deb http://us.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse
    37 # deb-src http://ca.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse
    38
    39 ## Uncomment the following two lines to add software from Canonical's
    40 ## 'partner' repository.
    41 ## This software is not part of Ubuntu, but is offered by Canonical and the
    42 ## respective vendors as a service to Ubuntu users.
    43 # deb http://archive.canonical.com/ubuntu bionic partner
    44 # deb-src http://archive.canonical.com/ubuntu bionic partner
    45
    46 deb http://us.archive.ubuntu.com/ubuntu/ bionic-security main restricted
    47 # deb-src http://security.ubuntu.com/ubuntu bionic-security main restricted
    48 deb http://us.archive.ubuntu.com/ubuntu/ bionic-security universe
    49 # deb-src http://security.ubuntu.com/ubuntu bionic-security universe
    50 deb http://us.archive.ubuntu.com/ubuntu/ bionic-security multiverse
    51 # deb-src http://security.ubuntu.com/ubuntu bionic-security multiverse
synth@ai:~$
synth@ai:~$

I'm certain this somehow pertains to my attempt to install mailutils. I have followed the instructions on the troubleshooting page up to the step about posting the output of the aforementioned commands. I don't really care if I end up with mailutils installed or not but I'd like to be able to install things again. Any help would be appreciated. Thanks!
ps I am using Ubuntu 18.04, pretty much default (gnome, gtk3, etc) I don't know if that information is helpful but there it is.

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Manfred Hampl (m-hampl) said :
#1

The cause of your problem is that you killed the configuration dialogue for mailutils, which left the package management system in a "locked" status.

To release this lock you can reboot your system or use the command
sudo fuser -ki /var/lib/dpkg/lock-frontend

Afterwards the package management probably will need to be brought back into a consistent status, e.g. with the command
sudo dpkg --configure -a
This will try completing the installation of mailutils.

Navigation in a configuration dialogue like the one you had is done with the up, down, tab, back-tab and space keys.

Can you help with this problem?

Provide an answer of your own, or ask Emma Carlton for more information if necessary.

To post a message you must log in.