Bug 81469 - init=/bin/bash and init=/bin/ash don't work
init=/bin/bash and init=/bin/ash don't work
Status: CLOSED RAWHIDE
Product: Red Hat Public Beta
Classification: Retired
Component: kernel (Show other bugs)
phoebe
All Linux
medium Severity high
: ---
: ---
Assigned To: Arjan van de Ven
Brian Brock
:
Depends On:
Blocks: 79578
  Show dependency treegraph
 
Reported: 2003-01-09 14:39 EST by Miloslav Trmac
Modified: 2007-04-18 12:49 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2003-03-25 19:03:10 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Miloslav Trmac 2003-01-09 14:39:40 EST
Hello,
I have no idea where the bug is, but the kernel folks will at least have
an idea how to debug it.

I'm booting my Phoebe install using a boot disk without problems.

When starting it with
        linux root=/dev/hda2 init=/bin/bash
or 
        linux root=/dev/hda2 init=/bin/ash
I get 
  Kernel panic: attempted to kill init!

OTOH, running
        linux root=/dev/hda2 init=/sbin/init
works just fine.

Bot init and *sh are dynamically linked (altough bash uses
a few more libraries).
Comment 1 Bill Nottingham 2003-01-10 00:12:05 EST
Yeah, I've seen this with up to 2.4.20-2.9 (have *not* tested 2.10 yet.)
Comment 2 Bill Nottingham 2003-01-14 17:53:00 EST
Still happens with 2.4.20-2.18, FWIW.
Comment 3 Bill Nottingham 2003-01-14 18:05:54 EST
2.4.18-19.8.0 works ok on top of Phoebe.
Comment 4 Bill Nottingham 2003-01-29 12:03:24 EST
init=/usr/bin/gdb fails
init=/bin/ash.static fails

They seem to be exiting prematurely.

Of note when running init=specially-hacked-strace-that-just-runs-bash:

open of /dev/tty fails with ENXIO
ioctl()s on stdin fail with ENOTTY

Later, *read* of fd 0 fails with EISDIR (?????)
Comment 5 Bill Nottingham 2003-02-12 15:28:02 EST
Followup to last comments:

If you look at init:

[root@nostromo 1]# ls -l fd/
total 0
lrwx------    1 root     root           64 Feb 12 15:22 10 -> /dev/initctl
lr-x------    1 root     root           64 Feb 12 15:22 3 -> /
lr-x------    1 root     root           64 Feb 12 15:22 4 -> /

3 & 4 are the initrd root.

7.2, 7.3, and 8.0 kernels don't have these fds.

These fds certainly sound related to the ENOTTY, EISDIR errors above.
Comment 6 Florian La Roche 2003-02-12 19:13:44 EST
The following patch fixes this for me and looks like the right patch.

greetings,

Florian La Roche

--- linux-2.4.20/init/do_mounts.c.lr    Wed Feb 12 22:54:02 2003
+++ linux-2.4.20/init/do_mounts.c       Wed Feb 12 22:55:57 2003
@@ -837,6 +837,9 @@
        sys_chroot(".");
        sys_umount("/old/dev", 0);

+       close (root_fd);
+       close (old_fd);
+
        if (real_root_dev == ram0) {
                sys_chdir("/old");
                return;
Comment 7 Brian Brock 2003-03-25 19:03:10 EST
Fix verified in most recent kernel.  Resolving as fixed in rawhide.

Note You need to log in before you can comment on or make changes to this bug.