LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 10-11-2021, 09:29 PM   #1
magster
Member
 
Registered: Nov 2020
Distribution: "Linux Mint" VERSION="20.2 (Uma)"
Posts: 144

Rep: Reputation: Disabled
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 ~ $

I found a possible fix online and tried it

maggie@linux ~ $ sudo apt-get update && sudo apt-get upgrade
[sudo] password for maggie:
Hit:1 http://security.ubuntu.com/ubuntu focal-security InRelease
Hit:2 http://archive.canonical.com/ubuntu focal InRelease
Hit:3 https://repo.skype.com/deb stable InRelease
Hit:4 http://archive.ubuntu.com/ubuntu focal InRelease
Get:5 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Ign:6 http://packages.linuxmint.com uma InRelease
Hit:7 http://packages.linuxmint.com uma Release
Get:8 http://archive.ubuntu.com/ubuntu focal-backports InRelease [101 kB]
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.
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 ?

I can use some help to fix this. Any takers ?
 
Old 10-11-2021, 09:53 PM   #2
craigevil
Senior Member
 
Registered: Apr 2005
Location: OZ
Distribution: Debian Sid/RPIOS
Posts: 4,886
Blog Entries: 28

Rep: Reputation: 533Reputation: 533Reputation: 533Reputation: 533Reputation: 533Reputation: 533
You have to be root or use sudo to update.
 
1 members found this post helpful.
Old 10-11-2021, 09:59 PM   #3
PsychoHermit
Member
 
Registered: Aug 2021
Location: Carson City Nevada
Distribution: Debian Testing
Posts: 137

Rep: Reputation: Disabled
sudo apt-get update sudo apt-get upgrade

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.

--glenn
 
1 members found this post helpful.
Old 10-11-2021, 11:45 PM   #4
magster
Member
 
Registered: Nov 2020
Distribution: "Linux Mint" VERSION="20.2 (Uma)"
Posts: 144

Original Poster
Rep: Reputation: Disabled
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 !!!

Last edited by magster; 10-11-2021 at 11:47 PM.
 
Old 10-12-2021, 02:51 AM   #5
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Quote:
Originally Posted by magster View Post
So, sudo commands are safer then.
Nobody said that. Do not jump to conclusions.
Remove that idea from your mind please, because it is wrong.
Quote:
Originally Posted by magster View Post
Since 214kb were fetched, why is it 0 upgraded ?
The 214kB (Byte, not bit) are just the list of packages.

Quote:
Originally Posted by magster View Post
And is the combined sudo apt-get update && sudo apt-get upgrade the best command to get both update and upgrade all at once ?
Not sure it's the best, but it's valid.

BTW, this is OP's earlier thread.

Last edited by ondoho; 10-12-2021 at 02:55 AM.
 
1 members found this post helpful.
Old 10-12-2021, 08:56 AM   #6
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941
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.
 
1 members found this post helpful.
Old 10-12-2021, 09:34 AM   #7
Rickkkk
Senior Member
 
Registered: Dec 2014
Location: Montreal, Quebec and Dartmouth, Nova Scotia CANADA
Distribution: Arch, AntiX, ArtiX
Posts: 1,364

Rep: Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511
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.

Cheers,

Rick

Last edited by Rickkkk; 10-12-2021 at 09:37 AM.
 
1 members found this post helpful.
Old 10-12-2021, 11:10 AM   #8
shruggy
Senior Member
 
Registered: Mar 2020
Posts: 3,670

Rep: Reputation: Disabled
Quote:
Originally Posted by Rickkkk View Post
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.
 
2 members found this post helpful.
Old 10-12-2021, 02:57 PM   #9
magster
Member
 
Registered: Nov 2020
Distribution: "Linux Mint" VERSION="20.2 (Uma)"
Posts: 144

Original Poster
Rep: Reputation: Disabled
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.
 
Old 10-12-2021, 03:06 PM   #10
magster
Member
 
Registered: Nov 2020
Distribution: "Linux Mint" VERSION="20.2 (Uma)"
Posts: 144

Original Poster
Rep: Reputation: Disabled
sundialsvcs,

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.
 
Old 10-12-2021, 03:11 PM   #11
magster
Member
 
Registered: Nov 2020
Distribution: "Linux Mint" VERSION="20.2 (Uma)"
Posts: 144

Original Poster
Rep: Reputation: Disabled
shruggy,

I guess to use su you must have a password. One different from my sudo one....THanks for that info.
 
Old 10-12-2021, 03:20 PM   #12
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,705

Rep: Reputation: 5898Reputation: 5898Reputation: 5898Reputation: 5898Reputation: 5898Reputation: 5898Reputation: 5898Reputation: 5898Reputation: 5898Reputation: 5898Reputation: 5898
I posted a response in your other thread https://www.linuxquestions.org/quest...ma-4175701820/ as to why you might see the posted error.

Yes, it helps to only post one question in a thread and posting multiple threads on the same topic does cause confusion...
 
1 members found this post helpful.
Old 10-12-2021, 03:29 PM   #13
magster
Member
 
Registered: Nov 2020
Distribution: "Linux Mint" VERSION="20.2 (Uma)"
Posts: 144

Original Poster
Rep: Reputation: Disabled
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
 
Old 10-12-2021, 04:39 PM   #14
Rickkkk
Senior Member
 
Registered: Dec 2014
Location: Montreal, Quebec and Dartmouth, Nova Scotia CANADA
Distribution: Arch, AntiX, ArtiX
Posts: 1,364

Rep: Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511
Quote:
Originally Posted by magster View Post
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.

Cheers,

Rick
 
1 members found this post helpful.
Old 10-12-2021, 06:31 PM   #15
PsychoHermit
Member
 
Registered: Aug 2021
Location: Carson City Nevada
Distribution: Debian Testing
Posts: 137

Rep: Reputation: Disabled
Hi Maggie,

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.
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied) Ztcoracat Debian 5 02-23-2019 10:02 AM
E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied) Grimm666 Linux - Newbie 3 07-16-2015 02:16 AM
open lock file /var/lib/postfix/master.lock: cannot open file: Permission denied gabsik Linux - Server 6 08-30-2012 09:39 PM
[SOLVED] 404errors when running apt-get update already tried sudo rm /var/lib/apt/lists/* -vf rasec8711 Linux - Software 2 05-31-2012 10:33 AM
Could not open lock file /var/lib/dpkg/lock - open (13 Permission denied) basina Linux - Laptop and Netbook 3 09-05-2011 05:18 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:36 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration