ikke-t / podman-container-systemd

creates systemd files and creates containers using podman
118 stars 44 forks source link

Podman installation fails on Ubuntu 20.04 #45

Closed hkcomori closed 2 years ago

hkcomori commented 3 years ago

I ran this role with the following settings to install podman.

skip_podman_install: false

However, it failed. I got the following error.

TASK [ikke_t.podman_container_systemd : ensure podman is installed] ***************
fatal: [ubuntu1]: FAILED! => {
    "cache_update_time": 1630881331,
    "cache_updated": false,
    "changed": false,
    "rc": 100
}

STDOUT:

Reading package lists...
Building dependency tree...
Reading state information...
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:
 podman : Depends: conmon (>= 100:2.0.25~2) but 2.0.9-1 is to be installed
          Depends: crun (>= 100:0.19.1-1) but 0.12.1+dfsg-1 is to be installed
          Recommends: containernetworking-plugins (>= 100:0.9.1-1) but it is not going to be installed

STDERR:

E: Unable to correct problems, you have held broken packages.

MSG:

'/usr/bin/apt-get -y -o "Dpkg::Options::=--force-confdef" -o "Dpkg::Options::=--force-confold"       install 'podman'' failed: E: Unable to correct problems, you have held broken packages.

It looks like the addition of the kubic repository is not working. The following official installation procedure successfully installed without errors.

. /etc/os-release
echo "deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_${VERSION_ID}/ /" | sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list
curl -L "https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_${VERSION_ID}/Release.key" | sudo apt-key add -
sudo apt-get update
sudo apt-get -y upgrade
sudo apt-get -y install podman

However, I could not identify the cause.

What am I doing wrong?

Thanks you.

ikke-t commented 3 years ago

Let's ask @Yajo , I don't use ubuntu.

yajo commented 3 years ago

Sorry I always ran this without podman installation because I have another role that installs it.

Basically, what it does is:

# meta/main.yaml
dependencies:
  - role: systemli.apt_repositories
    vars:
      apt_repositories:
        - preset: kubic
    when: |
      (ansible_distribution == 'Debian' and
      ansible_distribution_version is version ('11', '<')) or
      (ansible_distribution == 'Ubuntu' and
      ansible_distribution_version is version('21.04', '<'))
# tasks/main.yaml
- name: install required packages
  package:
    name:
      - podman

And it works.

hkcomori commented 3 years ago

OK... What version do you use? I used Ubuntu server 20.04 64bit and it did not work well. After running systemli.apt_repositories with the same settings, but without this role, manually installing Podman also failed.

I am concerned that instructions in systemli.apt_repositories are different from official instructions.

yajo commented 3 years ago

That one might be too old... I use 21.04.

hkcomori commented 3 years ago

21.04 does not require a kubic repository. You can install Podman from the distribution's official repositories. The following code will not run systemli.apt_repositories on 21.04 or later.

https://github.com/ikke-t/podman-container-systemd/blob/ed920c7fd1f2cada9630e42eaa2089a5e3b761f5/meta/main.yml#L39-L40

But 20.04 is the latest LTS version. I'm not allowed to use anything other than LTS by the policy of my organization.

This role and systemli.apt_repositories support 20.04 (focal), as shown in meta/default.yml. So I expect it to work on 20.04 as well.

Fortunately, I found an alternative: chasinglogic.podman. Therefore, I am not in a hurry to solve this issue.

yajo commented 3 years ago

Fix: https://github.com/systemli/ansible-role-apt_repositories/pull/9

chasinglogic.podman also does its own stuff and doesn't work with 20.04 according to my tests.

hkcomori commented 3 years ago

Thanks for your fix. If I run rm -Rf /etc/apt/preferences.d/kubic.pref, then it installs with no problem too.

chasinglogic.podman also does its own stuff and doesn't work with 20.04 according to my tests.

Oh, really? At least in my environment, the installation was successful and the container seems to be generally working. But I have not tested the details yet.

ikke-t commented 2 years ago

is this still an issue or can it be closed? Or should podman install task be excluded while on ubuntu?

hkcomori commented 2 years ago

Sorry for the late response. This issue has been resolved. Thanks for your help.

My environment: