Bug 81469 - init=/bin/bash and init=/bin/ash don't work
Summary: init=/bin/bash and init=/bin/ash don't work
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Public Beta
Classification: Retired
Component: kernel
Version: phoebe
Hardware: All
OS: Linux
medium
high
Target Milestone: ---
Assignee: Arjan van de Ven
QA Contact: Brian Brock
URL:
Whiteboard:
Depends On:
Blocks: 79578
TreeView+ depends on / blocked
 
Reported: 2003-01-09 19:39 UTC by Miloslav Trmac
Modified: 2007-04-18 16:49 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2003-03-26 00:03:10 UTC
Embargoed:


Attachments (Terms of Use)

Description Miloslav Trmac 2003-01-09 19:39:40 UTC
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 05:12:05 UTC
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 22:53:00 UTC
Still happens with 2.4.20-2.18, FWIW.

Comment 3 Bill Nottingham 2003-01-14 23:05:54 UTC
2.4.18-19.8.0 works ok on top of Phoebe.

Comment 4 Bill Nottingham 2003-01-29 17:03:24 UTC
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 20:28:02 UTC
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-13 00:13:44 UTC
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-26 00:03:10 UTC
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.