[arch-projects] [PATCH] shutdown: add a shutdown hook

Tom Gundersen teg at jklm.no
Fri Jul 22 10:52:45 EDT 2011


On Fri, Jul 22, 2011 at 4:04 PM, Dave Reisner <d at falconindy.com> wrote:
> On Fri, Jul 22, 2011 at 09:31:23AM -0400, Dave Reisner wrote:
>> On Fri, Jul 22, 2011 at 03:10:58PM +0200, Tom Gundersen wrote:
>> > On Fri, Jul 22, 2011 at 2:58 PM, Tom Gundersen <teg at jklm.no> wrote:
>> > > On Fri, Jul 22, 2011 at 1:45 PM, Tom Gundersen <teg at jklm.no> wrote:
>> > >> Enabling the shutdown hook and using systemd v31
>> > >> (which is yet to be released), means that on shutdown the root
>> > >> will be pivoted to /run/initramfs, from where the rootfs and
>> > >> all its submonuts (such as /usr) are unmounted cleanly.
>> > >
>> > > Looks like I made a mistake. This only works with busybox from
>> > > [community], not with mkinitcpio-busybox from [core].
>> > >
>> > > It looks like there are two problematic differences: our busybox does
>> > > not come with "tr", and the --install function creates symlinkes to
>> > > /bin/busybox, rather than to the calling binary
>> > > (/run/initramfs/bin/busybox, in this case).
>> >
>> > Looks easy to fix. Any objections to changing the mkinitrd-busybox config
>> > from:
>> > CONFIG_BUSYBOX_EXEC_PATH="/bin/busybox"
>> > # CONFIG_TR is not set
>> > to:
>> > CONFIG_BUSYBOX_EXEC_PATH="/proc/self/exe"
>> > CONFIG_TR=y
>> >
>> > When busybox is installed in the initramfs, we have /proc/self/exe ->
>> > /bin/busybox, so it should not make a difference (though, I have not
>> > actually tried, will do later).
>> >
>> > Cheers,
>> >
>> > Tom
>>
>> I object. The usage of tr isn't necessary in your pipeline. You can
>> remove it and everything will still just work. Furthermore....
>>
>>   umount $(mount | awk '
>>   $3 ~ /^\/oldroot/ {
>>     umount[NR] = $3;
>>   }
>>   END { for (i = NR; i >= 0; i--) {
>>     if (umount[i]) {
>>       umount[i]
>
> Of course i meant 'print umount[i]' here.
>
>>     }
>>   }')
>>
>> How does busybox behave with the exec path as /proc/self/exe prior to
>> /proc being mounted?
>>
>> d
>

Dave, Thomas,

Good points. I'll send a new patch soon.

-t


More information about the arch-projects mailing list