D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

[LUG] Help sought with SNAP Loop problem

 

I have Ubuntu 18.04.4 LTS but although I have been using Ubuntu for years, I am a novice because until last year I had a FOC IT manager who knows all things. Lets call him Tim.

Tim moved away, had a love interest now and doesn't seem to want to spend hours helping me out anymore! I need my system running properly since I run a charity from home.

This is a problem with scripts:

A crucial part of my setup is a virtual encrypted disk created by TrueCrypt, an open-source disk encryption program that creates real-time (on-the-fly) encrypted volumes. I mount the TC partition on a Samsung detachable drive (I need a detachable because I work on two PCs in different houses). Incidentally, after mounting it I have to run File Manager and find the TC partition. I don't do this with file manager first, the scripts can't find it.

There is however a problem that's stopping me mounting this TC partition on which all my working files are saved:

This is Tim's original script for mounting the TC partition on the Samsung detachable drive:

#!/bin/sh
# make the window hang around for a minute after finishing
trap "sleep 60" 0

if [ -L /dev/disk/by-uuid/9AF04AF8F04AD9E1 ]; then
   echo "Samsung disk connected, good"
   udisksctl mount --block-device /dev/disk/by-label/SAMSUNG
else
   echo "Can't find Samsung black disk, looking for volume ID 9AF04AF8F04AD9E1"
   exit 1
fi
if [ -f /media/adrian/SAMSUNG/adrian.tc ]; then
   echo "adrian.tc found under /media/adrian/SAMSUNG, good"
else
   echo "Can't find adrian.tc under /media/adrian/SAMSUNG"
   exit 1
fi
cd /media/adrian/SAMSUNG || exit 0

LSTAT=`sudo losetup /dev/loop0`
if echo "$LSTAT" | grep adrian.tc >/dev/null ; then
   echo "loop device is set up already"
else
   sudo losetup /dev/loop0 adrian.tc
   sudo tcplay --map=adrian.tc --device=/dev/loop0

fi

You will see that TC is set up as a loop device, Loop 0. This worked well a couple of years ago but since then other devices have appeared to steal the loops!

This is what I find more recently:

adrian@gandalf:~$ losetup
NAME       SIZELIMIT OFFSET AUTOCLEAR RO BACK-FILE                             DIO LOG-SEC
/dev/loop1         0      0         1  1 /var/lib/snapd/snaps/core_8689.snap     0     512
/dev/loop2         0      0         1  1 /var/lib/snapd/snaps/core18_1705.snap   0     512
/dev/loop0         0      0         1  1 /var/lib/snapd/snaps/core18_1668.snap   0     512
/dev/loop3         0      0         1  1 /var/lib/snapd/snaps/core_8592.snap     0     512
adrian@gandalf:

Snap is a new software installation method, which (I'm told) has advantages in terms of compatibility but mounts code as loops. As far as I can tell, these four items are canocial upgrades so legitimate BUT they have stolen Loop 0. They did not all happen at once but seem to be multiplying with every upgrade. I don't think there is anything to be done about them.

In response to these blockages, All I can do is to repeatedly modify Tim's script so as to advance the loop number so to carry on working; today I am mounting my TC partition as loop 4!

Thus:

adrian@gandalf:~$ losetup
NAME              SIZE   LIMIT OFFSET AUTOCLEAR RO BACK-FILE         DIO LOG-SEC
/dev/loop1              0      0         1  1 /var/lib/snapd/snaps/core_8935.snap      0     512
/dev/loop4              0      0         0  0 /media/adrian/SAMSUNG/adrian.tc         0     512
/dev/loop2              0      0         1  1 /var/lib/snapd/snaps/core_8689.snap      0     512
/dev/loop0              0      0         1  1 /var/lib/snapd/snaps/core18_1668.snap  0     512
/dev/loop3              0      0         1  1 /var/lib/snapd/snaps/core18_1705.snap  0     512
adrian@gandalf:~$

I should also like to use the auto-upgrage app but this also appears as a loop and I've had to delete it!

What I need is to be able to do is to modify Tim's script so that it finds the next free loop and mounts to that instead of a fixed one!

Any Ideas? quite willing to pay for a solution!

Adrian in Exmouth

-- 
Adrian Toole

31 Egremont Road, Exmouth, Devon EX8 1RX, England
07966 239464
-- 
The Mailing List for the Devon & Cornwall LUG
https://mailman.dcglug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/listfaq