Kernel Panic : No working init found. Try passing init= option to kernel

Insane Coder picture Insane Coder · May 15, 2018 · Viewed 15.4k times · Source

I have just started to understand the kernel working and internals and to begin with, I am trying to build the kernel and boot it.

I am using qemu as simulator for x86 architecture.

I am following this article (which is for arm though) : http://www.kaizou.org/2016/09/boot-minimal-linux-qemu/

I have built kernel using the following commands :

cd kernel_4.9
make x86_64-defconfig
make -j8

This gives me the bzImage. Now I developed a dummy initramfs with just hello world as the executable. This is the init.c :

#include <stdio.h>

void main()
{
    printf("Tiny init - Hello World...\n");
    while(1);
}

Pack the initramfs

gcc -static init.c -o init
chmod +x init
echo init | cpio -o --format=newc > initramfs

Now run the qemu :

qemu-system-x86_64 -kernel ~/data/linux/arch/x86/boot/bzImage -append 'console=ttyS0' -serial stdio -initrd ~/data/linux/arch/x86/boot/initramfs

I get this error :

[    1.158556] Write protecting the kernel text: 8528k
[    1.158842] Write protecting the kernel read-only data: 2396k
[    1.163684] Failed to execute /init (error -2)
[    1.163973] Kernel panic - not syncing: No working init found.  Try passing init= option to kernel. See Linux Documentation/init.txt for guidance.
[    1.164026] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.9.0 #3
[    1.164026] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Ubuntu-1.8.2-1ubuntu1 04/01/2014
[    1.164026]  c78a5f78 c12dd8e4 c184c900 00000000 c78a5f98 c110d8a0 c19b465c c1c400a0
[    1.164026]  c19a5f8c c184c930 00000000 00000000 c78a5fac c184ca18 c19a5fd8 c19a5bc1
[    1.164026]  fffffffe 00000000 c1851537 00000000 00000000 00000000 00000000 00000000
[    1.164026] Call Trace:
[    1.164026]  [<c12dd8e4>] dump_stack+0x47/0x63
[    1.164026]  [<c184c900>] ? rest_init+0x30/0x60
[    1.164026]  [<c110d8a0>] panic+0x93/0x1bc
[    1.164026]  [<c184c930>] ? rest_init+0x60/0x60
[    1.164026]  [<c184ca18>] kernel_init+0xe8/0x100
[    1.164026]  [<c1851537>] ret_from_fork+0x1b/0x28
[    1.164026] Kernel Offset: disabled
[    1.164026] ---[ end Kernel panic - not syncing: No working init found.  Try passing init= option to kernel. See Linux Documentation/init.txt for guidance.

Here are the complete boot serial logs :

Failed to initialize module: /usr/lib/x86_64-linux-gnu/qemu/block-iscsi.so
Note: only modules from the same build can be loaded.
Failed to initialize module: /usr/lib/x86_64-linux-gnu/qemu/block-curl.so
Note: only modules from the same build can be loaded.
Failed to initialize module: /usr/lib/x86_64-linux-gnu/qemu/block-rbd.so
Note: only modules from the same build can be loaded.
Failed to initialize module: /usr/lib/x86_64-linux-gnu/qemu/block-dmg.so
Note: only modules from the same build can be loaded.
warning: TCG doesn't support requested feature: CPUID.01H:ECX.vmx [bit 5]
[    0.000000] Linux version 4.9.0 (naveen@intel) (gcc version 4.8.5 (Ubuntu 4.8.5-4ubuntu2) ) #3 SMP Tue May 15 14:30:37 IST 2018
[    0.000000] x86/fpu: Legacy x87 FPU detected.
[    0.000000] x86/fpu: Using 'eager' FPU context switches.
[    0.000000] e820: BIOS-provided physical RAM map:
[    0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009fbff] usable
[    0.000000] BIOS-e820: [mem 0x000000000009fc00-0x000000000009ffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000000f0000-0x00000000000fffff] reserved
[    0.000000] BIOS-e820: [mem 0x0000000000100000-0x0000000007fdffff] usable
[    0.000000] BIOS-e820: [mem 0x0000000007fe0000-0x0000000007ffffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000fffc0000-0x00000000ffffffff] reserved
[    0.000000] Notice: NX (Execute Disable) protection cannot be enabled: non-PAE kernel!
[    0.000000] SMBIOS 2.8 present.
[    0.000000] e820: last_pfn = 0x7fe0 max_arch_pfn = 0x100000
[    0.000000] x86/PAT: Configuration [0-7]: WB  WC  UC- UC  WB  WC  UC- WT  
[    0.000000] found SMP MP-table at [mem 0x000f6640-0x000f664f] mapped at [c00f6640]
[    0.000000] Scanning 1 areas for low memory corruption
[    0.000000] RAMDISK: [mem 0x07f02000-0x07fdffff]
[    0.000000] ACPI: Early table checksum verification disabled
[    0.000000] ACPI: RSDP 0x00000000000F6460 000014 (v00 BOCHS )
[    0.000000] ACPI: RSDT 0x0000000007FE16EE 000034 (v01 BOCHS  BXPCRSDT 00000001 BXPC 00000001)
[    0.000000] ACPI: FACP 0x0000000007FE0C14 000074 (v01 BOCHS  BXPCFACP 00000001 BXPC 00000001)
[    0.000000] ACPI: DSDT 0x0000000007FE0040 000BD4 (v01 BOCHS  BXPCDSDT 00000001 BXPC 00000001)
[    0.000000] ACPI: FACS 0x0000000007FE0000 000040
[    0.000000] ACPI: SSDT 0x0000000007FE0C88 0009B6 (v01 BOCHS  BXPCSSDT 00000001 BXPC 00000001)
[    0.000000] ACPI: APIC 0x0000000007FE163E 000078 (v01 BOCHS  BXPCAPIC 00000001 BXPC 00000001)
[    0.000000] ACPI: HPET 0x0000000007FE16B6 000038 (v01 BOCHS  BXPCHPET 00000001 BXPC 00000001)
[    0.000000] 0MB HIGHMEM available.
[    0.000000] 127MB LOWMEM available.
[    0.000000]   mapped low ram: 0 - 07fe0000
[    0.000000]   low ram: 0 - 07fe0000
[    0.000000] Zone ranges:
[    0.000000]   DMA      [mem 0x0000000000001000-0x0000000000ffffff]
[    0.000000]   Normal   [mem 0x0000000001000000-0x0000000007fdffff]
[    0.000000]   HighMem  empty
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000001000-0x000000000009efff]
[    0.000000]   node   0: [mem 0x0000000000100000-0x0000000007fdffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000001000-0x0000000007fdffff]
[    0.000000] Using APIC driver default
[    0.000000] ACPI: PM-Timer IO Port: 0x608
[    0.000000] ACPI: LAPIC_NMI (acpi_id[0xff] dfl dfl lint[0x1])
[    0.000000] IOAPIC[0]: apic_id 0, version 17, address 0xfec00000, GSI 0-23
[    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 0 global_irq 2 dfl dfl)
[    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 5 global_irq 5 high level)
[    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 9 high level)
[    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 10 global_irq 10 high level)
[    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 11 global_irq 11 high level)
[    0.000000] Using ACPI (MADT) for SMP configuration information
[    0.000000] smpboot: Allowing 1 CPUs, 0 hotplug CPUs
[    0.000000] PM: Registered nosave memory: [mem 0x00000000-0x00000fff]
[    0.000000] PM: Registered nosave memory: [mem 0x0009f000-0x0009ffff]
[    0.000000] PM: Registered nosave memory: [mem 0x000a0000-0x000effff]
[    0.000000] PM: Registered nosave memory: [mem 0x000f0000-0x000fffff]
[    0.000000] e820: [mem 0x08000000-0xfffbffff] available for PCI devices
[    0.000000] clocksource: refined-jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 1910969940391419 ns
[    0.000000] setup_percpu: NR_CPUS:8 nr_cpumask_bits:8 nr_cpu_ids:1 nr_node_ids:1
[    0.000000] percpu: Embedded 20 pages/cpu @c7deb000 s50284 r0 d31636 u81920
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 32382
[    0.000000] Kernel command line: console=ttyS0
[    0.000000] PID hash table entries: 512 (order: -1, 2048 bytes)
[    0.000000] Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
[    0.000000] Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
[    0.000000] Initializing CPU#0
[    0.000000] Initializing HighMem for node 0 (00000000:00000000)
[    0.000000] Memory: 115236K/130552K available (8524K kernel code, 784K rwdata, 2388K rodata, 728K init, 608K bss, 15316K reserved, 0K cma-reserved, 0K highmem)
[    0.000000] virtual kernel memory layout:
[    0.000000]     fixmap  : 0xfff16000 - 0xfffff000   ( 932 kB)
[    0.000000]     pkmap   : 0xff800000 - 0xffc00000   (4096 kB)
[    0.000000]     vmalloc : 0xc87e0000 - 0xff7fe000   ( 880 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xc7fe0000   ( 127 MB)
[    0.000000]       .init : 0xc1b71000 - 0xc1c27000   ( 728 kB)
[    0.000000]       .data : 0xc185349f - 0xc1b6f1e0   (3183 kB)
[    0.000000]       .text : 0xc1000000 - 0xc185349f   (8525 kB)
[    0.000000] Checking if this processor honours the WP bit even in supervisor mode...Ok.
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] Hierarchical RCU implementation.
[    0.000000]  Build-time adjustment of leaf fanout to 32.
[    0.000000]  RCU restricting CPUs from NR_CPUS=8 to nr_cpu_ids=1.
[    0.000000] RCU: Adjusting geometry for rcu_fanout_leaf=32, nr_cpu_ids=1
[    0.000000] NR_IRQS:2304 nr_irqs:256 16
[    0.000000] Console: colour VGA+ 80x25
[    0.000000] console [ttyS0] enabled
[    0.000000] tsc: Fast TSC calibration using PIT
[    0.000000] tsc: Detected 3990.752 MHz processor
[    0.003738] Calibrating delay loop (skipped), value calculated using timer frequency.. 7981.50 BogoMIPS (lpj=3990752)
[    0.004100] pid_max: default: 32768 minimum: 301
[    0.004298] ACPI: Core revision 20160831
[    0.018424] ACPI: 2 ACPI AML tables successfully acquired and loaded
[    0.019070] Security Framework initialized
[    0.019253] SELinux:  Initializing.
[    0.019731] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.019863] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.027879] mce: CPU supports 10 MCE banks
[    0.028880] Last level iTLB entries: 4KB 0, 2MB 0, 4MB 0
[    0.028964] Last level dTLB entries: 4KB 0, 2MB 0, 4MB 0, 1GB 0
[    0.066432] Freeing SMP alternatives memory: 32K (c1c27000 - c1c2f000)
[    0.072781] smpboot: APIC(0) Converting physical 0 to logical package 0
[    0.072931] smpboot: Max logical packages: 1
[    0.073183] Enabling APIC mode:  Flat.  Using 1 I/O APICs
[    0.075427] ..TIMER: vector=0x30 apic1=0 pin1=2 apic2=-1 pin2=-1
[    0.086000] smpboot: CPU0: AMD QEMU Virtual CPU version 2.5+ (family: 0x6, model: 0x6, stepping: 0x3)
[    0.086000] Performance Events: PMU not available due to virtualization, using software events only.
[    0.092173] Huh? What family is it: 0x6?!
[    0.093089] x86: Booted up 1 node, 1 CPUs
[    0.093224] smpboot: Total of 1 processors activated (7981.50 BogoMIPS)
[    0.098310] devtmpfs: initialized
[    0.102509] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 1911260446275000 ns
[    0.103555] RTC time: 11:32:24, date: 05/15/18
[    0.106305] NET: Registered protocol family 16
[    0.113898] kworker/u2:0 (16) used greatest stack depth: 7104 bytes left
[    0.116939] cpuidle: using governor menu
[    0.117699] ACPI: bus type PCI registered
[    0.120641] PCI: PCI BIOS revision 2.10 entry at 0xfd40f, last bus=0
[    0.120800] PCI: Using configuration type 1 for base access
[    0.128384] kworker/u2:1 (45) used greatest stack depth: 6840 bytes left
[    0.205191] HugeTLB registered 4 MB page size, pre-allocated 0 pages
[    0.207229] ACPI: Added _OSI(Module Device)
[    0.207322] ACPI: Added _OSI(Processor Device)
[    0.207411] ACPI: Added _OSI(3.0 _SCP Extensions)
[    0.207481] ACPI: Added _OSI(Processor Aggregator Device)
[    0.219594] ACPI: Interpreter enabled
[    0.220185] ACPI: (supports S0 S3 S4 S5)
[    0.220292] ACPI: Using IOAPIC for interrupt routing
[    0.220749] PCI: Using host bridge windows from ACPI; if necessary, use "pci=nocrs" and report a bug
[    0.256389] ACPI: PCI Root Bridge [PCI0] (domain 0000 [bus 00-ff])
[    0.257153] acpi PNP0A03:00: _OSC: OS supports [ASPM ClockPM Segments]
[    0.257559] acpi PNP0A03:00: _OSC failed (AE_NOT_FOUND); disabling ASPM
[    0.258039] acpi PNP0A03:00: fail to add MMCONFIG information, can't access extended PCI configuration space under this bridge.
[    0.260137] PCI host bridge to bus 0000:00
[    0.260323] pci_bus 0000:00: root bus resource [io  0x0000-0x0cf7 window]
[    0.260489] pci_bus 0000:00: root bus resource [io  0x0d00-0xffff window]
[    0.260648] pci_bus 0000:00: root bus resource [mem 0x000a0000-0x000bffff window]
[    0.260810] pci_bus 0000:00: root bus resource [mem 0x08000000-0xfebfffff window]
[    0.261106] pci_bus 0000:00: root bus resource [bus 00-ff]
[    0.266648] pci 0000:00:01.1: legacy IDE quirk: reg 0x10: [io  0x01f0-0x01f7]
[    0.267038] pci 0000:00:01.1: legacy IDE quirk: reg 0x14: [io  0x03f6]
[    0.267212] pci 0000:00:01.1: legacy IDE quirk: reg 0x18: [io  0x0170-0x0177]
[    0.267388] pci 0000:00:01.1: legacy IDE quirk: reg 0x1c: [io  0x0376]
[    0.269092] pci 0000:00:01.3: quirk: [io  0x0600-0x063f] claimed by PIIX4 ACPI
[    0.269271] pci 0000:00:01.3: quirk: [io  0x0700-0x070f] claimed by PIIX4 SMB
[    0.287173] ACPI: PCI Interrupt Link [LNKA] (IRQs 5 *10 11)
[    0.287967] ACPI: PCI Interrupt Link [LNKB] (IRQs 5 *10 11)
[    0.288550] ACPI: PCI Interrupt Link [LNKC] (IRQs 5 10 *11)
[    0.289246] ACPI: PCI Interrupt Link [LNKD] (IRQs 5 10 *11)
[    0.289629] ACPI: PCI Interrupt Link [LNKS] (IRQs *9)
[    0.291383] ACPI: Enabled 16 GPEs in block 00 to 0F
[    0.294509] vgaarb: setting as boot device: PCI:0000:00:02.0
[    0.294694] vgaarb: device added: PCI:0000:00:02.0,decodes=io+mem,owns=io+mem,locks=none
[    0.294864] vgaarb: loaded
[    0.295054] vgaarb: bridge control possible 0000:00:02.0
[    0.296564] SCSI subsystem initialized
[    0.298270] ACPI: bus type USB registered
[    0.298918] usbcore: registered new interface driver usbfs
[    0.299384] usbcore: registered new interface driver hub
[    0.299663] usbcore: registered new device driver usb
[    0.300606] pps_core: LinuxPPS API ver. 1 registered
[    0.300720] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <[email protected]>
[    0.301225] PTP clock support registered
[    0.304522] Advanced Linux Sound Architecture Driver Initialized.
[    0.305080] PCI: Using ACPI for IRQ routing
[    0.312927] NetLabel: Initializing
[    0.313058] NetLabel:  domain hash size = 128
[    0.313185] NetLabel:  protocols = UNLABELED CIPSOv4
[    0.313816] NetLabel:  unlabeled traffic allowed by default
[    0.316063] clocksource: Switched to clocksource refined-jiffies
[    0.381394] VFS: Disk quotas dquot_6.6.0
[    0.381690] VFS: Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
[    0.383559] pnp: PnP ACPI init
[    0.389350] pnp: PnP ACPI: found 6 devices
[    0.402753] kworker/u2:1 (571) used greatest stack depth: 6796 bytes left
[    0.452615] clocksource: acpi_pm: mask: 0xffffff max_cycles: 0xffffff, max_idle_ns: 2085701024 ns
[    0.453280] clocksource: Switched to clocksource acpi_pm
[    0.455402] NET: Registered protocol family 2
[    0.459357] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[    0.459595] TCP bind hash table entries: 1024 (order: 1, 8192 bytes)
[    0.459779] TCP: Hash tables configured (established 1024 bind 1024)
[    0.460212] UDP hash table entries: 256 (order: 1, 8192 bytes)
[    0.460409] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes)
[    0.461374] NET: Registered protocol family 1
[    0.462874] RPC: Registered named UNIX socket transport module.
[    0.463082] RPC: Registered udp transport module.
[    0.463192] RPC: Registered tcp transport module.
[    0.463330] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.463523] pci 0000:00:00.0: Limiting direct PCI/PCI transfers
[    0.463697] pci 0000:00:01.0: PIIX3: Enabling Passive Release
[    0.463897] pci 0000:00:01.0: Activating ISA DMA hang workarounds
[    0.464260] pci 0000:00:02.0: Video device with shadowed ROM at [mem 0x000c0000-0x000dffff]
[    0.467306] Unpacking initramfs...
[    0.473860] Freeing initrd memory: 888K (c7f02000 - c7fe0000)
[    0.476653] Scanning for low memory corruption every 60 seconds
[    0.482223] futex hash table entries: 256 (order: 1, 8192 bytes)
[    0.482606] audit: initializing netlink subsys (disabled)
[    0.483232] audit: type=2000 audit(1526383943.481:1): initialized
[    0.487391] workingset: timestamp_bits=30 max_order=15 bucket_order=0
[    0.521354] NFS: Registering the id_resolver key type
[    0.521913] Key type id_resolver registered
[    0.522513] Key type id_legacy registered
[    0.531936] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 251)
[    0.532322] io scheduler noop registered
[    0.532530] io scheduler deadline registered
[    0.532992] io scheduler cfq registered (default)
[    0.535402] pci_hotplug: PCI Hot Plug PCI Core version: 0.5
[    0.537948] input: Power Button as /devices/LNXSYSTM:00/LNXPWRBN:00/input/input0
[    0.538556] ACPI: Power Button [PWRF]
[    0.542194] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
[    0.564322] 00:05: ttyS0 at I/O 0x3f8 (irq = 4, base_baud = 115200) is a 16550A
[    0.570759] hpet_acpi_add: no address or irqs in _CRS
[    0.572175] Non-volatile memory driver v1.3
[    0.572626] Linux agpgart interface v0.103
[    0.574796] [drm] Initialized
[    0.590888] loop: module loaded
[    0.600539] scsi host0: ata_piix
[    0.602350] scsi host1: ata_piix
[    0.602865] ata1: PATA max MWDMA2 cmd 0x1f0 ctl 0x3f6 bmdma 0xc040 irq 14
[    0.603187] ata2: PATA max MWDMA2 cmd 0x170 ctl 0x376 bmdma 0xc048 irq 15
[    0.605942] e100: Intel(R) PRO/100 Network Driver, 3.5.24-k2-NAPI
[    0.606265] e100: Copyright(c) 1999-2006 Intel Corporation
[    0.606537] e1000: Intel(R) PRO/1000 Network Driver - version 7.3.21-k8-NAPI
[    0.606639] e1000: Copyright (c) 1999-2006 Intel Corporation.
[    0.770123] ata2.00: ATAPI: QEMU DVD-ROM, 2.5+, max UDMA/100
[    0.771169] ata2.00: configured for MWDMA2
[    0.780823] scsi 1:0:0:0: CD-ROM            QEMU     QEMU DVD-ROM     2.5+ PQ: 0 ANSI: 5
[    0.797856] sr 1:0:0:0: [sr0] scsi3-mmc drive: 4x/4x cd/rw xa/form2 tray
[    0.798184] cdrom: Uniform CD-ROM driver Revision: 3.20
[    0.801572] sr 1:0:0:0: Attached scsi generic sg0 type 5
[    0.816855] ACPI: PCI Interrupt Link [LNKC] enabled at IRQ 11
[    1.093251] e1000 0000:00:03.0 eth0: (PCI:33MHz:32-bit) 52:54:00:12:34:56
[    1.093505] e1000 0000:00:03.0 eth0: Intel(R) PRO/1000 Network Connection
[    1.093945] e1000e: Intel(R) PRO/1000 Network Driver - 3.2.6-k
[    1.094092] e1000e: Copyright(c) 1999 - 2015 Intel Corporation.
[    1.094383] sky2: driver version 1.30
[    1.096254] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    1.096381] ehci-pci: EHCI PCI platform driver
[    1.096606] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    1.096897] ohci-pci: OHCI PCI platform driver
[    1.097279] uhci_hcd: USB Universal Host Controller Interface driver
[    1.098362] usbcore: registered new interface driver usblp
[    1.098982] usbcore: registered new interface driver usb-storage
[    1.099966] i8042: PNP: PS/2 Controller [PNP0303:KBD,PNP0f13:MOU] at 0x60,0x64 irq 1,12
[    1.101934] serio: i8042 KBD port at 0x60,0x64 irq 1
[    1.102277] serio: i8042 AUX port at 0x60,0x64 irq 12
[    1.103964] mousedev: PS/2 mouse device common for all mice
[    1.106301] input: AT Translated Set 2 keyboard as /devices/platform/i8042/serio0/input/input1
[    1.109219] rtc_cmos 00:00: RTC can wake from S4
[    1.111243] random: fast init done
[    1.112992] rtc_cmos 00:00: rtc core: registered rtc_cmos as rtc0
[    1.113528] rtc_cmos 00:00: alarms up to one day, 114 bytes nvram
[    1.115407] device-mapper: ioctl: 4.35.0-ioctl (2016-06-23) initialised: [email protected]
[    1.116222] hidraw: raw HID events driver (C) Jiri Kosina
[    1.121501] usbcore: registered new interface driver usbhid
[    1.121599] usbhid: USB HID core driver
[    1.132988] Netfilter messages via NETLINK v0.30.
[    1.133823] nf_conntrack version 0.5.0 (2048 buckets, 8192 max)
[    1.136193] ctnetlink v0.93: registering with nfnetlink.
[    1.138450] ip_tables: (C) 2000-2006 Netfilter Core Team
[    1.139693] Initializing XFRM netlink socket
[    1.141378] NET: Registered protocol family 10
[    1.145915] ip6_tables: (C) 2000-2006 Netfilter Core Team
[    1.147303] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
[    1.149505] NET: Registered protocol family 17
[    1.149894] Key type dns_resolver registered
[    1.151507] microcode: AMD CPU family 0x6 not supported
[    1.151630] Using IPI No-Shortcut mode
[    1.153701] registered taskstats version 1
[    1.155785]   Magic number: 2:763:529
[    1.156245] console [netcon0] enabled
[    1.156330] netconsole: network logging started
[    1.157653] ALSA device list:
[    1.157719]   No soundcards found.
[    1.186333] Freeing unused kernel memory: 728K (c1b71000 - c1c27000)
[    1.186687] Write protecting the kernel text: 8528k
[    1.186986] Write protecting the kernel read-only data: 2396k
[    1.191970] Failed to execute /init (error -8)
[    1.192330] Kernel panic - not syncing: No working init found.  Try passing init= option to kernel. See Linux Documentation/init.txt for guidance.
[    1.192664] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.9.0 #3
[    1.192756] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Ubuntu-1.8.2-1ubuntu1 04/01/2014
[    1.192992]  c78a5f78 c12dd8e4 c184c900 00000000 c78a5f98 c110d8a0 c19b465c c1c400a0
[    1.193079]  c19a5f8c c184c930 00000000 00000000 c78a5fac c184ca18 c19a5fd8 c19a5bc1
[    1.193079]  fffffff8 00000000 c1851537 00000000 00000000 00000000 00000000 00000000
[    1.193079] Call Trace:
[    1.193079]  [<c12dd8e4>] dump_stack+0x47/0x63
[    1.193079]  [<c184c900>] ? rest_init+0x30/0x60
[    1.193079]  [<c110d8a0>] panic+0x93/0x1bc
[    1.193079]  [<c184c930>] ? rest_init+0x60/0x60
[    1.193079]  [<c184ca18>] kernel_init+0xe8/0x100
[    1.193079]  [<c1851537>] ret_from_fork+0x1b/0x28
[    1.193079] Kernel Offset: disabled
[    1.193079] ---[ end Kernel panic - not syncing: No working init found.  Try passing init= option to kernel. See Linux Documentation/init.txt for guidance.

I have seen several posts over past 2 days discussing the similar issue, but none helped. In fact, the blog post I followed as reference has been working for the author and other people (could be for different architecture). I also referred Documentation/init.txt in kernel repo. I am losing my motivation out of frustration. Can someone please guide me and help me keep going?

Answer

tangrs picture tangrs · May 16, 2018

It looks like you're packing your init binary in the root of your initramfs instead of in the usual places the kernel looks for:

/sbin/init
/etc/init
/bin/init
/bin/sh

Try moving your init binary into one of those directories or specify init=/init as a kernel parameter as suggested by the error message you're getting.