Custom proxmox LXC image, stat: cannot read file system information for '/boot': No such file or directory

hi all,

I followed Proxmox Virtual Environment - NixOS Wiki to build a custom tarball LXC image. I used the boilerplate configuration.nix on that page and upon updating channels, rebooting, and switching, I get these errors

Failed to start transient service unit: Access denied
stat: cannot read file system information for '/boot': No such file or directory
WARNING: /boot being on a different filesystem not supported by init-script-builder.sh
'/nix/store/6544q8n5bj89vsschrfg8dnd0k7lhmkr-system-path/bin/busctl --json=short call org.freedesktop.systemd1 /org/freedesktop/systemd1 org.freedesktop.systemd1.Manager ListUnitsByPatterns asas 0 0' exited with value 1 at /nix/store/577xpzvwiiim58n841vzccslzy6qrgga-nixos-system-unnamed-24.11pre646099.00d80d13810d/bin/switch-to-configuration line 145.     warning: error(s) occurred while switching to the new configuration  

Sometimes, the error about /boot isn’t thrown, and it just fails to start the “transient service unit”

trace: warning: system.stateVersion is not set, defaulting to 24.11. Read why this matters on https://nixos.org/manual/nixos/stable/options.html#opt-system.stateVersion.          Failed to start transient service unit: Access denied                                                                                                                              '/nix/store/6544q8n5bj89vsschrfg8dnd0k7lhmkr-system-path/bin/busctl --json=short call org.freedesktop.systemd1 /org/freedesktop/systemd1 org.freedesktop.systemd1.Manager ListUnitsByPatterns asas 0 0' exited with value 1 at /nix/store/577xpzvwiiim58n841vzccslzy6qrgga-nixos-system-unnamed-24.11pre646099.00d80d13810d/bin/switch-to-configuration line 145.     warning: error(s) occurred while switching to the new configuration  

I built the image nix run github:nix-community/nixos-generators -- --format proxmox-lxc --configuration lxc.nix passing the following lxc.nix file

{ modulesPath, ... }:
{
  imports = [
    ./base.nix
  ];
  boot.isContainer = true;
  # Supress systemd units that don't work because of LXC
  systemd.suppressedSystemUnits = [
    "dev-mqueue.mount"
    "sys-kernel-debug.mount"
    "sys-fs-fuse-connections.mount"
  ];
}

base.nix just sets the state version, creates a user, enables flakes, and adds an ssh key.

{
  system.stateVersion = "24.11";
  users.users.nixos =
    {
      isNormalUser = true;
      extraGroups = [ "wheel" ];
      openssh.authorizedKeys.keys = [
        "ssh-ed25519  "
      ];
    };
  services.openssh = {
    enable = true;
    settings.PasswordAuthentication = false;
    settings.KbdInteractiveAuthentication = false;
    settings.PermitRootLogin = "no";
  };
  security.sudo.wheelNeedsPassword = false;
}

I’m scratching my head at this one, I don’t have much experience with LXCs and the problem isn’t really apparent. Any advice?

Looks like possible same error message as on this post:

Yeah, I saw that after doing some more digging. I spent all day trying to work around it. A friend helped me out and could get it to work but I’m having ssh errors. Ready to throw in the towel.

Are you sure there’s a configuration.nix in your container and that it’s not empty?

Might be something related to Proxmox, I haven’t had such issue with LXD as comparison.

Yes. Basically what I do is

make the image
update nix channels
reboot
copy the example configuration.nix from the wiki page
try to switch, fail
force a reboot
and my SSH settings are reset and im locked out. I guess I could define that in my configuration.nix but it seems redundant since that should be already done since it’s in the image.

Going to give it more eyes tomorrow.

Can you try building your own image without nix run github:nix-community/nixos-generators -- --format proxmox-lxc?
Then in that order

  1. paste that exact same config into the container
  2. run nix-channel --update
  3. modify the config
  4. run nixos-rebuild switch

Some references for that here: NixOS Proxmox LXC Not rebuilding using wiki provided configuration - #8 by JimJ92120

A friend helped me find a hacky workaround.

Build the image, passing whatever nix files to it to make a user and login. Make the container and login.
Update the nix channels as root. Reboot.

Write new configuration, including the provisions for LXC use, such as suppressing troublesome systemd units (lxc.nix) as well as making the user and installing ssh keys (base.nix).
Reboot using the -f flag to force it passed the access denied.

Now I have a container where I can freely make edits to the configuration.nix without having to rebuild it into the image.

1 Like