Ceci est une ancienne révision du document !
Table des matières
Fix for running Ubuntu Lucid in vserver
This tweak is inspired by http://linux-vserver.org/Upstart_issues.
Stopping the vserver does not (yet) work correctly: init do not stop services and all processes are killed after a timeout by vserver utils:
# vserver <vservername> stop A timeout occured while waiting for the vserver to finish and it will be killed by sending a SIGKILL signal. The following process list might be useful for finding out the reason of this behavior: ---------------------------------------------------------------------- 15816 153 <vservername> ? Ss 0:00 /sbin/init 15835 153 <vservername> ? Ss 0:00 dbus-daemon --system --fork 15838 153 <vservername> ? Sl 0:00 rsyslogd -c4 15847 153 <vservername> ? Ss 0:00 /usr/sbin/sshd 15955 153 <vservername> ? Ss 0:00 atd --------------------------------------------------------------------
The vserver can be stopped cleanly by going to level 0 in the vserver:
vserver <vservername> exec telinit 0
19:57 <@Bertl> well, regarding console: you probably don't want 'the console' created inside a guest, because that means that upstart (from the guest) will write on your host console (and can read stuff from there too) 19:58 <@Bertl> what you want is to put a tty or pts there instead of the console, or if you like to see the output on the current tty just tty 19:59 <@Bertl> regarding the stop: your guest seems to ignore the 'normal' init signalling which is done when a guest is shut down 19:59 <@Bertl> thus, after a given (configureable) timeout, the guest is killed instead 20:00 <@Bertl> util-vserver does not execute stuff inside the guest, it simply sends a signal to init (inside the guest) 20:01 <@Bertl> (the singnal is SIGINT, and this equals to the CTRL-ALT-DEL action)
Choose plain init style
You can do that while building the vserver:
# vserver <vservername> build --initstyle plain ...
or afterward:
# echo plain > /etc/vservers/<vservername>/apps/init/style
Add tmpfs for varlock and varrun
# echo 'none /var/run tmpfs size=16m,nosuid,mode=0755 0 0' >>/etc/vservers/<vservername>/fstab # echo 'none /var/lock tmpfs size=16m,noexec,nosuid,nodev 0 0' >>/etc/vservers/<vservername>/fstab
Remove incompatible upstart services
# mkdir /etc/vservers/<vservername>/vdir/root/init.disabled # for srv in console-setup control-alt-delete dmesg failsafe-x hostname hwclock-save hwclock module-init-tools \ mountall-net mountall-reboot mountall-shell mountall network-interface network-interface-security networking \ plymouth-log plymouth-splash plymouth-stop plymouth procps rcS rsyslog-kmsg tty1 tty2 tty3 tty4 tty5 tty6 \ upstart-udev-bridge ureadahead-other ureadahead; do mv /etc/vservers/<vservername>/vdir/etc/init/${srv}.conf \ /etc/vservers/<vservername>/vdir/root/init.disabled/; done
Add vserver init task
Create the file /etc/init/vserver.conf
:
description "Vserver init" start on startup console output task pre-start script touch /var/run/utmp chown root:utmp /var/run/utmp chmod 664 /var/run/utmp end script script initctl emit virtual-filesystems --no-wait initctl emit local-filesystems --no-wait initctl emit remote-filesystems --no-wait initctl emit all-swaps --no-wait initctl emit filesystem --no-wait initctl emit mounting --no-wait initctl emit mounted MOUNTPOINT=/dev --no-wait initctl emit mounted MOUNTPOINT=/var/run --no-wait initctl emit mounted MOUNTPOINT=/tmp --no-wait initctl emit net-device-up IFACE=lo --no-wait end script
Tweak rsyslog configuration
In /etc/rsyslog.conf
comment two lines ($ModLoad imklog
and $KLogPath
):
################# #### MODULES #### ################# $ModLoad imuxsock # provides support for local system logging #$ModLoad imklog # provides kernel logging support (previously done by rklogd) #$ModLoad immark # provides --MARK-- message capability #$KLogPath /proc/kmsg
In /etc/rsyslog.d/50-default.conf
file, comment the last part about xconsole
:
# The named pipe /dev/xconsole is for the `xconsole' utility. To use it, # you must invoke `xconsole' with the `-file' option: # # $ xconsole -file /dev/xconsole [...] # # NOTE: adjust the list below, or you'll go crazy if you have a reasonably # busy site.. # #daemon.*;mail.*;\ # news.err;\ # *.=debug;*.=info;\ # *.=notice;*.=warn |/dev/xconsole
Create the console device
Missing of /dev/console
makes all scripts with console output
fail:
# mknod --mode=600 /etc/vservers/<vservername>/vdir/dev/console c 5 1
Install dbus
Dbus seems to be required by some init script as read on a mailing-list (cannot get back the reference); so install it in the vserver:
# aptitude install dbus