After system upgrade from ubuntu 20.04 LTS to ubuntu 22.04.1 LTS firefox error when doing `sudo apt --fix-broken install` - firefox

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%3a1snap1-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%3a1snap1-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%3a1snap1-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.

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%3a85.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%3a85.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%3a85.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.

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

How do I stop apt from trying to install a snap package?

In using Kubuntu 20.04 and have lots of issues with snap that I can work around. I have a specific issue with the chromium browser not installing:
snap install chromium
error: cannot perform the following tasks:
Run configure hook of "chromium" snap if present (run hook "configure": cannot perform operation: mount --rbind /home /tmp/snap.rootfs_U0ZnmW//home: Permission denied)
I can live with this and find an alternative source however it is affecting apt:
apt-get -yfu dselect-upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
chromium-browser
0 to upgrade, 1 to newly install, 0 to remove and 0 not to upgrade.
Need to get 48.3 kB of archives.
After this operation, 164 kB of additional disk space will be used.
Get:1 http://au.archive.ubuntu.com/ubuntu focal-updates/universe amd64 chromium-browser amd64 1:85.0.4183.83-0ubuntu0.20.04.2 [48.3 kB]
Fetched 48.3 kB in 0s (110 kB/s)
Preconfiguring packages ...
(Reading database ... 559004 files and directories currently installed.)
Preparing to unpack .../chromium-browser_1%3a85.0.4183.83-0ubuntu0.20.04.2_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 /home /tmp/snap.rootfs_xemBfl//home: Permission denied)
dpkg: error processing archive /var/cache/apt/archives/chromium-browser_1%3a85.0.4183.83-0ubuntu0.20.04.2_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%3a85.0.4183.83-0ubuntu0.20.04.2_amd64.deb
Since chromium is not installing via apt or snap I cannot remove/purge it. How do I stop apt from wanting to install chromium via snap?
I've tried removing /var/cache/apt/archives/chromium-browser_1%3a85.0.4183.83-0ubuntu0.20.04.2_amd64.deb but apt always gets it back somehow.

Ubuntu unattended upgrades conflict with startup script on google cloud compute engine

Using a GCP Ubuntu 18.04 image, plain.
I use startup scripts on vm to automate the deployment of features and changes to the base image. I have one that start with the following :
#! /bin/bash
add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/'
apt update
apt -y upgrade
export DEBIAN_FRONTEND=noninteractive
apt -y install libpam-dev libpam-ldap r-base
Unfortunatly on some machine that haven't ran in a while, I get the following error:
From /var/log/syslog :
startup-script: INFO startup-script: dpkg: error: dpkg frontend is locked by another process
From my investigation I can see that the process unattended upgrades is locking the file because it is doing the automatic security updates to the system. If I let the automatic upgrades complete and launch the script manually, everything runs just fine.
Is there a way to delay the execution of the startup script so that it starts after unattended upgrades is done? I mean, something that is more reliable than a simple wait command.
The startup script is configured via the metadata of the vm per GCP documentation.
Thanks a lot and have a great day.
You can have your script wait until the dpkg lock is no longer held. This AskUbuntu answer suggests a solution using fuser to see if the lock file is in use by another process:
#!/bin/bash
while fuser /var/lib/dpkg/lock >& /dev/null; do
echo "waiting for other package installs to complete..."
sleep 1
done
add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/'
apt update
apt -y upgrade
export DEBIAN_FRONTEND=noninteractive
apt -y install libpam-dev libpam-ldap r-base

How to install Terragrunt 0.19.x version on Mac book

How to Install terragrunt 0.19.x Version on Macbook?
I tried brew install terragrunt which is Downloading 0.18.x only.
Option1:
brew install terragrunt
touch: /usr/local/Homebrew/.git/FETCH_HEAD: Permission denied
fatal: Unable to create '/usr/local/Homebrew/.git/index.lock': Permission denied
fatal: Unable to create '/usr/local/Homebrew/.git/index.lock': Permission denied
error: could not lock config file .git/config: Permission denied
==> Downloading https://homebrew.bintray.com/bottles/terragrunt-0.18.3.mojave.bottle.tar.gz
Already downloaded: /Users/rohithgundala/Library/Caches/Homebrew/downloads/f494cc7ebcfadf5e2610048e6c9f937e0151ff46cf0c226d83118e6d8ba704cc--terragrunt-0.18.3.mojave.bottle.tar.gz
==> Pouring terragrunt-0.18.3.mojave.bottle.tar.gz
🍺 /usr/local/Cellar/terragrunt/0.18.3: 3 files, 19.6MB
Option2:
# Install Terragrunt
RUN wget -q -O ${BIN_DIR}/terragrunt "https://github.com/gruntwork-io/terragrunt/releases/download/v${TERRAGRUNT_VERSION}/terragrunt_linux _amd64" \
&& chmod +x ${BIN_DIR}/terragrunt
Output:
bin/terragrunt: cannot execute binary file
Install Homebrew as described at https://brew.sh/.
Then run the following:
git clone https://github.com/cunymatthieu/tgenv.git /usr/local/Cellar/tgenv
ln -s /usr/local/Cellar/tgenv/bin/* /usr/local/bin
tgenv install 0.19.31
tfenv use 0.19.31
tgenv is a version manager for Terragrunt. https://github.com/cunymatthieu/tgenv/blob/master/README.md
It's extremely handy when you need to use a specific version or multiple versions on the same machine.
tfenv is a related tool and does the same for the terraform command: https://github.com/tfutils/tfenv
For newer versions of Mac OS the kernel is Darwin and the above answer will not work with an error like:-
zsh: exec format error
Please confirm that by running command uname -a and download the file specific to that kernel "terragrunt_darwin_amd64" for whatever version you want.
So below should work :-
wget -q -O /bin/terragrunt "https://github.com/gruntwork-io/terragrunt/releases/download/v0.xx.x/terragrunt_darwin_amd64"
chmod +x /bin/terragrunt
terragrunt -v
I found Answer for this.
wget -q -O /bin/terragrunt "https://github.com/gruntwork-io/terragrunt/releases/download/v0.xx.x/terragrunt_linux_amd64"
chmod +x /bin/terragrunt
terragrunt -v

How to install Heroku CLI on Raspberry PI 3

THIS HAS BEEN SOLVED READ ANSWER BELOW ON HOW TO DOWNLOAD HEROKU CLI ON RPI3
Just saying. Sorry if this has been asked before - I coudnt find it.
I have a Raspberry PI 3 and I am trying to install Heroku CLI. If I try to do it the normal way, for ubuntu or linux, it fails.Can't install Heroku CLI on Raspbian dosent wokr becasue i get error
wget https://cli-assets.heroku.com/branches/stable/heroku-OS-ARCH.tar.gz
--2018-05-23 17:15:46-- https://cli-assets.heroku.com/branches/stable/heroku-OS-ARCH.tar.gz
Resolving cli-assets.heroku.com (cli-assets.heroku.com)... 54.230.9.187, 54.230.9.194, 54.230.9.84, ...
Connecting to cli-assets.heroku.com (cli-assets.heroku.com)|54.230.9.187|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2018-05-23 17:15:50
ERROR 404: Not Found.
This post however dosent work either Heroku CLI alternative download location
and returns error
gzip: stdin: unexpected end of file
tar: Child returned status 1
tar: Error is not recoverable: exiting now
dpkg: error processing package heroku (--configure):
subprocess installed post-installation script returned error exit status 2
dpkg: dependency problems prevent configuration of heroku-toolbelt:
heroku-toolbelt depends on heroku (= 3.99.4); however:
Package heroku is not configured yet.
dpkg: error processing package heroku-toolbelt (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
heroku
heroku-toolbelt
E: Sub-process /usr/bin/dpkg returned an error code (1)
when i run the command
wget -O- https://toolbelt.heroku.com/install-ubuntu.sh | sh
OK guys i figured it out. If the posts above didnt work for you this is how to do it
This is how you install Heroku CLI onto a raspberry pi 3
Step 1: Make sure you have sudo privilages. The default RPI3 account has sudo so you need not worry about this If you cant get sudo privilages you may still be able to download the CLI .
How to check if you have sudo enabled
run these following commands from terminal
sudo su
If you have sudo privileges the terimal should now say
root#ControlUnit:/home/[Your account name]
or something along those lines.
then run exit then continue with steps
If it does continue with the next steps.
If not- if you own RPI3 then login into the default account(password: raspberry) and do sudo adduser [yourname] -g sudo. If you do not own it ask the owner to do this
Sudo aside
This is how you do the heroku CLI:
Run the following commands
wget https://cli-assets.heroku.com/branches/stable/heroku-linux-arm.tar.gz
what this does is it installs a outdated copy(you can update it later) made for the Raspberry Pi. Then run this command
mkdir -p /usr/local/lib /usr/local/bin
This is the part where you have to use sudo. If you cant use sudo still try the commands.
sudo tar -xvzf heroku-OS-ARCH.tar.gz -C /usr/local/lib
sudo ln -s /usr/local/lib/heroku/bin/heroku /usr/local/bin/heroku
Then just make sure you have it run in the terminal
heroku version
or heroku --version
it should come up saying something along the lines of
heroku-cli/5.7.1-c574890 (linux-arm) go1.7.5
then run
heroku update
and your done!
COPY PASTE COMMANDS*
wget https://cli-assets.heroku.com/branches/stable/heroku-linux-arm.tar.gz
mkdir -p /usr/local/lib /usr/local/bin
sudo tar -xvzf heroku-linux-arm.tar.gz -C /usr/local/lib
sudo ln -s /usr/local/lib/heroku/bin/heroku /usr/local/bin/heroku
heroku update
Instead of sudo tar -xvzf heroku-OS-ARCH.tar.gz -C /usr/local/lib as noted in the original post, the correct command should be sudo tar -xvzf **heroku-linux-arm.tar.gz** -C /usr/local/lib

Ubuntu 14.04 apt-get dist-upgrade error on bcmwl-kernel-source

A dist-update I just did hung (froze) after printing line:
DKMS: install completed.
I had to close the terminal to kill process, and to carry on did
sudo lsof /var/lib/dpkg/lock
kill -15 THE-PID
sudo dpkg --configure -a
But dist-update and command below (with output) still hangs, freezes on statement:
DKMS: install completed.
$ sudo apt-get install bcmwl-kernel-source
Reading package lists... Done
Building dependency tree
Reading state information... Done
bcmwl-kernel-source is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
3 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] Y
Setting up bcmwl-kernel-source (6.30.223.248+bdcom-0ubuntu0.1) ...
Removing old bcmwl-6.30.223.248+bdcom DKMS files...
-------- Uninstall Beginning --------
Module: bcmwl
Version: 6.30.223.248+bdcom
Kernel: 3.13.0-24-generic (x86_64)
-------------------------------------
Status: Before uninstall, this module version was ACTIVE on this kernel.
wl.ko:
- Uninstallation
- Deleting from: /lib/modules/3.13.0-24-generic/updates/dkms/
- Original module
- No original module was found for this module on this kernel.
- Use the dkms install command to reinstall any previous module version.
depmod....
DKMS: uninstall completed.
------------------------------
Deleting module version: 6.30.223.248+bdcom completely from the DKMS tree.
------------------------------
Done.
Loading new bcmwl-6.30.223.248+bdcom DKMS files...
Building only for 3.13.0-24-generic
Building for architecture x86_64
Building initial module for 3.13.0-24-generic
Done.
wl:
Running module version sanity check.
- Original module
- No original module exists within this kernel
- Installation
- Installing to /lib/modules/3.13.0-24-generic/updates/dkms/
depmod....
DKMS: install completed.
I dont think reboot is right answer here. Might not boot at all!
Gad Zooks! Any tips & tricks?
Probably should have commands below before update/upgrade but only hind sight is 20/20
sudo apt-get autoclean
sudo apt-get autoremove
Thanks,
Brad
It looks like my Broadcomm Wireless drivers do not play well with latest Ubuntu 14.04 updates.
I just removed debian packages bcmwl-kernel-source and dkms.
The packages might very well run fine, but apt-get upgrade hangs, and I don't want to to deal with contantly freezing updates.
Now I can run 'sudo apt-get dist-upgrade' and smooth sailing.

Resources