4

I am used to the old method of calling init 0 to shutdown. Bad, I know; but when I tried it on my new Arch install I get this:

# init 0
Excess Arguments

This confuses me because I thought systemd was supposed to support run levels? Looking at the man page, it mentions this:

For compatibility with SysV, if systemd is called as init and a PID that is not 1, it will execute telinit and pass all command line arguments unmodified. That means init and telinit are mostly equivalent when invoked from normal login sessions. See telinit(8) for more information.

Am I just using the wrong syntax or have I completely misunderstood systemd?

More Init/Systemd Information

# command -v init
/usr/bin/init

# file /bin/init
/usr/bin/init: symbolic link to ../lib/systemd/systemd

# /lib/systemd/systemd --version
systemd 234
+PAM -AUDIT -SELINUX -IMA -APPARMOR +SMACK -SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 -SECCOMP +BLKID +ELFUTILS +KMOD -IDN2 +IDN default-hierarchy=hybrid
# command -v telinit
/usr/bin/telinit

# file /bin/telinit
/bin/telinit: symbolic link to systemctl

# systemctl --version
systemd 234
+PAM -AUDIT -SELINUX -IMA -APPARMOR +SMACK -SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 -SECCOMP +BLKID +ELFUTILS +KMOD -IDN2 +IDN default-hierarchy=hybrid

General System Info

# uname -a
Linux arch 4.12.5-1-ARCH #1 SMP PREEMPT Fri Aug 11 12:40:21 CEST 2017 x86_64 GNU/Linux

# bash --version
GNU bash, version 4.4.12(1)-release (x86_64-unknown-linux-gnu) 
  • Note that telinit 0 (linked to systemctl) will continue to work regardless of build options; only init 0 (linked to systemd) does not. – u1686_grawity Dec 13 '17 at 15:52

3 Answers3

6

For compatibility with SysV, […]
systemd 234
[…] -SYSVINIT […]

You've built systemd without the compatibility option, so the compatibility behaviour described in the manual is not going to be present.

JdeBP
  • 68,745
1

Well as far as I can see from your symlinks this is the issue.

If your init is a symlink to systemd then you need to see what systemd can get as an argument.

systemd [OPTIONS...]

Starts up and maintains the system or user services.

  -h --help                      Show this help
     --test                      Determine startup sequence, dump it and exit
     --no-pager                  Do not pipe output into a pager
     --dump-configuration-items  Dump understood unit configuration items
     --unit=UNIT                 Set default unit
     --system                    Run a system instance, even if PID != 1
     --user                      Run a user instance
     --dump-core[=BOOL]          Dump core on crash
     --crash-vt=NR               Change to specified VT on crash
     --crash-reboot[=BOOL]       Reboot on crash
     --crash-shell[=BOOL]        Run shell on crash
     --confirm-spawn[=BOOL]      Ask for confirmation when spawning     processes
     --show-status[=BOOL]        Show status updates on the console during bootup
     --log-target=TARGET         Set log target (console, journal, kmsg, journal-or-kmsg, null)
     --log-level=LEVEL           Set log level (debug, info, notice, warning, err, crit, alert, emerg)
     --log-color[=BOOL]          Highlight important log messages
     --log-location[=BOOL]       Include code location in log messages
     --default-standard-output=  Set default standard output for services
     --default-standard-error=   Set default standard error output for services

So the thing is that you actually don't have the real init but just a linked systemd

Rui F Ribeiro
  • 56,709
  • 26
  • 150
  • 232
  • Thank you for the info! I get why it errors, but I don't get it doesn't pass to a real init since the man page says that it will execute telinit with all arguments passed unmodified? – prolificslacker Aug 30 '17 at 14:11
  • well a deeper look on your systems is the answer :) systemd can't do what you expect if you don't enable the -SYSVINIT flag on the compilation :) hope it helps – Christopher Díaz Riveros Aug 30 '17 at 14:18
0

There is an extra package "systemd-sysvcompat", and after that you can sysvinit 0 (and maybe telinit) - but then you need this inittab again, and the halt/shutdown/reboot of Slackware 14.2 (no systemd there) did not convince me.

This /usr/bin/sysvinit has the same size as the "old" init, and inside it reads: GCC: (GNU) 4.9.2, and miquels@cistron.nl (I know that name! he wrote sysvinit!). So this IS sysv-init. They just had to rename it. In the package it is called /usr/bin/init.

Alas, poor Init! getting pushed around like that!


re:6:once:/sbin/reboot 

This is from my inittab I use when I boot with init=/usr/bin/sysvinit. /sbin/reboot is a link to...systemctl! Well it works, but I am not saying go ahead...(not my invention, I found it like that installed by archlinux)