lxc / go-lxc

Go bindings for liblxc
https://linuxcontainers.org/lxc
Other
430 stars 76 forks source link

starting the container failed #134

Closed adam-hanna closed 4 years ago

adam-hanna commented 5 years ago

I'm trying to follow a few of the basic examples but am getting an error, starting the container failed.

Here's my simple program:

package main

import (
    "log"
    "time"

    lxc "gopkg.in/lxc/go-lxc.v2"
)

func main() {
    name := "lxc-test"
    c, err := lxc.NewContainer(name, lxc.DefaultConfigPath())
    if err != nil {
        log.Fatalf("ERROR: %s\n", err.Error())
    }
    defer c.Release()

    c.SetVerbosity(lxc.Verbose)
    c.SetLogFile(name + ".log")
    c.SetLogLevel(lxc.TRACE)

    log.Printf("Starting the container...\n")
    if err := c.Start(); err != nil {
        log.Fatalf("ERROR: %s\n", err.Error())
    }

    log.Printf("Waiting container to startup networking...\n")
    if _, err := c.WaitIPAddresses(5 * time.Second); err != nil {
        log.Fatalf("ERROR: %s\n", err.Error())
    }

    if output, err := c.Execute("uname", "-a"); err != nil {
        log.Fatalf("ERROR: %s\n", err.Error())
    } else {
        log.Printf("%s", output)
    }
}

Here's what I get when I try to run this program:

$ go run main.go
2019/10/28 05:26:29 Starting the container...
2019/10/28 05:26:29 ERROR: starting the container failed
exit status 1

Here's the log file:

lxc 20191028052629.271 TRACE    commands - commands.c:lxc_cmd:302 - Connection refused - Command "get_state" failed to connect command socket
lxc 20191028052629.271 TRACE    start - start.c:lxc_init_handler:766 - Created anonymous pair {4,5} of unix sockets
lxc 20191028052629.271 TRACE    commands - commands.c:lxc_cmd_init:1273 - Created abstract unix socket "/home/vagrant/.local/share/lxc/lxc-test/command"
lxc 20191028052629.271 TRACE    start - start.c:lxc_init_handler:779 - Unix domain socket 6 for command server is ready
lxc 20191028052629.271 INFO     lxccontainer - lxccontainer.c:do_lxcapi_start:971 - Set process title to [lxc monitor] /home/vagrant/.local/share/lxc lxc-test
lxc 20191028052629.271 TRACE    start - start.c:lxc_start:2128 - Doing lxc_start
lxc 20191028052629.271 INFO     lsm - lsm/lsm.c:lsm_init:50 - LSM security driver SELinux
lxc 20191028052629.271 TRACE    start - start.c:lxc_init:799 - Initialized LSM
lxc 20191028052629.271 TRACE    start - start.c:lxc_init:806 - Read seccomp policy
lxc 20191028052629.271 TRACE    start - start.c:lxc_serve_state_clients:474 - Set container state to STARTING
lxc 20191028052629.271 TRACE    start - start.c:lxc_serve_state_clients:477 - No state clients registered
lxc 20191028052629.271 TRACE    start - start.c:lxc_init:814 - Set container state to "STARTING"
lxc 20191028052629.271 TRACE    start - start.c:lxc_init:877 - Set environment variables
lxc 20191028052629.271 TRACE    start - start.c:lxc_init:884 - Ran pre-start hooks
lxc 20191028052629.272 TRACE    start - start.c:setup_signal_fd:356 - Created signal file descriptor 7
lxc 20191028052629.272 TRACE    start - start.c:lxc_init:895 - Set up signal fd
lxc 20191028052629.273 DEBUG    terminal - terminal.c:lxc_terminal_peer_default:676 - No such device - The process does not have a controlling terminal
lxc 20191028052629.273 TRACE    start - start.c:lxc_init:903 - Created console
lxc 20191028052629.273 TRACE    start - start.c:lxc_init:910 - Chowned console
lxc 20191028052629.273 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1014 - basecginfo is:
lxc 20191028052629.273 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1015 - 11:hugetlb:/
10:memory:/user.slice/user-1000.slice/session-3.scope
9:net_cls,net_prio:/
8:cpuset:/
7:devices:/user.slice
6:freezer:/
5:perf_event:/
4:pids:/user.slice/user-1000.slice/session-3.scope
3:blkio:/user.slice
2:cpu,cpuacct:/user.slice
1:name=systemd:/user.slice/user-1000.slice/session-3.scope
0::/user.slice/user-1000.slice/session-3.scope

lxc 20191028052629.273 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1018 - kernel subsystem 0: hugetlb
lxc 20191028052629.273 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1018 - kernel subsystem 1: memory
lxc 20191028052629.273 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1018 - kernel subsystem 2: net_cls
lxc 20191028052629.273 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1018 - kernel subsystem 3: net_prio
lxc 20191028052629.273 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1018 - kernel subsystem 4: cpuset
lxc 20191028052629.273 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1018 - kernel subsystem 5: devices
lxc 20191028052629.273 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1018 - kernel subsystem 6: freezer
lxc 20191028052629.273 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1018 - kernel subsystem 7: perf_event
lxc 20191028052629.273 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1018 - kernel subsystem 8: pids
lxc 20191028052629.273 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1018 - kernel subsystem 9: blkio
lxc 20191028052629.273 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1018 - kernel subsystem 10: cpu
lxc 20191028052629.273 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1018 - kernel subsystem 11: cpuacct
lxc 20191028052629.273 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1018 - kernel subsystem 12: cgroup2
lxc 20191028052629.273 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1021 - named subsystem 0: name=systemd
lxc 20191028052629.273 TRACE    cgfsng - cgroups/cgfsng.c:cg_hybrid_init:2595 - Writable cgroup hierarchies:
lxc 20191028052629.273 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:991 -   No hierarchies found
lxc 20191028052629.273 TRACE    cgroup - cgroups/cgroup.c:cgroup_init:56 - Initialized cgroup driver cgfsng
lxc 20191028052629.273 TRACE    cgroup - cgroups/cgroup.c:cgroup_init:61 - Running with hybrid cgroup layout
lxc 20191028052629.273 TRACE    start - start.c:lxc_init:917 - Initialized cgroup driver
lxc 20191028052629.273 INFO     start - start.c:lxc_init:919 - Container "lxc-test" is initialized
lxc 20191028052629.273 ERROR    start - start.c:lxc_spawn:1737 - Operation not permitted - Failed to clone a new set of namespaces
lxc 20191028052629.273 DEBUG    network - network.c:lxc_delete_network_unpriv:2479 - Cannot not guarantee safe deletion of network devices. Manual cleanup maybe needed
lxc 20191028052629.273 DEBUG    network - network.c:lxc_delete_network:3306 - Failed to delete network devices
lxc 20191028052629.273 TRACE    start - start.c:lxc_serve_state_socket_pair:543 - Sent container state "ABORTING" to 5
lxc 20191028052629.273 TRACE    start - start.c:lxc_serve_state_clients:474 - Set container state to ABORTING
lxc 20191028052629.273 TRACE    start - start.c:lxc_serve_state_clients:477 - No state clients registered
lxc 20191028052629.273 ERROR    start - start.c:__lxc_start:2019 - Failed to spawn container "lxc-test"
lxc 20191028052629.273 TRACE    start - start.c:lxc_serve_state_clients:474 - Set container state to STOPPING
lxc 20191028052629.273 TRACE    start - start.c:lxc_serve_state_clients:477 - No state clients registered
lxc 20191028052629.273 TRACE    start - start.c:lxc_fini:1024 - Closed command socket
lxc 20191028052629.273 TRACE    start - start.c:lxc_fini:1035 - Set container state to "STOPPED"
lxc 20191028052629.273 DEBUG    lxccontainer - lxccontainer.c:wait_on_daemonized_start:839 - First child 11384 exited
lxc 20191028052629.273 ERROR    lxccontainer - lxccontainer.c:wait_on_daemonized_start:850 - Received container state "ABORTING" instead of "RUNNING"

I'm on Fedora 30, before running I installed the following: $ sudo dnf install lxc lxc-templates lxc-devel lxc-extra dnsmasq debootstrap libvirt perl gpg

Here's my info:

$ uname -a
Linux fedora30.localdomain 5.3.5-200.fc30.x86_64 #1 SMP Tue Oct 8 12:41:15 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux 
stgraber commented 5 years ago
lxc 20191028052629.273 ERROR    start - start.c:lxc_spawn:1737 - Operation not permitted - Failed to clone a new set of namespaces

So looks like your user isn't allowed to unshare some namespaces, my guess would be the user namespace. It's possible to set restrictions on those in /proc/sys. Look for unprivileged_userns_clone and /proc/sys/user/max_*_namespaces.

adam-hanna commented 5 years ago

Interesting. I'll take a look tomorrow. Thanks for your help.

I did try compiling and running the binary as sudo and also received an error.

adam-hanna commented 5 years ago

I'm still investigating, but as an fyi ...

$ ls /proc/sys/user
max_cgroup_namespaces  max_inotify_instances  max_inotify_watches  max_ipc_namespaces  max_mnt_namespaces  max_net_namespaces  max_pid_namespaces  max_user_namespaces  max_uts_namespaces

$ sudo grep -r "unprivileged_userns_clone" /proc/sys
grep: /proc/sys/fs/binfmt_misc/register: Invalid argument
grep: /proc/sys/net/ipv4/route/flush: Permission denied
grep: /proc/sys/net/ipv6/conf/all/stable_secret: Input/output error
grep: /proc/sys/net/ipv6/conf/br-97edb9210c7b/stable_secret: Input/output error
grep: /proc/sys/net/ipv6/conf/br-aa094f908af8/stable_secret: Input/output error
grep: /proc/sys/net/ipv6/conf/default/stable_secret: Input/output error
grep: /proc/sys/net/ipv6/conf/docker0/stable_secret: Input/output error
grep: /proc/sys/net/ipv6/conf/eth0/stable_secret: Input/output error
grep: /proc/sys/net/ipv6/conf/eth1/stable_secret: Input/output error
grep: /proc/sys/net/ipv6/conf/lo/stable_secret: Input/output error
grep: /proc/sys/net/ipv6/conf/vethd4f1d6f/stable_secret: Input/output error
grep: /proc/sys/net/ipv6/conf/virbr0/stable_secret: Input/output error
grep: /proc/sys/net/ipv6/conf/virbr0-nic/stable_secret: Input/output error
grep: /proc/sys/net/ipv6/route/flush: Permission denied
grep: /proc/sys/vm/compact_memory: Permission denied

$  cat /proc/sys/user/max_cgroup_namespaces
23674

$ cat /proc/sys/user/max_ipc_namespaces
23674

$ cat /proc/sys/user/max_mnt_namespaces
23674

$ cat /proc/sys/user/max_net_namespaces
23674

$ cat /proc/sys/user/max_pid_namespaces
23674

$ cat /proc/sys/user/max_user_namespaces
23674

$ cat /proc/sys/user/max_uts_namespaces
23674
adam-hanna commented 5 years ago

I ran the following commands and seemed to make a little progress:

$ sudo su -
$ grubby --args="namespace.unpriv_enable=1 user_namespace.enable=1" --update-kernel="$(grubby --default-kernel)"
$ bash -c 'echo "user.max_user_namespaces=15076" >> /etc/sysctl.conf'
$ exit
$ sudo reboot

Then the following commands:

$ go build
$ sudo ./lxc-test

And that gave me the following log file. Looks like it's failing to create / mount directories.

lxc 20191029012929.925 TRACE    commands - commands.c:lxc_cmd:302 - Connection refused - Command "get_state" failed to connect command socket
lxc 20191029012929.926 TRACE    start - start.c:lxc_init_handler:766 - Created anonymous pair {4,5} of unix sockets
lxc 20191029012929.926 TRACE    commands - commands.c:lxc_cmd_init:1273 - Created abstract unix socket "/var/lib/lxc/lxc-test/command"
lxc 20191029012929.926 TRACE    start - start.c:lxc_init_handler:779 - Unix domain socket 6 for command server is ready
lxc 20191029012929.926 INFO     lxccontainer - lxccontainer.c:do_lxcapi_start:971 - Set process title to [lxc monitor] /var/lib/lxc lxc-test
lxc 20191029012929.927 TRACE    start - start.c:lxc_start:2128 - Doing lxc_start
lxc 20191029012929.927 INFO     lsm - lsm/lsm.c:lsm_init:50 - LSM security driver SELinux
lxc 20191029012929.927 TRACE    start - start.c:lxc_init:799 - Initialized LSM
lxc 20191029012929.927 TRACE    start - start.c:lxc_init:806 - Read seccomp policy
lxc 20191029012929.927 TRACE    start - start.c:lxc_serve_state_clients:474 - Set container state to STARTING
lxc 20191029012929.927 TRACE    start - start.c:lxc_serve_state_clients:477 - No state clients registered
lxc 20191029012929.927 TRACE    start - start.c:lxc_init:814 - Set container state to "STARTING"
lxc 20191029012929.927 TRACE    start - start.c:lxc_init:877 - Set environment variables
lxc 20191029012929.927 TRACE    start - start.c:lxc_init:884 - Ran pre-start hooks
lxc 20191029012929.927 TRACE    start - start.c:setup_signal_fd:356 - Created signal file descriptor 7
lxc 20191029012929.927 TRACE    start - start.c:lxc_init:895 - Set up signal fd
lxc 20191029012929.927 DEBUG    terminal - terminal.c:lxc_terminal_peer_default:676 - No such device - The process does not have a controlling terminal
lxc 20191029012929.927 TRACE    start - start.c:lxc_init:903 - Created console
lxc 20191029012929.927 TRACE    start - start.c:lxc_init:910 - Chowned console
lxc 20191029012929.928 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1014 - basecginfo is:
lxc 20191029012929.928 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1015 - 11:freezer:/
10:cpuset:/
9:blkio:/init.scope
8:pids:/init.scope
7:hugetlb:/
6:perf_event:/
5:cpu,cpuacct:/init.scope
4:net_cls,net_prio:/
3:memory:/init.scope
2:devices:/init.scope
1:name=systemd:/init.scope
0::/init.scope

lxc 20191029012929.928 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1018 - kernel subsystem 0: freezer
lxc 20191029012929.928 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1018 - kernel subsystem 1: cpuset
lxc 20191029012929.928 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1018 - kernel subsystem 2: blkio
lxc 20191029012929.928 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1018 - kernel subsystem 3: pids
lxc 20191029012929.928 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1018 - kernel subsystem 4: hugetlb
lxc 20191029012929.928 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1018 - kernel subsystem 5: perf_event
lxc 20191029012929.928 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1018 - kernel subsystem 6: cpu
lxc 20191029012929.928 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1018 - kernel subsystem 7: cpuacct
lxc 20191029012929.928 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1018 - kernel subsystem 8: net_cls
lxc 20191029012929.928 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1018 - kernel subsystem 9: net_prio
lxc 20191029012929.928 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1018 - kernel subsystem 10: memory
lxc 20191029012929.928 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1018 - kernel subsystem 11: devices
lxc 20191029012929.928 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1018 - kernel subsystem 12: cgroup2
lxc 20191029012929.928 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1021 - named subsystem 0: name=systemd
lxc 20191029012929.928 TRACE    cgfsng - cgroups/cgfsng.c:cg_hybrid_init:2568 - No controllers are enabled for delegation in the unified hierarchy
lxc 20191029012929.928 TRACE    cgfsng - cgroups/cgfsng.c:cg_hybrid_init:2595 - Writable cgroup hierarchies:
lxc 20191029012929.928 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:995 -   Hierarchies:
lxc 20191029012929.928 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1000 -   0: base_cgroup: /
lxc 20191029012929.928 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1001 -       mountpoint:  /sys/fs/cgroup/unified
lxc 20191029012929.928 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1002 -       controllers:
lxc 20191029012929.928 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1000 -   1: base_cgroup: /
lxc 20191029012929.928 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1001 -       mountpoint:  /sys/fs/cgroup/systemd
lxc 20191029012929.928 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1002 -       controllers:
lxc 20191029012929.928 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1004 -       0: name=systemd
lxc 20191029012929.928 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1000 -   2: base_cgroup: /
lxc 20191029012929.928 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1001 -       mountpoint:  /sys/fs/cgroup/devices
lxc 20191029012929.928 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1002 -       controllers:
lxc 20191029012929.928 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1004 -       0: devices
lxc 20191029012929.928 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1000 -   3: base_cgroup: /
lxc 20191029012929.928 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1001 -       mountpoint:  /sys/fs/cgroup/memory
lxc 20191029012929.928 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1002 -       controllers:
lxc 20191029012929.928 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1004 -       0: memory
lxc 20191029012929.928 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1000 -   4: base_cgroup: /
lxc 20191029012929.928 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1001 -       mountpoint:  /sys/fs/cgroup/net_cls,net_prio
lxc 20191029012929.928 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1002 -       controllers:
lxc 20191029012929.928 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1004 -       0: net_cls
lxc 20191029012929.928 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1004 -       1: net_prio
lxc 20191029012929.928 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1000 -   5: base_cgroup: /
lxc 20191029012929.928 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1001 -       mountpoint:  /sys/fs/cgroup/cpu,cpuacct
lxc 20191029012929.928 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1002 -       controllers:
lxc 20191029012929.928 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1004 -       0: cpu
lxc 20191029012929.928 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1004 -       1: cpuacct
lxc 20191029012929.928 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1000 -   6: base_cgroup: /
lxc 20191029012929.928 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1001 -       mountpoint:  /sys/fs/cgroup/perf_event
lxc 20191029012929.928 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1002 -       controllers:
lxc 20191029012929.928 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1004 -       0: perf_event
lxc 20191029012929.928 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1000 -   7: base_cgroup: /
lxc 20191029012929.928 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1001 -       mountpoint:  /sys/fs/cgroup/hugetlb
lxc 20191029012929.928 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1002 -       controllers:
lxc 20191029012929.928 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1004 -       0: hugetlb
lxc 20191029012929.928 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1000 -   8: base_cgroup: /
lxc 20191029012929.928 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1001 -       mountpoint:  /sys/fs/cgroup/pids
lxc 20191029012929.928 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1002 -       controllers:
lxc 20191029012929.928 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1004 -       0: pids
lxc 20191029012929.928 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1000 -   9: base_cgroup: /
lxc 20191029012929.928 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1001 -       mountpoint:  /sys/fs/cgroup/blkio
lxc 20191029012929.928 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1002 -       controllers:
lxc 20191029012929.928 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1004 -       0: blkio
lxc 20191029012929.928 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1000 -   10: base_cgroup: /
lxc 20191029012929.928 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1001 -       mountpoint:  /sys/fs/cgroup/cpuset
lxc 20191029012929.928 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1002 -       controllers:
lxc 20191029012929.928 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1004 -       0: cpuset
lxc 20191029012929.928 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1000 -   11: base_cgroup: /
lxc 20191029012929.928 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1001 -       mountpoint:  /sys/fs/cgroup/freezer
lxc 20191029012929.928 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1002 -       controllers:
lxc 20191029012929.928 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1004 -       0: freezer
lxc 20191029012929.928 TRACE    cgroup - cgroups/cgroup.c:cgroup_init:56 - Initialized cgroup driver cgfsng
lxc 20191029012929.928 TRACE    cgroup - cgroups/cgroup.c:cgroup_init:61 - Running with hybrid cgroup layout
lxc 20191029012929.928 TRACE    start - start.c:lxc_init:917 - Initialized cgroup driver
lxc 20191029012929.928 INFO     start - start.c:lxc_init:919 - Container "lxc-test" is initialized
lxc 20191029012929.929 TRACE    cgfsng - cgroups/cgfsng.c:cg_legacy_filter_and_set_cpus:516 - Copied cpu settings of parent cgroup
lxc 20191029012929.929 INFO     cgfsng - cgroups/cgfsng.c:cgfsng_monitor_create:1401 - The monitor process uses "lxc.monitor/lxc-test" as cgroup
lxc 20191029012929.930 TRACE    cgfsng - cgroups/cgfsng.c:cg_legacy_filter_and_set_cpus:516 - Copied cpu settings of parent cgroup
lxc 20191029012929.930 INFO     cgfsng - cgroups/cgfsng.c:cgfsng_payload_create:1466 - The container process uses "lxc.payload/lxc-test" as cgroup
lxc 20191029012929.932 TRACE    start - start.c:lxc_spawn:1740 - Cloned child process 5543
lxc 20191029012929.932 INFO     start - start.c:lxc_spawn:1750 - Cloned CLONE_NEWNS
lxc 20191029012929.932 INFO     start - start.c:lxc_spawn:1750 - Cloned CLONE_NEWPID
lxc 20191029012929.932 INFO     start - start.c:lxc_spawn:1750 - Cloned CLONE_NEWUTS
lxc 20191029012929.932 INFO     start - start.c:lxc_spawn:1750 - Cloned CLONE_NEWIPC
lxc 20191029012929.932 INFO     start - start.c:lxc_spawn:1750 - Cloned CLONE_NEWNET
lxc 20191029012929.932 DEBUG    start - start.c:lxc_try_preserve_namespaces:192 - Preserved mnt namespace via fd 16
lxc 20191029012929.932 DEBUG    start - start.c:lxc_try_preserve_namespaces:192 - Preserved pid namespace via fd 17
lxc 20191029012929.932 DEBUG    start - start.c:lxc_try_preserve_namespaces:192 - Preserved uts namespace via fd 18
lxc 20191029012929.932 DEBUG    start - start.c:lxc_try_preserve_namespaces:192 - Preserved ipc namespace via fd 19
lxc 20191029012929.932 DEBUG    start - start.c:lxc_try_preserve_namespaces:192 - Preserved net namespace via fd 20
lxc 20191029012929.933 TRACE    start - start.c:lxc_spawn:1812 - Allocated new network namespace id
lxc 20191029012929.933 INFO     start - start.c:do_start:1279 - Unshared CLONE_NEWCGROUP
lxc 20191029012929.933 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/" as MS_SLAVE
lxc 20191029012929.933 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/sys" as MS_SLAVE
lxc 20191029012929.933 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/sys/kernel/security" as MS_SLAVE
lxc 20191029012929.933 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/sys/fs/cgroup" as MS_SLAVE
lxc 20191029012929.933 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/sys/fs/cgroup/unified" as MS_SLAVE
lxc 20191029012929.933 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/sys/fs/cgroup/systemd" as MS_SLAVE
lxc 20191029012929.933 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/sys/fs/cgroup/devices" as MS_SLAVE
lxc 20191029012929.933 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/sys/fs/cgroup/memory" as MS_SLAVE
lxc 20191029012929.933 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/sys/fs/cgroup/net_cls,net_prio" as MS_SLAVE
lxc 20191029012929.933 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/sys/fs/cgroup/cpu,cpuacct" as MS_SLAVE
lxc 20191029012929.933 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/sys/fs/cgroup/perf_event" as MS_SLAVE
lxc 20191029012929.933 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/sys/fs/cgroup/hugetlb" as MS_SLAVE
lxc 20191029012929.933 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/sys/fs/cgroup/pids" as MS_SLAVE
lxc 20191029012929.933 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/sys/fs/cgroup/blkio" as MS_SLAVE
lxc 20191029012929.933 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/sys/fs/cgroup/cpuset" as MS_SLAVE
lxc 20191029012929.933 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/sys/fs/cgroup/freezer" as MS_SLAVE
lxc 20191029012929.933 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/sys/fs/pstore" as MS_SLAVE
lxc 20191029012929.933 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/sys/fs/bpf" as MS_SLAVE
lxc 20191029012929.933 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/sys/kernel/config" as MS_SLAVE
lxc 20191029012929.934 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/sys/fs/selinux" as MS_SLAVE
lxc 20191029012929.934 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/sys/kernel/debug" as MS_SLAVE
lxc 20191029012929.934 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/dev" as MS_SLAVE
lxc 20191029012929.934 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/dev/shm" as MS_SLAVE
lxc 20191029012929.934 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/dev/pts" as MS_SLAVE
lxc 20191029012929.934 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/dev/hugepages" as MS_SLAVE
lxc 20191029012929.934 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/dev/mqueue" as MS_SLAVE
lxc 20191029012929.934 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/run" as MS_SLAVE
lxc 20191029012929.934 ERROR    conf - conf.c:remount_all_slave:3292 - Permission denied - Failed to make "/run/docker/netns/9ec2a78eca4d" MS_SLAVE
lxc 20191029012929.934 ERROR    conf - conf.c:remount_all_slave:3293 - Continuing...
lxc 20191029012929.934 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/run/user/1000" as MS_SLAVE
lxc 20191029012929.934 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/proc" as MS_SLAVE
lxc 20191029012929.934 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/proc/sys/fs/binfmt_misc" as MS_SLAVE
lxc 20191029012929.934 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/tmp" as MS_SLAVE
lxc 20191029012929.934 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/boot" as MS_SLAVE
lxc 20191029012929.934 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/var/lib/nfs/rpc_pipefs" as MS_SLAVE
lxc 20191029012929.934 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/var/lib/docker/overlay2/42d542e2d16fad4f64956b2cb89ed602f7c28596a258813642548bbd48d1092c/merged" as MS_SLAVE
lxc 20191029012929.934 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/var/lib/docker/containers/649bb41d31873bed500006a91b2b98660ea921a09e4dee4fdbb106da286e31a8/mounts/shm" as MS_SLAVE
lxc 20191029012929.934 TRACE    conf - conf.c:remount_all_slave:3298 - Remounted all mount table entries as MS_SLAVE
lxc 20191029012929.934 TRACE    network - network.c:lxc_network_send_name_and_ifindex_to_parent:3262 - Sent network device names and ifindices to parent
lxc 20191029012929.935 INFO     conf - conf.c:mount_autodev:1120 - Preparing "/dev"
lxc 20191029012929.935 TRACE    conf - conf.c:mount_autodev:1144 - Mounted tmpfs on "/dev"
lxc 20191029012929.935 INFO     conf - conf.c:mount_autodev:1167 - Prepared "/dev"
lxc 20191029012929.935 INFO     conf - conf.c:lxc_fill_autodev:1211 - Populating "/dev"
lxc 20191029012929.935 DEBUG    conf - conf.c:lxc_fill_autodev:1226 - Created device node "/dev/full"
lxc 20191029012929.935 DEBUG    conf - conf.c:lxc_fill_autodev:1226 - Created device node "/dev/null"
lxc 20191029012929.935 DEBUG    conf - conf.c:lxc_fill_autodev:1226 - Created device node "/dev/random"
lxc 20191029012929.935 DEBUG    conf - conf.c:lxc_fill_autodev:1226 - Created device node "/dev/tty"
lxc 20191029012929.935 DEBUG    conf - conf.c:lxc_fill_autodev:1226 - Created device node "/dev/urandom"
lxc 20191029012929.935 DEBUG    conf - conf.c:lxc_fill_autodev:1226 - Created device node "/dev/zero"
lxc 20191029012929.935 INFO     conf - conf.c:lxc_fill_autodev:1288 - Populated "/dev"
lxc 20191029012929.935 ERROR    utils - utils.c:safe_mount:1204 - No such file or directory - Failed to mount "/dev/pts/2" onto "/dev/console"
lxc 20191029012929.935 ERROR    conf - conf.c:lxc_setup_dev_console:1746 - Failed to mount "/dev/pts/2" on "/dev/console"
lxc 20191029012929.935 ERROR    conf - conf.c:lxc_setup:3623 - Failed to setup console
lxc 20191029012929.935 ERROR    start - start.c:do_start:1299 - Failed to setup container "lxc-test"
lxc 20191029012929.935 ERROR    sync - sync.c:__sync_wait:61 - An error occurred in another process (expected sequence number 5)
lxc 20191029012929.935 DEBUG    network - network.c:lxc_delete_network:3308 - Deleted network devices
lxc 20191029012929.935 TRACE    start - start.c:lxc_serve_state_socket_pair:543 - Sent container state "ABORTING" to 5
lxc 20191029012929.935 TRACE    start - start.c:lxc_serve_state_clients:474 - Set container state to ABORTING
lxc 20191029012929.935 TRACE    start - start.c:lxc_serve_state_clients:477 - No state clients registered
lxc 20191029012929.935 ERROR    start - start.c:lxc_abort:1103 - No such file or directory - Failed to send SIGKILL to 5543
lxc 20191029012929.936 DEBUG    lxccontainer - lxccontainer.c:wait_on_daemonized_start:839 - First child 5541 exited
lxc 20191029012929.936 ERROR    lxccontainer - lxccontainer.c:wait_on_daemonized_start:850 - Received container state "ABORTING" instead of "RUNNING"
lxc 20191029012929.936 ERROR    start - start.c:__lxc_start:2019 - Failed to spawn container "lxc-test"
lxc 20191029012929.936 TRACE    start - start.c:lxc_serve_state_clients:474 - Set container state to STOPPING
lxc 20191029012929.936 TRACE    start - start.c:lxc_serve_state_clients:477 - No state clients registered
lxc 20191029012929.939 TRACE    cgfsng - cgroups/cgfsng.c:cg_legacy_filter_and_set_cpus:516 - Copied cpu settings of parent cgroup
lxc 20191029012929.939 TRACE    start - start.c:lxc_fini:1024 - Closed command socket
lxc 20191029012929.939 TRACE    start - start.c:lxc_fini:1035 - Set container state to "STOPPED"
stgraber commented 5 years ago
lxc 20191029012929.935 ERROR    utils - utils.c:safe_mount:1204 - No such file or directory - Failed to mount "/dev/pts/2" onto "/dev/console"

That's the new error. What's in your container config?

adam-hanna commented 5 years ago

Interestingly, I added this line: log.Println(lxc.DefaultConfigPath()), which points to this path: /home/vagrant/.local/share/lxc. However:

$ ls /home/vagrant/.local/share/lxc
ls: cannot access '/home/vagrant/.local/share/lxc': No such file or directory

Based on the above, I'm not sure what config the script is using.

$ cat /etc/lxc/default.conf
lxc.net.0.type = veth
lxc.net.0.link = lxcbr0
lxc.net.0.flags = up
lxc.net.0.hwaddr = 00:16:3e:xx:xx:xx

$ cat ~/.config/lxc/default.conf
cat: /home/vagrant/.config/lxc/default.conf: No such file or directory

If I change my program such that:

  ...
  name := "lxc-test"
  path := "/etc/lxc/"
  c, err := lxc.NewContainer(name, path)
  ...

Then:

$ go build
$ sudo ./lxc-test
2019/10/29 17:37:39 /var/lib/lxc
2019/10/29 17:37:39 Starting the container...
2019/10/29 17:37:39 ERROR: starting the container failed

$ sudo cat lxc-test.log
lxc 20191029174754.381 TRACE    commands - commands.c:lxc_cmd:302 - Connection refused - Command "get_state" failed to connect command socket
lxc 20191029174754.381 TRACE    start - start.c:lxc_init_handler:766 - Created anonymous pair {4,5} of unix sockets
lxc 20191029174754.381 TRACE    commands - commands.c:lxc_cmd_init:1273 - Created abstract unix socket "/etc/lxc/lxc-test/command"
lxc 20191029174754.381 TRACE    start - start.c:lxc_init_handler:779 - Unix domain socket 6 for command server is ready
lxc 20191029174754.382 INFO     lxccontainer - lxccontainer.c:do_lxcapi_start:971 - Set process title to [lxc monitor] /etc/lxc lxc-test
lxc 20191029174754.382 TRACE    start - start.c:lxc_start:2128 - Doing lxc_start
lxc 20191029174754.382 INFO     lsm - lsm/lsm.c:lsm_init:50 - LSM security driver SELinux
lxc 20191029174754.382 TRACE    start - start.c:lxc_init:799 - Initialized LSM
lxc 20191029174754.382 TRACE    start - start.c:lxc_init:806 - Read seccomp policy
lxc 20191029174754.382 TRACE    start - start.c:lxc_serve_state_clients:474 - Set container state to STARTING
lxc 20191029174754.382 TRACE    start - start.c:lxc_serve_state_clients:477 - No state clients registered
lxc 20191029174754.382 TRACE    start - start.c:lxc_init:814 - Set container state to "STARTING"
lxc 20191029174754.382 TRACE    start - start.c:lxc_init:877 - Set environment variables
lxc 20191029174754.382 TRACE    start - start.c:lxc_init:884 - Ran pre-start hooks
lxc 20191029174754.382 TRACE    start - start.c:setup_signal_fd:356 - Created signal file descriptor 7
lxc 20191029174754.382 TRACE    start - start.c:lxc_init:895 - Set up signal fd
lxc 20191029174754.384 DEBUG    terminal - terminal.c:lxc_terminal_peer_default:676 - No such device - The process does not have a controlling terminal
lxc 20191029174754.384 TRACE    start - start.c:lxc_init:903 - Created console
lxc 20191029174754.384 TRACE    start - start.c:lxc_init:910 - Chowned console
lxc 20191029174754.384 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1014 - basecginfo is:
lxc 20191029174754.384 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1015 - 11:blkio:/init.scope
10:memory:/init.scope
9:pids:/init.scope
8:cpu,cpuacct:/init.scope
7:freezer:/
6:perf_event:/
5:hugetlb:/
4:cpuset:/
3:devices:/init.scope
2:net_cls,net_prio:/
1:name=systemd:/init.scope
0::/init.scope

lxc 20191029174754.384 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1018 - kernel subsystem 0: blkio
lxc 20191029174754.384 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1018 - kernel subsystem 1: memory
lxc 20191029174754.384 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1018 - kernel subsystem 2: pids
lxc 20191029174754.384 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1018 - kernel subsystem 3: cpu
lxc 20191029174754.384 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1018 - kernel subsystem 4: cpuacct
lxc 20191029174754.384 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1018 - kernel subsystem 5: freezer
lxc 20191029174754.384 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1018 - kernel subsystem 6: perf_event
lxc 20191029174754.384 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1018 - kernel subsystem 7: hugetlb
lxc 20191029174754.384 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1018 - kernel subsystem 8: cpuset
lxc 20191029174754.384 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1018 - kernel subsystem 9: devices
lxc 20191029174754.384 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1018 - kernel subsystem 10: net_cls
lxc 20191029174754.384 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1018 - kernel subsystem 11: net_prio
lxc 20191029174754.384 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1018 - kernel subsystem 12: cgroup2
lxc 20191029174754.384 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1021 - named subsystem 0: name=systemd
lxc 20191029174754.384 TRACE    cgfsng - cgroups/cgfsng.c:cg_hybrid_init:2568 - No controllers are enabled for delegation in the unified hierarchy
lxc 20191029174754.384 TRACE    cgfsng - cgroups/cgfsng.c:cg_hybrid_init:2595 - Writable cgroup hierarchies:
lxc 20191029174754.384 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:995 -   Hierarchies:
lxc 20191029174754.384 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1000 -   0: base_cgroup: /
lxc 20191029174754.384 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1001 -       mountpoint:  /sys/fs/cgroup/unified
lxc 20191029174754.384 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1002 -       controllers:
lxc 20191029174754.384 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1000 -   1: base_cgroup: /
lxc 20191029174754.384 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1001 -       mountpoint:  /sys/fs/cgroup/systemd
lxc 20191029174754.384 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1002 -       controllers:
lxc 20191029174754.384 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1004 -       0: name=systemd
lxc 20191029174754.384 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1000 -   2: base_cgroup: /
lxc 20191029174754.384 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1001 -       mountpoint:  /sys/fs/cgroup/net_cls,net_prio
lxc 20191029174754.384 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1002 -       controllers:
lxc 20191029174754.384 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1004 -       0: net_cls
lxc 20191029174754.384 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1004 -       1: net_prio
lxc 20191029174754.384 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1000 -   3: base_cgroup: /
lxc 20191029174754.384 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1001 -       mountpoint:  /sys/fs/cgroup/devices
lxc 20191029174754.384 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1002 -       controllers:
lxc 20191029174754.384 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1004 -       0: devices
lxc 20191029174754.384 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1000 -   4: base_cgroup: /
lxc 20191029174754.384 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1001 -       mountpoint:  /sys/fs/cgroup/cpuset
lxc 20191029174754.384 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1002 -       controllers:
lxc 20191029174754.384 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1004 -       0: cpuset
lxc 20191029174754.384 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1000 -   5: base_cgroup: /
lxc 20191029174754.384 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1001 -       mountpoint:  /sys/fs/cgroup/hugetlb
lxc 20191029174754.384 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1002 -       controllers:
lxc 20191029174754.384 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1004 -       0: hugetlb
lxc 20191029174754.384 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1000 -   6: base_cgroup: /
lxc 20191029174754.384 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1001 -       mountpoint:  /sys/fs/cgroup/perf_event
lxc 20191029174754.384 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1002 -       controllers:
lxc 20191029174754.384 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1004 -       0: perf_event
lxc 20191029174754.384 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1000 -   7: base_cgroup: /
lxc 20191029174754.384 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1001 -       mountpoint:  /sys/fs/cgroup/freezer
lxc 20191029174754.384 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1002 -       controllers:
lxc 20191029174754.384 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1004 -       0: freezer
lxc 20191029174754.384 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1000 -   8: base_cgroup: /
lxc 20191029174754.384 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1001 -       mountpoint:  /sys/fs/cgroup/cpu,cpuacct
lxc 20191029174754.384 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1002 -       controllers:
lxc 20191029174754.384 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1004 -       0: cpu
lxc 20191029174754.384 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1004 -       1: cpuacct
lxc 20191029174754.384 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1000 -   9: base_cgroup: /
lxc 20191029174754.384 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1001 -       mountpoint:  /sys/fs/cgroup/pids
lxc 20191029174754.384 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1002 -       controllers:
lxc 20191029174754.384 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1004 -       0: pids
lxc 20191029174754.384 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1000 -   10: base_cgroup: /
lxc 20191029174754.384 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1001 -       mountpoint:  /sys/fs/cgroup/memory
lxc 20191029174754.384 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1002 -       controllers:
lxc 20191029174754.384 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1004 -       0: memory
lxc 20191029174754.384 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1000 -   11: base_cgroup: /
lxc 20191029174754.384 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1001 -       mountpoint:  /sys/fs/cgroup/blkio
lxc 20191029174754.384 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1002 -       controllers:
lxc 20191029174754.384 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1004 -       0: blkio
lxc 20191029174754.384 TRACE    cgroup - cgroups/cgroup.c:cgroup_init:56 - Initialized cgroup driver cgfsng
lxc 20191029174754.384 TRACE    cgroup - cgroups/cgroup.c:cgroup_init:61 - Running with hybrid cgroup layout
lxc 20191029174754.384 TRACE    start - start.c:lxc_init:917 - Initialized cgroup driver
lxc 20191029174754.384 INFO     start - start.c:lxc_init:919 - Container "lxc-test" is initialized
lxc 20191029174754.385 TRACE    cgfsng - cgroups/cgfsng.c:cg_legacy_handle_cpuset_hierarchy:612 - "cgroup.clone_children" was already set to "1"
lxc 20191029174754.385 INFO     cgfsng - cgroups/cgfsng.c:cgfsng_monitor_create:1401 - The monitor process uses "lxc.monitor/lxc-test" as cgroup
lxc 20191029174754.386 TRACE    cgfsng - cgroups/cgfsng.c:cg_legacy_handle_cpuset_hierarchy:612 - "cgroup.clone_children" was already set to "1"
lxc 20191029174754.386 INFO     cgfsng - cgroups/cgfsng.c:cgfsng_payload_create:1466 - The container process uses "lxc.payload/lxc-test" as cgroup
lxc 20191029174754.387 TRACE    start - start.c:lxc_spawn:1740 - Cloned child process 13326
lxc 20191029174754.387 INFO     start - start.c:lxc_spawn:1750 - Cloned CLONE_NEWNS
lxc 20191029174754.387 INFO     start - start.c:lxc_spawn:1750 - Cloned CLONE_NEWPID
lxc 20191029174754.387 INFO     start - start.c:lxc_spawn:1750 - Cloned CLONE_NEWUTS
lxc 20191029174754.387 INFO     start - start.c:lxc_spawn:1750 - Cloned CLONE_NEWIPC
lxc 20191029174754.387 INFO     start - start.c:lxc_spawn:1750 - Cloned CLONE_NEWNET
lxc 20191029174754.387 DEBUG    start - start.c:lxc_try_preserve_namespaces:192 - Preserved mnt namespace via fd 17
lxc 20191029174754.387 DEBUG    start - start.c:lxc_try_preserve_namespaces:192 - Preserved pid namespace via fd 18
lxc 20191029174754.387 DEBUG    start - start.c:lxc_try_preserve_namespaces:192 - Preserved uts namespace via fd 19
lxc 20191029174754.387 DEBUG    start - start.c:lxc_try_preserve_namespaces:192 - Preserved ipc namespace via fd 20
lxc 20191029174754.387 DEBUG    start - start.c:lxc_try_preserve_namespaces:192 - Preserved net namespace via fd 21
lxc 20191029174754.387 TRACE    start - start.c:lxc_spawn:1812 - Allocated new network namespace id
lxc 20191029174754.388 INFO     start - start.c:do_start:1279 - Unshared CLONE_NEWCGROUP
lxc 20191029174754.388 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/" as MS_SLAVE
lxc 20191029174754.388 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/sys" as MS_SLAVE
lxc 20191029174754.388 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/sys/kernel/security" as MS_SLAVE
lxc 20191029174754.388 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/sys/fs/cgroup" as MS_SLAVE
lxc 20191029174754.388 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/sys/fs/cgroup/unified" as MS_SLAVE
lxc 20191029174754.388 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/sys/fs/cgroup/systemd" as MS_SLAVE
lxc 20191029174754.388 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/sys/fs/cgroup/net_cls,net_prio" as MS_SLAVE
lxc 20191029174754.388 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/sys/fs/cgroup/devices" as MS_SLAVE
lxc 20191029174754.388 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/sys/fs/cgroup/cpuset" as MS_SLAVE
lxc 20191029174754.388 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/sys/fs/cgroup/hugetlb" as MS_SLAVE
lxc 20191029174754.388 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/sys/fs/cgroup/perf_event" as MS_SLAVE
lxc 20191029174754.388 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/sys/fs/cgroup/freezer" as MS_SLAVE
lxc 20191029174754.388 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/sys/fs/cgroup/cpu,cpuacct" as MS_SLAVE
lxc 20191029174754.388 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/sys/fs/cgroup/pids" as MS_SLAVE
lxc 20191029174754.388 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/sys/fs/cgroup/memory" as MS_SLAVE
lxc 20191029174754.388 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/sys/fs/cgroup/blkio" as MS_SLAVE
lxc 20191029174754.388 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/sys/fs/pstore" as MS_SLAVE
lxc 20191029174754.388 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/sys/fs/bpf" as MS_SLAVE
lxc 20191029174754.388 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/sys/kernel/config" as MS_SLAVE
lxc 20191029174754.388 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/sys/fs/selinux" as MS_SLAVE
lxc 20191029174754.388 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/sys/kernel/debug" as MS_SLAVE
lxc 20191029174754.388 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/dev" as MS_SLAVE
lxc 20191029174754.388 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/dev/shm" as MS_SLAVE
lxc 20191029174754.388 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/dev/pts" as MS_SLAVE
lxc 20191029174754.388 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/dev/mqueue" as MS_SLAVE
lxc 20191029174754.388 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/dev/hugepages" as MS_SLAVE
lxc 20191029174754.388 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/run" as MS_SLAVE
lxc 20191029174754.388 ERROR    conf - conf.c:remount_all_slave:3292 - Permission denied - Failed to make "/run/docker/netns/290a8fe74e1a" MS_SLAVE
lxc 20191029174754.388 ERROR    conf - conf.c:remount_all_slave:3293 - Continuing...
lxc 20191029174754.388 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/run/user/1000" as MS_SLAVE
lxc 20191029174754.388 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/proc" as MS_SLAVE
lxc 20191029174754.388 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/proc/sys/fs/binfmt_misc" as MS_SLAVE
lxc 20191029174754.388 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/tmp" as MS_SLAVE
lxc 20191029174754.388 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/boot" as MS_SLAVE
lxc 20191029174754.388 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/var/lib/nfs/rpc_pipefs" as MS_SLAVE
lxc 20191029174754.388 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/var/lib/docker/overlay2/42d542e2d16fad4f64956b2cb89ed602f7c28596a258813642548bbd48d1092c/merged" as MS_SLAVE
lxc 20191029174754.388 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/var/lib/docker/containers/649bb41d31873bed500006a91b2b98660ea921a09e4dee4fdbb106da286e31a8/mounts/shm" as MS_SLAVE
lxc 20191029174754.388 TRACE    conf - conf.c:remount_all_slave:3298 - Remounted all mount table entries as MS_SLAVE
lxc 20191029174754.388 TRACE    network - network.c:lxc_network_send_name_and_ifindex_to_parent:3262 - Sent network device names and ifindices to parent
lxc 20191029174754.388 INFO     conf - conf.c:mount_autodev:1120 - Preparing "/dev"
lxc 20191029174754.388 TRACE    conf - conf.c:mount_autodev:1144 - Mounted tmpfs on "/dev"
lxc 20191029174754.388 INFO     conf - conf.c:mount_autodev:1167 - Prepared "/dev"
lxc 20191029174754.388 INFO     conf - conf.c:lxc_fill_autodev:1211 - Populating "/dev"
lxc 20191029174754.389 DEBUG    conf - conf.c:lxc_fill_autodev:1226 - Created device node "/dev/full"
lxc 20191029174754.389 DEBUG    conf - conf.c:lxc_fill_autodev:1226 - Created device node "/dev/null"
lxc 20191029174754.389 DEBUG    conf - conf.c:lxc_fill_autodev:1226 - Created device node "/dev/random"
lxc 20191029174754.389 DEBUG    conf - conf.c:lxc_fill_autodev:1226 - Created device node "/dev/tty"
lxc 20191029174754.389 DEBUG    conf - conf.c:lxc_fill_autodev:1226 - Created device node "/dev/urandom"
lxc 20191029174754.389 DEBUG    conf - conf.c:lxc_fill_autodev:1226 - Created device node "/dev/zero"
lxc 20191029174754.389 INFO     conf - conf.c:lxc_fill_autodev:1288 - Populated "/dev"
lxc 20191029174754.389 ERROR    utils - utils.c:safe_mount:1204 - No such file or directory - Failed to mount "/dev/pts/2" onto "/dev/console"
lxc 20191029174754.389 ERROR    conf - conf.c:lxc_setup_dev_console:1746 - Failed to mount "/dev/pts/2" on "/dev/console"
lxc 20191029174754.389 ERROR    conf - conf.c:lxc_setup:3623 - Failed to setup console
lxc 20191029174754.389 ERROR    start - start.c:do_start:1299 - Failed to setup container "lxc-test"
lxc 20191029174754.389 ERROR    sync - sync.c:__sync_wait:61 - An error occurred in another process (expected sequence number 5)
lxc 20191029174754.389 DEBUG    network - network.c:lxc_delete_network:3308 - Deleted network devices
lxc 20191029174754.389 TRACE    start - start.c:lxc_serve_state_socket_pair:543 - Sent container state "ABORTING" to 5
lxc 20191029174754.389 TRACE    start - start.c:lxc_serve_state_clients:474 - Set container state to ABORTING
lxc 20191029174754.389 TRACE    start - start.c:lxc_serve_state_clients:477 - No state clients registered
lxc 20191029174754.389 ERROR    start - start.c:lxc_abort:1103 - No such file or directory - Failed to send SIGKILL to 13326
lxc 20191029174754.389 DEBUG    lxccontainer - lxccontainer.c:wait_on_daemonized_start:839 - First child 13324 exited
lxc 20191029174754.389 ERROR    lxccontainer - lxccontainer.c:wait_on_daemonized_start:850 - Received container state "ABORTING" instead of "RUNNING"
lxc 20191029174754.389 ERROR    start - start.c:__lxc_start:2019 - Failed to spawn container "lxc-test"
lxc 20191029174754.389 TRACE    start - start.c:lxc_serve_state_clients:474 - Set container state to STOPPING
lxc 20191029174754.389 TRACE    start - start.c:lxc_serve_state_clients:477 - No state clients registered
lxc 20191029174754.390 TRACE    cgfsng - cgroups/cgfsng.c:cg_legacy_handle_cpuset_hierarchy:612 - "cgroup.clone_children" was already set to "1"
lxc 20191029174754.391 TRACE    start - start.c:lxc_fini:1024 - Closed command socket
lxc 20191029174754.391 TRACE    start - start.c:lxc_fini:1035 - Set container state to "STOPPED"

Still getting the same error: ERROR conf - conf.c:lxc_setup_dev_console:1746 - Failed to mount "/dev/pts/2" on "/dev/console". I'll read more about the config file and try to understand what I need to change to fix this.

adam-hanna commented 5 years ago

Ok, now I'm getting something slightly different. I added the following line to be sure it was loading the default config: c.LoadConfigFile("/etc/lxc/default.conf"). Which is strange, because now I'm getting a different output from log.Println(lxc.DefaultConfigPath()): /var/lib/lxc.

Now, I'm getting an error about creating namespaces:

$ go build
$ sudo ./lxc-test
2019/10/29 17:53:48 /var/lib/lxc
2019/10/29 17:53:48 Starting the container...
2019/10/29 17:53:48 ERROR starting the container: starting the container failed

$ sudo cat lxc-test.log
lxc lxc-test 20191029175348.680 TRACE    commands - commands.c:lxc_cmd:302 - Connection refused - Command "get_state" failed to connect command socket
lxc lxc-test 20191029175348.680 TRACE    start - start.c:lxc_init_handler:766 - Created anonymous pair {4,5} of unix sockets
lxc lxc-test 20191029175348.680 TRACE    commands - commands.c:lxc_cmd_init:1273 - Created abstract unix socket "/var/lib/lxc/lxc-test/command"
lxc lxc-test 20191029175348.680 TRACE    start - start.c:lxc_init_handler:779 - Unix domain socket 6 for command server is ready
lxc lxc-test 20191029175348.680 INFO     lxccontainer - lxccontainer.c:do_lxcapi_start:971 - Set process title to [lxc monitor] /var/lib/lxc lxc-test
lxc lxc-test 20191029175348.681 TRACE    start - start.c:lxc_start:2128 - Doing lxc_start
lxc lxc-test 20191029175348.681 INFO     lsm - lsm/lsm.c:lsm_init:50 - LSM security driver SELinux
lxc lxc-test 20191029175348.681 TRACE    start - start.c:lxc_init:799 - Initialized LSM
lxc lxc-test 20191029175348.681 TRACE    start - start.c:lxc_init:806 - Read seccomp policy
lxc lxc-test 20191029175348.681 TRACE    start - start.c:lxc_serve_state_clients:474 - Set container state to STARTING
lxc lxc-test 20191029175348.681 TRACE    start - start.c:lxc_serve_state_clients:477 - No state clients registered
lxc lxc-test 20191029175348.681 TRACE    start - start.c:lxc_init:814 - Set container state to "STARTING"
lxc lxc-test 20191029175348.681 TRACE    start - start.c:lxc_init:877 - Set environment variables
lxc lxc-test 20191029175348.681 TRACE    start - start.c:lxc_init:884 - Ran pre-start hooks
lxc lxc-test 20191029175348.681 TRACE    start - start.c:setup_signal_fd:356 - Created signal file descriptor 7
lxc lxc-test 20191029175348.681 TRACE    start - start.c:lxc_init:895 - Set up signal fd
lxc lxc-test 20191029175348.682 DEBUG    terminal - terminal.c:lxc_terminal_peer_default:676 - No such device - The process does not have a controlling terminal
lxc lxc-test 20191029175348.682 TRACE    start - start.c:lxc_init:903 - Created console
lxc lxc-test 20191029175348.682 TRACE    start - start.c:lxc_init:910 - Chowned console
lxc lxc-test 20191029175348.682 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1014 - basecginfo is:
lxc lxc-test 20191029175348.682 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1015 - 11:blkio:/init.scope
10:memory:/init.scope
9:pids:/init.scope
8:cpu,cpuacct:/init.scope
7:freezer:/
6:perf_event:/
5:hugetlb:/
4:cpuset:/
3:devices:/init.scope
2:net_cls,net_prio:/
1:name=systemd:/init.scope
0::/init.scope

lxc lxc-test 20191029175348.682 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1018 - kernel subsystem 0: blkio
lxc lxc-test 20191029175348.682 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1018 - kernel subsystem 1: memory
lxc lxc-test 20191029175348.682 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1018 - kernel subsystem 2: pids
lxc lxc-test 20191029175348.682 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1018 - kernel subsystem 3: cpu
lxc lxc-test 20191029175348.682 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1018 - kernel subsystem 4: cpuacct
lxc lxc-test 20191029175348.682 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1018 - kernel subsystem 5: freezer
lxc lxc-test 20191029175348.682 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1018 - kernel subsystem 6: perf_event
lxc lxc-test 20191029175348.682 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1018 - kernel subsystem 7: hugetlb
lxc lxc-test 20191029175348.682 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1018 - kernel subsystem 8: cpuset
lxc lxc-test 20191029175348.682 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1018 - kernel subsystem 9: devices
lxc lxc-test 20191029175348.682 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1018 - kernel subsystem 10: net_cls
lxc lxc-test 20191029175348.682 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1018 - kernel subsystem 11: net_prio
lxc lxc-test 20191029175348.682 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1018 - kernel subsystem 12: cgroup2
lxc lxc-test 20191029175348.682 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1021 - named subsystem 0: name=systemd
lxc lxc-test 20191029175348.682 TRACE    cgfsng - cgroups/cgfsng.c:cg_hybrid_init:2568 - No controllers are enabled for delegation in the unified hierarchy
lxc lxc-test 20191029175348.682 TRACE    cgfsng - cgroups/cgfsng.c:cg_hybrid_init:2595 - Writable cgroup hierarchies:
lxc lxc-test 20191029175348.682 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:995 -   Hierarchies:
lxc lxc-test 20191029175348.682 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1000 -   0: base_cgroup: /
lxc lxc-test 20191029175348.682 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1001 -       mountpoint:  /sys/fs/cgroup/unified
lxc lxc-test 20191029175348.682 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1002 -       controllers:
lxc lxc-test 20191029175348.682 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1000 -   1: base_cgroup: /
lxc lxc-test 20191029175348.682 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1001 -       mountpoint:  /sys/fs/cgroup/systemd
lxc lxc-test 20191029175348.682 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1002 -       controllers:
lxc lxc-test 20191029175348.682 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1004 -       0: name=systemd
lxc lxc-test 20191029175348.682 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1000 -   2: base_cgroup: /
lxc lxc-test 20191029175348.682 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1001 -       mountpoint:  /sys/fs/cgroup/net_cls,net_prio
lxc lxc-test 20191029175348.682 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1002 -       controllers:
lxc lxc-test 20191029175348.682 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1004 -       0: net_cls
lxc lxc-test 20191029175348.682 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1004 -       1: net_prio
lxc lxc-test 20191029175348.682 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1000 -   3: base_cgroup: /
lxc lxc-test 20191029175348.682 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1001 -       mountpoint:  /sys/fs/cgroup/devices
lxc lxc-test 20191029175348.682 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1002 -       controllers:
lxc lxc-test 20191029175348.682 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1004 -       0: devices
lxc lxc-test 20191029175348.682 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1000 -   4: base_cgroup: /
lxc lxc-test 20191029175348.682 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1001 -       mountpoint:  /sys/fs/cgroup/cpuset
lxc lxc-test 20191029175348.682 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1002 -       controllers:
lxc lxc-test 20191029175348.682 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1004 -       0: cpuset
lxc lxc-test 20191029175348.682 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1000 -   5: base_cgroup: /
lxc lxc-test 20191029175348.682 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1001 -       mountpoint:  /sys/fs/cgroup/hugetlb
lxc lxc-test 20191029175348.682 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1002 -       controllers:
lxc lxc-test 20191029175348.682 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1004 -       0: hugetlb
lxc lxc-test 20191029175348.682 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1000 -   6: base_cgroup: /
lxc lxc-test 20191029175348.682 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1001 -       mountpoint:  /sys/fs/cgroup/perf_event
lxc lxc-test 20191029175348.682 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1002 -       controllers:
lxc lxc-test 20191029175348.682 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1004 -       0: perf_event
lxc lxc-test 20191029175348.682 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1000 -   7: base_cgroup: /
lxc lxc-test 20191029175348.682 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1001 -       mountpoint:  /sys/fs/cgroup/freezer
lxc lxc-test 20191029175348.682 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1002 -       controllers:
lxc lxc-test 20191029175348.682 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1004 -       0: freezer
lxc lxc-test 20191029175348.682 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1000 -   8: base_cgroup: /
lxc lxc-test 20191029175348.682 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1001 -       mountpoint:  /sys/fs/cgroup/cpu,cpuacct
lxc lxc-test 20191029175348.682 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1002 -       controllers:
lxc lxc-test 20191029175348.682 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1004 -       0: cpu
lxc lxc-test 20191029175348.682 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1004 -       1: cpuacct
lxc lxc-test 20191029175348.682 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1000 -   9: base_cgroup: /
lxc lxc-test 20191029175348.682 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1001 -       mountpoint:  /sys/fs/cgroup/pids
lxc lxc-test 20191029175348.682 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1002 -       controllers:
lxc lxc-test 20191029175348.682 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1004 -       0: pids
lxc lxc-test 20191029175348.682 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1000 -   10: base_cgroup: /
lxc lxc-test 20191029175348.682 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1001 -       mountpoint:  /sys/fs/cgroup/memory
lxc lxc-test 20191029175348.682 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1002 -       controllers:
lxc lxc-test 20191029175348.682 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1004 -       0: memory
lxc lxc-test 20191029175348.682 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1000 -   11: base_cgroup: /
lxc lxc-test 20191029175348.682 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1001 -       mountpoint:  /sys/fs/cgroup/blkio
lxc lxc-test 20191029175348.682 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1002 -       controllers:
lxc lxc-test 20191029175348.682 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1004 -       0: blkio
lxc lxc-test 20191029175348.682 TRACE    cgroup - cgroups/cgroup.c:cgroup_init:56 - Initialized cgroup driver cgfsng
lxc lxc-test 20191029175348.682 TRACE    cgroup - cgroups/cgroup.c:cgroup_init:61 - Running with hybrid cgroup layout
lxc lxc-test 20191029175348.682 TRACE    start - start.c:lxc_init:917 - Initialized cgroup driver
lxc lxc-test 20191029175348.682 INFO     start - start.c:lxc_init:919 - Container "lxc-test" is initialized
lxc lxc-test 20191029175348.683 TRACE    cgfsng - cgroups/cgfsng.c:cg_legacy_handle_cpuset_hierarchy:612 - "cgroup.clone_children" was already set to "1"
lxc lxc-test 20191029175348.683 INFO     cgfsng - cgroups/cgfsng.c:cgfsng_monitor_create:1401 - The monitor process uses "lxc.monitor/lxc-test" as cgroup
lxc lxc-test 20191029175348.691 INFO     network - network.c:instantiate_veth:151 - Retrieved mtu 1500 from vethR0SO2L
lxc lxc-test 20191029175348.692 ERROR    utils - utils.c:run_command_internal:1648 - Failed to exec command
lxc lxc-test 20191029175348.692 ERROR    network - network.c:lxc_ovs_attach_bridge:2007 - Failed to attach "lxcbr0" to openvswitch bridge "vethT7HGX0": 
lxc lxc-test 20191029175348.692 ERROR    network - network.c:instantiate_veth:172 - Operation not permitted - Failed to attach "vethT7HGX0" to bridge "lxcbr0"
lxc lxc-test 20191029175348.698 ERROR    network - network.c:lxc_create_network_priv:2577 - Failed to create network device
lxc lxc-test 20191029175348.698 ERROR    start - start.c:lxc_spawn:1682 - Failed to create the network
lxc lxc-test 20191029175348.698 INFO     network - network.c:lxc_delete_network_priv:2719 - Interface "(null)" with index 11 already deleted or existing in different network namespace
lxc lxc-test 20191029175348.698 INFO     network - network.c:lxc_delete_network_priv:2723 - Removed interface "(null)" with index 11
lxc lxc-test 20191029175348.701 WARN     network - network.c:lxc_delete_network_priv:2742 - Failed to remove interface "vethT7HGX0" from "lxcbr0"
lxc lxc-test 20191029175348.701 DEBUG    network - network.c:lxc_delete_network:3308 - Deleted network devices
lxc lxc-test 20191029175348.701 TRACE    start - start.c:lxc_serve_state_socket_pair:543 - Sent container state "ABORTING" to 5
lxc lxc-test 20191029175348.701 TRACE    start - start.c:lxc_serve_state_clients:474 - Set container state to ABORTING
lxc lxc-test 20191029175348.701 TRACE    start - start.c:lxc_serve_state_clients:477 - No state clients registered
lxc lxc-test 20191029175348.701 ERROR    start - start.c:__lxc_start:2019 - Failed to spawn container "lxc-test"
lxc lxc-test 20191029175348.701 TRACE    start - start.c:lxc_serve_state_clients:474 - Set container state to STOPPING
lxc lxc-test 20191029175348.701 TRACE    start - start.c:lxc_serve_state_clients:477 - No state clients registered
lxc lxc-test 20191029175348.701 DEBUG    lxccontainer - lxccontainer.c:wait_on_daemonized_start:839 - First child 16978 exited
lxc lxc-test 20191029175348.701 ERROR    lxccontainer - lxccontainer.c:wait_on_daemonized_start:850 - Received container state "ABORTING" instead of "RUNNING"
lxc lxc-test 20191029175348.701 TRACE    cgfsng - cgroups/cgfsng.c:cg_legacy_handle_cpuset_hierarchy:612 - "cgroup.clone_children" was already set to "1"
lxc lxc-test 20191029175348.702 TRACE    start - start.c:lxc_fini:1024 - Closed command socket
lxc lxc-test 20191029175348.702 TRACE    start - start.c:lxc_fini:1035 - Set container state to "STOPPED"

These are the important bits...

lxc lxc-test 20191029175348.692 ERROR    utils - utils.c:run_command_internal:1648 - Failed to exec command
lxc lxc-test 20191029175348.692 ERROR    network - network.c:lxc_ovs_attach_bridge:2007 - Failed to attach "lxcbr0" to openvswitch bridge "vethT7HGX0":
lxc lxc-test 20191029175348.692 ERROR    network - network.c:instantiate_veth:172 - Operation not permitted - Failed to attach "vethT7HGX0" to bridge "lxcbr0"
lxc lxc-test 20191029175348.698 ERROR    network - network.c:lxc_create_network_priv:2577 - Failed to create network device
lxc lxc-test 20191029175348.698 ERROR    start - start.c:lxc_spawn:1682 - Failed to create the network
lxc lxc-test 20191029175348.698 INFO     network - network.c:lxc_delete_network_priv:2719 - Interface "(null)" with index 11 already deleted or existing in different network namespace
lxc lxc-test 20191029175348.698 INFO     network - network.c:lxc_delete_network_priv:2723 - Removed interface "(null)" with index 11
adam-hanna commented 5 years ago

ok, more progress. I still can't seem to use networking, even as root.

Here's my config file, now:

lxc.mount.entry = /usr/sbin/init.lxc usr/sbin/init.lxc none ro,bind 0 0
lxc.cgroup.devices.allow = c 10:200 rwm

lxc.net.0.type = empty
lxc.rootfs.path = dir:/var/lib/lxc/arch1/rootfs
lxc.uts.name = arch1
lxc.arch = x86_64

## network
lxc.net.0.type = none

Here's the log file, now:

lxc lxc-test 20191101031336.842 TRACE    commands - commands.c:lxc_cmd:302 - Connection refused - Command "get_state" failed to connect command socket
lxc lxc-test 20191101031336.842 TRACE    start - start.c:lxc_init_handler:766 - Created anonymous pair {4,5} of unix sockets
lxc lxc-test 20191101031336.842 TRACE    commands - commands.c:lxc_cmd_init:1273 - Created abstract unix socket "/var/lib/lxc/lxc-test/command"
lxc lxc-test 20191101031336.842 TRACE    start - start.c:lxc_init_handler:779 - Unix domain socket 6 for command server is ready
lxc lxc-test 20191101031336.843 INFO     lxccontainer - lxccontainer.c:do_lxcapi_start:971 - Set process title to [lxc monitor] /var/lib/lxc lxc-test
lxc lxc-test 20191101031336.843 TRACE    start - start.c:lxc_start:2128 - Doing lxc_start
lxc lxc-test 20191101031336.843 INFO     lsm - lsm/lsm.c:lsm_init:50 - LSM security driver SELinux
lxc lxc-test 20191101031336.843 TRACE    start - start.c:lxc_init:799 - Initialized LSM
lxc lxc-test 20191101031336.843 TRACE    start - start.c:lxc_init:806 - Read seccomp policy
lxc lxc-test 20191101031336.843 TRACE    start - start.c:lxc_serve_state_clients:474 - Set container state to STARTING
lxc lxc-test 20191101031336.843 TRACE    start - start.c:lxc_serve_state_clients:477 - No state clients registered
lxc lxc-test 20191101031336.843 TRACE    start - start.c:lxc_init:814 - Set container state to "STARTING"
lxc lxc-test 20191101031336.844 TRACE    start - start.c:lxc_init:877 - Set environment variables
lxc lxc-test 20191101031336.844 TRACE    start - start.c:lxc_init:884 - Ran pre-start hooks
lxc lxc-test 20191101031336.844 TRACE    start - start.c:setup_signal_fd:356 - Created signal file descriptor 7
lxc lxc-test 20191101031336.844 TRACE    start - start.c:lxc_init:895 - Set up signal fd
lxc lxc-test 20191101031336.844 DEBUG    terminal - terminal.c:lxc_terminal_peer_default:676 - No such device - The process does not have a controlling terminal
lxc lxc-test 20191101031336.844 TRACE    start - start.c:lxc_init:903 - Created console
lxc lxc-test 20191101031336.844 TRACE    start - start.c:lxc_init:910 - Chowned console
lxc lxc-test 20191101031336.844 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1014 - basecginfo is:
lxc lxc-test 20191101031336.844 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1015 - 11:cpuset:/
10:net_cls,net_prio:/
9:pids:/init.scope
8:devices:/init.scope
7:hugetlb:/
6:blkio:/init.scope
5:perf_event:/
4:cpu,cpuacct:/init.scope
3:freezer:/
2:memory:/init.scope
1:name=systemd:/init.scope
0::/init.scope

lxc lxc-test 20191101031336.844 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1018 - kernel subsystem 0: cpuset
lxc lxc-test 20191101031336.844 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1018 - kernel subsystem 1: net_cls
lxc lxc-test 20191101031336.844 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1018 - kernel subsystem 2: net_prio
lxc lxc-test 20191101031336.844 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1018 - kernel subsystem 3: pids
lxc lxc-test 20191101031336.844 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1018 - kernel subsystem 4: devices
lxc lxc-test 20191101031336.844 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1018 - kernel subsystem 5: hugetlb
lxc lxc-test 20191101031336.844 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1018 - kernel subsystem 6: blkio
lxc lxc-test 20191101031336.844 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1018 - kernel subsystem 7: perf_event
lxc lxc-test 20191101031336.844 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1018 - kernel subsystem 8: cpu
lxc lxc-test 20191101031336.844 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1018 - kernel subsystem 9: cpuacct
lxc lxc-test 20191101031336.844 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1018 - kernel subsystem 10: freezer
lxc lxc-test 20191101031336.844 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1018 - kernel subsystem 11: memory
lxc lxc-test 20191101031336.844 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1018 - kernel subsystem 12: cgroup2
lxc lxc-test 20191101031336.844 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_basecg_debuginfo:1021 - named subsystem 0: name=systemd
lxc lxc-test 20191101031336.844 TRACE    cgfsng - cgroups/cgfsng.c:cg_hybrid_init:2568 - No controllers are enabled for delegation in the unified hierarchy
lxc lxc-test 20191101031336.845 TRACE    cgfsng - cgroups/cgfsng.c:cg_hybrid_init:2595 - Writable cgroup hierarchies:
lxc lxc-test 20191101031336.845 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:995 -   Hierarchies:
lxc lxc-test 20191101031336.845 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1000 -   0: base_cgroup: /
lxc lxc-test 20191101031336.845 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1001 -       mountpoint:  /sys/fs/cgroup/unified
lxc lxc-test 20191101031336.845 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1002 -       controllers:
lxc lxc-test 20191101031336.845 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1000 -   1: base_cgroup: /
lxc lxc-test 20191101031336.845 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1001 -       mountpoint:  /sys/fs/cgroup/systemd
lxc lxc-test 20191101031336.845 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1002 -       controllers:
lxc lxc-test 20191101031336.845 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1004 -       0: name=systemd
lxc lxc-test 20191101031336.845 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1000 -   2: base_cgroup: /
lxc lxc-test 20191101031336.845 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1001 -       mountpoint:  /sys/fs/cgroup/memory
lxc lxc-test 20191101031336.845 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1002 -       controllers:
lxc lxc-test 20191101031336.845 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1004 -       0: memory
lxc lxc-test 20191101031336.845 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1000 -   3: base_cgroup: /
lxc lxc-test 20191101031336.845 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1001 -       mountpoint:  /sys/fs/cgroup/freezer
lxc lxc-test 20191101031336.845 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1002 -       controllers:
lxc lxc-test 20191101031336.845 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1004 -       0: freezer
lxc lxc-test 20191101031336.845 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1000 -   4: base_cgroup: /
lxc lxc-test 20191101031336.845 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1001 -       mountpoint:  /sys/fs/cgroup/cpu,cpuacct
lxc lxc-test 20191101031336.845 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1002 -       controllers:
lxc lxc-test 20191101031336.845 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1004 -       0: cpu
lxc lxc-test 20191101031336.845 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1004 -       1: cpuacct
lxc lxc-test 20191101031336.845 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1000 -   5: base_cgroup: /
lxc lxc-test 20191101031336.845 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1001 -       mountpoint:  /sys/fs/cgroup/perf_event
lxc lxc-test 20191101031336.845 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1002 -       controllers:
lxc lxc-test 20191101031336.845 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1004 -       0: perf_event
lxc lxc-test 20191101031336.845 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1000 -   6: base_cgroup: /
lxc lxc-test 20191101031336.845 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1001 -       mountpoint:  /sys/fs/cgroup/blkio
lxc lxc-test 20191101031336.845 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1002 -       controllers:
lxc lxc-test 20191101031336.845 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1004 -       0: blkio
lxc lxc-test 20191101031336.845 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1000 -   7: base_cgroup: /
lxc lxc-test 20191101031336.845 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1001 -       mountpoint:  /sys/fs/cgroup/hugetlb
lxc lxc-test 20191101031336.845 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1002 -       controllers:
lxc lxc-test 20191101031336.845 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1004 -       0: hugetlb
lxc lxc-test 20191101031336.845 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1000 -   8: base_cgroup: /
lxc lxc-test 20191101031336.845 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1001 -       mountpoint:  /sys/fs/cgroup/devices
lxc lxc-test 20191101031336.845 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1002 -       controllers:
lxc lxc-test 20191101031336.845 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1004 -       0: devices
lxc lxc-test 20191101031336.845 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1000 -   9: base_cgroup: /
lxc lxc-test 20191101031336.845 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1001 -       mountpoint:  /sys/fs/cgroup/pids
lxc lxc-test 20191101031336.845 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1002 -       controllers:
lxc lxc-test 20191101031336.845 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1004 -       0: pids
lxc lxc-test 20191101031336.845 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1000 -   10: base_cgroup: /
lxc lxc-test 20191101031336.845 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1001 -       mountpoint:  /sys/fs/cgroup/net_cls,net_prio
lxc lxc-test 20191101031336.845 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1002 -       controllers:
lxc lxc-test 20191101031336.845 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1004 -       0: net_cls
lxc lxc-test 20191101031336.845 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1004 -       1: net_prio
lxc lxc-test 20191101031336.845 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1000 -   11: base_cgroup: /
lxc lxc-test 20191101031336.845 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1001 -       mountpoint:  /sys/fs/cgroup/cpuset
lxc lxc-test 20191101031336.845 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1002 -       controllers:
lxc lxc-test 20191101031336.845 TRACE    cgfsng - cgroups/cgfsng.c:lxc_cgfsng_print_hierarchies:1004 -       0: cpuset
lxc lxc-test 20191101031336.845 TRACE    cgroup - cgroups/cgroup.c:cgroup_init:56 - Initialized cgroup driver cgfsng
lxc lxc-test 20191101031336.845 TRACE    cgroup - cgroups/cgroup.c:cgroup_init:61 - Running with hybrid cgroup layout
lxc lxc-test 20191101031336.845 TRACE    start - start.c:lxc_init:917 - Initialized cgroup driver
lxc lxc-test 20191101031336.845 INFO     start - start.c:lxc_init:919 - Container "lxc-test" is initialized
lxc lxc-test 20191101031336.845 TRACE    cgfsng - cgroups/cgfsng.c:cg_legacy_handle_cpuset_hierarchy:612 - "cgroup.clone_children" was already set to "1"
lxc lxc-test 20191101031336.845 INFO     cgfsng - cgroups/cgfsng.c:cgfsng_monitor_create:1401 - The monitor process uses "lxc.monitor/lxc-test" as cgroup
lxc lxc-test 20191101031336.847 TRACE    cgfsng - cgroups/cgfsng.c:cg_legacy_handle_cpuset_hierarchy:612 - "cgroup.clone_children" was already set to "1"
lxc lxc-test 20191101031336.848 INFO     cgfsng - cgroups/cgfsng.c:cgfsng_payload_create:1466 - The container process uses "lxc.payload/lxc-test" as cgroup
lxc lxc-test 20191101031336.848 TRACE    start - start.c:lxc_spawn:1740 - Cloned child process 11657
lxc lxc-test 20191101031336.848 INFO     start - start.c:lxc_spawn:1750 - Cloned CLONE_NEWNS
lxc lxc-test 20191101031336.848 INFO     start - start.c:lxc_spawn:1750 - Cloned CLONE_NEWPID
lxc lxc-test 20191101031336.848 INFO     start - start.c:lxc_spawn:1750 - Cloned CLONE_NEWUTS
lxc lxc-test 20191101031336.848 INFO     start - start.c:lxc_spawn:1750 - Cloned CLONE_NEWIPC
lxc lxc-test 20191101031336.848 DEBUG    start - start.c:lxc_try_preserve_namespaces:192 - Preserved mnt namespace via fd 17
lxc lxc-test 20191101031336.848 DEBUG    start - start.c:lxc_try_preserve_namespaces:192 - Preserved pid namespace via fd 18
lxc lxc-test 20191101031336.848 DEBUG    start - start.c:lxc_try_preserve_namespaces:192 - Preserved uts namespace via fd 19
lxc lxc-test 20191101031336.848 DEBUG    start - start.c:lxc_try_preserve_namespaces:192 - Preserved ipc namespace via fd 20
lxc lxc-test 20191101031336.848 INFO     cgfsng - cgroups/cgfsng.c:__cg_legacy_setup_limits:2351 - Limits for the legacy cgroup hierarchies have been setup
lxc lxc-test 20191101031336.849 DEBUG    start - start.c:lxc_spawn:1805 - Preserved net namespace via fd 11
lxc lxc-test 20191101031336.849 WARN     start - start.c:lxc_spawn:1810 - File exists - Failed to allocate new network namespace id
lxc lxc-test 20191101031336.849 INFO     start - start.c:do_start:1279 - Unshared CLONE_NEWCGROUP
lxc lxc-test 20191101031336.850 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/" as MS_SLAVE
lxc lxc-test 20191101031336.850 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/sys" as MS_SLAVE
lxc lxc-test 20191101031336.850 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/sys/kernel/security" as MS_SLAVE
lxc lxc-test 20191101031336.850 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/sys/fs/cgroup" as MS_SLAVE
lxc lxc-test 20191101031336.850 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/sys/fs/cgroup/unified" as MS_SLAVE
lxc lxc-test 20191101031336.850 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/sys/fs/cgroup/systemd" as MS_SLAVE
lxc lxc-test 20191101031336.850 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/sys/fs/cgroup/memory" as MS_SLAVE
lxc lxc-test 20191101031336.850 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/sys/fs/cgroup/freezer" as MS_SLAVE
lxc lxc-test 20191101031336.850 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/sys/fs/cgroup/cpu,cpuacct" as MS_SLAVE
lxc lxc-test 20191101031336.850 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/sys/fs/cgroup/perf_event" as MS_SLAVE
lxc lxc-test 20191101031336.850 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/sys/fs/cgroup/blkio" as MS_SLAVE
lxc lxc-test 20191101031336.850 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/sys/fs/cgroup/hugetlb" as MS_SLAVE
lxc lxc-test 20191101031336.850 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/sys/fs/cgroup/devices" as MS_SLAVE
lxc lxc-test 20191101031336.850 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/sys/fs/cgroup/pids" as MS_SLAVE
lxc lxc-test 20191101031336.850 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/sys/fs/cgroup/net_cls,net_prio" as MS_SLAVE
lxc lxc-test 20191101031336.850 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/sys/fs/cgroup/cpuset" as MS_SLAVE
lxc lxc-test 20191101031336.850 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/sys/fs/pstore" as MS_SLAVE
lxc lxc-test 20191101031336.850 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/sys/fs/bpf" as MS_SLAVE
lxc lxc-test 20191101031336.850 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/sys/kernel/config" as MS_SLAVE
lxc lxc-test 20191101031336.850 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/sys/fs/selinux" as MS_SLAVE
lxc lxc-test 20191101031336.850 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/sys/kernel/debug" as MS_SLAVE
lxc lxc-test 20191101031336.850 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/dev" as MS_SLAVE
lxc lxc-test 20191101031336.850 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/dev/shm" as MS_SLAVE
lxc lxc-test 20191101031336.850 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/dev/pts" as MS_SLAVE
lxc lxc-test 20191101031336.850 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/dev/mqueue" as MS_SLAVE
lxc lxc-test 20191101031336.850 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/dev/hugepages" as MS_SLAVE
lxc lxc-test 20191101031336.850 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/run" as MS_SLAVE
lxc lxc-test 20191101031336.850 ERROR    conf - conf.c:remount_all_slave:3292 - Permission denied - Failed to make "/run/docker/netns/38e6a606c75b" MS_SLAVE
lxc lxc-test 20191101031336.850 ERROR    conf - conf.c:remount_all_slave:3293 - Continuing...
lxc lxc-test 20191101031336.850 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/run/user/1000" as MS_SLAVE
lxc lxc-test 20191101031336.850 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/run/netns" as MS_SLAVE
lxc lxc-test 20191101031336.850 ERROR    conf - conf.c:remount_all_slave:3292 - Permission denied - Failed to make "/run/netns/net1" MS_SLAVE
lxc lxc-test 20191101031336.850 ERROR    conf - conf.c:remount_all_slave:3293 - Continuing...
lxc lxc-test 20191101031336.850 ERROR    conf - conf.c:remount_all_slave:3292 - Permission denied - Failed to make "/run/netns/net1" MS_SLAVE
lxc lxc-test 20191101031336.850 ERROR    conf - conf.c:remount_all_slave:3293 - Continuing...
lxc lxc-test 20191101031336.850 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/proc" as MS_SLAVE
lxc lxc-test 20191101031336.850 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/proc/sys/fs/binfmt_misc" as MS_SLAVE
lxc lxc-test 20191101031336.850 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/tmp" as MS_SLAVE
lxc lxc-test 20191101031336.850 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/boot" as MS_SLAVE
lxc lxc-test 20191101031336.850 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/var/lib/nfs/rpc_pipefs" as MS_SLAVE
lxc lxc-test 20191101031336.850 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/var/lib/docker/overlay2/42d542e2d16fad4f64956b2cb89ed602f7c28596a258813642548bbd48d1092c/merged" as MS_SLAVE
lxc lxc-test 20191101031336.850 TRACE    conf - conf.c:remount_all_slave:3296 - Remounted "/var/lib/docker/containers/649bb41d31873bed500006a91b2b98660ea921a09e4dee4fdbb106da286e31a8/mounts/shm" as MS_SLAVE
lxc lxc-test 20191101031336.850 TRACE    conf - conf.c:remount_all_slave:3298 - Remounted all mount table entries as MS_SLAVE
lxc lxc-test 20191101031336.850 DEBUG    storage - storage/storage.c:get_storage_by_name:232 - Detected rootfs type "dir"
lxc lxc-test 20191101031336.850 TRACE    dir - storage/dir.c:dir_mount:203 - Mounted "/var/lib/lxc/arch1/rootfs" on "/usr/lib64/lxc/rootfs"
lxc lxc-test 20191101031336.850 DEBUG    conf - conf.c:lxc_mount_rootfs:1332 - Mounted rootfs "/var/lib/lxc/arch1/rootfs" onto "/usr/lib64/lxc/rootfs" with options "(null)"
lxc lxc-test 20191101031336.850 INFO     conf - conf.c:setup_utsname:793 - Set hostname to "arch1"
lxc lxc-test 20191101031336.850 INFO     network - network.c:lxc_setup_network_in_child_namespaces:3181 - network has been setup
lxc lxc-test 20191101031336.850 TRACE    network - network.c:lxc_network_send_name_and_ifindex_to_parent:3262 - Sent network device names and ifindices to parent
lxc lxc-test 20191101031336.850 INFO     conf - conf.c:mount_autodev:1120 - Preparing "/dev"
lxc lxc-test 20191101031336.850 TRACE    conf - conf.c:mount_autodev:1144 - Mounted tmpfs on "/usr/lib64/lxc/rootfs/dev"
lxc lxc-test 20191101031336.850 INFO     conf - conf.c:mount_autodev:1167 - Prepared "/dev"
lxc lxc-test 20191101031336.850 ERROR    conf - conf.c:mount_entry:1993 - No such file or directory - Failed to mount "/usr/sbin/init.lxc" on "/usr/lib64/lxc/rootfs/usr/sbin/init.lxc"
lxc lxc-test 20191101031336.850 ERROR    conf - conf.c:lxc_setup:3551 - Failed to setup mount entries
lxc lxc-test 20191101031336.850 ERROR    start - start.c:do_start:1299 - Failed to setup container "lxc-test"
lxc lxc-test 20191101031336.850 ERROR    sync - sync.c:__sync_wait:61 - An error occurred in another process (expected sequence number 5)
lxc lxc-test 20191101031336.850 TRACE    start - start.c:lxc_serve_state_socket_pair:543 - Sent container state "ABORTING" to 5
lxc lxc-test 20191101031336.850 TRACE    start - start.c:lxc_serve_state_clients:474 - Set container state to ABORTING
lxc lxc-test 20191101031336.850 TRACE    start - start.c:lxc_serve_state_clients:477 - No state clients registered
lxc lxc-test 20191101031336.850 ERROR    start - start.c:lxc_abort:1103 - No such file or directory - Failed to send SIGKILL to 11657
lxc lxc-test 20191101031336.851 DEBUG    lxccontainer - lxccontainer.c:wait_on_daemonized_start:839 - First child 11655 exited
lxc lxc-test 20191101031336.851 ERROR    lxccontainer - lxccontainer.c:wait_on_daemonized_start:850 - Received container state "ABORTING" instead of "RUNNING"
lxc lxc-test 20191101031336.851 ERROR    start - start.c:__lxc_start:2019 - Failed to spawn container "lxc-test"
lxc lxc-test 20191101031336.851 TRACE    start - start.c:lxc_serve_state_clients:474 - Set container state to STOPPING
lxc lxc-test 20191101031336.851 TRACE    start - start.c:lxc_serve_state_clients:477 - No state clients registered
lxc lxc-test 20191101031336.854 TRACE    cgfsng - cgroups/cgfsng.c:cg_legacy_handle_cpuset_hierarchy:612 - "cgroup.clone_children" was already set to "1"
lxc lxc-test 20191101031336.854 TRACE    start - start.c:lxc_fini:1024 - Closed command socket
lxc lxc-test 20191101031336.854 TRACE    start - start.c:lxc_fini:1035 - Set container state to "STOPPED"

The error that causes the crash:

ERROR    conf - conf.c:mount_entry:1993 - No such file or directory - Failed to mount "/usr/sbin/init.lxc" on "/usr/lib64/lxc/rootfs/usr/sbin/init.lxc"

Still debugging on my end. Thanks for your help.

stgraber commented 5 years ago

That's odd, that error is normally associated with you attempting an Execute() call rather than a Start() call.

Start() should be looking for /sbin/init in your container's rootfs and execute that, if missing, maybe it would cause the error above.

stgraber commented 4 years ago

@adam-hanna any progress on this?

adam-hanna commented 4 years ago

@stgraber sorry but no. I couldn't get it working so went another route. Feel free to close for now.