Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

running updatedb on the cli tries to write to /nix/store which is a read-only file system #24250

Closed
mwasilew2 opened this issue Mar 23, 2017 · 7 comments

Comments

@mwasilew2
Copy link

commented Mar 23, 2017

Issue description

updatedb tries to write to /nix/store which is a read-only file system:
/nix/store/95vfigaqdg8jg5bk961k1x06j86p5fh0-findutils-4.6.0/var/locatedb.n: Read-only file system

this path comes from updatedb shell script: /nix/store/95vfigaqdg8jg5bk961k1x06j86p5fh0-findutils-4.6.0/bin/updatedb
which was modified in nix (this line is different in the gnu sources):
186: ${LOCATE_DB=/nix/store/95vfigaqdg8jg5bk961k1x06j86p5fh0-findutils-4.6.0/var/locatedb}

Steps to reproduce

run as root or normal user in a login shell: updatedb

Technical details

  • System: VERSION="16.09.1836.067e66a (Flounder)"
  • Nix version: nix-env (Nix) 1.11.7
  • Nixpkgs version: "16.09.1836.067e66a"
@rlupton20

This comment has been minimized.

Copy link
Contributor

commented Mar 23, 2017

Reproduces on my system - taking a look.

locate is quite a basic tool, so it would be good to get this working. Looking to aid investigation.

@rlupton20

This comment has been minimized.

Copy link
Contributor

commented Mar 23, 2017

By the looks of it the derivations is doing a pretty standard build from a Makefile:

description = "GNU Find Utilities, the basic directory searching utilities of the GNU operating system";

I think what this probably means is all the paths are indiscriminately rewritten to $out (i.e. in the nix-store). Need to confirm that suspicion, but that also raises the question of what it should write to, because it'll depend on which user is using it.

@rlupton20

This comment has been minimized.

Copy link
Contributor

commented Mar 23, 2017

Yep:

in configure in the gnu sources

1985:localstatedir='${prefix}/var'

and locate/Makefile.am

4:LOCATE_DB = $(localstatedir)/locatedb

nix will rewrite prefix to a path in the nix store.

So that's the cause of the updatedb script looking like it does - now to decide what we ought to do with it. Not a heavy user of locate - looking around it looks like it would be sufficient for this to work as root, with normal users using the -o switch? Happy to be told otherwise 😄.

Also, this ought to work nicely when running alongside the systemd service which periodically updates the database, if it's running.

Current thought is to add this as a field to default.nix which defaults to /var/cache. This should work with the systemd service, and can be overridden in other systems if it doesn't play nice.

@rlupton20

This comment has been minimized.

Copy link
Contributor

commented Mar 25, 2017

This is fixed with this commit:

417dbaf#diff-8e7fcdc2b11daa4074e040076c6163cf

Can be made to work on 16.09 by pulling findutils from unstable.

Not quite sure why my search pulled up an old version, but that's another matter!

@rlupton20

This comment has been minimized.

Copy link
Contributor

commented Mar 25, 2017

Tested and working. Suggest can be closed.

@gleber

This comment has been minimized.

Copy link
Contributor

commented Dec 17, 2017

This seem to have been fixed. Works for me on 18.03.git.4e7deb7. Please close.

@baracoder

This comment has been minimized.

Copy link
Contributor

commented Apr 29, 2019

Ping: This can be closed

@Ekleog Ekleog closed this Jun 13, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.