When executing shutdown now
in a Debian terminal, you might encounter this sequence:
All processes ended within 2 seconds...done
INIT: Going single user
INIT: Sending processes the TERM signal
INIT: Sending processes the KILL signal
Give root password for maintenance(or...
This typically indicates one or more processes are refusing to terminate properly during shutdown. The system switches to single-user mode as a failsafe. Common culprits include:
- Network time protocol daemons (ntpd)
- Custom iptables rules
- Unresponsive hardware drivers
- Filesystem sync issues
To identify the problematic process, check system logs:
journalctl -b -1 | grep -i "fail\|error\|warn\|terminat"
dmesg | tail -n 50
cat /var/log/syslog | grep -i shutdown
If you suspect ntp/ntpdate conflicts, try these steps:
# Stop ntp services before shutdown
sudo systemctl stop ntp
sudo systemctl stop ntpdate
# Alternatively, modify the service file
sudo nano /lib/systemd/system/ntp.service
# Add under [Service]:
TimeoutStopSec=5
KillMode=process
For iptables-related shutdown hangs:
# Create a pre-shutdown flush script
sudo nano /etc/init.d/flush-iptables
#!/bin/sh
### BEGIN INIT INFO
# Provides: flush-iptables
# Required-Start:
# Required-Stop: $local_fs $network
# Default-Start:
# Default-Stop: 0 6
# Short-Description: Flush iptables before shutdown
### END INIT INFO
case "$1" in
stop)
iptables -F
iptables -X
iptables -t nat -F
iptables -t nat -X
;;
esac
exit 0
# Make executable and register
sudo chmod +x /etc/init.d/flush-iptables
sudo update-rc.d flush-iptables defaults
When regular shutdown fails, try these commands:
# Force immediate shutdown
sudo shutdown -h now
# Poweroff directly
sudo poweroff
# Emergency fallback
echo 1 > /proc/sys/kernel/sysrq
echo o > /proc/sysrq-trigger
Modify systemd shutdown behavior:
sudo nano /etc/systemd/system.conf
# Adjust these values:
DefaultTimeoutStartSec=10s
DefaultTimeoutStopSec=10s
After changes, reload systemd:
sudo systemctl daemon-reload
Verify the fix works by simulating shutdown:
sudo systemctl start emergency.target
# Check which services remain
systemctl list-units --state=failed
When executing shutdown now
in a terminal, the system should cleanly terminate all processes. The output you're seeing indicates an abnormal shutdown sequence:
All processes ended within 2 seconds...done
INIT: Going single user
INIT: Sending processes the TERM signal
INIT: Sending processes the KILL signal
Give root password for maintenance(or...
The root password prompt during shutdown typically appears when:
- A critical process fails to terminate properly
- Filesystem unmount operations hang
- Network services don't release resources
- Hardware drivers misbehave during power-off
Given you recently installed NTP services, we should investigate potential conflicts:
# Check running NTP processes before shutdown
ps aux | grep ntp
# Verify service shutdown behavior
systemctl status ntp.service
journalctl -u ntp.service --no-pager
Create a shutdown debug script (/usr/local/bin/shutdown-debug
):
#!/bin/bash
echo "Starting shutdown debug..."
exec > /var/log/shutdown-debug.log 2>&1
date
ps auxf
lsof
systemctl list-units --state=running
echo "Debug information captured"
Make it executable and trigger before shutdown:
chmod +x /usr/local/bin/shutdown-debug
shutdown -c "Debugging shutdown" /usr/local/bin/shutdown-debug
For NTP-related issues:
# Modify NTP service to ensure clean shutdown
sudo systemctl edit ntpd.service
[Service]
TimeoutStopSec=5
KillMode=process
ExecStop=/usr/sbin/ntpd -q -g -x -N
General systemd troubleshooting:
# Increase systemd shutdown timeout
sudo mkdir -p /etc/systemd/system.conf.d
echo -e "[Manager]\nDefaultTimeoutStopSec=10s" | sudo tee /etc/systemd/system.conf.d/timeout.conf
systemctl daemon-reload
For persistent cases, enable verbose shutdown logging:
# Edit kernel parameters
sudo sed -i 's/GRUB_CMDLINE_LINUX_DEFAULT="/&initcall_debug log_buf_len=16M /' /etc/default/grub
sudo update-grub
After reproducing the issue, check kernel logs with:
dmesg | grep -iE 'shutdown|terminat|hang|blocked'