• I’m using a laptop as a server
  • I usually close my laptop and connect with SSH and VNC to operate it.

In this situation, if you restart from SSH, it will not restart at all, but if you open the lid, it will restart properly.

solution

First, execute the following to open the configuration file with nano
sudo nano /etc/systemd/logind.conf

Next, HandleLidSwitchremove the #
HandleLidSwitch=ignoreattached, set the comment out to uncommented , and press Ctrl + X to save and exit.

Finally, sudo systemctl restart systemd-logind.servicerun it and restart the service and you’re done.