# man > finalrd(1)

---
type: CommandReference
command: finalrd
mode: man
section: 1
source: man-pages
---

## Quick Reference

- `systemctl enable --now finalrd.service` — Enable and start finalrd service
- `foo.finalrd setup` — Execute setup hook from rootfs
- `foo.finalrd halt|poweroff|reboot|kexec` — Execute shutdown hook from finalrd
- Hook directories: `/usr/share/finalrd/`, `/etc/finalrd/`, `/run/finalrd/`

## Name

`finalrd` — final runtime directory generator for shutdown

## Synopsis

`systemctl enable --now finalrd.service`

## Description

`finalrd` generates a shutdown directory `/run/initramfs` which `systemd-shutdown` pivots to during shutdown. This allows safe cleanup of rootfs and execution of arbitrary shutdown tasks (e.g., stopping RAID arrays, iscsi logout).

**Hook directories** (in order of execution):
- `/usr/share/finalrd/` — distribution hooks
- `/etc/finalrd/` — sysadmin hooks
- `/run/finalrd/` — transient hooks

**Hook interface**:
- Setup stage: hooks are executed from rootfs with argument `setup`. Environment variables `DESTDIR` and `DESTROOTDIR` point to the finalrd location (for use with `copy_exec` or `dracut-install`).
- Shutdown stage: hooks are executed from finalrd in parallel with argument `halt`, `poweroff`, `reboot`, or `kexec`.
- If identically named hooks exist in multiple directories, all are executed during setup, but only the last one is copied to finalrd and executed during shutdown.

**Hookless operation**: If `initramfs-tools` is not available (e.g., Ubuntu Core), hooks are not executed, but the shutdown directory is still created to allow a clean pivot.

## Examples

shell
# Setup hook (run from rootfs)
foo.finalrd setup

# Shutdown hooks (run from finalrd)
foo.finalrd halt
foo.finalrd poweroff
foo.finalrd reboot
foo.finalrd kexec
## See Also

[The initrd Interface of systemd](https://www.freedesktop.org/wiki/Software/systemd/InitrdInterface)