[Lxc-users] On clean reboot of Ubuntu 10.04 containers
Trent W. Buck
twb at cybersource.com.au
Tue Dec 7 00:29:44 UTC 2010
"Brian K. White" <brian at aljex.com> writes:
> On 12/6/2010 3:01 AM, Trent W. Buck wrote:
>> Trent W. Buck writes:
>>
>>> This post describes my attempts to get "clean" shutdown of Ubuntu 10.04
>>> containers. The goal here is that a "shutdown -h now" of the dom0
>>> should not result in a potentially inconsistent domU postgres database,
>>> cf. a naive lxc-stop.
>
>
> In my previous note about parallel shutdowns, that same system also
> works for this too. User may ssh in to the container as root and issue
> "shutdown-r now" or "shutdown -h now" and it works as expected from
> their point of view. No cron job on the host. In lxc 0.6.5 you would
> have a watchdog process per container that uses inotify to be alerted
> the instant the containers runlevel file and/or cgroup tasks list file
> changed. I had that as just a shell function right in the init script.
> In 0.7.2 this is handled by lxc internally and is rather more
> reliable, since it was possible to break or kill the separate watchdog
> processes.
I think that handling relies on /var/run/utmp not being "hidden" inside
a tmpfs, which is why the shipped lxc-ubuntu template goes out of its
way to avoid this.
I know that "shutdown -h now" *does* work correctly if /var/run isn't a
tmpfs; it hadn't occurred to me that this might also handle "shutdown -r
now" correctly -- by the time I came to care about rebooting containers,
I'd already decided that having a tmpfs was more important than
lxc-start's autodetection.
I might revise that opinion after trying to handle rebooting manually --
particularly since I've decided to administratively prohibit sys_admin
inside containers.
More information about the lxc-users
mailing list