If you have experienced problems with graphical screen lockers where either (a) the screen locker flashes the contents of your desktop briefly after resume from suspend or (b) the screenlocker fails altogether, I have found something more reliable. Namely, one may disable their current screen locker and use physlock in combination with xautolock and two systemd services. Further, since physlock drops you to a virtual console and then locks from there, this provides a more secure method of locking one's screen, as
screen lockers on X11 cannot be secure (I don't understand the author's worry about a fake screen locker prompt--you're owned anyway at that point, but there are other important points. Software need not be malicious to prevent your screen locker from starting. Also, besides this blog post there has been a history of exploiting X11 screen lockers, e.g., one was not too long ago shown
using a special key combo). If you want, you can read my
relevant bug report and some additional info. regarding the problem with the default Qubes screen lockers. Without further ado, I'll provide a walk-through on how to set this up for yourself.
First, open up a terminal in a networked DispVM. We'll be moving code (after cryptographically verifying it's integrity) into dom0, so we want to ensure we are working in an uncompromised domU.
$ echo gnome-terminal | /usr/lib/qubes/qfile-daemon-dvm qubes.VMShell dom0 DEFAULT red
We clone the repository we want with
Next, we will check the git tags. It is possible to sign git tags, however, if you run `git log --show-signatures` you will see that our author has only signed their tagged releases. When in the physlock directory we may call git tag to get a list of the release versions.
$ cd physlock
$ git tag
At the time of writing, the latest tagged version is v0.4.5. In order to verify it, we must first download the developer's signing key. It has RSA key ID 2F2C3DB4.
$ gpg --recv-key 2F2C3DB4
$ git tag -v v0.4.5
If the signature is good, we can either (a) checkout this branch or (b) manually review the commits (3 tiny ones at time of writing) since v0.4.5 and decide whether to trust them.
(a) $ git checkout v0.4.5
(b) $ git diff v0.4.5
We're going to use tar to make this into an archive, for ease of copy to dom0, but while we're at it we can save some time by adding in the systemd files we would like to use. I've uploaded them to Github for your convenience. No signature, so read over the unit files yourself. An explanation of these units can be found in my bug report (linked above).
$ cd ..
$ tar -cf physlock.tar.gz physlock
Now
move the tar.gz archive into dom0. I placed it in my ~/bin folder in dom0. At this point you may close the DispVM terminal and we proceed from the dom0 terminal. First, let's install tar, gcc, make, and xautolock. I think this is everything you need to extract the archive, compile the source, and get everything running.
$ sudo qubes-dom0-update gcc make xautolock
Now extract the archive and get qubes-misc out of there.
$ tar -xf physlock.tar.gz
$ mv physlock/qubes-misc .
We can now make and install physlock
$ cd physlock
$ make
$ sudo make install
Now that physlock is installed we copy our systemd unit files to where they need to be
$ cd ../qubes-misc
$ sudo cp physlock.service /etc/systemd/system/sleep.target.wants/
$ sudo cp xautolock.service /etc/systemd/system/graphical.target.wants/
We can now enable our systemd services and then start them immediately.
$ sudo systemctl enable physlock.service
$ sudo systemctl enable xautolock.service
$ sudo systemctl start physlock.service
$ sudo systemctl start xautolock.service
You can now disable your other screenlocker. You may lastly wish to map the command `/usr/bin/xautolock -locknow` to a key combination. I chose Ctrl-Alt-L to override the default for activating KDE's screenlocker.