debugging `Kernel panic - not syncing: Attempted to kill init!`

28,490

having the same issue with Trusty (14.04) while trying to solve an unity issue using a solution found on one of the bug's documentation.

Makes me sad to see all this research go to "waste" without even an attempt of an answer. Surely there must be a way to fix this without a fresh install.


I haven't came to a solution yet, but let me share what can be the entry to a solution (part of it thanks to this thread):

  1. Create a bootable USB drive with the Ubuntu distro of your preference

  2. Select the Try Ubuntu option

  3. Make sure your filesystem is usable with e2fsck /dev/your-partition

    • you can get the correct info by running blikd or fdisk -l
  4. Mount your partition with sudo mount /dev/your-partition /mnt

  5. Access your root's env with chroot /mnt

  6. By now you should have full access to your filesystem.
    It's up to you to try to fix or retrieve your data through an USB drive or using rsync

I was stuck trying to rebuild init through sudo apt-get install init

it returned unable to locate package init and as for sudo apt-get update it returned something like

Is there a default init package for ubuntu 14.04?

While trying to download manually, I've found an immense list of init packages here.

The only "init" package i've found is apparently for xenial. Can i use this package to install in trusty?


Still trying to figure out how to make this work. A few more hours until I admit defeat and start backing up my sensitive data before reinstalling from scratch.

Share:
28,490

Related videos on Youtube

Matteo
Author by

Matteo

I'm a PhD student in Computer Science.

Updated on September 18, 2022

Comments

  • Matteo
    Matteo over 1 year

    After accepting to a kernel update my system stopped functioning. Commands on the terminal (like ls, cd, etc.) were not working and returned an error message command not found, as well as trying to use the GUI for any action.

    I forcefully shut down the computer and after rebooting I (expectedly) got a kernel panic error:

    [timestamp]Kernel panic - not syncing: Attempted to kill init! exitcode=0x0001000
    [timestamp]CPU: 0 PID: 1 Comm: run-init Not tainted 3.19.0-25-generic #26~14.04.1-Ubuntu
    [timestamp]Hardware name: To Be Filled By O.E.M. To Be Filled By O.E.M./B150M Pro4S, BIOS P1.10 07/16/2015
    [timestamp] ffff88084cd60380 ffff880851727e68 ffffffff817aed00 0000000000002478
    [timestamp] ffffffff81a901a8 ffff880851727ee8 ffffffff817a8bc8 ffff880851728000
    [timestamp] ffffffff00000010 ffff880851727ef8 ffff880851727e98 ffffffff81c5ee20
    [timestamp] Call Trace:
    [timestamp]  [<ffffffff817aed00>] dump_stack+0x45/0x57
    [timestamp]  [<ffffffff817a8bc8>] panic+0xc1/0x1f5
    [timestamp]  [<ffffffff81077ae1>] do_exit+0xa11/0xb00
    [timestamp]  [<ffffffff81077c17>] SyS_exit+0x17/0x20
    [timestamp]  [<ffffffff817b668d>] system_call_fastpath+0x16/0x1b
    [timestamp] Kernel Offset: 0x0 from 0xffffffff81000000 (relocation range:0xffffffff80000000-0xffffffffbfffffff)
    [timestamp] ---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x0001000
    

    I didn't panic (hope you like the pun) and looked for possible solutions online, amongst which I found:


    The problem with this approach is that somehow the new kernel seems to have messed up the old one, and if and when I use the GRUB menu to select a previous version (both in regular and recovery mode) the new kernel gives the exact same error.


    My error is similar, as the run-init command is not working, but not because a file is missing. Similarly to the OP's case, my disk is working fine and if I access the device from a LiveOS I'm able to find all the binary directories and files.


    The links refer to different systems so I adapted the solution as follows, once I started the GRUB command line:

    grub> set root=(hd0,1) selinux=0 enforcing=0
    grub> linux /boot/vmlinuz-3.19.0-25-generic root=/dev/sda1
    grub> initrd /boot/initrd.img-3.13.0-29-generic
    grub> boot
    

    Not really suggesting a solution, but pointing out multiple possible diagnosis none of which seem to fit my problem.


    Sort of unrelated to the kernel panic, but explains how to boot into single user mode from within the GRUB menu. This prevents the X Server from being launched and hopefully would allow me to run the kernel.


    At this point I found many diagnosis, tried many solutions and nothing worked.

    What I (think I) understand:

    • The kernel (both new and old, recovery mode or not) is having a problem running the run-init command.
    • This has nothing to do with my HW, as the computer works fine with a LiveOS, and I am able to use graphics card, access my disk, use keyboard and mouse.
    • This error is in the early stages of booting, as trying to boot into single-user mode does not work and preventing the X server to load has no effect.

    What I would like to understand, in order of importance:

    • Is it possible that a new kernel install overwrites / messes-up the old kernel?
    • Is anyone aware of something I'm missing / other solutions?
    • Did I do any mistake in implementing the above solutions?
    • Is there anything that I haven't tried that comes off the top of your head?
    • Can I install a new kernel without formatting everything from the GRUB console?
    • Is it time to reinstall the OS? (If you can't answer the ones above I already know the answer to this one...)

    Further readings

    • WinEunuuchs2Unix
      WinEunuuchs2Unix over 7 years
      Have you tried booting with all the options in "advanced options" sub-menu? Just thinking you might get lucky that one might work. Someone posted in the last 48 hours in AskUbuntu that when ever they tried to run a command they got "command not found" error so you might want to search on his problem and any proposed solutions.
    • Matteo
      Matteo over 7 years
      @WinEunuuchs2Unix - Yeah, I was getting exactly the same command not found errors before i decided to turn the system off. Can you point me to that question? Also, I tried all the options and none of them works...
    • WinEunuuchs2Unix
      WinEunuuchs2Unix over 7 years
      I did a quick search and couldn't find it. Can't remember the title properly I guess. I recall the OP was asked many questions via comments by some of the regulars here so hopefully they are reading, can remember and post the link via comment. So none of the advanced options work. You can still boot with Ubuntu Live right? Then you can chroot and run all the commands you want I surmise.
    • Adi Prasetyo
      Adi Prasetyo almost 3 years
      at least 4 possible cause defined here
  • ShiftyF97
    ShiftyF97 about 3 years
    It took me some figuring out, but I had to manually link init to upstart if that's still on your system. In a chrooted environment: ln -s /sbin/upstart /sbin/init and ln -s /lib/sysvinit/telinit /sbin/telinit