https://wiki.archlinux.org/api.php?action=feedcontributions&user=Karottenreibe&feedformat=atomArchWiki - User contributions [en]2024-03-28T22:07:56ZUser contributionsMediaWiki 1.41.0https://wiki.archlinux.org/index.php?title=Arch_VServer&diff=131050Arch VServer2011-02-15T17:09:51Z<p>Karottenreibe: fixed typo</p>
<hr />
<div>[[Category:Emulators (English)]][[Category: HOWTOs (English)]]<br />
This article aims to provide all necessary information regarding the creation of a vserver host as well as vserver guests running Arch Linux. This will enable you to setup virtual servers that provide different services as if they were on different machines, with a very little overhead. You can get more information about virtual servers [http://en.wikipedia.org/wiki/Virtual_private_server here].<br />
<br />
====Current status / Next steps====<br />
I've just started playing around with vserver and am finding the documentation regarding this project lacking. As such, the way I'm doing this below may not be optimal.<br />
<br />
That being said, I'm thinking that the next step to make this more efficient would be to write the proper scripts to integrate pacman into util-vserver as has been done for apt, rpm, etc... The actual files may be found in ''/usr/lib/util-vserver''.<br />
<br />
=Preparing the Host=<br />
<br />
To prepare the vserver host environment, you will need to install both a vserver patched kernel, the vserver utilities and their dependencies which are located in the [[AUR]]. The required packages are {{Package AUR|dietlibc}}, {{Package AUR|beecrypt}}, {{Package AUR|kernel26-vserver}}, and {{Package AUR|util-vserver}}<br />
<br />
=Paths of Interest=<br />
<br />
'''/etc/vservers''' : configuration root ( [http://www.nongnu.org/util-vserver/doc/conf/configuration.html ''reference''] )<br />
: '''/etc/vservers/.defaults''' : configuration skeleton used when building new guests<br />
:: '''/etc/vservers/.defaults/vdirbase''' : symlink to the folder containing vserver guests. This defaults to /vservers.<br />
: '''/etc/vservers/<guest name>''' : guest specific configurations<br />
<br />
=Preparing the Guests=<br />
<br />
Vserver will launch guests from subfolders of ''/etc/vservers/.defaults/vdirbase''. As such, creating a new guest system is as simple as installing the required packages in a folder of the host. Furthermore, there's nothing stopping you ( and quite a few things encouraging you ) to mount filesystems to the subfolders of ''vdirbase'' and installing your guest in there.<br />
<br />
If you plan on doing this often, I highly recommend that you write yourself a little batch script since most of these steps can be automated quite easily.<br />
<br />
==Preparing the guest installation media==<br />
<br />
'''NOTE''' : This is all heavily inspired from [http://wiki.archlinux.org/index.php/Install_From_Existing_Linux wiki:Install From Existing Linux] and will therefore be quite brief when not mentioning Vserver specific steps.<br />
<br />
===Optional: Base variables to follow along with the steps===<br />
GuestName= # Name of the guest<br />
GuestRoot=/etc/vservers/.defaults/vdirbase/$GuestName<br />
GuestPackages= # Listing of packages to install via pacman<br />
GuestDisk= # Installation target device<br />
GuestNetDevice= # ex.: eth0, dummy0, etc...<br />
GuestIP= # I think you get it<br />
GuestContext= # Unique identifier for the guest, I go with the last part of the IP<br />
<br />
===Optional: Preparing the guest disk===<br />
# Create a LVM Physical Volume, a Volume Group and a Logical Volume ( [http://wiki.archlinux.org/index.php/Lvm#Create_Logical_Volumes wiki:LVM] )<br />
# Create a filesystem on the lvm volume<br />
# mkdir $GuestRoot<br />
# mount /dev/$GuestDisk $GuestRoot<br />
<br />
===Optional: Link the host and guest pacman cache===<br />
# mkdir $GuestRoot/var/cache/pacman/pkg<br />
# mount -o bind /var/cache/pacman/pkg $GuestRoot/var/cache/pacman/pkg<br />
<br />
===Prepare Vserver===<br />
# vserver $GuestName -m skeleton --context $GuestContext --interface $GuestNetDevice:$GuestIP --flags lock,virt_mem,virt_uptime,virt_cpu,virt_load,sched_hard,hide_netif --initstyle plain<br />
# (optional) cd /etc/vservers/$GuestName/interfaces<br />
# (optional) cp -r 0 1<br />
# (optional) echo 'lo' > dev<br />
# (optional) echo '127.0.0.$GuestContext' > ip<br />
<br />
===Prepare the guest's filesystem===<br />
# Prepare guest filesystem for the pacman db<br />
## mkdir -p /newarch/var/lib/pacman <br />
<br />
===Install the base system===<br />
'''NOTE : ''' To save some time, it's probably a good idea to create a text file containing all the packages to install and call it via "pacman -Sy `cat $GuestPackages` -r $GuestRoot" instead of the following : <br />
# pacman -Sy base -r $GuestRoot<br />
# Optional: If you want to chroot into the newly created guest so as to install new packages, it might be a good idea to mount a few filesystems required by some packages.<br />
## Bind /dev, /proc, /sys to the corresponding directories in $GuestRoot<br />
# Modify guest configuration files to enable a smoother boot process<br />
## Modify '''/etc/inittab''' by deleting all lines that create the consoles ( agetty )<br />
## Modify '''/etc/rc.shutdown''' by removing anything hardware/clock/mount related. This includes most everything under ''Saving Random Seed'.<br />
## Modify '''/etc/rc.sysinit''' by anything hardware/clock/mount related.<br />
## Create '''/etc/init.d/rc'''<br />
## Modify '''/etc/syslog-ng.conf''' by removing file("/proc/kmsg")<br />
## Modify '''/etc/rc.conf''' by removing the networks Daemon.<br />
# Ensure '''/etc/rc.*''' can be executed: "chmod +x /etc/rc.*"<br />
<br />
===Annexe : Configuration files modified===<br />
'''/etc/init.d/rc'''<br />
if [ $1 -eq 3 ]; then<br />
echo "entering runlevel 3:multi";<br />
/etc/rc.multi<br />
fi<br />
if [ $1 -eq 6 ]; then<br />
echo "entering runlevel 6:reboot";<br />
/etc/rc.shutdown<br />
fi<br />
if [ $1 -eq 0 ]; then<br />
echo "entering runlevel 0: shutdown";<br />
/etc/rc.shutdown<br />
fi<br />
if [ $1 -eq 4 ]; then<br />
echo "entering runlevel 4";<br />
fi<br />
if [ $1 -eq 5 ]; then<br />
echo "entering runlevel 5";<br />
fi<br />
if [ $1 -eq 1 ]; then<br />
echo "entering runlevel 1:single";<br />
/etc/rc.single<br />
fi<br />
if [ $1 -eq 2 ]; then<br />
echo "entering runlevel 2:multi";<br />
/etc/rc.multi<br />
fi<br />
<br />
====/etc/rc.sysinit====<br />
#!/bin/bash<br />
#<br />
# /etc/rc.sysinit<br />
#<br />
<br />
. /etc/rc.conf<br />
. /etc/rc.d/functions<br />
<br />
echo " "<br />
printhl "Arch Linux\n"<br />
printhl "${C_H2}http://www.archlinux.org"<br />
printhl "Copyright 2002-2007 Judd Vinet"<br />
printhl "Copyright 2007-2009 Aaron Griffin"<br />
printhl "Distributed under the GNU General Public License (GPL)"<br />
printsep<br />
<br />
<br />
# start up our mini logger until syslog takes over<br />
/sbin/minilogd<br />
<br />
if [ -x /sbin/udevadm ]; then<br />
stat_busy "Starting UDev Daemon"<br />
/sbin/udevd --daemon<br />
stat_done<br />
else<br />
# Static /dev, our last resort<br />
status "Using static /dev filesystem" true<br />
fi<br />
<br />
# Trigger udev uevents<br />
if /bin/pidof -o %PPID /sbin/udevd >/dev/null; then<br />
stat_busy "Triggering UDev uevents"<br />
/sbin/udevadm trigger<br />
stat_done<br />
fi<br />
NETFS="nonfs,nonfs4,nosmbfs,nocifs,nocodafs,noncpfs,nosysfs,noshfs,nofuse,nofuseblk,noglusterfs"<br />
<br />
stat_busy "Mounting Local Filesystems"<br />
/bin/rm -f /etc/mtab*<br />
# Write /proc, /sys and /dev to /etc/mtab<br />
if [ -e /proc/mounts ]; then<br />
/bin/grep -e "rootfs" -e "/proc " -e "/sys " -e "/dev " /proc/mounts >> /etc/mtab<br />
fi<br />
stat_done<br />
<br />
stat_busy "Configuring System Clock"<br />
if [ ! -f /var/lib/hwclock/adjtime ]; then<br />
echo "0.0 0 0.0" > /var/lib/hwclock/adjtime<br />
fi<br />
if [ "$TIMEZONE" != "" -a -e "/usr/share/zoneinfo/$TIMEZONE" ]; then<br />
/bin/rm -f /etc/localtime<br />
/bin/cp "/usr/share/zoneinfo/$TIMEZONE" /etc/localtime<br />
fi<br />
<br />
if [ -n "$HWCLOCK_PARAMS" ]; then<br />
/sbin/hwclock --adjust #Adjust for system drift<br />
/sbin/hwclock $HWCLOCK_PARAMS<br />
fi<br />
stat_done<br />
<br />
RANDOM_SEED=/var/lib/misc/random-seed<br />
if [ -f $RANDOM_SEED ]; then<br />
stat_busy "Initializing Random Seed"<br />
/bin/cat $RANDOM_SEED > /dev/urandom<br />
stat_done<br />
fi<br />
<br />
stat_busy "Removing Leftover Files"<br />
/bin/rm -f /etc/nologin &>/dev/null<br />
/bin/rm -f /etc/shutdownpid &>/dev/null<br />
/bin/rm -f /var/lock/* &>/dev/null<br />
/bin/rm -rf /tmp/* /tmp/.* &>/dev/null<br />
/bin/rm -f /forcefsck &>/dev/null<br />
(cd /var/run && /usr/bin/find . ! -type d -exec /bin/rm -f -- {} \; )<br />
: > /var/run/utmp<br />
/bin/chmod 0664 /var/run/utmp<br />
# Keep {x,k,g}dm happy with xorg<br />
/bin/mkdir /tmp/.ICE-unix && /bin/chmod 1777 /tmp/.ICE-unix<br />
/bin/mkdir /tmp/.X11-unix && /bin/chmod 1777 /tmp/.X11-unix<br />
stat_done<br />
<br />
#status "Updating Shared Library Links" /sbin/ldconfig<br />
<br />
if [ "$HOSTNAME" != "" ]; then<br />
status "Setting Hostname: $HOSTNAME" /bin/hostname $HOSTNAME<br />
fi<br />
<br />
# Set the NIS domain name, if necessary<br />
[ -f /etc/conf.d/nisdomainname ] && . /etc/conf.d/nisdomainname<br />
if [ "$NISDOMAINNAME" != "" ]; then<br />
status "Setting NIS Domain Name: $NISDOMAINNAME" /bin/nisdomainname $NISDOMAINNAME<br />
fi<br />
<br />
status "Updating Module Dependencies" /sbin/depmod -A<br />
<br />
# Flush old locale settings<br />
: >/etc/profile.d/locale.sh<br />
/bin/chmod 755 /etc/profile.d/locale.sh<br />
# Set user defined locale<br />
[ -z "$LOCALE" ] && LOCALE="en_US"<br />
stat_busy "Setting Locale: $LOCALE"<br />
echo "export LANG=$LOCALE" >>/etc/profile.d/locale.sh<br />
stat_done<br />
<br />
# Adding persistent network/cdrom generated rules<br />
if [ -f "/dev/.udev/tmp-rules--70-persistent-cd.rules" ]; then<br />
stat_busy "Adding persistent cdrom udev rules"<br />
/bin/cat /dev/.udev/tmp-rules--70-persistent-cd.rules >> /etc/udev/rules.d/70-persistent-cd.rules<br />
stat_done<br />
fi<br />
if [ -f "/dev/.udev/tmp-rules--70-persistent-net.rules" ]; then<br />
stat_busy "Adding persistent network udev rules"<br />
/bin/cat /dev/.udev/tmp-rules--70-persistent-net.rules >> /etc/udev/rules.d /70-persistent-net.rules<br />
stat_done<br />
fi<br />
<br />
/bin/dmesg >| /var/log/dmesg.log<br />
<br />
# End of file<br />
# vim: set ts=2 noet:<br />
<br />
====/etc/rc.shutdown====<br />
#!/bin/bash<br />
#<br />
# /etc/rc.shutdown<br />
#<br />
<br />
. /etc/rc.conf<br />
. /etc/rc.d/functions<br />
<br />
# avoid staircase effect<br />
/bin/stty onlcr<br />
<br />
echo " "<br />
printhl "Initiating Shutdown..."<br />
echo " "<br />
<br />
# avoid NIS hanging syslog-ng on shutdown by unsetting the domainname<br />
if [ -x /bin/domainname ]; then<br />
/bin/domainname ""<br />
fi<br />
<br />
if [ -x /etc/rc.local.shutdown ]; then<br />
/etc/rc.local.shutdown<br />
fi<br />
<br />
if [ "$PREVLEVEL" = "3" -o "$PREVLEVEL" = "5" ]; then<br />
# Find daemons NOT in the DAEMONS array. Shut these down first<br />
if [ -d /var/run/daemons ]; then<br />
for daemon in $(/bin/ls -1t /var/run/daemons); do<br />
if ! in_array $daemon ${DAEMONS[@]}; then<br />
stop_daemon $daemon<br />
fi<br />
done<br />
fi<br />
# Shutdown daemons in reverse order<br />
let i=${#DAEMONS[@]}-1<br />
while [ $i -ge 0 ]; do<br />
if [ "${DAEMONS[$i]:0:1}" != '!' ]; then<br />
ck_daemon ${DAEMONS[$i]#@} || stop_daemon ${DAEMONS[$i]#@}<br />
fi<br />
let i=i-1<br />
done<br />
fi<br />
<br />
# Terminate all processes<br />
stat_busy "Sending SIGTERM To Processes"<br />
/sbin/killall5 -15 &> /dev/null<br />
/bin/sleep 5<br />
stat_done<br />
<br />
stat_busy "Sending SIGKILL To Processes"<br />
/sbin/killall5 -9 &> /dev/null<br />
/bin/sleep 1<br />
stat_done<br />
<br />
# Write to wtmp file before unmounting<br />
/sbin/halt -w<br />
<br />
# Power off or reboot<br />
if [ "$RUNLEVEL" = "0" ]; then<br />
printsep<br />
printhl "${C_H2}POWER OFF"<br />
/sbin/poweroff -d -f -h -i<br />
else<br />
printsep<br />
printhl "${C_H2}REBOOTING"<br />
# if kexec is installed and a kernel is loaded, use it<br />
[ -x /sbin/kexec ] && /sbin/kexec -e > /dev/null 2>&1<br />
/sbin/reboot -d -f -i<br />
fi<br />
<br />
# End of file<br />
# vim: set ts=2 sw=2 noet:<br />
<br />
=Troubleshooting=<br />
==Viewing output from vserver $GuestName start / stop==<br />
<br />
'''NOTE : ''' For me, this only worked in the actual consoles, not in X.<br />
<br />
# Make sure that the device /dev/console exists in the guest<br />
## If it does not, cp -a /dev/console $GuestRoot/dev/<br />
<br />
==SSH will not start==<br />
I noticed that /dev/null did not always get created properly in my first experimentations. Therefore I did a quick : <br />
# cp -a /dev/null $GuestRoot/dev<br />
# cp -a /dev/zero $GuestRoot/dev<br />
<br />
Furthermore, if you're not using the dummy network driver and are attaching to the host's network interface, you'll want to configure the ListenAddress statement of /etc/ssh/sshd_config so that it binds only to the guest's IP address as opposed to 127.0.0.1.<br />
<br />
==SSH immediately terminates the connection==<br />
On my machine, SSH used to authenticate me correctly and log me in, but then immediately drop the connection without an explanation. Consulting /var/log/auth.log revealed the following:<br />
<br />
sshd[17899]: pam_limits(sshd:session): Could not set limit for 'nice': Operation not permitted<br />
<br />
This is easily fixed by commenting all '''nice''' related lines in /etc/security/limits.conf.<br />
<br />
=Tips & Trick=<br />
==Network via dummy adapters==<br />
Here, you're either using the dummy module to create virtual network adapters or created interface aliases via /usr/sbin/ip or /usr/sbin/ifconfig. I went for the former and configured the host as such : <br />
# ''/etc/sysctl.conf'' : net.ipv4.ip_forward=1<br><br />
Modify or add that statement to enable routing on the host<br />
# ''/etc/rc.local''<br><br />
modprobe dummy numdummies=$NumberOfGuests<br><br />
ip link set dev dummy$GuestContext name $GuestName<br />
<br />
This provides me with dummy interfaces that I can route / firewall that are all named the same as my guests... yay.<br />
<br />
=More Resources=<br />
[http://linux-vserver.org/Problematic_Programs Problematic Programs]<br><br />
[http://linux-vserver.org/Howto_make_bsd-style_init_sysv-compatible Make BSD style init SYSV compatible]<br><br />
[http://www.cedarcreeksoftware.com/an-even-easier-linux-vserver-tutorial.html Vserver tutorial]<br><br />
[http://linux-vserver.org/Installation_on_ArchLinux linux-vserver.org's Installation on ArchLinux]<br><br />
[http://wiki.linux-vserver.org/Networking_vserver_guests linux-verserver.org's networking tutorial]<br><br />
<!-- vim: set ft=Wikipedia: --></div>Karottenreibehttps://wiki.archlinux.org/index.php?title=Arch_VServer&diff=131049Arch VServer2011-02-15T17:08:47Z<p>Karottenreibe: /* SSH will not start */ added section that describes a problem I ran into</p>
<hr />
<div>[[Category:Emulators (English)]][[Category: HOWTOs (English)]]<br />
This article aims to provide all necessary information regarding the creation of a vserver host as well as vserver guests running Arch Linux. Tis will enable you to setup virtual servers that provide different services as if they were on different machines, with a very little overhead. You can get more information about virtual servers [http://en.wikipedia.org/wiki/Virtual_private_server here].<br />
<br />
====Current status / Next steps====<br />
I've just started playing around with vserver and am finding the documentation regarding this project lacking. As such, the way I'm doing this below may not be optimal.<br />
<br />
That being said, I'm thinking that the next step to make this more efficient would be to write the proper scripts to integrate pacman into util-vserver as has been done for apt, rpm, etc... The actual files may be found in ''/usr/lib/util-vserver''.<br />
<br />
=Preparing the Host=<br />
<br />
To prepare the vserver host environment, you will need to install both a vserver patched kernel, the vserver utilities and their dependencies which are located in the [[AUR]]. The required packages are {{Package AUR|dietlibc}}, {{Package AUR|beecrypt}}, {{Package AUR|kernel26-vserver}}, and {{Package AUR|util-vserver}}<br />
<br />
=Paths of Interest=<br />
<br />
'''/etc/vservers''' : configuration root ( [http://www.nongnu.org/util-vserver/doc/conf/configuration.html ''reference''] )<br />
: '''/etc/vservers/.defaults''' : configuration skeleton used when building new guests<br />
:: '''/etc/vservers/.defaults/vdirbase''' : symlink to the folder containing vserver guests. This defaults to /vservers.<br />
: '''/etc/vservers/<guest name>''' : guest specific configurations<br />
<br />
=Preparing the Guests=<br />
<br />
Vserver will launch guests from subfolders of ''/etc/vservers/.defaults/vdirbase''. As such, creating a new guest system is as simple as installing the required packages in a folder of the host. Furthermore, there's nothing stopping you ( and quite a few things encouraging you ) to mount filesystems to the subfolders of ''vdirbase'' and installing your guest in there.<br />
<br />
If you plan on doing this often, I highly recommend that you write yourself a little batch script since most of these steps can be automated quite easily.<br />
<br />
==Preparing the guest installation media==<br />
<br />
'''NOTE''' : This is all heavily inspired from [http://wiki.archlinux.org/index.php/Install_From_Existing_Linux wiki:Install From Existing Linux] and will therefore be quite brief when not mentioning Vserver specific steps.<br />
<br />
===Optional: Base variables to follow along with the steps===<br />
GuestName= # Name of the guest<br />
GuestRoot=/etc/vservers/.defaults/vdirbase/$GuestName<br />
GuestPackages= # Listing of packages to install via pacman<br />
GuestDisk= # Installation target device<br />
GuestNetDevice= # ex.: eth0, dummy0, etc...<br />
GuestIP= # I think you get it<br />
GuestContext= # Unique identifier for the guest, I go with the last part of the IP<br />
<br />
===Optional: Preparing the guest disk===<br />
# Create a LVM Physical Volume, a Volume Group and a Logical Volume ( [http://wiki.archlinux.org/index.php/Lvm#Create_Logical_Volumes wiki:LVM] )<br />
# Create a filesystem on the lvm volume<br />
# mkdir $GuestRoot<br />
# mount /dev/$GuestDisk $GuestRoot<br />
<br />
===Optional: Link the host and guest pacman cache===<br />
# mkdir $GuestRoot/var/cache/pacman/pkg<br />
# mount -o bind /var/cache/pacman/pkg $GuestRoot/var/cache/pacman/pkg<br />
<br />
===Prepare Vserver===<br />
# vserver $GuestName -m skeleton --context $GuestContext --interface $GuestNetDevice:$GuestIP --flags lock,virt_mem,virt_uptime,virt_cpu,virt_load,sched_hard,hide_netif --initstyle plain<br />
# (optional) cd /etc/vservers/$GuestName/interfaces<br />
# (optional) cp -r 0 1<br />
# (optional) echo 'lo' > dev<br />
# (optional) echo '127.0.0.$GuestContext' > ip<br />
<br />
===Prepare the guest's filesystem===<br />
# Prepare guest filesystem for the pacman db<br />
## mkdir -p /newarch/var/lib/pacman <br />
<br />
===Install the base system===<br />
'''NOTE : ''' To save some time, it's probably a good idea to create a text file containing all the packages to install and call it via "pacman -Sy `cat $GuestPackages` -r $GuestRoot" instead of the following : <br />
# pacman -Sy base -r $GuestRoot<br />
# Optional: If you want to chroot into the newly created guest so as to install new packages, it might be a good idea to mount a few filesystems required by some packages.<br />
## Bind /dev, /proc, /sys to the corresponding directories in $GuestRoot<br />
# Modify guest configuration files to enable a smoother boot process<br />
## Modify '''/etc/inittab''' by deleting all lines that create the consoles ( agetty )<br />
## Modify '''/etc/rc.shutdown''' by removing anything hardware/clock/mount related. This includes most everything under ''Saving Random Seed'.<br />
## Modify '''/etc/rc.sysinit''' by anything hardware/clock/mount related.<br />
## Create '''/etc/init.d/rc'''<br />
## Modify '''/etc/syslog-ng.conf''' by removing file("/proc/kmsg")<br />
## Modify '''/etc/rc.conf''' by removing the networks Daemon.<br />
# Ensure '''/etc/rc.*''' can be executed: "chmod +x /etc/rc.*"<br />
<br />
===Annexe : Configuration files modified===<br />
'''/etc/init.d/rc'''<br />
if [ $1 -eq 3 ]; then<br />
echo "entering runlevel 3:multi";<br />
/etc/rc.multi<br />
fi<br />
if [ $1 -eq 6 ]; then<br />
echo "entering runlevel 6:reboot";<br />
/etc/rc.shutdown<br />
fi<br />
if [ $1 -eq 0 ]; then<br />
echo "entering runlevel 0: shutdown";<br />
/etc/rc.shutdown<br />
fi<br />
if [ $1 -eq 4 ]; then<br />
echo "entering runlevel 4";<br />
fi<br />
if [ $1 -eq 5 ]; then<br />
echo "entering runlevel 5";<br />
fi<br />
if [ $1 -eq 1 ]; then<br />
echo "entering runlevel 1:single";<br />
/etc/rc.single<br />
fi<br />
if [ $1 -eq 2 ]; then<br />
echo "entering runlevel 2:multi";<br />
/etc/rc.multi<br />
fi<br />
<br />
====/etc/rc.sysinit====<br />
#!/bin/bash<br />
#<br />
# /etc/rc.sysinit<br />
#<br />
<br />
. /etc/rc.conf<br />
. /etc/rc.d/functions<br />
<br />
echo " "<br />
printhl "Arch Linux\n"<br />
printhl "${C_H2}http://www.archlinux.org"<br />
printhl "Copyright 2002-2007 Judd Vinet"<br />
printhl "Copyright 2007-2009 Aaron Griffin"<br />
printhl "Distributed under the GNU General Public License (GPL)"<br />
printsep<br />
<br />
<br />
# start up our mini logger until syslog takes over<br />
/sbin/minilogd<br />
<br />
if [ -x /sbin/udevadm ]; then<br />
stat_busy "Starting UDev Daemon"<br />
/sbin/udevd --daemon<br />
stat_done<br />
else<br />
# Static /dev, our last resort<br />
status "Using static /dev filesystem" true<br />
fi<br />
<br />
# Trigger udev uevents<br />
if /bin/pidof -o %PPID /sbin/udevd >/dev/null; then<br />
stat_busy "Triggering UDev uevents"<br />
/sbin/udevadm trigger<br />
stat_done<br />
fi<br />
NETFS="nonfs,nonfs4,nosmbfs,nocifs,nocodafs,noncpfs,nosysfs,noshfs,nofuse,nofuseblk,noglusterfs"<br />
<br />
stat_busy "Mounting Local Filesystems"<br />
/bin/rm -f /etc/mtab*<br />
# Write /proc, /sys and /dev to /etc/mtab<br />
if [ -e /proc/mounts ]; then<br />
/bin/grep -e "rootfs" -e "/proc " -e "/sys " -e "/dev " /proc/mounts >> /etc/mtab<br />
fi<br />
stat_done<br />
<br />
stat_busy "Configuring System Clock"<br />
if [ ! -f /var/lib/hwclock/adjtime ]; then<br />
echo "0.0 0 0.0" > /var/lib/hwclock/adjtime<br />
fi<br />
if [ "$TIMEZONE" != "" -a -e "/usr/share/zoneinfo/$TIMEZONE" ]; then<br />
/bin/rm -f /etc/localtime<br />
/bin/cp "/usr/share/zoneinfo/$TIMEZONE" /etc/localtime<br />
fi<br />
<br />
if [ -n "$HWCLOCK_PARAMS" ]; then<br />
/sbin/hwclock --adjust #Adjust for system drift<br />
/sbin/hwclock $HWCLOCK_PARAMS<br />
fi<br />
stat_done<br />
<br />
RANDOM_SEED=/var/lib/misc/random-seed<br />
if [ -f $RANDOM_SEED ]; then<br />
stat_busy "Initializing Random Seed"<br />
/bin/cat $RANDOM_SEED > /dev/urandom<br />
stat_done<br />
fi<br />
<br />
stat_busy "Removing Leftover Files"<br />
/bin/rm -f /etc/nologin &>/dev/null<br />
/bin/rm -f /etc/shutdownpid &>/dev/null<br />
/bin/rm -f /var/lock/* &>/dev/null<br />
/bin/rm -rf /tmp/* /tmp/.* &>/dev/null<br />
/bin/rm -f /forcefsck &>/dev/null<br />
(cd /var/run && /usr/bin/find . ! -type d -exec /bin/rm -f -- {} \; )<br />
: > /var/run/utmp<br />
/bin/chmod 0664 /var/run/utmp<br />
# Keep {x,k,g}dm happy with xorg<br />
/bin/mkdir /tmp/.ICE-unix && /bin/chmod 1777 /tmp/.ICE-unix<br />
/bin/mkdir /tmp/.X11-unix && /bin/chmod 1777 /tmp/.X11-unix<br />
stat_done<br />
<br />
#status "Updating Shared Library Links" /sbin/ldconfig<br />
<br />
if [ "$HOSTNAME" != "" ]; then<br />
status "Setting Hostname: $HOSTNAME" /bin/hostname $HOSTNAME<br />
fi<br />
<br />
# Set the NIS domain name, if necessary<br />
[ -f /etc/conf.d/nisdomainname ] && . /etc/conf.d/nisdomainname<br />
if [ "$NISDOMAINNAME" != "" ]; then<br />
status "Setting NIS Domain Name: $NISDOMAINNAME" /bin/nisdomainname $NISDOMAINNAME<br />
fi<br />
<br />
status "Updating Module Dependencies" /sbin/depmod -A<br />
<br />
# Flush old locale settings<br />
: >/etc/profile.d/locale.sh<br />
/bin/chmod 755 /etc/profile.d/locale.sh<br />
# Set user defined locale<br />
[ -z "$LOCALE" ] && LOCALE="en_US"<br />
stat_busy "Setting Locale: $LOCALE"<br />
echo "export LANG=$LOCALE" >>/etc/profile.d/locale.sh<br />
stat_done<br />
<br />
# Adding persistent network/cdrom generated rules<br />
if [ -f "/dev/.udev/tmp-rules--70-persistent-cd.rules" ]; then<br />
stat_busy "Adding persistent cdrom udev rules"<br />
/bin/cat /dev/.udev/tmp-rules--70-persistent-cd.rules >> /etc/udev/rules.d/70-persistent-cd.rules<br />
stat_done<br />
fi<br />
if [ -f "/dev/.udev/tmp-rules--70-persistent-net.rules" ]; then<br />
stat_busy "Adding persistent network udev rules"<br />
/bin/cat /dev/.udev/tmp-rules--70-persistent-net.rules >> /etc/udev/rules.d /70-persistent-net.rules<br />
stat_done<br />
fi<br />
<br />
/bin/dmesg >| /var/log/dmesg.log<br />
<br />
# End of file<br />
# vim: set ts=2 noet:<br />
<br />
====/etc/rc.shutdown====<br />
#!/bin/bash<br />
#<br />
# /etc/rc.shutdown<br />
#<br />
<br />
. /etc/rc.conf<br />
. /etc/rc.d/functions<br />
<br />
# avoid staircase effect<br />
/bin/stty onlcr<br />
<br />
echo " "<br />
printhl "Initiating Shutdown..."<br />
echo " "<br />
<br />
# avoid NIS hanging syslog-ng on shutdown by unsetting the domainname<br />
if [ -x /bin/domainname ]; then<br />
/bin/domainname ""<br />
fi<br />
<br />
if [ -x /etc/rc.local.shutdown ]; then<br />
/etc/rc.local.shutdown<br />
fi<br />
<br />
if [ "$PREVLEVEL" = "3" -o "$PREVLEVEL" = "5" ]; then<br />
# Find daemons NOT in the DAEMONS array. Shut these down first<br />
if [ -d /var/run/daemons ]; then<br />
for daemon in $(/bin/ls -1t /var/run/daemons); do<br />
if ! in_array $daemon ${DAEMONS[@]}; then<br />
stop_daemon $daemon<br />
fi<br />
done<br />
fi<br />
# Shutdown daemons in reverse order<br />
let i=${#DAEMONS[@]}-1<br />
while [ $i -ge 0 ]; do<br />
if [ "${DAEMONS[$i]:0:1}" != '!' ]; then<br />
ck_daemon ${DAEMONS[$i]#@} || stop_daemon ${DAEMONS[$i]#@}<br />
fi<br />
let i=i-1<br />
done<br />
fi<br />
<br />
# Terminate all processes<br />
stat_busy "Sending SIGTERM To Processes"<br />
/sbin/killall5 -15 &> /dev/null<br />
/bin/sleep 5<br />
stat_done<br />
<br />
stat_busy "Sending SIGKILL To Processes"<br />
/sbin/killall5 -9 &> /dev/null<br />
/bin/sleep 1<br />
stat_done<br />
<br />
# Write to wtmp file before unmounting<br />
/sbin/halt -w<br />
<br />
# Power off or reboot<br />
if [ "$RUNLEVEL" = "0" ]; then<br />
printsep<br />
printhl "${C_H2}POWER OFF"<br />
/sbin/poweroff -d -f -h -i<br />
else<br />
printsep<br />
printhl "${C_H2}REBOOTING"<br />
# if kexec is installed and a kernel is loaded, use it<br />
[ -x /sbin/kexec ] && /sbin/kexec -e > /dev/null 2>&1<br />
/sbin/reboot -d -f -i<br />
fi<br />
<br />
# End of file<br />
# vim: set ts=2 sw=2 noet:<br />
<br />
=Troubleshooting=<br />
==Viewing output from vserver $GuestName start / stop==<br />
<br />
'''NOTE : ''' For me, this only worked in the actual consoles, not in X.<br />
<br />
# Make sure that the device /dev/console exists in the guest<br />
## If it does not, cp -a /dev/console $GuestRoot/dev/<br />
<br />
==SSH will not start==<br />
I noticed that /dev/null did not always get created properly in my first experimentations. Therefore I did a quick : <br />
# cp -a /dev/null $GuestRoot/dev<br />
# cp -a /dev/zero $GuestRoot/dev<br />
<br />
Furthermore, if you're not using the dummy network driver and are attaching to the host's network interface, you'll want to configure the ListenAddress statement of /etc/ssh/sshd_config so that it binds only to the guest's IP address as opposed to 127.0.0.1.<br />
<br />
==SSH immediately terminates the connection==<br />
On my machine, SSH used to authenticate me correctly and log me in, but then immediately drop the connection without an explanation. Consulting /var/log/auth.log revealed the following:<br />
<br />
sshd[17899]: pam_limits(sshd:session): Could not set limit for 'nice': Operation not permitted<br />
<br />
This is easily fixed by commenting all '''nice''' related lines in /etc/security/limits.conf.<br />
<br />
=Tips & Trick=<br />
==Network via dummy adapters==<br />
Here, you're either using the dummy module to create virtual network adapters or created interface aliases via /usr/sbin/ip or /usr/sbin/ifconfig. I went for the former and configured the host as such : <br />
# ''/etc/sysctl.conf'' : net.ipv4.ip_forward=1<br><br />
Modify or add that statement to enable routing on the host<br />
# ''/etc/rc.local''<br><br />
modprobe dummy numdummies=$NumberOfGuests<br><br />
ip link set dev dummy$GuestContext name $GuestName<br />
<br />
This provides me with dummy interfaces that I can route / firewall that are all named the same as my guests... yay.<br />
<br />
=More Resources=<br />
[http://linux-vserver.org/Problematic_Programs Problematic Programs]<br><br />
[http://linux-vserver.org/Howto_make_bsd-style_init_sysv-compatible Make BSD style init SYSV compatible]<br><br />
[http://www.cedarcreeksoftware.com/an-even-easier-linux-vserver-tutorial.html Vserver tutorial]<br><br />
[http://linux-vserver.org/Installation_on_ArchLinux linux-vserver.org's Installation on ArchLinux]<br><br />
[http://wiki.linux-vserver.org/Networking_vserver_guests linux-verserver.org's networking tutorial]<br><br />
<!-- vim: set ft=Wikipedia: --></div>Karottenreibehttps://wiki.archlinux.org/index.php?title=Arch_VServer&diff=130955Arch VServer2011-02-14T22:01:47Z<p>Karottenreibe: /* Install the base system */ fixed botched line break, added tip to make rc files executable</p>
<hr />
<div>[[Category:Emulators (English)]][[Category: HOWTOs (English)]]<br />
This article aims to provide all necessary information regarding the creation of a vserver host as well as vserver guests running Arch Linux. Tis will enable you to setup virtual servers that provide different services as if they were on different machines, with a very little overhead. You can get more information about virtual servers [http://en.wikipedia.org/wiki/Virtual_private_server here].<br />
<br />
====Current status / Next steps====<br />
I've just started playing around with vserver and am finding the documentation regarding this project lacking. As such, the way I'm doing this below may not be optimal.<br />
<br />
That being said, I'm thinking that the next step to make this more efficient would be to write the proper scripts to integrate pacman into util-vserver as has been done for apt, rpm, etc... The actual files may be found in ''/usr/lib/util-vserver''.<br />
<br />
=Preparing the Host=<br />
<br />
To prepare the vserver host environment, you will need to install both a vserver patched kernel, the vserver utilities and their dependencies which are located in the [[AUR]]. The required packages are {{Package AUR|dietlibc}}, {{Package AUR|beecrypt}}, {{Package AUR|kernel26-vserver}}, and {{Package AUR|util-vserver}}<br />
<br />
=Paths of Interest=<br />
<br />
'''/etc/vservers''' : configuration root ( [http://www.nongnu.org/util-vserver/doc/conf/configuration.html ''reference''] )<br />
: '''/etc/vservers/.defaults''' : configuration skeleton used when building new guests<br />
:: '''/etc/vservers/.defaults/vdirbase''' : symlink to the folder containing vserver guests. This defaults to /vservers.<br />
: '''/etc/vservers/<guest name>''' : guest specific configurations<br />
<br />
=Preparing the Guests=<br />
<br />
Vserver will launch guests from subfolders of ''/etc/vservers/.defaults/vdirbase''. As such, creating a new guest system is as simple as installing the required packages in a folder of the host. Furthermore, there's nothing stopping you ( and quite a few things encouraging you ) to mount filesystems to the subfolders of ''vdirbase'' and installing your guest in there.<br />
<br />
If you plan on doing this often, I highly recommend that you write yourself a little batch script since most of these steps can be automated quite easily.<br />
<br />
==Preparing the guest installation media==<br />
<br />
'''NOTE''' : This is all heavily inspired from [http://wiki.archlinux.org/index.php/Install_From_Existing_Linux wiki:Install From Existing Linux] and will therefore be quite brief when not mentioning Vserver specific steps.<br />
<br />
===Optional: Base variables to follow along with the steps===<br />
GuestName= # Name of the guest<br />
GuestRoot=/etc/vservers/.defaults/vdirbase/$GuestName<br />
GuestPackages= # Listing of packages to install via pacman<br />
GuestDisk= # Installation target device<br />
GuestNetDevice= # ex.: eth0, dummy0, etc...<br />
GuestIP= # I think you get it<br />
GuestContext= # Unique identifier for the guest, I go with the last part of the IP<br />
<br />
===Optional: Preparing the guest disk===<br />
# Create a LVM Physical Volume, a Volume Group and a Logical Volume ( [http://wiki.archlinux.org/index.php/Lvm#Create_Logical_Volumes wiki:LVM] )<br />
# Create a filesystem on the lvm volume<br />
# mkdir $GuestRoot<br />
# mount /dev/$GuestDisk $GuestRoot<br />
<br />
===Optional: Link the host and guest pacman cache===<br />
# mkdir $GuestRoot/var/cache/pacman/pkg<br />
# mount -o bind /var/cache/pacman/pkg $GuestRoot/var/cache/pacman/pkg<br />
<br />
===Prepare Vserver===<br />
# vserver $GuestName -m skeleton --context $GuestContext --interface $GuestNetDevice:$GuestIP --flags lock,virt_mem,virt_uptime,virt_cpu,virt_load,sched_hard,hide_netif --initstyle plain<br />
# (optional) cd /etc/vservers/$GuestName/interfaces<br />
# (optional) cp -r 0 1<br />
# (optional) echo 'lo' > dev<br />
# (optional) echo '127.0.0.$GuestContext' > ip<br />
<br />
===Prepare the guest's filesystem===<br />
# Prepare guest filesystem for the pacman db<br />
## mkdir -p /newarch/var/lib/pacman <br />
<br />
===Install the base system===<br />
'''NOTE : ''' To save some time, it's probably a good idea to create a text file containing all the packages to install and call it via "pacman -Sy `cat $GuestPackages` -r $GuestRoot" instead of the following : <br />
# pacman -Sy base -r $GuestRoot<br />
# Optional: If you want to chroot into the newly created guest so as to install new packages, it might be a good idea to mount a few filesystems required by some packages.<br />
## Bind /dev, /proc, /sys to the corresponding directories in $GuestRoot<br />
# Modify guest configuration files to enable a smoother boot process<br />
## Modify '''/etc/inittab''' by deleting all lines that create the consoles ( agetty )<br />
## Modify '''/etc/rc.shutdown''' by removing anything hardware/clock/mount related. This includes most everything under ''Saving Random Seed'.<br />
## Modify '''/etc/rc.sysinit''' by anything hardware/clock/mount related.<br />
## Create '''/etc/init.d/rc'''<br />
## Modify '''/etc/syslog-ng.conf''' by removing file("/proc/kmsg")<br />
## Modify '''/etc/rc.conf''' by removing the networks Daemon.<br />
# Ensure '''/etc/rc.*''' can be executed: "chmod +x /etc/rc.*"<br />
<br />
===Annexe : Configuration files modified===<br />
'''/etc/init.d/rc'''<br />
if [ $1 -eq 3 ]; then<br />
echo "entering runlevel 3:multi";<br />
/etc/rc.multi<br />
fi<br />
if [ $1 -eq 6 ]; then<br />
echo "entering runlevel 6:reboot";<br />
/etc/rc.shutdown<br />
fi<br />
if [ $1 -eq 0 ]; then<br />
echo "entering runlevel 0: shutdown";<br />
/etc/rc.shutdown<br />
fi<br />
if [ $1 -eq 4 ]; then<br />
echo "entering runlevel 4";<br />
fi<br />
if [ $1 -eq 5 ]; then<br />
echo "entering runlevel 5";<br />
fi<br />
if [ $1 -eq 1 ]; then<br />
echo "entering runlevel 1:single";<br />
/etc/rc.single<br />
fi<br />
if [ $1 -eq 2 ]; then<br />
echo "entering runlevel 2:multi";<br />
/etc/rc.multi<br />
fi<br />
<br />
====/etc/rc.sysinit====<br />
#!/bin/bash<br />
#<br />
# /etc/rc.sysinit<br />
#<br />
<br />
. /etc/rc.conf<br />
. /etc/rc.d/functions<br />
<br />
echo " "<br />
printhl "Arch Linux\n"<br />
printhl "${C_H2}http://www.archlinux.org"<br />
printhl "Copyright 2002-2007 Judd Vinet"<br />
printhl "Copyright 2007-2009 Aaron Griffin"<br />
printhl "Distributed under the GNU General Public License (GPL)"<br />
printsep<br />
<br />
<br />
# start up our mini logger until syslog takes over<br />
/sbin/minilogd<br />
<br />
if [ -x /sbin/udevadm ]; then<br />
stat_busy "Starting UDev Daemon"<br />
/sbin/udevd --daemon<br />
stat_done<br />
else<br />
# Static /dev, our last resort<br />
status "Using static /dev filesystem" true<br />
fi<br />
<br />
# Trigger udev uevents<br />
if /bin/pidof -o %PPID /sbin/udevd >/dev/null; then<br />
stat_busy "Triggering UDev uevents"<br />
/sbin/udevadm trigger<br />
stat_done<br />
fi<br />
NETFS="nonfs,nonfs4,nosmbfs,nocifs,nocodafs,noncpfs,nosysfs,noshfs,nofuse,nofuseblk,noglusterfs"<br />
<br />
stat_busy "Mounting Local Filesystems"<br />
/bin/rm -f /etc/mtab*<br />
# Write /proc, /sys and /dev to /etc/mtab<br />
if [ -e /proc/mounts ]; then<br />
/bin/grep -e "rootfs" -e "/proc " -e "/sys " -e "/dev " /proc/mounts >> /etc/mtab<br />
fi<br />
stat_done<br />
<br />
stat_busy "Configuring System Clock"<br />
if [ ! -f /var/lib/hwclock/adjtime ]; then<br />
echo "0.0 0 0.0" > /var/lib/hwclock/adjtime<br />
fi<br />
if [ "$TIMEZONE" != "" -a -e "/usr/share/zoneinfo/$TIMEZONE" ]; then<br />
/bin/rm -f /etc/localtime<br />
/bin/cp "/usr/share/zoneinfo/$TIMEZONE" /etc/localtime<br />
fi<br />
<br />
if [ -n "$HWCLOCK_PARAMS" ]; then<br />
/sbin/hwclock --adjust #Adjust for system drift<br />
/sbin/hwclock $HWCLOCK_PARAMS<br />
fi<br />
stat_done<br />
<br />
RANDOM_SEED=/var/lib/misc/random-seed<br />
if [ -f $RANDOM_SEED ]; then<br />
stat_busy "Initializing Random Seed"<br />
/bin/cat $RANDOM_SEED > /dev/urandom<br />
stat_done<br />
fi<br />
<br />
stat_busy "Removing Leftover Files"<br />
/bin/rm -f /etc/nologin &>/dev/null<br />
/bin/rm -f /etc/shutdownpid &>/dev/null<br />
/bin/rm -f /var/lock/* &>/dev/null<br />
/bin/rm -rf /tmp/* /tmp/.* &>/dev/null<br />
/bin/rm -f /forcefsck &>/dev/null<br />
(cd /var/run && /usr/bin/find . ! -type d -exec /bin/rm -f -- {} \; )<br />
: > /var/run/utmp<br />
/bin/chmod 0664 /var/run/utmp<br />
# Keep {x,k,g}dm happy with xorg<br />
/bin/mkdir /tmp/.ICE-unix && /bin/chmod 1777 /tmp/.ICE-unix<br />
/bin/mkdir /tmp/.X11-unix && /bin/chmod 1777 /tmp/.X11-unix<br />
stat_done<br />
<br />
#status "Updating Shared Library Links" /sbin/ldconfig<br />
<br />
if [ "$HOSTNAME" != "" ]; then<br />
status "Setting Hostname: $HOSTNAME" /bin/hostname $HOSTNAME<br />
fi<br />
<br />
# Set the NIS domain name, if necessary<br />
[ -f /etc/conf.d/nisdomainname ] && . /etc/conf.d/nisdomainname<br />
if [ "$NISDOMAINNAME" != "" ]; then<br />
status "Setting NIS Domain Name: $NISDOMAINNAME" /bin/nisdomainname $NISDOMAINNAME<br />
fi<br />
<br />
status "Updating Module Dependencies" /sbin/depmod -A<br />
<br />
# Flush old locale settings<br />
: >/etc/profile.d/locale.sh<br />
/bin/chmod 755 /etc/profile.d/locale.sh<br />
# Set user defined locale<br />
[ -z "$LOCALE" ] && LOCALE="en_US"<br />
stat_busy "Setting Locale: $LOCALE"<br />
echo "export LANG=$LOCALE" >>/etc/profile.d/locale.sh<br />
stat_done<br />
<br />
# Adding persistent network/cdrom generated rules<br />
if [ -f "/dev/.udev/tmp-rules--70-persistent-cd.rules" ]; then<br />
stat_busy "Adding persistent cdrom udev rules"<br />
/bin/cat /dev/.udev/tmp-rules--70-persistent-cd.rules >> /etc/udev/rules.d/70-persistent-cd.rules<br />
stat_done<br />
fi<br />
if [ -f "/dev/.udev/tmp-rules--70-persistent-net.rules" ]; then<br />
stat_busy "Adding persistent network udev rules"<br />
/bin/cat /dev/.udev/tmp-rules--70-persistent-net.rules >> /etc/udev/rules.d /70-persistent-net.rules<br />
stat_done<br />
fi<br />
<br />
/bin/dmesg >| /var/log/dmesg.log<br />
<br />
# End of file<br />
# vim: set ts=2 noet:<br />
<br />
====/etc/rc.shutdown====<br />
#!/bin/bash<br />
#<br />
# /etc/rc.shutdown<br />
#<br />
<br />
. /etc/rc.conf<br />
. /etc/rc.d/functions<br />
<br />
# avoid staircase effect<br />
/bin/stty onlcr<br />
<br />
echo " "<br />
printhl "Initiating Shutdown..."<br />
echo " "<br />
<br />
# avoid NIS hanging syslog-ng on shutdown by unsetting the domainname<br />
if [ -x /bin/domainname ]; then<br />
/bin/domainname ""<br />
fi<br />
<br />
if [ -x /etc/rc.local.shutdown ]; then<br />
/etc/rc.local.shutdown<br />
fi<br />
<br />
if [ "$PREVLEVEL" = "3" -o "$PREVLEVEL" = "5" ]; then<br />
# Find daemons NOT in the DAEMONS array. Shut these down first<br />
if [ -d /var/run/daemons ]; then<br />
for daemon in $(/bin/ls -1t /var/run/daemons); do<br />
if ! in_array $daemon ${DAEMONS[@]}; then<br />
stop_daemon $daemon<br />
fi<br />
done<br />
fi<br />
# Shutdown daemons in reverse order<br />
let i=${#DAEMONS[@]}-1<br />
while [ $i -ge 0 ]; do<br />
if [ "${DAEMONS[$i]:0:1}" != '!' ]; then<br />
ck_daemon ${DAEMONS[$i]#@} || stop_daemon ${DAEMONS[$i]#@}<br />
fi<br />
let i=i-1<br />
done<br />
fi<br />
<br />
# Terminate all processes<br />
stat_busy "Sending SIGTERM To Processes"<br />
/sbin/killall5 -15 &> /dev/null<br />
/bin/sleep 5<br />
stat_done<br />
<br />
stat_busy "Sending SIGKILL To Processes"<br />
/sbin/killall5 -9 &> /dev/null<br />
/bin/sleep 1<br />
stat_done<br />
<br />
# Write to wtmp file before unmounting<br />
/sbin/halt -w<br />
<br />
# Power off or reboot<br />
if [ "$RUNLEVEL" = "0" ]; then<br />
printsep<br />
printhl "${C_H2}POWER OFF"<br />
/sbin/poweroff -d -f -h -i<br />
else<br />
printsep<br />
printhl "${C_H2}REBOOTING"<br />
# if kexec is installed and a kernel is loaded, use it<br />
[ -x /sbin/kexec ] && /sbin/kexec -e > /dev/null 2>&1<br />
/sbin/reboot -d -f -i<br />
fi<br />
<br />
# End of file<br />
# vim: set ts=2 sw=2 noet:<br />
<br />
=Troubleshooting=<br />
==Viewing output from vserver $GuestName start / stop==<br />
<br />
'''NOTE : ''' For me, this only worked in the actual consoles, not in X.<br />
<br />
# Make sure that the device /dev/console exists in the guest<br />
## If it does not, cp -a /dev/console $GuestRoot/dev/<br />
<br />
==SSH will not start==<br />
I noticed that /dev/null did not always get created properly in my first experimentations. Therefore I did a quick : <br />
# cp -a /dev/null $GuestRoot/dev<br />
# cp -a /dev/zero $GuestRoot/dev<br />
<br />
Furthermore, if you're not using the dummy network driver and are attaching to the host's network interface, you'll want to configure the ListenAddress statement of /etc/ssh/sshd_config so that it binds only to the guest's IP address as opposed to 127.0.0.1.<br />
<br />
<br />
=Tips & Trick=<br />
==Network via dummy adapters==<br />
Here, you're either using the dummy module to create virtual network adapters or created interface aliases via /usr/sbin/ip or /usr/sbin/ifconfig. I went for the former and configured the host as such : <br />
# ''/etc/sysctl.conf'' : net.ipv4.ip_forward=1<br><br />
Modify or add that statement to enable routing on the host<br />
# ''/etc/rc.local''<br><br />
modprobe dummy numdummies=$NumberOfGuests<br><br />
ip link set dev dummy$GuestContext name $GuestName<br />
<br />
This provides me with dummy interfaces that I can route / firewall that are all named the same as my guests... yay.<br />
<br />
=More Resources=<br />
[http://linux-vserver.org/Problematic_Programs Problematic Programs]<br><br />
[http://linux-vserver.org/Howto_make_bsd-style_init_sysv-compatible Make BSD style init SYSV compatible]<br><br />
[http://www.cedarcreeksoftware.com/an-even-easier-linux-vserver-tutorial.html Vserver tutorial]<br><br />
[http://linux-vserver.org/Installation_on_ArchLinux linux-vserver.org's Installation on ArchLinux]<br><br />
[http://wiki.linux-vserver.org/Networking_vserver_guests linux-verserver.org's networking tutorial]<br><br />
<!-- vim: set ft=Wikipedia: --></div>Karottenreibe