22

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

2
  • Can you please post the working Dockerfile solution as you have marked the question answered I believe? I am having a similar issue
    – Benjamin
    Commented May 26, 2023 at 9:23
  • @Benjamin the marked answer works for me. I wound up fixing the issue by instead just switching to a more recent Debian distribution as the base image for my Dockerfile.
    – AJwr
    Commented Jun 12, 2023 at 18:11

4 Answers 4

16
wget http://archive.ubuntu.com/ubuntu/pool/main/libu/libu2f-host/libu2f-udev_1.1.4-1_all.deb
dpkg -i libu2f-udev_1.1.4-1_all.deb

and retry update chrome

1
  • This finally solved it for me and allowed me to install Chrome.
    – TheTomer
    Commented Aug 9, 2023 at 20:09
13

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.

3
  • 1
    This works, since nothing vital is provided in that package. For ubuntu 22.04, the package is essentially empty. So it is even sufficient to use any .deb from bionic 18.04 upward.
    – wolfmanx
    Commented Feb 11, 2023 at 23:51
  • This is simply excellent! Thank you! I uninstalled google-chrome on ubuntu16.04, only to find that it cannot be reinstalled due to missing libu2f-udev. This trick solved my problem perfectly and I am able to reinstall g-chrome. Commented Mar 1, 2023 at 22:08
  • This helped me when I ran sudo apt-get -y install ./vivaldi-stable_6.4.3160.34-1_amd64.deb and wanted to get rid of Depends: libu2f-udev but it is not installable. I added libu2f-udev in two places in the libu2f-udev file and one of these places was not very obvious it appeared to be within a "comment", but it looks like my guesses for these places were okay. I'm still not sure what the best folder is for running these commands, I got the message Attention, the package has been created in the current directory, not in ".." as indicated by the message above! from ~/Downloads.
    – Nike
    Commented Oct 31, 2023 at 14:03
2

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 <[email protected]>
# 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
-1

Uninstall google-chrome with next command: sudo apt remove google-chrome-stable and to correct the error in the library and then install the package you need.

The following packages have unmet dependencies: google-chrome-stable : Depends: libu2f-udev but it is not installed E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

1
  • 1
    Code formatting can be used to highlight code snippets/commands. Commented May 25, 2023 at 13:26

Not the answer you're looking for? Browse other questions tagged or ask your own question.