Emerg-shutdown not showing any messages at shutdown? (18.0.8.7 Feedback)

Installation Details


Version: 18.0.8.7 Feedback

Install medium: Sandisk USB (Baremetal no virtualization)

Partition format: ext4 (auto-formatted) + LUKS

BIOS: Coreboot


Hi everyone,

I’m a bit puzzled by the way emerg‑shutdown operates in both persistence and live modes when I’m using a USB thumb drive. I want to report that it does work in both modes for my installation. The question at hand is when I unplug the drive, the system simply powers off without displaying any on screen notification.

Is this the intended behavior? If not, could we consider adding a brief display message before the shutdown occurs?

Thanks for your help!

P.S. Very much pleased so far :slight_smile: good work!

1 Like

This is the intended behavior indeed.

Adding a display message (or any pause of any kind) would be a security hazard for the threat model emerg-shutdown is meant to defend against. Imagine you’re using Kicksecure from an external USB drive, and you’re using it to do something a physically proximate adversary doesn’t like. As you’re doing this work, the adversary suddenly breaks open the door to the room you’re in and starts walking toward you quickly. At this point one of your primary concerns is turning off the computer as quickly as possible so that all traces of what you were doing are erased. Every millisecond counts in this scenario, so emerg-shutdown is designed to power off the computer with all haste. It doesn’t make any attempt to save unsaved data, sync filesystems, warn the user of what’s going to happen, etc. it just* tells the kernel to cut power to the system as quickly as it can.

*well, almost; to work around kernel bugs that can result in a kernel panic during shutdown, emerg-shutdown switches to an unused TTY first. This is necessary to keep the system from hanging or rebooting instead of shutting down if you’re using Intel graphics, at least on some systems.

More about emerg-shutdown’s threat model, implementation, and usage is here:

1 Like

What are these service for? I haven’t find much information in the documentation:

  • emerg-shutdown.service
  • ensure-shutdown.service
  • ensure-shutdown-trigger.service

I have both of ensure disabled and I don’t know if they should be enabled…

This is the autostart service for the “immediately shutdown on boot drive removal or panic key press” code.

These are part of an optional feature that can be used to prevent a shutdown hang. It uses emerg-shutdown under the hood. The feature is implemented in a non-ideal way currently (it will actually increase shutdown time by default), so it’s disabled by default and will probably eventually be removed in favor of a better implementation. If you want to enable it anyway though, see:

I will keep them disabled so.

Another question regarding emergency shutdown and RAM.

If emergency shutdown doesn’t run ram-wipe to be able to power the device off as faster as possible. Won’t be better to reboot rather than shutting down? With a clean reboot, though forced, the ram will be wiped naturally and the disk will be encrypted.

ram-wipe itself doesn’t really “run” anymore nowadays, instead kernel configuration is used so that RAM is wiped automatically on an as-possible basis. A normal shutdown probably will indeed result in more RAM contents being wiped, but this is mainly useful when the attacker isn’t physically close nearby while the system is fully powered on. If there is a significant chance of an attacker reaching the system before it is fully powered off, there is potentially quite a bit more recoverable data than if they reach the system after it is fully powered off but before RAM decay has fully taken effect (depending on what software, if any, decides to hang during shutdown).

1 Like

If a service stuck the shutdown, how is the process to terminate it?

As I understand for the configuration file, systemd timeout will try to terminate the process before the emerg-shutdown timeout arrive, right? That would run a normal (non forced) shutdown that would completely clean the RAM.

I don’t know exactly the seconds RAM decay take after powering off, but if you force a reboot it will clear the RAM automatically. We dodge the risk of a RAM dump after a power off.

## Enabling ensure-shutdown.service will cause shutdown to always
## take at least as long as systemd's DefaultTimeoutStopSec (which by default
## is 90 seconds). If you are going to enable ensure-shutdown.service, it is
## highly recommended to set DefaultTimeoutStopSec to a much smaller value,
## such as 5 seconds. The maximum shutdown time set here should be at least 10
## seconds *longer* than DefaultTimeoutStopSec, to give normal shutdown a
## chance to actually succeed before forcibly shutting down the system.
ENSURE_SHUTDOWN_TIMEOUT=30

systemd tries to make sure everything it tracks is killed before issuing a reboot syscall. If a process is stuck in a kernel thread and won’t respond to even SIGKILL, it will simply hang forever waiting for it to respond. emerg-shutdown on the other hand just issues a reboot syscall when it decides the system should be shut down, triggering the kernel to cut power to the device regardless of what may or may not be hung.

Yes. Reducing the DefaultTimeoutStopSec will make systemd resort to force-killing everything during shutdown sooner than it would otherwise. If it manages to do that and get to issuing a reboot syscall before emerg-shutdown gets there, the kernel settings will wipe the RAM of killed processes during shutdown.

1 Like

It may be good to be documented in the docs, I tried but I think I have no permissions to modify that page.

As the options available security-misc/usr/src/security-misc/emerg-shutdown.c#security-misc-shared at 9535bf8e9c37bb65d1b4cabb39b7f6bc5ee9f29f · Kicksecure/security-misc · GitHub

Anyway, after reviewing the thread and the documentation I think I confused the use case of the variable ENSURE_SHUTDOWN_TIMEOUT=30 available in the configuration file /etc/security-misc/emerg-shutdown/30_security_misc.conf. Ensure shutdown will just trigger the kernel to cut the power without waiting any service to be closed, similar to unplug the computer from the grid, this is what I have understood from the documentation.

That’s correct. I can update the docs to be a bit more clear on that.

1 Like

Perfect, thanks