4

I am making an embedded Linux distribution and my board is a Raspberry Pi. My kernel version is 3.2.27 without initramfs and my root file system as follows:

/lib                          /* contains kernel modules */
/bin /sbin /usr/bin /usr/sbin /* contains busybox utils binaries */
/usr/lib                      /* contains cross-compiler tool chain libs */
linuxrc                       /* generated by busybox, kept in / */
/dev                          /* I have created console and ttyAM0 manually but added mode devices by udev */
/etc/init.d/rcS               /* required by busybox init */

after kernel booted I am getting a console (I don't know whether it is busybox console or not). I have few problems below

  • No process information available (no files/folder created under /proc).
  • When I am using ps -e it shows nothing.

Why this unexpected behavior happens?

5

After initialising and mounting the root file system, Linux starts /sbin/init which carries on with the user space initialisations including mounting /proc

Most likely your rcS or whatever configuration init reads doesn't do that, and you need to tell it to.

If you've got a shell prompt, you can mount /proc manually with:

mount -t proc p /proc

Note that the /proc directory must exist before you can mount something there. You should include it in your root image.

| improve this answer | |
3

2) is very likely because of 1) - ps uses /proc to get information about running processes.

1) is either because the initialisation isn't expected to do that or because it fails to do it. Check what the distribution is supposed to do on boot - how the system is to be brought up.

Things you can try:

  • mount /proc, e.g.: mount -t proc proc /proc - the second argument is arbitrary (it's what shows as the source of the mount). Check what is running with PID=1

  • check in /proc/cmdline what parameters your kernel receives on boot. If it contains init=... you might need to change it to e.g. /sbin/init or remove it to let kernel try to resolve the init to be run itself. You have to do this in bootloader configuration (for R-Pi this is in some text file on the SD card IIRC).

  • Check that the desired init executable exists - Busybox normaly has tons of symlinks pointing to its binary so that one can use command [args] rather than busybox command [args]. Your might be missing those.

| improve this answer | |
0

Mount it first thing on your /etc/inittab

That is, you inittab should start with:

::sysinit:/bin/mount -t proc proc /proc

This is done by Buildroot 2017.02.

| improve this answer | |
0

I had this problem with an extremely bare-bones Linux container. I found that ps (and other things) didn't work on the initial launch of the container but everything was fine if the container was restarted.

My container image did not contain an empty /proc directory so busybox had nowhere to mount the proc filesystem. However, it did get created later (I presume busybox did it at some point) which meant that it existed on subsequent restarts and that allowed it to successfully mount.

I recreated my image to include /proc and everything worked after that.

So, it would appear that the root file system must contain a /proc directory for busybox to mount on. No further action (manual mounts, inittab entries, etc) seem necessary (at least in a container).

An inconsistency is that busybox seems happy to create similar directories that it needs to mount on, such as /sys.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.