Failed to execute init error 2

after upgrading the kernel to 5.4.7, the system cannot boot. it output the following message:

#1 2020-01-06 02:46:51

zjykzk
Member
Registered: 2020-01-06
Posts: 4

kernel panic: failed to execute init (error -2)

after upgrading the kernel to 5.4.7, the system cannot boot. it output the following message:

i have no idea now, thx

Wechat-IMG410.jpg

Last edited by zjykzk (2020-01-06 04:00:05)

#2 2020-01-06 03:26:24

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,216
Website

Re: kernel panic: failed to execute init (error -2)

#3 2020-01-06 04:51:08

zjykzk
Member
Registered: 2020-01-06
Posts: 4

Re: kernel panic: failed to execute init (error -2)

i just executed the command `mkinitcpio -p linux`, the kernel is also panic.

anything else to do ? thx

Last edited by zjykzk (2020-01-06 04:55:59)

#4 2020-01-06 05:05:27

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,376
Website

Re: kernel panic: failed to execute init (error -2)

Did you try and follow the advice of the error message and explicitly pass your init location as a kernel parameter?

And just rebuilding the intramfs and hoping is not much of a strategy. Read your logs and see what happened during the upgrade. Try downgrading the kernel. Try helping yourself.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

#5 2020-01-06 06:14:54

zjykzk
Member
Registered: 2020-01-06
Posts: 4

Re: kernel panic: failed to execute init (error -2)

jasonwryan wrote:

Did you try and follow the advice of the error message and explicitly pass your init location as a kernel parameter?

And just rebuilding the intramfs and hoping is not much of a strategy. Read your logs and see what happened during the upgrade. Try downgrading the kernel. Try helping yourself.

i had downgraded the kernel and added the option parameter with ‘/sbin/init’. it was all failed.

it produced same error message. ;(

#6 2020-01-06 06:53:42

frostschutz
Member
Registered: 2013-11-15
Posts: 1,243

Re: kernel panic: failed to execute init (error -2)

it found /init (of the initramfs) but there is some problem with it (syntax error or anything) so something wrong with your initramfs

to figure out what’s going on you might have to take a look at it directly

#7 2020-01-14 03:42:47

zjykzk
Member
Registered: 2020-01-06
Posts: 4

Re: kernel panic: failed to execute init (error -2)

fixed, some so file is missing in the initramfs-linux.img file

the checking command is

mkdir /tmp/foo
cd /tmp/foo
zcat /boot/initramfs-linux.img  | cpio -i
chroot . /bin/sh

set these files’path in the field FILES in the file /etc/mkinitcpio.conf, then rebuild the initramfs.

it’s done

Last edited by zjykzk (2020-01-14 03:44:31)

#8 2020-02-11 10:18:55

robert.next
Member
Registered: 2016-08-24
Posts: 3

Re: kernel panic: failed to execute init (error -2)

frostschutz wrote:

it found /init (of the initramfs) but there is some problem with it (syntax error or anything) so something wrong with your initramfs

to figure out what’s going on you might have to take a look at it directly

I’m facing the same issue now that I’ve upgraded to 5.5.2… (and all the other kernel options are broken the same way) would you mind letting us know what was the missing file (.so lib?) on your initramfs?

Is this a systemic issue? (ie. broken mkinicpio scripts) or this is a weird occurrence due some rootfs differences?

#9 2020-02-11 10:43:13

robert.next
Member
Registered: 2016-08-24
Posts: 3

Re: kernel panic: failed to execute init (error -2)

Actually I’ve just found what my problem was.

Part of the linux drivers for my scanner overwrote the /usr/lib64 from being a symlink, hence when creating the initramfs some so files (thanks zjykzk) might have gone missing. So removing those offending files , recreating the symlink and regenerating the mkinitcpio my system booted again.

Содержание

  1. Kernel panic: Request init /bin/bash failed (error -2)
  2. Arch Linux
  3. #1 2020-01-06 02:46:51
  4. kernel panic: failed to execute init (error -2)
  5. #2 2020-01-06 03:26:24
  6. Re: kernel panic: failed to execute init (error -2)
  7. #3 2020-01-06 04:51:08
  8. Re: kernel panic: failed to execute init (error -2)
  9. #4 2020-01-06 05:05:27
  10. Re: kernel panic: failed to execute init (error -2)
  11. #5 2020-01-06 06:14:54
  12. Re: kernel panic: failed to execute init (error -2)
  13. #6 2020-01-06 06:53:42
  14. Re: kernel panic: failed to execute init (error -2)
  15. #7 2020-01-14 03:42:47
  16. Re: kernel panic: failed to execute init (error -2)
  17. #8 2020-02-11 10:18:55
  18. Re: kernel panic: failed to execute init (error -2)
  19. #9 2020-02-11 10:43:13
  20. Re: kernel panic: failed to execute init (error -2)
  21. Arch Linux
  22. #1 2015-01-16 12:25:58
  23. [SOLVED]Kernel panic init error
  24. #2 2015-01-16 12:39:55
  25. Re: [SOLVED]Kernel panic init error
  26. #3 2015-01-16 13:15:20
  27. Re: [SOLVED]Kernel panic init error
  28. #4 2015-01-16 15:11:47
  29. Re: [SOLVED]Kernel panic init error
  30. #5 2015-01-16 16:59:25
  31. Re: [SOLVED]Kernel panic init error
  32. #6 2015-01-17 17:36:24
  33. Re: [SOLVED]Kernel panic init error
  34. #7 2015-01-19 20:39:05
  35. Re: [SOLVED]Kernel panic init error
  36. «Failed to execute /init (error -2)» when building root #310
  37. Comments
  38. Footer

Kernel panic: Request init /bin/bash failed (error -2)

Люди, прошу, помогите Выдает сабж. В grub редактировалпункт меню, к строке дописывал init=/bin/bash теперь это. Что посоветуете? ОС Arch linux

Убери из строки то, что дописал. Выдели пункт меню, нажми клавишу «e», сотри из строки параметров ядра дописанное, затем нажми клавишу «b» или F10 для загрузки, в общем там написано.

Собственно написал я это туда не просто так. Без этого Kernel panic — not syncing: No working init found. Try passing init= option to kernel

Вестимо, если в archlinux нет ссылки /sbin/init -> /usr/lib/systemd/systemd, то у вас это работать не будет. Верните туда то, что было. Если это ваша первая установка Arch Linux, то следуйте согласно wiki странице установки, если это вообще ваш первый Linux, то начните с чего-нибудь проще, например Ubuntu или Fedora.

А так, могу быть нюансы, всё зависит от того где находится корневая файловая система.

Читайте соответствующую wiki страницу и не бездумно копируйте оттуда, а разбирайтесь что и почему сделано так.

очевидно, что что-то с диском/ФС, по крайней мере она не монтируется. или пуста, или повреждена. устройство правильное указываешь? и каким образом? порядковые номера разделов могут меняться, используй UUID или метки.

Вестимо, если в archlinux нет ссылки /sbin/init -> /usr/lib/systemd/systemd, то у вас это работать не будет.

но она есть, и баш тем более. так что проблема явно не в этом.

Значит, скорее всего, ТС ставит на lvm, raid или ещё какой-либо контейнер. В любом случае в шапке ничего не сказано о конфигурации.

Нет, можно конечно устроить гадание на кофейной гуще, но ТС лучше всё же всё описать нормально.

по крайней мере она не монтируется

Нет, тогда сообщение о панике было бы другое («VFS: Unable to mount root fs on unknown-block»).

Но, вообще говоря, если у ТС даже init=/bin/bash не срабатывает, то у него что-то очень не так с системой.

Может, он libc испортил? В любом случае, ТС вообще не написал, после чего и почему у него начались проблемы.

Да. Может быть, что-то случилось с симлинками /lib64 -> /usr/lib.

Источник

Arch Linux

You are not logged in.

#1 2020-01-06 02:46:51

kernel panic: failed to execute init (error -2)

after upgrading the kernel to 5.4.7, the system cannot boot. it output the following message:

i have no idea now, thx

Last edited by zjykzk (2020-01-06 04:00:05)

#2 2020-01-06 03:26:24

Re: kernel panic: failed to execute init (error -2)

Start by booting the install ISO, chroot’ing into your install and re-running mkinitcpio
https://wiki.archlinux.org/index.php/Ch … rch-chroot

#3 2020-01-06 04:51:08

Re: kernel panic: failed to execute init (error -2)

Start by booting the install ISO, chroot’ing into your install and re-running mkinitcpio
https://wiki.archlinux.org/index.php/Ch … rch-chroot

i just executed the command `mkinitcpio -p linux`, the kernel is also panic.

anything else to do ? thx

Last edited by zjykzk (2020-01-06 04:55:59)

#4 2020-01-06 05:05:27

Re: kernel panic: failed to execute init (error -2)

Did you try and follow the advice of the error message and explicitly pass your init location as a kernel parameter?

And just rebuilding the intramfs and hoping is not much of a strategy. Read your logs and see what happened during the upgrade. Try downgrading the kernel. Try helping yourself.

Registered Linux User #482438

#5 2020-01-06 06:14:54

Re: kernel panic: failed to execute init (error -2)

Did you try and follow the advice of the error message and explicitly pass your init location as a kernel parameter?

And just rebuilding the intramfs and hoping is not much of a strategy. Read your logs and see what happened during the upgrade. Try downgrading the kernel. Try helping yourself.

i had downgraded the kernel and added the option parameter with ‘/sbin/init’. it was all failed.

it produced same error message. ;(

#6 2020-01-06 06:53:42

Re: kernel panic: failed to execute init (error -2)

it found /init (of the initramfs) but there is some problem with it (syntax error or anything) so something wrong with your initramfs

to figure out what’s going on you might have to take a look at it directly

#7 2020-01-14 03:42:47

Re: kernel panic: failed to execute init (error -2)

fixed, some so file is missing in the initramfs-linux.img file

the checking command is

set these files’path in the field FILES in the file /etc/mkinitcpio.conf, then rebuild the initramfs.

Last edited by zjykzk (2020-01-14 03:44:31)

#8 2020-02-11 10:18:55

Re: kernel panic: failed to execute init (error -2)

it found /init (of the initramfs) but there is some problem with it (syntax error or anything) so something wrong with your initramfs

to figure out what’s going on you might have to take a look at it directly

I’m facing the same issue now that I’ve upgraded to 5.5.2. (and all the other kernel options are broken the same way) would you mind letting us know what was the missing file (.so lib?) on your initramfs?

Is this a systemic issue? (ie. broken mkinicpio scripts) or this is a weird occurrence due some rootfs differences?

#9 2020-02-11 10:43:13

Re: kernel panic: failed to execute init (error -2)

Actually I’ve just found what my problem was.

Part of the linux drivers for my scanner overwrote the /usr/lib64 from being a symlink, hence when creating the initramfs some so files (thanks zjykzk) might have gone missing. So removing those offending files , recreating the symlink and regenerating the mkinitcpio my system booted again.

Источник

Arch Linux

You are not logged in.

#1 2015-01-16 12:25:58

[SOLVED]Kernel panic init error

So this I f*** up really bad. I was in a horry and did not read the output from pacman. Pacman then updated ONLY linux 3.18.2-2. Now my system can not boot because of a init error as far as I could understand from the kernel panic page. I followed some archwiki tutorials on downgrading with arch-chroot, I reconfigured grub because it booted the wrong partition and I redid mkinitcpio. but no matter what I tried nothing worked.
The first line of the kernel panic error is: Failed to execute /init (error -2)
second line: Kernel panic — not syncing: no working init found. try passing init= option to kernel. See linux documentation/init.txt for guidance.

Any help is super appreciated
— Cheers Sebbe

Last edited by sebkirller (2015-01-21 15:55:57)

#2 2015-01-16 12:39:55

Re: [SOLVED]Kernel panic init error

So try passing an init option. I’d start with init=/usr/lib/systemd/systemd. If this works, check the output of `ls -l /usr/bin/init`, if it fails you can use init=/usr/bin/bash. Then you can check is systemd is actually there and if needed mount partitions and run pacman.

Also, if you can describe what actually happened better we could provide better suggestions. Upgrading the kernel only would not cause such problems. Downgrading the kernel also wouldn’t.

«UNIX is simple and coherent. » — Dennis Ritchie, «GNU’s Not UNIX» — Richard Stallman

#3 2015-01-16 13:15:20

Re: [SOLVED]Kernel panic init error

So try passing an init option. I’d start with init=/usr/lib/systemd/systemd. If this works, check the output of `ls -l /usr/bin/init`, if it fails you can use init=/usr/bin/bash. Then you can check is systemd is actually there and if needed mount partitions and run pacman.

Also, if you can describe what actually happened better we could provide better suggestions. Upgrading the kernel only would not cause such problems. Downgrading the kernel also wouldn’t.

I am sorry my description was inaccurate. What I ment by it was that I updated my system with pacman -Syu and did not read what updated and just went to do something els. When I came back I saw that the kernel had been upgraded from 3.17 to 3.18 without the 3.18 linux-headers packages. After I rebooted I was presented with the kernel panic. Then I downgraded again but the problem persisted. I hope this describes my mistake better.

Both init commands gives me this output: «failed to execute /usr/lib/systemd/systemd (error -2). attempting defaults. » and «failed to execute /usr/bin/bash (error -2). Attempting defaults. «

#4 2015-01-16 15:11:47

Re: [SOLVED]Kernel panic init error

I suspect your bootloader is mounting the wrong root partition. Can you post your bootloader config?

«UNIX is simple and coherent. » — Dennis Ritchie, «GNU’s Not UNIX» — Richard Stallman

#5 2015-01-16 16:59:25

Re: [SOLVED]Kernel panic init error

Also, tell us about your disks and partitions. Are you using a single disk?, multiple disks? RAID? What are your file systems? Is your boot partition a separate partition?
Is there any chance the boot partition was not mounted when you did your update?
What do you mean by the kernel being updated without having updated the headers?

Anyway, don’t panic. You might want to read the wiki article on chroot. I think we may use that method to get you back to a working system.

Nothing is too wonderful to be true, if it be consistent with the laws of nature — Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. — Alan Turing

How to Ask Questions the Smart Way

#6 2015-01-17 17:36:24

Re: [SOLVED]Kernel panic init error

Here is a link to pastebin wit my grub.cfg file: http://pastebin.com/gzqraKPr
I have one HDD and one SSD. The SSD is windows dedicated only. The HDD is split with half for windows and the other half for linux. The bit for linux is partitioned with separate root and home partitions. The root file system is xfs and the home partition btrfs. As far as I could understand the packages linux 3.18.2-2 requires linux-headers 3.18.2-2, which did not get downloaded because it was not uploaded until maybe 1 minute later. As for the chroot I am totally in for that as I already tried fixing grub from the arch boot cd with arch-chroot after I saw that my partitions were mounted incorrectly.

#7 2015-01-19 20:39:05

Re: [SOLVED]Kernel panic init error

So this I f*** up really bad. I was in a horry and did not read the output from pacman. Pacman then updated ONLY linux 3.18.2-2. Now my system can not boot because of a init error as far as I could understand from the kernel panic page. I followed some archwiki tutorials on downgrading with arch-chroot, I reconfigured grub because it booted the wrong partition and I redid mkinitcpio. but no matter what I tried nothing worked.
The first line of the kernel panic error is: Failed to execute /init (error -2)
second line: Kernel panic — not syncing: no working init found. try passing init= option to kernel. See linux documentation/init.txt for guidance.

Any help is super appreciated
— Cheers Sebbe

I had the exactly the same strange problem.
The problem is that /usr/lib64/ should be a symbolic link to the /usr/lib/, but it was a folder containing something (for me kde4/kcm_adobe_flash_player.so), also move the folder lib64 somewhere, reinstall package «filesystem» and redo makeinitcpio.
After that, /usr/lib64 become a link to /usr/lib and the generated /boot/initramfs-linux.img contains all libraries needed to boot, systemd as well!

Also, boot the system with arch-live usb stick and at prompt :

Remove usb stick and at GRUB enjoy the resumed Arch
——

Источник

«Failed to execute /init (error -2)» when building root #310

Making root on the native host architecture (x86_64) and running with the qemu script on the host directory throws error -2.
The output:

For the build environment I’m using ubuntu 20.04 with qemu 4.2.1.
The toybox release was just cloned from master and I’m using the version 5.16.0-rc6 of the kernel.
I’ve also tried adding init=/init as KARGS, it doesn’t seem to make a difference.

The text was updated successfully, but these errors were encountered:

I’m assuming you used mkroot here? With a LINUX= kernel?

According to /usr/include/asm-generic/errno-base.h error 2 is ENOENT «No such file or directory». It’s saying your filesystem hasn’t got an /init in it, although what the kernel might be complaining about is the #!/bin/sh it points to is what’s missing. (Does your toybox .config not have CONFIG_SH enabled in it? I.E. the warning in last paragraph of https://landley.net/toybox/faq.html#mkroot ?) The third option for the kernel loader giving that error would be the /bin/sh the #! line tries to load is dynamically linked and it can’t find the ld-linux.so it points to, but mkroot only produces a static toybox.

Saying init=/init won’t help for two reasons: 1) that’s what it already tried, 2) that’s the init for the fallback root mount if there’s no initramfs, the initramfs init is «rdinit=/init». (Ask the kernel guys why they’re different, not me. )

Most likely «rm .config && LINUX=$LOCATION scripts/mkroot.sh» would fix it. You built an existing defconfig and didn’t let mkroot create a .config with the extra two commands from pending (sh and route). Once I get those two finished/promoted that should be less of a problem because then they’d be in defconfig already.

Hi Rob, it seems, that, somehow one of the build-essential components got corrupted and an invalid binary was built.
I just needed to reinstall the package.
Thank you for your assistance.

© 2023 GitHub, Inc.

You can’t perform that action at this time.

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.

Источник

View previous topic :: View next topic  
Author Message
willem-jan
n00b
n00b

Joined: 12 Sep 2021
Posts: 7

PostPosted: Fri Sep 17, 2021 8:59 am    Post subject: Kernel panic init error -2 Reply with quote

Hi All,

I’m trying to migrate to ZFS on root using EFI stub boot instead of GRUB.

OpenRC 0.43.5, Kernel: 5.14.4, Dracut 053

I have the EFI stub boot working (aka boot without grub), but once I add an initramfs (to add ZFS later) I get a kernel panic when booting saying:

Code:
failed to execute /init (error-2)

I checked and there is definitely an /init file in the initramfs (using lsinitramfs)

But I cannot find the error code -2 anywhere.

What can be wrong here?

For completeness this is the dracut command I used:

Code:
dracut —force -H —kver 5.14.4-gentoo

And this the efibootmgr command:

Code:
efibootmgr -c -d /dev/nvme0n1 -p 5 -L «Gentoo» -l ‘EFIgentoobzImage.efi’ -u ‘root=PARTUUID=233200e8-4ba8-2943-869e-9311abe1d556 rw initrd=EFIgentooinitramfs.img net.ifnames=0 biosdevnam=0 ipv6.disable=1 loglevel=8’ -v

Note1: i copied the generated initramfs to /boot/EFI/gentoo/initramfs, so I am sure the latest dracut generated initram is used.

Note2: the system boots perfectly fine without the initrd kernel parameter / initramfs. But as said, I am migrating to ZFS and need the ZFS kernel module during boot, hence I need an initramfs (unfortunately).

Back to top

View user's profile Send private message

alamahant
Advocate
Advocate

Joined: 23 Mar 2019
Posts: 3304

PostPosted: Fri Sep 17, 2021 9:29 am    Post subject: Reply with quote

Quote:

d /dev/nvme0n1 -p 5 -L «Gentoo»



This refers to the efi partition.

Is your efi partition

/dev/nvme0n1p5

?

I strongly advice you to use grub though.
_________________
:)

Back to top

View user's profile Send private message

willem-jan
n00b
n00b

Joined: 12 Sep 2021
Posts: 7

PostPosted: Fri Sep 17, 2021 10:03 am    Post subject: Reply with quote

Yes that is indeed the efi partition that contains the kernel and the initramfs.

The uuid is the root partition. and without the initramfs the system boots fine.

Part of this migration is to actually get rid of grub, hence the EFI stub approach.

Any clue ehat the error code -2 stands for?

Back to top

View user's profile Send private message

mike155
Advocate
Advocate

Joined: 17 Sep 2010
Posts: 4312
Location: Frankfurt, Germany

PostPosted: Fri Sep 17, 2021 10:34 am    Post subject: Reply with quote

I use efibootmgr, but I don’t use initramfs or dracut, so I probably won’t be able to help you… Anyway…

  1. In your post above, the ‘initrd’ argument starts with ‘EFIgentoo’. In our handbook, it starts with «».

    Code:
    efibootmgr -c -d /dev/sda -p 2 -L «Gentoo» -l «efibootbootx64.efi» initrd=’initramfs-genkernel-amd64-4.9.16-gentoo’



    I don’t say that your command is wrong. But if differs from the example in our handbook.

  2. There’s a warning in the handbook:

    Quote:
    Important:

    It is recommended to use genkernel for both, building kernel and initramfs. If you decide to use genkernel only for generating initramfs it is crucial to pass —kernel-config=/path/to/kernel.config to genkernel or generated initramfs may not work with your manually built kernel.



    It probably doesn’t apply in your case, since you use dracut — but it could be something similar.

Back to top

View user's profile Send private message

alamahant
Advocate
Advocate

Joined: 23 Mar 2019
Posts: 3304

PostPosted: Fri Sep 17, 2021 4:16 pm    Post subject: Reply with quote

You mention you are in the process of migration to zfs.

What does that mean?

Have you greated the zfs rpool?

If yes you need to pass this kernel parameter

Code:
 

root=ZFS=rpool/ROOT/gentoo



or similar

How can you do that with efistub?

Can you?

you have

Code:

root=UUID=xxxxxxxxxxxxx


_________________
:)

Back to top

View user's profile Send private message

Hu
Moderator
Moderator

Joined: 06 Mar 2007
Posts: 19773

PostPosted: Sat Sep 18, 2021 1:02 am    Post subject: Reply with quote

Are you sure about that error message? I can’t find it in the kernel source via grep on some likely substrings.

Errno 2 is ENOENT, so it is probably telling you that it cannot find the init file.

Although it would increase kernel size, you could also choose to build the initramfs into the kernel, to avoid dealing with loading it.

Back to top

View user's profile Send private message

willem-jan
n00b
n00b

Joined: 12 Sep 2021
Posts: 7

PostPosted: Mon Sep 20, 2021 7:04 am    Post subject: Reply with quote

Thank you all for your input.

I finally have managed to load the initramfs / init properly. But not with dracut. I now used genkernel (with the —zfs flag), and while I do not know what both exactly do in the background, Genkernel does work.

Also booting my non-ZFS system with the initramfs works. It technically does not need an initramfs since none of the modules are needed to boot my system. I only tried this to make sure I can boot my system with EFI stub and an initramfs prior to the migration to ZFS.

Unfortunately booting into the ZFS root does not seem to work. The kernel just hangs/waits (after the initramfs was loaded and the kernel is active) without displaying an error message.

The partition layout is as follows:

— p1: boot, FAT32, with the kernel and initramfs

— p2: regular swap

— p3: encrypted rpool/ROOT with a root and home dataset

The initram asks me for the password for the pool which indicates that the pool/dataset is found correctly. And yes, the ZFS root is correctly passed to the kernel.

I will do some more digging/testing but am at the point to abandon this route since my boot time is already significantly increased (e.g. one of the additional delays when ‘starting udev’ is already 5 sec extra) plus I am slightly worried of the ‘stability/reliability’ of this approach.

Back to top

View user's profile Send private message

willem-jan
n00b
n00b

Joined: 12 Sep 2021
Posts: 7

PostPosted: Mon Sep 20, 2021 7:18 am    Post subject: Reply with quote

Hu wrote:
Are you sure about that error message? I can’t find it in the kernel source via grep on some likely substrings.

Errno 2 is ENOENT, so it is probably telling you that it cannot find the init file.

Although it would increase kernel size, you could also choose to build the initramfs into the kernel, to avoid dealing with loading it.

Ah yes I am.

Also did a quick grep and I think I have found the line: 1516 in init/main.c (kernel 5.14.4)

Code:
grep -rnwi «./» -e «failed to execute»

./init/main.c:1516:             pr_err(«Failed to execute %s (error %d)n»,

Code:

Code:

   if (ramdisk_execute_command) {

      ret = run_init_process(ramdisk_execute_command);

      if (!ret)

         return 0;

      pr_err(«Failed to execute %s (error %d)n»,

             ramdisk_execute_command, ret);

   }


Quote:
Although it would increase kernel size, you could also choose to build the initramfs into the kernel, to avoid dealing with loading it.

Ah that indeed sounds as a good option. It works now, but still… It also would give the possibility to sign the kernel and use secure boot. Since one of the caveats of ZFS (as far as I know) is that we cannot encrypt the boot partition. My use case is protect it against malware, virus, trojan, rootkits etc. There is no sensitive data/passwords etc in the initram or kernel. Hence, secureboot might actually make more sense I guess. Any hints/sources you could recommend on how to compile the initramfs into the kernel?

The ultimate solution would be to have ZFS available in the kernel and not as a kernel module. But apparently there seems some license hurdles with Sun.

Back to top

View user's profile Send private message

mike155
Advocate
Advocate

Joined: 17 Sep 2010
Posts: 4312
Location: Frankfurt, Germany

PostPosted: Mon Sep 20, 2021 12:40 pm    Post subject: Reply with quote

willem-jan wrote:
The ultimate solution would be to have ZFS available in the kernel and not as a kernel module. But apparently there seems some license hurdles with Sun.



It’s not only the license… See what Linus Torvalds wrote: https://www.phoronix.com/scan.php?page=news_item&px=Linus-Says-No-To-ZFS-Linux

Quote:
Note that «we don’t break users» is literally about user-space applications, and about the kernel I maintain.

If somebody adds a kernel module like ZFS, they are on their own. I can’t maintain it, and I can not be bound by other peoples kernel changes.

And honestly, there is no way I can merge any of the ZFS efforts until I get an official letter from Oracle that is signed by their main legal counsel or preferably by Larry Ellison himself that says that yes, it’s ok to do so and treat the end result as GPL’d.

Other people think it can be ok to merge ZFS code into the kernel and that the module interface makes it ok, and that’s their decision. But considering Oracle’s litigious nature, and the questions over licensing, there’s no way I can feel safe in ever doing so.

And I’m not at all interested in some «ZFS shim layer» thing either that some people seem to think would isolate the two projects. That adds no value to our side, and given Oracle’s interface copyright suits (see Java), I don’t think it’s any real licensing win either.

Don’t use ZFS. It’s that simple. It was always more of a buzzword than anything else, I feel, and the licensing issues just make it a non-starter for me.

The benchmarks I’ve seen do not make ZFS look all that great. And as far as I can tell, it has no real maintenance behind it either any more, so from a long-term stability standpoint, why would you ever want to use it in the first place?

Back to top

View user's profile Send private message

Hu
Moderator
Moderator

Joined: 06 Mar 2007
Posts: 19773

PostPosted: Mon Sep 20, 2021 6:12 pm    Post subject: Reply with quote

willem-jan wrote:
Hu wrote:
Are you sure about that error message?

Ah yes I am.

Also did a quick grep and I think I have found the line: 1516 in init/main.c (kernel 5.14.4)

Code:
grep -rnwi «./» -e «failed to execute»

./init/main.c:1516:             pr_err(«Failed to execute %s (error %d)n»,

I see. In your opening post, you didn’t capitalize failed, and I didn’t do a case-insensitive search. That’s why I couldn’t find it.

willem-jan wrote:
I get a kernel panic when booting saying:

Code:
failed to execute /init (error-2)

willem-jan wrote:
Any hints/sources you could recommend on how to compile the initramfs into the kernel?

Start with the kernel source documentation file Documentation/filesystems/ramfs-rootfs-initramfs.rst, under the section Populating initramfs:. If you need more help, post back and I can try to elaborate.

Back to top

View user's profile Send private message

Display posts from previous:   

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Attaching a bit more of the boot log.

HugeTLB registered 1.00 GiB page size, pre-allocated 0 pages
HugeTLB registered 32.0 MiB page size, pre-allocated 0 pages
HugeTLB registered 2.00 MiB page size, pre-allocated 0 pages
HugeTLB registered 64.0 KiB page size, pre-allocated 0 pages
iommu: Default domain type: Translated 
iommu: DMA domain TLB invalidation policy: strict mode 
SCSI subsystem initialized
EDAC MC: Ver: 3.0.0
clocksource: Switched to clocksource arch_sys_counter
workingset: timestamp_bits=62 max_order=19 bucket_order=0
Block layer SCSI generic (bsg) driver version 0.4 loaded (major 252)
io scheduler mq-deadline registered
cacheinfo: Unable to detect cache hierarchy for CPU 0
brd: module loaded
VFS: Mounted root (tmpfs filesystem) on device 0:15.
Freeing unused kernel memory: 704K
Run /init as init process
  with arguments:
    /init
  with environment:
    HOME=/
    TERM=linux
Kernel panic - not syncing: Requested init /init failed (error -2).
CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.15.0-rc7-00001-g8d7daa446b53-dirty #33
Call trace:
 dump_backtrace+0x0/0x1d0
 show_stack+0x14/0x20
 dump_stack_lvl+0x64/0x7c
 dump_stack+0x14/0x2c
 panic+0x158/0x304
 kernel_init+0xf0/0x150
 ret_from_fork+0x10/0x20
Kernel Offset: disabled
CPU features: 0x00001001,20000802
Memory Limit: none
---[ end Kernel panic - not syncing: Requested init /init failed (error -2). ]---

I am building an embedded linux OS for an experimental FPGA platform. I used upstream U-boot(boot-loader), linux(kernel) and buildroot(just for filesystem).

I followed some examples and enabled the required initrd/initramfs support in my linux config.

CONFIG_BLK_DEV_INITRD=y
CONFIG_BLK_DEV_RAM=y
CONFIG_BLK_DEV_RAM_COUNT=1
CONFIG_BLK_DEV_RAM_SIZE=10240

I used the bootm command in u-boot to load a FIT image that comprises of the linux kernel, dtb and the rootfs.cpio(compiled from buildroot). Relevant info here: FIT test

These are the bootargs passed to the kernel:

console=ttyS0,9600 earlyprintk maxcpus=1 earlycon root=/dev/ram init=/init rw rootfstype=tmpfs debug

Note:

Couple of other things I tried , but resulted in the same error.

  • Passing the kernel,dtb and fs image separately.
  • Tried passing init=/bin/sh , /sbin/init , /etc/init , /bin/init
  • Tried a basic initramfs with just an init script , simple directory structure and a separately compiled busybox placed in /bin/busybox with symbolic links.
  • Rather than passing an external FS, I passed the path to the initramfs source and compiled it into the kernel with CONFIG_INITRAMFS_SOURCE.

I would appreciate any feedback/pointers on what I could be missing, been stuck on this for while now.

I am brand new to Linux so I have no clue what any of the error message means in the slightest. The message I am getting is:

[0.424931] Initramfs unpacking failed: no cpio magic
[0.984686] Failed to execute /init (error -2)
[0.984730] Kernel panic - not syncing: No working init found. Try passing init= option to kernel. See Linux Documentation/admin-guide/init.rst for guidance.
[0.984789] CPU: 2 PID: 1 Comm: swapper/0 Not tainted 5.4.0-26-generic #30-Ubuntu
[0.984789] Hardware name: MotherBoard By ZOTAC MotherBoard Z77ITX-A-E/Z77ITX-A-E, BIOS A229P007 06/05/2012
[0.984816] Call Trace:
[0.984840]  dump_stack+0x6d/0x9a
[0.984862]  ? rest_init+0x30/0xb0
[0.984883]  panic+0x101/0x2e3
[0.984904]  ? do_execve+0x25/0x30
[0.984924]  ? rest_init+0xb0/0xb0
[0.984965]  kernel_init+0xfb/0x100
[0.984965]  ret_from_fork+0x35/0x40
[0.985039] Kernel Offset: 0x17600000 from 0xffffffff81000000 (relocation range: 0xffffffff80000000-0xffffffffbfffffff)
[0.985069] ---[ end Kernel panic - not syncing: No working init found. Try passing init= option to kernel. See Linux Documentation/admin-guide/init.rst for guidance. ]---

I looked at https://www.kernel.org/doc/Documentation/admin-guide/init.rst and it really didn’t help me at all because of how new I am to Linux. I am installing with a USB drive and I have tried every USB port on my computer (USB 3 and 2).

asked May 13, 2020 at 10:12

RabidWabbit's user avatar

Just in case you didn’t resolve it and/or anyone else is wondering — I was having the same issue with Server 20.04 when I was running 512MB of RAM in an old Lenovo desktop (oldest AMD64 machine I’ve ever seen — had to disable APIC & LAPIC). Taking out the 512MB and dropping in 2GB of RAM solved the issue and doesn’t crash the installer with a kernel panic.

Classic case of a not-so-helpful (although probably accurate) error message. Hope this helps!

answered Jun 27, 2020 at 1:43

theMadSpektre's user avatar

1

My solution is that you remove one of your RAM. I had 3gb of ram and took out 1gb…boom everything worked perfectly.

answered Sep 10, 2021 at 1:34

The Neek's user avatar

Понравилась статья? Поделить с друзьями:
  • Failed to initialize battleye service driver load error 577 fortnite
  • Failed to initialize battleye service driver load error 577 dayz
  • Failed to initialize battleye service driver load error 5 что делать
  • Failed to execute default web browser input output error ubuntu
  • Failed to initialize battleye service driver load error 1450 как исправить