I have following script that performs an emergency shutdown that needs to take 1-2 seconds. (halt takes too long)

# Enable System Requests
sudo echo 1 > /proc/sys/kernel/sysrq
sudo echo s > /proc/sysrq-trigger
#emergency remount
sudo echo u > /proc/sysrq-trigger
sudo echo o > /proc/sysrq-trigger

During this emergency shutdown, I looked at tail -f /var/log/syslog and saw that the emergency sync as well as the emergency read-only remount was sucessful.

But after the system is turned on again, fsck reports a file system error (systemd status systemd-fsck-root.service shows the error "nodes that were part of a corrupted orphan linked list found").

What can I do to prevent that? I thought that the combination sync + remount is safe. I cannot explain why the file system is in an inconsistent state.

Update: Very weird is that if I repair the error (using boot parameter fsck.repair=yes), the folder /lost+found is empty and journalctl -u systemd-fsck* does not show that a repair was done:

[23:41]root@ras3:/daten/scripts$ journalctl --all -u systemd-fsck*
-- Logs begin at Thu 2016-11-03 18:16:43 CET, end at Sat 2019-07-06 23:45:20 CEST. --
Jul 06 23:03:10 ras3 systemd-fsck[139]: e2fsck 1.43.4 (31-Jan-2017)
Jul 06 23:03:10 ras3 systemd[1]: Started File System Check Daemon to report status.
Jul 07 01:17:01 ras3 systemd-fsck[143]: Durchgang 1: Inodes, Blöcke und Größen werden geprüft
Jul 07 01:17:26 ras3 systemd-fsck[143]: Durchgang 2: Verzeichnisstruktur wird geprüft
Jul 07 01:17:32 ras3 systemd-fsck[143]: Durchgang 3: Verzeichnisverknüpfungen werden geprüft
Jul 07 01:17:32 ras3 systemd-fsck[143]: Durchgang 4: Referenzzähler werden überprüft
Jul 07 01:17:33 ras3 systemd-fsck[143]: Durchgang 5: Zusammengefasste Gruppeninformation wird geprüft
Jul 06 23:03:43 ras3 systemd[1]: Started File System Check on Root Device.
Jul 06 23:03:44 ras3 systemd[1]: Starting File System Check on /dev/mmcblk0p1...
Jul 06 23:03:44 ras3 systemd-fsck[290]: fsck.fat 4.1 (2017-01-24)
Jul 06 23:03:44 ras3 systemd-fsck[290]: /dev/mmcblk0p1: 188 files, 45366/86467 clusters
Jul 06 23:03:44 ras3 systemd[1]: Started File System Check on /dev/mmcblk0p1.

The system is a Debian Stretch on an Raspberry Pi 3 B+.

  • Edit your question and show thr error. – Prvt_Yadav Jul 6 '19 at 21:42
  • I have edited the question and added the error message ("nodes that were part of a corrupted orphan linked list found") – Daniel Marschall Jul 6 '19 at 21:48
  • Thank you for the hint with "--all", I didn't knew that. The revealed blob data (I have updated my question) just shows the default status messages "step 1, 2, 3, 4", no errors. (In German e.g. "Durchgang 2: Verzeichnisstruktur wird geprüft"). I think it is BLOB data, because there are German umlauts (äöüß) in it. – Daniel Marschall Jul 7 '19 at 15:04
  • @DanielMarschall another side-note: that shouldn't happen if you use e.g. de_DE.utf8 locale. If possible, I invite you to join our glorious Unicode future :-). If you need to transcode existing filenames, I think you can use convmv -f iso-8859-1 -t utf8 ... – sourcejedi Jul 7 '19 at 17:36

I don't know why that happens. Here is an untested alternative. I hope this will also run in just a few seconds on your system.

# /etc/systemd/system/emergency-poweroff.service
# Immediately terminate all processes, and then power off.
# Usage: systemctl start emergency-poweroff

Description=Emergency Power-Off

# SIGKILL all the things
# - except the process itself, or we would not continue
ExecStart=/sbin/killall5 -9

# Wait for all processes to be cleaned up,
# then cleanly shutdown the filesystems and kernel.
ExecStart=/bin/systemctl poweroff --force

If you replace systemctl poweroff with systemctl halt, it might retain the log messages on-screen. That might be useful as a first test.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.