Open chrisys opened 4 years ago
This is currently achieved using dbus and systemd inhibit locks. We are using handle-lid-switch
in block
mode which inhibits the low-level handling of the systemd hardware lid switch.
Inhibit() returns a single value, a file descriptor that encapsulates the lock. As soon as the file descriptor is closed (and all its duplicates) the lock is automatically released. If the client dies while the lock is taken the kernel automatically closes the file descriptor so that the lock is automatically released.
The current problem is the container creating the lock can die for e.g during an update and cause the lock to be released.
This should be resolved by setting RESIN_SUPERVISOR_UPDATE_STRATEGY
to hand-over
Tested on device running intel-nuc image
With the current implementation of
power-management
, there are cases where if a laptop is closed and that container stops (for reasons such as update), the device could fall into a sleep state.To quote @rahul-thakoor "if the power-management service dies, the lock for the file descriptor is released and the action is removed!"