I don't understand the multi user mode

Hello I installed Nixos yesterday for my personal PC, using the official Calamares installer.

If I use nix commands such as ‘nix-shell’, or the new ‘nix search’ without sudo, I get:

error: opening lock file '/nix/store/(...)-nix-info.drv.lock': Read-only file system

The command sudo nix-shell -p nix-info --run "nix-info -m" returns:


 - system: `"x86_64-linux"`
 - host os: `Linux 5.15.64, NixOS, 22.05 (Quokka), 22.05.2889.67e45078141`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.11.0`
 - channels(drito): `"nixpkgs"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

If my install is set to multi user I suppose the nix daemon is expected to run so I checked the daemon.

sudo systemctl status nix-daemon


○ nix-daemon.service - Nix Daemon
     Loaded: loaded (/etc/systemd/system/nix-daemon.service; linked; vendor preset: enabled)
    Drop-In: /nix/store/l64lzk5ibcdgn8hfswn0q7ycwq822h63-system-units/nix-daemon.service.d
             └─overrides.conf
     Active: inactive (dead)
TriggeredBy: ● nix-daemon.socket
       Docs: man:nix-daemon
             https://nixos.org/manual

I tried to enable the nix-daemon.

sudo systemctl enable nix-daemon

But the answer was:

Failed to enable unit: File /etc/systemd/system/multi-user.target.wants/nix-daemon.service: Read-only file system

Notice that even sudo is not enough in this case.

During the install with Calamares I placed ‘/’ mount point on sda2 (previously owned by my broken arch based distro), and /home on my existing sda3. It is the only thing not default.

lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sda      8:0    0 465,8G  0 disk
├─sda1   8:1    0     2G  0 part
├─sda2   8:2    0  95,7G  0 part /nix/store
│                                /
└─sda3   8:3    0 368,1G  0 part /home
sr0     11:0    1  1024M  0 rom

The “mount” commands show me that about the partition owned by nixos.

/dev/sda2 on / type ext4 (rw,relatime)
/dev/sda2 on /nix/store type ext4 (ro,relatime)

How to restore a normal behaviour ?

Something looks very broken, what does journalctl -xe --unit nix-daemon.service give you?

The output is No entries

Oh, I misread. No, you don’t enable this daemon. It’s socket-activated, and on NixOS you don’t activate units using systemctl (because that’s imperative and not reproducible). enable will try to write a symlink to a file in /nix/store, which is read-only exactly so that that can’t happen (we don’t want to modify packages after they were built in NixOS land).

Try systemctl start nix-daemon, just in case, but really, the daemon should launch itself once you run nix because of the socket-activation, yet we get no logs for it. Something is quite broken.

Just in case it’s my bad again, how about sudo journalctl -xe --unit nix-daemon.service?

1 Like

I just reinstalled nixos. The configuration.nix make that fast an easy and I have a home in a separate partition.
Calamares fails 3 times with an not very meaningful message. The next attempt succeed.
Maybe I have to save money for a new HDD :roll_eyes:

It could just be a bug in the installer. It’s still quite new, but it’s a little hard to debug with no logs, heh.

Glad that it’s working now, at least. I doubt these errors are HDD failure related, shout if you run into them again, maybe share your configuration then too :slight_smile: