linuxserver / docker-unifi-network-application

GNU General Public License v3.0
551 stars 40 forks source link

[BUG] apt packages cannot be installed due to missing dependencies #53

Closed kykc closed 4 months ago

kykc commented 5 months ago

Is there an existing issue for this?

Current Behavior

In its current state packages cannot be installed using apt.

Expected Behavior

Being able to install packages inside the container or extending Dockerfile

Steps To Reproduce

  1. Create Dockerfile
FROM lscr.io/linuxserver/unifi-network-application:8.0.24
RUN apt update && apt install -y net-tools
  1. Run docker build .

Environment

- OS: Ubuntu 22.04
- Docker service was installed used official repo from https://docs.docker.com/engine/install/ubuntu/

CPU architecture

x86-64

Docker creation

docker build .

Container logs

> [2/2] RUN apt update && apt install -y net-tools:
0.318
0.318 WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
0.318
0.583 Get:1 http://archive.ubuntu.com/ubuntu jammy InRelease [270 kB]
1.256 Get:2 http://archive.ubuntu.com/ubuntu jammy-updates InRelease [119 kB]
1.425 Get:3 http://archive.ubuntu.com/ubuntu jammy-security InRelease [110 kB]
1.593 Get:4 http://archive.ubuntu.com/ubuntu jammy/main Sources [1,668 kB]
2.172 Get:5 http://archive.ubuntu.com/ubuntu jammy/restricted Sources [28.2 kB]
2.172 Get:6 http://archive.ubuntu.com/ubuntu jammy/multiverse Sources [361 kB]
2.346 Get:7 http://archive.ubuntu.com/ubuntu jammy/universe Sources [22.0 MB]
3.484 Get:8 http://archive.ubuntu.com/ubuntu jammy/multiverse amd64 Packages [266 kB]
3.490 Get:9 http://archive.ubuntu.com/ubuntu jammy/restricted amd64 Packages [164 kB]
3.492 Get:10 http://archive.ubuntu.com/ubuntu jammy/universe amd64 Packages [17.5 MB]
4.482 Get:11 http://archive.ubuntu.com/ubuntu jammy/main amd64 Packages [1,792 kB]
4.508 Get:12 http://archive.ubuntu.com/ubuntu jammy-updates/main Sources [577 kB]
4.517 Get:13 http://archive.ubuntu.com/ubuntu jammy-updates/restricted Sources [63.0 kB]
4.518 Get:14 http://archive.ubuntu.com/ubuntu jammy-updates/multiverse Sources [21.0 kB]
4.518 Get:15 http://archive.ubuntu.com/ubuntu jammy-updates/universe Sources [375 kB]
4.602 Get:16 http://archive.ubuntu.com/ubuntu jammy-updates/universe amd64 Packages [1,305 kB]
4.662 Get:17 http://archive.ubuntu.com/ubuntu jammy-updates/multiverse amd64 Packages [49.8 kB]
4.663 Get:18 http://archive.ubuntu.com/ubuntu jammy-updates/restricted amd64 Packages [1,602 kB]
4.720 Get:19 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages [1,599 kB]
4.812 Get:20 http://archive.ubuntu.com/ubuntu jammy-security/main Sources [303 kB]
4.824 Get:21 http://archive.ubuntu.com/ubuntu jammy-security/multiverse Sources [11.3 kB]
4.825 Get:22 http://archive.ubuntu.com/ubuntu jammy-security/restricted Sources [60.2 kB]
4.828 Get:23 http://archive.ubuntu.com/ubuntu jammy-security/universe Sources [221 kB]
4.836 Get:24 http://archive.ubuntu.com/ubuntu jammy-security/multiverse amd64 Packages [44.0 kB]
4.840 Get:25 http://archive.ubuntu.com/ubuntu jammy-security/main amd64 Packages [1,326 kB]
4.918 Get:26 http://archive.ubuntu.com/ubuntu jammy-security/universe amd64 Packages [1,046 kB]
4.960 Get:27 http://archive.ubuntu.com/ubuntu jammy-security/restricted amd64 Packages [1,572 kB]
5.478 Fetched 54.4 MB in 5s (10.6 MB/s)
5.478 Reading package lists...
6.027 Building dependency tree...
6.125 Reading state information...
6.136 18 packages can be upgraded. Run 'apt list --upgradable' to see them.
6.140
6.140 WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
6.140
6.179 Reading package lists...
6.721 Building dependency tree...
6.817 Reading state information...
6.821 You might want to run 'apt --fix-broken install' to correct these.
6.821 The following packages have unmet dependencies:
6.871  unifi : Depends: mongodb-server (>= 1:3.6.0) but it is not installable or
6.871                   mongodb-10gen (>= 3.6.0) but it is not installable or
6.871                   mongodb-org-server (>= 3.6.0) but it is not installable
6.871          Depends: mongodb-server (< 1:5.0.0) but it is not installable or
6.871                   mongodb-10gen (< 5.0.0) but it is not installable or
6.871                   mongodb-org-server (< 5.0.0) but it is not installable
6.874 E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
github-actions[bot] commented 5 months ago

Thanks for opening your first issue here! Be sure to follow the relevant issue templates, or risk having this issue marked as invalid.

kykc commented 5 months ago

Obviously caused by this

One of the possible solutions would be to force-overwrite dpkg/status as mentioned here. This is rather crude and invasive, of course. Other option would be to edit deb package itself and erase mongodb dependency prior to installation.

j0nnymoe commented 5 months ago

You should be able to bypass that missing package by adding --ignore-missing when running apt.

j0nnymoe commented 5 months ago

Also, worth mentioning you don't need to create a dockerfile just to add in net-tools when we have this: https://github.com/linuxserver/docker-mods/tree/universal-package-install

thespad commented 5 months ago

All of the available options are bad, but it's unfortunately the way they package the software and the way apt operates.

kykc commented 5 months ago

You should be able to bypass that missing package by adding --ignore-missing when running apt.

Sadly, no luck

root@2c73653608eb:/usr/lib/unifi# apt install --ignore-missing -y net-tools
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 unifi : Depends: mongodb-server (>= 1:3.6.0) but it is not installable or
                  mongodb-10gen (>= 3.6.0) but it is not installable or
                  mongodb-org-server (>= 3.6.0) but it is not installable
         Depends: mongodb-server (< 1:5.0.0) but it is not installable or
                  mongodb-10gen (< 5.0.0) but it is not installable or
                  mongodb-org-server (< 5.0.0) but it is not installable
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
kykc commented 5 months ago

FYI deb package dependency on mongodb-server can be amended prior to installation of the package during image build like this:

RUN mkdir /tmp/control
RUN ar -p /tmp/unifi.deb control.tar.gz | tar -xvz -C /tmp/control
RUN sed -i '/^ mongodb-server/d' /tmp/control/control
RUN tar -cvzf /tmp/control.tar.gz -C /tmp/control .
RUN ar -r /tmp/unifi.deb /tmp/control.tar.gz
LinuxServer-CI commented 4 months ago

This issue has been automatically marked as stale because it has not had recent activity. This might be due to missing feedback from OP. It will be closed if no further activity occurs. Thank you for your contributions.

thespad commented 4 months ago

Looking to try and fix this by installing from their zip bundle rather than deb repo package in https://github.com/linuxserver/docker-unifi-network-application/pull/67. We don't want to screw with the deb package to edit the deps because it's liable to break unexpectedly in the future.

You're welcome to test once the PR build finishes and see if it works properly for you.