Bug 68369

Summary: systemd-nspawn fails to start dirty rootfs
Product: systemd Reporter: Maksim Melnikau <maxposedon>
Component: generalAssignee: systemd-bugs
Status: RESOLVED FIXED QA Contact: systemd-bugs
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Maksim Melnikau 2013-08-21 06:48:02 UTC
systemd-nspawn has problems to start, when rootfs is dirty on some journal file check. Its easy to catch with btrfs snapshots (see below). And when journal is deleted it starts just fine.

m_melnikau-M11xR3 max_posedon # btrfs subvolume snapshot / /.tmp
Create a snapshot of '/' in '//.tmp'

m_melnikau-M11xR3 max_posedon # systemd-nspawn -D /.tmp -b
Spawning namespace container on /.tmp (console is /dev/pts/4).
Init process in the container running as PID 3928.
/etc/localtime is not a symlink, not updating container timezone.
/.tmp/var/log/journal/be1598bd68baa268cb48e33d0000000f not empty.
Container failed with error code 1

m_melnikau-M11xR3 max_posedon # rm -rf /.tmp/var/log/journal/be1598bd68baa268cb48e33d0000000f 

m_melnikau-M11xR3 max_posedon # systemd-nspawn -D /.tmp -b                                   
Spawning namespace container on /.tmp (console is /dev/pts/4).
Init process in the container running as PID 4096.
/etc/localtime is not a symlink, not updating container timezone.
systemd 206 running in system mode. (+PAM +LIBWRAP -AUDIT -SELINUX +IMA -SYSVINIT -LIBCRYPTSETUP +GCRYPT +ACL +XZ)
Detected virtualization 'systemd-nspawn'.

Welcome to Gentoo/Linux!

Set hostname to <m_melnikau-M11xR3>.
Comment 1 Maksim Melnikau 2013-08-21 06:58:55 UTC
After doing few experiments I found out, that there is some issues with --link-journal=auto logic.

m_melnikau-M11xR3 max_posedon # systemd-nspawn -D /.tmp -b --link-journal=no
starting just fine
Comment 2 Laszlo Papp 2013-08-29 09:57:41 UTC
I experience similar issues with ext 4. Is there any workaround? I basically moved /mnt/wheezy to my home due to space concerns. Then, it got broken all of a sudden.

sudo systemd-nspawn
[sudo] password for lpapp: 
Spawning namespace container on /home/lpapp/Projects/chroot/wheezy (console is /dev/pts/1).
Init process in the container running as PID 787.
mknod(/home/lpapp/Projects/chroot/wheezy) failed: File exists
mknod(/home/lpapp/Projects/chroot/wheezy) failed: File exists
mknod(/home/lpapp/Projects/chroot/wheezy) failed: File exists
mknod(/home/lpapp/Projects/chroot/wheezy) failed: File exists
mknod(/home/lpapp/Projects/chroot/wheezy) failed: File exists
mknod(/home/lpapp/Projects/chroot/wheezy) failed: File exists
Container failed with error code 1.
Comment 3 Zbigniew Jedrzejewski-Szmek 2013-12-12 03:45:13 UTC
Maksim: you most probably have the same machine id in host and guest. I just hit this and it looks the same as in your output.

Changed to a more explicit message in http://cgit.freedesktop.org/systemd/systemd/commit/?id=4d680aeea.

Laszlo: this looks like a different problem. Please file a separate bug.
Comment 4 Maksim Melnikau 2013-12-12 07:17:36 UTC
(In reply to comment #3)
> Maksim: you most probably have the same machine id in host and guest. I just
> hit this and it looks the same as in your output.
Yes, it is.

This is exactly what btrfs snapshot do - making 1:1 writable copy. My usecase quite simple a) make btrfs snapshot, b) start it. And I would like that systemd will support this usecase.

Thank you for fixing bug, I'll open more, if find smth interesting for such usecases.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.