Discussion:
Bug#983002: plocate: updatedb fails with "/var/lib/plocate/: Operation not supported"
(too old to reply)
Daniel Lewart
2021-02-18 05:00:01 UTC
Permalink
Package: plocate
Version: 1.1.3-1 and 1.1.4-1
Severity: important

Steinar,

updatedb fails with:
/var/lib/plocate/: Operation not supported

However, writing to a database in a different directory works fine.

Please see the transcript below.

Thank you!
Daniel Lewart
Urbana, Illinois
---
$ uname -a
Linux debian 5.10.0-3-amd64 #1 SMP Debian 5.10.13-1 (2021-02-06) x86_64 GNU/Linux

$ sudo updatedb
/var/lib/plocate/: Operation not supported

$ sudo updatedb -o /tmp/plocate.db

$ ls -l /tmp/plocate.db
-rw-r----- 1 root plocate 4590032 Feb 17 21:00 /tmp/plocate.db

$ sudo mv /tmp/plocate.db /var/lib/plocate/

$ locate plocate
/etc/cron.daily/plocate
/etc/systemd/system/timers.target.wants/plocate-updatedb.timer
/usr/bin/plocate
...
Steinar H. Gunderson
2021-02-18 08:10:01 UTC
Permalink
Post by Daniel Lewart
/var/lib/plocate/: Operation not supported
However, writing to a database in a different directory works fine.
Hi,

Thanks for the bug report. Is there anything special about your
/var/lib/plocate? Unusual filesystems? SELinux permissions?

I assume this is the O_TMPFILE call somehow, but it would be nice if you
could verify by doing

sudo strace updatedb

and seeing which call is the failing one.

/* Steinar */
--
Homepage: https://www.sesse.net/
Daniel Lewart
2021-02-19 07:30:01 UTC
Permalink
Steinar,
Post by Steinar H. Gunderson
Thanks for the bug report. Is there anything special about your
/var/lib/plocate? Unusual filesystems? SELinux permissions?
Yes, it is a Debian Live image, so it is an Overlay filesystem
(debian-live-testing-amd64-standard.iso).
Post by Steinar H. Gunderson
I assume this is the O_TMPFILE call somehow, but it would be nice
if you could verify by doing
sudo strace updatedb
and seeing which call is the failing one.
Correct. Below is the tail of the output.

Thank you!
Daniel Lewart
Urbana, Illinois
---
umask(027) = 022
openat(AT_FDCWD, "/var/lib/plocate/", O_WRONLY|O_TMPFILE, 0640) = -1
EOPNOTSUPP (Operation not supported)
dup(2) = 4
fcntl(4, F_GETFL) = 0x2 (flags O_RDWR)
fstat(4, {st_mode=S_IFCHR|0620, st_rdev=makedev(0x88, 0x1), ...}) = 0
write(4, "/var/lib/plocate/: Operation not"..., 43/var/lib/plocate/:
Operation not supported
) = 43
close(4) = 0
exit_group(1) = ?
+++ exited with 1 +++
Steinar H. Gunderson
2021-02-19 08:10:01 UTC
Permalink
retitle 983002 plocate: does not work with /var on overlayfs
severity 983002 normal
thanks
Post by Daniel Lewart
Post by Steinar H. Gunderson
Thanks for the bug report. Is there anything special about your
/var/lib/plocate? Unusual filesystems? SELinux permissions?
Yes, it is a Debian Live image, so it is an Overlay filesystem
(debian-live-testing-amd64-standard.iso).
Aha. So overlayfs simply does not support O_TMPFILE? I have a workaround for
FreeBSD that can probably be reused, but it has the usual concerns of not
going away if the process is forcibly interrupted.

/* Steinar */
--
Homepage: https://www.sesse.net/
Steinar H. Gunderson
2021-02-19 18:20:02 UTC
Permalink
Post by Steinar H. Gunderson
Aha. So overlayfs simply does not support O_TMPFILE? I have a workaround for
FreeBSD that can probably be reused, but it has the usual concerns of not
going away if the process is forcibly interrupted.
Are you in a position to try latest git?

/* Steinar */
--
Homepage: https://www.sesse.net/
Daniel Lewart
2021-02-20 07:50:01 UTC
Permalink
This post might be inappropriate. Click to display it.
Daniel Lewart
2021-02-20 07:10:02 UTC
Permalink
Steinar,
Post by Steinar H. Gunderson
Aha. So overlayfs simply does not support O_TMPFILE?
I have a workaround for FreeBSD that can probably
be reused, but it has the usual concerns of not
going away if the process is forcibly interrupted.
openat(2):
https://manpages.debian.org/testing/manpages-dev/openat.2.en.html
says:
"O_TMPFILE requires support by the underlying filesystem; only a
subset of Linux filesystems provide that support. In the initial
implementation, support was provided in the ext2, ext3, ext4, UDF,
Minix, and shmem filesystems. Support for other filesystems has
subsequently been added as follows: XFS (Linux 3.15); Btrfs (Linux
3.16); F2FS (Linux 3.16); and ubifs (Linux 4.9)"

Below is some more detail.
The lowerdir is squashfs and the upperdir and workdir are tmpfs.

Since writing to /tmp (tmpfs) works, I would expect that writing to
/var/lib/plocate would too, since upper/work dir are tmpfs.
Perhaps this is a bug in overlayfs?

Thank you!
Dan
Urbana, Illinois
---
$ df -hT /var/lib/plocate /tmp
Filesystem Type Size Used Avail Use% Mounted on
overlay overlay 2.0G 316M 1.7G 17% /
tmpfs tmpfs 2.0G 72K 2.0G 1% /tmp

$ findmnt -P /
TARGET="/" SOURCE="overlay" FSTYPE="overlay"
OPTIONS="rw,noatime,
lowerdir=/run/live/rootfs/filesystem.squashfs/,
upperdir=/run/live/overlay/rw,
workdir=/run/live/overlay/work"
###
Loading...