Outils pour utilisateurs

Outils du site


tof:computer:vserver:upstart_ubuntu_lucid

Fix for running Ubuntu Lucid in vserver

This tweak is inspired by http://linux-vserver.org/Upstart_issues.

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 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

Be carefull to keep the control-alt-delete.conf service as it is used to shutdown the vserver with vserver <vservername> stop:

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)

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 sysinit configuration

In /etc/init/rc-sysinit.conf replace the following line:

start on filesystem and net-device-up IFACE=lo

by:

start on filesystem

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

Tweak ssh configuration

In /etc/init/ssh.conf comment the following line:

# replaces SSHD_OOM_ADJUST in /etc/default/ssh
#oom never

Create the console device

Missing of /dev/console makes all scripts with console output fail. First think would be to create the console device inside the guest but this should be avoided:

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

I use tty so the console outpouts on the current tty:

# mknod --mode=600 /etc/vservers/<vservername>/vdir/dev/console c 5 0

If you want to troubleshot from outside the vserver you can use for example tty8 as the console device for vservers:

# mknod --mode=600 /etc/vservers/<vservername>/vdir/dev/console c 4 8

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
tof/computer/vserver/upstart_ubuntu_lucid.txt · Dernière modification : 13/07/2010 11:58 de Christophe Boyanique

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki