0

When I try to install anything (Ubuntu 16.04) with apt or apt-get I get this:

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?

This is the output of ps aux | grep apt:

root     23906  0.0  0.0   4504   784 ?        Ss   Feb20   0:00 /bin/sh /usr/lib/apt/apt.systemd.daily install
root     23912  0.0  0.0   4504  1640 ?        S    Feb20   0:00 /bin/sh /usr/lib/apt/apt.systemd.daily lock_is_held install

But these are the sub processes:

root     23906  0.0  0.0   4504   784 ?        Ss   Feb20   0:00 /bin/sh /usr/lib/apt/apt.systemd.daily install
root     23912  0.0  0.0   4504  1640 ?        S    Feb20   0:00  \_ /bin/sh /usr/lib/apt/apt.systemd.daily lock_is_held install
root     23943  0.1  3.7 140052 77424 ?        S    Feb20  56:54      \_ /usr/bin/python3 /usr/bin/unattended-upgrade
root     23948  0.0  0.0      0     0 ?        Z    Feb20   0:00          \_ [dpkg-deb] <defunct>
root     23965  0.0  2.9 140632 59508 ?        S    Feb20  31:44          \_ /usr/bin/python3 /usr/bin/unattended-upgrade
root     24051  0.0  0.2  19196  4632 pts/0    Ss+  Feb20   0:00              \_ /usr/bin/dpkg --status-fd 10 --configure redis-server:amd64 linux-modules-4.4.0-1102-aws:amd64 linux-image-4.4.0-1102-aws:amd64 linux-image-aws:amd64 linux-a
root     24052  0.0  0.0   4504  1660 pts/0    S+   Feb20   0:00                  \_ /bin/sh /var/lib/dpkg/info/redis-server.postinst configure
root     24094  0.0  0.0   4504  1696 pts/0    S+   Feb20   0:00                      \_ /bin/sh /usr/sbin/invoke-rc.d redis-server start
root     24138  0.0  0.0  24888  1340 pts/0    S+   Feb20   0:11                          \_ systemctl start redis-server.service

I believe that the PIDs from ps aux | grep apt are holding my apt install command but I don't want to kill the redis-server PID in the subprocesses and all the other PIDs eventhough systemctl status says that both redis and redis server state is deactivating (stop-post). And last time someone tried to install anything was redis-server

3
  • shorzly yes, i do ot some times – djdomi Mar 18 '20 at 9:38
  • Thisi is a production server, what would happen to the redis-server and why is it connected with the daily install? – CzipO2 Mar 18 '20 at 9:51
  • root 23948 0.0 0.0 0 0 ? Z Feb20 0:00 \_ [dpkg-deb] <defunct> dpkg is broken sofat kill the processes and restart via apt install -f or dpkg-reconfigure -a – djdomi Mar 21 '20 at 10:20
0

1: Check apt services installed with: systemctl list-units | grep apt

Disable the running apt services: systemctl disable apt*. e.g. sudo systemctl disable apt-daily.service

Refer a very clean process at: https://askubuntu.com/questions/1038923/do-i-really-need-apt-daily-service-and-apt-daily-upgrade-service

2: You might also want to set to zero or false some of the config values of apt.conf files at /etc/apt/apt.conf.d/10periodic

Refer: https://askubuntu.com/questions/1167314/disable-automatic-updates-ubuntu-18-04

You most likely will be good with #1 above.

Hope this helps

Thanks

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.