[uml-user] UML hangs with con=fd:0,fd:1 if stdin is no tty

2011-04-29 Thread Riccardo Murri
Hello,

I'm trying to use UML to provide a "standard environment" for
computational jobs in a Grid computing setting.

So, I launch "linux mem=256M ubd0=apppot0.img con=null con0=fd:0,fd:1
root=/dev/ubda umid=my".  The /etc/inittab within the UML
machine is set up to run a certain non-interactive script instead of
the regular multiuser boot.

Everything runs fine if I start the UML in a terminal.  However, if I
redirect stdin from a non-tty stream (e.g., /dev/null), then all
output disappears as soon as control is passed to userspace, and the
CPU usage of the host machine goes up to 100%.  These are the last
lines printed to stdout:

Initialized stdio console driver
Console initialized on /dev/tty0
console [tty0] enabled
Initializing software serial port version 1
console [mc-1] enabled
 ubda: unknown partition table
registered taskstats version 1

Is there a way I can run a UML and have all its output redirected to a
stream, and stdin connected to /dev/null ?  This is how
non-interactive jobs are run in a batch system, and it would be
difficult to work around.

I'm using the UML `linux` 2.6.35.1 from the Ubuntu 10.10 package
`user-mode-linux` version 2.6.35-1um-0ubuntu1.  The UML filesystem
image contains a standard minimal Debian squeeze (except for the
startup scripts).

Thanks for any help!

Riccardo

--
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
___
User-mode-linux-user mailing list
User-mode-linux-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-user


Re: [uml-user] UML hangs with con=fd:0,fd:1 if stdin is no tty

2011-04-29 Thread richard -rw- weinberger
On Fri, Apr 29, 2011 at 5:14 PM, Riccardo Murri
 wrote:
> Hello,
>
> I'm trying to use UML to provide a "standard environment" for
> computational jobs in a Grid computing setting.
>
> So, I launch "linux mem=256M ubd0=apppot0.img con=null con0=fd:0,fd:1
> root=/dev/ubda umid=my".  The /etc/inittab within the UML
> machine is set up to run a certain non-interactive script instead of
> the regular multiuser boot.

Do you really need a full blown disk image with a inittab?
I would use hostfs.
E.g:
./linux rootfstype=hostfs init=/path/to/work/doit.sh con=null
con0=fd:0,fd:1 &> uml.log < /dev/null
BTW: When doit.sh is done UML panics with "Kernel panic - not syncing:
Attempted to kill init!".
This is okay.

Anyway, what is the exact command-line which causes UML to hang?
Can you provide me a stand alone test case?

-- 
Thanks,
//richard

--
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
___
User-mode-linux-user mailing list
User-mode-linux-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-user


Re: [uml-user] UML hangs with con=fd:0,fd:1 if stdin is no tty

2011-04-29 Thread Riccardo Murri
Hi Richard,

On Fri, Apr 29, 2011 at 5:47 PM, richard -rw- weinberger
 wrote:
> Anyway, what is the exact command-line which causes UML to hang?
> Can you provide me a stand alone test case?
>

Here it is:

  * download the 64-bit kernel:
http://uml.devloop.org.uk/kernels/kernel64-2.6.35.7.bz2

  * download the 64-bit filesystem
http://fs.devloop.org.uk/filesystems/Debian-Squeeze/Debian-Squeeze-AMD64-root_fs.bz2

  * Run (this works regularly):

  ./kernel64-2.6.35.7 umid=my mem=256M \
ubd0=Debian-Squeeze-AMD64-root_fs root=/dev/ubda \
con=fd:0,fd:1

  * Now redirect stdin from /dev/null; the UML hangs and cannot be
shutdown even from uml_mconsole (I have to manually kill the processes):

  ./kernel64-2.6.35.7 umid=my mem=256M \
ubd0=Debian-Squeeze-AMD64-root_fs root=/dev/ubda \
con=fd:0,fd:1  Do you really need a full blown disk image with a inittab?
> I would use hostfs.
> E.g:
> ./linux rootfstype=hostfs init=/path/to/work/doit.sh con=null
> con0=fd:0,fd:1 &> uml.log < /dev/null

Well, the idea is that users get a "reference disk image", which they
can run on their desktop to do development; when they are done with
the coding and it runs on the reference machine, they can submit to
the Grid.  I guess we could do that with hostfs as well, but then we
risk running into more permission problems than by distributing
"opaque" disk images that users can boot like a regular VM.

Thanks,
Riccardo

--
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
___
User-mode-linux-user mailing list
User-mode-linux-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-user


Re: [uml-user] UML hangs with con=fd:0,fd:1 if stdin is no tty

2011-04-29 Thread richard -rw- weinberger
On Fri, Apr 29, 2011 at 6:10 PM, Riccardo Murri
 wrote:
> Hi Richard,
>
> On Fri, Apr 29, 2011 at 5:47 PM, richard -rw- weinberger
>  wrote:
>> Anyway, what is the exact command-line which causes UML to hang?
>> Can you provide me a stand alone test case?
>>
>
> Here it is:
>

I fear you cannot use /dev/null (or any other non-tty file) as stdin. :-(
UML uses poll() to detect whether input is available from stdin.
As you can always read from /dev/null poll() doesn't block and
UML gets flooded with interrupts.

Do you really need stdin set to /dev/null?
Can't you use a tool like screen to detach UML from your terminal?

-- 
Thanks,
//richard

--
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
___
User-mode-linux-user mailing list
User-mode-linux-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-user


Re: [uml-user] UML hangs with con=fd:0,fd:1 if stdin is no tty

2011-04-29 Thread Riccardo Murri
On Fri, Apr 29, 2011 at 6:46 PM, richard -rw- weinberger
 wrote:
> I fear you cannot use /dev/null (or any other non-tty file) as stdin. :-(
> UML uses poll() to detect whether input is available from stdin.
> As you can always read from /dev/null poll() doesn't block and
> UML gets flooded with interrupts.
>
> Do you really need stdin set to /dev/null?
> Can't you use a tool like screen to detach UML from your terminal?

H... no :-(   The purpose of this exercise is to launch a UML
machine as a non-interactive job in a batch system, and this means it
will run with stdin = /dev/null (or a file, which has the same
`poll()` behavior).

But I can still redirect stdin from a named FIFO and attach a "silent"
process to it:

  mkfifo fake.stdin
  (sleep 365d > fake.stdin) &
  linux ... con=fd:0,fd:1 < fake.stdin

This apparently works; I wonder whether there is a simpler/better
solution.

Thanks for your help!

Riccardo

--
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
___
User-mode-linux-user mailing list
User-mode-linux-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-user


Re: [uml-user] UML hangs with con=fd:0,fd:1 if stdin is no tty

2011-04-29 Thread richard -rw- weinberger
On Fri, Apr 29, 2011 at 7:05 PM, Riccardo Murri
 wrote:
> But I can still redirect stdin from a named FIFO and attach a "silent"
> process to it:

Sure, but you'll still need a wrapper script which creates this FIFO
in the grid node.
I've had enough fun with sge, lsf, ... ;)

-- 
Thanks,
//richard

--
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
___
User-mode-linux-user mailing list
User-mode-linux-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-user