Giter Club home page Giter Club logo

Comments (13)

caglar10ur avatar caglar10ur commented on June 14, 2024

Please use "go build start.go" and use the resulting binary, I haven't checked whether it really makes a difference but that would be my first suspect.

Which distro are you using? I think you are trying to start the container using an unprivileged user (I'm seeing no sudo in front of go) and that causing a problem for you and underlying LXC C API is crashing for some reason.

Would it be possible to test the privileged case first? Also you don't need to change the code as all the examples accept different set of parameters. Can you try going into your examples directory and running following commands to build some of the tools;

  • go build list.go
  • go build start.go

then run "sudo ./list" and make sure that the container that you created is listed. Then run "sudo ./start -name bb2" followed by "sudo ./list" to ensure that it's reported as running.

from go-lxc.

dshwatrz avatar dshwatrz commented on June 14, 2024

First I reverted start.go to the original one, where the container name is "rubik".
Second, I tried "go build start.go" and used the resulting binary and still the same problem. I am using Fedora 20 and I ran it as root, shameless me (this is the reason for not seeing sudo in front of go)
Running go build list.go
and then
./list
does show the container:
[root@h examples]# ./list
2014/02/23 09:48:39 Defined containers:
2014/02/23 09:48:39 bb2 (STOPPED)
2014/02/23 09:48:39 bbCT (STOPPED)
2014/02/23 09:48:39 bbTest (STOPPED)
2014/02/23 09:48:39 busyboxCT (STOPPED)
2014/02/23 09:48:39 fedora (STOPPED)
2014/02/23 09:48:39 fedora19 (STOPPED)
2014/02/23 09:48:39 fedoraCT (STOPPED)
2014/02/23 09:48:39 fedoraCT1 (STOPPED)
2014/02/23 09:48:39 fedoraNew (STOPPED)
2014/02/23 09:48:39 fedoraNew1 (STOPPED)
2014/02/23 09:48:39 fedora_2_2 (STOPPED)
2014/02/23 09:48:39 p1 (STOPPED)
2014/02/23 09:48:39 testSnap (STOPPED)
2014/02/23 09:48:39 ubuntuCT (STOPPED)
2014/02/23 09:48:39 ubuntuNew (STOPPED)
2014/02/23 09:48:39 ubuntuNew1 (STOPPED)
2014/02/23 09:48:39
2014/02/23 09:48:39 Active containers:
2014/02/23 09:48:39
2014/02/23 09:48:39 Active and Defined containers:

I want to try to create a container with create.go. What are the parameters which I should pass ?
when running
go build create.go
and then
./create
I get:
2014/02/23 09:49:31 Creating container...
lxc_container: No such file or directory - Failed to make / rslave to run template
lxc_container: Continuing...
getopt: invalid option -- 'a'
getopt: invalid option -- 'r'
lxc-busybox -h|--help -p|--path=
lxc_container: container creation template for rubik failed
2014/02/23 09:49:31 ERROR: creating the container failed

from go-lxc.

caglar10ur avatar caglar10ur commented on June 14, 2024

I don't have a fedora 20 system at this moment to test so I need to ask couple of questions until I download/install one which could take little time.

  • What does "lxc-start --version" show to you?
  • What's your go version?
  • Which kernel are you using? What's your "uname -a" output?
  • What's lxc-checkconfig showing to you?

About create's parameters, something like "./create -template ubuntu -arch amd64 -release saucy -name mycontainer " should create a 64bit ubuntu saucy container for you (hint: Every example should have -h parameter to give you possible parameters and their description)

Lastly, would it be possible to run start tool under gdb and get a backtrace to see where it crashes? The trace shows that liblxc is crashing first and then causing go runtime to panic so I'm wondering whether we have a LXC issue or a binding one.

from go-lxc.

dshwatrz avatar dshwatrz commented on June 14, 2024

Here is the requested data:
In gdb I see:
ERROR: container is not defined

lxc-start --version
1.0.0

go version
go version go1.2 linux/amd64

uname -a
Linux h 3.12.7-300.fc20.x86_64 #1 SMP Fri Jan 10 15:35:31 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

lxc-checkconfig
Kernel configuration not found at /proc/config.gz; searching...
Kernel configuration found at /boot/config-3.12.7-300.fc20.x86_64
--- Namespaces ---
Namespaces: enabled
Utsname namespace: enabled
Ipc namespace: enabled
Pid namespace: enabled
User namespace: missing
Network namespace: enabled
Multiple /dev/pts instances: enabled

--- Control groups ---
Cgroup: enabled
Cgroup clone_children flag: enabled
Cgroup device: enabled
Cgroup sched: enabled
Cgroup cpu account: enabled
Cgroup memory controller: enabled
Cgroup cpuset: enabled

--- Misc ---
Veth pair device: enabled
Macvlan: enabled
Vlan: enabled
File capabilities: enabled

Note : Before booting a new kernel, you can check its configuration
usage : CONFIG=/path/to/config /usr/local/bin/lxc-checkconfig

gdb ./start
GNU gdb (GDB) Fedora 7.6.50.20130731-16.fc20
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
http://www.gnu.org/software/gdb/bugs/.
Find the GDB manual and other documentation resources online at:
http://www.gnu.org/software/gdb/documentation/.
For help, type "help".
Type "apropos word" to search for commands related to "word".
..
Reading symbols from /home/davids/go/src/github.com/lxc/go-lxc/examples/start...done.
warning: File "/usr/local/go/src/pkg/runtime/runtime-gdb.py" auto-loading has been declined by your `auto-load safe-path' set to "$debugdir:$datadir/auto-load:/usr/bin/mono-gdb.py".
To enable execution of this file add
add-auto-load-safe-path /usr/local/go/src/pkg/runtime/runtime-gdb.py
line to your configuration file "/root/.gdbinit".
To completely disable this security protection add
set auto-load safe-path /
line to your configuration file "/root/.gdbinit".
For more information about this security protection see the
"Auto-loading safe path" section in the GDB manual. E.g., run from the shell:
info "(gdb)Auto-loading safe path"
(gdb) run
Starting program: /home/davids/go/src/github.com/lxc/go-lxc/examples/start
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
[New Thread 0x7ffff7bb0700 (LWP 3019)]
[New Thread 0x7ffff72af700 (LWP 3020)]
[New Thread 0x7ffff6aae700 (LWP 3021)]
2014/02/24 10:04:52 Starting the container...
2014/02/24 10:04:52 ERROR: container is not defined
[Thread 0x7ffff72af700 (LWP 3020) exited]
[Thread 0x7ffff7bb0700 (LWP 3019) exited]
[Thread 0x7ffff7d71880 (LWP 3015) exited]
[Inferior 1 (process 3015) exited with code 01]
Missing separate debuginfos, use: debuginfo-install glibc-2.18-11.fc20.x86_64 libattr-2.4.47-3.fc20.x86_64 libcap-2.22-7.fc20.x86_64 libseccomp-2.1.0-1.fc20.x86_64 libselinux-2.2.1-6.fc20.x86_64 pcre-8.33-2.fc20.1.x86_64 xz-libs-5.1.2-6alpha.fc20.x86_64
(gdb)

from go-lxc.

dshwatrz avatar dshwatrz commented on June 14, 2024

Hello,
Sorry, in the previous post:
gdb ./start
is not enough since I should specify the container name.
However,
gdb ./start -name bb1
gives
gdb: unrecognized option '-name'
Use `gdb --help' for a complete list of option

Please advice - how should I start the container with gdb?

from go-lxc.

caglar10ur avatar caglar10ur commented on June 14, 2024

"sudo gdb ./start" and then "run -name bb1" should do the trick.

from go-lxc.

dshwatrz avatar dshwatrz commented on June 14, 2024

Here is the output with gdb ./start" and then "run -name bb1":

gdb ./start
GNU gdb (GDB) Fedora 7.6.50.20130731-16.fc20
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
http://www.gnu.org/software/gdb/bugs/.
Find the GDB manual and other documentation resources online at:
http://www.gnu.org/software/gdb/documentation/.
For help, type "help".
Type "apropos word" to search for commands related to "word".
..
Reading symbols from /home/davids/go/src/github.com/lxc/go-lxc/examples/start...done.
warning: File "/usr/local/go/src/pkg/runtime/runtime-gdb.py" auto-loading has been declined by your `auto-load safe-path' set to "$debugdir:$datadir/auto-load:/usr/bin/mono-gdb.py".
To enable execution of this file add
add-auto-load-safe-path /usr/local/go/src/pkg/runtime/runtime-gdb.py
line to your configuration file "/root/.gdbinit".
To completely disable this security protection add
set auto-load safe-path /
line to your configuration file "/root/.gdbinit".
For more information about this security protection see the
"Auto-loading safe path" section in the GDB manual. E.g., run from the shell:
info "(gdb)Auto-loading safe path"
(gdb) run -name bb1
Starting program: /home/davids/go/src/github.com/lxc/go-lxc/examples/start -name bb1
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
[New Thread 0x7ffff7bb0700 (LWP 3200)]
[New Thread 0x7ffff73af700 (LWP 3201)]
[New Thread 0x7ffff6bae700 (LWP 3202)]
2014/02/25 11:59:30 Starting the container...
Detaching after fork from child process 3203.
Detaching after fork from child process 3205.

Program received signal SIGSEGV, Segmentation fault.
0x0000000000000000 in ?? ()
(gdb)

from go-lxc.

caglar10ur avatar caglar10ur commented on June 14, 2024

Good news I reproduced the problem on Fedora 20 VM, bad news I see no apparent reason LXC to crash. Will investigate more.

from go-lxc.

dshwatrz avatar dshwatrz commented on June 14, 2024

Thanks for your response.
Question: Do you think this problem is due to using Fedora ? is there something which is known to work under Ubuntu ? in case there is, I can install Ubuntu on some machine.

from go-lxc.

caglar10ur avatar caglar10ur commented on June 14, 2024

I use ubuntu on daily basis and as long as I see bindings works fine there.

from go-lxc.

caglar10ur avatar caglar10ur commented on June 14, 2024

I think ad388f1 improved the situation a lot.

As long as I see the only remaining issue is create now which I'm working on

from go-lxc.

caglar10ur avatar caglar10ur commented on June 14, 2024

And create problem turned out to be an actual liblxc problem, you need to update your LXC to latest once the patch goes in.

[1] https://lists.linuxcontainers.org/pipermail/lxc-devel/2014-February/008263.html

from go-lxc.

caglar10ur avatar caglar10ur commented on June 14, 2024

The patch found its way into LXC repo and I confirmed that create is now working. Beware that the example that provided with this repo is not going to work as Fedora template uses different set of arguments. You may want to try something like following;

package main

import (
        "flag"
        "log"

        "github.com/lxc/go-lxc"
)

var (
        lxcpath  string
        template string
        name     string
)

func init() {
        flag.StringVar(&lxcpath, "lxcpath", lxc.DefaultConfigPath(), "Use specified container path")
        flag.StringVar(&template, "template", "busybox", "Template to use")
        flag.StringVar(&name, "name", "rubik", "Name of the container")
        flag.Parse()
}

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

        log.Printf("Creating container...\n")
        c.SetVerbosity(lxc.Verbose)

        if err := c.Create(template); err != nil {
                log.Printf("ERROR: %s\n", err.Error())
        }
}
./fedora -name busybox
./fedora -name fedora -template fedora

So based on this I'm closing this bug now...

from go-lxc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.