How to check if /init starts /etc/inittab

0

I have an embedded ARM system with processor AT91SAM9G45.

System consists of two components:

  1. Linux kernel (4.14.79)
  2. Busybox 1.29.3 as initramfs image.

I connect to the device using putty and connecting to serial port.

When kernel starts, everything goes fine. Kernel unpacks initramfs image, all files are found and listed (I see it by debug messages). But when it starts /init, log messages are:

Freeing unused kernel memory: 384K
This architecture does not have kernel memory protection.
run_init_process BEFORE /init
run_init_process AFTER /init, result = 0
Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000004

/init is symlink to /bin/busybox. I tried to replace /init with /sbin/init, /bin/busybox, /linuxrc, but results are the same.

/etc/inittab file:

# Begin /etc/inittab

id::initdefault:

si::sysinit:/etc/init.d/rc S

#l0::wait:/etc/rc.d/init.d/rc 0
#l1::wait:/etc/rc.d/init.d/rc 1
#l2::wait:/etc/rc.d/init.d/rc 2
#l3::wait:/etc/rc.d/init.d/rc 3
#l4::wait:/etc/rc.d/init.d/rc 4
#l5::wait:/etc/rc.d/init.d/rc 5
#l6::wait:/etc/rc.d/init.d/rc 6

ca::ctrlaltdel:/sbin/shutdown -t1 -a -r now

su::once:/sbin/sulogin

1::respawn:/sbin/getty ttyS1 115200
2::respawn:/sbin/getty ttyS2 115200
3::respawn:/sbin/getty ttyS3 115200
4::respawn:/sbin/getty ttyS4 115200
5::respawn:/sbin/getty ttyS5 115200
6::respawn:/sbin/getty ttyS6 115200

# End /etc/inittab

/etc/init.d/rcS file (this file is allowed to execute):

#!/bin/busybox sh
echo "Hello world!"

I don't know if even /init process starts parsing /etc/inittab or it falls before getting /etc/inittab by some reasons I cannot find out. Maybe there are some mistakes in my /etc/inittab and /etc/init.d/rcS files. Maybe there are some errors with terminal (/etc/init.d/rcS cannot write to stdout cause it's blocked, suspended, being used by another process and so on).

How to definitely get sured, that /etc/inittab is started?

linux
embedded-linux
busybox
panic
inittab
asked on Stack Overflow Jan 23, 2019 by vglv

2 Answers

0

Welcome to StackOverflow. I see there is space between rc and S si::sysinit:/etc/init.d/rc S

change it to

si::sysinit:/etc/init.d/rcS

let me know if it works.

answered on Stack Overflow Jan 23, 2019 by Devidas
0

/init is symlink to /bin/busybox.

The typical /init file in an initramfs built by Buildroot that incorporates Busybox is a script of seven lines:

#!/bin/sh
# devtmpfs does not get automounted for initramfs
/bin/mount -t devtmpfs devtmpfs /dev
exec 0</dev/console
exec 1>/dev/console
exec 2>/dev/console
exec /sbin/init $*

Note the comment ("devtmpfs does not get automounted for initramfs") and the mount command for /dev.

It's /sbin/init (rather than /init) that is linked to /bin/busybox.

IOW without the proper setup of the /dev directory, userland has no I/O capabilty.
Only after devtmpfs has been mounted should the init program in Busybox be executed, which will then access /etc/inittab.

See Is there a way to get Linux to treat an initramfs as the final root filesystem?
and
Make CONFIG_DEVTMPFS_MOUNT apply to initramfs/initmpfs

answered on Stack Overflow Jan 25, 2019 by sawdust • edited Jan 25, 2019 by sawdust

User contributions licensed under CC BY-SA 3.0