Ciel does not guarantee the root of nspawn containers to have the correct permissions
Closed this issue · 0 comments
poscat0x04 commented
Summary
When creating an nspawn container ciel does not guarantee the correct permission of the root of container, which should have at least 551
for services inside the container to function.
Cause
- ciel does not validate the permission of the directories
.ciel/container/instances/<instance>/layers/{diff{,.tmp},local}
when creating them. And while unsquashfs guarantees the root of the base image to have the correct permission, this causes incorrect permissions of the root directory of the container when these directories are layered on top of the base image. - AOSC by default sets it's umask to
0077
in/etc/login.defs
. But only bash shells default their umask to 0002 (see/etc/bashrc.d/20-shell.sh
). And since sudo inherits the umask of the calling environment (at least by default), this means when using any shell other than bash to run ciel, the aforementioned directories won't have the executable bit set.
Reproducing
- Run
umask 0077
to simulate the behavior of every non-bash shell. - Create a new directory and
cd
into it. - Run
sudo ciel init
. - Run
sudo ciel load-os
. - Run
sudo ciel config -g
. - Run
sudo ciel add default
. - Run
sudo ciel shell -i default
, which should fail withFailed to start transient service unit: Failed to activate service 'org.freedesktop.systemd1': timed out (service_start_timeout=25000ms)
. The container's journal should be available underdefault/var/log/journal/<machine-id>/system.journal
and should look something like this (journal file)
Currently possible workarounds
- Use
chmod 755
on the container root after mounting - Run
umask 0022
before runningciel