Skip to content

Enhance nspawn debug logs for mount/unmount operations#4351

Merged
poettering merged 4 commits intosystemd:masterfrom
keszybz:nspawn-debugging
Oct 12, 2016
Merged

Enhance nspawn debug logs for mount/unmount operations#4351
poettering merged 4 commits intosystemd:masterfrom
keszybz:nspawn-debugging

Conversation

@keszybz
Copy link
Member

@keszybz keszybz commented Oct 11, 2016

This should help with understanding all the details in #4223 and #4340.
Strace provides similar information, but having it in the log statements makes it much easier.
Also if errors happens, they are reported better.

We would check the condition cg_ns_supported() twice. No functional
change.
- check for oom after strdup
- no need to truncate the line since we're only extracting one field anyway
- use STR_IN_SET
This makes it easier to debug failed nspawn invocations:

Mounting sysfs on /var/lib/machines/fedora-rawhide/sys (MS_RDONLY|MS_NOSUID|MS_NOEXEC|MS_NODEV "")...
Mounting tmpfs on /var/lib/machines/fedora-rawhide/dev (MS_NOSUID|MS_STRICTATIME "mode=755,uid=1450901504,gid=1450901504")...
Mounting tmpfs on /var/lib/machines/fedora-rawhide/dev/shm (MS_NOSUID|MS_NODEV|MS_STRICTATIME "mode=1777,uid=1450901504,gid=1450901504")...
Mounting tmpfs on /var/lib/machines/fedora-rawhide/run (MS_NOSUID|MS_NODEV|MS_STRICTATIME "mode=755,uid=1450901504,gid=1450901504")...
Bind-mounting /sys/fs/selinux on /var/lib/machines/fedora-rawhide/sys/fs/selinux (MS_BIND "")...
Remounting /var/lib/machines/fedora-rawhide/sys/fs/selinux (MS_RDONLY|MS_NOSUID|MS_NOEXEC|MS_NODEV|MS_BIND|MS_REMOUNT "")...
Mounting proc on /proc (MS_NOSUID|MS_NOEXEC|MS_NODEV "")...
Bind-mounting /proc/sys on /proc/sys (MS_BIND "")...
Remounting /proc/sys (MS_RDONLY|MS_NOSUID|MS_NOEXEC|MS_NODEV|MS_BIND|MS_REMOUNT "")...
Bind-mounting /proc/sysrq-trigger on /proc/sysrq-trigger (MS_BIND "")...
Remounting /proc/sysrq-trigger (MS_RDONLY|MS_NOSUID|MS_NOEXEC|MS_NODEV|MS_BIND|MS_REMOUNT "")...
Mounting tmpfs on /tmp (MS_STRICTATIME "mode=1777,uid=0,gid=0")...
Mounting tmpfs on /sys/fs/cgroup (MS_NOSUID|MS_NOEXEC|MS_NODEV|MS_STRICTATIME "mode=755,uid=0,gid=0")...
Mounting cgroup on /sys/fs/cgroup/systemd (MS_NOSUID|MS_NOEXEC|MS_NODEV "none,name=systemd,xattr")...
Failed to mount cgroup on /sys/fs/cgroup/systemd (MS_NOSUID|MS_NOEXEC|MS_NODEV "none,name=systemd,xattr"): No such file or directory
@keszybz keszybz added the nspawn label Oct 11, 2016
@poettering poettering merged commit 18e51a0 into systemd:master Oct 12, 2016
@keszybz keszybz deleted the nspawn-debugging branch October 13, 2016 01:06
@evverx
Copy link
Contributor

evverx commented Oct 13, 2016

@keszybz , thanks!
I think it would be great to see [pid what]:

234 [outer-child] Mount ...
236 [inner-child] Mount ...

This helps to detect all mounts inside/outside the user namespace

@keszybz
Copy link
Member Author

keszybz commented Oct 13, 2016

It would also be helpful to log namespace transitions...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

3 participants