Package: util-vserver
Severity: normal
Version: 0.30.216~r2772-3

I'm using a vserver kernel.  I get failures within a vserver guest
when i try to test the POSIX-style shared-memory commands with the .c
examples found here:

  http://www.cs.cf.ac.uk/Dave/C/node27.html#SECTION002730000000000000000

This turns out to be because the initial creation of /dev/shm inside
the vserver (by initscripts.postinst during a stock lenny debootstrap)
is defeated by
/usr/lib/util-vserver/distributions/lenny/debootstrap.script:

I created a stock debian vserver with:

  vserver monkey build -m debootstrap --context 101 --hostname monkey -- -d 
lenny -m http://ftp.us.debian.org/debian

All this basically does is set up some vserver configs and then invoke
debootstrap like this:

vnamespace --new /usr/sbin/debootstrap lenny 
/etc/vservers/.defaults/vdirbase/monkey http://ftp.us.debian.org/debian 
/usr/lib/util-vserver/distributions/lenny/debootstrap.script

After the debootstrap completes,
.../distributions/lenny/debootstrap.script monkeys around with /dev
within the chroot to replace it with the raw initial /dev:

[...]
function fixupDebian
{
    $_RM -rf "$1"/dev
    $_MV "$1"/dev.X "$1"/dev
}
[...]
mv "$VDIR"/dev "$VDIR"/dev.X
"$_VNAMESPACE" --new -- \
    "$DEBOOTSTRAP" $options "$@" "$DISTRIBUTION" "$VDIR" "$MIRROR" "$script" || 
:   ## HACK: ignore all errors...                                               
        
fixupDebian "$VDIR"
[...]


However, one of the jobs of the initscripts.postinst (which is run
during debootstrap) is to create /dev/shm for systems that do not have
a dynamically-populated /dev.

If the following two steps are done from the host before starting the
vserver, POSIX-style shared memory seems to work within the vserver
for me:

  mkdir /var/lib/vservers/$VSERVER_NAME/dev/shm
  chmod --reference=/dev/shm /var/lib/vservers/$VSERVER_NAME/dev/shm

Perhaps this directory should be added into the default deboostrap
operation?

Are there other ways to resolve this that i missed?

        --dkg

0 cur:~# dpkg -l | egrep 'linux-image|vserver|initscripts'
ii  initscripts                                 2.86.ds1-61          Scripts 
for initializing and shutting down t
ii  kvm-modules-2.6.26-1-vserver-amd64          72+dfsg-2+2.6.26-8   kvm 
modules for Linux (kernel 2.6.26-1-vserv
ii  linux-headers-2.6.26-1-common-vserver       2.6.26-8             Common 
header files for Linux 2.6.26-1-vserv
ii  linux-headers-2.6.26-1-vserver-amd64        2.6.26-8             Header 
files for Linux 2.6.26-1-vserver-amd6
ii  linux-image-2.6.26-1-vserver-amd64          2.6.26-8             Linux 
2.6.26 image on AMD64, Linux-VServer s
ii  linux-image-vserver-amd64                   2.6.26+16            Linux 
image on AMD64
ii  util-vserver                                0.30.216~r2772-3     user-space 
tools for Linux-VServer virtual p
0 cur:~# 

Attachment: pgpI9OF79SYLa.pgp
Description: PGP signature

Reply via email to