Dependency issue installing google-chrome-stable through Ubuntu docker - linux

I have a Dockerfile that attempts to install the package google-chrome-stable among other packages in Ubuntu (v16 Xenial I think) as part of a Gitlab pipeline step. I have had no issues until recently, when the step started failing with this issue:
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
google-chrome-stable : Depends: libu2f-udev but it is not installable
E: Unable to correct problems, you have held broken packages.
It seems like the libu2f-udev has recently become a depends instead of a recommends – but I'm not sure how to fix this. Here is the part of the Dockerfile in question:
FROM -.dkr.ecr.us-east-1.amazonaws.com/ubuntu:xenial
EXPOSE 9222
# Install ubuntu dependencies
RUN apt-get update && \
apt-get -y upgrade && \
apt-get install -yq curl libgconf-2-4
# Install Google Chrome Stable
RUN curl https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \
apt-get install -y wget gnupg && \
echo 'deb [arch=amd64] http://dl.google.com/linux/chrome/deb stable main' >> /etc/apt/sources.list.d/google-chrome.list && \
apt-get update && \
apt-get install -y --no-install-recommends \
google-chrome-stable \
fonts-ipafont-gothic \
fonts-wqy-zenhei \
fonts-thai-tlwg \
fonts-kacst ttf-freefont && \
rm -fr /var/lib/apt/lists/* && \
apt-get purge --auto-remove -y curl && \
rm -fr /src/*.deb
I would think the apt-get update before the install would fix this but it is not. Any help is appreciated, thanks!
Edit: also, I know that Ubuntu 16 is no longer receiving standard support (this is a pretty old service I'm working with). If upgrading to v18 or higher would help that would also be good to know

Creating a dummy package which provides libu2f-udev fixes the issue. I followed below steps for Ubuntu 16.04. Install equivs package
sudo apt install equivs
equivs-control libu2f-udev
This creates a file libu2f-udev. Edit this file and give libu2f-udev as value of "Package" and "Provides" keys. Then execute
equivs-build libu2f-udev
This creates dummy package libu2f-udev_1.0_all.deb. Install it by
sudo dpkg -i libu2f-udev_1.0_all.deb
All set.

The contents of the libu2f-udev file should be like this
Tested on 16.04.7 LTS & chrome 110.0.5481.100. In case it is not clear, the libu2f-udev file after editing should look like this:
​### Commented entries have reasonable defaults.
### Uncomment to edit them.
# Source: <source package name; defaults to package name>
Section: misc
Priority: optional
# Homepage: <enter URL here; no default>
Standards-Version: 3.9.2
Package: libu2f-udev
# Version: <enter version here; defaults to 1.0>
# Maintainer: Your Name <yourname#example.com>
# Pre-Depends: <comma-separated list of packages>
# Depends: <comma-separated list of packages>
# Recommends: <comma-separated list of packages>
# Suggests: <comma-separated list of packages>
Provides: libu2f-udev
# Replaces: <comma-separated list of packages>
# Architecture: all
# Multi-Arch: <one of: foreign|same|allowed>
# Copyright: <copyright file; defaults to GPL2>
# Changelog: <changelog file; defaults to a generic changelog>
# Readme: <README.Debian file; defaults to a generic one>
# Extra-Files: <comma-separated list of additional files>
# Files: <pair of space-separated paths;>
# <more pairs, if there's more than one file to include.>
Description: <short description; defaults to some wise words>
long description and info
.
second paragraph

Related

The command '[...] apt-get install -y [...]' returned a non-zero code: 100

I am trying to build a Docker image from a dockerfile using the following:
sudo docker build \
--build-arg BBS_HTTP_PROXY=$http_proxy \
--build-arg BBS_http_proxy=$http_proxy \
--build-arg BBS_HTTPS_PROXY=$https_proxy \
--build-arg BBS_https_proxy=$https_proxy \
--build-arg BBS_USERS="$USER_NAME/$USER_ID" \
-f docker/base.Dockerfile -t test_bbs_base .
The output is:
Sending build context to Docker daemon 2.299MB
Step 1/29 : FROM nvidia/cuda:10.2-devel
---> 7e913212889f
Step 2/29 : ARG BBS_http_proxy
---> Using cache
---> b09f54db4bb5
Step 3/29 : ARG BBS_https_proxy
---> Using cache
---> 98d5ca2e0222
Step 4/29 : ARG BBS_HTTP_PROXY
---> Using cache
---> d2adf75f400d
Step 5/29 : ARG BBS_HTTPS_PROXY
---> Using cache
---> f8967537a467
Step 6/29 : ENV http_proxy=$BBS_http_proxy
---> Using cache
---> e878456c2bdb
Step 7/29 : ENV https_proxy=$BBS_https_proxy
---> Using cache
---> 60fa7aefa446
Step 8/29 : ENV HTTP_PROXY=$BBS_HTTP_PROXY
---> Using cache
---> 003d6fb55d55
Step 9/29 : ENV HTTPS_PROXY=$BBS_HTTPS_PROXY
---> Using cache
---> f918604d47e5
Step 10/29 : ENV LANG=C.UTF-8
---> Using cache
---> 50dda4cb5b07
Step 11/29 : RUN apt-get update && apt-get upgrade -y && apt-get update
---> Using cache
---> 1562edfea402
Step 12/29 : RUN DEBIAN_FRONTEND="noninteractive" TZ="Europe/Zurich" apt-get install -y dpkg-dev gcc libbluetooth-dev libbz2-dev libc6-dev libexpat1-dev libffi-dev libgdbm-dev liblzma-dev libncursesw5-dev libreadline-dev libsqlite3-dev libssl-dev make tk-dev wget xz-utils zlib1g-dev
---> Running in f50b334c69e0
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package libbluetooth-dev
E: Unable to locate package libbz2-dev
E: Unable to locate package libexpat1-dev
E: Unable to locate package libffi-dev
E: Unable to locate package libgdbm-dev
E: Unable to locate package liblzma-dev
E: Unable to locate package libncursesw5-dev
E: Unable to locate package libreadline-dev
E: Unable to locate package libsqlite3-dev
E: Unable to locate package libssl-dev
E: Unable to locate package tk-dev
E: Unable to locate package wget
E: Unable to locate package zlib1g-dev
The command '/bin/sh -c DEBIAN_FRONTEND="noninteractive" TZ="Europe/Zurich" apt-get install -y dpkg-dev gcc libbluetooth-dev libbz2-dev libc6-dev libexpat1-dev libffi-dev libgdbm-dev liblzma-dev libncursesw5-dev libreadline-dev libsqlite3-dev libssl-dev make tk-dev wget xz-utils zlib1g-dev' returned a non-zero code: 100
I don't know what causes the error, help would be greatly appreciated.
This is the Dockerfile:
# Blue Brain Search is a text mining toolbox focused on scientific use cases.
#
# Copyright (C) 2020 Blue Brain Project, EPFL.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# This image has the CUDA toolkit pre-installed and so the GPUs
# work out of the box. Just include the "--gpus all" flag in
# docker run.
#
# Note that this is a big development image. If you don't need
# the development packages consider changing the image tag to
# "10.2-base" or "10.2-runtime". See the information on docker
# hub for more details: https://hub.docker.com/r/nvidia/cuda
#
# If the GPU support is not necessary, then another image,
# for example "python:3.7" can be used.
FROM nvidia/cuda:10.2-runtime
# ARGs are only visible at build time and can be provided in
# the docker-compose.yml file in the "args:" section or with the
# --build-arg parameter of docker build
ARG BBS_http_proxy
ARG BBS_https_proxy
ARG BBS_HTTP_PROXY
ARG BBS_HTTPS_PROXY
# ENVs are visible both at image build time and container run time.
# We want the http proxys to be visible in both cases and therefore
# set them equal to the values of the ARGs.
ENV http_proxy=$BBS_http_proxy
ENV https_proxy=$BBS_https_proxy
ENV HTTP_PROXY=$BBS_HTTP_PROXY
ENV HTTPS_PROXY=$BBS_HTTPS_PROXY
# Debian's default LANG=C breaks python3.
# See commends in the official python docker file:
# https://github.com/docker-library/python/blob/master/3.7/buster/Dockerfile
ENV LANG=C.UTF-8
# Install system packages
#
# The environment variable $DEBIAN_FRONTENT is necessary to
# prevent apt-get from prompting for the timezone and keyboard
# layout configuration.
#
# There are two dev-packages that are installed:
# - libmysqlclient-dev
# - python3.7-dev
# This is intentional because otherwise "pip install SQLAlchemy[mysql]" breaks.
RUN \
apt-get update &&\
apt-get upgrade -y --no-install-recommends &&\
apt-get update &&\
TZ="Europe/Zurich" \
DEBIAN_FRONTEND="noninteractive" \
apt-get install -y --no-install-recommends \
libbluetooth3 libbz2-1.0 libc6 libexpat1 \
libffi6 libgdbm5 liblzma5 libncursesw5 libreadline7 \
libsqlite3-0 libssl1.1 tk xz-utils zlib1g \
gcc g++ build-essential make \
curl git htop less man vim wget \
libfontconfig1 libmysqlclient-dev
# Install Python 3.7 & pip 3.7
#
# The base image ("nvidia/cuda") does not have Python pre-installed. The
# following command can be omitted on images that already have Python, for
# example "python:3.7".
#
# The package "python3.7-pip" doesn't exist. The package "python3-pip" needs
# to be installed instead. After its installation:
# - "pip" isn't an existing command,
# - "pip3" refers to pip for Python 3.6,
# - "pip3.7" isn't an existing command,
# - "python3.7 -m pip" works.
#
# The command "apt install python3-pip" does the following:
# - Install the pip module into the python version agnostic directory /usr/lib/python3/dist-packages
# - Install /usr/bin/python3.6
# - Link /usr/bin/python3 to /usr/bin/python3.6
# - Install the script /usr/bin/pip3 that has the /usr/bin/python3 shebang
# and so load the pip module from python 3.6's site-packages
#
# How to make pip refer to the python 3.7 site-packages?
# Run "python3.7 -m pip install pip". This will
# - Use the pip module from the python version agnostic directory /usr/lib/python3/dist-packages
# to install a pip module into the version specific directory /usr/local/lib/python3.7/dist-packages
# (You can verify using "python3.7 -m site" that the version specific one has precedence)
# - Install the scripts
# - /usr/local/bin/pip
# - /usr/local/bin/pip3
# - /usr/local/bin/pip3.7
# which are all copies of each other and have the correct python 3.7 shebang
#
# The command "update-alternatives" makes the command "python" refer to
# "python3.7". Otherwise, "python" refers to "python2".
#
RUN \
DEBIAN_FRONTEND="noninteractive" \
apt-get install -y --no-install-recommends \
python3.7-dev python3.7-venv python3-pip && \
python3.7 -m pip install --upgrade pip setuptools wheel && \
update-alternatives --install /usr/local/bin/python python /usr/bin/python3.7 0
# Install BBS requirements
COPY requirements.txt /tmp
COPY requirements-data_and_models.txt /tmp
RUN \
pip install --no-cache-dir -r /tmp/requirements.txt -r /tmp/requirements-data_and_models.txt &&\
rm /tmp/requirements.txt /tmp/requirements-data_and_models.txt
# Add and configure users
SHELL ["/bin/bash", "-c"]
ARG BBS_USERS
COPY docker/utils.sh /tmp
RUN \
. /tmp/utils.sh && \
groupadd -g 999 docker && \
create_users "${BBS_USERS},guest/1000" "docker" && \
configure_user
# Entry point
EXPOSE 8888
RUN mkdir /workdir && chmod a+rwX /workdir
WORKDIR /workdir
USER guest
ENTRYPOINT ["env"]
CMD ["bash", "-l"]
This Problem occured while trying to setup the Blue Brain Search Toolbox.
For future reference the whole Dockerfile was included to provide reference for the problem.

Unable to install php7.1-soap in Ubuntu 19.04

I am running PHP 7.2 on an Apache server on Ubuntu, and I need to add the PHP SoapClient. However, when I try to install it using apt-get, I get the following error:
The following packages have unmet dependencies:
php7.2-soap : Depends: php7.2-common (= 7.2.24-0ubuntu0.19.04.2) but 7.2.26-1+ubuntu19.04.1+deb.sury.org+1 is to be installed
E: Unable to correct problems, you have held broken packages.
I've tried the following before reattempting:
sudo apt-get update
sudo apt-get clean && sudo apt-get update
sudo apt-get upgrade
sudo apt-get upgrade-dist
sudo apt-get -f install
sudo dpkg --configure -a
If it helps, when I run uname -r the output is
5.0.0-37-generic
Thanks in advance!
After a looooong time tackling this issue I finally got my head around it and found a solution :)
It seems the issue is I was using the ppa:ondrej/apache2 PPA which was installing the latest version of a selection of PHP packages, which at the time of writing is using PHP7.2.27. As far as I can tell, the most up-to-date version of the php7.2-soap package is for php7.2.24, meaning there is an unmet dependency for the php7.2-common package provided by the PPA.
So, the solution was to remove the PPA and downgrade the PHP packages. Here's a step by step for any poor souls who might encounter a similar issue:
First, if not already installed, install aptitude sudo apt-get install aptitude
Next, install ppa-purge:
mkdir ppa-purge && cd ppa-purge && wget http://mirror.pnl.gov/ubuntu/pool/universe/p/ppa-purge/ppa-purge_0.2.8+bzr56_all.deb && wget http://mirror.pnl.gov/ubuntu//pool/main/a/aptitude/aptitude_0.6.6-1ubuntu1_i386.deb && sudo dpkg -i ./*.deb
(I ran this in my user folder, i.e. ~/
Then I remove the PPA with the following commands:
sudo ppa-purge ppa:ondrej/apache2
sudo add-apt-repository --remove ppa:ondrej/apache2
sudo apt-get autoclean
Now we need to downgrade the dependencies. First I determined which version I needed. The package that was causing the unmet dependency was php7.2-common, so I ran sudo apt list -a php7.2-common. I chose the version which matched the original error message, in this case, 7.2.24-0ubuntu0.19.04.2.
So you are able to install a specific version by following the package with a = then a version number. If you, like me, are working on a live server, I'm going to shout this next bit about the next command you will write:
DO NOT USE THE -y TAG!!
CHOOSE "NO" WHEN IT ASKS YOU IF YOU WANT TO CONTINUE!!
If you do any of these, it will automatically remove any dependencies for php7.2-common and the PHP stop working on your site.
To determine which dependencies we need to update along with php7.2-common, I ran sudo apt-get install php7.2-common=7.2.24-0ubuntu0.19.04.2. It then showed me a list of other packages it would remove as well. I copied these dependencies then chose 'n' to cancel the install.
Next, I put the copied list into a text editor and used it to create the following script:
sudo apt-get install php7.2-common=7.2.24-0ubuntu0.19.04.2 \
libapache2-mod-php7.2=7.2.24-0ubuntu0.19.04.2 \
php7.2=7.2.24-0ubuntu0.19.04.2 \
php7.2-bcmath=7.2.24-0ubuntu0.19.04.2 \
php7.2-bz2=7.2.24-0ubuntu0.19.04.2 \
php7.2-cgi=7.2.24-0ubuntu0.19.04.2 \
php7.2-cli=7.2.24-0ubuntu0.19.04.2 \
php7.2-curl=7.2.24-0ubuntu0.19.04.2 \
php7.2-dev=7.2.24-0ubuntu0.19.04.2 \
php7.2-enchant=7.2.24-0ubuntu0.19.04.2 \
php7.2-fpm=7.2.24-0ubuntu0.19.04.2 \
php7.2-gd=7.2.24-0ubuntu0.19.04.2 \
php7.2-imap=7.2.24-0ubuntu0.19.04.2 \
php7.2-intl=7.2.24-0ubuntu0.19.04.2 \
php7.2-json=7.2.24-0ubuntu0.19.04.2 \
php7.2-ldap=7.2.24-0ubuntu0.19.04.2 \
php7.2-mbstring=7.2.24-0ubuntu0.19.04.2 \
php7.2-mysql=7.2.24-0ubuntu0.19.04.2 \
php7.2-odbc=7.2.24-0ubuntu0.19.04.2 \
php7.2-opcache=7.2.24-0ubuntu0.19.04.2 \
php7.2-pspell=7.2.24-0ubuntu0.19.04.2 \
php7.2-readline=7.2.24-0ubuntu0.19.04.2 \
php7.2-tidy=7.2.24-0ubuntu0.19.04.2 \
php7.2-xml=7.2.24-0ubuntu0.19.04.2 \
php7.2-xmlrpc=7.2.24-0ubuntu0.19.04.2 \
php7.2-zip=7.2.24-0ubuntu0.19.04.2
Finally, I ran this command. Instead of warning me about removing the packages, it warned me that these packages would be "downgraded", which is fine. I pressed Y and it reinstalled all the packages and viola! I was then able to install php7.2-soap :)
See these links which I credit to finding a solution for this:
https://askubuntu.com/a/92021
https://appuals.com/fix-unmet-dependencies-error-ubuntu/
I have a similar issue one month ago with a Debian 9 and PHP 7 Did you consider to upgrade your PHP to the latest stable version before installing the PHP Client ?

Upgrade or install Ghostscript 9.21 in docker image node:7

I'm installing Ghostscript into a docker image and want to use it with ghostscript4js which requires for some functionality at least Ghostscript 9.21.
I'm using this in my docker file which installs Ghostscript 9.06
FROM node:7
ARG JOB_TOKEN
RUN apt-get update && \
apt-get install -y pdftk
ENV APP_DIR="/usr/src/app" \
JOB_TOKEN=${JOB_TOKEN} \
APP_DIR="/usr/src/app" \
GS4JS_HOME="/usr/lib"
COPY ./ ${APP_DIR}
# Step 1: Install App
# -------------------
WORKDIR ${APP_DIR}
# Step 2: Install Python, GhostScript and npm packages
# -------------------
ARG CACHE_DATE=2017-01-01
RUN \
apt-get update && \
apt-get install -y build-essential make gcc g++ python python-dev python-pip python-virtualenv && \
apt-get -y install ghostscript && apt-get clean && \
apt-get install -y libgs-dev && \
rm -rf /var/lib/apt/lists/*
RUN npm install
# Step 3: Start App
# -----------------
CMD ["npm", "run", "start"]
How do I install or upgrade to a higher Ghostscript version in a docker image?
Seems like the distro you are using (since you use apt-get) is only on 9.06. Not surprising, many distros remain behind the curve, especially long term support ones.
If you want to use a more recent version of Ghostscript, then you could nag the packager to update. And you know, 9.06 is 5 years old now.....
Failing that you'll have to build it yourself. Git clone the Ghostscript repository, cd ghostpdl, ./autogen.sh, make install. That of course gets the current bleeding edge source, for a release version you'll have to pull from one of the tags (we tag the source for each release).
Or build it yourself locally and put it somewhere that your docker image can retrieve it from.
IMO if you are going to use a version other than the one provided by the packager of your distro, you may as well use the current release. That's currently 9.22 and will be 9.23 in a few weeks.

implement CVE-2017-7494 (samba cry) on ubuntu server 16.04

Recently my experiment needs to implement CVE-2017-7494 (the so called sambacry), and I am trying to rebuild the vulnerable environment
I am new to this, not very sure how to set all the path and conf right
here is what I did:
# wget https://download.samba.org/pub/samba/stable/samba-4.5.9.tar.gz
# apt-get install acl attr autoconf bison build-essential \
debhelper dnsutils docbook-xml docbook-xsl flex gdb krb5-user \
libacl1-dev libaio-dev libattr1-dev libblkid-dev libbsd-dev \
libcap-dev libcups2-dev libgnutls-dev libjson-perl \
libldap2-dev libncurses5-dev libpam0g-dev libparse-yapp-perl \
libpopt-dev libreadline-dev perl perl-modules pkg-config \
python-all-dev python-dev python-dnspython python-crypto \
xsltproc zlib1g-dev
Reference about the above package.
# tar -xvf samba-4.5.9.tar.gz
# cd samba-4.5.9
# ./configure
# make
# make install
after that I found it installed under /local, and cannot start samba normally because, say, smbd not found, etc
I think it's a problem of path and config file then I tried this to fix it.
But didn't get well realizing.
Would anyone please help?
Since you did not specify a path in your configure parameters, it should be by default at /usr/local/samba/sbin/smbd.
You can try running this in your shell (and add it to your profile) to add it to your path:
export PATH=/usr/local/samba/bin/:/usr/local/samba/sbin/:$PATH

unable to lacate package hue

I'm trying to install Hue on Ubuntu 14, it displays this :
apt-get install hue
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package hue
anyone have an idea.
thanks
This installation script worked for me.
sudo apt-get install git
git clone https://github.com/cloudera/hue.git
cd hue
apt-get install python2.7-dev \
make \
libkrb5-dev \
libxml2-dev \
libxslt-dev \
libsqlite3-dev \
libssl-dev \
libldap2-dev \
python-pip
sudo apt-get install maven
sudo ln -s /usr/lib/python2.7/plat-*/_sysconfigdata_nd.py /usr/lib/python2.7/
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get install oracle-java7-installer
sudo apt-get install oracle-java7-set-default
make apps
If you are behind a proxy server, make sure you set your environment variables correctly when installing oracle-java7 or any other package outside the repository.
Seems the repository doesn`t contain such package.
Try build binaries from sources: guide
You could try to use the Lucid 12.04 packages: http://archive.cloudera.com/cdh5/one-click-install/precise/amd64/
The Trusty 14.04 are coming up in less than a month in CDH5.2.

Resources