You are not logged in.
What is the equivalent of:
NETWORK_PERSIST="yes"
for systemd?
For example, I am connecting from my laptop to my server via ssh. I want to restart the server from the ssh connection I just started. After I issue the `systemctl reboot` command, the shell I used to connect to the server hangs. I'd like it systemd to log me out gracefully.
# systemctl reboot
Broadcast message from facade@mars on pts/0 (Thu, 10 May 2012 11:59:24 -0400):
The system is going down for reboot NOW!
# Write failed: Broken pipe
Last edited by graysky (2012-05-12 13:34:53)
CPU-optimized Linux-ck packages @ Repo-ck • AUR packages • Zsh and other configs
Online
Maybe something is not right in your network's service?
Offline
Using static networking; template on wiki:
[Unit]
Description=Network Connectivity
Wants=network.target
Before=network.target
[Service]
Type=oneshot
RemainAfterExit=yes
EnvironmentFile=/etc/conf.d/network
ExecStart=/sbin/ip link set dev ${interface} up
ExecStart=/sbin/ip addr add ${address}/${netmask} broadcast ${broadcast} dev ${interface}
ExecStart=/sbin/ip route add default via ${gateway}
ExecStop=/sbin/ip addr flush dev ${interface}
ExecStop=/sbin/ip link set dev ${interface} down
[Install]
WantedBy=multi-user.target
CPU-optimized Linux-ck packages @ Repo-ck • AUR packages • Zsh and other configs
Online
Are you using sshd.service? I'm using sshd.socket/sshd@.service and it logs me out fine when I reboot.
also see the comment in the sshd.service file : https://github.com/falconindy/systemd-a … hd.service
Offline
You could try disabling systemd stopping this unit with DefaultDependencies=false. That way it won't conflict with shutdown.target, which is why the network is stopped as things stand now. You'll also want to make sure to cover the other half of what DefaultDependencies does for you now (making sure it doesn't try to start too early) by adding "Requires=systemd-journald.socket basic.target" and "After=systemd-journald.socket basic.target". (I did systemctl show network.service to see what these implicit dependencies actually were. You will also see the "Conflicts=shutdown.target" you want to disable in there.)
Another way would be to just remove the ExecStop lines, so that systemd wouldn't even know how to kill the network. But then, that would also prevent you from doing so manually, so this probably isn't that useful.
Offline
Are you using sshd.service? I'm using sshd.socket/sshd@.service and it logs me out fine when I reboot.
also see the comment in the sshd.service file : https://github.com/falconindy/systemd-a … hd.service
Yeah, I was using sshd.service and your suggestion to use sshd.socket seems to have solved the problem.
$ sudo systemctl reboot
Connection to mars closed by remote host.
Connection to mars closed.
Thanks again 65kid.
Last edited by graysky (2012-05-12 13:35:09)
CPU-optimized Linux-ck packages @ Repo-ck • AUR packages • Zsh and other configs
Online