How can I remove a mount unit?

I’m playing with mounting a cifs mount, but I run into errors trying to switch.

I have removed my attempt from the configuration file, but I still can’t switch;)

stopping the following units: home-ai-test.mount
activating the configuration...
restarting systemd...
reloading user units for b0ef...
restarting sysinit-reactivation.target
Error: Failed to get unit home-ai-mnt-proj.mount

Caused by:
    Unit home-ai-mnt-proj.mount not loaded.
warning: error(s) occurred while switching to the new configuration

How can I clean this up?

This is really strange. Can you share the steps you used to reach this point? NixOS shouldn’t be stopping mount units like this. Seems like there’s a bug somewhere.

I really just added this

  # fileSystems."/home/ai/test" = {
  #   device = "//10.100.0.1/proj";
  #   fsType = "cifs";
  #   options = let
  #     # network split
  #     automount_opts = "x-systemd.automount,noauto,x-systemd.idle-timeout=60,x-systemd.device-timeout=5s,x-systemd.mount-timeout=5s,user,users";
  #     #automount_opts = "x-systemd.automount,noauto,x-systemd.idle-timeout=60,x-systemd.device-timeout=5s,x-systemd.mount-timeout=5s";

  #  #in ["${automount_opts},credentials=/etc/smb-secrets-quasar"];
  #   in ["${automount_opts},credentials=/etc/smb-secrets-quasar,uid=1005,gid=100"];
  # };

I did have the target as /home/ai/mnt/proj or something like that before I tried /home/ai/test

Hm, I think there’s probably some bugs with switch-to-configuration and x-systemd.automount.

I have to reboot to last configuration? I can’t clean this up without going that route?:wink:

I think I may have run into a different version of what you’re seeing.

I was doing frequent tweaks trying to get an automount working and was getting really weird symptoms.

The weird symptoms went away when I started this process when I needed to make a change

  • comment out mount config
  • nixos-rebuild --switch
  • Reboot
  • Uncomment mount and make changes
  • nixos-rebuild --switch

I can’t say if what I was running into was unique to mount units though cause all the systemd services I setup that weren’t mounts worked on my first try.

P.S. : I’m already in triple digit generation after less than 2 weeks because I had to do this so much lol

I did a reboot and all is well now, but kinda wanna figure out what happened here;)

Like I said, I think we have undiagnosed bugs in switch-to-configuration w.r.t. x-systemd.automount. I think we need someone to do some work to test and experiment with switch-to-configuration to see what it’s doing wrong.

2 Likes