TransWikia.com

Is there a way to change where systemd sends its output during shutdown?

Unix & Linux Asked on December 24, 2021

I want systemd to send shutdown messages to a TTY that is different from the one that was used during bootup. More specifically, if the system starts to shutdown, the system should send any messages to /dev/ttyS0.

Here’s what I tried so far:

  1. Get systemd to change where it sends it’s output: systemd itself accepts --default-standard-output/--default-standard-error but I’m unable to find a way to change these settings once systemd has started. systemctl daemon-rexec doesn’t accept new arguments for the new systemd instance.

  2. Changing the console by setting TIOCCONS on /dev/ttyS0 as described in this question: The syscall appears to be successful, but systemd continues to send output to tty1. I suspect this itctl command only redirects the output of the console rather than switch the console’s tty (see #3 and #4).

  3. Closing all virtual terminals other than S0 to somehow force systemd to switch to the serial terminal: This fails because deallocvt thinks that tty1 is the console (even after setting TIOCCONS on /dev/ttyS0). Stopping each virtual terminal’s systemd getty service didn’t seem to help either.

  4. Naively removing /dev/tty{1..} devices using rm, killing associated agetty processes, and ensuring that systemd getty services are stopped: Still didn’t work, perhaps systemd retains an open file descriptor for tty1.

All these attempts failed to stop systemd from using /dev/tty1 to output shutdown messages. As a last ditch effort, I’m considering gdb to edit systemd, but I’d rather avoid going down this route if at all posible.

Is there a way to change where systemd sends its output during shutdown?

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP