overlayfs: Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000100

Open
#3,317 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
linux

Research direction

Reproduce the panic using the supplied initramfs-tools files at /usr/share/initramfs-tools/hooks/ro_root and /usr/share/initramfs-tools/scripts/init-bottom/ro_root, then compare kernel-panic.txt with successful-boot.txt. Start with the overlayfs mount and the init-bottom script, and consider the issue done when the generated initramfs boots with a working read-only root filesystem without requiring the /dev/console write.

Written by the indexing model from the issue text.

Description

Setting up a root file system as read-only with the help of overlayfs, I can reliably reproduce a kernel panic. It looks very much like a kernel bug to me, although I am not perfectly sure about this.

It occurs when mounting an overlay in a shell script in an initramfs like this:

mount -t overlay -o "lowerdir=${ROOT_RO},upperdir=${UPPER},workdir=${WORK}" root.union "${rootmnt}"

and later exiting the script. If I write anything into /dev/console after the mount command and before exiting the script, it works fine.

To reproduce

  1. Write the current lite release 2019-09-26-raspbian-buster-lite.img onto an SD card: sudo dd if=2019-09-26-raspbian-buster-lite.img of=/dev/mmcblk0 bs=1M
  2. Boot from that SD card on a Raspberry 3B+, log in as pi, set date, apt-get update, apt-get upgrade, apt-get dist-upgrade.
  3. Place the two files from initramfs-tools.zip at /usr/share/initramfs-tools/hooks/ro_root and /usr/share/initramfs-tools/scripts/init-bottom/ro_root.
  4. Create an initramfs: sudo mkinitramfs -o /boot/initrd.img-4.19.75-v7+ 4.19.75-v7+.
  5. Activate the initramfs by appending initramfs initrd.img-4.19.75-v7+ followkernel to /boot/config.txt.
  6. Reboot.

Expected behaviour
Properly booting Raspbian with a working read-only root file system

Actual behaviour
A kernel panic

Output of the console via UART (after disabling bluetooth in config.txt with dtoverlay=pi3-disable-bt): kernel-panic.txt

When activating the last line in /usr/share/initramfs-tools/scripts/init-bottom/ro_root
echo "" > "${rootmnt}"/dev/console

and regenerating the initramfs
sudo mkinitramfs -o /boot/initrd.img-4.19.75-v7+ 4.19.75-v7+

it works fine: successful-boot.txt

Note that the particular device node /dev/console is important. Things like e.g. /dev/ttyprintk do not work for me.

System
Output of raspinfo after successful boot: raspinfo.txt

Dominant language
C
Stars
13.2k
Forks
5.5k
Avg merge
2d 21h
Merged PRs (30d)
21

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from raspberrypi/linux

All issues in raspberrypi/linux

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.