| 両方とも前のリビジョン 前のリビジョン 次のリビジョン | 前のリビジョン |
| linux:podman [2025/03/30 10:13] – [コンテナ内のカラーが微妙に違う...🤔どうでもいいけど...😅] ともやん | linux:podman [2025/09/28 13:23] (現在) – [Error: cannot re-exec process to join the existing user namespace エラーが発生する💩🤪] ともやん |
|---|
| </WRAP> | </WRAP> |
| |
| === コンテナ内のカラーが微妙に違う...🤔どうでもいいけど...😅 === | === コンテナ内のカラーが微妙に違う...🤔ドウデモイイケドネ...😅 === |
| [[https://www.baeldung.com/linux/docker-container-colored-bash-output|Displaying Colored Output in Bash Inside a Docker Container | Baeldung on Linux]]\\ | |
| [[https://forums.docker.com/t/wrong-colors-inside-docker-container/68322|Wrong colors inside Docker container - General - Docker Community Forums]]\\ | |
| [[https://www.howtogeek.com/307899/how-to-change-the-colors-of-directories-and-files-in-the-ls-command/|How to Change the Colors of Directories and Files in the ls Command]] [[gtr>https://www.howtogeek.com/307899/how-to-change-the-colors-of-directories-and-files-in-the-ls-command/|翻訳]]\\ | |
| 気になる人のために...😉\\ | 気になる人のために...😉\\ |
| <WRAP color_term> | <WRAP color_term> |
| <WRAP color_command><html><pre class=BSc> | <WRAP color_command><html><pre> |
| <font color="#00FFFF">┌──(</font><font color="#0087FF"><b>tomoyan highway-x</b></font><font color="#00FFFF">)-[</font><b>~</b><font color="#00FFFF">]</font> | <font color="#0087FF"><b>$</b></font> <font color="#26A269">buildah</font> u<font color="#999999">nshare</font> |
| <font color="#00FFFF">└─</font><font color="#0087FF"><b>$</b></font> <font color="#26A269">buildah</font> u<font color="#999999">nshare</font> | </pre></html></WRAP> |
| | <WRAP color_result><html><pre class=BSc> |
| <font color="#5F00FF">┌──(</font><font color="#F66151"><b>root 💀 highway-x</b></font><font color="#5F00FF">)-[</font><b>~/</b><font color="#5F00FF">]</font> | <font color="#5F00FF">┌──(</font><font color="#F66151"><b>root 💀 highway-x</b></font><font color="#5F00FF">)-[</font><b>~/</b><font color="#5F00FF">]</font> |
| <font color="#5F00FF">└─</font><font color="#F66151"><b>#</b></font> <font color="#26A269">exit</font> | <font color="#5F00FF">└─</font><font color="#F66151"><b>#</b></font> <font color="#26A269">exit</font> |
| | </pre></html></WRAP> |
| <font color="#00FFFF">┌──(</font><font color="#0087FF"><b>tomoyan highway-x</b></font><font color="#00FFFF">)-[</font><b>~</b><font color="#00FFFF">]</font> | <WRAP color_command><html><pre> |
| <font color="#00FFFF">└─</font><font color="#0087FF"><b>$</b></font> <font color="#26A269">podman</font> run <font color="#A347BA">--name</font> fedora <font color="#A347BA">--rm</font> <font color="#A347BA">-ti</font> tomoyan596/fedora41-minimal-zsh zsh | <font color="#0087FF"><b>$</b></font> <font color="#26A269">podman</font> run <font color="#A347BA">--name</font> fedora <font color="#A347BA">--rm</font> <font color="#A347BA">-ti</font> tomoyan596/fedora41-minimal-zsh zsh |
| | </pre></html></WRAP> |
| | <WRAP color_result><html><pre class=BSc> |
| ┌──(<font color="#F66151"><b>root 💀 dedcd1106d29</b></font>)-[<b>~</b>] | ┌──(<font color="#F66151"><b>root 💀 dedcd1106d29</b></font>)-[<b>~</b>] |
| └─<font color="#F66151"><b>#</b></font> <font color="#26A269">exit</font> | └─<font color="#F66151"><b>#</b></font> <font color="#26A269">exit</font> |
| | </pre></html></WRAP> |
| <font color="#00FFFF">┌──(</font><font color="#0087FF"><b>tomoyan highway-x</b></font><font color="#00FFFF">)-[</font><b>~</b><font color="#00FFFF">]</font> | <WRAP color_command><html><pre> |
| <font color="#00FFFF">└─</font><font color="#0087FF"><b>$</b></font> <font color="#26A269">podman</font> run <font color="#A347BA">--name</font> fedora <font color="#A347BA">--rm</font> <font color="#A347BA">-ti</font> <font color="#A347BA">-e</font> <font color="#A2734C">"TERM=xterm-256color"</font> tomoyan596/fedora41-minimal-zsh zsh | <font color="#0087FF"><b>$</b></font> <font color="#26A269">podman</font> run <font color="#A347BA">--name</font> fedora <font color="#A347BA">--rm</font> <font color="#A347BA">-ti</font> <font color="#A347BA">-e</font> <font color="#A2734C">"TERM=$TERM"</font> tomoyan596/fedora41-minimal-zsh zsh |
| | </pre></html></WRAP> |
| | <WRAP color_result><html><pre class=BSc> |
| | <font color="#5F00FF">┌──(</font><font color="#F66151"><b>root 💀 d6d67305079a</b></font><font color="#5F00FF">)-[</font><b>~</b><font color="#5F00FF">]</font> |
| | <font color="#5F00FF">└─</font><font color="#F66151"><b>#</b></font> |
| | </pre></html></WRAP> |
| | Or |
| | <WRAP color_command><html><pre> |
| | <font color="#0087FF"><b>$</b></font> <font color="#26A269">podman</font> run <font color="#A347BA">--name</font> fedora <font color="#A347BA">--rm</font> <font color="#A347BA">-ti</font> <font color="#A347BA">-e</font> <font color="#A2734C">"TERM=xterm-256color"</font> tomoyan596/fedora41-minimal-zsh zsh |
| | </pre></html></WRAP> |
| | <WRAP color_result><html><pre class=BSc> |
| <font color="#5F00FF">┌──(</font><font color="#F66151"><b>root 💀 d6d67305079a</b></font><font color="#5F00FF">)-[</font><b>~</b><font color="#5F00FF">]</font> | <font color="#5F00FF">┌──(</font><font color="#F66151"><b>root 💀 d6d67305079a</b></font><font color="#5F00FF">)-[</font><b>~</b><font color="#5F00FF">]</font> |
| <font color="#5F00FF">└─</font><font color="#F66151"><b>#</b></font> | <font color="#5F00FF">└─</font><font color="#F66151"><b>#</b></font> |
| </pre></html></WRAP> | </pre></html></WRAP> |
| </WRAP> | </WRAP> |
| | ※''$TERM'' 環境変数は通常 VTE によって設定されるが、''podman run'' または ''podman exec'' では今のところ設定されない🤔\\ |
| |
| ''$LS_COLORS'' は特に差異は認められない😊\\ | ''$LS_COLORS'' は特に差異は認められない😊\\ |
| </pre></html></WRAP> | </pre></html></WRAP> |
| </WRAP> | </WRAP> |
| | |
| | 一先ず ''-e "TERM=$TERM"'' で運用😅\\ |
| | <WRAP color_term> |
| | <WRAP color_command><html><pre> |
| | <font color="#0087FF"><b>$</b></font> <font color="#26A269">podman</font> run <font color="#A347BA">--name</font> openwrt_builder <font color="#A347BA">--rm</font> <font color="#A347BA">-ti</font> <font color="#A347BA">-v</font> <font color="#2A7BDE"><b>`</b></font><font color="#26A269">pwd</font><font color="#2A7BDE"><b>`</b></font>/openwrt:/home/tomoyan/openwrt tomoyan596/openwrt_builder zsh |
| | </pre></html></WRAP> |
| | <WRAP color_result><html><pre class=BSc> |
| | ┌──(<b>tomoyan d72536ea41c9</b>)-[<b>~</b>] |
| | └─<b>$</b> <font color="#26A269">exit</font> |
| | </pre></html></WRAP> |
| | <WRAP color_command><html><pre> |
| | <font color="#0087FF"><b>$</b></font> <font color="#26A269">podman</font> run <font color="#A347BA">--name</font> openwrt_builder <font color="#A347BA">--rm</font> <font color="#A347BA">-ti</font> <font color="#A347BA">-v</font> <font color="#2A7BDE"><b>`</b></font><font color="#26A269">pwd</font><font color="#2A7BDE"><b>`</b></font>/openwrt:/home/tomoyan/openwrt <font color="#A347BA">-e</font> <font color="#A2734C">"TERM=</font><font color="#A347BA">$TERM</font><font color="#A2734C">"</font> tomoyan596/openwrt_builder zsh |
| | </pre></html></WRAP> |
| | <WRAP color_result><html><pre class=BSc> |
| | <font color="#00FFFF">┌──(</font><font color="#0087FF"><b>tomoyan f300a11c5dff</b></font><font color="#00FFFF">)-[</font><b>~</b><font color="#00FFFF">]</font> |
| | <font color="#00FFFF">└─</font><font color="#0087FF"><b>$</b></font> |
| | </pre></html></WRAP> |
| | </WRAP> |
| | |
| | **参考文献:**\\ |
| | [[https://www.baeldung.com/linux/docker-container-colored-bash-output|Displaying Colored Output in Bash Inside a Docker Container | Baeldung on Linux]]\\ |
| | [[https://forums.docker.com/t/wrong-colors-inside-docker-container/68322|Wrong colors inside Docker container - General - Docker Community Forums]]\\ |
| | [[https://www.howtogeek.com/307899/how-to-change-the-colors-of-directories-and-files-in-the-ls-command/|How to Change the Colors of Directories and Files in the ls Command]] [[gtr>https://www.howtogeek.com/307899/how-to-change-the-colors-of-directories-and-files-in-the-ls-command/|翻訳]]\\ |
| | [[https://www.cyberciti.biz/faq/bash-shell-change-the-color-of-my-shell-prompt-under-linux-or-unix/|BASH Shell Change The Color of Shell Prompt on Linux or UNIX - nixCraft]]\\ |
| | [[https://superuser.com/questions/841016/how-to-configure-gnome-terminal-to-use-xterm-256color-by-default|linux - How to configure gnome-terminal to use xterm-256color by default? - Super User]]\\ |
| | [[https://askubuntu.com/questions/233280/gnome-terminal-reports-term-to-be-xterm/578798|Gnome-Terminal reports $TERM to be `xterm` - Ask Ubuntu]] [[gtr>https://askubuntu.com/questions/233280/gnome-terminal-reports-term-to-be-xterm/578798|翻訳]]\\ |
| |
| === 実行例 === | === 実行例 === |
| [[git>containers/podman/issues/9137|podman rootless causes Error: cannot re-exec process · Issue #9137 · containers/podman]]\\ | [[git>containers/podman/issues/9137|podman rootless causes Error: cannot re-exec process · Issue #9137 · containers/podman]]\\ |
| issues は閉じているが再現性はありそう...🤔\\ | issues は閉じているが再現性はありそう...🤔\\ |
| | |
| | 原因のまとめ🤔 by [[https://grok.com/|Grok]]\\ |
| | 主な原因はルートレスPodmanの仕組み(ユーザーネームスペース、cgroup v2、OCIランタイムのcrun/runc)で、以下のような要因:\\ |
| | * **pause.pidの残骸**: Podmanのルートレス実行で/run/user/$UID/libpod/tmp/pause.pidが残ると、再実行時に名前空間に参加できずエラー。 |
| | * **systemdセッションの不整合**: XDG_RUNTIME_DIRやsystemd-logindのセッションが不完全(Incusやツールボックス内のネスト実行で発生しやすい)。 |
| | * **ユーザーネームスペースの無効化**: ホストのカーネル設定(kernel.unprivileged_userns_clone=0)で無効になってる場合。 |
| | * **ネストコンテナ環境**: Incusやsystemd-nspawn内でPodmanを実行すると、ネスト設定(security.nesting)が不足。 |
| | * **仕様変更の影響**: Podman 4.9.x以降でルートレス処理が強化され、Fedora 42やUbuntu 24.04.2の組み合わせでエラーが増えた。以前の環境(例: Podman 4.3.1)では問題なかったのはこのため。 |
| | |
| | 結論: pause.pidの残骸を削除する🤔\\ |
| | <WRAP color_term> |
| | <WRAP color_command><html><pre> |
| | <font color="#0087FF"><b>$</b></font> <font color="#26A269">podman</font> info |
| | </pre></html></WRAP> |
| | <WRAP color_result><html><pre> |
| | Error: cannot re-exec process to join the existing user namespace |
| | </pre></html></WRAP> |
| | <WRAP color_command><html><pre> |
| | <font color="#0087FF"><b>$</b></font> <font color="#26A269">rm</font> /run/user/<font color="#A347BA">$</font><font color="#12488B"><b>(</b></font><font color="#26A269">id</font> <font color="#A347BA">-u</font><font color="#12488B"><b>)</b></font>/libpod/tmp/pause.pid |
| | <font color="#0087FF"><b>$</b></font> <font color="#26A269">podman</font> info |
| | </pre></html></WRAP> |
| | <WRAP color_result_hlong><html><pre> |
| | host: |
| | arch: amd64 |
| | buildahVersion: 1.41.4 |
| | cgroupControllers: |
| | - cpu |
| | - io |
| | - memory |
| | - pids |
| | cgroupManager: systemd |
| | cgroupVersion: v2 |
| | conmon: |
| | package: conmon-2.1.13-1.fc42.x86_64 |
| | path: /usr/bin/conmon |
| | version: 'conmon version 2.1.13, commit: ' |
| | cpuUtilization: |
| | idlePercent: 88.42 |
| | systemPercent: 2.59 |
| | userPercent: 8.99 |
| | </pre></html></WRAP> |
| | </WRAP> |
| | |
| | === 古い対処の経緯🤕 === |
| <WRAP color_term> | <WRAP color_term> |
| <WRAP color_command><html><pre> | <WRAP color_command><html><pre> |
| [[https://www.redhat.com/sysadmin/speeding-container-buildah|Speeding up container image builds with Buildah | Enable Sysadmin]]\\ | [[https://www.redhat.com/sysadmin/speeding-container-buildah|Speeding up container image builds with Buildah | Enable Sysadmin]]\\ |
| [[https://stackoverflow.com/questions/57776452/is-it-possible-to-map-a-user-inside-the-docker-container-to-an-outside-user|linux - Is it possible to map a user inside the docker container to an outside user? - Stack Overflow]]\\ | [[https://stackoverflow.com/questions/57776452/is-it-possible-to-map-a-user-inside-the-docker-container-to-an-outside-user|linux - Is it possible to map a user inside the docker container to an outside user? - Stack Overflow]]\\ |
| | [[https://kinsta.com/blog/dockerfile-entrypoint/|Dockerfile ENTRYPOINT: Everything You Need To Know]]\\ |
| |
| ==== 付録 ==== | ==== 付録 ==== |