0

I build a linux container from scratch and wanna start it.

First, I use chroot to test like run "chroot rootfs/ /init", it starts correctly.

However, when i try to use "lxc-start -n mycontainer", one of its process has segfault problem and dmesg shows “[973.829549] servicemanager[1634]: segfault at 0 ip 40001094 sp bff23920 error 4 in servicemanager[40000000+3000]”

Even I try "lxc-start -n mycontainer -- /bin/sh" (just start sh instead of the whole init process), and it shows "[ 333.572917] sh[1715]: segfault at 90 ip b76d9a80 sp bff4cb24 error 4 in libc.so[b767a000+99000]", still a segfault problem.

I checked the lxc-start log and the container setup part is fine, no error.

Then I go through the lxc sourcecode, find it uses pivot_root instead of chroot. Could this be the problem? Or something else like namespace ,cgroup couses the segfault here?

jasonNew
  • 5
  • 5

1 Answers1

0

lxc-start works fine for me, pivot_root is not the problem.

1) just 'lxc-start -n mycontainer' is not good coz it will try to start the init

how about lxc-start -n mycontainer /bin/sh ?

resultsway
  • 12,299
  • 7
  • 36
  • 43
  • I've change the lxc.init_cmd in config file , so this should not be a problem. After all, i found it happens because the original init script in contianer tries to mount dev again, so maybe some devices lost causes the script to crash. Anyway, thank you. I'm moving on . – jasonNew Apr 28 '15 at 06:16