Outils pour utilisateurs

Outils du site


tech:pb_podman_-_podman_system_migrate

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Prochaine révision
Révision précédente
tech:pb_podman_-_podman_system_migrate [2025/03/24 15:06] – créée - modification externe 127.0.0.1tech:pb_podman_-_podman_system_migrate [2026/06/02 10:58] (Version actuelle) Jean-Baptiste
Ligne 1: Ligne 1:
 +<!DOCTYPE markdown>
 +{{tag>Pb podman SystemD CA}}
 +
 +# Pb podman - podman system migrate
 +
 +Voir sur RedHat :
 +* https://access.redhat.com/solutions/6988045
 +* [Red Hat Enterprise Linux8 Building, running, and managing containers Chapter 1. Starting with containers 1.6. Setting up rootless containers](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)
 +* 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
 +~~~
 +
 +~~~bash
 +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
 +~~~
 +
 +~~~bash
 +sudo -u awx -i podman system migrate
 +~~~
 +
 +Un faut lancer au moins un container
 +~~~bash
 +sudo -u awx -i podman run -d monimage:latest sleep inf
 +~~~
 +
 +
 +
 +### Reproduction
 +
 +~~~bash
 +yum install setup
 +~~~
 +
 +~~~bash
 +sudo -u awx -i podman ps
 +~~~
 +Pas d'erreur, car nous n'avons pas encore faite de reboot
 +
 +Redémarrons
 +~~~bash
 +reboot
 +~~~
 +
 +~~~bash
 +$ 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
 +
 +~~~bash
 +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`
 +~~~bash
 +#! /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`
 +~~~ini
 +[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
 +
 +~~~yaml
 +    - name: Ensure changes are applied to podman
 +      command: podman system migrate
 +      environment:
 +        XDG_RUNTIME_DIR: "{{ podman_tmp.path }}"
 +~~~
 +
  

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki