I'm trying to understand bind-dirs

Being able to make directories/files persistent is an extremely useful feature and I’m trying to understand it. I have read How to make any file persistent (bind-dirs) | Qubes OS several times but there I things I still don’t get.

The example given with /var/lib/tor is easy enough to understand, but then the article mentions other configuration folders:

/usr/lib/qubes-bind-dirs.d (lowest priority, for packages)
/etc/qubes-bind-dirs.d (intermediate priority, for template wide configuration)
/rw/config/qubes-bind-dirs.d (highest priority, for per VM configuration)

What are these and how do they differ from /rw/config/qubes-bind-dirs.d?

I’ve also read Running Bisq on Qubes - Bisq Wiki since it gives detailed instructions on how to install a .deb package in an appVM (which I’m trying to do but with a different package) and I’ve noticed that the instructions are a bit different than in the Qubes docs.

For example, it mentions creating binding dirs before editing the /rw/config/qubes-bind-dirs.d/50_user.conf file?

The different folders allow you to specify bind-dirs in different places

  • in the template or in individual qubes.
    The “priority” stated means which configuration will actually work.

For example if you have a specification in the template at
/etc/qubes-bind-dirs.d, then this will be used by all qubes using that
template.
If you have a specification in one of those qubes at
/rw/config/qubes-bind-dirs.d, then that specification will be used,
over-riding that from the template.

When you create a specification in /rw/config/qubes-bind-dirs.d , the
files and folders in /rw/bind-dirs are created after a reboot.
You can create those files and folders before reboot if you wish - this
allows you to make any changes you want so that they will be applied on
the next reboot. (Rather than rebooting, and then making changes.)
This is covered in the page you referred to.

The Bisq instructions are wrong - there is no need to create folders and
reboot.

2 Likes

Thanks a lot!

I now understand the difference between using bind-dirs in an appVM v a templateVM, but in what situation would you want to use it to only bind a package?

If you simply want to install an application in an appVM and have it persist across reboots, is it best to use /usr/lib/qubes-bind-dirs.d or /rw/config/qubes-bind-dirs.d ?

I’ve tried creating /usr/lib/qubes-bind-dirs.d/50_user.conf and adding
binds+=( ' /opt/bisq'), rebooting and installing bisq and rebooting again but that doesn’t seem to make the bisq install persistent.

On a related note, what is the best way to find out which directories I need to bind when I want to install a program in an appVM and have it persist across reboots? On Linux apps seem to install in different locations.

You can examine packages for install locations, for example dpkg --contents package.deb.

1 Like

Thanks! Is there a similar command for already installed applications?

For ,deb, there is dpkg -L <package>.

I’m trying to install a package whirlpool-gui and if I run dpkg --content whirlpool-gui or dpkg -L whirlpool-gui (after install) I only get

/opt/whirlpool-gui/*
/usr/share/doc/whirlpool-gui
/usr/share/applications/whirlpool-gui
user/share/icons/hicolor/*

However, if I type which whirlpool-gui I get: /usr/bin/whirlpool-gui

Why doesn’t /usr/bin/whirlpool-gui show when running dpkg -L or dpkg --content?

I’ve added:

binds+=( ‘/opt/whirlpool-gui’ )
binds+=( ‘/usr/share/doc/whirlpool-gui’ )
binds+=( ‘/usr/share/applications/whirlpool-gui.desktop’ )
binds+=( ‘/usr/bin/whirlpool-gui’ )

to /rw/config/qubes-bind-dirs.d/50_user.conf but the whirlpool-gui is not persistent across appVM reboots…

I think the installer creates /usr/bin/whirlpool-gui, which is just a symlink to /opt/whirlpool-gui/whirlpool-gui.

You can create the symlink in /rw/config/rc.local.

By the way, it looks like whirlpool-gui has an AppImage, so you can just run that, no bind-dirs needed.

I haven’t gotten around to symlinks yet. I could use the AppImage, but then I wouldn’t learn bind-dirs :grinning: and since I plan to use Qubes as my only OS from now on I really need to learn this.

I don’t understand what I’m doing wrong… aren’t my binds correct?

You can try this:

/rw/config/rc.local:
ln -s /opt/whirlpool-gui/whirlpool-gui /usr/bin/

/rw/config/qubes-bind-dirs.d/50_user.conf:
binds+=( '/opt' )

1 Like

That… actually worked. I’ll try to understand what you did here.

binds+=( ’ /opt’ ) makes the whole /opt directory persistent, correct?

but what does the symlink do?

Apparently the package installer creates that symlink, so we do the same. A symlink is simpler than bind-mounting it.

IIRC only directories that already exist in a template can be made bind-dir. /opt/whirlpool-gui/ doesn’t exist in the template, but an empty /opt does exists in the template, that’s why I used that.

Now that I know that I cannot bind directories that don’t already exist in the relevant template things make a lot more sense. I created a new appVM and followed the steps detailed here: Running Bisq on Qubes - Bisq Wiki but for whirlpool-gui instead of Bisq.

@unman was correct that you don’t need to create the folders - if they already exist in the template. If they don’t the first have to be created in /rw/bind-dirs, so the guide for Bisq was in fact correct.

By first creating all the necessary files and folders in /rw/bind-dirs and then editing 50_user.conf
I managed to make the whirlpool-gui install persistent. Only thing that is not working is running it with whirlpool-gui, I have to go to /opt/whirlpool-gui and run with ./whirlpool-gui

I’m glad you got the program installed - you didn’t do it by following the Bisq
instructions.
You misunderstood my criticism.

The Bisq instructions say:

  1. Create directories in /rw/bind-dirs/ and restart.
  2. Set up bind-dirs and install Bisq

The problem with this is that on a reboot after step 2, the qube will
boot with an empty /opt/bisq
This is because /opt is stored in the template, and will be provided
fresh at each boot. Since there is nothing in /rw/bind-dirs/opt/bisq,
even though bind-dirs have been configured, nothing will appear in
/opt/bisq in the qube.

The instructions should say:

  1. Create folders, set up bind-dirs, and restart.
  2. Install Bisq.

I doubt that those instructions were tested at all.

1 Like

I see, sorry I misunderstood your post. You’re right, I didn’t follow Bisq’ instructions I did it the way you described. It’s quicker and makes more sense than what Bisq suggests.

I see, sorry I misunderstood your post. You’re right, I didn’t follow Bisq’ instructions I did it the way you described. It’s quicker and makes more sense than what Bisq suggests.

I guess someone should tell Bisq

I’ll see if I can contact them

Were you successful getting persistence to work? I remember I got it to work at one time but it hasn’t worked subsequently.

I tried installing Zulu java in an AppVM like this:
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 0xB1998361219BD9C9
sudo apt-get install software-properties-common
sudo apt-add-repository ‘deb http://repos.azulsystems.com/ubuntu stable main’
sudo apt-get update
sudo apt-get install zulu-11

I found two deb files that shows the following installation directories. Then I created my 50_user.conf like this:
/rw/config/qubes-bind-dirs.d/50_user.conf
binds+=(’/usr/lib/jvm’)
binds+=(’/usr/share/zulu-repo’)

I also tried saving my .conf file in /usr/lib/qubes-bind-dirs.d but the .conf file itself did not persist.

As already said, that wont work.
You can’t install and then create the bind-dirs.
When you restart the source directories will be clean (coming from the
template) and then the binds will be implemented.
Set up the binds first, reboot, and then run the install.