Could not get lock /var/lib/dpkg/lock-frontend

It worked yesterday. I got to a screen that had Ok on it, but could not figure out how to proceed.

Logging out did not help.

sudo apt-get install ubuntu-restricted-extras
[sudo] password for andy: 
E: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 60204 (apt-get)
N: Be aware that removing the lock file is not a solution and may break your system.
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it?

I get that once in a while because Apt check sometimes runs in the background. Do not kill the other dpkg manually, it will muck up your system. To stop this from happening turn off auto updates in Software & Updates

4 Likes

Try the guide here: [Solved] Could not get lock /var/lib/dpkg/lock Error in Ubuntu

Specifically the section: 'Troubleshooting 1: "Unable to acquire the dpkg frontend lock".'

1 Like

'Unattended upgrades' also run in the background. That will do the same thing. I don't recommend it for everyone, you have to be diligent about uprgading every day if you do, but I usually remove it the first time it gives me trouble shutting down. It reminds me to much of Windoze forced updates.

1 Like

I agree with others, in that unattended upgrades can often get in the way (it does for many of us, myself included), but I'll suggest also checking your other terminals (both graphic & text for me), as I often find I've started something in a different workspace etc, then promptly forgot about due to other distraction... (ie. I've locked myself out)

2 Likes

I very rarely do any restarts or shutdowns.

If I do a restart as part of "maintenance", will that be recognized and a proper undamaging restart occurs?

Sometimes commands, do not show up when I do the up/down arrow thing in a terminal.

Can that be fixed?

How can I do my own upgrades?

With my memory issues, can I automate that so I do not miss anything.

Sometimes I will uncheck a program because I do not use it.

Is that o.k.?

Two questions . The first requires a little understanding: Linux (and its forerunner, Unix) is possibly the most stable operating system extant today, but my experience has been that no OS is infallible. I will typically do a restart on my systems (all of them, not just Linux) every 15-20 days or so. Even though there are maintenance jobs that run unattended, cruft has a tendency to accumulate (temp files, etc.) and a restart simply puts everything back into smooth, proper order.

I like my server running 24x7x365, but having a short 5-10 minute down time periodically I think makes things just run more smoothly. I just reboot when I don't think I'll be needing my resources for a while.

As for your terminal commands, that might be part of your 'history' setting. Take a look at your ~/.bashrc to see if you have key bindings set. Then, check to see if you don't invoke key bindings that overwrite them. Also, you can probably use Ctrl-R to search your command history. Lastly, you can set your history for the number of commands it remembers. If you type history at the command prompt, you'll see what it contains.

3 Likes

Just my opinion:

  • unattended upgrades are inadvisable; I prefer to have eyes on in case anything breaks during the process.

Before un-checking a program or "removing completely" you need to be absolutely sure of the dependencies so that nothing else breaks.

4 Likes