Bug 519155 - Shutdown takes too long when running from Live USB
Summary: Shutdown takes too long when running from Live USB
Alias: None
Product: Fedora
Classification: Fedora
Component: initscripts
Version: 11
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Bill Nottingham
QA Contact: Fedora Extras Quality Assurance
Depends On:
TreeView+ depends on / blocked
Reported: 2009-08-25 12:53 UTC by Mads Kiilerich
Modified: 2014-03-17 03:20 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2010-06-28 14:17:42 UTC
Type: ---

Attachments (Terms of Use)

Description Mads Kiilerich 2009-08-25 12:53:29 UTC
Description of problem:

When a livecd-creator USB installation with overlay and encrypted home is halted or rebooted it hangs for 10-20 seconds _after_ plymouth has stopped throbbing, so it looks like the machine is dead. It could shutdown within seconds, so this unnecessary delay is a bug.

The problem is that /etc/init.d/halt loops and sleeps in the __umount* functions while it tries to unmount everything, finishing one device type at a time. That doesn't work in complex setups where there are circular dependencies between device types. For example: /home is ext3 on /dev/mapper/EncHome which is dm crypt on /dev/loop5 which is /mnt/live/LiveOS/home.img where /mnt/live is mounted from /dev/sdb1. So there is no way __umount_loop can unmount everything, and retrying and sleeping and killing won't help. Instead we must use several iterations over the different kinds of device types.

Live CDs could be perhaps be improved. The kickstarts creates a /etc/init.d/livesys which "mounts things" without handling how they should be unmounted again. Perhaps it should undo its own tricks on shutdown? It also seems like it was the intention that /etc/crypttab should be updated - but AFAICS that wouldn't help anyway. (CCing katzj)

The halt script seems to come in two parts; first a polite part (until quotaoff) where things are closed down nicely, and then a brutal part with unmounting and killing and sleeping. In the common case where polite unmounting works we would rather avoid killing and sleeping. I suggest adding a polite unmount section before the brutal one - or at least an easy way to insert custom actions there. It might take some time to do polite trial-and-error, but it is better and faster than killing and sleeping.

The current behaviour and code probably solves some other cases, so keeping it for failback would be fine.

The following works fine for me, inserted after quotaoff:

for dm in $(/sbin/dmsetup ls|cut -f1); do umount /dev/mapper/$dm; /sbin/cryptsetup remove $dm || /sbin/dmsetup remove $dm; done
for lo in $(/sbin/losetup -a|cut -d: -f1); do umount $lo; /sbin/losetup -d $lo; done
for mp in $(awk '{if(!/^\/proc /) {print $2}}' /proc/mounts |sort -r); do umount $mp; done

(stderr should probably be muted, and we might want to make it loop a couple of times to handle complex setups.)

Version-Release number of selected component (if applicable):


Comment 1 Bug Zapper 2010-04-28 09:57:51 UTC
This message is a reminder that Fedora 11 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 11.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '11'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 11's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 11 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 

Comment 2 Bug Zapper 2010-06-28 14:17:42 UTC
Fedora 11 changed to end-of-life (EOL) status on 2010-06-25. Fedora 11 is 
no longer maintained, which means that it will not receive any further 
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of 
Fedora please feel free to reopen this bug against that version.

Thank you for reporting this bug and we are sorry it could not be fixed.

Note You need to log in before you can comment on or make changes to this bug.