[SOLVED] apt-get update resulted in "Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)"
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
apt-get update resulted in "Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)"
No response to my post yesterday yet. I am thinking it was too long.
This thread contains one part of the earlier thread. One step at a time,right ?
Maybe fixing this is all I need....
maggie@linux ~ $ apt-get update
Reading package lists... Done
E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)
E: Unable to lock directory /var/lib/apt/lists/
W: Problem unlinking the file /var/cache/apt/pkgcache.bin - RemoveCaches (13: Permission denied)
W: Problem unlinking the file /var/cache/apt/srcpkgcache.bin - RemoveCaches (13: Permission denied)
maggie@linux ~ $
There are no errors, yet no fix either. I ran apt-get update again, and it was identical to the first time above...
I found there are some root fixes possible, but I also read one false move in root and I could ruin my system.
#2 Question What is the significance in the E: and the W: ?
#3 And how do I get my terminal results in their own box in this thread ?
Welcome to the world of Linux. I love it, everything on my 7 year old laptop just works.
I'm confused, you got errors running apt-get as maggie but when you used sudo everything worked normally. I don't see your problem. To paste terminal output into a post use {code} paste contents {/code}. Use [] instead of the {} I used.
You can highlight the contents of the terminal session with your mouse and then middle click in the post to paste the terminal contents.
craigevil,
Thanks for responding. "You have to be root or use sudo to update." So, sudo commands are safer then. Good to know.
And the "apt-get update" command requires I be root. Got it. Not ready to be root yet lol !
When I used sudo apt-get update && sudo apt-get upgrade I have questions about the result
Fetched 214 kB in 2s (87.0 kB/s)
Reading package lists... Done
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Since 214kb were fetched, why is it 0 upgraded ?
And is the combined sudo apt-get update && sudo apt-get upgrade
the best command to get both update and upgrade all at once ? Finally, is using update manager alone pretty reliable ?
PsychoHermit,Sorry, I did not follow/ " use {code} paste contents. " Where do I find "code" ?
And what does "ign" stand for in #6 on $ sudo apt-get update && sudo apt-get upgrade ?
Thanks to both of you !!!
I always set up exactly one user which is "an administrator" – that is, "a member of the wheel group." Every other user, including all of the ones that I daily use, are not a member of that group and therefore do not have the power to gain root access no matter how hard they may try.
Anytime I need to put on blue tights and fly around, I walk into that telephone booth. I use it for no other purposes. You will never guess its random password, and you cannot log into it remotely even if you did know the magic word.
"Computers are terrible at knowing when to say 'yes,' but they are wonderful at saying 'no.'" Therefore I use this principle of least privilege on a daily basis. If you sneak some program into my account and try to run it on my behalf to do nasty things to my system, you will find that it doesn't work – my user does not have the power. And, if you try to snoop around into other users' /home/xxx directories, you will find that you have no access to them.
Last edited by sundialsvcs; 10-12-2021 at 08:58 AM.
Location: Montreal, Quebec and Dartmouth, Nova Scotia CANADA
Distribution: Arch, AntiX, ArtiX
Posts: 1,364
Rep:
Hi magster,
Concerning privileges / sudo / root :
Certain commands (basically those affecting system files) need to be run with higher privileges. Updating your system is one of those types of commands.
The "root" user is analogous to "local administrator" in the Windows world. The code has all privileges on everything. If needed, most distros let you log in using the root user, but that is not necessary in everyday situations (see next point).
The "sudo" and "su" commands temporarily enable a non-root user to execute the above type of commands by temporarily "substituting" their user for another to execute the command. If no specific user is specified, the system presumes you want to substitute "root". The difference between the 2 commands is that "sudo" (short for substitute user do) is a preface for a specific command and su is simply the command that will bring you a command prompt under the substituted user code (useful if you have several tasks to accomplish ...).
... so as mentioned above by ondoho, "sudo" (or "su") isn't a "safer" way of executing certain commands, it is rather one of the options you have to acquire the required privileges to execute certain commands.
Finally, as others have mentioned, your "update" and "upgrade" commands seem to be functioning correctly. "Update" simply updates your local package database (what is available in the online repositories - as mentioned, this is the small amount of data downloaded) and "upgrade" will install any new versions of packages already installed on your system (in your case, you don't have anything to upgrade yet).
Hope this helps - let us know if you need further help.
The difference between the 2 commands is that "sudo" (short for substitute user do) is a preface for a specific command and su is simply the command that will bring you a command prompt under the substituted user code (useful if you have several tasks to accomplish ...).
That's the common usage, but you can bring the command prompt with sudo -i and you can execute a command with su -c some_command. The crucial difference is that su - expects the password of root (and, more generally, su some_user the password of some_user), while sudo always expects your password.
Ondoho,
I did not realize sudo DOES have root priveleges. Not as much as full root priveleges. Basically, I Could inadvertantly mess up my computer more easily using full root,I hear what you are saying though...
Thanks for your input. For now, I feel safer using sudo commands and not even having full root control.
Is there any reason (safety wise) you see that I ought to set it up anyway so I could have full root control b4 I plan to use it ?
THanks.
Thanks for your clear explanations !
"Update" simply updates your local package database (what is available in the online repositories - as mentioned, this is the small amount of data downloaded)
That explains why when I see "fetched # kB" in an update, I do not see it reflected at the screen bottom
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
THat is only actual UPDATES that will be listed there. Is that correct ?
Now I understand that !
If in the future I post something, and there is no feedback, or I do not understand what a person replies, is it possible I could message you somehow through this platform? If you are okay with that, how would I do that ?
Location: Montreal, Quebec and Dartmouth, Nova Scotia CANADA
Distribution: Arch, AntiX, ArtiX
Posts: 1,364
Rep:
Quote:
Originally Posted by magster
Rickkkk,
Thanks for your clear explanations !
"Update" simply updates your local package database (what is available in the online repositories - as mentioned, this is the small amount of data downloaded)
That explains why when I see "fetched # kB" in an update, I do not see it reflected at the screen bottom
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
THat is only actual UPDATES that will be listed there. Is that correct ?
Now I understand that !
If in the future I post something, and there is no feedback, or I do not understand what a person replies, is it possible I could message you somehow through this platform? If you are okay with that, how would I do that ?
THanks sooo much !
Maggie
Hey Maggie - glad that helped. You'll usually get a lot of useful responses from members here, many with much more experience than me. However, feel free to message me anytime - you just click on my user name and choose private message. I will add you to my contacts.
Let's try it again. To post something and preserve the formatting you have to use the code tags. I'm substituting {} for [] because using [] would not be visible to you. It would interpret the code tags and make a code block.
{code}
Pasted terminal output.
{/code}
To copy and paste terminal output into your browser you highlight the terminal output with your mouse and then go to your browser and click the middle mouse button. Saves a lot of typing. Update is a script on my machine that does
Code:
sudo apt-get update && sudo apt-get upgrade
Pasted from a terminal session.
Code:
glenn@PsychoBox:~$ update
Hit:1 http://security.ubuntu.com/ubuntu focal-security InRelease
Hit:2 http://us.archive.ubuntu.com/ubuntu focal InRelease
Hit:3 http://us.archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:4 http://us.archive.ubuntu.com/ubuntu focal-backports InRelease
Reading package lists... Done
Building dependency tree
Reading state information... Done
All packages are up to date.
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Hopefully this made sense, it will save you a lot of typing.
--glenn
Last edited by PsychoHermit; 10-13-2021 at 09:05 PM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.