Bug#788303: systemd: Hangs indefinitely on >90% of reboot attempts

Sascha Jung gnujahcsas at googlemail.com
Wed Jan 6 08:35:18 GMT 2016


I can confirm this behaviour on my system exactly as described.

Besides the message

swapoff: /dev/sdxx: swapoff failed: Cannot allocate memory

there are also these lines:

dev-sdxx.swap swap process exited, code=exited status=255
Unit dev-sdxx.swap entered failed state.

I also have set overcommit_memory=2 and in my case Commited_AS is
above MemTotal when the system is running. But when the system got
stuck during shutdown, I can see that this is not true anymore, i. e.
the processes which commited memory were stopped and Committed_AS is
well beyond MemTotal.
Manually doing a 'swapoff -a' on the debug shell allows the system to
continue with a proper shutdown or reboot.

I "fixed" it somehow by removing the swap partition from /etc/fstab,
creating an own systemd service for handling swap and adding a
dependency for the process which needs to commit some memory:

[Unit]
Description=swap on /dev/sdxx
Before=some.service

[Service]
User=root
Group=root
Type=oneshot
RemainAfterExit=yes

ExecStart=/sbin/swapon /dev/sdxx
ExecStop=/sbin/swapoff /dev/sdxx

[Install]
WantedBy=multi-user.target

I know that this is not a good solution, but it seems to work at least
for my configuration.




More information about the Pkg-systemd-maintainers mailing list