Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't start up the container #18

Closed
ishworgurung opened this Issue Jun 23, 2015 · 11 comments

Comments

Projects
None yet
7 participants
@ishworgurung
Copy link

commented Jun 23, 2015

Hello,
I am unable to launch the container. It keeps trying to find daemon user.

$ cd /container
$ runc
Unable to find user daemon
WARN[0000] exit status 1                                
Timestamp: 2015-06-23 14:20:51.598848353 +0000 UTC
Code: System error

Message: Unable to find user daemon

Frames:

---
0: func·006
Package: github.com/opencontainers/runc/libcontainer
File: factory_linux.go@225

---
1: StartInitialization
Package: github.com/opencontainers/runc/libcontainer.(*LinuxFactory)
File: factory_linux.go@236

---
2: init·1
Package: main
File: main.go@33

---
3: init
Package: main
File: utils.go@173

---
4: main
Package: runtime
File: proc.go@58

---
5: goexit
Package: runtime
File: asm_amd64.s@2232

Some sys details below:

$ runc -v
runc version 0.1
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 15.04
Release:    15.04
Codename:   vivid
$ uname -a
Linux octopus 3.19.0-22-generic #22-Ubuntu SMP Tue Jun 16 17:15:15 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
$ go version
go version go1.4 linux/amd64
$ cat /container/container.json
{
    "version": "0.1",
    "os": "linux",
    "arch": "amd64",
    "processes": [
        {
            "tty": true,
        "user": "daemon",
            "args": [
                "sh"
            ],
            "env": [
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
                "TERM=xterm"
            ],
            "cwd": ""
        }
    ],
    "root": {
        "path": "rootfs",
        "readonly": true
    },
    "cpus": 1.1,
    "memory": 1024,
    "hostname": "shell",
    "namespaces": [
        {
            "type": "mount"
        },
        {
            "type": "ipc"
        },
        {
            "type": "uts"
        }
    ],
    "capabilities": [
        "AUDIT_WRITE",
        "KILL",
        "NET_BIND_SERVICE"
    ],
    "devices": [
        "null",
        "random",
        "full",
        "tty",
        "zero",
        "urandom"
    ],
    "mounts": [
        {
            "type": "proc",
            "source": "proc",
            "destination": "/proc",
            "options": ""
        },
        {
            "type": "tmpfs",
            "source": "tmpfs",
            "destination": "/dev",
            "options": "nosuid,strictatime,mode=755,size=65536k"
        },
        {
            "type": "devpts",
            "source": "devpts",
            "destination": "/dev/pts",
            "options": "nosuid,noexec,newinstance,ptmxmode=0666,mode=0620,gid=5"
        },
        {
            "type": "tmpfs",
            "source": "shm",
            "destination": "/dev/shm",
            "options": "nosuid,noexec,nodev,mode=1777,size=65536k"
        },
        {
            "type": "mqueue",
            "source": "mqueue",
            "destination": "/dev/mqueue",
            "options": "nosuid,noexec,nodev"
        },
        {
            "type": "sysfs",
            "source": "sysfs",
            "destination": "/sys",
            "options": "nosuid,noexec,nodev"
        }
    ]
}
$ id daemon
uid=1(daemon) gid=1(daemon) groups=1(daemon)
@lizf-os

This comment has been minimized.

Copy link
Contributor

commented Jun 24, 2015

I guess you didn't prepare a rootfs. Try copy a rootfs from /var/lib/docker/aufs/diff/xxxx to runc/rootfs/, and see if it works.

@tksarah

This comment has been minimized.

Copy link

commented Jun 24, 2015

I saw the same result. I have not solved it yet.

@rajasec

This comment has been minimized.

Copy link
Contributor

commented Jun 24, 2015

Try Keeping your rootfs in the same directory where the container.json is placed and then runc

@tksarah

This comment has been minimized.

Copy link

commented Jun 25, 2015

Thank you! It works good!

@estesp

This comment has been minimized.

Copy link
Contributor

commented Jun 25, 2015

As noted above, this means you don't have a proper rootfs, as it wants to open "/etc/passwd" to resolve the user daemon to a uid value (code in libcontainer/user).

I don't believe there is anything runc can do in this case as there are quite a few issues that might cause a rootfs to be invalid outside the control of runc. Given this check is early, we could possibly catch this "can't find user" message and augment with "are you sure your rootfs is a reasonable Linux filesystem with /etc/passwd, /etc/group contents?", but that seems potentially overkill.

@rajasec

This comment has been minimized.

Copy link
Contributor

commented Jun 25, 2015

@tksarah
Please keep the bare minimum Linux file system to run runc.

@mgoelzer

This comment has been minimized.

Copy link

commented Jun 25, 2015

@tksarah:

If you want a rootfs that will definitely work, do this:

docker run -it ubuntu bash
(exit immediately)
docker ps -a (to find the container ID of the ubuntu container you just quit)
docker export [container ID] > docker-ubuntu.tar

Then untar docker-ubuntu.tar into a directory called rootfs, which should be in the same parent directory as your container.json. You now have a rootfs that will work with the container.json that badbug0101 posted at the top of this issue. Type "sudo runc" and you'll be at an sh prompt, inside your container.

@ishworgurung

This comment has been minimized.

Copy link
Author

commented Jun 26, 2015

Thanks all.
I went with the stock ubuntu 15.04 rootfs:

$ id
uid=0(root) gid=0(root) groups=0(root)
$ cd /container
$ wget http://cdimage.ubuntu.com/ubuntu-core/releases/15.04/release/ubuntu-core-15.04-core-amd64.tar.gz
$ mkdir rootfs
$ ls
container.json rootfs
$ tar -C rootfs -xf ubuntu-core-15.04-core-amd64.tar.gz
$ runc
$ id
uid=1(daemon) gid=1(daemon) groups=1(daemon)
$ ps -ef
UID        PID  PPID  C STIME TTY          TIME CMD
daemon       1     0  0 06:07 ?        00:00:00 sh
daemon      10     1  0 06:07 ?        00:00:00 ps -ef
@crosbymichael

This comment has been minimized.

Copy link
Member

commented Jun 26, 2015

Cool, glad it worked.

@tksarah

This comment has been minimized.

Copy link

commented Jun 29, 2015

@mgoelzer

Thank you for your the details process.
I could run a container by "runC".

@mgoelzer

This comment has been minimized.

Copy link

commented Jun 29, 2015

@tksarah Glad I could help!

mrunalp pushed a commit to mrunalp/runc that referenced this issue Feb 22, 2019

Merge pull request opencontainers#18 from 0x0916/remove-unnecessary-c…
…hecks

BACKPORT: kill.go: Remove unnecessary checks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.