Toolbox: 当 /etc/localtime 是主机上的绝对符号链接时,容器不会启动(例如,Arch 和 Ubuntu)

创建于 2020-11-09  ·  10评论  ·  资料来源: containers/toolbox

描述错误
升级到工具箱版本 0.0.97 后,我无法再启动任何工具箱。

toolbox enter work

DEBU Running as real user ID 1000                 
DEBU Resolved absolute path to the executable as /usr/bin/toolbox 
DEBU Running on a cgroups v1 host                 
DEBU Checking if /etc/subgid and /etc/subuid have entries for user x 
DEBU TOOLBOX_PATH is /usr/bin/toolbox             
DEBU Toolbox config directory is /home/x/.config/toolbox 
DEBU Current Podman version is 2.1.1              
DEBU Old Podman version is 2.1.1                  
DEBU Migration not needed: Podman version 2.1.1 is unchanged 
DEBU Resolving container and image names          
DEBU Container: 'work'                            
DEBU Image: ''                                    
DEBU Release: ''                                  
DEBU Resolved container and image names           
DEBU Container: 'work'                            
DEBU Image: 'fedora-toolbox:31'                   
DEBU Release: '31'                                
DEBU Checking if container work exists            
DEBU Inspecting mounts of container work          
DEBU Starting container work                      
DEBU Inspecting entry point of container work     
DEBU Entry point PID is a float64                 
DEBU Entry point of container work is toolbox (PID=0) 
Error: invalid entry point PID of container work

更新前后创建的容器的输出相同。 工具箱可以在降级到 0.0.96 后启动,一旦启动就可以进入 0.0.97。

如何重现行为的步骤

  1. 启动工具箱

预期行为
工具箱已启动

实际行为
抛出错误Error: invalid entry point PID of container work并且工具箱未启动。

toolbox --version (v0.0.90+) 的输出
toolbox version 0.0.97

工具箱包信息( rpm -q toolbox
toolbox-0.0.97-1-x86_64 (arch)

podman version

Version:      2.1.1
API Version:  2.0.0
Go Version:   go1.15.2
Git Commit:   9f6d6ba0b314d86521b66183c9ce48eaa2da1de2
Built:        Sat Sep 26 16:50:37 2020
OS/Arch:      linux/amd64

Podman 包信息 ( rpm -q podman )
podman-2.1.1-1-x86_64 (arch)

有关您的操作系统的信息
Archlinux

1. Bug

最有用的评论

我遇到了完全相同的问题(在 Arch Linux 上也是如此)。 降级到 0.0.96 对我有用。

这些是 Fedora 32 工具箱的 Podman 日志:

$ podman logs fedora-toolbox-32
level=debug msg="Running as real user ID 0"
level=debug msg="Resolved absolute path to the executable as /usr/bin/toolbox"
level=debug msg="TOOLBOX_PATH is /usr/bin/toolbox"
level=debug msg="XDG_RUNTIME_DIR is unset"
level=debug msg="XDG_RUNTIME_DIR set to /run/user/1000"
level=debug msg="Creating /run/.toolboxenv"
level=debug msg="Monitoring host"
level=debug msg="Path /run/host/etc exists"
level=debug msg="Resolved /etc/localtime to /usr/share/zoneinfo/Europe/Amsterdam"
Error: /etc/localtime points to unknown location

所有10条评论

我遇到了完全相同的问题(在 Arch Linux 上也是如此)。 降级到 0.0.96 对我有用。

这些是 Fedora 32 工具箱的 Podman 日志:

$ podman logs fedora-toolbox-32
level=debug msg="Running as real user ID 0"
level=debug msg="Resolved absolute path to the executable as /usr/bin/toolbox"
level=debug msg="TOOLBOX_PATH is /usr/bin/toolbox"
level=debug msg="XDG_RUNTIME_DIR is unset"
level=debug msg="XDG_RUNTIME_DIR set to /run/user/1000"
level=debug msg="Creating /run/.toolboxenv"
level=debug msg="Monitoring host"
level=debug msg="Path /run/host/etc exists"
level=debug msg="Resolved /etc/localtime to /usr/share/zoneinfo/Europe/Amsterdam"
Error: /etc/localtime points to unknown location

我看一样

level=debug msg="Running as real user ID 0"
level=debug msg="Resolved absolute path to the executable as /usr/bin/toolbox"
level=debug msg="TOOLBOX_PATH is /usr/bin/toolbox"
level=debug msg="XDG_RUNTIME_DIR is unset"
level=debug msg="XDG_RUNTIME_DIR set to /run/user/1000"
level=debug msg="Creating /run/.toolboxenv"
level=debug msg="Monitoring host"
level=debug msg="Path /run/host/etc exists"
level=debug msg="Preparing to redirect /etc/localtime to /run/host/etc/localtime"
level=debug msg="/run/host/etc/localtime is a symbolic link"
level=debug msg="Redirecting /etc/localtime to /run/host/etc/localtime"
level=debug msg="Resolved /etc/localtime to /usr/share/zoneinfo/Europe/Copenhagen"
Error: /etc/localtime points to unknown location

这可能是由 4c9b80aee2b2ee3162b82e309718a23792d0e103 引起的吗?

我在 Manjaro(基于拱门)上遇到了同样的问题。 通过提交,我发现 b9a0bd5f0c2a2421ec15eea286ca20f03b7152d2 是罪魁祸首。 4c9b80aee2b2ee3162b82e309718a23792d0e103 似乎是最后一个正常工作的。

有人在 Arch Linux 上试过 0.0.98.1 吗?

出于好奇,您的 Arch 主机系统没有/etc/localtime吗?

是的,Arch 主机确实有 /etc/localtime。 它是 /usr/share/zoneinfo/ 的符号链接。
问题是工具箱有:

        const zoneInfoRoot = "/run/host/usr/share/zoneinfo"

        if !strings.HasPrefix(localTimeEvaled, zoneInfoRoot) {
                return errors.New("/etc/localtime points to unknown location")
        }

如果我将 zoneInfoRoot 更改为"/usr/share/zoneinfo" ,则工具箱运行良好。

在调用updateTimeZoneFromLocalTime() , /etc/localtime 链接被更新为指向与 /run/host/etc/localtime 指向的相同路径。
我看不出这应该如何使 /etc/localtime 指向 /run/host,因为主机文件对工具箱一无所知。

因此,除非我错过了某些东西,甚至对其他人来说甚至可能很明显,否则zoneInfoRoot应该简单地更改/修复。 如果 /etc/localtime 的两个用例都指向 /run/host/usr/share/zoneinfo/... 和 /usr/share/zoneinfo/... 我想我们可以检查这两种可能性,并且根据匹配的前缀解析timeZone

是的,Arch 主机确实有 /etc/localtime。 它是一个符号链接
/usr/share/zoneinfo/.

好的,所以它不像 Fedora CoreOS 上的情况

这应该由https://github.com/containers/toolbox/pull/634解决

但是,我必须提到 Arch 和 Ubuntu 都应该使用相对符号链接。 如果他们这样做了,这将继续起作用,因为相对符号链接能够处理类似 chroot 的情况,这是更好的。 例如,在 Fedora 工作站上,我们有:

$ ls -l /etc/localtime 
lrwxrwxrwx. 1 root root 35 Jan  5 18:20 /etc/localtime -> ../usr/share/zoneinfo/Europe/Prague

而在 Ubuntu 18.04 上,我看到:

$ ls -l /etc/localtime 
lrwxrwxrwx 1 root root 33 lis 11 16:21 /etc/localtime -> /usr/share/zoneinfo/Europe/Prague

但是,如果我使用timedatectl那么它就会得到修复

$ timedatectl set-timezone Europe/Prague
$ ls -l /etc/localtime 
lrwxrwxrwx 1 root root 35 led 12 20:29 /etc/localtime -> ../usr/share/zoneinfo/Europe/Prague

是的,将 /etc/localtime 符号链接更改为绝对值是一种可用的解决方法。 我现在就用这个​​,谢谢。

但我认为#634 应该合并。 我认为不支持这种绝对符号链接没有多大意义。

关闭。 如果您认为这仍然没有解决,请重新打开或发表评论。

感谢您测试 Toolbox。

此页面是否有帮助?
0 / 5 - 0 等级