Idk What This Error Means

NePoran

Member
Joined
Mar 24, 2021
Messages
32
Reaction score
3
Credits
266
E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?

I get this occasionally when running commands, the most recent command I used it for was ubuntu-drivers autoinstall
 


Did you use 'sudo' at the start of your command?
 
Did you use 'sudo' at the start of your command?
This. Or enter sudo -i into the terminal.
Password. And then, reenter your command.

In the future, in case something similar happens, you can also paste the error message into Google and search for solution. That will save your time.
 
G'day all and @NePoran and welcome to linux.org :)

Not likely to be sudo-related.

@NePoran what Linux Distro are you using and version, eg Ubuntu 20.04 or other, and read the link from @KGIII 's signature


Include version information in any support question, preferably in the title.

I am betting Ubuntu or related, and that you entered the command at Terminal shortly after reaching the desktop, is that so?

I'll proceed further when you have answered, but if you are after a quick fix, wait 5 minutes then re-enter the command and see how you go.

Please report the outcome back here.

Chris Turner
wizardfromoz
 
This. Or enter sudo -i into the terminal.
Password. And then, reenter your command.

In the future, in case something similar happens, you can also paste the error message into Google and search for solution. That will save your time.
I didn't think of it, thanks for the suggestion.
 
G'day all and @NePoran and welcome to linux.org :)

Not likely to be sudo-related.

@NePoran what Linux Distro are you using and version, eg Ubuntu 20.04 or other, and read the link from @KGIII 's signature

Include version information in any support question, preferably in the title.

I am betting Ubuntu or related, and that you entered the command at Terminal shortly after reaching the desktop, is that so?

I'll proceed further when you have answered, but if you are after a quick fix, wait 5 minutes then re-enter the command and see how you go.

Please report the outcome back here.

Chris Turner
wizardfromoz

"what Linux Distro are you using and version"
Ubuntu 20.04 GNOME

" and that you entered the command at Terminal shortly after reaching the desktop, is that so?"
Not sure what you mean by reaching the desktop, do you mean after a fresh install?
 
I believe I switched the driver I was using to Nouveau via Additional Drivers.
 
I'm not sure if the error's gone away, I haven't ran the command since yesterday.

However I switched the driver used in Additional Drivers to Nouveau, purged the PPA';s from the original install beforehand, and now I can use 1050p again.

Whenever I go to Additional Drivers now it says it's using a manually installed driver and it's set to continue using that driver.
 
It might be related to automatic updates.

I did a Debian install for a friend, they wanted the standard Gnome3 desktop, so I used the full Debian live installer, rather than my usual Debian minimal.

And after installing - my friend reported that they sometimes had this problem whilst trying to install new programs. Sometimes they could install - other times they got errors about dpkg being locked.

And the problem turned out to be related to the automatic updates.
They had tweaked their system to check for updates multiple times per day.

If they decided to try to manually install something whilst the automatic updates were running in the background, they'd get error messages about dpkg being locked.

In which case, the solution is simply to wait until the updates have finished before trying to install/uninstall anything.

Personally, I disable ALL automatic updates and manually update via a bash script I have in my personal bin directory.
As a developer, I pretty much live in the terminal when I'm using Linux. So typically, I'll run my update script manually when I first log-in, so I can see when the updates have finished (if there even are any) before I try to install anything new.

So I'm guessing that the OP may be having this issue. Automatic updates are occurring in the background and are blocking them from being able to use apt.

Failing that, this also sometimes happens if you try installing some new packages and you kill the process before all of the new packages have been fully installed and configured by dpkg.
If you accidentally kill the installation process before it's finished - dpkg will have set up some lock files.
Typically the following ones:
/var/lib/dpkg/lock
/var/lib/apt/lists/lock
/var/cache/apt/archives/lock

In that scenario, you will need to:
Step 1:
Ensure that any processes that are still using the lock files are terminated.
You can find out the PID's of any processes that are still using the lock files using the following commands:
Bash:
sudo lsof /var/lib/dpkg/lock
sudo lsof /var/lib/apt/lists/lock
sudo lsof /var/cache/apt/archives/lock

If lsof tells you that some processes have any of those files open, proceed to step 2. to kill them.
Otherwise go to step 3.

Step 2:
Once you have identified the PIDs of any processes using those files, you can kill each one using:
Bash:
kill -15 {PID}
NOTE: Replace {PID} in the above with the PID number of the process that has the files open. So if lsof says that process 2125 has the lock-files open, you would use:
Bash:
kill -15 2125
Again 2125 is just an example, replace 2125 with whatever PID was in the output from your lsof commands.
Also note the -15 parameter in the above specifies to send signal15 to the process.
Signal 15 is SIGTERM, which tells the process to cleanly shut itself down - so there is less risk of loss, or corruption of data.

2.a.
Next you need to verify that the process with PID 2125 has closed using:
Bash:
ps -p 2125
That should tell you that the process has been terminated.

2.b.
If the process has not been terminated, then you can issue the following command:
Bash:
kill -9 2125
This sends signal 9 (SIGKILL) which will force the process to immediately shut down. Generally speaking, it's good practice to try killing processes with -15 (SIGTERM) first and then only use signal -9 (SIGKILL) when you absolutely have to.
Repeat the above steps until ALL processes using those lock files are killed. Typically there will only be a single process that has these files open, but you never know!!

Step 3:
Manually remove the lock-files:
Bash:
sudo rm /var/lib/apt/lists/lock
sudo rm /var/cache/apt/archives/lock
sudo rm /var/lib/dpkg/lock

Step 4:
Run the following command to ensure that any partially installed/configured packages are installed cleanly:
Bash:
sudo dpkg --configure -a

Once that completes, you should be able to install/remove new packages using apt in the terminal, or the software centre (or whatever it's called this week!) in the GUI.
 
Last edited:
I did not.

Administrative tasks require 'sudo' which elevates your permissions.

So, 'sudo apt update; sudo apt upgrade' would be good. (These days full-upgrade is recommended, but that's not important for this.)

After entering such a command, you'll be asked to type in your password. When you type in your password, nothing will appear on the screen. This is the normal behavior, just keep typing and trust that you're entering text. When you're done, press the enter button and the command will run with higher permissions than your user account has.
 

Staff online

Members online


Top