AA-TERMINATE(1)

NAME
aa-teminate - Tries to close/unmount everything it can

SYNOPSIS
aa-terminate [-D] [-l] [-a] [-q | -v]

OPTIONS

-a, --apis
    When done, unmount API file systems: /run, /sys, /proc and /dev If a regular umount call fails, a lazy umount will be performed.

-D, --double-output
    Enable double-output mode. Instead of using stdout for regular output, and stderr for warnings and errors, everything is sent both to stdout and stderr. This is intended to redirect stderr to a log file, so full output can be both shown on console and logged.

-h, --help
    Show help screen and exit.

-l, --lazy-umounts
    When nothing can be done anymore (see DESCRIPTION below) and there are still active mount points, run the loop again performing lazy unmounts: making the mount point unavailable for new accesses, and actually performing the unmount when the mount point ceases to be busy.

-q, --quiet
    Do not output anything (not even warnings of "left overs" when done; See --verbose for more).

-V, --version
    Show version information and exit.

-v, --verbose
    Out information about everything that is tried. By default it only outputs when something succeeds (and warnings of "left-overs" when done, listing anything that couldn't be closed/removed/unmounted). With this option, aa-terminate(1) will output about any operation it attempts, as well as an error message on failure. This is usually not important information and mostly useful for testing/debugging purposes.

DESCRIPTION
Ideally, when shutting down/rebooting the system, anything that was opened/mounted on boot (i.e. via aa-start(1) during stage 0/1) should be closed/unmounted automatically (i.e. via aa-stop(1) during stage 3/4), as defined on the relevant services.

However, things might not go as planned, for one reason or another (starting with, things might have been opened/mounted outside of any services).

aa-terminate(1) is aimed at closing/unmounting all that can be done at the end of e.g. stage 3/4, right before powering off/rebooting.

To do so, it will try to:

1. Turn all swaps off
2. Unmount everything but /, /dev, /proc, /sys and /run
3. Close all loop devices (/dev/loop*)
4. Remove all DM block devices (/dev/dm-*)

When done, if there are still things to do (i.e. certain operations failed) and at least one attempt was successful, it will try it all again, until either there's nothing left to do, or it can't do anything else.

If option --lazy-umounts was specified and there are still active mount points, it will try all over again, performing lazy umounts.

Then, if option --apis was specified it will umount API file systems: /run, /sys, /proc and /dev If a regular umount call fails, a lazy umount will be performed (regardless of whether option --lazy-umounts was used or not).

Finally, unless option --quiet was specified, warnings will be emitted for everything left (swaps, mount points, loop/block devices that couldn't be closed/unmounted/removed), if there is any.

NOTE
aa-terminate(1) requires /dev and /proc to be mounted. Specifically, it reads /proc/swaps to list active swaps and /proc/mounts for mount points; It also reads /dev for loop/block devices, and uses /dev/mapper/control to remove block devices.

RETURN VALUES
aa-terminate(1) returns 0 on success (no "left-overs"), 1 on syntax error (e.g. invalid option) and 2 if there is at least one left-over (excluding API file systems).

BUGS
They're probably crawling somewhere in there... if you happen to catch one, (or more) report it and I'll do my best to squash it.

REPOSITORY
You can find the latest source code of anopa as well as report bugs and/or suggest features on its GitHub repository, available at <https://github.com/jjk-jacky/anopa>; or visit its official website at <https://jjacky.com/anopa>

AUTHOR

Olivier Brunel <jjk@jjacky.com>