dpkg: permission denied creating dir in ./opt for installation

Asked by Digitalw00t

Does anyone know what would cause this from an "apt install brave-browser" command:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  brave-keyring libu2f-udev
The following NEW packages will be installed:
  brave-browser brave-keyring libu2f-udev
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/95.6 MB of archives.
After this operation, 286 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Selecting previously unselected package brave-keyring.
(Reading database ... 439365 files and directories currently installed.)
Preparing to unpack .../brave-keyring_1.12_all.deb ...
Unpacking brave-keyring (1.12) ...
Preparing to unpack .../brave-browser_1.36.112_amd64.deb ...
Unpacking brave-browser (1.36.112) ...
dpkg: error processing archive /var/cache/apt/archives/brave-browser_1.36.112_amd64.deb (--unpack):
 error creating directory './opt/brave.com': Permission denied
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Selecting previously unselected package libu2f-udev.
Preparing to unpack .../libu2f-udev_1.1.10-1_all.deb ...
Unpacking libu2f-udev (1.1.10-1) ...
Errors were encountered while processing:
 /var/cache/apt/archives/brave-browser_1.36.112_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

I get the same thing trying to install a cisco anyconnect deb package with dpkg -i.

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
Digitalw00t
Solved:
Last query:
Last reply:
Revision history for this message
Digitalw00t (digialw00t) said :
#1

I've tried the following, and still get the same message from the apt install and dpkg.

sudo apt-get update –fix-missing
sudo dpkg –configure -a
sudo apt-get install -f
sudo fuser -vki /var/lib/dpkg/lock
sudo dpkg –configure -a
sudo rm /var/lib/apt/lists/lock
sudo rm /var/cache/apt/archives/lock

Odd part is, the apt install brave-browser WILL install the two dependencies with no problem. I've even removed the deps to verify they will be installed.

Revision history for this message
Digitalw00t (digialw00t) said :
#2

It was a new autofs map added to the host that was pointing to /opt. I turned off the autofs service, and everything worked fine.