public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Samuel Thibault <samuel.thibault@ens-lyon.org>
To: David Luyer <david@luyer.net>
Cc: "linux-os (Dick Johnson)" <linux-os@analogic.com>,
	linux-kernel@vger.kernel.org
Subject: Re: emergency or init=/bin/sh mode and terminal signals
Date: Tue, 20 Jun 2006 10:04:35 +0200	[thread overview]
Message-ID: <20060620080435.GA4347@implementation.labri.fr> (raw)
In-Reply-To: <C0BD782F.CF80%david@luyer.net>

David Luyer, le Tue 20 Jun 2006 10:02:23 +1000, a écrit :
> On 20/6/06 8:09 AM, "Samuel Thibault" <samuel.thibault@ens-lyon.org> wrote:
> > linux-os (Dick Johnson), le Mon 19 Jun 2006 07:37:02 -0400, a écrit :
> >> You can't allow some terminal input to affect init. It has been the
> >> de facto standard in Unix, that the only time one should have a
> >> controlling terminal is after somebody logs in and owns something to
> >> control.
> > 
> > Ok. The following still makes sense, doesn't it? (i.e. set a session for
> > the emergency shell)
> > 
> > --- linux-2.6.17-orig/init/main.c 2006-06-18 19:22:40.000000000 +0200
> > +++ linux-2.6.17-perso/init/main.c 2006-06-20 00:07:07.000000000 +0200
> > @@ -729,6 +729,11 @@
> > run_init_process("/sbin/init");
> > run_init_process("/etc/init");
> > run_init_process("/bin/init");
> > +
> > + /* Set a session for the shell.  */
> > + sys_setsid();
> > + sys_ioctl(0, TIOCSCTTY, 1);
> > +
> > run_init_process("/bin/sh");
> >  
> > panic("No init found.  Try passing init= option to kernel.");
> 
> What if people are booting via /bin/sh and then setting up
> their custom chroot's and init(s), and don't want these init(s) to
> be part of a session?

The problem is that you can't distinguish that from usual init booting:

	if (execute_command) {
		run_init_process(execute_command);
		printk(KERN_WARNING "Failed to execute %s.  Attempting "
					"defaults...\n", execute_command);
	}
	run_init_process("/sbin/init");

If you setsid() in the if(execute_command) statement, and the
execute_command fails, you get to run init in a session.

> It is also particularly possible for an embedded system to start
> up via /bin/sh running /etc/profile rather than using an init type
> program.

Then people writing that embedded system should use /bin/login instead.

> Also, the above doesn't help people specifying "init=/bin/sh" on the
> command line (as per the original post subject).  The real solution
> is for them to specify a different init= or run/exec something to set
> up their tty and session once logged in.

Yes. And the problem is that people usually don't know about sessions
etc, and will just grumble "linux can't work".

Samuel

  parent reply	other threads:[~2006-06-20  8:04 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-18 21:23 emergency or init=/bin/sh mode and terminal signals Samuel Thibault
2006-06-18 21:33 ` Willy Tarreau
2006-06-19 22:03   ` Samuel Thibault
2006-06-20 11:15     ` linux-os (Dick Johnson)
2006-06-18 22:39 ` Wakko Warner
2006-06-18 22:40   ` Samuel Thibault
2006-06-18 22:44     ` Willy Tarreau
2006-06-18 22:48       ` Samuel Thibault
2006-06-19  3:59         ` Willy Tarreau
2006-06-19  7:59           ` Samuel Thibault
2006-06-18 22:52     ` Wakko Warner
2006-06-18 23:25       ` Joshua Hudson
2006-06-19 11:37 ` linux-os (Dick Johnson)
2006-06-19 11:46   ` Samuel Thibault
2006-06-19 12:05     ` linux-os (Dick Johnson)
2006-06-19 22:06       ` Samuel Thibault
2006-06-21 11:53     ` linux-os (Dick Johnson)
2006-06-21 11:57       ` Samuel Thibault
2006-06-19 22:09   ` Samuel Thibault
2006-06-20  0:02     ` David Luyer
2006-06-20  4:28       ` Willy Tarreau
2006-06-20  5:03         ` Valdis.Kletnieks
2006-06-20  8:04       ` Samuel Thibault [this message]
2006-07-01 14:57         ` Matthias Andree
2006-06-20 11:26     ` linux-os (Dick Johnson)
2006-06-20 11:32       ` Samuel Thibault
2006-06-19 12:08 ` Jan Engelhardt
2006-06-19 15:47   ` Samuel Thibault
  -- strict thread matches above, loose matches on Subject: below --
2006-06-19  3:47 Albert Cahalan
2006-06-19  8:57 ` Samuel Thibault

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060620080435.GA4347@implementation.labri.fr \
    --to=samuel.thibault@ens-lyon.org \
    --cc=david@luyer.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-os@analogic.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox