Cannot install update-notifier-common in Ubuntu pyxis container - apt

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

Related

I got error Class "MongoDB\Driver\Manager" not found under docker

I try to install laravel 9 /mongodbsite under docker , based on
FROM php:8.1.6-apache
But running the app I got error:
Class "MongoDB\Driver\Manager" not found
Searching in net I found a possible decision as “php-mongo” package is not installed
But adding php-mongo in as :
RUN wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | apt-key add -
RUN echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-6.0.list
...
RUN apt-get install -y mongodb-org php-mongo
I got error :
E: Package 'php-mongo' has no installation candidate
I tried to use php-mongodb-all-dev, php8.1-mongodb, but got similar errors.
Which package and have I to install ?
Updated Part 1:
I modified Dockerfile.yml as :
FROM php:8.1.6-apache
RUN apt-get update && \
apt-get install --assume-yes --no-install-recommends --quiet \
curl \
wget \
gnupg
RUN wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | apt-key add -
RUN echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-6.0.list
ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
RUN chmod +x /usr/local/bin/install-php-extensions \
&& install-php-extensions mongo
RUN apt-get update && \
apt-get install --assume-yes --no-install-recommends --quiet \
python \
apt-transport-https \
libfreetype6-dev \
But I got error :
docker-compose up -d --build
...
Reading package lists...
### INSTALLING REQUIRED PACKAGES ###
# Packages to be kept after installation:
# Packages to be used only for installation: libsasl2-dev libssl-dev
debconf: delaying package configuration, since apt-utils is not installed
(Reading database ... 14467 files and directories currently installed.)
Preparing to unpack .../libssl1.1_1.1.1n-0+deb11u3_amd64.deb ...
Unpacking libssl1.1:amd64 (1.1.1n-0+deb11u3) over (1.1.1n-0+deb11u2) ...
Setting up libssl1.1:amd64 (1.1.1n-0+deb11u3) ...
Selecting previously unselected package libsasl2-dev.
(Reading database ... 14467 files and directories currently installed.)
Preparing to unpack .../libsasl2-dev_2.1.27+dfsg-2.1+deb11u1_amd64.deb ...
Unpacking libsasl2-dev (2.1.27+dfsg-2.1+deb11u1) ...
Selecting previously unselected package libssl-dev:amd64.
Preparing to unpack .../libssl-dev_1.1.1n-0+deb11u3_amd64.deb ...
Unpacking libssl-dev:amd64 (1.1.1n-0+deb11u3) ...
Setting up libsasl2-dev (2.1.27+dfsg-2.1+deb11u1) ...
Setting up libssl-dev:amd64 (1.1.1n-0+deb11u3) ...
Processing triggers for libc-bin (2.31-13+deb11u3) ...
### INSTALLING REMOTE MODULE mongo ###
WARNING: "pecl/mongo" is deprecated in favor of "channel:///mongodb"
pecl/mongo requires PHP (version >= 5.3.0, version <= 5.99.99), installed version is 8.1.6
No valid packages found
install failed
ERROR: Service 'web' failed to build: The command '/bin/sh -c chmod +x /usr/local/bin/install-php-extensions && install-php-extensions mongo' returned a non-zero code: 1
Which format of the command is valid ?
Thanks in advance!
php-mongo is a PHP extension and the default PHP images for docker do not allow installing PHP extensions on then using apt-get.
You can try doing the following in your Dockerfile instead:
ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
RUN chmod +x /usr/local/bin/install-php-extensions \
&& install-php-extensions mongodb
This is a more simplified approach than the official documentation.
More information on these images as well as the documentation to install extensions can be found in dockerhub
Information about docker-php-extension-installer can be found in Github

W: GPG error: Unknown error executing apt-key

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.

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.

sudo apt-get install zip - error

I am trying to install a library zip.
How to fix it? Thank you for your help.
How to fix it? Thank you for your help.
However receives this error:
root#vps300197:~# sudo apt-get install zip
Reading package lists... Done
Building dependency tree
Reading state information... Done
zip is already the newest version (3.0-11).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
2 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 nginx-core (1.10.0-0ubuntu0.16.04.2) ...
Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.
invoke-rc.d: initscript nginx, action "start" failed.
dpkg: error processing package nginx-core (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of nginx:
nginx depends on nginx-core (>= 1.10.0-0ubuntu0.16.04.2) | nginx-full (>= 1.10. 0-0ubuntu0.16.04.2) | nginx-light (>= 1.10.0-0ubuntu0.16.04.2) | nginx-extras (> = 1.10.0-0ubuntu0.16.04.2); however:
Package nginx-core is not configured yet.
Package nginx-full is not installed.
Package nginx-light is not installed.
Package nginx-extras is not installed.
nginx depends on nginx-core (<< 1.10.0-0ubuntu0.16.04.2.1~) | nginx-full (<< 1. 10.0-0ubuntu0.16.04.2.1~) | nginx-light (<< 1.10.0-0ubuntu0.16.04.2.1~) | nginx- extras (<< 1.10.0-0ubuntu0.16.04.2.1~); however:
Package nginx-core is not configured yet.
Package nginx-full is not installed.
Package nginx-light is not installed.
Package nginx-extras is not installed.
dpkg: error processing packagNo apport report written because the error message indicates its a followup error from a previous failure.
e nginx (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
nginx-core
nginx
E: Sub-process /usr/bin/dpkg returned an error code (1)
As a root user, you don't need sudo before any command you want to run.
Normally, you should not use the root account to work on your server, it is very dangerous.
If you want install library zip, you should use apt-get install libzip, not
apt-get install zip. Zip is already the newest version (3.0-11) on you system.
According to the system output information, it seems to be there's some problems with you nginx installation.
Try sudo apt-get -f install or sudo apt-get remove nginx* && sudo apt-get install nginx-full

dpkg: error: reading package info file '/usr/local/var/lib/dpkg/status': Is a directory

I want to install apt_1.0.9.8.1_amd64.deb package but when I try dpkg -i apt_1.0.9.8.1_amd64.deb at first the error is requested operation requires superuser privilege and then after I sudo it dpkg: error: reading package info file '/usr/local/var/lib/dpkg/status': Is a directory
I understand Debian uses status to keep some information about installed packages. Try running the following commands :
sudo mv /usr/local/var/lib/dpkg/status /usr/local/var/lib/dpkg/status.ko
sudo cp /usr/local/var/lib/dpkg/status-old /usr/local/var/lib/dpkg/status
sudo dpkg --configure -a

Resources