“Debian 7: Resolving Missing shutdown Command After System Upgrade”


2 views

After performing a routine apt upgrade on my Debian 7 server, I encountered an unexpected issue - the shutdown command vanished completely. Neither the direct command nor its typical location at /sbin/shutdown was available. The same happened with the reboot command.

First, I checked where the command should be:

which shutdown
whereis shutdown
ls -l /sbin/shutdown

All returned empty or "not found". Checking installed packages revealed the issue:

dpkg -S /sbin/shutdown

The upgrade process had somehow removed or broken the sysvinit package, which contains these essential system commands. This can happen if dependencies aren't properly maintained during upgrades on older systems.

The solution was to reinstall the necessary packages:

apt-get install --reinstall sysvinit sysvinit-utils

For a more thorough fix, I also recommend:

apt-get install --reinstall coreutils util-linux

After installation, verify the commands exist:

ls -l /sbin/shutdown /sbin/reboot /sbin/halt
which shutdown

While fixing the main issue, these alternatives can be used:

# Using init directly
/sbin/init 0  # shutdown
/sbin/init 6  # reboot

# Using systemctl if available
systemctl poweroff
systemctl reboot

To avoid similar problems:

  • Always check apt-get upgrade output for removed packages
  • Consider using apt-get dist-upgrade for better dependency handling
  • Maintain regular backups of critical system configurations

If the system becomes unbootable after such issues, boot from a live CD and:

chroot /mnt
apt-get install --reinstall sysvinit
exit
reboot

After performing a routine apt-get upgrade on my Debian 7 server, I discovered that both shutdown and reboot commands were no longer available in the system path. Attempting to locate them directly in /sbin/ also failed:


$ which shutdown
$ /sbin/shutdown
bash: /sbin/shutdown: No such file or directory

The immediate suspicion falls on the sysvinit package which provides these essential system commands. Running the following verification command reveals the problem:


$ dpkg -S /sbin/shutdown
dpkg-query: no path found matching pattern /sbin/shutdown

To resolve this, we need to reinstall the core package containing these utilities. For Debian 7 (Wheezy), the complete solution involves:


# First, ensure the package database is updated
apt-get update

# Reinstall the sysvinit package
apt-get install --reinstall sysvinit

# Verify the installation
dpkg -L sysvinit | grep -E 'shutdown|reboot|halt'

While waiting for the package reinstallation, you can use these workarounds:


# Using the init command
/sbin/init 0  # shutdown
/sbin/init 6  # reboot

# Using telinit
telinit 6

# Using systemctl if available
systemctl poweroff
systemctl reboot

To avoid similar issues after upgrades:


# Always hold critical packages
apt-mark hold sysvinit

# Or use alternative init systems
apt-get install systemd-sysv

Remember that Debian 7 is quite old (released in 2013) and reached end-of-life in 2018. Consider upgrading to a supported version like Debian 10 (Buster) or newer.