Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[resolved] Handbook: why not unmount sys before reboot?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
dcljr
Tux's lil' helper
Tux's lil' helper


Joined: 20 Aug 2005
Posts: 139
Location: Austin, TX

PostPosted: Tue Aug 05, 2014 11:56 am    Post subject: [resolved] Handbook: why not unmount sys before reboot? Reply with quote

In the Handbook (both AMD64 and x86 versions), after configuring the bootloader and before rebooting, we see:
Code:
# exit
cdimage ~# cd
cdimage ~# umount -l /mnt/gentoo/dev{/shm,/pts,}
cdimage ~# umount -l /mnt/gentoo{/boot,/proc,}
cdimage ~# reboot

Why isn't mnt/gentoo/sys included here? That is, why not
Code:
cdimage ~# umount -l /mnt/gentoo{/boot,/proc,/sys,}

for the second umount command?

After all, it was mounted at the "Chrooting" step (just before the actual chroot command):
Code:
# mount -t proc proc /mnt/gentoo/proc
# mount --rbind /sys /mnt/gentoo/sys
# mount --rbind /dev /mnt/gentoo/dev


I ask mainly because I prefer to install new Gentoo systems (working on my 4th at the moment) "a little at a time" from within a current running Gentoo system, not "all at once" using an installation CD. So often I will be unmounting the /mnt/gentoo stuff and then not rebooting (until much later).

In fact, specifically what I've been doing on this latest installation (each time I'm ready to "pause" in the process to do something more interesting) is:
Code:
(chroot) ~ # exit
~ # cd
~ # umount -l /mnt/gentoo/dev{/shm,/pts,}
~ # umount -l /mnt/gentoo/{boot,proc,sys}
~ # umount /mnt/gentoo
~ # exit

Which just exits the X terminal I'm working in. Anything wrong with that?

Anyway, so why doesn't the Handbook tell users to unmount /mnt/gentoo/sys?


Last edited by dcljr on Fri Aug 29, 2014 4:32 am; edited 1 time in total
Back to top
View user's profile Send private message
Oniryczny
Guru
Guru


Joined: 01 Dec 2011
Posts: 388
Location: Poland

PostPosted: Tue Aug 05, 2014 12:04 pm    Post subject: Reply with quote

Code:

~ # umount -l /mnt/gentoo/{boot,proc,sys}

umounts:
/mnt/gentoo/boot
/mnt/gentoo/proc
/mnt/gentoo/sys
;)
_________________
cogito ergo sum
Back to top
View user's profile Send private message
DONAHUE
Watchman
Watchman


Joined: 09 Dec 2006
Posts: 7550
Location: Goose Creek SC

PostPosted: Tue Aug 05, 2014 2:43 pm    Post subject: Reply with quote

Which just exits the X terminal I'm working in. Anything wrong with that? No.
Anyway, so why doesn't the Handbook tell users to unmount /mnt/gentoo/sys? A Good Question, suggest filing a bug.
_________________
Defund the FCC.
Back to top
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7071

PostPosted: Tue Aug 05, 2014 3:14 pm    Post subject: Reply with quote

Well i don't read the handbook if anyone file a bug, ask to correct the only thing that seems stupid :
umount -l /mnt/gentoo/boot

As this might damage boot. Nobody should lazy umount boot that hold real datas (kernel, grub... some hdd or controller may have not flush datas to disk yet).

And proc sys and dev, nobody cares about them anyway. So umount them with a hammer or not umounting them change nothing.
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 13830

PostPosted: Wed Aug 06, 2014 1:31 am    Post subject: Reply with quote

I agree with krinn. If you use a lazy unmount on a filesystem backed by real storage, you need to wait for the unmount to complete before you reboot. The unmount will begin when the filesystem is unused. If you have processes with open files or directories on that filesystem, then the filesystem does not become unused until those processes release the descriptors. Lazy unmount can be used freely for NFS and virtual filesystems. For real filesystems, it should be used only if you know exactly why you need a lazy unmount instead of an eager unmount.
Back to top
View user's profile Send private message
dcljr
Tux's lil' helper
Tux's lil' helper


Joined: 20 Aug 2005
Posts: 139
Location: Austin, TX

PostPosted: Fri Aug 08, 2014 12:25 pm    Post subject: Reply with quote

To those who are complaining about lazily unmounting /mnt/gentoo/boot: it is true, is it not, that my solution...
Code:
(chroot) ~ # exit
~ # cd
~ # umount -l /mnt/gentoo/dev{/shm,/pts,}
~ # umount -l /mnt/gentoo/{proc,sys,boot}
~ # umount /mnt/gentoo
~ # exit

is technically still safe, since the 3rd (non-lazy) umount command should complain if /mnt/gentoo/boot has not been unmounted yet. Right?

So perhaps I should suggest that for the Handbook? (And readers should probably be warned about what to do if the last umount command doesn't work.)
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 13830

PostPosted: Sat Aug 09, 2014 12:59 am    Post subject: Reply with quote

No, your solution is not technically safe. A lazy unmount immediately detaches the specified mount from the namespace, so after umount -l /mnt/gentoo/boot, you can immediately unmount /mnt/gentoo even if the filesystem formerly mounted at /mnt/gentoo/boot is still in use. That is why I said "For real filesystems, it should be used only if you know exactly why you need a lazy unmount instead of an eager unmount." Both root and boot are real filesystems, so both of them need a non-lazy unmount unless you know exactly why you need a lazy unmount.
Back to top
View user's profile Send private message
dcljr
Tux's lil' helper
Tux's lil' helper


Joined: 20 Aug 2005
Posts: 139
Location: Austin, TX

PostPosted: Sun Aug 10, 2014 8:21 am    Post subject: Reply with quote

Right. OK, so this then:
Code:
(chroot) ~ # exit
~ # cd
~ # umount -l /mnt/gentoo/dev{/shm,/pts,}
~ # umount -l /mnt/gentoo{/proc,/sys}
~ # umount /mnt/gentoo{/boot,}
~ # exit

(I've decided to put the slashes inside the curly-braces in the 2nd lazy umount this time just for the sake of "symmetry".)
Back to top
View user's profile Send private message
Cyker
Veteran
Veteran


Joined: 15 Jun 2006
Posts: 1746

PostPosted: Sun Aug 10, 2014 11:40 am    Post subject: Reply with quote

Interesting... I don't think I bothered doing any of that and just rebooted the system :lol:
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 13830

PostPosted: Sun Aug 10, 2014 4:01 pm    Post subject: Reply with quote

dcljr: right, that would be safe. You usually do not need to use a lazy unmount even for virtual filesystems, but using it there is not dangerous as it can be for real filesystems.

Cyker: if you skip the umount process, then the system may automatically perform eager unmounts of the filesystems on the way down, which is safe, equivalent to what dcljr posted, and uses fewer keystrokes. If you mean that you used lazy unmounts for real filesystems and it worked, then that just means you got lucky. Getting lucky is likely in this case, since a lazy unmount will probably free the filesystem within a few seconds if you do not have any processes using it. The eager unmount has the advantage that it will fail if the filesystem is in use, rather than detaching immediately and releasing it at some unspecified later time, which may or may not occur before the kernel turns off the device.
Back to top
View user's profile Send private message
dcljr
Tux's lil' helper
Tux's lil' helper


Joined: 20 Aug 2005
Posts: 139
Location: Austin, TX

PostPosted: Mon Aug 18, 2014 9:40 am    Post subject: Reply with quote

Bugs submitted (first by me, second by someone else) and acted upon:

:)
Back to top
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7071

PostPosted: Mon Aug 18, 2014 10:42 am    Post subject: Reply with quote

I'm the one who made the 2nd report, because of bad privacy policies of gentoo bugzilla.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum