To install guix (the package manager) inside an ubuntu LXC on Ubuntu you can do the following:

$ sudo apt install lxc
$ sudo lxc-create -t download -n schemer -- --dist ubuntu --release bionic --arch amd64

That will create a lightweight virtulal machine with ubuntu bionic as a distribution.

To connect to it, use the following command:

$ sudo lxc-start -n schemer
$ sudo lxc-attach -n schemer

This will open a bash prompt inside the LXC container.

It's recommended to install emacs-no-x (!) and openssh-server:

# apt install emacs-no-x
# apt install openssh-server

Then change the configuration of sshd to allow to connect as root:

# emacs /etc/ssh/sshd_config

You must have a line in that file that says:

PermitRootLogin yes

Restart ssh daemon:

# /etc/init.d/sshd restart

Use the following command to know the IP of the container:

# ip a

Set a password for the root login:

# passwd

Now type 'exit' to exit the container and return to the host. You can a now connect using ssh:

$ ssh root@$IP_OF_SCHEMER

Now, you are connected to the LXC using ssh, you can follow the usual steps
to install guix from the manual:


Now you might try to do:

# guix package -i hello

And it will fail with the following error:

> build failed: while setting up the build environment: unable to make ?/? private mount: Permission denied

If you look at 'dmesg' output you will see something like:

> audit: type=1400 audit(1539605833.825:115): apparmor="DENIED" operation="mount" info="failed flags match" error=-13 profile="lxc-container-default-cgns" name="/" pid=13543 comm="guix-daemon" flags="rw, rprivate"

That's where it gets ugly. I only know how to disable apparmor for that lxc container.

Go to /var/lib/lxc/schemer/config and add somewhere in that file the following command:

lxc.apparmor.profile = unconfined

You might need to restart the lxc container:

$ lxc-stop -n schemer
$ lxc-start -n schemer
$ ssh root@$IP_OF_SCHEMER
# guix package -i hello && hello


Happy hacking!