[systemd-devel] [PATCH 07/11] Support init=/bin/bash on the kernel command line

Lennart Poettering lennart at poettering.net
Fri Jun 20 09:39:57 PDT 2014


On Mon, 16.06.14 14:51, David Herrmann (dh.herrmann at gmail.com) wrote:

> 
> Hi
> 
> On Mon, Jun 16, 2014 at 2:42 PM, Dr. Werner Fink <werner at suse.de> wrote:
> > On Fri, Jun 13, 2014 at 05:49:24PM +0200, Tom Gundersen wrote:
> >> On Fri, Jun 13, 2014 at 4:41 PM, Werner Fink <werner at suse.de> wrote:
> >> > From: Ruediger Oertel <ro at suse.de>
> >> >
> >> > Process 1 (aka init) needs to be started with an empty signal mask.
> >> > That includes the process 1 that's started after the initrd is finished.
> >> > When the initrd is using systemd (as it does with dracut based initrds)
> >> > then it is systemd that calls the real init.  Normally this is systemd
> >> > again, except when the user uses for instance "init=/bin/bash" on the
> >> > kernel command line.
> >>
> >> Why is this necessary for /bin/bash, but not for /lib/systemd/systemd?
> >> Please include the explanation in the commit message.
> >
> > I do not understand your question.  AFAIK the signal mask is set by
> > systemd accordingly to man:systemd.service(5) ... the only problem
> > with this schem is that /bin/bash nor any other shell does reset
> > its signal mask.  I guess that systemd will support the init=/bin/bash
> > on the kernel command line.  IMHO this requires a clean signal mask.
> 
> The question was, why is this fix related to init=/bin/bash? What does
> bash do different than systemd that it requires this fix? That
> information should be placed in the commit-message.
> 
> The fix itself looks good and if you called it "restore signal-mask
> before executing init=" it'd be fine. However, calling it "support
> init=/bin/bash" implies that this is only needed for init=/bin/bash.
> This, however, is just a side-effect of this fix, because systemd
> simply doesn't care for the initial sigmask.
> 
> I'll fix up the commit-msg and apply it. No need to resend.

I have made another change on top now: there's no need to remember the
old signal mask if we are going to die anyway. And also, we will now
also reset the signal handlers, so that we don't pass any SIG_IGN
handlers to the replacement process.

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list