W: GPG error: Unknown error executing apt-key - gnupg

While running "sudo apt-get update", I getting below error:
Err:1 https://nvidia.github.io/libnvidia-container/stable/ubuntu18.04/amd64 InRelease
Unknown error executing apt-key
Err:2 http://in.archive.ubuntu.com/ubuntu bionic InRelease
Unknown error executing apt-key
Err:5 http://in.archive.ubuntu.com/ubuntu bionic-backports InRelease
Unknown error executing apt-key
Err:6 http://packages.microsoft.com/repos/code stable InRelease
Unknown error executing apt-key
Err:4 https://download.docker.com/linux/ubuntu bionic InRelease
Unknown error executing apt-key
and more ...
While running "sudo apt install gpg", I getting below error:
/usr/bin/apt-key: 659: /usr/bin/apt-key: grep: not found
Warning: The postinst maintainerscript of the package cumulus-archive-keyring
Warning: seems to use apt-key (provided by apt) without depending on gnupg or gnupg2.
Warning: This will BREAK in the future and should be fixed by the package maintainer(s).
Note: Check first if apt-key functionality is needed at all - it probably isn't!
/usr/bin/apt-key: 695: /usr/bin/apt-key: touch: not found
dpkg: error processing package cumulus-archive-keyring (--configure):
installed cumulus-archive-keyring package post-installation script subprocess returned error exit status 127
Errors were encountered while processing:
cumulus-archive-keyring
sh: 1: touch: not found
E: Sub-process /usr/bin/dpkg returned an error code (1)
Also, I similar error while running, "sudo apt install grep --reinstall".
"sudo apt install cumulus-archive-keyring" gave below error:
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up cumulus-archive-keyring (4-cl3u5) ...
/usr/bin/apt-key: 659: /usr/bin/apt-key: grep: not found
Warning: The postinst maintainerscript of the package cumulus-archive-keyring
Warning: seems to use apt-key (provided by apt) without depending on gnupg or gnupg2.
Warning: This will BREAK in the future and should be fixed by the package maintainer(s).
Note: Check first if apt-key functionality is needed at all - it probably isn't!
/usr/bin/apt-key: 695: /usr/bin/apt-key: touch: not found
dpkg: error processing package cumulus-archive-keyring (--configure):
installed cumulus-archive-keyring package post-installation script subprocess returned error exit status 127
Errors were encountered while processing:
cumulus-archive-keyring
sh: 1: touch: not found
E: Sub-process /usr/bin/dpkg returned an error code (1)
I tried to update all gpg key as well by:
gpg --refresh-keys and apt-key. But nothing worked.
I couldn't install the y-ppa-manager manager as well.
I'm stuck, kindly help me! Thank you.

After some inspection I found out that /usr/bin/touch exists but not /bin/touch. Installing the latter using sudo apt-get install --reinstall coreutils solved my problem.

Related

unable to run apt-get -f install on debian

I have a system that is due to be upgraded but I'm having conflicts with apt-get -f install:
apt-get -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following extra packages will be installed:
login sysvinit-utils util-linux
Suggested packages:
kbd util-linux-locales
The following packages will be upgraded:
login sysvinit-utils util-linux
3 upgraded, 0 newly installed, 0 to remove and 106 not upgraded.
13 not fully installed or removed.
Need to get 0 B/1775 kB of archives.
After this operation, 1886 kB of additional disk space will be used.
Do you want to continue? [Y/n]
E: Sub-process false returned an error code (1)
E: Prior errors apply to /var/cache/apt/archives/sysvinit-utils_2.96-7_arm64.deb
E: Prior errors apply to /var/cache/apt/archives/util-linux_2.36.1-8_arm64.deb
E: Prior errors apply to /var/cache/apt/archives/login_1%3a4.8.1-1_arm64.deb
debconf: apt-extracttemplates failed: No such file or directory
(Reading database ... 9765 files and directories currently installed.)
Preparing to unpack .../sysvinit-utils_2.96-7_arm64.deb ...
Unpacking sysvinit-utils (2.96-7) over (2.88dsf-59) ...
dpkg: error processing archive /var/cache/apt/archives/sysvinit-utils_2.96-7_arm64.deb (--unpack):
trying to overwrite '/lib/init/vars.sh', which is also in package initscripts 2.88dsf-59
Errors were encountered while processing:
/var/cache/apt/archives/sysvinit-utils_2.96-7_arm64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
I don't understand why it says E: Sub-process false returned an error code (1) after I confirm installation of the packages. Can anyone help me with this?
initscripts is a purely virtual package, so it is safe to give dpkg permission to overwrite it. Open the terminal and type:
sudo dpkg -i --force-overwrite /var/cache/apt/archives/sysvinit-utils_2.96-7_arm64.deb
If you're not using dpkg directly and using an apt front-end like apt or apt-get, the following command defines the same custom dpkg option to use as the previous command.
sudo apt-get -o Dpkg::Options::="--force-overwrite" install sysvinit-utils
Try to flush the cache and reinstall then :
apt autoremove
apt clean
apt autoclean
apt update
apt install -f
if it doesn't help, try to remove the problematic packages and reinstall them normally.

Cannot install update-notifier-common in Ubuntu pyxis container

I'm trying to set up a script that initialises my Ubuntu pyxis container:
#!/usr/bin/env bash
# Python and nano
apt-get update
apt-get install -y software-properties-common python3-pip python3-tk nano
# Fonts
echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | debconf-set-selections # Automatically accept EULA
echo ttf-mscorefonts-installer msttcorefonts/present-mscorefonts-eula note | debconf-set-selections # Automatically accept EULA
apt-get install -y msttcorefonts
rm -r ~/.cache/matplotlib 2>/dev/null
# Required python packages
pip3 install joblib matplotlib numpy pillow scikit-learn scipy tqdm
I run this script with
srun --container-image ubuntu:latest /root/setup_container.sh >~/setup_container.log 2>&1
However, the installation of the MS fonts package fails due to update-notifier-common not being configured correctly. The key part of the log file is below (I also uploaded the entire log file here).
...
Setting up update-notifier-common (3.192.30.9) ...
chown: invalid user: ‘_apt:root’
dpkg: error processing package update-notifier-common (--configure):
installed update-notifier-common package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of ttf-mscorefonts-installer:
ttf-mscorefonts-installer depends on update-notifier-common (>= 0.119ubuntu2); however:
Package update-notifier-common is not configured yet.
dpkg: error processing package ttf-mscorefonts-installer (--configure):
dependency problems - leaving unconfigured
Processing triggers for libc-bin (2.31-0ubuntu9.2) ...
Errors were encountered while processing:
update-notifier-common
ttf-mscorefonts-installer
W: No sandbox user '_apt' on the system, can not drop privileges
E: Sub-process /usr/bin/dpkg returned an error code (1)
...
Since the log contains an error message about an invalid _apt:root user, and I was also getting No sandbox user 'apt' warnings elsewhere in the log file, I tried to create an _apt user myself, but that brought on new errors:
#!/usr/bin/env bash
# _apt user
adduser _apt --home /nonexistent --system --no-create-home --force-badname
usermod -aG sudo _apt
usermod -aG root _apt
# Python and nano
apt-get update
apt-get install -y software-properties-common python3-pip python3-tk nano
# Fonts
echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | debconf-set-selections # Automatically accept EULA
echo ttf-mscorefonts-installer msttcorefonts/present-mscorefonts-eula note | debconf-set-selections # Automatically accept EULA
apt-get install -y msttcorefonts
rm -r ~/.cache/matplotlib 2>/dev/null
⠀
Warning: The home dir /nonexistent you specified can't be accessed: No such file or directory
Allowing use of questionable username.
Adding system user `_apt' (UID 100) ...
Adding new user `_apt' (UID 100) with group `nogroup' ...
Not creating home directory `/nonexistent'.
Reading package lists...
E: Method gave invalid 400 URI Failure message: Could not switch group
E: Method gave invalid 400 URI Failure message: Could not switch group
E: Method http has died unexpectedly!
E: Sub-process http returned an error code (112)
E: Method http has died unexpectedly!
E: Sub-process http returned an error code (112)
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package software-properties-common
E: Unable to locate package python3-pip
E: Unable to locate package python3-tk
E: Unable to locate package nano
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package msttcorefonts
/root/GE/setup_container.sh: line 19: pip3: command not found
/root/GE/setup_container.sh: line 21: pip3: command not found
srun: error: gpu01: task 0: Exited with exit code 127
How do I get update-notifier-common (and subsequently msttcorefonts) to install properly?
I managed to resolve the issue by manually downloading and installing the msttcorefonts package, as apparently the version on the Ubuntu repo is currently broken.
apt-get install -y wget
wget http://ftp.de.debian.org/debian/pool/contrib/m/msttcorefonts/ttf-mscorefonts-installer_3.8_all.deb -O ~/msfonts.deb
apt-get install -y ~/msfonts.deb
rm ~/msfonts.deb

H5PY install: error command 'x86_64-linux-gnu-gcc' failed with exit status 1

I get the following error:
command 'x86_64-linux-gnu-gcc' failed with exit status 1
when I try to install h5py:
sudo pip install h5py
I tried installing python-dev tools. Doesn't work though
running this first solved it for me:
sudo apt-get install python-h5py

update-alternatives: error: alternative path /usr/bin/gem1.8 doesn't exist

I am trying to install ruby1.8 on Ubuntu 14.04 so that I can be able to run a work application. When i run this command:
sudo apt-get install build-essential ruby1.8-dev ruby-dev mysql-client mysql-server git-core libmysql-ruby libmysqlclient-dev unzip rubygems
I get these errors below:
Building dependency tree Reading state information...
Done build-essential is already the newest version. git-core
is already the newest version. ruby-dev is already the newest
version. unzip is already the newest version.
libmysqlclient-dev is already the newest version. mysql-client is
already the newest version. mysql-server is already the newest
version. ruby1.8-dev is already the newest version. rubygems
is already the newest version. libmysql-ruby1.8 is already the
newest version. 0 upgraded, 0 newly installed, 0 to remove and 161
not upgraded. 1 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 rubygems (1.8.25-1bbox3~trusty1)
... update-alternatives: error: alternative path /usr/bin/gem1.8
doesn't exist dpkg: error processing package rubygems
(--configure): subprocess installed post-installation script
returned error exit status 2 Errors were encountered while
processing: rubygems E: Sub-process /usr/bin/dpkg returned an
error code (1) lusekero_mwathengere#lusekero:~$
Please help....I know ruby1.8 is an old version but this is what we are using at work so I need to succeed in this installation.
Thanks, in advance, for any help rendered.
I ran into a similar error message while putting ruby on rails on AWS:
Setting up rubygems (1.8.25-1bbox3~trusty1) ...
update-alternatives: error: alternative path /usr/bin/gem1.8 doesn't exist
dpkg: error processing package rubygems (--configure):
subprocess installed post-installation script returned error exit status 2
Errors were encountered while processing:
rubygems
E: Sub-process /usr/bin/dpkg returned an error code (1)
The solution was to manually install the library for the missing alternative path. in ubuntu:
sudo apt-get install rubygems1.8
This allowed my install script to find the requested files.
This worked for me:
sudo apt-get install rubygems1.8
update-alternatives --set ruby /usr/bin/ruby1.8

MongoDB installation problems Linux Mint Debian

MongoDB did not install correctly because of some Dpkg errors. Trying to purge or remove
anything related just comes with the error. I have tried deleting all of the Mongodb libs and did a search for other files. I am not sure what caused the original error or how to get the system back to a workable state:
Setting up mongodb-org-server (2.6.5) ...
invoke-rc.d: unknown initscript, /etc/init.d/mongod not found.
dpkg: error processing mongodb-org-server (--configure):
subprocess installed post-installation script returned error exit status 100
Errors were encountered while processing:
mongodb-org-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
This is the original installation command
$ sudo apt-get install -y mongodb-org
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
mongodb-org-mongos mongodb-org-server mongodb-org-shell mongodb-org-tools
The following NEW packages will be installed:
mongodb-org mongodb-org-mongos mongodb-org-server mongodb-org-shell mongodb-org-tools
0 upgraded, 5 newly installed, 0 to remove and 0 not upgraded.
Need to get 115 MB of archives.
After this operation, 290 MB of additional disk space will be used.
Get:1 http://downloads-distro.mongodb.org/repo/ubuntu-upstart/ dist/10gen mongodb-org- shell amd64 2.6.5 [4,458 kB]
Get:2 http://downloads-distro.mongodb.org/repo/ubuntu-upstart/ dist/10gen mongodb-org- server amd64 2.6.5 [9,446 kB]
Get:3 http://downloads-distro.mongodb.org/repo/ubuntu-upstart/ dist/10gen mongodb-org- mongos amd64 2.6.5 [7,175 kB]
Get:4 http://downloads-distro.mongodb.org/repo/ubuntu-upstart/ dist/10gen mongodb-org- tools amd64 2.6.5 [93.7 MB]
Get:5 http://downloads-distro.mongodb.org/repo/ubuntu-upstart/ dist/10gen mongodb-org amd64 2.6.5 [3,656 B]
Fetched 115 MB in 4min 20s (441 kB/s)
Selecting previously unselected package mongodb-org-shell.
(Reading database ... 165525 files and directories currently installed.)
Unpacking mongodb-org-shell (from .../mongodb-org-shell_2.6.5_amd64.deb) ...
Selecting previously unselected package mongodb-org-server.
Unpacking mongodb-org-server (from .../mongodb-org-server_2.6.5_amd64.deb) ...
Selecting previously unselected package mongodb-org-mongos.
Unpacking mongodb-org-mongos (from .../mongodb-org-mongos_2.6.5_amd64.deb) ...
Selecting previously unselected package mongodb-org-tools.
Unpacking mongodb-org-tools (from .../mongodb-org-tools_2.6.5_amd64.deb) ...
Selecting previously unselected package mongodb-org.
Unpacking mongodb-org (from .../mongodb-org_2.6.5_amd64.deb) ...
Processing triggers for man-db ...
Setting up mongodb-org-shell (2.6.5) ...
Setting up mongodb-org-server (2.6.5) ...
Adding system user `mongodb' (UID 120) ...
Adding new user `mongodb' (UID 120) with group `nogroup' ...
Not creating home directory `/home/mongodb'.
Adding group `mongodb' (GID 126) ...
Done.
Adding user `mongodb' to group `mongodb' ...
Adding user mongodb to group mongodb
Done.
invoke-rc.d: unknown initscript, /etc/init.d/mongod not found.
dpkg: error processing mongodb-org-server (--configure):
subprocess installed post-installation script returned error exit status 100
Setting up mongodb-org-mongos (2.6.5) ...
Setting up mongodb-org-tools (2.6.5) ...
dpkg: dependency problems prevent configuration of mongodb-org:
mongodb-org depends on mongodb-org-server; however:
Package mongodb-org-server is not configured yet.
dpkg: error processing mongodb-org (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
mongodb-org-server
mongodb-org
E: Sub-process /usr/bin/dpkg returned an error code (1)
Try using this init script.
init.d
If you previously installed MongoDB, uninstall it first.
To delete МongoDB.
sudo apt-get remove mongodb-10gen
After that delete confing files and init scripts
sudo find /etc/ | grep mongod.* | xargs rm -rf
sudo find /usr/bin/ | grep mongod.* | xargs rm -rf
sudo find /var/lib/ | grep mongod.* | xargs rm -rf
Warning!
/var/lib/ may contain your databases.
Install MongoDB
There are
apt-get autoremove
apt-get -f install
worthy to try first, if it doesn't work, actually I have mongodb-org-server in half-configure and no regular way to remove.
Then I found a worst solution which is to remove package status block. But you will lose track of the real package state and leave trash in your system.
So I check the error message we have, and I found this line interesting:
invoke-rc.d: unknown initscript, /etc/init.d/mongod not found.
Then I create a empty file to fool the invoke function.
touch /etc/init.d/mongod
And then try apt-get autoremove again and apt-get remove the package successfully!
Run this code
touch /etc/init.d/mongod
and then follow that link
https://community.c9.io/t/setting-up-mongodb/1717
Note: (--rest) is removed in latest release of mongo.

Resources