Project

General

Profile

Bug #44559

Updated by Nathan Cutler about 4 years ago

When Apparently "stat -c %u %g /var/lib/ceph" works inside the upstream container, but I run "cephadm bootstrap", I see the following in the log: have a container (based on openSUSE Leap 15.2) where it does not work:

<pre>
INFO:cephadm:Extracting ceph user uid/gid from container image...
DEBUG:cephadm:['/usr/bin/podman', 'run', '--rm', '--net=host', '-e', 'CONTAINER_IMAGE=registry.opensuse.org/filesystems/ceph/octopus/images/ceph/ceph', '-e', 'NODE_NAME=admin', '--entrypoint', 'stat', 'registry.opensuse.org/filesystems/ceph/octopus/images/ceph/ceph', '-c', '%u %g', '/var/lib/ceph']
DEBUG:cephadm:Running command: /usr/bin/podman
admin:~ # podman run --rm --net=host -e CONTAINER_IMAGE=registry.opensuse.org/filesystems/ceph/octopus/images/ceph/ceph -e NODE_NAME=admin --entrypoint -it 57b3630086f6 /bin/bash
admin:/ #
stat registry.opensuse.org/filesystems/ceph/octopus/images/ceph/ceph -c %u %g /var/lib/ceph
stat: cannot stat '%g': No such file or directory
167
</pre>

But the actual command being run is: following *does* work:

<pre>
"/usr/bin/podman" "run" "--rm" "--net=host" "-e" "CONTAINER_IMAGE=registry.opensuse.org/filesystems/ceph/octopus/images/ceph/ceph" "-e" "NODE_NAME=admin" "--entrypoint admin:/ # stat registry.opensuse.org/filesystems/ceph/octopus/images/ceph/ceph" "-c" "%u %g" "/var/lib/ceph" -c %u /var/lib/ceph
167
admin:/ # stat -c %g /var/lib/ceph
167
</pre>

It seems prudent to use the latter form.

For completeness:

<pre>
admin:/ # stat --version
stat (GNU coreutils) 8.29
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is important because <code>stat -c %u %g /var/lib/ceph</code> is syntactically incorrect and will produce an error if free software: you try are free to run it change and redistribute it.
There is NO WARRANTY, to the extent permitted
by copying the command as cephadm logs it. law.

Written by Michael Meskes.
</pre>

Back