From: Katharina Haselhorst on
Hello,

I'm running debian lenny with xen kernel 2.6.26, amd64. Inside a domU I
need to make a pivot_root and unmount the old root afterwards.
I've done the following:

cd /newroot
(newroot contains a minimal system from initrd, dev/console, dev/null
and old-root are available unter newroot/)
exec <dev/console >dev/console 2>&1
pivot_root . old-root
exec chroot . bin/sh
umount -n old-root

but I always get: device is busy - so I can't umount the old root.
/proc/mounts shows that the proc fs is still mounten under old-root/proc
and an umount old-root/proc doesn't work either (device is busy, too).

I also tried to umount proc before doing the pivot_root, but no luck either.
Why doesn't pivot_root remove the proc mountpoint from old-root? As I
understand the documentation - it should clear all dependencies so that
the old-root can be unmounted afterwards...

Any ideas or suggestions to help would be great!

K. Haselhorst


--
To UNSUBSCRIBE, email to debian-user-REQUEST(a)lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster(a)lists.debian.org
Archive: http://lists.debian.org/4BA4A71F.8060506(a)mathematik.uni-marburg.de
From: Rogerio Luz Coelho on
are you doing this with X enabled?

If so stop X before atempting a umount

Rogerio

2010/3/20 Katharina Haselhorst <brandlk(a)mathematik.uni-marburg.de>

> Hello,
>
> I'm running debian lenny with xen kernel 2.6.26, amd64. Inside a domU I
> need to make a pivot_root and unmount the old root afterwards.
> I've done the following:
>
> cd /newroot
> (newroot contains a minimal system from initrd, dev/console, dev/null and
> old-root are available unter newroot/)
> exec <dev/console >dev/console 2>&1
> pivot_root . old-root
> exec chroot . bin/sh
> umount -n old-root
>
> but I always get: device is busy - so I can't umount the old root.
> /proc/mounts shows that the proc fs is still mounten under old-root/proc
> and an umount old-root/proc doesn't work either (device is busy, too).
>
> I also tried to umount proc before doing the pivot_root, but no luck
> either.
> Why doesn't pivot_root remove the proc mountpoint from old-root? As I
> understand the documentation - it should clear all dependencies so that the
> old-root can be unmounted afterwards...
>
> Any ideas or suggestions to help would be great!
>
> K. Haselhorst
>
>
> --
> To UNSUBSCRIBE, email to debian-user-REQUEST(a)lists.debian.org with a
> subject of "unsubscribe". Trouble? Contact listmaster(a)lists.debian.org
> Archive:
> http://lists.debian.org/4BA4A71F.8060506(a)mathematik.uni-marburg.de
>
>
From: Katharina Haselhorst on
no, I don't have X. I just tried to mount --move /dev and /proc to the
new root before actually doing the pivot-root. proc/mounts doesn't show
any mountpoints under old-root afterwards, but an umount still gives
device busy...

On 03/20/2010 02:33 PM, Rogerio Luz Coelho wrote:
> are you doing this with X enabled?
>
> If so stop X before atempting a umount
>
> Rogerio
>
> 2010/3/20 Katharina Haselhorst <brandlk(a)mathematik.uni-marburg.de
> <mailto:brandlk(a)mathematik.uni-marburg.de>>
>
> Hello,
>
> I'm running debian lenny with xen kernel 2.6.26, amd64. Inside a
> domU I need to make a pivot_root and unmount the old root afterwards.
> I've done the following:
>
> cd /newroot
> (newroot contains a minimal system from initrd, dev/console,
> dev/null and old-root are available unter newroot/)
> exec <dev/console >dev/console 2>&1
> pivot_root . old-root
> exec chroot . bin/sh
> umount -n old-root
>
> but I always get: device is busy - so I can't umount the old root.
> /proc/mounts shows that the proc fs is still mounten under
> old-root/proc and an umount old-root/proc doesn't work either
> (device is busy, too).
>
> I also tried to umount proc before doing the pivot_root, but no luck
> either.
> Why doesn't pivot_root remove the proc mountpoint from old-root? As
> I understand the documentation - it should clear all dependencies so
> that the old-root can be unmounted afterwards...
>
> Any ideas or suggestions to help would be great!
>
> K. Haselhorst
>
>
> --
> To UNSUBSCRIBE, email to debian-user-REQUEST(a)lists.debian.org
> <mailto:debian-user-REQUEST(a)lists.debian.org> with a subject of
> "unsubscribe". Trouble? Contact listmaster(a)lists.debian.org
> <mailto:listmaster(a)lists.debian.org>
> Archive:
> http://lists.debian.org/4BA4A71F.8060506(a)mathematik.uni-marburg.de
>
>


--
To UNSUBSCRIBE, email to debian-user-REQUEST(a)lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster(a)lists.debian.org
Archive: http://lists.debian.org/4BA4ED31.2040102(a)mathematik.uni-marburg.de
From: Stephen Powell on
On Sat, 20 Mar 2010 11:43:45 -0400 (EDT), Katharina Haselhorst wrote:
>
> no, I don't have X. I just tried to mount --move /dev and /proc to the
> new root before actually doing the pivot-root. proc/mounts doesn't show
> any mountpoints under old-root afterwards, but an umount still gives
> device busy...

Perhaps the "fuser" command would come in handy here. "fuser" is part
of the psmisc package and is useful for determining what process or
processes are preventing a device from being unmounted. For example,
let's say you want to umount "/home", which is a separate partition.
The command

fuser -m /home

will list the process ids which are accessing any file under /home.
Compare that to the output of "ps aux" to see which processes you
need to terminate in order to be able to umount /home.

--
.''`. Stephen Powell <zlinuxman(a)wowway.com>
: :' :
`. `'`
`-


--
To UNSUBSCRIBE, email to debian-user-REQUEST(a)lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster(a)lists.debian.org
Archive: http://lists.debian.org/1660971449.20495501269107061438.JavaMail.root(a)md01.wow.synacor.com
From: Katharina Haselhorst on
Hello,

> fuser -m /home
>
> will list the process ids which are accessing any file under /home.
> Compare that to the output of "ps aux" to see which processes you
> need to terminate in order to be able to umount /home.

Since I'm doing a pivot_root before trying to umount the old root there
are still several processes keeping some files open inside the old root
subdirs. Init is still running, als well as rc and one shutdown script
(atm I'm doing the pivot_root just before shutdown, because most
processes are terminted by the time). If I kill one of these processes,
the systems gets shut down.
I don't understand why there is still that shutdown script running,
because I'm doing a exec chroot. The pivot_root's manual says: "Note
that exec chroot changes the running executable, which is necessary if
the old root directory should be unmounted afterwards."
And the init process is always running, so how does pivot_root handle
the open files of init?
I did move the /proc and /dev mountpoints from old-root to the new root
- might that cause some problems? If I don't do that - lsof or fuser of
course don't show any open files for old-root, but I'm not able to
unmount to old-root either.

K. Haselhorst


--
To UNSUBSCRIBE, email to debian-user-REQUEST(a)lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster(a)lists.debian.org
Archive: http://lists.debian.org/4BA62144.9050207(a)mathematik.uni-marburg.de