1

I created /etc/systemd/system/veracrypt-automount-devices.service:

[Unit]
Description=VeraCrypt auto-mount device-hosted volumes

[Service]
Type=forking
ExecStartPre=/bin/sleep 300
ExecStart=/usr/bin/veracrypt --auto-mount=devices /media/veracrypt1

[Install]
WantedBy=multi-user.target

Then I did:

sudo systemctl daemon-reload
sudo systemctl enable veracrypt-automount-devices
sudo systemctl status veracrypt-automount-devices

● veracrypt-automount-devices.service - VeraCrypt auto-mount device-hosted volumes
   Loaded: loaded (/etc/systemd/system/veracrypt-automount-devices.service; enabled; vendor preset: enabled)
   Active: failed (Result: timeout) since Sat 2020-06-06 17:28:59 CEST; 8min ago
  Process: 967 ExecStartPre=/bin/sleep 300 (code=killed, signal=TERM)

Jun 06 17:27:29 username-computername systemd[1]: Starting VeraCrypt auto-mount device-hosted volumes...

Jun 06 17:28:59 username-computername systemd[1]: veracrypt-automount-devices.service: Start-pre operation timed out. Terminating.

Jun 06 17:28:59 username-computername systemd[1]: veracrypt-automount-devices.service: Failed with result 'timeout'.

Jun 06 17:28:59 username-computername systemd[1]: Failed to start VeraCrypt auto-mount device-hosted volumes.

As you can see, it doesn't work. If I grep syslog, here is what I find:

Jun  6 16:56:08 username-computername systemd[1]: veracrypt-automount-devices.service: Control process exited, code=exited status=1
Jun  6 16:56:08 username-computername veracrypt[969]: Enter password:
Jun  6 16:56:08 username-computername systemd[1]: veracrypt-automount-devices.service: Failed with result 'exit-code'.
Jun  6 17:28:59 username-computername systemd[1]: veracrypt-automount-devices.service: Start-pre operation timed out. Terminating.
Jun  6 17:28:59 username-computername systemd[1]: veracrypt-automount-devices.service: Failed with result 'timeout'.

Basically, what I want is to be asked for the password to decrypt the device-hosted volume after I logged in with my username and password in Linux Mint.

Thomas
  • 422
  • 1
  • 4
  • 12
  • I am just curious... how does veracrypt know which volumes need to be mounted? Should there be a configuration file mentioned? – tswaehn Jun 06 '20 at 23:22
  • @tswaehn No, there isn't any configuration file. I'm not sure exactly how it works, if you go on their website they go into more details, but if I'm not mistaken they sort of scan all of the devices that are attached and look for a specific VeraCrypt header on the drive to see if it was encrypted with VeraCrypt. If it finds it, it will prompt you to enter your password to decrypt it. – Thomas Jun 07 '20 at 03:10
  • Could you try to execute the same command from command line to check if it’s generally working? – tswaehn Jun 07 '20 at 07:52
  • @tswaehn yes I did, it works. If you're curious, you can see the command line version of VeraCrypt for Linux by typing veracrypt -h in a terminal. – Thomas Jun 07 '20 at 08:07

1 Answers1

0

I found how to do it. I put the veracrypt command in ~/.profile to execute the program on login. See https://askubuntu.com/a/270050/787567.

Thomas
  • 422
  • 1
  • 4
  • 12