• intrigeri's avatar
    Return to the initramfs (unpacked in /run/initramfs) on shutdown (refs:... · 888ccc5a
    intrigeri authored
    Return to the initramfs (unpacked in /run/initramfs) on shutdown (refs: #12428, #12354, Debian#778849).
    
    … otherwise the aufs read-write (tmpfs) branch, among possibly other things,
    can't be properly unmounted and its content remains in memory.
    
    Notes:
    
     * We have to handle some unmounting ourselves in initramfs-pre-shutdown-hook:
       systemd-shutdown doesn't manage to unmount the aufs read-write
       branch (/oldroot/lib/live/mount/overlay) as it is needed by the
       aufs (/oldroot) filesystem, and reciprocally it cannot unmount /oldroot as it
       is kept busy by /oldroot/lib/live/mount/*. So we disentangle this mess
       ourselves. And we have to manually empty the aufs read-write (tmpfs) branch,
       otherwise for some reason its content remains in memory. This code will of
       course need to be adapted for overlayfs some day.
    
     * We lock /bin/kill in memory: apparently systemd-exit.service needs it.
    
     * We remount /run on shutdown *before* dropping caches, just in case dropping
       caches removes what we've loc...
    888ccc5a