Systemd-nspawn --version exits with 1

Greetings,

Not sure if this is a bug or just a functionality misunderstanding on my part. I am rather new to linux and was playing around with rkt containers when I stumbled upon this.

When running the following 2 commands
> systemd-nspawn --version
> echo $?

I get a return code of 1.
Shouldn’t this be a return code of 0?

System Info
VERSION_ID=“20170324”
PRETTY_NAME=“openSUSE Tumbleweed”

OpenSuse is running as a VM inside VMWare workstation. Host is Windows 10.

Thanks!

Hello and welcome here.

First a technical feature of the forums here:
Please use CODE tags around copied/pasted computer text in a post. It is the # button in the tool bar of the post editor. When applicable copy/paste complete, that is including the prompt, the command, the output and the next prompt.

When I would then post what you did, it will look like this:

boven:~ # systemd-nspawn --version
systemd 210
+PAM +LIBWRAP +AUDIT +SELINUX -IMA +SYSVINIT +LIBCRYPTSETUP +GCRYPT +ACL +XZ +SECCOMP +APPARMOR
boven:~ # echo $?
0
boven:~ #

There is no need now to explain “when I did x, I get y”, because we can see it.

The big surprise is of course that doing this to show you an example, I get return code 0 .
I must add that this is on openSUSE 13.2.

The man page (on 13.2) says:

EXIT STATUS

The exit code of the program executed in the container is returned.

As in the --version case there is no program executed, it is a bit doubtful what it should be. 0 looks then logical enough to me.

I will start a LEAP 42.2 system to see what I get.

Which I just did. And guess what? I do get a ) also there.

Thus either you are doing something different (that is why we love you showing all from top to toe), or there is something else going on in your system.

You do need to be root to run most systemd commands

Well, not realy:

henk@boven:~> systemd-nspawn --version
systemd 210
+PAM +LIBWRAP +AUDIT +SELINUX -IMA +SYSVINIT +LIBCRYPTSETUP +GCRYPT +ACL +XZ +SECCOMP +APPARMOR
henk@boven:~> echo $?
0
henk@boven:~>

Asking for complete posting of prompt, command, output and prompt is of course one way to check what is done also in this aspect.

But I agree with you that for doing anything substantial with systemd on the system level, processes must be owned by root.

Ah code blocks! Thanks for the nudge. :wink:

I’ve run the commands again once without sudo and once with, same output.
Maybe there is something strange about my system setup. I’ll try and create a fresh OpenSUSE Tumbleweed VM over the weekend and see if I get the same result. The current VM was “relativly” fresh but hey maybe I did something “interesting” in my noobish ignorance. :stuck_out_tongue:


linux-d2c4:~> systemd-nspawn --version
systemd 232
+PAM -AUDIT +SELINUX -IMA +APPARMOR -SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID -ELFUTILS +KMOD -IDN
alex@linux-d2c4:~> echo $?
1
alex@linux-d2c4:~> echo $?
0
alex@linux-d2c4:~> sudo systemd-nspawn --version
[sudo] password for root: 
systemd 232
+PAM -AUDIT +SELINUX -IMA +APPARMOR -SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID -ELFUTILS +KMOD -IDN
alex@linux-d2c4:~> echo $?
1
alex@linux-d2c4:~> echo $?
0

I do not really understand why you get the return code 1. Strange.

Butt doing the

echo $?

twice is not very useful. The second echo will show the return code of the first echo, not any more of the systemd-nspawn.

Hi Guys,

I created an account to confirm this bug.


mitch@mitch:~> sudo /usr/bin/systemd-nspawn --version
systemd 232
+PAM -AUDIT +SELINUX -IMA +APPARMOR -SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID -ELFUTILS +KMOD -IDN
mitch@mitch:~> echo $?
1

I am on the latest tumbleweed also playing around with rkt containers.

I have found github threads referencing the problem:

Appears as though it is a problem introduced by systemd, however a patch has been applied to the systemd master branch. Now to check if the patch has made it into tumbleweed systemd?

I’m not sure of a convienient way to check if the patch is applied to the builds in the TW repos.

Any ideas?

Mitch

Well my system isn’t on the latest systemd.


Information for package systemd:
--------------------------------
Repository     : repo-oss                    
Name           : systemd                     
Version        : 232-10.1                    
Arch           : x86_64                      
Vendor         : openSUSE                    
Installed Size : 9.4 MiB                     
Installed      : Yes                         
Status         : up-to-date                  
Source package : systemd-232-10.1.src        
Summary        : A System and Session Manager

Latest release appears to be 233.

I have downloaded the opensuse source for systemd-232-10.2 and the error code patch has not been applied there.

I wonder how long it will take? Not sure if I should submit bug to TW bugzilla.

Mitch

You should submit a bug to bugzilla including the links to the github bug.
The github bug claims that the bug isn’t theirs, it was introduced by someone (Arch?) which is then probably being used as source by other distros.
Only the openSUSE maintainers will know for sure what source is being used.

It’s probably not an openSUSE bug, but only the openSUSE maintainers can know who to notify to fix the bug.

TSU

TSU, thanks for the advice

Bug report is here: https://bugzilla.opensuse.org/show_bug.cgi?id=1042092

Mitch