http://linux-vserver.org/api.php?action=feedcontributions&user=95.223.145.189&feedformat=atomLinux-VServer - User contributions [en]2024-03-29T10:14:24ZUser contributionsMediaWiki 1.20.2http://linux-vserver.org/Upstart_issuesUpstart issues2009-11-16T02:11:47Z<p>95.223.145.189: </p>
<hr />
<div>== running an upstart based guest ==<br />
<br />
currently upstart based guests need some manual tweaking to make them work inside a vserver guest.<br />
<br />
=== prepare the host ===<br />
First of all you need to set the init style of your vserver to plain<br />
# echo plain > /etc/vservers/<vservername>/apps/init/style<br />
<br />
=== remove low level services inside the guest ===<br />
Then you need to get rid of anything in <code>/etc/init/</code> that tries to fiddle with your Server's Hardware or other low-level Stuff that's already handled by your host's kernel/system. Having one such scriptlet still enabled might cause the whole upstart system to fail (like not beeing able to open <code>/dev/console</code> or failing to start the udev system).<br />
Just remove these scriptlets, move them out of the way or rename them to something not ending in <code>.conf</code>. Be aware that upstart also parses subfolders of <code>/etc/init/</code> for <code>.conf</code> files.<br />
<br />
This is what I deleted on a basic Ubuntu 9.10 guest:<br />
dmesg.conf<br />
hostname.conf<br />
hwclock-save.conf<br />
hwclock.conf<br />
mountall-net.conf<br />
mountall-reboot.conf<br />
mountall-shell.conf<br />
mountall.conf<br />
network-interface.conf<br />
networking.conf<br />
procps.conf<br />
rsyslog-kmsg.conf<br />
tty1.conf<br />
tty2.conf<br />
tty3.conf<br />
tty4.conf<br />
tty5.conf<br />
tty6.conf<br />
upstart-udev-bridge.conf<br />
<br />
=== fake low level events inside the guest ===<br />
Finally you need to fake emit the events that some of these scripts would do during regular boot. Probably the cleanest approach is to add a scriptlet <code>vserver.conf</code> to <code>/etc/init/</code> with this content:<br />
start on startup<br />
script<br />
initctl emit virtual-filesystems<br />
initctl emit local-filesystems<br />
initctl emit remote-filesystems<br />
initctl emit filesystem<br />
end script<br />
<br />
=== Notes for older kernels ===<br />
If you encounter upstart errors like this:<br />
<br />
$ vserver foo start<br />
init: missing runlevel<br />
Try `init --help' for more information.<br />
<br />
or<br />
<br />
$ vserver foo start<br />
telinit: Failed to connect to socket /com/ubuntu/upstart: Connection refused<br />
<br />
then you're probably running the current stable version <code>2.6.22.19-vs2.2.0.7</code>.<br />
<br />
Upstart's <code>/sbin/init</code> implementation requires to be PID 1. It is linked against NPTL (in contrast to sysvinit), which has a bug in it's caching <code>getpid(2)</code> wrapper. With this kernel version <code>getpid(2)</code> returns the cached PID to init, resulting in init replacing itself with telinit. You can fix this by upgrading to a <code>2.6.26+</code> kernel and a newer vserver patch, or by patching upstart:<br />
<br />
diff --git a/init/main.c b/init/main.c<br />
index bfcd528..c6c9304 100644<br />
--- a/init/main.c<br />
+++ b/init/main.c<br />
@@ -37,6 +37,7 @@<br />
#include <string.h><br />
#include <syslog.h><br />
#include <unistd.h><br />
+#include <syscall.h><br />
<br />
#include <linux/kd.h><br />
<br />
@@ -131,7 +132,7 @@ main (int argc,<br />
}<br />
<br />
/* Check we're process #1 */<br />
- if (getpid () > 1) {<br />
+ if (syscall(SYS_getpid) > 1) {<br />
execv (TELINIT, argv);<br />
/* Ignore failure, probably just that telinit doesn't exist */<br />
<br />
For more information see the man pages of <code>getpid(2)</code> (NOTES) and <code>clone(2)</code> (BUGS).</div>95.223.145.189http://linux-vserver.org/Upstart_issuesUpstart issues2009-11-16T01:36:00Z<p>95.223.145.189: /* remove low level services inside the guest */</p>
<hr />
<div>== running an upstart based guest ==<br />
<br />
currently upstart based guests need some manual tweaking to make them work inside a vserver guest.<br />
<br />
=== prepare the host ===<br />
First of all you need to set the init style of your vserver to plain<br />
# echo plain > /etc/vservers/<vservername>/apps/init/style<br />
<br />
=== remove low level services inside the guest ===<br />
Then you need to get rid of anything in <code>/etc/init/</code> that tries to fiddle with your Server's Hardware or other low-level Stuff that's already handled by your host's kernel/system. Having one such scriptlet still enabled might cause the whole upstart system to fail (like not beeing able to open <code>/dev/console</code> or failing to start the udev system).<br />
Just remove these scriptlets, move them out of the way or rename them to something not ending in <code>.conf</code>. Be aware that upstart also parses subfolders of <code>/etc/init/</code> for <code>.conf</code> files.<br />
<br />
This is what I deleted on a basic Ubuntu 9.10 guest:<br />
dmesg.conf<br />
hostname.conf<br />
hwclock-save.conf<br />
hwclock.conf<br />
mountall-net.conf<br />
mountall-reboot.conf<br />
mountall-shell.conf<br />
mountall.conf<br />
network-interface.conf<br />
networking.conf<br />
procps.conf<br />
rsyslog-kmsg.conf<br />
tty1.conf<br />
tty2.conf<br />
tty3.conf<br />
tty4.conf<br />
tty5.conf<br />
tty6.conf<br />
upstart-udev-bridge.conf<br />
<br />
=== fake low level events inside the guest ===<br />
Finally you need to fake emit the events that some of these scripts would do during regular boot. Probably the cleanest approach is to add a scriptlet <code>vserver.conf</code> to <code>/etc/init/</code> with this content:<br />
start on startup<br />
script<br />
initctl emit virtual-filesystems<br />
initctl emit local-filesystems<br />
initctl emit remote-filesystems<br />
initctl emit filesystem<br />
end script</div>95.223.145.189