Possible to run locate/mlocate in dom0 to index appvms?

I posted to the mailing list something similar to this awhile back and didnt get any hits so am going to re-ask but regarding a perhaps more trusted app locate, or as i understand it in fedora mlocate?

While I have tried to keep my data somewhat siloed in the appropriate appvms its not perfect, and I am one of those that has quite a few appvms and trying to remember or find the files in the ~/Documents/ of the appvm where its supposed to be or the ~/QubesIncomming of where they are sometimes has proven to be a huge challenge… hence if I was able to run locate to keep a database of the files and thier locations that would really really be helpful.’

It doesnt have to be locate, I was just assuming it was a vetted and safe(ish) program that i could install and run in dom0 w/o too much trouble.

I agree it would be useful to be able to use software like AngrySearch or FSearch in dom0 for indexing AppVMs, but at the first glance. I’m not sure if that would brake the isolation of dom0 from AppVMs?

Not sure, I was thinking that, assuming the software was trustworthy, and that it was used from within dom0, that the setup would be secure as dom0 has total access to all the appvms anyway. Regarding Fsearch, I was aware of that, angry search looks pretty cool but neither are in Fedora or Debian repos AFAIK and since I didnt get any responses to my previous post for recoll I thought I’d post but ask about locate/mlocate as those are in the repos so more trustworthy?

1 Like

I feel like this a good start for a requirement for a search-vm and a qubes-index-service.

ok, I wanted to revisit this and ask about a script I am trying to write, somewhat blindly as I literally can’t code (have cobbled this together from example snippets).

#!/bin/bash

# Find all images that end with "private"
images=$(find /dev/qybes_dom0/ -type f -name "*private")

# Loop over the images and mount them on /home/rob/Public, then run updatedb -vU on the mounted image
for image in $images; do
    mount $image /home/rob/Public
    updatedb -vU /home/rob/Public
done

the above seems to work, with the major caveat that it just writes the output to the same dir again and again which might be overwriting some things but also isnt useful in that I have no idea which VM each line is referring to.

so then i tried to have it make dirs using the file name… and well a few variations of this and none of them have worked :confused:

#!/bin/bash

# Find all images that end with "private"
images=$(find /dev/qybes_dom0/ -type f -name "*private")

# Find just the image names, minus the path
imagedir=$(ls -w 1 /dev/qubes_dom0 *private)

# Loop over the images and mount them on /home/rob/Public, then run updatedb -vU on the mounted image
for image in $images; do
    sudo mkdir /home/rob/Public/$imagedir
    sudo mount $image /home/rob/Public/$imagedir
    updatedb -vU /home/rob/Public/$imagedir
    sudo umount /home/rob/Public/$imagedir
done

Thoughts? help? Please

futurama-days-since-last-accident

1 Like

ok, so that is no bueno, any ideas on other, less perilous, ways to achieve automated indexing of appvms?

If it’s just as a memory aid, and it’s okay to replace filename characters beyond the printable ASCII range with _ for security reasons, maybe you could occasionally index your VMs like this:

mkdir -p ~/vm-file-listings
qvm-run </dev/null --pass-io --filter-escape-chars --no-colour-output -- VMNAME bash -c 'find ~' | head -c 100M > ~/vm-file-listings/VMNAME.txt

And then e.g. run a search query with grep -r inside that directory.

If you do need a larger range of filename characters (or you want to unambiguously deal with filenames that contain newlines) that would complicate doing this securely.

1 Like

yeah! That worked nicely!
There is ZERO chance I would have been able to come up with that so thank you soooo much!

@stumpi I suppose you meant to mark @rustybird’s post as the solution? I’ve fixed that, please feel free to correct if I was wrong!

oi! Yes, thank you.