Podman 4.3 on Artix Linux: Fix initialization issues
Tags: podman, docker, virtualization, artix
Published: 2023-01-27 07:35:37

## Summary

It is not so difficult to install [Podman](https://podman.io/) on [Artix Linux](https://artixlinux.org/), based on [Arch Linux](https://archlinux.org/) and [systemd](https://www.freedesktop.org/wiki/Software/systemd/)-free.
It's because [pacman](https://archlinux.org/pacman/) brings key packages: `podman` and `qemu-base` of [QEMU](https://www.qemu.org/).

You can prepare Podman by installing them and configure some. [After completing them]({{< relref "podman-43-on-artix-linux-install" >}}), you can start virtual machine and manage containers ... to a certain extent.

There are issues left, which occurs problems on process handling or networking.
This post shows how to fix them.

### Environment

- OS: Artix Linux (based on Arch Linux) where I chose [OpenRC](https://wiki.gentoo.org/wiki/OpenRC) as [init system](https://en.wikipedia.org/wiki/Init)
- Virtualization: Podman [4.3.1](https://github.com/containers/podman/releases/tag/v4.3.1)

## Issued and Solutions

\* [`doas`](https://man.openbsd.org/doas) ([OpenDoas](https://wiki.archlinux.org/title/Doas)) can be replaced with [`sudo`](https://www.sudo.ws/).

### `system migrate` warned due to lack of buildah

#### Issue description

[buildah](https://buildah.io/) is a "tool that facilitates building OCI images" of [Containers](https://github.com/containers).
If it is not installed, `podman system migrate` will print out the warning:

```console
WARN[0000] "/" is not a shared mount, this could cause issues or missing mounts with rootless containers
```

In addition, some of the following `podman` operations will also print the same warning.

#### Solution

Install buildah. It's easy to install thanks to pacman:

```console
$ doas pacman -Sy buildah
```

The output and the interaction were:

```console
:: Synchronizing package databases...
(...)
resolving dependencies...
looking for conflicting packages...

Packages (2) skopeo-1.11.0-1  buildah-1.28.2-1

Total Download Size:   15.06 MiB
Total Installed Size:  52.21 MiB

:: Proceed with installation? [Y/n] y
:: Retrieving packages...
(...)
:: Processing package changes...
(...)
```

Run `podman system migrate` again. It will not surely print any error or warning.

### `gvproxy` was missing so networking was limited

#### Issue description

When starting a virtual machine, it printed `gvproxy` was missing and therefore "unable to start host networking".

```console
$ podman machine start
```

The output was:

```console
Starting machine "podman-machine-default"
Error: unable to start host networking: "could not find \"gvproxy\" in one of [/usr/local/libexec/podman /usr/local/lib/podman /usr/libexec/podman /usr/lib/podman].  To resolve this error, set the helper_binaries_dir key in the `[engine]` section of containers.conf to the directory containing your helper binaries."
```

#### Solution

`gvproxy` is published as [gvisor-tap-vsock](https://github.com/containers/gvisor-tap-vsock) by Containers in [Github](https://github.com/).
Download the latest version (0.5.0, in my case) from [releases](https://github.com/containers/gvisor-tap-vsock/releases). One for Linux is called `gvproxy-linux`.

In your local, rename it to `gvproxy` and place it as Podman helper binaries. Where ? The error messages above mentioned the candidates. Also, remember to modify the permissions.

```console
$ doas mv gvproxy-linux /usr/lib/podman/gvproxy

$ doas chown root:root /usr/lib/podman/gvproxy
$ doas chmod a+x /usr/lib/podman/gvproxy
```

Besides, you may be able to find the package in pacman repositories or AUR.

### `timedatectl` was missing so `.ign`, ignition file for vm, was not created 

#### Issue description

`getLocalTimeZone` in [`ignition_linux.go`](https://github.com/containers/podman/blob/52d5f367b144f755dd20b18d88c5f79bc6b0c3fe/pkg/machine/ignition_linux.go) of Podman executes [`timedatectl`](https://www.freedesktop.org/software/systemd/man/timedatectl.html), which is a part of systemd. Therefore, `podman machine init` failed with the error:

```console
Extracting compressed file
Image resized.
Error: exec: "timedatectl": executable file not found in $PATH
```

and `.ign`, ignition conf, for the default machine was not created.

As a result, `podman machine start` failed due to the error:

```console
Starting machine "podman-machine-default"
Waiting for VM ...
Error: qemu exited unexpectedly with exit code 1, stderr: qemu-system-x86_64: -fw_cfg name=opt/com.coreos/config,file=/home/(...)/.config/containers/podman/machine/qemu/podman-machine-default.ign: can't load /home/(...)/.config/containers/podman/machine/qemu/podman-machine-default.ign: Failed to open file “/home/(...)/.config/containers/podman/machine/qemu/podman-machine-default.ign”: No such file or directory
```

#### Solution

[It will be fixed](https://github.com/containers/podman/pull/17264) in 4.4.

Let `timedatectl` executable placed in you $PATH... somehow now 😅

My way was to:

1. Create a Cargo project named "timedatectl".
2. Write Rust code to just print my time zone (with input parameters ignored).    
    ```rust
    fn main() {
        println!("Asia/Tokyo");
    }
    ```
3. Built it and placed in `$PATH`, actually `/usr/local/bin`.

## Conclusion

`podman machine init` must be successful like below !!!

```console
Extracting compressed file
Image resized.
Machine init complete
To start your machine run:

	podman machine start

```

Then run `podman machine start`. It will start in rootless mode like a charm 😊

```console
Starting machine "podman-machine-default"
Waiting for VM ...
Mounting volume... /home/(...):/home/(...)

This machine is currently configured in rootless mode. If your containers
require root permissions (e.g. ports < 1024), or if you run into compatibility
issues with non-podman clients, you can switch using the following command: 

	podman machine set --rootful

API forwarding listening on: /home/(...)/.local/share/containers/podman/machine/podman-machine-default/podman.sock
You can connect Docker API clients by setting DOCKER_HOST using the
following command in your terminal session:

	export DOCKER_HOST='unix:///home/(...)/.local/share/containers/podman/machine/podman-machine-default/podman.sock'

Machine "podman-machine-default" started successfully
```

Hope that some of the solutions above might help you enjoy Podman containers and pods.