Subject: Re: [vserver] support for Alpine Linux
From: "Daniel Hokka Zakrisson" <daniel@hozac.com>
Date: Tue, 31 Jul 2007 14:42:30 +0200 (CEST)

Natanael Copa wrote:
> Hi,
>
> I'm making an uclibc/busybox based linux distro based on gentoo, Alpine
> linux. I have managed to get vserver started and I can bootstrap a
> debian etch vserver. (I think its prettty cool, minimalistic grsec'ed
> vserver host on tmpfs from a cd/usb. memory usage less than 60MB)
>
> Now I would like to add support for alpine as a vserver guest but I
> cannot really find out how to handle the init.
>
> First I tried to use plain init. It booted with minor issues related the
> fact that it uses busybox init. But when I try to stop the vserver I
> only get: "reboot: no". Its busybox reboot/halt command that tries to
> kill pid 1 and when it fails it just gives up.

Killing pid 1 never works, init is protected by the kernel.

> But what I really need is only to run /etc/init.d/rcL on start
> and /etc/init.d/rcK && killall5 on stop so I thought I would try to
> start an initstyle called "alpine" by
> modifying /usr/lib/util-vserver/vserver.functions:

You really don't have to. Just use the sysv initstyle and set
/etc/vservers/<guest>/apps/init/cmd.start and
/etc/vservers/<guest>/apps/init/cmd.stop to the appropriate commands.

> --- /usr/lib/util-vserver/vserver.functions.orig        Tue Jul 31
> 11:43:26 2007
> +++ /usr/lib/util-vserver/vserver.functions     Tue Jul 31 11:45:01 2007
> @@ -322,7 +322,11 @@
>  Your vserver ($(basename "$vdir")) seems to have baselayout-$basever,
>  please use 'plain' init-style instead!"
>             ;;
> -
> +       (xalpine)
> +           INITCMD_START=( /etc/init.d/rcL )
> +           INITCMD_STOP=( /etc/init.d/rcK killall5 )
> +           INITCMD_PREPARE=( $_FAKE_RUNLEVEL 3 /var/run/utmp )
> +           ;;
>         (x) ;;
>         (*) panic "Unknown init-style '$INITSTYLE'; aborting";;
>      esac
>
>
> But when I tried to start it I get:
>
> ~ $ vserver alpine start
> vshelper.init: can not determine xid of vserver 'alpine'; returned value
> was ''
>
> An error occured after executing the vserver startup sequence. This
> means that some processes may exist in the created context and the
> manual execution of
>
>   /usr/sbin/vserver '/etc/vservers/alpine' stop
>
> is recommended to fix this.

Which means your guest started and exited before the start script was
finished. You're going to need some sort of service running inside to use
an init-less guest, or to make the contexts persistent.

> I tried to dig around in the bash script to find out whats going on but
> I cannot figure out whats going on.
>
> Any pointers?
>
> Would you be interested in patches so next official release of
> util-vserver has support for alpine linux?

I guess so...

> If you want to try alpine as vserver host, then download alpine-1.7.3
> from:
> http://dev.alpinelinux.org/alpine/v1.7/iso/
>
> or boot from usb:
> http://dev.alpinelinux.org/alpine/v1.7/usbdrive/
>
> You can also install the base system (2-3MB?) in a directory, designed
> for mini vserver guests, using the albootstrap script:
> http://dev.alpinelinux.org/alpine/v1.7/albootstrap
>
> sh albootstrap /vservers/alpine
>
> Thanks!
>
> Natanael Copa

-- 
Daniel Hokka Zakrisson