Bug 693185

Summary: systemd-nspawn invalid excess arguments error
Product: [Fedora] Fedora Reporter: Albert Strasheim <fullung>
Component: systemdAssignee: Lennart Poettering <lpoetter>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 15CC: fullung, johannbg, lpoetter, metherid, mschmidt, notting, plautrba
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-04-04 18:34:14 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Albert Strasheim 2011-04-03 12:23:23 UTC
Description of problem:

I'm trying to run systemd under strace in a systemd-nspawn container:

systemd-nspawn -D root -- /usr/bin/strace -f /bin/systemd systemd.log_level=debug

I'm getting an Excess arguments error.

Version-Release number of selected component (if applicable):

systemd-22-1.fc15.x86_64

How reproducible:

Always

Steps to Reproduce:
1. systemd-nspawn -D root -- /usr/bin/strace -f /bin/systemd systemd.log_level=debug
  
Actual results:

Excess arguments error.

Expected results:

systemd-nspawn should not try to interpret arguments after --, which would avoid it from being confused by arguments I am trying to pass to strace.

Additional info:

Comment 1 Albert Strasheim 2011-04-03 12:48:54 UTC
The error is coming from systemd, not systemd-nspawn.

The excess arguments is happening because systemd isn't running as PID=1 and does a check like this:

if (getpid() != 1 && optind < argc) {
  return -EINVAL;
}

which makes me wonder if in fact the example in the systemd-nspawn manual page which suggests passing systemd.log_level=debug as a parameter to systemd might be wrong?

Comment 2 Lennart Poettering 2011-04-04 18:34:14 UTC
Hmm? if you run "systemd-nspawn -D root -- /usr/bin/strace -f /bin/systemd systemd.log_level=debug" then strace starts as PID 1, and systemd is forked off that and gets PID 2. However, when it is PID 2 it cannot act as init system and chooses to run as user sessoin manager instead which takes no additional argument.

The example in the man page is correct, since it does not involve strace and hence systemd is started as PID 1.

So I see nothing wrong here?

Comment 3 Albert Strasheim 2011-04-04 18:58:39 UTC
Right. Sorry for the noise.