Updatedb changes

So arch made a change today dropping an moving from mlocate to plocate.

mlocate            0.26.git.20170220-7       -0.34 MiB
extra/plocate                 1.1.22-3        0.49 MiB

Which is causing this error,
Failed to start updatedb.service: Unit updatedb.service not found.

Looking into it a bit. plocate has some changes to updatedb on their git git.sesse.net Git - plocate/summary

I cant say for sure its the cause but I think for users waiting on upstream to work on it is a option.

Note, the commands here

sudo systemctl enable --now plocate-updatedb.timer
The unit files have no installation config (WantedBy=, RequiredBy=, UpheldBy=,
Also=, or Alias= settings in the [Install] section, and DefaultInstance= for
template units). This means they are not meant to be enabled or disabled using systemctl.

Possible reasons for having these kinds of units are:
• A unit may be statically enabled by being symlinked from another unit's
.wants/, .requires/, or .upholds/ directory.
• A unit's purpose may be to act as a helper for some other unit which has
a requirement dependency on it.
• A unit may be started when needed via activation (socket, path, timer,
D-Bus, udev, scripted systemctl call, ...).
• In case of template units, the unit is meant to be enabled with some
instance name specified.
sudo systemctl enable --now updatedb.timer
Failed to enable unit: Unit updatedb.timer does not exist

Restoring old snapshots also wont solve this one.
This is more a heads up post then anything.

4 Likes

Yes, that’s right: mlocate is dead. Long live plocate! :crown:

plocate is a drop-in replacement for mlocate, except the service files are named differently. That is the cause of this error:

The new service file is called plocate-updatedb.service.

I just pushed through a commit for the garuda-update script to address this:

The new version is already in the repo (garuda-update 4.8.1-1); if you run the update again you should be able to pull it down if your mirror is up to date.

The only “gotcha” is our existing /etc/updatedb.conf file is being saved as a pacsave.

The new file it is being replaced with is exactly the same, except it is missing a consideration that was added for excluding snapshots when building the database used by plocate (formerly mlocate).

PRUNE_BIND_MOUNTS = "yes"
PRUNEFS = "9p afs anon_inodefs auto autofs bdev binfmt_misc cgroup cifs coda configfs cpuset cramfs debugfs devpts devtmpfs ecryptfs exofs ftpfs fuse fuse.encfs fuse.s3fs fuse.sshfs fusectl gfs gfs2 hugetlbfs inotifyfs iso9660 jffs2 lustre mqueue ncpfs nfs nfs4 nfsd pipefs proc ramfs rootfs rpc_pipefs securityfs selinuxfs sfs shfs smbfs sockfs sshfs sysfs tmpfs ubifs udf usbfs vboxsf"
PRUNENAMES = ".git .hg .svn"
# Modified by Garuda Linux to exclude snapshots
PRUNEPATHS = "/afs /media /mnt /net /sfs /tmp /udev /var/cache /var/lib/pacman/local /var/lock /var/run /var/spool /var/tmp /.snapshots"

Aside from the commented line, the only difference between the two files is the addition of /.snapshots to the PRUNEPATHS line.

In this case, the pacsave (the original file) should be kept, overwriting the new version.

sudo mv /etc/updatedb.conf.pacsave /etc/updatedb.conf

@TNE @dr460nf1r3 maybe this last piece could be added as a hotfix.

11 Likes

Pinned for one week to increase topic visibility, since user intervention is required for restoring the pacsave file.

Perfect an yep update fixes it. I figured it wasn’t anything to big.

People should now be notified in case of updating their system. The reason for making this a notice is that we can’t be sure plocate already installed when our migrations package is running.

Edit: Ugh, just noticed a typo.
Edit 2: fixed up.

8 Likes

I just noticed plocate was not indexing my home folder.
Apparently PRUNE_BIND_MOUNTS should be “no” on btrfs, as answered here:

It’s working for me.

I believe that information is out of date. The Btrfs-specific note referenced in that discussion has since been completely removed from the updatedb.conf man page.

Additionally, in our case we are not mounting the filesystem root. By default the root directory is a Btrfs subvolume.

2 Likes

Then are you aware of another reason why plocate was not indexing home?

I took a closer look and I think you are right: the non-root subvolmes do not seem to be getting indexed unless you enable indexing bind mounts. This seems to be contrary to the documentation:

Note that Btrfs subvolume mounts […] may get skipped if you have also mounted the filesystem root itself.

In our case, the filesystem root is not mounted (root is a subvolume), so it would seem the subvolume mounts should not be skipped.

To counteract this, make your root directory a Btrfs subvolume, too.

Again, the root directory is a Btrfs subvolume…so we are already using the suggested workaround for this issue.

And yet, as you pointed out the non-root subvolumes don’t appear to be getting indexed.

❯ sudo updatedb

❯ sudo locate .config/fish
/etc/skel/.config/fish
/etc/skel/.config/fish/conf.d
/etc/skel/.config/fish/config.fish
/etc/skel/.config/fish/conf.d/done.fish

But if you enable indexing bind mounts, the other subvolumes show up.

❯ sudo updatedb --prune-bind-mounts 0

❯ sudo locate .config/fish
/etc/skel/.config/fish
/etc/skel/.config/fish/conf.d
/etc/skel/.config/fish/config.fish
/etc/skel/.config/fish/conf.d/done.fish
/home/jeremy/.config/fish
/home/jeremy/.config/fish/completions
/home/jeremy/.config/fish/conf.d
/home/jeremy/.config/fish/config.fish
/home/jeremy/.config/fish/fish_variables
/home/jeremy/.config/fish/functions
/home/jeremy/.config/fish/conf.d/done.fish
/root/.config/fish
/root/.config/fish/conf.d
/root/.config/fish/config.fish
/root/.config/fish/conf.d/done.fish

So: either the documentation isn’t accurate, or I am not understanding something about how this is supposed to work.

Either way, you are right @malkien: setting PRUNE_BIND_MOUNTS to “no” or “0” does work around this issue for anyone who wants their home subvolume (or other non-root subvolumes) indexed for using with plocate. Obviously users who have actual bind mounts in place may need to carefully consider if this is appropriate for their setup.

2 Likes