2

I cannot install podman following the official RedHat instructions or any other, for instance.

I always get to the same situation

diegosasw@LAP-DMARTIN:~$ sudo apt-get -qq -y install podman
E: Unable to correct problems, you have held broken packages.
diegosasw@LAP-DMARTIN:~$ sudo apt-get -y install podman
Reading package lists... Done
Building dependency tree
Reading state information... Done
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: containers-common (>= 1.2.0~3) but it is not going to be installed Recommends: crun but it is not going to be installed Recommends: slirp4netns but it is not going to be installed Recommends: uidmap but it is not going to be installed Recommends: varlink but it is not going to be installed E: Unable to correct problems, you have held broken packages.

I have tried upgrading sudo apt-get upgrade and everything is up to date. Same problem. If anything I can see containers-common 1.2.0~2 installed, but never the 1.2.0.~3 (assuming that's the reason of the broken packages).

Does anybody know the cause? It is a brand new Ubuntu 20.04 distro and these are the steps followed on first run as per https://oldgitops.medium.com/setting-up-podman-on-wsl2-in-windows-10-be2991c2d443

. /etc/os-release

sudo sh -c "echo 'deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_${VERSION_ID}/ /' > /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 -qq

sudo apt-get -qq -y install podman

And I have the following:

diegosasw@LAP-DMARTIN:~$ ls /etc/apt/sources.list.d
devel:kubic:libcontainers:stable.list
NotTheDr01ds
  • 17,888
diegosasw
  • 211
  • 3
  • 6
  • 1
    Their version of containers-common has not been updated in their repository. You would need to contact the support for the podman and have them update it so it works with 20.04. Nothing we can do here. – Terrance Dec 01 '20 at 14:36
  • This solved same problem on my system: https://www.how2shout.com/linux/how-to-install-podman-on-ubuntu-20-04-wsl2/ – user1556610 Dec 28 '21 at 11:20
  • @user1556610 Thanks for pointing that out. Note that the podman instructions themselves now work as well. The probably in this question seems to have been resolved. Also note that there are a few things in those instructions that you linked that aren't quite optimal. For instance, I recommend wsl --install rather than wsl --install Ubuntu-20.04. There's not much of a difference, but I prefer the unversioned "Ubuntu" simply so that you don't have to worry about naming when you upgrade. "Ubuntu-20.04" will always be "named" that, even if you upgrade to 22.04 (when it becomes available). – NotTheDr01ds Dec 30 '21 at 20:25
  • Of bigger concern is that their instructions for updating Ubuntu to a later (non-LTS) release on WSL don't include the (in my experience) critical part of removing snapd first. – NotTheDr01ds Dec 30 '21 at 21:09

1 Answers1

2

Older question that got bumped recently, but for anyone wondering, as of the time of this answer, the instructions on podman.io currently work for Ubuntu on WSL2.

There are two options:

  • First, if you update your WSL2 Ubuntu installation to 21.10 per my answer here, you can simply:

    sudo apt-get -y update
    sudo apt-get -y install podman
    
  • If you prefer installing on WSL2 Ubuntu 20.04 (LTS), the normal directions on podman.io also apply, with some minor tweaks.

    1. First (but not mentioned in the podman doc), make sure your current distro is up to date before attempting to install the podman repo key. Otherwise you may run into an expired certificate chain:

      sudo apt update && sudo apt upgrade -y
      
    2. Run the commands in the podman doc. Currently, this is:

      . /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, please refer to the doc for the most recent information.

    3. Also not mentioned in the podman doc, but you might want to add:

      sudo apt install buildah
      

      This package is included as a dependency for the 21.10 podman package, but you'll need to add it manually on 20.04.

NotTheDr01ds
  • 17,888