[Lxc-users] [lxc-devel] template-script for ubuntu [lucid] containers

Wilhelm wilhelm.meier at fh-kl.de
Tue Jun 1 20:17:48 UTC 2010


Am 01.06.2010 20:05, schrieb Daniel Lezcano:
> On 06/01/2010 09:50 PM, Wilhelm wrote:
>> Am 01.06.2010 16:06, schrieb Daniel Lezcano:
>>> On 06/01/2010 06:04 PM, Daniel Lezcano wrote:
>>>> On 05/30/2010 07:07 PM, Wilhelm wrote:
>>>>> Hi,
>>>>>
>>>>> for all interested: attached you'll find a template script for ubuntu
>>>>> containers.
>>>>>
>>>> Hi Willem,
>>>>
>>>> thanks a lot for the script, I fixed some nasty things but I was happy
>>>> to play with it :)
>>>>
>>>> Do you mind to modify the script in order to have '/var/tmp' not being
>>>
>>> sorry, I meant '/var/run'
>>
>> ok, changed it in the attached script (and added the patches you 
>> posted and some other tweaks)
>>>
>>>
>>>> mounted as a tmpfs, so the mechanism within lxc can 'shutdown' /
>>>> 'reboot' properly ?
>> but a "halt" from inside the container isn't handled properly: the 
>> init-process still remains ...
>> Any ideas?
>
> I added a mechanism to watch the utmp file in the container's rootfs 
> in lxc.
> This is not available for lxc 0.6.5, do you have this version ?
>
latest git and here ist the log with issuing halt insige the container:

root at ubuntu01:~# lxc-start -n test2 --logfile=/dev/stderr 
--logpriority=TRACE
       lxc-start 1275423291.064 DEBUG    lxc_conf - allocated pty 
'/dev/pts/1' (4/5)
       lxc-start 1275423291.065 DEBUG    lxc_conf - allocated pty 
'/dev/pts/2' (6/7)
       lxc-start 1275423291.065 DEBUG    lxc_conf - allocated pty 
'/dev/pts/3' (8/9)
       lxc-start 1275423291.065 DEBUG    lxc_conf - allocated pty 
'/dev/pts/4' (10/11)
       lxc-start 1275423291.065 INFO     lxc_conf - tty's configured
       lxc-start 1275423291.066 DEBUG    lxc_start - sigchild handler set
       lxc-start 1275423291.066 INFO     lxc_start - 'test2' is initialized
       lxc-start 1275423291.076 DEBUG    lxc_conf - instanciated macvlan 
'mcPR3qjD', index is '8' and mode '2'
       lxc-start 1275423291.089 DEBUG    lxc_cgroup - using cgroup 
mounted at '/lxc-cgroup'
       lxc-start 1275423291.089 DEBUG    lxc_cgroup - '/lxc-cgroup/4052' 
renamed to '/lxc-cgroup/test2'
       lxc-start 1275423291.092 DEBUG    lxc_conf - move 'eth0' to '4052'
       lxc-start 1275423291.092 INFO     lxc_conf - 'test2' hostname has 
been setup
       lxc-start 1275423291.094 DEBUG    lxc_conf - mac address 
'4a:49:43:49:79:03' on 'eth0' has been setup
       lxc-start 1275423291.095 DEBUG    lxc_conf - 'eth0' has been setup
       lxc-start 1275423291.095 INFO     lxc_conf - network has been setup
       lxc-start 1275423291.099 DEBUG    lxc_cgroup - using cgroup 
mounted at '/lxc-cgroup'
       lxc-start 1275423291.105 DEBUG    lxc_conf - cgroup 
'devices.deny' set to 'a'
       lxc-start 1275423291.105 DEBUG    lxc_conf - cgroup 
'devices.allow' set to 'c 1:3 rwm'
       lxc-start 1275423291.105 DEBUG    lxc_conf - cgroup 
'devices.allow' set to 'c 1:5 rwm'
       lxc-start 1275423291.105 DEBUG    lxc_conf - cgroup 
'devices.allow' set to 'c 5:1 rwm'
       lxc-start 1275423291.105 DEBUG    lxc_conf - cgroup 
'devices.allow' set to 'c 5:0 rwm'
       lxc-start 1275423291.105 DEBUG    lxc_conf - cgroup 
'devices.allow' set to 'c 4:0 rwm'
       lxc-start 1275423291.105 DEBUG    lxc_conf - cgroup 
'devices.allow' set to 'c 4:1 rwm'
       lxc-start 1275423291.105 DEBUG    lxc_conf - cgroup 
'devices.allow' set to 'c 1:9 rwm'
       lxc-start 1275423291.105 DEBUG    lxc_conf - cgroup 
'devices.allow' set to 'c 1:8 rwm'
       lxc-start 1275423291.105 DEBUG    lxc_conf - cgroup 
'devices.allow' set to 'c 136:* rwm'
       lxc-start 1275423291.105 DEBUG    lxc_conf - cgroup 
'devices.allow' set to 'c 5:2 rwm'
       lxc-start 1275423291.105 DEBUG    lxc_conf - cgroup 
'devices.allow' set to 'c 254:0 rwm'
       lxc-start 1275423291.105 INFO     lxc_conf - cgroup has been setup
       lxc-start 1275423291.106 DEBUG    lxc_conf - mounted proc on 
/usr/local/var/lib/lxc/test2/rootfs/proc, type proc
       lxc-start 1275423291.106 DEBUG    lxc_conf - mounted devpts on 
/usr/local/var/lib/lxc/test2/rootfs/dev/pts, type devpts
       lxc-start 1275423291.107 DEBUG    lxc_conf - mounted sysfs on 
/usr/local/var/lib/lxc/test2/rootfs/sys, type sysfs
       lxc-start 1275423291.107 INFO     lxc_conf - mount points have 
been setup
       lxc-start 1275423291.110 INFO     lxc_conf - mount points have 
been setup
       lxc-start 1275423291.110 INFO     lxc_conf - no console output 
required
       lxc-start 1275423291.110 INFO     lxc_conf - 4 tty(s) has been setup
       lxc-start 1275423291.111 DEBUG    lxc_conf - mounted 
'/usr/local/var/lib/lxc/test2/rootfs' on '/usr/local/lib/lxc/rootfs'
       lxc-start 1275423291.111 DEBUG    lxc_conf - created 
'/usr/local/lib/lxc/rootfs/oldrootfs' directory
       lxc-start 1275423291.111 DEBUG    lxc_conf - mountpoint for old 
rootfs is '/usr/local/lib/lxc/rootfs/oldrootfs'
       lxc-start 1275423291.116 DEBUG    lxc_conf - pivot_root syscall 
to '/usr/local/lib/lxc/rootfs' successful
       lxc-start 1275423291.117 DEBUG    lxc_conf - umounted 
'/oldrootfs/dev/pts'
       lxc-start 1275423291.117 DEBUG    lxc_conf - umounted 
'/oldrootfs/dev/shm'
       lxc-start 1275423291.117 DEBUG    lxc_conf - umounted 
'/oldrootfs/sys/fs/fuse/connections'
       lxc-start 1275423291.117 DEBUG    lxc_conf - umounted 
'/oldrootfs/sys/kernel/debug'
       lxc-start 1275423291.117 DEBUG    lxc_conf - umounted 
'/oldrootfs/sys/kernel/security'
       lxc-start 1275423291.117 DEBUG    lxc_conf - umounted 
'/oldrootfs/proc'
       lxc-start 1275423291.117 DEBUG    lxc_conf - umounted 
'/oldrootfs/var/run'
       lxc-start 1275423291.117 DEBUG    lxc_conf - umounted 
'/oldrootfs/var/lock'
       lxc-start 1275423291.117 DEBUG    lxc_conf - umounted 
'/oldrootfs/lib/init/rw'
       lxc-start 1275423291.117 DEBUG    lxc_conf - umounted 
'/oldrootfs/boot'
       lxc-start 1275423291.117 DEBUG    lxc_conf - umounted 
'/oldrootfs/lxc-cgroup'
       lxc-start 1275423291.117 DEBUG    lxc_conf - umounted 
'/oldrootfs/usr/local/var/lib/lxc/test2/rootfs/proc'
       lxc-start 1275423291.117 DEBUG    lxc_conf - umounted 
'/oldrootfs/usr/local/var/lib/lxc/test2/rootfs/dev/pts'
       lxc-start 1275423291.117 DEBUG    lxc_conf - umounted 
'/oldrootfs/usr/local/var/lib/lxc/test2/rootfs/sys'
       lxc-start 1275423291.117 DEBUG    lxc_conf - umounted 
'/oldrootfs/usr/local/var/lib/lxc/test2/rootfs/dev/tty1'
       lxc-start 1275423291.117 DEBUG    lxc_conf - umounted 
'/oldrootfs/usr/local/var/lib/lxc/test2/rootfs/dev/tty2'
       lxc-start 1275423291.117 DEBUG    lxc_conf - umounted 
'/oldrootfs/usr/local/var/lib/lxc/test2/rootfs/dev/tty3'
       lxc-start 1275423291.117 DEBUG    lxc_conf - umounted 
'/oldrootfs/usr/local/var/lib/lxc/test2/rootfs/dev/tty4'
       lxc-start 1275423291.117 DEBUG    lxc_conf - umounted 
'/oldrootfs/dev'
       lxc-start 1275423291.117 DEBUG    lxc_conf - umounted 
'/oldrootfs/sys'
       lxc-start 1275423291.117 DEBUG    lxc_conf - umounted '/oldrootfs'
       lxc-start 1275423291.130 INFO     lxc_conf - pivoted to 
'/usr/local/lib/lxc/rootfs'
       lxc-start 1275423291.130 INFO     lxc_conf - created new pts instance
       lxc-start 1275423291.130 DEBUG    lxc_conf - capabilities has 
been setup
       lxc-start 1275423291.130 NOTICE   lxc_conf - 'test2' is setup.
       lxc-start 1275423291.130 NOTICE   lxc_start - exec'ing '/sbin/init'
       lxc-start 1275423291.134 NOTICE   lxc_start - '/sbin/init' 
started with pid '4052'
       lxc-start 1275423291.135 INFO     lxc_console - no console specified
       lxc-start 1275423292.520 DEBUG    lxc_cgroup - using cgroup 
mounted at '/lxc-cgroup'
       lxc-start 1275423314.100 DEBUG    lxc_commands - peer has 
disconnected


-- 
Wilhelm






More information about the lxc-users mailing list