Create a luks container, then make a script that when the vm launches, a terminal window opens and prompts you for the password, then it mounts the container to a directory accessible to you.
The following script will configure everything for you (a 500Mb container will be created, if you want to change the size, edit the dd
command):
#!/bin/bash
filename="encrypted_container"
# Create luks container
dd if=/dev/urandom of=/home/user/$filename bs=1M count=500
sudo cryptsetup luksFormat /home/user/$filename
sudo cryptsetup open /home/user/$filename luks-$filename
sudo mkfs.ext4 /dev/mapper/luks-$filename
sudo cryptsetup close luks-$filename
# Create unlock script
cat << EOF > /home/user/unlock_container.sh
dir="/home/user/encrypted_dir"
mkdir -p \$dir
sudo xterm -e "while ! cryptsetup open $filename luks-$filename; do false; done"
sudo mount /dev/mapper/luks-$filename \$dir
sudo chown -R user \$dir
EOF
# Create autostart file
mkdir -p /home/user/.config/autostart
cat << EOF > /home/user/.config/autostart/unlock_container.desktop
[Desktop Entry]
Type=Application
Name=Unlock luks container
Exec=/home/user/unlock_container.sh
EOF
# Make everything executable
chmod +x /home/user/unlock_container.sh
chmod +x /home/user/.config/autostart/unlock_container.desktop
Just copy it into a file, and launch it.