How do I do this? Tried building to latest stable and unstable. Both with the repository added. Both ran with sudo.
error: path ‘/nix/store/k19qimkv8m2ghxgmvigca4hsx255qyla-linux-6.12.30-modules-shrunk/lib’ is not in the Nix store
Not using flakes.
How do I do this? Tried building to latest stable and unstable. Both with the repository added. Both ran with sudo.
error: path ‘/nix/store/k19qimkv8m2ghxgmvigca4hsx255qyla-linux-6.12.30-modules-shrunk/lib’ is not in the Nix store
Not using flakes.
I solved it on multiple machines by updating my nix version (the version that fails is 2.18.5). You can set the nix version with this: Search - MyNixOS
Don’t know what that is for. I am on NixOS. So how do I get the version updated step by step?
Sure. You can find the option for NixOS on search.nixos.org, the attribute that the other link I sent you is for which versions of nix are available for this attribute: NixOS Search
You can then do something like this:
# configuration.nix
{ config, lib, pkgs, ... }:
{
nix.package = pkgs.nixVersions.latest;
}
Keep in mind, you need to do this before trying to rebuild at the version you actually want. So this rebuild would be at the version you were at prior to the error.
sudo nixos-rebuild switch or sudo nixos-rebuild switch --flake .#<your-hostname> if you are using flakes.
Then check that you are above version 2.18.5: nix --version.
If you are, then you can now upgrade to the version you were trying to before you ran into the initial error.
Bit of a tricky bug.
[termg@nixos:~]$ nix --version
nix (Nix) 2.18.8
[termg@nixos:~]$ sudo nix-channel --update nixos; nixos-rebuild switch
[sudo] password for termg:
error: reading symbolic link ‘/nix/var/nix/profiles/per-user/root/channels/nixpkgs’: No such file or directory
building Nix…
Not using flakes. Set to unstable. Edited configuration. For some reason it is not recognizing it. Config: Look near bottom for the change
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
{ config, lib, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
];
# Bootloader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
networking.hostName = "nixos"; # Define your hostname.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
# Enable networking
networking.networkmanager.enable = true;
# Bluetooth
hardware.bluetooth.enable = true; # enables support for Bluetooth
hardware.bluetooth.powerOnBoot = true; # powers up the default Bluetooth controller on boot
services.blueman.enable = true;
# Set your time zone.
time.timeZone = "America/New_York";
# Select internationalisation properties.
i18n.defaultLocale = "en_US.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "en_US.UTF-8";
LC_IDENTIFICATION = "en_US.UTF-8";
LC_MEASUREMENT = "en_US.UTF-8";
LC_MONETARY = "en_US.UTF-8";
LC_NAME = "en_US.UTF-8";
LC_NUMERIC = "en_US.UTF-8";
LC_PAPER = "en_US.UTF-8";
LC_TELEPHONE = "en_US.UTF-8";
LC_TIME = "en_US.UTF-8";
};
# Enable the X11 windowing system.
services.xserver.enable = true;
# Enable the KDE Plasma Desktop Environment.
services.displayManager.sddm.enable = true;
services.desktopManager.plasma6.enable = true;
# Configure keymap in X11
services.xserver = {
xkb.layout = "us";
xkb.variant = "";
};
# Enable CUPS to print documents.
services.printing.enable = true;
services.avahi = {
enable = true;
nssmdns4 = true;
openFirewall = true;
};
# Steam and Flatpak
services.flatpak.enable = true;
xdg.portal.enable = true;
# Enable sound with pipewire.
#sound.enable = true;
services.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
# If you want to use JACK applications, uncomment this
#jack.enable = true;
# use the example session manager (no others are packaged yet so this is enabled by default,
# no need to redefine it in your config for now)
#media-session.enable = true;
};
# Enable touchpad support (enabled default in most desktopManager).
# services.xserver.libinput.enable = true;
# Define a user account. Don't forget to set a password with ‘passwd’.
users.users.termg = {
isNormalUser = true;
description = "Term Grecos";
extraGroups = [ "networkmanager" "wheel" "scanner" "lp" "dialout" ];
packages = with pkgs; [
firefox
libsForQt5.kate
kicad
calibre
freecad
amdgpu_top
i2pd
jellyfin
libsForQt5.kdenlive
krita
leocad
libreoffice
minetest
lutris
megasync
mpv
obs-studio
onionshare
qtox
prusa-slicer
remmina
transmission_4
qemu
vscodium
waydroid
teams-for-linux
discord
lbry
docker
gnupg
openssl
pinentry
openvswitch
virt-manager
libvirt
zulu
xautoclick
distrobox
#tor-browser
anki
libsForQt5.kcalc
wine
yt-dlp
simple-scan
epsonscan2
# python
python3
simplex-chat-desktop
arti
cargo
fw-ectool
wasm-tools
jan
envision
monado
alvr
sidequest
unetbootin
usbimager
flatpak
git
curl
#gnome-shell-extension-fw-fanctrl
fwupd
dmidecode
gamescope
protonup-qt
protonup-ng
gamehub
diskscan
nwipe
dysk
gparted
# super-slicer
spotify
avrdude
octoprint
# prusa-slicer
#Hacking tools
# thunderbird
];
};
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
#Bug fix when upgrading
nix.package = pkgs.nixVersions.latest;
hardware.sane.enable = true; # enables support for SANE scanners
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
# vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
# wget
];
# programs.gpg.agent = {
# enable = true;
# pinentryPackage = pkgs.pinentry;
# };
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
# programs.mtr.enable = true;
# programs.gnupg.agent = {
# enable = true;
# enableSSHSupport = true;
# };
# List services that you want to enable:
# Enable the OpenSSH daemon.
# services.openssh.enable = true;
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. It‘s perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "25.05"; # Did you read the comment?
}
Please kindly refer to the second half of my previous response. The overall problem here is that you are at a version of nix the command line tool, and possibly the nix daemon, where this bug exists. You need to get access to a version of nix which no longer has this bug prior to trying to change to the latest nixpkgs channel, whether that’s via an update (maybe try changing your channel to a previous stable channel like 24.05) or by using a shell.nix file and nix-shell command, as described in the comment which answered the original poster’s question.
First I would try:
nix-channel --help
nix-channel {--add url [name] | --remove name | --list | --update [names…] | --list-generations | --rollback [generation] }
nix.package = pkgs.nixVersions.latest; change.nix --versionnix that has the bug.I was trying to update from 24.05. The 25.05 in the config at the bottom was in case having it at 23.05 was causing some issues.
So basically I can’t really update with the command line?
I tried, even though I am not sure how to do so, but it gives this:
[termg@nixos:~]$ nix-shell
error: getting status of ‘/home/termg/default.nix’: No such file or directory
[termg@nixos:~]$
Managed to get it to unstable: It was having some issues doing so.
[termg@nixos:~]$ sudo nix-channel --list
[sudo] password for termg:
nixos nixos-unstable release nixos-25.11pre806853.4faa5f532132
nixos-unstable nixos-unstable release nixos-25.11pre806853.4faa5f532132
nixpkgs nixpkgs-unstable release nixpkgs-25.11pre807111.3d1f29646e4b
[termg@nixos:~]$
Nevermind. Just got it working. Did:
/nix/store/l9xhiy5wqs3cflxsfhxk0isbjv96rhd1-nix-2.18.8/bin/nix-env --upgrade
going off of a error when trying to do rollback with nix-channel on 24.05. Had a lot of trace stuff related to CUDA where certain versions or lower would no longer be supported. Ran the rebuild switch, and it seems to have worked.
Here is a rerun:
[termg@nixos:~]$ sudo nixos-rebuild switch
[sudo] password for termg:
building Nix…
building the system configuration…
activating the configuration…
setting up /etc…
reloading user units for termg…
restarting sysinit-reactivation.target
the following new units were started: NetworkManager-dispatcher.service
Done. The new configuration is /nix/store/hsgqn77kzv9ifc58a1xkl7s8w0b5za4r-nixos-system-nixos-25.11pre806853.4faa5f532132
[termg@nixos:~]$
So basically I guess you need to set the channels to unstable, then manually upgrade your current channel, then you can rebuild switch it and it will work.
Sorry about the issues. I don’t understand the nix shell stuff, so that was what I was trying to ask help with, but it seems it would not have worked. The system I was on was 24.11.
My systems use system flakes, so it was not easy to pre-update only the nix service.
My solution was to use a more modern nix when doing the update:
sudo nix run nixpkgs/nixos-25.05#nixos-rebuild -- switch --flake $os_flake_location
Hey!
Previous methods didn’t work but this updated my system, finally, thanks a lot!
I’m also using flakes and tried sudo nix run nixpkgs/nixos-25.05#nixos-rebuild, but then I get this error, which seems related:
warning: the following units failed: home-manager-gabriela.service, nix-daemon.service, nix-daemon.socket
× home-manager-gabriela.service - Home Manager environment for gabriela
Loaded: loaded (/etc/systemd/system/home-manager-gabriela.service; enabled; preset: ignored)
Active: failed (Result: exit-code) since Fri 2025-06-06 12:31:36 -03; 287ms ago
Duration: 1h 55min 32.598s
Invocation: b5dad7106f3240b2a12b00740188081b
Process: 99197 ExecStart=/nix/store/ykaw6zwqkqvbspp5gazg9a4jv6lb7dbr-hm-setup-env /nix/store/kd94fic3cr1xcak522m8jim7mqqsbvx5-home-manager-generation (code=exited, status=1/FAILURE)
Main PID: 99197 (code=exited, status=1/FAILURE)
IP: 0B in, 0B out
IO: 0B read, 0B written
Mem peak: 5.8M
CPU: 42ms
Jun 06 12:31:36 bugarela systemd[1]: Starting Home Manager environment for gabriela...
Jun 06 12:31:36 bugarela hm-activate-gabriela[99197]: Starting Home Manager activation
Jun 06 12:31:36 bugarela hm-activate-gabriela[99207]: error: cannot open connection to remote store 'daemon': error: reading from file: Connection reset by peer
Jun 06 12:31:36 bugarela systemd[1]: home-manager-gabriela.service: Main process exited, code=exited, status=1/FAILURE
Jun 06 12:31:36 bugarela systemd[1]: home-manager-gabriela.service: Failed with result 'exit-code'.
Jun 06 12:31:36 bugarela systemd[1]: Failed to start Home Manager environment for gabriela.
× nix-daemon.service - Nix Daemon
Loaded: loaded (/etc/systemd/system/nix-daemon.service; linked; preset: ignored)
Drop-In: /nix/store/m7v6ndr18nqpmg6rijim7cxa8m2hgwvd-system-units/nix-daemon.service.d
└─overrides.conf
Active: failed (Result: resources) since Fri 2025-06-06 12:03:48 -03; 27min ago
Duration: 1h 55min 33.693s
Invocation: 682a14a0d04e4e899d601a7880f59061
TriggeredBy: × nix-daemon.socket
Docs: man:nix-daemon
https://nixos.org/manual
Jun 06 12:31:36 bugarela systemd[1]: nix-daemon.service: Failed to spawn 'start' task: No such file or directory
Jun 06 12:31:36 bugarela systemd[1]: nix-daemon.service: Failed with result 'resources'.
Jun 06 12:31:36 bugarela systemd[1]: Failed to start Nix Daemon.
Jun 06 12:31:36 bugarela systemd[1]: nix-daemon.service: Failed to load environment files: No such file or directory
Jun 06 12:31:36 bugarela systemd[1]: nix-daemon.service: Failed to spawn 'start' task: No such file or directory
Jun 06 12:31:36 bugarela systemd[1]: nix-daemon.service: Failed with result 'resources'.
Jun 06 12:31:36 bugarela systemd[1]: Failed to start Nix Daemon.
Jun 06 12:31:36 bugarela systemd[1]: nix-daemon.service: Start request repeated too quickly.
Jun 06 12:31:36 bugarela systemd[1]: nix-daemon.service: Failed with result 'resources'.
Jun 06 12:31:36 bugarela systemd[1]: Failed to start Nix Daemon.
× nix-daemon.socket - Nix Daemon Socket
Loaded: loaded (/etc/systemd/system/nix-daemon.socket; enabled; preset: ignored)
Drop-In: /nix/store/m7v6ndr18nqpmg6rijim7cxa8m2hgwvd-system-units/nix-daemon.socket.d
└─overrides.conf
Active: failed (Result: service-start-limit-hit) since Fri 2025-06-06 12:31:36 -03; 302ms ago
Duration: 106ms
Invocation: 96f4cc7091874fbc80661a9a28468cd8
Triggers: ● nix-daemon.service
Listen: /nix/var/nix/daemon-socket/socket (Stream)
Jun 06 12:31:36 bugarela systemd[1]: Listening on Nix Daemon Socket.
Jun 06 12:31:36 bugarela systemd[1]: nix-daemon.socket: Failed with result 'service-start-limit-hit'.
warning: error(s) occurred while switching to the new configuration
I figured it out. It was probably unrelated to the original issue afterall. The cause was this line:
systemd.services.nix-daemon.serviceConfig.EnvironmentFile = "/etc/nixos/nix-daemon-environment";
in my configs. Removing it solved the issue. This config is shared with another computer and it was never an issue, so it could be related to the context of this issue.
I had the same error
What in the end worked for me was to:
Additional details: I would like to add that this error occurs up to nix 2.18.8 (not just 2.18.5) when trying to update from 24.05 to 25.05
The solution that worked for me:
nix shell
{ pkgs ? import (fetchTarball “https://github.com/NixOS/nixpkgs/archive/nixos-unstable.tar.gz”) { } }:
pkgs.mkShell {
packages = with pkgs; [
nixVersions.latest
nixos-rebuild
];
}
and then nixos-rebuild in the shell.
Thanks guys, this was the key for me.
Although the 24.11 → 25.05 update didn’t seem to be working for me (getting that same “…shrunk/lib” error), after upgrading to the latest 24.11 (which bumped “nix --version” from 2.18.5 to 2.24.14), the 24.11 → 25.05 update worked fine.
Confirmed that this one-line command fixed everything for me, thank you!