You are not logged in.

#1 2018-02-28 18:39:59

From: Canada
Registered: 2010-12-14
Posts: 28

Need to shut down my laptop after a timeout in initramfs

I'm having a problem with my Surface Book where it's turning on at random in my bag. I have no idea what's causing this, but I'm trying to make it shut down after a timeout. To complicate matters, my disk is encrypted, so I need to do this in initramfs.

I copied the "timeout" program to initramfs and modified the "encrypt" hook to use it, and it works... except that the "poweroff" command doesn't work in initramfs. If I could just figure out an alternative command to shut down the system, this would work...

I suppose an alternative would be to set up a timeout in grub, if that's a feature.

Here's the code I put in the encrypt hook for timing out.

                echo "A password is required to access the ${cryptname} volume:"

                #try to get a password, timeout after 5 seconds
                timeout 5 cryptsetup open --type luks ${resolved} ${cryptname} ${cryptargs} ${CSQUIET}
                if [ $? -ne 0 ]; then
                    err "Timeout waiting for password."
                    return 1


Board footer

Powered by FluxBB