• intrigeri's avatar
    Mount a dedicated tmpfs on /run/initramfs instead of trying to remount /run... · 290620df
    intrigeri authored
    Mount a dedicated tmpfs on /run/initramfs instead of trying to remount /run with the "exec" option (refs: #16097).
    My previous approach, i.e. "let's remount /run with the exec option via a unit
    file started as part of the shutdown procedure", worked just fine for clean
    shutdown. But it does not work for emergency shutdown, i.e. when the boot medium
    is physically removed: for some reason (possibly missing bits in the memlockd
    configuration), this service is not started, and then systemd-shutdown won't
    return to the initramfs because /run/initramfs/shutdown is not executable.
    So let's instead disregard /run and extract the initramfs into a dedicated
    tmpfs, that we mount on /run/initramfs (where systemd-shutdown will look for
    it), and that we mount without the "noexec" option.
    Also, remove manual calls to eject(1):
     - They increase chances that the shutdown process breaks due to missing
       files locked in memory by memlockd.
     - Their sole benefit is to ensure we physically eject the DVD. It's unclear if
       this code is still needed nowadays. Regardless, starting with Tails 3.12, the
       only supported use case for ISO and DVD is virtual machines, which are not
       targeted by the emergency shutdown feature, which is about removing the
       *physical* boot medium.