[Vserver] Problem with vserver startup and namespace-cleanup

From: Gerald Hochegger <gerald.hochegger_at_uni-klu.ac.at>
Date: Sun 23 Jul 2006 - 11:41:02 BST
Message-ID: <20060723104102.GB3373@console1.zid.uni-klu.ac.at>

Hello,

I run into the same problems with vservers, drbd and heartbeat
as Martin in this thread:
  (devices remain busy after stopping vservers)
  http://www.paul.sladen.org/vserver/archives/200607/0132.html

I tried the elegant namespace-cleanup solution suggested by
Daniel Hokka Zakrisson in:
  http://www.paul.sladen.org/vserver/archives/200607/0133.html
  http://www.paul.sladen.org/vserver/archives/200607/0173.html

but now my vservers fail to startup with:
  save_ctxinfo: open("/var/run/vservers/testsrv"): No such file or directory

  An error occured while executing the vserver startup sequence; when
  there are no other messages, it is very likely that the init-script
  (/etc/init.d/rc 3) failed.

Removing the namespace-cleanup flag in /etc/vservers/.defaults fixes
the startup problem.

starting with vserver --debug and strace'ing save_ctxinfo gives:

++ for i in '"$base/$flavor"' '"$base/$flavor.d"/*'
++ isRegularFile '/etc/vservers/.defaults/scripts/pre-start.d/*'
++ test -f '/etc/vservers/.defaults/scripts/pre-start.d/*'
++ return 1
++ continue
++ test -z '' -o -n ''
++ popd
++ test -z ''
++ pushd /etc/vservers/testsrv/vdir/
++ is_configured=1
++ /usr/sbin/vserver-info - FEATURE migrate
++ /usr/bin/nice -n 0 /usr/sbin/chbind --silent --ip 10.10.10.40 -- /usr/lib/util-vserver/exec-ulimit /etc/vservers/testsrv/ulimits /usr/sbin/vcontext --create --silent -- /usr/sbin/vnamespace --set -- /usr/sbin/vlimit --dir /etc/vservers/testsrv/rlimits --missingok -- /usr/sbin/vsched --xid self -- /usr/sbin/vuname --xid self --dir /etc/vservers/testsrv/uts --missingok -- /usr/sbin/vuname --xid self --set -t context=/etc/vservers/testsrv -- /usr/sbin/vattribute --set --secure --flag default --flag fakeinit --flag sched_prio -- /usr/lib/util-vserver/save_ctxinfo /etc/vservers/testsrv /usr/bin/env -i -- /usr/sbin/vcontext --migrate-self --endsetup --chroot --silent --vlogin -- /etc/init.d/rc 3
execve("/usr/lib/util-vserver/save_ctxinfo.exe", ["/usr/lib/util-vserver/save_ctxin"..., "/etc/vservers/testsrv", "/usr/bin/env", "-i", "--", "/usr/sbin/vcontext", "--migrate-self", "--endsetup", "--chroot", "--silent", "--vlogin", "--", "/etc/init.d/rc", "3"], [/* 24 vars */]) = 0
vserver(0x2e010000, 0, 0, 0, 0xbfb1f612) = 49163
readlink("/etc/vservers/testsrv/run", "/var/run/vservers/testsrv", 4094) = 25
open("/var/run/vservers/testsrv", O_WRONLY|O_CREAT|O_EXCL|O_LARGEFILE, 0644) = -1 ENOENT (No such file or directory)
write(2, "save_ctxinfo: ", 14save_ctxinfo: ) = 14
write(2, "open(\"/var/run/vservers/testsrv\""..., 33open("/var/run/vservers/testsrv")) = 33
write(2, ": ", 2: ) = 2
write(2, "No such file or directory", 25No such file or directory) = 25
write(2, "\n", 1
) = 1
_exit(255) = ?
++ is_executed=1
++ popd
++ pushd /etc/vservers/testsrv/vdir/
++ execScriptlets /etc/vservers/testsrv testsrv post-start
++ declare -r vdir=/etc/vservers/testsrv
++ declare -r name=testsrv
++ declare -r flavor=post-start
++ local base i
++ for base in '"$vdir"/scripts' '"$__CONFDIR"/.defaults/scripts'

open("/var/run/vservers/testsrv", O_WRONLY|O_CREAT|O_EXCL|O_LARGEFILE, 0644) fails ?

When strace'ing without namespace-cleanup the same call works
without problems.

The problem exists on both i386 and amd64 kernels and util-vserver

Has anybody some suggestions how I could narrow down this problem ?

Thanks,
Gerald

----------------------------------------------------------------

I searched the archives and found:
  http://www.paul.sladen.org/vserver/archives/200604/0129.html
but this was a dietlib problem:
  http://www.paul.sladen.org/vserver/archives/200604/0195.html
  http://www.paul.sladen.org/vserver/archives/200604/0198.html

I'm using Ubuntu dapper packages from
  https://help.ubuntu.com/community/VServer
    kernel 2.6.15 + vserver-2.0.2rc26 patch
    util-vserver-0.30.210 debian sid + umount -n -l fix

--- vserver-info ---
Versions:
                   Kernel: 2.6.15-27-server
                   VS-API: 0x00020001
             util-vserver: 0.30.210; Jul 17 2006, 14:33:18

Features:
                       CC: gcc, gcc (GCC) 4.0.3 (Ubuntu 4.0.3-1ubuntu5)
                      CXX: g++, g++ (GCC) 4.0.3 (Ubuntu 4.0.3-1ubuntu5)
                 CPPFLAGS: ''
                   CFLAGS: '-Wall -g -O2 -std=c99 -Wall -pedantic -W -funit-at-a-time'
                 CXXFLAGS: '-g -O2 -ansi -Wall -pedantic -W -fmessage-length=0 -funit-at-a-time'
               build/host: i486-pc-linux-gnu/i486-pc-linux-gnu
             Use dietlibc: yes
       Build C++ programs: yes
       Build C99 programs: yes
           Available APIs: v13,net
            ext2fs Source: e2fsprogs
    syscall(2) invocation: alternative
      vserver(2) syscall#: 273/glibc

Paths:
                   prefix: /usr
        sysconf-Directory: /etc
            cfg-Directory: /etc/vservers
         initrd-Directory: $(sysconfdir)/init.d
       pkgstate-Directory: /var/run/vservers
          vserver-Rootdir: /var/lib/vservers

--- testme.sh -v ---
Linux-VServer Test [V0.15] Copyright (C) 2003-2006 H.Poetzl
chcontext is working.
chbind is working.
chcontext 0.30.210 -- allocates/enters a security context
This program is part of util-vserver 0.30.210

Copyright (C) 2004 Enrico Scholz
This program is free software; you may redistribute it under the terms of
the GNU General Public License. This program has absolutely no warranty.
Linux 2.6.15-27-server #1 SMP Fri Jul 21 08:21:30 CEST 2006 i686
Ea 0.30.210 273/glibc (DSa) <v13,net>
VCI: 0002:0001 273 03000036 (TbLgnP)
(debuild@build32-dapper)
(gcc version 4.0.3 (Ubuntu 4.0.3-1ubuntu5))
#1 SMP Fri Jul 21 08:21:30 CEST 2006

---
[000]# chcontext  true && chcontext --xid 45678 true
[000]# succeeded.
[001]# chcontext --xid 45678 egrep 'context|VxID' /proc/self/status
[001]# succeeded.
[011]# chcontext --secure --xid 45678 mknod /tmp/testme.sh.I0xge3/node c 0 0
[011]# succeeded.
[031]# chcontext  --hostname zaphod.6459 uname -a | grep -q zaphod.6459
[031]# succeeded.
[101]# chbind  --ip 192.168.0.42 true
[101]# succeeded.
[102]# chbind  --ip 192.168.0.1/255.255.255.0 --ip 10.0.0.1/24 true
[102]# succeeded.
[201]# chcontext --xid 45678 --flag fakeinit bash -c 'test $$ -eq 1'
[201]# succeeded.
[202]# chcontext  --flag fakeinit bash -c 'test $$ -eq 1'
[202]# succeeded.
_______________________________________________
Vserver mailing list
Vserver@list.linux-vserver.org
http://list.linux-vserver.org/mailman/listinfo/vserver
Received on Sun Jul 23 11:49:48 2006
[Next/Previous Months] [Main vserver Project Homepage] [Howto Subscribe/Unsubscribe] [Paul Sladen's vserver stuff]
Generated on Sun 23 Jul 2006 - 11:49:56 BST by hypermail 2.1.8