13: Permission Denied During Updates


I'm trying to run a simple apt-get update && apt-get upgrade -y command, however, when I run that command, I get this:

apt-get update && apt-get upgrade -y
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)

When I run the same command with sudo prefix I get more progress, but still no luck. Her's the output that I get when I run sudo apt-get update && apt-get upgrade -y:

[sudo] password for example_user:
Hit:1 http://mirrors.linode.com/ubuntu eoan InRelease
Get:2 http://mirrors.linode.com/ubuntu eoan-updates InRelease [97.5 kB]
Get:3 http://mirrors.linode.com/ubuntu eoan-backports InRelease [88.8 kB]
Get:4 http://security.ubuntu.com/ubuntu eoan-security InRelease [97.5 kB]
Get:5 http://mirrors.linode.com/ubuntu eoan-updates/main i386 Packages [76.2 kB]
Get:6 http://mirrors.linode.com/ubuntu eoan-updates/main amd64 Packages [99.7 kB]
Get:7 http://mirrors.linode.com/ubuntu eoan-updates/main Translation-en [37.0 kB]
Get:8 http://mirrors.linode.com/ubuntu eoan-updates/main amd64 c-n-f Metadata [1,792 B]
Get:9 http://mirrors.linode.com/ubuntu eoan-updates/restricted amd64 Packages [5,140 B]
Get:10 http://mirrors.linode.com/ubuntu eoan-updates/restricted Translation-en [1,188 B]
Get:11 http://mirrors.linode.com/ubuntu eoan-updates/universe i386 Packages [39.2 kB]
Get:12 http://mirrors.linode.com/ubuntu eoan-updates/universe amd64 Packages [41.6 kB]
Get:13 http://mirrors.linode.com/ubuntu eoan-updates/universe Translation-en [21.7 kB]
Get:14 http://mirrors.linode.com/ubuntu eoan-updates/universe amd64 c-n-f Metadata [1,736 B]
Get:15 http://mirrors.linode.com/ubuntu eoan-updates/multiverse i386 Packages [1,340 B]
Get:16 http://mirrors.linode.com/ubuntu eoan-updates/multiverse amd64 Packages [1,172 B]
Get:17 http://mirrors.linode.com/ubuntu eoan-backports/universe amd64 Packages [2,940 B]
Get:18 http://mirrors.linode.com/ubuntu eoan-backports/universe i386 Packages [2,944 B]
Get:19 http://mirrors.linode.com/ubuntu eoan-backports/universe amd64 c-n-f Metadata [188 B]
Get:20 http://security.ubuntu.com/ubuntu eoan-security/main amd64 Packages [70.9 kB]
Get:21 http://security.ubuntu.com/ubuntu eoan-security/main i386 Packages [47.6 kB]
Get:22 http://security.ubuntu.com/ubuntu eoan-security/main Translation-en [26.9 kB]
Get:23 http://security.ubuntu.com/ubuntu eoan-security/main amd64 c-n-f Metadata [1,456 B]
Get:24 http://security.ubuntu.com/ubuntu eoan-security/restricted amd64 Packages [5,140 B]
Get:25 http://security.ubuntu.com/ubuntu eoan-security/restricted Translation-en [1,188 B]
Get:26 http://security.ubuntu.com/ubuntu eoan-security/universe amd64 Packages [30.1 kB]
Get:27 http://security.ubuntu.com/ubuntu eoan-security/universe i386 Packages [27.9 kB]
Get:28 http://security.ubuntu.com/ubuntu eoan-security/universe Translation-en [16.1 kB]
Get:29 http://security.ubuntu.com/ubuntu eoan-security/universe amd64 c-n-f Metadata [1,448 B]
Get:30 http://security.ubuntu.com/ubuntu eoan-security/multiverse amd64 Packages [1,172 B]
Get:31 http://security.ubuntu.com/ubuntu eoan-security/multiverse i386 Packages [1,340 B]
Fetched 849 kB in 3s (279 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?

I'm not using a root account, but the "example_user" is part of sudo group.

Just for kicks, I went ahead and logged on using root account and ran the apt-get update && apt-get upgrade -y command again. Here's the output I got:

Hit:1 http://mirrors.linode.com/ubuntu eoan InRelease
Hit:2 http://mirrors.linode.com/ubuntu eoan-updates InRelease
Hit:3 http://mirrors.linode.com/ubuntu eoan-backports InRelease
Hit:4 http://security.ubuntu.com/ubuntu eoan-security InRelease
Reading package lists… Done
Reading package lists… Done
Building dependency tree
Reading state information… Done
Calculating upgrade… Done
The following packages have been kept back:
linux-generic linux-headers-generic linux-image-generic
The following packages will be upgraded:
intel-microcode klibc-utils libklibc linux-firmware
4 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
Need to get 85.5 MB of archives.
After this operation, 611 kB of additional disk space will be used.
Get:1 http://mirrors.linode.com/ubuntu eoan-updates/main amd64 klibc-utils amd64 2.0.6-1ubuntu3 [95.7 kB]
Get:2 http://mirrors.linode.com/ubuntu eoan-updates/main amd64 libklibc amd64 2.0.6-1ubuntu3 [41.9 kB]
Get:3 http://mirrors.linode.com/ubuntu eoan-updates/main amd64 linux-firmware all 1.183.2 [83.0 MB]
Get:4 http://mirrors.linode.com/ubuntu eoan-updates/main amd64 intel-microcode amd64 3.20191112-0ubuntu0.19.10.2 [2,406 kB]
Fetched 85.5 MB in 2s (55.5 MB/s)
(Reading database … 106177 files and directories currently installed.)
Preparing to unpack …/klibc-utils_2.0.6-1ubuntu3_amd64.deb …
Unpacking klibc-utils (2.0.6-1ubuntu3) over (2.0.6-1ubuntu2) …
Preparing to unpack …/libklibc_2.0.6-1ubuntu3_amd64.deb …
Unpacking libklibc:amd64 (2.0.6-1ubuntu3) over (2.0.6-1ubuntu2) …
Preparing to unpack …/linux-firmware_1.183.2_all.deb …
Unpacking linux-firmware (1.183.2) over (1.183.1) …
Preparing to unpack …/intel-microcode_3.20191112-0ubuntu0.19.10.2_amd64.deb …
Unpacking intel-microcode (3.20191112-0ubuntu0.19.10.2) over (3.20190918.1ubuntu1) …
Setting up linux-firmware (1.183.2) …
update-initramfs: Generating /boot/initrd.img-5.3.0-19-generic
I: The initramfs will attempt to resume from /dev/sdb
I: (UUID=76696225-bd13-49b4-ad48-770c55aa8769)
I: Set the RESUME variable to override this.
update-initramfs: Generating /boot/initrd.img-5.3.0-18-generic
I: The initramfs will attempt to resume from /dev/sdb
I: (UUID=76696225-bd13-49b4-ad48-770c55aa8769)
I: Set the RESUME variable to override this.
Setting up intel-microcode (3.20191112-0ubuntu0.19.10.2) …
update-initramfs: deferring update (trigger activated)
intel-microcode: microcode will be updated at next boot
Setting up libklibc:amd64 (2.0.6-1ubuntu3) …
Setting up klibc-utils (2.0.6-1ubuntu3) …
Processing triggers for initramfs-tools (0.133ubuntu10) …
update-initramfs: Generating /boot/initrd.img-5.3.0-19-generic
I: The initramfs will attempt to resume from /dev/sdb
I: (UUID=76696225-bd13-49b4-ad48-770c55aa8769)
I: Set the RESUME variable to override this.

Does anyone know what it wants and why a user that is part of sudo group is getting permission denied to a directory?

3 Replies

You need sudo for each command. sudo apt-get update && sudo apt-get upgrade -y

I didn't realize sudo had to be added twice. Thanks for the tip! That did the trick.

You can check here how to use the apt command.


Please enter an answer

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct