Allow virsh as a normal user on Debian Jessie

Debian Jessie has migrated libvirt to use polkit which means the normal advice of “add your user to libvirt and kvm groups” doesn’t work for virsh. There doesn’t seem to be any documentation about the change either. After a bit of head scratching and googling the following fixes the problem and allows members of the libvirt group to use virsh.

You need to create a local policykit access list, this example allows all members of the libvirt group to manage libvirt

[libvirt Management Access]

You also need to configure virsh to connect to libvirtd running on the local system by default, to do this add these lines to .bash_profile to add it to your bash shell environment.

if test -x $(which virsh); then
export LIBVIRT_DEFAULT_URI=qemu:///system

Mounting Android encrypted storage on the Galaxy S2

Because I like to understand how things work before they break, I wanted to be able to mount the encrypted storage of my Galaxy S2 phone from the ADB shell.

My understanding of the Android encryption system is that there is a metadata file stored in /efs at least for phones that have an efs partition. This metadata file contains the normal LUKS headers and encryption keys.

The following works for me in the ADB shell, it mounts the efs partition and then requests that vold unlocks the storage.

mkdir /efs
mount /dev/block/mmcblk0p1 /efs
setprop ro.crypto.state encrypted
vdc cryptfs checkpw 'your passphrase here'
mount -o ro /dev/block/dm-0 /data