Re: [Vserver] Building vserver from skeleton

From: Xavier Montagutelli <xavier.montagutelli_at_unilim.fr>
Date: Thu 18 May 2006 - 17:34:26 BST
Message-Id: <200605181834.26683.xavier.montagutelli@unilim.fr>

On Thursday 18 May 2006 17:42, Fareha Shafique wrote:
> Xavier Montagutelli wrote:
> >On Wednesday 17 May 2006 16:20, Fareha Shafique wrote:
> >>Hi,
> >>
> >>I want to try to build a few vservers from a host template and then
> >>unify these vservers. I'm not sure what files I need to include in the
> >>template. I tried to create one vserver like this but I cannot start it.
> >>I get the following error:
> >>-------------------------
> >># vserver sk start
> >>No command given; use '--help' for more information.
> >>
> >>An error occured while executing the vserver startup sequence; when
> >>there are no other messages, it is very likely that the init-script
> >>() failed.
> >>
> >>Common causes are:
> >>* /etc/rc.d/rc on Fedora Core 1 and RH9 fails always; the 'apt-rpm' build
> >> method knows how to deal with this, but on existing installations,
> >> appending 'true' to this file will help.
> >>
> >>Failed to start vserver 'sk'
> >>---------------------
> >
> >What is "sk" ? Your "host template" or the first vserver based on the
> >template ?
> >
> >Could you tell us more precisely how you created the vserver you call your
> >"host template" (I suppose it is a normal vserver that you won't run) ? I
> >think this one should be constructed as a normal vserver, for example with
> >standard methods (vserver my_template build -m <your_method> ....)
> >
> >How do you create the actual vservers from the template : do you use
> >vserver-copy, something like http://www.micropp.se/vserver/vcopy ?
>
> Well I found a thread in the mailing list archive that said:
> "- reserve space on your /vservers partition for a template
> - dump/restore or cp -va or whatever, your existing host system there
> - cleanup the template with simple chroot, i.e. remove packages and
> stuff you won't need in a guest, adjust the startup/shutdown scripts to
> avoid hardware stuff
> - clear out /proc and /dev inside the template
> now this is only required once, and will save you a lot of space later ...
> to create a new guest, use the 'skeleton' method with all the desired
> config options, then copy over the template into the skeleton guest dir"

IMHO, this way is perfectly correct, but needs more knowledge (in vserver and
in your distribution) than using the "vserver .. build -m yum" method for
building the template.

Personaly, I have used both methods. The "raw" copy methods was used to
"virtualize" existing servers. I wrote some notes about what needs to be
cleaned, for different distributions. These notes are in french and were for
personal use only (Suse :
http://webmail.unilim.fr/dokuwiki/doku.php?id=systeme:vserver:vserver_suse,
Mandrake 10.2 :
http://webmail.unilim.fr/dokuwiki/doku.php?id=systeme:vserver:vserver_mandrake_10.2)

Doing a copy, you have to be careful about /dev : you should not copy it, but
construct it like the "vserver .. build -m skeleton" does (for security
reasons).

The "vserver .. build" method also takes care of some final steps to adjust a
few parts (look at ${prefix}/lib/util-vserver/distributions/*/initpost)

>
> So what I did was copied my host system into a directory (called it
> template). I used the skeleton method to build a guest called sk (with
> appropriate interface and hostname given). Then I copied the template
> into the guest. I think where I went wrong is the cleanup of the
> template, I'm not sure what I should clean out and what I should leave.

Deactivate any service related to hardware, or services managed by the host
(ntp, nfs). Something like :

for svc in alsa dm hotplug keytable kheader netfs netplugd network rawdevices
sound udev ;do chkconfig --del $svc ;done

Sometimes I had to modify the /etc/rc script (see diff in my web notes). To
cleanly shutdown the guest, clear the shutdown script : in many distrib, the
final script /etc/init.d/halt makes many things not needed in a guest (e.g.
unmount filesystems). I suppose this step is not mandatory but cleaner.

> I think I have either left some scripts that are not needed or deleted
> something that is needed, but I don't understand what.
> Any help would be appreciated.

You can use the '--debug' switch to add verbosity (vserver --debug sk start)

HTH

>
> Thanks,
> -FS
>
> >>I'm using Fedora Core 4 (2.6). I have been able to successfully build a
> >>vserver using the yum method previously and starts fine.
> >>Any help will be appreciated.
> >>
> >>Thanks,
> >>-FS
>
> _______________________________________________
> Vserver mailing list
> Vserver@list.linux-vserver.org
> http://list.linux-vserver.org/mailman/listinfo/vserver

-- 
Xavier Montagutelli                      Tel : +33 (0)5 55 45 77 20
Service Commun Informatique              Fax : +33 (0)5 55 45 75 95
Universite de Limoges
123, avenue Albert Thomas
87060 Limoges cedex
_______________________________________________
Vserver mailing list
Vserver@list.linux-vserver.org
http://list.linux-vserver.org/mailman/listinfo/vserver
Received on Thu May 18 17:37:22 2006
[Next/Previous Months] [Main vserver Project Homepage] [Howto Subscribe/Unsubscribe] [Paul Sladen's vserver stuff]
Generated on Thu 18 May 2006 - 17:37:28 BST by hypermail 2.1.8