-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fully power off workstation after lid close #473
Conversation
There is in fact an easy way to disable the UI options as well, using |
Unfortunately there's no way to force a shutdown on lid close using xfce's power management settings, so we're back to the logind method. But we can hide the options we don't want. I'll make that part of a separate PR to tweak misc. XFCE settings, including the default icon size. We can land this PR if it looks good, marking as ready for review. |
Updated the clean-up test command step. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Testing production config
make clone
this branch into dom0- Ensure you have a valid
config.json
. Runscripts/configure-environment --environment prod
to switch it to production. (Note: That script currently messes up JSON formatting, make sure you have a copy if you care about that.) make prep-salt
to deploy salt config indom0
- Open a new
dom0
terminal and follow the logind logs withjournalctl -f -u systemd-logind
- In the original terminal, deploy the salt state added in this PR with
sudo qubesctl --show-output --targets dom0 state.sls sd-dom0-systemd
-
- Observe in the journal that
systemd-logind
was restarted
- Observe in the journal that
-
- Observe that
/etc/systemd/logind.conf
now contains theHandleLidSwitch=poweroff
directive.
- Observe that
- Detach any external displays.
-
- Close the laptop lid and observe that the system is ultimately powered off (this can take up to a minute or so).
- Reboot (sorry!).
Testing cleanup
- Follow the logind logs again in a separate terminal.
- In a
dom0
terminal, runsudo qubesctl --show-output --targets dom0 state.sls sd-clean-all
to undo the changes from the previous run. (Note: This will remove other files indom0
and force you to re-runmake all
for a working environment.) -
- Observe in the journal that
systemd-logind
is restarted.
- Observe in the journal that
-
- Observe that
/etc/systemd/logind.conf
no longer contains the line in question.
- Observe that
- Close your laptop lid.
-
- Observe that the system is again suspended, if that was your previous configuration.
Testing that change has no impact in dev env
- Set your
config.json
todev
using the same method as before. - Re-deploy it with
make prep-salt
. - Re-run the salt state
sd-dom0-systemd
as before. -
- Observe that
/etc/systemd/logind.conf
has not been modified andsystemd-logind
has not been restarted.
- Observe that
Everything worked as excepted. Approving.
Description
In production or staging environment, fully powers off the workstation instead of merely suspending to disk if the laptop lid is closed, in order to protect full-disk encryption key.
Status
Ready for review. Towards #178, but does not resolve as "suspend" is still an option in the logout menu.
Test plan
Since we've not issued a new prod release yet, I suggest testing this PR by running the Salt state on its own.
Testing production config
make clone
this branch into dom0config.json
. Runscripts/configure-environment --environment prod
to switch it to production. (Note: That script currently messes up JSON formatting, make sure you have a copy if you care about that.)make prep-salt
to deploy salt config indom0
dom0
terminal and follow the logind logs withjournalctl -f -u systemd-logind
sudo qubesctl --show-output --targets dom0 state.sls sd-dom0-systemd
systemd-logind
was restarted/etc/systemd/logind.conf
now contains theHandleLidSwitch=poweroff
directive.Testing cleanup
dom0
terminal, runsudo qubesctl --show-output --targets dom0 state.sls sd-clean-all
to undo the changes from the previous run. (Note: This will remove other files indom0
and force you to re-runmake all
for a working environment.)systemd-logind
is restarted./etc/systemd/logind.conf
no longer contains the line in question.Testing that change has no impact in dev env
config.json
todev
using the same method as before.make prep-salt
.sd-dom0-systemd
as before./etc/systemd/logind.conf
has not been modified andsystemd-logind
has not been restarted.Checklist
make flake8
) passesmake test
not re-run yet