Score:-1

Permission denied error running: sudo apt-get update && apt-get install -y

pm flag

This is the error that I get after executing sudo apt-get update && apt-get install -y

Hit:1 http://ir.archive.ubuntu.com/ubuntu focal InRelease
Hit:2 http://ir.archive.ubuntu.com/ubuntu focal-updates InRelease
Get:3 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]
Get:4 http://ir.archive.ubuntu.com/ubuntu focal-backports InRelease [108 kB]
Hit:5 https://repo.steampowered.com/steam stable InRelease 
Get:6 http://dl.google.com/linux/chrome/deb stable InRelease [1,811 B]
Fetched 224 kB in 20s (11.0 kB/s) 
Reading package lists... Done 
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?
us flag
Does this answer your question? [How can I solve "Be aware that removing the lock file is not a solution and may break your system"?](https://askubuntu.com/questions/1286005/how-can-i-solve-be-aware-that-removing-the-lock-file-is-not-a-solution-and-may) (**Restart the computer**)
nobody avatar
gh flag
You forgot sudo after &&
Score:2
ng flag

You forgot to add sudo in the second command so you did not have privileges to run the second command. The install command also did not include the name of a package to install.

The correct syntax for the command you tried to run is:

sudo apt-get update && sudo apt-get install -y packagename

However this command is problematic for a few reasons:

  • When you chain commands with && you do not get to see if the first command was successful or if it needs attention before the second command is executed.

  • When you use the -y option, you ignore confirmation prompts that would let you halt the process if something is not right.

  • sudo apt-get install needs a target package.

It's almost always better to run the commands separately, without the -y option. So one at a time, run:

sudo apt-get update
sudo apt-get install packagename

Replace packagename with the name of the package you are trying to install.

Score:1
cn flag

It is most likely because you aren't using correct syntax when writing the command. Assuming you are trying to install a package and update apt. sudo apt update && sudo apt install <package>. Also, you might want to try to add sudo in front of apt install to run it as root.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.