0

I'm having a problem with Truecrypt 7.1a-15 on Ubuntu 18.04.6.

I do not encounter the problem described below with Ubuntu 16.04.7.

I have written a small script which loads two truecrypt volumes, each encrypted with a keyfile and no password.

The script is copied below:

truecrypt -k /media/DATA/TESTKEY /media/DATA/TESTVOL1 /media/tc1

#sleep 5

truecrypt -k /media/DATA/TESTKEY /media/DATA/TESTVOL2 /media/tc2

The problem is that the script will only successfully mount the first volume but not the second. When I run the script from a terminal, I am prompted for a "user or administrator" password. Once I have entered the password the terminal shows the first volume mounted but hangs on the second.

If I run the Truecrypt GUI manager I can see that the first mount was indeed successful but the second volume although listed display's a blank under the "Mount Directory" column.

If I do nothing, after a minute or so I receive an Truecrypt error dialogue which says:

        "Failed to setup a loop device:"
        /media/DATA/TESTVOL2
            OK

And the second volume shown in the Truecrypt GUI disappears.

If I then use the GUI to "dismount all" so that no volumes are mounted and run the script again from the same or a new Terminal the script works as expected. I am asked for a password once and then both volumes are mounted. Thereafter I can dismount all and remount both volumes using the script without further issue. The problem only occurs the first time I run the script after booting. Which unfortunately is the time when I need to use the script.

It does not matter how long after booting the system I run the script. The problem only occurs the first time I run the script.

I gave both folders /media/tc1 and /media/tc2 full permissions for all users and groups. If I swap the two mount commands in the script, the first volume always mounts as expected but not the second. I tried a delay between the two commands in case the system needed extra time at startup for some reason, but no difference.

The problem only occurs the first time I run the script after a boot. A subsequent full dismount and then thereafter the script mounts both volums without problem?

I tried rebooting and only using the GUI first time. But its the same, the first volume loads but the GUI hangs when trying to load the second, again for a long time before failing.

Not sure how loop devices work exactly. I assume truecrypt issues a losetup -f before loading each volume. I tried checking by running ls -l /dev/loop* after booting, but before running my script and it listed 20 loop devices. Plus a loop-control whatever that is.

After the second mount had failed I checked the number of loop devices and it had gone up to 255! Could it be some mis-timing between truecrypt and losetup, whereby losetup creates a new loop device but truecrypt times out too quickly waiting for losetup? If so is there anything that can be done. But why only after the first mount was successful.

I also tried running the command as root, but although it did not ask for a password it still hung after the first mount and failed to mount the second volume.

I tried splitting the script into two seperate scripts each with a seperate call to truescript. But again it hung in the second script.

I created a script which had the second mount twice.

truecrypt -k /media/DATA/TESTKEY /media/DATA/TESTVOL1 /media/tc1

truecrypt -k /media/DATA/TESTKEY /media/DATA/TESTVOL2 /media/tc2

truecrypt -k /media/DATA/TESTKEY /media/DATA/TESTVOL2 /media/tc2

It worked but it necessitates waiting for the second mount to fail, which is over a minute. And requres clicking OK on the truecrypt error dialog box. So not ideal.

It seems after the intial boot, truecrypt needs a fail before it allows more mounts to occur?

I would really like to use Ubuntu 18.04.6 - the 64 bit version. But this is an issue.

Thanks for any help.

CMod
  • 1
  • You shouldn't be using Truecrypt. It has been abandoned many years ago and problems with new kernels and everything else are to be expected. – ChanganAuto Mar 08 '22 at 18:29
  • The developers of Truecrypt announced that it would no longer be maintained as of 2014. It is not secure which really defeats the purpose of using it. Veracrypt is a fork of Truecrypt that is still maintained. – Nmath Mar 08 '22 at 21:12

1 Answers1

0

Thanks for replies.

Agreed. Will try Veracrypt.

Only to add, I guess the reason why the problem only happens after boot, is that probably in my setup at boot there is one spare loop device. So the first map works. Then truecrypt "chases" losetup asking for more and more loop devices. Somehow not seeing the devices losetup provides. On all subsequent attempts there are loads of spare loop devices so the problem does not return. But why truecrypt and losetup don't communicate properly (if that is the problem) is a mystery.

Anyway moot points as will try Veracrypt as suggested.

CMod
  • 1