LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   initramfs problem: "Attempted to kill init" (https://www.linuxquestions.org/questions/linux-general-1/initramfs-problem-attempted-to-kill-init-843505/)

old-snake 11-10-2010 01:55 PM

initramfs problem: "Attempted to kill init"
 
Hi,

For a special purpose I needed a initramfs - that didn't work. So I reduced the initramfs setup to the simplest.
Mount the root and switch_root into it. But that didn't work either. I really am stuck here!

If I go with the init-script for the initramfs I posted below the system prints out the switch_root usage-text from busybox. But the syntax is right, ain't it??
When I use chroot instead of switch_root then it prints the usage-text of init before the kernel panic.
If I try with "/sbin/init 5" then, after a while the system reports "init: timeout opening/writing control channel /dev/initctl".
In the other cases I get the following error messages before the system hangs: "Kernel Panic", "Attempted to kill init", "init not tainted"

(With the init script below there is a error saying:"sh: can't access tty; job control turned off". I know why it's there - but don't know if it is connected to this problem.)


This information may be important:
- The machine boots from a usb-harddisk
- /sbin/init on the new root is available
- the system on newroot is sane and runs perfect standalone (without initramfs)
- the system on newroot uses baselayout-2 with openrc
- busybox is built as static binary
- busybox version is v1.15.3

Here is the relevant data:

My uname -a on that machine:
Code:

Linux nibbler 2.6.35-zen2 #13 ZEN Fri Nov 5 21:40:41 CET 2010 i586 Geode(TM) Integrated Processor by AMD PCS AuthenticAMD GNU/Linux
Content of the initramfs:
Code:

-rwxr-xr-x 1 root root  348 Nov  7 11:00 init

bin:
total 1.5M
drwxr-xr-x  2 root root 4.0K Nov  7 10:15 .
drwxr-xr-x 12 root root 4.0K Nov  7 11:21 ..
-rwxr-xr-x  1 root root 1.5M Nov  6 19:03 busybox

dev:
total 20K
drwxr-xr-x  5 root root 4.0K Nov  7 10:15 .
drwxr-xr-x 12 root root 4.0K Nov  7 11:21 ..
crw-------  1 root root 5, 1 Nov  7 10:14 console
drw-------  2 root root 4.0K Nov  7 10:15 fb
crw-------  1 root root 1, 1 Nov  7 10:14 mem
drw-------  2 root root 4.0K Nov  7 10:15 misc
crw-rw-rw-  1 root root 1, 3 Nov  7 10:14 null
crw--w----  1 root root 4, 0 Nov  7 10:14 tty0
crw-------  1 root root 4, 1 Nov  7 10:14 tty1
drw-------  2 root root 4.0K Nov  7 10:15 vc
crw-------  1 root root 1, 5 Nov  7 10:14 zero

etc:
total 8.0K
drwxr-xr-x  2 root root 4.0K Nov  6 12:03 .
drwxr-xr-x 12 root root 4.0K Nov  7 11:21 ..

lib:
total 8.0K
drwxr-xr-x  2 root root 4.0K Nov  7 10:15 .
drwxr-xr-x 12 root root 4.0K Nov  7 11:21 ..

mnt:
total 8.0K
drwxr-xr-x  2 root root 4.0K Nov  6 12:03 .
drwxr-xr-x 12 root root 4.0K Nov  7 11:21 ..

proc:
total 8.0K
drwxr-xr-x  2 root root 4.0K Nov  6 12:03 .
drwxr-xr-x 12 root root 4.0K Nov  7 11:21 ..

root:
total 12K
drwxr-xr-x  2 root root 4.0K Nov  7 00:28 .
drwxr-xr-x 12 root root 4.0K Nov  7 11:21 ..
-rw-r--r--  1 root root  33 Nov  7 00:28 .ash_history

sbin:
total 624K
drwxr-xr-x  2 root root 4.0K Nov  7 10:16 .
drwxr-xr-x 12 root root 4.0K Nov  7 11:21 ..
lrwxrwxrwx  1 root root  12 Nov  7 00:28 mdev -> /bin/busybox
-rwxr-xr-x  1 root root 607K Nov  6 12:06 mount.aufs
-rwxr-xr-x  1 root root  963 Nov  7 10:16 umount.aufs

sys:
total 8.0K
drwxr-xr-x  2 root root 4.0K Nov  6 12:03 .
drwxr-xr-x 12 root root 4.0K Nov  7 11:21 ..

usr:
total 16K
drwxr-xr-x  4 root root 4.0K Nov  7 10:12 .
drwxr-xr-x 12 root root 4.0K Nov  7 11:21 ..
drwxr-xr-x  2 root root 4.0K Nov  6 18:43 lib
drwxr-xr-x  2 root root 4.0K Nov  7 10:12 share

This is one of the more sane versions of the init:
Code:

#!/bin/busybox ash
# -*- mode: sh -*-

export CONSOLE="/dev/tty1"

mkdir /mnt/ro

mount -t proc none /proc
mount -t sysfs none /sys
sleep 15
mdev -s
echo mdev > /proc/sys/kernel/hotplug

mount -o ro /dev/sda2 /mnt/ro

echo > /proc/sys/kernel/hotplug
umount /proc
umount /sys
exec switch_root /mnt/ro /sbin/init
# or chroot /mnt/ro /sbin/init

This command is used for creating the archive:
Code:

find . -print0 | cpio --null -ov --format=newc | gzip -9 > /boot/initramfs.cpio.gz
This is the grub.conf:
Code:

# GRUB CONFIG

default 1
timeout 3

# The normal boot - rootdelay is important!
title Gentoo Linux 2.6.35-zen
root (hd0,1)
kernel /boot/bzImage-2.6.35-zen root=/dev/sda2 rootdelay=20

# The initramfs config
# Here I tried also without rootdelay and with ichkpt=6 - no difference
title Aufs Gentoo Linux 2.6.35-zen
root (hd0,1)
kernel /boot/bzImage-2.6.35-zen root=/dev/sda2 rootdelay=20
initrd /boot/initramfs.cpio.gz

Here is the kernel config:
http://pastebin.com/Y0Fz48J7


Any help is highly appreciated!

old-snake 11-15-2010 03:36 PM

Solved!
See this thread in gentoo-forums:
http://forums.gentoo.org/viewtopic-p-6486685.html


All times are GMT -5. The time now is 08:53 AM.