Since Debian 10, the Debian Linux distribution uses systemd to control the starting and stopping of services, and Systemd also controls the whole boot and shutdown process of the operating system. The consequence of switching from init.d to Systemd is that some commands to stop or restart Debian, like 'shutdown -h now' or 'reboot' do not work anymore as they used to. In this short article, I'll show you how to stop and restart a Systemd-based Linux like Debian 11 or Debian 12.
Shutdown Debian 12
The command to shut down (power off) a Debian system now is:
Reboot Debian 12
If you want to reboot your Debian Server or Desktop, use this command:
Frequently Asked Questions
- How do I shut down Debian Linux using systemctl?
- To shut down your system, use the command
systemctl poweroff. This will safely power off your system.
- How can I schedule a shutdown using systemctl?
- The systemctl command does not directly support scheduled shutdowns. Instead, use the
sleepcommand in combination with systemctl. For example,
echo 'systemctl poweroff' | at now + 10 minutes.
- Is there a systemctl command to cancel a scheduled shutdown?
- Since systemctl doesn't schedule shutdowns, you would cancel it through the scheduling command (like
atrmfor 'at' jobs).
- How do I reboot my system using systemctl?
- To reboot your system, use
sudo systemctl reboot. This command will restart your system safely.
- Can I use systemctl to shut down or reboot remotely?
- Yes, you can use SSH to access your Debian system remotely and then use
systemctl rebootas needed.
- Is it safe to turn off the power directly without using systemctl?
- It's not recommended as it can lead to data loss or file system corruption. Always try to shut down gracefully using the systemctl command.
- How do I log out of my session without shutting down or rebooting?
- To log out without shutting down or rebooting, use the logout option in your desktop environment's main menu or the appropriate command in your display manager.