linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* pivot_root from non-interactive script
@ 2001-06-18 13:03 Ralph Jones
  2001-06-18 13:54 ` Andreas Schwab
  0 siblings, 1 reply; 5+ messages in thread
From: Ralph Jones @ 2001-06-18 13:03 UTC (permalink / raw)
  To: linux-kernel

Greetings,

I have followed the instructions given in Documentation/initrd.txt with regard to pivot_root, but am unable to unmount the filesystem, when everything is called from a non-interactive script. 

ie. When I set a link from linuxrc to /bin/ash and then manually go through the commands in the shell script, I am able to unmount the old initrd filesystem.  However, when linuxrc is a shell script containing the same commands, I am unable to umount the old initrd fs.  I get instead: "Device or resource busy".

The contents of my linuxrc script are as follows:
--------------------
#!/bin/ash
export PATH=/bin:/sbin:/usr/bin:/usr/sbin
 
cd /
mkdir /new
mount -t shm /dev/shm /new
cp -pdR * new
 
cd new
pivot_root . initrd
 
cd /
exec chroot . /bin/ash <dev/console > dev/console 2>&1
-------------
ash is a static binary.  chroot, mount and pivot_root are from busybox.  

- Ralph Jones

Find the best deals on the web at AltaVista Shopping!
http://www.shopping.altavista.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: pivot_root from non-interactive script
  2001-06-18 13:03 pivot_root from non-interactive script Ralph Jones
@ 2001-06-18 13:54 ` Andreas Schwab
  0 siblings, 0 replies; 5+ messages in thread
From: Andreas Schwab @ 2001-06-18 13:54 UTC (permalink / raw)
  To: Ralph Jones; +Cc: linux-kernel

Ralph Jones <ralph.jones@altavista.com> writes:

|> I have followed the instructions given in Documentation/initrd.txt with regard to pivot_root, but am unable to unmount the filesystem, when everything is called from a non-interactive script. 
|> 
|> ie. When I set a link from linuxrc to /bin/ash and then manually go through the commands in the shell script, I am able to unmount the old initrd filesystem.  However, when linuxrc is a shell script containing the same commands, I am unable to umount the old initrd fs.  I get instead: "Device or resource busy".

Perhaps the shell didn't close the filedescriptor on the script.

Andreas.

-- 
Andreas Schwab                                  "And now for something
SuSE Labs                                        completely different."
Andreas.Schwab@suse.de
SuSE GmbH, Schanzäckerstr. 10, D-90443 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: pivot_root from non-interactive script
@ 2001-06-20 12:32 Ralph Jones
  0 siblings, 0 replies; 5+ messages in thread
From: Ralph Jones @ 2001-06-20 12:32 UTC (permalink / raw)
  To: schwab; +Cc: linux-kernel

Hi,

I was using ash from SuSE 7.1 (ash-0.2-294)

I patched ash's input.c with 

fcntl(fd, F_SETFD, FD_CLOEXEC); in setinputd.  This fixed the problem.  

Then I found that there is version 0.3.5-11 (on the debian site) with this fix already included.  

Thanks for your help.

Ralph Jones


On Tue, 19 June 2001, Andreas Schwab wrote:

> 
> Ralph Jones <ralph.jones@altavista.com> writes:
> 
> |> Thanks.  Yes it looks as if this might be the case.  Do you have any ideas how I might get around this?  Or do I have to use a different shell?
> 
> The latter is probably the easiest.  Or fix /bin/ash to set FD_CLOEXEC on
> the file descriptor.
> 
> Andreas.
> 
> -- 
> Andreas Schwab                                  "And now for something
> SuSE Labs                                        completely different."
> Andreas.Schwab@suse.de
> SuSE GmbH, Schanzäckerstr. 10, D-90443 Nürnberg
> Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5


Find the best deals on the web at AltaVista Shopping!
http://www.shopping.altavista.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: pivot_root from non-interactive script
  2001-06-19  9:58 Ralph Jones
@ 2001-06-19 12:10 ` Andreas Schwab
  0 siblings, 0 replies; 5+ messages in thread
From: Andreas Schwab @ 2001-06-19 12:10 UTC (permalink / raw)
  To: Ralph Jones; +Cc: linux-kernel

Ralph Jones <ralph.jones@altavista.com> writes:

|> Thanks.  Yes it looks as if this might be the case.  Do you have any ideas how I might get around this?  Or do I have to use a different shell?

The latter is probably the easiest.  Or fix /bin/ash to set FD_CLOEXEC on
the file descriptor.

Andreas.

-- 
Andreas Schwab                                  "And now for something
SuSE Labs                                        completely different."
Andreas.Schwab@suse.de
SuSE GmbH, Schanzäckerstr. 10, D-90443 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: pivot_root from non-interactive script
@ 2001-06-19  9:58 Ralph Jones
  2001-06-19 12:10 ` Andreas Schwab
  0 siblings, 1 reply; 5+ messages in thread
From: Ralph Jones @ 2001-06-19  9:58 UTC (permalink / raw)
  To: schwab; +Cc: linux-kernel

Thanks.  Yes it looks as if this might be the case.  Do you have any ideas how I might get around this?  Or do I have to use a different shell?

Ralph

On Mon, 18 June 2001, Andreas Schwab wrote:

> 
> Ralph Jones <ralph.jones@altavista.com> writes:
> 
> |> I have followed the instructions given in Documentation/initrd.txt with regard to pivot_root, but am unable to unmount the filesystem, when everything is called from a non-interactive script. 
> |> 
> |> ie. When I set a link from linuxrc to /bin/ash and then manually go through the commands in the shell script, I am able to unmount the old initrd filesystem.  However, when linuxrc is a shell script containing the same commands, I am unable to umount the old initrd fs.  I get instead: "Device or resource busy".
> 
> Perhaps the shell didn't close the filedescriptor on the script.
> 
> Andreas.
> 
> -- 
> Andreas Schwab                                  "And now for something
> SuSE Labs                                        completely different."
> Andreas.Schwab@suse.de
> SuSE GmbH, Schanzäckerstr. 10, D-90443 Nürnberg
> Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5

Find the best deals on the web at AltaVista Shopping!
http://www.shopping.altavista.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2001-06-20 12:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-06-18 13:03 pivot_root from non-interactive script Ralph Jones
2001-06-18 13:54 ` Andreas Schwab
2001-06-19  9:58 Ralph Jones
2001-06-19 12:10 ` Andreas Schwab
2001-06-20 12:32 Ralph Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).