#1153245 plocate database not generated in chroots

Package:
plocate
Source:
plocate
Description:
much faster locate
Submitter:
Benjamin Drung
Date:
2026-11-06 19:26:12 UTC
Severity:
normal
Tags:
#1153245#5
Date:
2026-11-06 17:40:26 UTC
From:
To:
Dear Maintainer,

When installing plocate in a container, the plocate database is not
generated.

In Ubuntu we have been carrying the attached patch to create the plocate
database in postinst since several years.

#1153245#10
Date:
2026-11-06 17:50:53 UTC
From:
To:
Hi,

Thanks for the patch. However, this means installing plocate can make apt
block further installation for unbounded amounts of time, even days on
certain systems, and I doubt that is acceptable.

/* Steinar */

#1153245#15
Date:
2026-11-06 18:41:47 UTC
From:
To:
I searched the bug reports and found
https://bugs.launchpad.net/ubuntu/+source/plocate/+bug/1968388

So blocking for the update is not a good idea. But how can we solve the
initial problem (installation in containers)? How about detecting if
running in a container and only then update the db in postinst?
containers are normally smaller than full desktop installations.

#1153245#20
Date:
2026-11-06 18:54:03 UTC
From:
To:
Can you elaborate what the problem is? Why does running background jobs not
work correctly in the container system you are using?

/* Steinar */

#1153245#25
Date:
2026-11-06 18:56:31 UTC
From:
To:
Some containers (e.g. schroot) do not have an init system running. So
the systemd service is never started.

#1153245#30
Date:
2026-11-06 19:04:09 UTC
From:
To:
This sounds like something that is outside what each individual package
should be dealing with? How do they deal with other packages that want
to run timers?

/* Steinar */

#1153245#35
Date:
2026-11-06 19:07:53 UTC
From:
To:
Also: How would you ever update the database if there are changes, if you
care about plocate inside the container -- why is it acceptable to run
updatedb once on postinst, and then never again? There's something about the
use case here that eludes me.

/* Steinar */

#1153245#40
Date:
2026-11-06 19:08:37 UTC
From:
To:
Timers are not run. Some other package update their DB in postinst or
work without a db, but plocate complains:

$ schroot -c unstable -u root
$ apt install -y plocate
$ plocate man
/var/lib/plocate/plocate.db: No such file or directory

#1153245#45
Date:
2026-11-06 19:11:06 UTC
From:
To:
the initial use case was.

For me: I have a schroot wrapper where I can specify what I want to have
installed. I often use this as throw-away environment. So a one-time
setup is good enough for me.

#1153245#50
Date:
2026-11-06 19:23:05 UTC
From:
To:
But this depends on when plocate was unpacked and configured relative to
other packages? Depending on completely uncontrollable factors, you could
have basically zero packages in your database, which then is never updated?

Shouldn't you just run updatedb explicitly after apt in your setup script,
in such a case?

/* Steinar */

#1153245#55
Date:
2026-11-06 19:25:10 UTC
From:
To:
That's a good point. So we would need an apt hook (that is run at the
end) instead of a postinst.

That would be an alternative.