oio11: (Default)
[personal profile] oio11
xebian
September 12th, 2009, 06:12 AM
I'm using the following script but I'm having trouble using umount.



#!/bin/sh

## Directory /mnt/karmic already exists

sudo mount /dev/sdb1 /mnt/karmic/
sudo mount -o bind /proc /mnt/karmic/proc
sudo mount -o bind /dev /mnt/karmic/dev
sudo mount -o bind /dev/pts /mnt/karmic/dev/pts
sudo mount -o bind /sys /mnt/karmic/sys
sudo cp /etc/resolv.conf /mnt/karmic/etc/resolve.conf
sudo chroot /mnt/karmic /bin/bash

fi

After the script I'm using this with errors.

sudo umount /dev/sdb1
umount: /mnt/karmic: device is busy.
(In some cases useful info about processes that use
the device is found by lsof(8) or fuser(1))

You have to un-mount first the points under it. While /mnt/karmic/proc is mounted you can not un-mount /mnt/karmic.

BTW it's preferred to un-mount point not the dev.

http://ubuntuforums.org/archive/index.php/t-1264003.html


Registered User
 
Join Date: Mar 2008
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
 
as usual, the solution seems trivial.
Is there an explanation why the mount and umount are
not "symmetrical" with respect to the chroot. ?

in script:

mount -t proc none /mnt/gentoo/proc
chroot . /bin/bash -c "/root/myscript.sh; umount /proc; exit 0"

####


http://www.unix.com/gentoo/66464-automating-chroot-mount-unmount.html

October 2025

S M T W T F S
   1234
567891011
12131415161718
19202122 232425
262728293031 

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Feb. 4th, 2026 02:03 am
Powered by Dreamwidth Studios