Home > Software design >  After system upgrade from ubuntu 20.04 LTS to ubuntu 22.04.1 LTS firefox error when doing `sudo apt
After system upgrade from ubuntu 20.04 LTS to ubuntu 22.04.1 LTS firefox error when doing `sudo apt

Time:10-03

After upgrade from ubuntu 20.04 LTS to 22.04.1 LTS, I got a very persistent error:

(Reading database ... 350976 files and directories currently installed.)
Preparing to unpack .../firefox_1:1snap1-0ubuntu2_amd64.deb ...
=> Installing the firefox snap
==> Checking connectivity with the snap store
==> Installing the firefox snap
error: cannot perform the following tasks:
- Run hook connect-plug-host-hunspell of snap "firefox" (run hook "connect-plug-
host-hunspell": cannot perform operation: mount --rbind /var/log /tmp/snap.rootf
s_hE2Zj1//var/log: Permission denied)
dpkg: error processing archive /var/cache/apt/archives/firefox_1:1snap1-0ubunt
u2_amd64.deb (--unpack):
 new firefox package pre-installation script subprocess returned error exit stat
us 1
Please restart all running instances of firefox, or you will experience problems
.
Errors were encountered while processing:
 /var/cache/apt/archives/firefox_1:1snap1-0ubuntu2_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

This

- Run hook connect-plug-host-hunspell of snap "firefox" (run hook "connect-plug-
host-hunspell": cannot perform operation: mount --rbind /var/log /tmp/snap.rootf
s_hE2Zj1//var/log: Permission denied)

was very persistent and was hindering any apt-involved installations. Thus, no apt install nor apt upgrade was working.

CodePudding user response:

After long search and trying around, where I did:

sudo apt --fix-broken install
sudo rm /var/lib/dpkg/lock
sudo rm /var/lib/dpkg/lock-frontend 
sudo rm /var/lib/apt/lists/lock
sudo rm /var/cache/apt/archives/lock
sudo dpkg --configure -a

And then, cave(!) this removes firefox from your installed package list and thus after this command you cannot use firefox any more on your computer until you install it - so I did that - but I had a second computer where I could google around while I had no firefox on that machine. I couldn't install chromium browser or other browsers, because apt was not working! So run this command only when you have a second computer or at least your mobile to surf for instructions!

sudo dpkg --force depends -P firefox

I found a hint in https://forums.mozillazine.org/viewtopic.php?f=38&t=3097766

My solution was:

#  Add Mozilla Team PPA
sudo add-apt-repository ppa:mozillateam/ppa
# Set PPA priority
sudo gedit /etc/apt/preferences.d/mozillateamppa
# The command creates and opens empty config file in Gedit text editor.
# When it opens, add the lines below and save it:

Package: firefox*
Pin: release o=LP-PPA-mozillateam
Pin-Priority: 501

save and close that file.

after that, I could do finally:

sudo apt --fix-broken install

# and then:
sudo apt update && sudo apt upgrade

and then, all apt or snap commands were working again flawlessly.

note:

Now, I encounter

sudo apt install chromium-browser
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
  chromium-browser
0 upgraded, 1 newly installed, 0 to remove and 4 not upgraded.
Need to get 0 B/48,4 kB of archives.
After this operation, 164 kB of additional disk space will be used.
Preconfiguring packages ...
(Reading database ... 313313 files and directories currently installed.)
Preparing to unpack .../chromium-browser_1:85.0.4183.83-0ubuntu2_amd64.deb ...
=> Installing the chromium snap
==> Checking connectivity with the snap store
==> Installing the chromium snap
error: cannot perform the following tasks:
- Run configure hook of "chromium" snap if present (run hook "configure": cannot perform operation: mount --rbind /var/log /
tmp/snap.rootfs_Gg42mE//var/log: Permission denied)
dpkg: error processing archive /var/cache/apt/archives/chromium-browser_1:85.0.4183.83-0ubuntu2_amd64.deb (--unpack):
 new chromium-browser package pre-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 /var/cache/apt/archives/chromium-browser_1:85.0.4183.83-0ubuntu2_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

I tried:

sudo add-apt-repository ppa:xtradeb/apps
sudo gedit /etc/apt/preferences.d/xtradebppa

# content:
Package: chromium*
Pin: release o=LP-PPA-xtradeb
Pin-Priority: 501

But this didn't help.

CodePudding user response:

Finally, I found out the solution!

In former days, when my / containing system partition was too full, I sym-linked /var/log. I linked it to somehwere in my home folder. But then, I moved snap back.

- Run hook connect-plug-host-hunspell of snap "firefox" (run hook "connect-plug-
host-hunspell": cannot perform operation: mount --rbind /var/log /tmp/snap.rootf
s_hE2Zj1//var/log: Permission denied)

The permission was denied, because it tried to mount to a symlink. All I had to do was:

sudo rm /var/log
sudo mkdir -p /var/log

Now, it is not a symlink any more. So it can actually mount to it.

  • Related