{{tag>Pb podman SystemD CA}}
= Pb podman - podman system migrate
Voir sur RedHat :
* https://access.redhat.com/solutions/6988045
* [[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/building_running_and_managing_containers/assembly_starting-with-containers_building-running-and-managing-containers#proc_setting-up-rootless-containers_assembly_starting-with-containers|Red Hat Enterprise Linux8 Building, running, and managing containers Chapter 1. Starting with containers 1.6. Setting up rootless containers]]
* Paquet ''setup'' (''/etc/subuid'' et ''/etc/subgid'')
Notes :
* [[Pb Podman container still Stopping|After executing podman system migrate, the container status remained stopping]]
* ''podman system migrate'' can be used to stop both the running containers and the pause process...
Erreur
potentially insufficient UIDs or GIDs available in user namespace
ou encore, suite à une mise à jour de Podman
ERRO[0000] invalid internal status, try resetting the pause process with "/usr/bin/podman system migrate": could not find any running process: no such process
== Étapes à suivre pour reproduire
=== Remise à l'état initial
# egrep " setup-" /var/log/dnf.rpm.log |grep Upgraded | tail -1
2023-09-27T17:52:38+0200 SUBDEBUG Upgraded: setup-2.12.2-5.el8.noarch
yum install -y setup-2.12.2-5.el8.noarch
# sudo -u awx -i podman ps ; echo $?
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
0
sudo -u awx -i podman system migrate
Un faut lancer au moins un container
sudo -u awx -i podman run -d monimage:latest sleep inf
=== Reproduction
yum install setup
sudo -u awx -i podman ps
Pas d'erreur, car nous n'avons pas encore faite de reboot
Redémarrons
reboot
$ sudo -u awx -i podman ps ; echo $?
ERRO[0000] invalid internal status, try resetting the pause process with "podman system migrate": could not find any running process: no such process
1
=== Solution
sudo -u awx -i podman system migrate
-------------------
== Script palliatif
Maintenance palliative - script pour automatiser la commande ''podman system migrate'' quand cela est nécessaire. Cela évite les indisponibilité de podman en cas de reboot.
''autofix_podman_system_migrate.sh''
#! /bin/bash
# QUI: Script écrit par JB. Il doit être lancé avec le(s) compte(s) utilisateur(s) exécutant des containers podman.
# QUOI: Voir le ticket #03618727
# POURQUOI: Bug indispo podman après reboot si certains paquets tels que podman, setup... ont été mis à jour.
# QUAND: Script lancé au boot
# COMMENT: Avec une crontab tel que :
# '@reboot /var/lib/awx/scripts/autofix_podman_system_migrate.sh'
# ou si cron root '@reboot sudo -u awx -i /var/lib/awx/scripts/autofix_podman_system_migrate.sh'
# ou encore avec SystemD
if podman ps 2>&1 | grep -q 'podman system migrate'
then
podman system migrate
# Fix containers still in Stopping state
if [[ "$USER" == 'awx' ]]
then
sleep 1
podman rm -f "$(podman ps -a | grep -v 'seconds' | awk '/Stopping/ {print $1}')" 2>/dev/null || true
fi
fi
''autofix_podman_system_migrate.service''
[Unit]
Description=Autofix podman system migrate
[Service]
Type=oneshot
ExecStart=/bin/bash /var/lib/awx/scripts/autofix_podman_system_migrate.sh
RemainAfterExit=yes
User=awx
[Install]
WantedBy=receptor.service
== Autres
- name: Ensure changes are applied to podman
command: podman system migrate
environment:
XDG_RUNTIME_DIR: "{{ podman_tmp.path }}"