nixos-rebuild failing in lxc container

919 views
Skip to first unread message

zeroni...@gmail.com

unread,
May 4, 2018, 1:54:35 PM5/4/18
to nix-devel
Hi,

I'm trying to run nixos under lxc. I've used this and this as references and managed to get image obtained from Hydra up and running under lxc. However it seems that I can't do anything useful with it cause "nixos-rebuild switch" command fails with the following output:

[root@nixos:~]# nixos-rebuild switch
building Nix...
building the system configuration...
activating the configuration...
setting up /etc...
mount: /dev: permission denied.
mount: /dev/pts: permission denied.
mount: /dev/shm: permission denied.
mount: /proc: permission denied.
mount: /run: permission denied.
mount: /run/keys: permission denied.
mount: /run/wrappers: permission denied.
setting up tmpfiles
warning: the following units failed: sys-kernel-config.mount

● sys-kernel-config.mount - Kernel Configuration File System
   Loaded: loaded (/nix/store/fl3mcaqqk2vg0dmk01dfbs6nbm5skpzc-systemd-237/example/systemd/system/sys-kernel-config.mount; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Fri 2018-05-04 17:47:56 UTC; 21ms ago
    Where: /sys/kernel/config
     What: configfs
     Docs: https://www.kernel.org/doc/Documentation/filesystems/configfs/configfs.txt
           https://www.freedesktop.org/wiki/Software/systemd/APIFileSystems
  Process: 915 ExecMount=/nix/store/xnyix1xsidcddhh2ry6jxnpgysjsl4qn-util-linux-2.31.1-bin/bin/mount configfs /sys/kernel/config -t configfs (code=exited, status=32)

May 04 17:47:56 nixos systemd[1]: Mounting Kernel Configuration File System...
May 04 17:47:56 nixos mount[915]: mount: /sys/kernel/config: permission denied.
May 04 17:47:56 nixos systemd[1]: sys-kernel-config.mount: Mount process exited, code=exited status=32
May 04 17:47:56 nixos systemd[1]: sys-kernel-config.mount: Failed with result 'exit-code'.
May 04 17:47:56 nixos systemd[1]: Failed to mount Kernel Configuration File System.
warning: error(s) occurred while switching to the new configuration

Disabling sys-kernel-config.mount via /etc/nixos/configuration.nix didn't help either.I believe that the problem is somehow related to those "permission denied" errors but not really sure about that.

Does anybody have any positive experience with running nixos under unprivileged lxc? Are there any well-known obstacles preventing this usecase? I'm nix(os) newbie and might simply be unaware of them ;)

Any help would be greatly appreciated. Thanks in advance!

Tuomas Tynkkynen

unread,
May 4, 2018, 6:11:32 PM5/4/18
to nix-devel
I encounter those warnings as well with LXC, but as far as I can tell, those aren't fatal and everything else still works. (Except enabling sandboxing in Nix, IIRC) I.e. I just ignore them.

I agree that's not a very neat solution but has worked for my purposes.

Linus Heckemann

unread,
May 5, 2018, 6:37:21 AM5/5/18
to nix-...@googlegroups.com
On 04/05/18 18:54, zeroni...@gmail.com wrote:
> Hi,
>
> I'm trying to run nixos under lxc. I've used this
> <https://github.com/NixOS/nixpkgs/issues/9884> and this
> <https://github.com/NixOS/nixpkgs/issues/9735> as references and managed
> <https://discuss.linuxcontainers.org/t/strange-nobody-nogroup-ownership-in-unprivileged-lxc/1705>
> but not really sure about that.
>
> Does anybody have any positive experience with running nixos under
> unprivileged lxc? Are there any well-known obstacles preventing this
> usecase? I'm nix(os) newbie and might simply be unaware of them ;)
>
> Any help would be greatly appreciated. Thanks in advance!
>

Did you set the boot.isContainer option to true? That should disable
this stuff as far as I know.

zeroni...@gmail.com

unread,
May 7, 2018, 10:19:53 AM5/7/18
to nix-devel
Thanks all for the attention =)

Tuomas Tynkkynen, you're right - they are just warnings. Apparently, I was a little bit sleep deprieved and didn't even checked that rebuild actually hadn't done anything useful =/

Linus Heckemann, I tried
boot.isContainer option but didn't notice any noticeable changes in the nixos-rebuild switch output.

All in all, I think NixOS is pretty impressive piece of software but not for me currently. Now I'm going to try Arch with guix package manager ;)

Thanks again and sorry for the noise!
Reply all
Reply to author
Forward
0 new messages