Bug 85759 - sytemd-nspawn 217 fails with error code 1 if --bind option scecified
Summary: sytemd-nspawn 217 fails with error code 1 if --bind option scecified
Status: RESOLVED FIXED
Alias: None
Product: systemd
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: systemd-bugs
QA Contact: systemd-bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-11-02 14:36 UTC by Vlad
Modified: 2014-11-02 18:01 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Vlad 2014-11-02 14:36:10 UTC
Starting with systemd 217 systemd-nspawn fails with error code 1 if --bind option specified. The version 216 works fine.
The command "systemd-nspawn --bind /mnt/portage -D /mnt/data/srv2 /bin/bash"
returns:
Press ^] three times within 1s to kill container.
Container srv2 failed with error code 1.

Without "--bind" the same command workd fine.

Below is the last lines from strace with systemd 217.

access("/mnt/data/srv2/root/bin/bash", F_OK) = 0
open("/dev/ptmx", O_RDWR|O_NOCTTY|O_NONBLOCK|O_CLOEXEC) = 3
statfs("/dev/pts", {f_type="DEVPTS_SUPER_MAGIC", f_bsize=4096, f_blocks=0, f_bfree=0, f_bavail=0, f_files=0, f_ffree=0, f_fsid={0, 0}, f_namelen=255, f_frsize=4096}) = 0
ioctl(3, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
ioctl(3, TIOCGPTN, [10])                = 0
stat("/dev/pts/10", {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 10), ...}) = 0
writev(2, [{"Spawning container srv2 on /mnt/"..., 47}, {"\n", 1}], 2) = 48
writev(2, [{"Press ^] three times within 1s t"..., 49}, {"\n", 1}], 2) = 50
ioctl(3, TIOCSPTLCK, [0])               = 0
access("/dev/kdbus/control", F_OK)      = -1 ENOENT (No such file or directory)
socketpair(PF_LOCAL, SOCK_DGRAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0, [4, 5]) = 0
rt_sigprocmask(SIG_BLOCK, [INT TERM CHLD WINCH], NULL, 8) = 0
eventfd2(0, O_NONBLOCK|O_CLOEXEC)       = 6
eventfd2(0, O_NONBLOCK|O_CLOEXEC)       = 7
pipe2([8, 9], O_NONBLOCK|O_CLOEXEC)     = 0
rt_sigprocmask(SIG_UNBLOCK, [CHLD], NULL, 8) = 0
rt_sigaction(SIGCHLD, {0x7fa5dbec51c0, [], SA_RESTORER|SA_NOCLDSTOP, 0x7fa5db21ee30}, NULL, 8) = 0
clone(child_stack=0, flags=CLONE_NEWNS|CLONE_NEWUTS|CLONE_NEWIPC|CLONE_NEWPID|SIGCHLD) = 2329
close(9)                                = 0
write(6, "\1\0\0\0\0\0\0\0", 8)         = 8
poll([{fd=8, events=POLLHUP}, {fd=7, events=POLLIN}], 2, 4294967295) = 1 ([{fd=8, revents=POLLHUP}])
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=2329, si_status=1, si_utime=0, si_stime=0} ---
rt_sigreturn()                          = 1
kill(2329, SIGKILL)                     = 0
waitid(P_PID, 2329, {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=2329, si_status=1, si_utime=0, si_stime=0}, WEXITED, NULL) = 0
writev(2, [{"Container srv2 failed with error"..., 40}, {"\n", 1}], 2) = 41
close(6)                                = 0
close(7)                                = 0
close(8)                                = 0
close(4)                                = 0
close(5)                                = 0
close(3)                                = 0
exit_group(1)                           = ?
+++ exited with 1 +++
Comment 1 Vlad 2014-11-02 14:51:01 UTC
I've spent some time to test, so it looks like systemd tries to create the mount point inside the container even if directory exists:

[pid  5519] open("/mnt/data/srv2/root/etc/machine-id", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid  5519] stat("/mnt/portage", {st_mode=S_IFDIR|0755, st_size=180, ...}) = 0
[pid  5519] stat("/mnt/data/srv2/root/mnt/portage", {st_mode=S_IFDIR|0755, st_size=70, ...}) = 0
[pid  5519] mkdir("/mnt/data/srv2/root/mnt/portage", 0755) = -1 EEXIST (File exists)
[pid  5519] writev(2, [{"Failed to create mount point /mn"..., 73}, {"\n", 1}], 2) = 74
[pid  5519] exit_group(1)               = ?
[pid  5518] <... poll resumed> )        = 1 ([{fd=8, revents=POLLHUP}])
[pid  5519] +++ exited with 1 +++
Comment 2 Lennart Poettering 2014-11-02 18:01:22 UTC
Fixed in 1ab19cb167b32967556eefd8f6d3df0e3de7d67d already.


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.