Error invalid magic number error please load the kernel first

Arch Linux You are not logged in. #1 2021-06-02 18:43:41 [SOLVED] Invalid magic number on boot after a system upgrade including linux and linux-headers my system stopped working. I’ve already tried to reinstall linux and linux-headers, tried `mkinitcpio -P`, to rebuild my grub config and to reinstall grub. Everything without error messages. Some weeks […]

Содержание

  1. Arch Linux
  2. #1 2021-06-02 18:43:41
  3. [SOLVED] Invalid magic number on boot
  4. #2 2021-06-02 20:06:13
  5. Re: [SOLVED] Invalid magic number on boot
  6. #3 2021-06-03 09:26:48
  7. Re: [SOLVED] Invalid magic number on boot
  8. #4 2021-06-03 13:42:56
  9. Re: [SOLVED] Invalid magic number on boot
  10. #5 2021-06-03 17:30:34
  11. Re: [SOLVED] Invalid magic number on boot
  12. #6 2021-06-03 18:37:26
  13. Re: [SOLVED] Invalid magic number on boot
  14. #7 2021-06-04 05:19:17
  15. Re: [SOLVED] Invalid magic number on boot
  16. #8 2021-06-04 14:48:33
  17. Re: [SOLVED] Invalid magic number on boot
  18. #9 2021-06-04 14:55:54
  19. Re: [SOLVED] Invalid magic number on boot
  20. #10 2021-06-04 17:48:05
  21. Re: [SOLVED] Invalid magic number on boot
  22. #11 2021-06-04 20:40:21
  23. Re: [SOLVED] Invalid magic number on boot
  24. #12 2021-06-05 20:23:24
  25. Re: [SOLVED] Invalid magic number on boot
  26. #13 2021-06-05 22:33:50
  27. Re: [SOLVED] Invalid magic number on boot
  28. #14 2021-06-06 12:13:21
  29. Re: [SOLVED] Invalid magic number on boot
  30. #15 2021-06-06 12:34:36
  31. Re: [SOLVED] Invalid magic number on boot
  32. #16 2021-06-06 21:57:33
  33. Re: [SOLVED] Invalid magic number on boot
  34. #17 2021-06-06 22:03:11
  35. Re: [SOLVED] Invalid magic number on boot
  36. #18 2021-06-07 19:45:18
  37. Re: [SOLVED] Invalid magic number on boot
  38. #19 2021-06-07 19:47:19
  39. Re: [SOLVED] Invalid magic number on boot
  40. #20 2021-06-07 19:49:57
  41. Re: [SOLVED] Invalid magic number on boot
  42. Arch Linux
  43. #1 2019-05-02 09:21:53
  44. Grub: loading Linux . invalid magic number
  45. #2 2019-05-03 18:23:16
  46. Re: Grub: loading Linux . invalid magic number
  47. #3 2019-05-04 03:38:36
  48. Re: Grub: loading Linux . invalid magic number
  49. #4 2019-05-04 05:55:01
  50. Re: Grub: loading Linux . invalid magic number
  51. #5 2021-04-14 21:27:40
  52. Re: Grub: loading Linux . invalid magic number
  53. “Invalid magic number, you need to load the kernel first” on an existent and previously working Ubuntu installation (not live USB issue)
  54. Error invalid magic number error please load the kernel first

Arch Linux

You are not logged in.

#1 2021-06-02 18:43:41

[SOLVED] Invalid magic number on boot

after a system upgrade including linux and linux-headers my system stopped working.

I’ve already tried to reinstall linux and linux-headers, tried `mkinitcpio -P`, to rebuild my grub config and to reinstall grub. Everything without error messages.

Some weeks ago I had the same issue, but here everything was fine again after I reinstalled linux and linux-headers.

I’ve used the grub command line. I’m not sure if I used it correctly or if it is a hint:

It is a btrfs filesystem and it works.

I hope someone has an idea.

EDIT: My solution was to upgrade grub to 2.06 RC1. Details are in the thread.

Last edited by bysom (2021-06-07 19:52:23)

#2 2021-06-02 20:06:13

Re: [SOLVED] Invalid magic number on boot

Suggests /boot/vmlinuz-linux is corrupt.
Is the boot partition full (no space left)?
What dow «file /boot/vmlinuz-linux» say and what is the md5 of the file?
If thereÄs enough space, can you isntall and boot the lts kernel?

#3 2021-06-03 09:26:48

Re: [SOLVED] Invalid magic number on boot

Hi, thanks for your answer.

There is enough space, since i have no extra /boot partition. I’ve encrypted my entire system including /boot. Therefore I have an extra efi partition with grub, that decrypts my btrfs and then boots the kernel. Mostly like it is described in the Wiki

I’ve also installed the lts kernel. Both aren’t working.

Here the md5 sums

I’ve also tried a `btrfs check` without errors.

Thanks for your help!

#4 2021-06-03 13:42:56

Re: [SOLVED] Invalid magic number on boot

It would seem that either the decryption fails or maybe is just too slow
Can you «ls» the partition after «insmod btrfs»?

#5 2021-06-03 17:30:34

Re: [SOLVED] Invalid magic number on boot

Okay, I have some results.

After the cryptomount command:

I have tried a `ls /@/boot` after the `echo ‘Loading Linux linux-lts . ‘` and it lists the files in my /boot directory. After that I have tried a `file —is-x86-linux /@/boot/vmlinuz-linux` and got no result (and also no error). Is there something else I should try?

#6 2021-06-03 18:37:26

Re: [SOLVED] Invalid magic number on boot

I’ve tried a `sleep 30` before loading the kernel, which hasn’t changed anything.

After that I have chrooted my arch again and reinstalled linux, linux-lts, and the headers and now something changed. If I try to boot the LTS kernel it passes the ‘Loading Linux linux-lts . ‘ section and then I get a kernel panic in the following ‘Loading initial ramdisk . ‘ section. The error message before the kernel panic is

The normal linux kernel still fails at the first section ‘Loading Linux linux . ‘

Last edited by bysom (2021-06-03 18:38:35)

#7 2021-06-04 05:19:17

Re: [SOLVED] Invalid magic number on boot

Re-cap:
This is a regression, the config used to work befoer?
The files end on the encrypted partition intact, ie. they’re perfectly accessible offline?
The error has a degree of randomness, eg. vmlinuz-linux-lts (now) loads, but the other files have bad header bytes?

What else was included in the breaking udpate? /var/log/pacman.log?

returns a boolean.

#8 2021-06-04 14:48:33

Re: [SOLVED] Invalid magic number on boot

Yes, your recap sounds correct. The config worked before, I can access my files and the error seems to have some kind of randomness.

Here is the pacman log from the last update before the crash: http://ix.io/3oJJ

#9 2021-06-04 14:55:54

Re: [SOLVED] Invalid magic number on boot

cryptsetup sticks out…
Downgrade that, re-install the kernels and see what happens.

BE PREPARED TO LOSE ACCESS TO THE … oh, wait: you can’t boot and will have to chroot anyway

#10 2021-06-04 17:48:05

Re: [SOLVED] Invalid magic number on boot

I’ve downgraded to cryptsetup 2.3.4 and the error is still the same.

Is this setup with an encrypted boot partition that rare, that it could be a bug in grub or somewhere else? The idea to reinstall my arch with a classical encryption setup gets more and more attractive for me. Unless you have still some good ideas. I’m still very happy with your help

#11 2021-06-04 20:40:21

Re: [SOLVED] Invalid magic number on boot

Did the kernel re-installation change anything about the randomness aspect of the kernel/initramfs «corruption»?
And otherwise, how the status is at the grub shell (ie. testing the file types there) in case this is -somehow- a time/race condition…

#12 2021-06-05 20:23:24

Re: [SOLVED] Invalid magic number on boot

Hi, I have some news.

To your questions: The kernel reinstallation made that the error occours at the ‘Loading Linux linux-lts . ‘ again for the lts kernel which made it to the initramfs loading. As far as I remember this state changed with the reinstallation of the kernel.

I have tried your ‘if file xy then’ example and it obviously returned a false value. I’ve got a ‘kernel is bad’ because I’ve added an else case. It should have been true, right?

After that I saw, that I can use md5sum with grub and checked the md5 sum of the kernel and got a different number than I get from my live system.

From a live linux

I have asked someone else with an arch linux for a hash sum as a reference and got the 8ed348f0125772a6ef0756b818199fc6 for the actual kernel.

(I’ve updated the kernel yesterday)

Then I’ve used cat with grub to view some text files which all looked normal to me. After that I’ve used md5sum on one of these files and got the same hash numbers with grub and with my live stick.

Last edited by bysom (2021-06-05 21:33:05)

#13 2021-06-05 22:33:50

Re: [SOLVED] Invalid magic number on boot

If you change the mkinitcpio compression (in doubt to «cat»), do the md5sums for those turn consistent?
https://wiki.archlinux.org/title/Mkinitcpio#COMPRESSION

#14 2021-06-06 12:13:21

Re: [SOLVED] Invalid magic number on boot

Hi, I have changed that compression to cat and reinstalled the kernels.

The md5 sums from my live linux (ubuntu 20.04, Kernel 5.8.0, cryptsetup 2.2.2, btrfs-progs v5.4.1). Those from my chrooted arch are the same.

The md5sums from grub

That ones from the initramfs are correct. And that one from the linux is different now.

Last edited by bysom (2021-06-06 12:18:59)

#15 2021-06-06 12:34:36

Re: [SOLVED] Invalid magic number on boot

Smells as if the grub btrfs module doesn’t like compressed files (at least not zstd)?
If you check a random zstd compressed file from the grub shell, does its md5 deviate?
Or do you maybe use https://wiki.archlinux.org/title/Btrfs#Compression ?

#16 2021-06-06 21:57:33

Re: [SOLVED] Invalid magic number on boot

Yes, I’m using btrfs compression with zstd.

I’ve checked the results with a normal file

Linux point of view

grub point of view

Both files are different here. There could be some randomness, I think.

Last edited by bysom (2021-06-06 22:27:06)

#17 2021-06-06 22:03:11

Re: [SOLVED] Invalid magic number on boot

What if you «chattr -c /boot» and update the kernel?

Edit: also notice the warning and to have grub-install post 2019-07-05

Last edited by seth (2021-06-06 22:06:14)

#18 2021-06-07 19:45:18

Re: [SOLVED] Invalid magic number on boot

Hi, I have tried that chattr -c /boot thing and it hasn’t changed anything. After that I have checked the md5sums with grub again and got for one file an error message containing ‘error: zstd data corrupted.’. After that I have repeated that btrfs check just in case without errors.

Since the error only occurred with grub and there is already a rc1 for the next grub release, which seems to be really rare, I thought that I could try grub-git from the aur (what if it is a grub bug and no one fixes it before the release, was my first thought). So I installed grub-git, then executed grub-install, restored the grub config and got a booting system. I’m a bit happy now. And I am very thankful for your help and your patience, seth! A very positive experience. Let me know if I can do something in reward.

#19 2021-06-07 19:47:19

Re: [SOLVED] Invalid magic number on boot

Let me know if I can do something in reward.

Please always remember to mark resolved threads by editing your initial posts subject — so others will know that there’s no task left, but maybe a solution to find.
Thanks.

#20 2021-06-07 19:49:57

Re: [SOLVED] Invalid magic number on boot

Of course

Last edited by bysom (2021-06-07 19:54:38)

Источник

Arch Linux

You are not logged in.

#1 2019-05-02 09:21:53

Grub: loading Linux . invalid magic number

I have LVM (vg-root, vg-data, vg-swap) on LUKS on RAID5 (mdadm).
After the grub boot menu, I’m getting:

I copied /boot to a USB drive and edited the menu entry from:

which sets me to use the copy on the USB drive. It works.

I figured that grub was finding the filesystem OK since it was getting grub.cfg for the menu, but I still went and tried «insmod»ing several modules including many gcry-* modules. Nothing worked.
fsck shows a clean root filesystem.
Has anyone a suggestion?
TIA

My grub config file is:
/boot/grub/grub.cfg

#2 2019-05-03 18:23:16

Re: Grub: loading Linux . invalid magic number

Look in this thread: Update problem: invalid magic number. Something may not have updated correctly. Using a liveusb and chroot into your system to update might fix this.

#3 2019-05-04 03:38:36

Re: Grub: loading Linux . invalid magic number

I saw that thread. I looks that the system somehow corrected itself — not a lot of helpful info there. I am able to boot using the copy of the kernel and initramfs on the USB drive.

After each pacman upgrade where the kernel and/or initramfs is updated, I need to copy the files to the USB (mounted temporarily on /mnt/1):
cp /boot/vmlinuz-linux-lts /boot/initramfs-linux-lts.img /mnt/1/boot/

#4 2019-05-04 05:55:01

Re: Grub: loading Linux . invalid magic number

I’ve removed and reinstalled grub and breeze-grub.

There exists «grub-file», which I don’t know if it uses the same routines as the grub loader, but testing the kernel with it provided the following info:

This seems a loose test, but at least it says the kernel is a x86_64-efi kernel.

#5 2021-04-14 21:27:40

Re: Grub: loading Linux . invalid magic number

This problem quietly disappeared and now has reappeared after an upgrade. This is a workaround that works for some reason.

copy vmlinux-linux-lts to some other directory. I was initially using a USB flash drive, but now I just create a subdirectory in /boot like /boot/5.10.29.
In grub, hit ‘e’ to edit the menu entry. Change the linux line from
linux /boot/vmlinux-linux-lts .
to
linux /boot/5.10.29/vmlinux-linux-lts .
.
This works.
Change /boot/grub/grub.cfg to fix things until the next grub-mkconfig.
Both files are identical with the same permissions.

Maybe someone more knowledgeable can explain why this hack is required and why it works.

Источник

“Invalid magic number, you need to load the kernel first” on an existent and previously working Ubuntu installation (not live USB issue)

I installed Ubuntu 20.04 on a fresh SSD. This motherboard has other harddrives with, for example, windows on them. My installation went fine and I was working all day yesterday on this install. I can’t recall for sure, but I believe I restarted a few times, for updates and the like, and booted back into Ubuntu 20.04 no problem. What I didn’t do was ever launch back into windows until the end of the night. I shut the system down after that, and this morning tried to launch back into Ubuntu 20.04. I mention this because some of my research indicated Windows can sometimes mess with boot filesystems.

Note that the below issues all occurred identically both before and after I ran fsck on the ssd from a temp Live Ubuntu thing, even though apparently fsck found a large volume of errors. Before fsck, the drive was unmountable in that Live Ubuntu, after, it was mountable, and I could grab some files I needed this morning.

If I try to select «Ubuntu» in my Grub menu, I get the error:

If I drop into the console, I can see my file system no problem.

In my boot/, there is

If I do file on these, I get weird results:

At this point my potential research points have branched enough to make me think I should ask on stackexchange what next steps I can try. For example, the two most common ubuntu stackoverflow answers get the «invalid arch-independent ELF magic» directly from grub (or grub-rescue?) it seems. Also, every other «invalid magic number» answer on reddit and stackexchange involve Live CD type things running directly off a flashdrive, and the solution is always «use a different flash drive / installation creation tool.»

Note that the above commands and responses were hand-typed so while I double checked I may have mis-typed something.

How can I boot into 20.04 again, ideally without re-installing or losing my files?

First answer doesn’t work, if I do

Second answer doesn’t work. I’m not in secure-boot mode.

The third answer didn’t work, I’ve tried disconnecting all USB devices to no avail.

I saw some things online about EFI mode. In my grub menu, I see UEFI Firmware Settings as an option, I’m not sure if that indicates I’m in UEFI «mode» or not. Based on what I’m looking at in my bios menu, I believe I’m in UEFI mode.

I tried the most-given solution to invalid arch-independent ELF magic error (across various Stackexchange questions)

Источник

Error invalid magic number error please load the kernel first

I’m in trouble with new kernel compile.
I’m using kernel 5.4.48-gentoo-x86_64 and all working fine.
Using the same configuration (I have copied .config of the older kernel in new source directory and run «make syncconf») I have compiled today the new source 5.4.60.
Compile phase finish without any error (I used «genkernel —xconfig —clean all»), in boot directory I find the new initamfs and vmlinuz files.
When I restart the system, If in grub I select the new kernel the system halted with message

error: invalid magic number
error: initramfs, load kernel before

I read another post about a similar problem (https://forums.gentoo.org/viewtopic-t-1084672-highlight-invalid+magic+number.html), but I have not understand the solution.

Последний раз редактировалось: alessio_demarchi (вт сен 01, 2020 8:58 am), всего редактировалось 1 раз Вернуться к началу

eccerr0r
Watchman

Зарегистрирован: 01 июл 2004
Сообщений: 9187
Откуда: almost Mile High in the USA

Добавлено: сб авг 29, 2020 3:19 pm Заголовок сообщения:
How are you configuring your grub?
What file did you use for your kernel and initramfs?
_________________
Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching?

Вернуться к началу

Whissi
Retired Dev

Зарегистрирован: 12 янв 2011
Сообщений: 222

Добавлено: сб авг 29, 2020 3:31 pm Заголовок сообщения:
Which genkernel version are you using? If you are using genkernel-4.1.1, please upgrade to 4.1.2 and retry.
_________________
Regards,
Whissi

Вернуться к началу

alessio_demarchi
n00b

Зарегистрирован: 03 ноя 2012
Сообщений: 36

Добавлено: вс авг 30, 2020 10:46 am Заголовок сообщения:
My grub is configured to load initram and kernel generated by genkernel.
genkernel is the version 4.1.0-r2
I use to move generated kernel and initramfs files in tree directory from /boot:

old (previous compiled kernel files)
default (actual functioning kernel)
test (new kernel)

in each directory there is:
vmlinuz-genkernel-x86_64-
initramfs-genkernel-x86_64-
Systemmap-genkernel- .map
kernel-config-

in /boot directory I create two group of symbolik link:
initramfs-x86_64-1_old -> linked to initramfs in old directory
initramfs-x86_64-2_tst -> linked to initramfs in test directory
initramfs-x86_64-3_dfl -> linked to initramfs in default directory

kernel-x86_64-1_old, 2_tst, 3_dfl with the same philosophy as the previous tree link

System.map linked to default directory System.map

My system is my working laptop, and is running since 4 years ago with gentoo (dell precision M4800)

Thanks a lot for your replies

Вернуться к началу

Tony0945
Watchman

Зарегистрирован: 25 июл 2006
Сообщений: 5127
Откуда: Illinois, USA

Добавлено: вс авг 30, 2020 1:50 pm Заголовок сообщения:
All of that can be automated with a script, eliminating mistakes in typing.
IIRC genkernel will update grub for you, so your script needn’t do that.
I always recommend enabling IKCONFIG IKCONFIG_PROC in the kernel so that the running configuration can be retrieved unambiguously.

Вернуться к началу

alessio_demarchi
n00b

Зарегистрирован: 03 ноя 2012
Сообщений: 36

Добавлено: вс авг 30, 2020 2:45 pm Заголовок сообщения:
Now I have tried to recompile my kernel with genkernel-4.1.2, but the result not changed.

Вернуться к началу

Whissi
Retired Dev

Зарегистрирован: 12 янв 2011
Сообщений: 222

Добавлено: вс авг 30, 2020 3:25 pm Заголовок сообщения:
Do you build kernel and initramfs with genkernel or do you build kernel manually? Please also show /var/log/genkernel.log.

Get a debug shell in genkernel and run «gksosreport» and show us that file.
_________________
Regards,
Whissi

Вернуться к началу

alessio_demarchi
n00b

Зарегистрирован: 03 ноя 2012
Сообщений: 36

Добавлено: пн авг 31, 2020 9:15 am Заголовок сообщения:
I build all with genkernel.

How can I show you genkernel.log (it is very huge)

Вернуться к началу

Whissi
Retired Dev

Зарегистрирован: 12 янв 2011
Сообщений: 222

Добавлено: пн авг 31, 2020 11:39 am Заголовок сообщения:
Use services like https://transfer.sh/
_________________
Regards,
Whissi

Вернуться к началу

alessio_demarchi
n00b

Зарегистрирован: 03 ноя 2012
Сообщений: 36

Добавлено: пн авг 31, 2020 2:07 pm Заголовок сообщения:
Ok

thanks

Вернуться к началу

Whissi
Retired Dev

Зарегистрирован: 12 янв 2011
Сообщений: 222

Добавлено: пн авг 31, 2020 5:13 pm Заголовок сообщения:
First, genkernel.log is not really the interesting log file in your case for now because generation didn’t fail for you.

Цитата:
Using the same configuration (I have copied .config of the older kernel in new source directory and run «make syncconf») I have compiled today the new source 5.4.60.

This is wrong. Please read how genkernel determines kernel.config it will use. If you start building a new KV (=when upgrading kernel sources), pay attention to used kernel config. I recommend to always pass kernel config via parameter (—kernel-confog=/path/to/desired/kernel.config). This way you can be sure that nothing unexpected will happen (hint: If new kernel should be based on current running kernel, just use —kernel-config=/proc/config.gz).

If you really did what you wrote in your first posting, i.e. installed new kernel sources, copied any existing kernel.config into that directory and run an arbitrary command in that directory. on next genkernel run, this kernel.config (=/usr/src/linux/.config) will be ignored by default and genkernel will look for kernel.config based on set heuristic (determining KV based on set kernel sources, looking in /etc/kernels/ for an already existing kernel.config for that version. when building a new KV for the first time, a kernel.config for this KV usually doesn’t exist yet so genkernel will fall back to its generic kernel.config).

So please notice that shown genkernel.log shows

Цитата:
* Using kernel config file ‘/etc/kernels/kernel-config-5.4.60-gentoo-x86_64’ .

which means that something had created a config in there. This doesn’t match your story. Please verify.

  • Rebuild kernel and initramfs with «genkernel all» and ensure that your desired kernel.config was used for that run (—kernel-config=/proc/config.gz)
  • If genkernel-4.1.2 initramfs will be still unable to boot, get a shell in that environment and run «gksosreport» — attach this file to this thread like you did with genkernel.log

_________________
Regards,
Whissi

Вернуться к началу

alessio_demarchi
n00b

Зарегистрирован: 03 ноя 2012
Сообщений: 36

Добавлено: пн авг 31, 2020 6:21 pm Заголовок сообщения:
Thanks Whissi

The method I used for configuring new kernel from previous kernel version source is explained in Gentoo wiki for kernel update (probably my english is not so good, and my explaination is not correct).
Typically I using genkernel —xconfig —clean all and I always check basic kernel configuration before compilation phase, and it seems to be correct.

I think the problem is not in initramfs file, but in vmlinuz. How can I run gksosreport, it is not and application installed in my system.

Now I try to run genkernel —kernel-config=/proc/config.gz all and then I try to reboot my system.

Вернуться к началу

Whissi
Retired Dev

Зарегистрирован: 12 янв 2011
Сообщений: 222

Добавлено: пн авг 31, 2020 6:46 pm Заголовок сообщения:
«gksosreport» is part of genkernel’s initramfs. I.e. in case genkernel’s initramfs will fail to boot your system you can start a rescue shell and call that command.
_________________
Regards,
Whissi

Вернуться к началу

alessio_demarchi
n00b

Зарегистрирован: 03 ноя 2012
Сообщений: 36

Добавлено: пн авг 31, 2020 6:48 pm Заголовок сообщения:
I try new kernel generated by genkernel —kernel-config=/proc/config.gz all, but nothing change

I think the problem is in vmlinuz, initramfs is not loaded, so I can’t run gksosreport.

The message reported at boot is:

Loading Linux x86_64-3_dfl .
error: invalid magic number
Loading initial ramdisk .
error: you need to load the kernel first.

Press any key to continue.

Последний раз редактировалось: alessio_demarchi (пн авг 31, 2020 6:51 pm), всего редактировалось 1 раз

Вернуться к началу

Whissi
Retired Dev

Зарегистрирован: 12 янв 2011
Сообщений: 222

Добавлено: пн авг 31, 2020 6:50 pm Заголовок сообщения:
Which bootloader are you using? For grub, please show us /boot/grub/grub.cfg.
_________________
Regards,
Whissi

Вернуться к началу

alessio_demarchi
n00b

Зарегистрирован: 03 ноя 2012
Сообщений: 36

Добавлено: пн авг 31, 2020 6:54 pm Заголовок сообщения:
I use grub2

this is my grub.cfg https://transfer.sh/%28%29.tar.gz

Вернуться к началу

Whissi
Retired Dev

Зарегистрирован: 12 янв 2011
Сообщений: 222

Добавлено: пн авг 31, 2020 6:55 pm Заголовок сообщения:
That tar file is empty.
_________________
Regards,
Whissi

Вернуться к началу

alessio_demarchi
n00b

Зарегистрирован: 03 ноя 2012
Сообщений: 36

Добавлено: пн авг 31, 2020 7:12 pm Заголовок сообщения:
Sorry

Try this
https://transfer.sh/%28%29.tar.gz

Вернуться к началу

alessio_demarchi
n00b

Зарегистрирован: 03 ноя 2012
Сообщений: 36

Добавлено: пн авг 31, 2020 7:14 pm Заголовок сообщения:
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
if [ -s $prefix/grubenv ]; then
load_env
fi
if [ «$» ] ; then
set default=»$»
set next_entry=
save_env next_entry
set boot_once=true
else
set default=»$»
fi

if [ x»$» = xy ]; then
menuentry_id_option=»—id»
else
menuentry_id_option=»»
fi

if [ «$» ]; then
set saved_entry=»$»
save_env saved_entry
set prev_saved_entry=
save_env prev_saved_entry
set boot_once=true
fi

function savedefault <
if [ -z «$» ]; then
saved_entry=»$»
save_env saved_entry
fi
>

function load_video <
if [ x$feature_all_video_module = xy ]; then
insmod all_video
else
insmod efi_gop
insmod efi_uga
insmod ieee1275_fb
insmod vbe
insmod vga
insmod video_bochs
insmod video_cirrus
fi
>

if [ x$feature_default_font_path = xy ] ; then
font=unicode
else
insmod part_msdos
insmod jfs
set root=’hd0,msdos7′
if [ x$feature_platform_search_hint = xy ]; then
search —no-floppy —fs-uuid —set=root —hint-bios=hd0,msdos7 —hint-efi=hd0,msdos7 —hint-baremetal=ahci0,msdos7 3e5f2da8-79d5-4cff-99cc-5fcc68cfa006
else
search —no-floppy —fs-uuid —set=root 3e5f2da8-79d5-4cff-99cc-5fcc68cfa006
fi
font=»/usr/share/grub/unicode.pf2″
fi

if loadfont $font ; then
set gfxmode=1920×1080,1440×900,1280×800,1024×600,auto
load_video
insmod gfxterm
set locale_dir=$prefix/locale
set lang=en_US
insmod gettext
fi
terminal_output gfxterm
insmod part_msdos
insmod ext2
set root=’hd0,msdos6′
if [ x$feature_platform_search_hint = xy ]; then
search —no-floppy —fs-uuid —set=root —hint-bios=hd0,msdos6 —hint-efi=hd0,msdos6 —hint-baremetal=ahci0,msdos6 48f55fb2-f9e9-404c-9916-8a1c09ab9030
else
search —no-floppy —fs-uuid —set=root 48f55fb2-f9e9-404c-9916-8a1c09ab9030
fi
insmod png
background_image -m stretch /grub/mybackground.png
if [ x$feature_timeout_style = xy ] ; then
set timeout_style=menu
set timeout=3
# Fallback normal timeout code in case the timeout_style feature is
# unavailable.
else
set timeout=3
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/10_linux ###
menuentry ‘Gentoo GNU/Linux’ —class gentoo —class gnu-linux —class gnu —class os $menuentry_id_option ‘gnulinux-simple-3e5f2da8-79d5-4cff-99cc-5fcc68cfa006’ <
savedefault
load_video
set gfxpayload=keep
insmod gzio
insmod part_msdos
insmod ext2
set root=’hd0,msdos6′
if [ x$feature_platform_search_hint = xy ]; then
search —no-floppy —fs-uuid —set=root —hint-bios=hd0,msdos6 —hint-efi=hd0,msdos6 —hint-baremetal=ahci0,msdos6 48f55fb2-f9e9-404c-9916-8a1c09ab9030
else
search —no-floppy —fs-uuid —set=root 48f55fb2-f9e9-404c-9916-8a1c09ab9030
fi
echo ‘Loading Linux x86_64-3_dfl . ‘
linux /kernel-genkernel-x86_64-3_dfl root=UUID=3e5f2da8-79d5-4cff-99cc-5fcc68cfa006 ro resume=/dev/sda5 quiet splash
echo ‘Loading initial ramdisk . ‘
initrd /initramfs-genkernel-x86_64-3_dfl
>
submenu ‘Advanced options for Gentoo GNU/Linux’ $menuentry_id_option ‘gnulinux-advanced-3e5f2da8-79d5-4cff-99cc-5fcc68cfa006’ <
menuentry ‘Gentoo GNU/Linux, with Linux x86_64-3_dfl’ —class gentoo —class gnu-linux —class gnu —class os $menuentry_id_option ‘gnulinux-x86_64-3_dfl-advanced-3e5f2da8-79d5-4cff-99cc-5fcc68cfa006’ <
savedefault
load_video
set gfxpayload=keep
insmod gzio
insmod part_msdos
insmod ext2
set root=’hd0,msdos6′
if [ x$feature_platform_search_hint = xy ]; then
search —no-floppy —fs-uuid —set=root —hint-bios=hd0,msdos6 —hint-efi=hd0,msdos6 —hint-baremetal=ahci0,msdos6 48f55fb2-f9e9-404c-9916-8a1c09ab9030
else
search —no-floppy —fs-uuid —set=root 48f55fb2-f9e9-404c-9916-8a1c09ab9030
fi
echo ‘Loading Linux x86_64-3_dfl . ‘
linux /kernel-genkernel-x86_64-3_dfl root=UUID=3e5f2da8-79d5-4cff-99cc-5fcc68cfa006 ro resume=/dev/sda5 quiet splash
echo ‘Loading initial ramdisk . ‘
initrd /initramfs-genkernel-x86_64-3_dfl
>
menuentry ‘Gentoo GNU/Linux, with Linux x86_64-3_dfl (recovery mode)’ —class gentoo —class gnu-linux —class gnu —class os $menuentry_id_option ‘gnulinux-x86_64-3_dfl-recovery-3e5f2da8-79d5-4cff-99cc-5fcc68cfa006’ <
load_video
set gfxpayload=keep
insmod gzio
insmod part_msdos
insmod ext2
set root=’hd0,msdos6′
if [ x$feature_platform_search_hint = xy ]; then
search —no-floppy —fs-uuid —set=root —hint-bios=hd0,msdos6 —hint-efi=hd0,msdos6 —hint-baremetal=ahci0,msdos6 48f55fb2-f9e9-404c-9916-8a1c09ab9030
else
search —no-floppy —fs-uuid —set=root 48f55fb2-f9e9-404c-9916-8a1c09ab9030
fi
echo ‘Loading Linux x86_64-3_dfl . ‘
linux /kernel-genkernel-x86_64-3_dfl root=UUID=3e5f2da8-79d5-4cff-99cc-5fcc68cfa006 ro single resume=/dev/sda5
echo ‘Loading initial ramdisk . ‘
initrd /initramfs-genkernel-x86_64-3_dfl
>
menuentry ‘Gentoo GNU/Linux, with Linux x86_64-2_tst’ —class gentoo —class gnu-linux —class gnu —class os $menuentry_id_option ‘gnulinux-x86_64-2_tst-advanced-3e5f2da8-79d5-4cff-99cc-5fcc68cfa006’ <
savedefault
load_video
set gfxpayload=keep
insmod gzio
insmod part_msdos
insmod ext2
set root=’hd0,msdos6′
if [ x$feature_platform_search_hint = xy ]; then
search —no-floppy —fs-uuid —set=root —hint-bios=hd0,msdos6 —hint-efi=hd0,msdos6 —hint-baremetal=ahci0,msdos6 48f55fb2-f9e9-404c-9916-8a1c09ab9030
else
search —no-floppy —fs-uuid —set=root 48f55fb2-f9e9-404c-9916-8a1c09ab9030
fi
echo ‘Loading Linux x86_64-2_tst . ‘
linux /kernel-genkernel-x86_64-2_tst root=UUID=3e5f2da8-79d5-4cff-99cc-5fcc68cfa006 ro resume=/dev/sda5 quiet splash
echo ‘Loading initial ramdisk . ‘
initrd /initramfs-genkernel-x86_64-2_tst
>
menuentry ‘Gentoo GNU/Linux, with Linux x86_64-2_tst (recovery mode)’ —class gentoo —class gnu-linux —class gnu —class os $menuentry_id_option ‘gnulinux-x86_64-2_tst-recovery-3e5f2da8-79d5-4cff-99cc-5fcc68cfa006’ <
load_video
set gfxpayload=keep
insmod gzio
insmod part_msdos
insmod ext2
set root=’hd0,msdos6′
if [ x$feature_platform_search_hint = xy ]; then
search —no-floppy —fs-uuid —set=root —hint-bios=hd0,msdos6 —hint-efi=hd0,msdos6 —hint-baremetal=ahci0,msdos6 48f55fb2-f9e9-404c-9916-8a1c09ab9030
else
search —no-floppy —fs-uuid —set=root 48f55fb2-f9e9-404c-9916-8a1c09ab9030
fi
echo ‘Loading Linux x86_64-2_tst . ‘
linux /kernel-genkernel-x86_64-2_tst root=UUID=3e5f2da8-79d5-4cff-99cc-5fcc68cfa006 ro single resume=/dev/sda5
echo ‘Loading initial ramdisk . ‘
initrd /initramfs-genkernel-x86_64-2_tst
>
menuentry ‘Gentoo GNU/Linux, with Linux x86_64-1_old’ —class gentoo —class gnu-linux —class gnu —class os $menuentry_id_option ‘gnulinux-x86_64-1_old-advanced-3e5f2da8-79d5-4cff-99cc-5fcc68cfa006’ <
savedefault
load_video
set gfxpayload=keep
insmod gzio
insmod part_msdos
insmod ext2
set root=’hd0,msdos6′
if [ x$feature_platform_search_hint = xy ]; then
search —no-floppy —fs-uuid —set=root —hint-bios=hd0,msdos6 —hint-efi=hd0,msdos6 —hint-baremetal=ahci0,msdos6 48f55fb2-f9e9-404c-9916-8a1c09ab9030
else
search —no-floppy —fs-uuid —set=root 48f55fb2-f9e9-404c-9916-8a1c09ab9030
fi
echo ‘Loading Linux x86_64-1_old . ‘
linux /kernel-genkernel-x86_64-1_old root=UUID=3e5f2da8-79d5-4cff-99cc-5fcc68cfa006 ro resume=/dev/sda5 quiet splash
echo ‘Loading initial ramdisk . ‘
initrd /initramfs-genkernel-x86_64-1_old
>
menuentry ‘Gentoo GNU/Linux, with Linux x86_64-1_old (recovery mode)’ —class gentoo —class gnu-linux —class gnu —class os $menuentry_id_option ‘gnulinux-x86_64-1_old-recovery-3e5f2da8-79d5-4cff-99cc-5fcc68cfa006’ <
load_video
set gfxpayload=keep
insmod gzio
insmod part_msdos
insmod ext2
set root=’hd0,msdos6′
if [ x$feature_platform_search_hint = xy ]; then
search —no-floppy —fs-uuid —set=root —hint-bios=hd0,msdos6 —hint-efi=hd0,msdos6 —hint-baremetal=ahci0,msdos6 48f55fb2-f9e9-404c-9916-8a1c09ab9030
else
search —no-floppy —fs-uuid —set=root 48f55fb2-f9e9-404c-9916-8a1c09ab9030
fi
echo ‘Loading Linux x86_64-1_old . ‘
linux /kernel-genkernel-x86_64-1_old root=UUID=3e5f2da8-79d5-4cff-99cc-5fcc68cfa006 ro single resume=/dev/sda5
echo ‘Loading initial ramdisk . ‘
initrd /initramfs-genkernel-x86_64-1_old
>
>

### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/30_os-prober ###
menuentry ‘Windows 10 (on /dev/sda2)’ —class windows —class os $menuentry_id_option ‘osprober-chain-AE52157E52154C89’ <
savedefault
insmod part_msdos
insmod ntfs
set root=’hd0,msdos2′
if [ x$feature_platform_search_hint = xy ]; then
search —no-floppy —fs-uuid —set=root —hint-bios=hd0,msdos2 —hint-efi=hd0,msdos2 —hint-baremetal=ahci0,msdos2 AE52157E52154C89
else
search —no-floppy —fs-uuid —set=root AE52157E52154C89
fi
parttool $ hidden-
drivemap -s (hd0) $
chainloader +1
>
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the ‘exec tail’ line above.
### END /etc/grub.d/40_custom ###

### BEGIN /etc/grub.d/41_custom ###
if [ -f $/custom.cfg ]; then
source $/custom.cfg
elif [ -z «$» -a -f $prefix/custom.cfg ]; then
source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###

Вернуться к началу

Whissi
Retired Dev

Зарегистрирован: 12 янв 2011
Сообщений: 222

Добавлено: пн авг 31, 2020 7:18 pm Заголовок сообщения:
Note: In your first posting you mentioned

Цитата:
vmlinuz-genkernel-x86_64-
initramfs-genkernel-x86_64-
Systemmap-genkernel- .map
kernel-config-

These are custom names.

The shown genkernel.log also shows that you created

Код:
/boot/initramfs-5.4.60-gentoo-x86_64.img

Your shown grub.cfg doesn’t use that name schema.

I would suggest cleaning up /boot and re-run

Код:
grub-mkconfig -o /boot/grub/grub.cfg

. Please double check before reboot that grub.cfg will contain an entry using initramfs-5.4.60-gentoo-x86_64.img and corresponding kernel.
_________________
Regards,
Whissi

Вернуться к началу

alessio_demarchi
n00b

Зарегистрирован: 03 ноя 2012
Сообщений: 36

Добавлено: пн авг 31, 2020 7:23 pm Заголовок сообщения:
Sorry

In my first post I used a simplified sintax. The filenames are correct in grub.cfg.
I tried command that you suggest before opening this post

The filename that compare in grub.cfg are symbolik link to initramfs-genkernel- .img and corresponding kernel file
I don’t know if it is usefull, this is my actual /boot directory:

drwxr-xr-x 2 root root 4096 Aug 31 21:15 default
drwxr-xr-x 6 root root 4096 Aug 29 13:05 grub
lrwxrwxrwx 1 root root 38 Aug 28 19:15 initramfs-genkernel-x86_64-1_old -> old/initramfs-5.4.48-gentoo-x86_64.img
lrwxrwxrwx 1 root root 39 Jul 17 11:22 initramfs-genkernel-x86_64-2_tst -> test/initramfs-5.4.48-gentoo-x86_64.img
lrwxrwxrwx 1 root root 42 Aug 28 19:43 initramfs-genkernel-x86_64-3_dfl -> default/initramfs-5.4.60-gentoo-x86_64.img
lrwxrwxrwx 1 root root 32 Aug 28 19:15 kernel-genkernel-x86_64-1_old -> old/vmlinuz-5.4.48-gentoo-x86_64
lrwxrwxrwx 1 root root 33 Jul 17 11:22 kernel-genkernel-x86_64-2_tst -> test/vmlinuz-5.4.48-gentoo-x86_64
lrwxrwxrwx 1 root root 42 Aug 28 19:43 kernel-genkernel-x86_64-3_dfl -> default/kernel-config-5.4.60-gentoo-x86_64
drwxr-xr-x 2 root root 4096 Aug 28 19:14 old
lrwxrwxrwx 1 root root 39 Aug 28 19:43 System.map -> default/System.map-5.4.60-gentoo-x86_64
drwxr-xr-x 2 root root 4096 Jul 17 11:23 test

Вернуться к началу

Whissi
Retired Dev

Зарегистрирован: 12 янв 2011
Сообщений: 222

Добавлено: пн авг 31, 2020 8:39 pm Заголовок сообщения:
I am kind of lost here. Don’t get me wrong here but you are doing advanced stuff and I am not sure you understand what you are doing. I cannot help you with that.

All I can tell you:

If you manage to get genkernel’s initramfs loaded (you will see that on boot when initramfs will print you name and version) and it will fail, genkernel’s initramfs will offer you to enter rescue shell. If you enter rescue shell you can use «gksosreport» to get further help. If you don’t see such a prompt that is another indicator that you don’t use genkernel’s initramfs.

But at the moment it sounds like your problem is that you do not boot genkernel’s initramfs at all so this is not a genkernel problem.

So I recommend you to go back one step and follow handbook step by step. Build both, kernel and initramfs with genkernel (genkernell —kernel-config=/path/to/your/desired/kernel.config all) and tell bootloader to boot that image and initramfs. I am pretty sure that this will work when you use a working kernel config (for example /proc/config.gz from current running kernel).
_________________
Regards,
Whissi

Вернуться к началу

alessio_demarchi
n00b

Зарегистрирован: 03 ноя 2012
Сообщений: 36

Добавлено: вт сен 01, 2020 8:15 am Заголовок сообщения:
Sorry Whissi. You have to be patience with me. I’m an old linux users (it is since 1994 that I recompile linux kernel source as hobbyist user), and a lot my solution it is not so «classical», but trust me, all are running and functional.
My problem is not in initramfs, initramfs is not loaded because vmlinuz (loaded before initramfs) is not recognized as right kernel file.
I don’t know why.
If I run «file /boot/default/vmlinuz. » this is the result:
# file /boot/default/vmlinuz-5.4.60-gentoo-x86_64
/boot/default/vmlinuz-5.4.60-gentoo-x86_64: Linux kernel x86 boot executable bzImage, version 5.4.60-gentoo-x86_64 (root@ganimede) #1 SMP PREEMPT Mon Aug 31 20:59:27 CEST 2020, RO-rootFS, swap_dev 0x6, Normal VGA

Now I try to clear my /boot partition (all link and directory old, test and default), launch your suggested command (genkernel —kernel-config=/proc/config.gz all) then grub-mkconfig -o /boot/grub.cfg and then reboot my system.

wait a moment and then I write the result

Последний раз редактировалось: alessio_demarchi (вт сен 01, 2020 8:44 am), всего редактировалось 1 раз

Вернуться к началу

alessio_demarchi
n00b

Зарегистрирован: 03 ноя 2012
Сообщений: 36

Добавлено: вт сен 01, 2020 8:43 am Заголовок сообщения: [solved]
Ok.
I don’t know why, but now it is working.
I have cleared my /boot directory (copied my old functioning kernels file), copy /boot/default/vmlinuz. initramfs.. and System.map-genkernel.. in /boot.
Run grub-mkconfig -o /boot/grub/grub.cfg
Reboot.
And now my new kernel is running.

Whissi thank a lot. For your patience and competence.

How can I mark as solved this topic?

Вернуться к началу

Whissi
Retired Dev

Зарегистрирован: 12 янв 2011
Сообщений: 222

Добавлено: вт сен 01, 2020 8:51 am Заголовок сообщения:
Glad you sorted the issue.

Next to your first posting you should find an «EDIT» button which will allow you to change title to add «SOLVED» I think.
_________________
Regards,
Whissi

Вернуться к началу

Вы не можете начинать темы
Вы не можете отвечать на сообщения
Вы не можете редактировать свои сообщения
Вы не можете удалять свои сообщения
Вы не можете голосовать в опросах

Copyright 2001-2023 Gentoo Foundation, Inc. Designed by Kyle Manna © 2003; Style derived from original subSilver theme. | Hosting by Gossamer Threads Inc. © | Powered by phpBB 2.0.23-gentoo-p11 © 2001, 2002 phpBB Group
Privacy Policy

Источник

Adblock
detector

#1 2021-06-02 18:43:41

bysom
Member
Registered: 2021-06-02
Posts: 13

[SOLVED] Invalid magic number on boot

Hi,

after a system upgrade including linux and linux-headers my system stopped working.

Loading Linux core repo kernel...
error: invalid magic number.
Loading initial ramdisk...
error: you need to load the kernel first

I’ve already tried to reinstall linux and linux-headers, tried `mkinitcpio -P`, to rebuild my grub config and to reinstall grub. Everything without error messages.

Some weeks ago I had the same issue, but here everything was fine again after I reinstalled linux and linux-headers.

I’ve used the grub command line. I’m not sure if I used it correctly or if it is a hint:

grub> ls (hd1,gpt3)
    Partition hd1,gpt3: No known filesystem detected - Partition start at 37315584KiB - Total size 3869702983.5KiB

It is a btrfs filesystem and it works.

I hope someone has an idea.

EDIT: My solution was to upgrade grub to 2.06 RC1. Details are in the thread.

Last edited by bysom (2021-06-07 19:52:23)

#2 2021-06-02 20:06:13

seth
Member
Registered: 2012-09-03
Posts: 35,309

Re: [SOLVED] Invalid magic number on boot

Suggests /boot/vmlinuz-linux is corrupt.
Is the boot partition full (no space left)?
What dow «file /boot/vmlinuz-linux» say and what is the md5 of the file?
If thereÄs enough space, can you isntall and boot the lts kernel?

#3 2021-06-03 09:26:48

bysom
Member
Registered: 2021-06-02
Posts: 13

Re: [SOLVED] Invalid magic number on boot

Hi, thanks for your answer.

There is enough space, since i have no extra /boot partition. I’ve encrypted my entire system including /boot. Therefore I have an extra efi partition with grub, that decrypts my btrfs and then boots the kernel. Mostly like it is described in the Wiki

# df -h
...
/dev/mapper/cryptroot        3,7T    2,3T  1,4T   64% /mnt
/dev/mapper/cryptroot        3,7T    2,3T  1,4T   64% /mnt/home
/dev/mapper/cryptroot        3,7T    2,3T  1,4T   64% /mnt/.snapshots
/dev/sda1                    599M    352K  599M    1% /mnt/efi

I’ve also installed the lts kernel. Both aren’t working.

# file /mnt/boot/vmlinuz-linux
/mnt/boot/vmlinuz-linux: Linux kernel x86 boot executable bzImage, version 5.12.8-arch1-1 (linux@archlinux) #1 SMP PREEMPT Fri, 28 May 2021 15:10:20 +0000, RO-rootFS, swap_dev 0x8, Normal VGA
# file /mnt/boot/vmlinuz-linux-lts 
/mnt/boot/vmlinuz-linux-lts: Linux kernel x86 boot executable bzImage, version 5.10.41-1-lts (linux-lts@archlinux) #1 SMP Fri, 28 May 2021 15:03:28 +0000, RO-rootFS, swap_dev 0x8, Normal VGA

Here the md5 sums

# md5sum /mnt/boot/vmlinuz-linux
04da1eb5b1d97e228936fbb613277406  /mnt/boot/vmlinuz-linux
# md5sum /mnt/boot/vmlinuz-linux-lts 
f525237336ec905a8af0002ac457d1dc  /mnt/boot/vmlinuz-linux-lts

I’ve also tried a `btrfs check` without errors.

Thanks for your help!

#4 2021-06-03 13:42:56

seth
Member
Registered: 2012-09-03
Posts: 35,309

Re: [SOLVED] Invalid magic number on boot

It would seem that either the decryption fails or maybe is just too slow
Can you «ls» the partition after «insmod btrfs»?

#5 2021-06-03 17:30:34

bysom
Member
Registered: 2021-06-02
Posts: 13

Re: [SOLVED] Invalid magic number on boot

Okay, I have some results.

After the cryptomount command:

> ls (crypto0)
Device crypto0: Filesystem type btrfs - Label `cepa`, UUID <the uuid> - Sector size 512B - Total size 3869700935.5KiB

I have tried a `ls /@/boot` after the `echo ‘Loading Linux linux-lts …’` and it lists the files in my /boot directory. After that I have tried a `file —is-x86-linux /@/boot/vmlinuz-linux` and got no result (and also no error). Is there something else I should try?

#6 2021-06-03 18:37:26

bysom
Member
Registered: 2021-06-02
Posts: 13

Re: [SOLVED] Invalid magic number on boot

I’ve tried a `sleep 30` before loading the kernel, which hasn’t changed anything.

After that I have chrooted my arch again and reinstalled linux, linux-lts, and the headers and now something changed. If I try to boot the LTS kernel it passes the ‘Loading Linux linux-lts …’ section and then I get a kernel panic in the following ‘Loading initial ramdisk …’ section. The error message before the kernel panic is

Initramfs unpacking failed: invalid magic at start of compressed

The normal linux kernel still fails at the first section ‘Loading Linux linux …’

Last edited by bysom (2021-06-03 18:38:35)

#7 2021-06-04 05:19:17

seth
Member
Registered: 2012-09-03
Posts: 35,309

Re: [SOLVED] Invalid magic number on boot

Re-cap:
This is a regression, the config used to work befoer?
The files end on the encrypted partition intact, ie. they’re perfectly accessible offline?
The error has a degree of randomness, eg. vmlinuz-linux-lts (now) loads, but the other files have bad header bytes?

What else was included in the breaking udpate? /var/log/pacman.log?

file --is-x86-linux /@/boot/vmlinuz-linux

returns a boolean.

if file --is-x86-linux /@/boot/vmlinuz-linux; then echo 'kernel is good'; fi

#8 2021-06-04 14:48:33

bysom
Member
Registered: 2021-06-02
Posts: 13

Re: [SOLVED] Invalid magic number on boot

Yes, your recap sounds correct. The config worked before, I can access my files and the error seems to have some kind of randomness.

Here is the pacman log from the last update before the crash: http://ix.io/3oJJ

#9 2021-06-04 14:55:54

seth
Member
Registered: 2012-09-03
Posts: 35,309

Re: [SOLVED] Invalid magic number on boot

cryptsetup sticks out…
Downgrade that, re-install the kernels and see what happens.

BE PREPARED TO LOSE ACCESS TO THE … oh, wait: you can’t boot and will have to chroot anyway smile

#10 2021-06-04 17:48:05

bysom
Member
Registered: 2021-06-02
Posts: 13

Re: [SOLVED] Invalid magic number on boot

I’ve downgraded to cryptsetup 2.3.4 and the error is still the same.

Is this setup with an encrypted boot partition that rare, that it could be a bug in grub or somewhere else? The idea to reinstall my arch with a classical encryption setup gets more and more attractive for me. Unless you have still some good ideas. I’m still very happy with your help smile

#11 2021-06-04 20:40:21

seth
Member
Registered: 2012-09-03
Posts: 35,309

Re: [SOLVED] Invalid magic number on boot

Did the kernel re-installation change anything about the randomness aspect of the kernel/initramfs «corruption»?
And otherwise, how the status is at the grub shell (ie. testing the file types there) in case this is -somehow- a time/race condition…

#12 2021-06-05 20:23:24

bysom
Member
Registered: 2021-06-02
Posts: 13

Re: [SOLVED] Invalid magic number on boot

Hi, I have some news.

To your questions: The  kernel reinstallation made that the error occours at the ‘Loading Linux linux-lts …’ again for the lts kernel which made it to the initramfs loading. As far as I remember this state changed with the reinstallation of the kernel.

I have tried your ‘if file xy then’ example and it obviously returned a false value. I’ve got a ‘kernel is bad’ because I’ve added an else case. It should have been true, right?

After that I saw, that I can use md5sum with grub and checked the md5 sum of the kernel and got a different number than I get from my live system.

From grub

> md5sum /@/boot/vmlinuz-linux
546c...145ce /@/boot/vmlinuz-linux 

From a live linux

# md5sum /mnt/boot/vmlinuz-linux
8ed348f0125772a6ef0756b818199fc6  /mnt/boot/vmlinuz-linux

I have asked someone else with an arch linux for a hash sum as a reference and got the 8ed348f0125772a6ef0756b818199fc6 for the actual kernel.

(I’ve updated the kernel yesterday)

Then I’ve used cat with grub to view some text files which all looked normal to me. After that I’ve used md5sum on one of these files and got the same hash numbers with grub and with my live stick.

Last edited by bysom (2021-06-05 21:33:05)

#14 2021-06-06 12:13:21

bysom
Member
Registered: 2021-06-02
Posts: 13

Re: [SOLVED] Invalid magic number on boot

Hi, I have changed that compression to cat and reinstalled the kernels.

The md5 sums from my live linux (ubuntu 20.04, Kernel 5.8.0, cryptsetup 2.2.2, btrfs-progs v5.4.1). Those from my chrooted arch are the same.

f14f10d20670a7638af02f4ae11b8c2e  /mnt/boot/initramfs-linux.img
2cda8759540127bf587869679441188b  /mnt/boot/initramfs-linux-lts.img
8ed348f0125772a6ef0756b818199fc6  /mnt/boot/vmlinuz-linux
afe5da8d09ed00335cea004e1ed79f65  /mnt/boot/vmlinuz-linux-lts

The md5sums from grub

f14f10d20670a7638af02f4ae11b8c2e  /@/boot/initramfs-linux.img
2cda8759540127bf587869679441188b  /@/boot/initramfs-linux-lts.img
e36e627...3a053  /@/boot/vmlinuz-linux
7727430...f441de  /@/boot/vmlinuz-linux-lts

That ones from the initramfs are correct. And that one from the linux is different now.

Last edited by bysom (2021-06-06 12:18:59)

#15 2021-06-06 12:34:36

seth
Member
Registered: 2012-09-03
Posts: 35,309

Re: [SOLVED] Invalid magic number on boot

Smells as if the grub btrfs module doesn’t like compressed files (at least not zstd)?
If you check a random zstd compressed file from the grub shell, does its md5 deviate?
Or do you maybe use https://wiki.archlinux.org/title/Btrfs#Compression ?

#16 2021-06-06 21:57:33

bysom
Member
Registered: 2021-06-02
Posts: 13

Re: [SOLVED] Invalid magic number on boot

Yes, I’m using btrfs compression with zstd.

I’ve checked the results with a normal file

Linux point of view

c3b6db02c809b04751fa5c7c0f430df4  /mnt/root/Testfile.mp4
0a02ed72843d8893bd5616cf58dd8737  /mnt/root/Testfile.mp4.zst

grub point of view

41bf8909...cdc8da  /@/root/Testfile.mp4
3283ab1ac...281f11e  /@/root/Testfile.mp4.zst

Both files are different here. There could be some randomness, I think.

Last edited by bysom (2021-06-06 22:27:06)

#17 2021-06-06 22:03:11

seth
Member
Registered: 2012-09-03
Posts: 35,309

Re: [SOLVED] Invalid magic number on boot

What if you «chattr -c /boot» and update the kernel?

Edit: also notice the warning and to have grub-install post 2019-07-05

Last edited by seth (2021-06-06 22:06:14)

#18 2021-06-07 19:45:18

bysom
Member
Registered: 2021-06-02
Posts: 13

Re: [SOLVED] Invalid magic number on boot

Hi, I have tried that chattr -c /boot thing and it hasn’t changed anything. After that I have checked the md5sums with grub again and got for one file an error message containing ‘error: zstd data corrupted.’. After that I have repeated that btrfs check just in case without errors.

Since the error only occurred with grub and there is already a rc1 for the next grub release, which seems to be really rare, I thought that I could try grub-git from the aur (what if it is a grub bug and no one fixes it before the release, was my first thought). So I installed grub-git, then executed grub-install, restored the grub config and got a booting system. I’m a bit happy now. And I am very thankful for your help and your patience, seth! A very positive experience. Let me know if I can do something in reward.

#19 2021-06-07 19:47:19

seth
Member
Registered: 2012-09-03
Posts: 35,309

Re: [SOLVED] Invalid magic number on boot

Let me know if I can do something in reward.

Please always remember to mark resolved threads by editing your initial posts subject — so others will know that there’s no task left, but maybe a solution to find.
Thanks.

;-)

#20 2021-06-07 19:49:57

bysom
Member
Registered: 2021-06-02
Posts: 13

Re: [SOLVED] Invalid magic number on boot

Of course big_smile

Last edited by bysom (2021-06-07 19:54:38)

I installed Ubuntu 20.04 on a fresh SSD. This motherboard has other harddrives with, for example, windows on them. My installation went fine and I was working all day yesterday on this install. I can’t recall for sure, but I believe I restarted a few times, for updates and the like, and booted back into Ubuntu 20.04 no problem. What I didn’t do was ever launch back into windows until the end of the night. I shut the system down after that, and this morning tried to launch back into Ubuntu 20.04. I mention this because some of my research indicated Windows can sometimes mess with boot filesystems.

Note that the below issues all occurred identically both before and after I ran fsck on the ssd from a temp Live Ubuntu thing, even though apparently fsck found a large volume of errors. Before fsck, the drive was unmountable in that Live Ubuntu, after, it was mountable, and I could grab some files I needed this morning.

If I try to select «Ubuntu» in my Grub menu, I get the error:

Error: Invalid Magic Number
Error: You need to load the kernel first

If I drop into the console, I can see my file system no problem.

ls (hd3,gpt2/)
lost+found/, boot/ ...etc

In my boot/, there is

efi/
grub/
System.map-5.4.0-26-generic
config-5.4.0-26-generic
initrd.img
initrd.img.old
memtest86+.bin
memtest86+elf
memtest86+_multiboot.bin
vmlinuz
vmlinuz.old
vmlinuz-5.4.0-26-generic 
vmlinuz-5.4.0-48-generic <-- this is the one I'm trying to use
initrd.img-5.4.0-26-generic
config-5.4.0-48-generic
System.map-5.4.0-48-generic
initrd.img-5.4.0-48-generic

If I do file on these, I get weird results:

file (hd3,gpt2)/boot/vmlinuz-5.4.0-48-generic
error: invalid arch-independent ELF magic

file (hd3,gpt2)/boot/initrd.img-5.4.0-48-generic
error: invalid arch-independent ELF magic

At this point my potential research points have branched enough to make me think I should ask on stackexchange what next steps I can try. For example, the two most common ubuntu stackoverflow answers get the «invalid arch-independent ELF magic» directly from grub (or grub-rescue?) it seems. Also, every other «invalid magic number» answer on reddit and stackexchange involve Live CD type things running directly off a flashdrive, and the solution is always «use a different flash drive / installation creation tool.»

Note that the above commands and responses were hand-typed so while I double checked I may have mis-typed something.

How can I boot into 20.04 again, ideally without re-installing or losing my files?

Experiments below:

I tried Live USB error «you need to load the kernel first» :

First answer doesn’t work, if I do

linux /boot/vmlinuz-5.4.0-48-generic root=/dev/sdb2

I get

error: invalid magic number

Second answer doesn’t work. I’m not in secure-boot mode.

The third answer didn’t work, I’ve tried disconnecting all USB devices to no avail.

I saw some things online about EFI mode. In my grub menu, I see UEFI Firmware Settings as an option, I’m not sure if that indicates I’m in UEFI «mode» or not. Based on what I’m looking at in my bios menu, I believe I’m in UEFI mode.

I tried the most-given solution to invalid arch-independent ELF magic error (across various Stackexchange questions)

sudo mount /dev/sdb2 /mnt
sudo grub-install --root-directory=/mnt /dev/sdb2
Installing for i386-pc platform.
grub-install: warning: File system `ext2' doesn't support embedding.
grub-install: warning: Embedding is not possible. GRUB can only be installed in this setup by using blocklists. However, blocklists are UNRELIABLE and their use is discouraged.
grub-install: error: will not proceed with blocklists. 

EDIT: I ran the oft-recommended boot repair tool, this is the output: http://paste.ubuntu.com/p/H86ZBpr9Sr/

Now the error is

error: invalid magic number
alloc magic is broken at 0xb7855240: b779dc00
Aborted. Press any key to exit.

View previous topic :: View next topic  
Author Message
alessio_demarchi
n00b
n00b

Joined: 03 Nov 2012
Posts: 36

PostPosted: Sat Aug 29, 2020 2:11 pm    Post subject: [SOLVED] error: invalid magic number on kernel loading Reply with quote

Hello everyone

I’m in trouble with new kernel compile.

I’m using kernel 5.4.48-gentoo-x86_64 and all working fine.

Using the same configuration (I have copied .config of the older kernel in new source directory and run «make syncconf») I have compiled today the new source 5.4.60.

Compile phase finish without any error (I used «genkernel —xconfig —clean all»), in boot directory I find the new initamfs and vmlinuz files.

When I restart the system, If in grub I select the new kernel the system halted with message

error: invalid magic number

error: initramfs, load kernel before

I read another post about a similar problem (https://forums.gentoo.org/viewtopic-t-1084672-highlight-invalid+magic+number.html), but I have not understand the solution.

Any suggestion?

Last edited by alessio_demarchi on Tue Sep 01, 2020 8:58 am; edited 1 time in total

Back to top

View user's profile Send private message

eccerr0r
Watchman
Watchman

Joined: 01 Jul 2004
Posts: 9221
Location: almost Mile High in the USA

PostPosted: Sat Aug 29, 2020 3:19 pm    Post subject: Reply with quote

How are you configuring your grub?

What file did you use for your kernel and initramfs?
_________________
Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD

What am I supposed watching?
Back to top

View user's profile Send private message

Whissi
Retired Dev
Retired Dev

Joined: 12 Jan 2011
Posts: 222

PostPosted: Sat Aug 29, 2020 3:31 pm    Post subject: Reply with quote

Which genkernel version are you using? If you are using genkernel-4.1.1, please upgrade to 4.1.2 and retry.
_________________
Regards,

Whissi
Back to top

View user's profile Send private message

alessio_demarchi
n00b
n00b

Joined: 03 Nov 2012
Posts: 36

PostPosted: Sun Aug 30, 2020 10:46 am    Post subject: Reply with quote

My grub is configured to load initram and kernel generated by genkernel.

genkernel is the version 4.1.0-r2

I use to move generated kernel and initramfs files in tree directory from /boot:

old (previous compiled kernel files)

default (actual functioning kernel)

test (new kernel)

in each directory there is:

vmlinuz-genkernel-x86_64-<version>

initramfs-genkernel-x86_64-<version>

Systemmap-genkernel-<version>.map

kernel-config-<version>

in /boot directory I create two group of symbolik link:

initramfs-x86_64-1_old -> linked to initramfs in old directory

initramfs-x86_64-2_tst -> linked to initramfs in test directory

initramfs-x86_64-3_dfl -> linked to initramfs in default directory

kernel-x86_64-1_old, 2_tst, 3_dfl with the same philosophy as the previous tree link

System.map linked to default directory System.map

My system is my working laptop, and is running since 4 years ago with gentoo (dell precision M4800)

Thanks a lot for your replies

Back to top

View user's profile Send private message

Tony0945
Watchman
Watchman

Joined: 25 Jul 2006
Posts: 5127
Location: Illinois, USA

PostPosted: Sun Aug 30, 2020 1:50 pm    Post subject: Reply with quote

All of that can be automated with a script, eliminating mistakes in typing.

IIRC genkernel will update grub for you, so your script needn’t do that.

I always recommend enabling IKCONFIG IKCONFIG_PROC in the kernel so that the running configuration can be retrieved unambiguously.
Back to top

View user's profile Send private message

alessio_demarchi
n00b
n00b

Joined: 03 Nov 2012
Posts: 36

PostPosted: Sun Aug 30, 2020 2:45 pm    Post subject: Reply with quote

Now I have tried to recompile my kernel with genkernel-4.1.2, but the result not changed.
Back to top

View user's profile Send private message

Whissi
Retired Dev
Retired Dev

Joined: 12 Jan 2011
Posts: 222

PostPosted: Sun Aug 30, 2020 3:25 pm    Post subject: Reply with quote

Do you build kernel and initramfs with genkernel or do you build kernel manually? Please also show /var/log/genkernel.log…

Get a debug shell in genkernel and run «gksosreport» and show us that file.
_________________
Regards,

Whissi

Back to top

View user's profile Send private message

alessio_demarchi
n00b
n00b

Joined: 03 Nov 2012
Posts: 36

PostPosted: Mon Aug 31, 2020 9:15 am    Post subject: Reply with quote

I build all with genkernel.

How can I show you genkernel.log (it is very huge)

Back to top

View user's profile Send private message

Whissi
Retired Dev
Retired Dev

Joined: 12 Jan 2011
Posts: 222

PostPosted: Mon Aug 31, 2020 11:39 am    Post subject: Reply with quote

Use services like https://transfer.sh/
_________________
Regards,

Whissi
Back to top

View user's profile Send private message

alessio_demarchi
n00b
n00b

Joined: 03 Nov 2012
Posts: 36

PostPosted: Mon Aug 31, 2020 2:07 pm    Post subject: Reply with quote

Ok

I used transfer.sh

The link is

https://transfer.sh/%28/Q385Q/genkernel.log%29.tar.gz

thanks

Back to top

View user's profile Send private message

Whissi
Retired Dev
Retired Dev

Joined: 12 Jan 2011
Posts: 222

PostPosted: Mon Aug 31, 2020 5:13 pm    Post subject: Reply with quote

First, genkernel.log is not really the interesting log file in your case for now because generation didn’t fail for you.

Quote:
Using the same configuration (I have copied .config of the older kernel in new source directory and run «make syncconf») I have compiled today the new source 5.4.60.

This is wrong. Please read how genkernel determines kernel.config it will use. If you start building a new KV (=when upgrading kernel sources), pay attention to used kernel config. I recommend to always pass kernel config via parameter (—kernel-confog=/path/to/desired/kernel.config). This way you can be sure that nothing unexpected will happen (hint: If new kernel should be based on current running kernel, just use —kernel-config=/proc/config.gz).

If you really did what you wrote in your first posting, i.e. installed new kernel sources, copied any existing kernel.config into that directory and run an arbitrary command in that directory… on next genkernel run, this kernel.config (=/usr/src/linux/.config) will be ignored by default and genkernel will look for kernel.config based on set heuristic (determining KV based on set kernel sources, looking in /etc/kernels/ for an already existing kernel.config for that version… when building a new KV for the first time, a kernel.config for this KV usually doesn’t exist yet so genkernel will fall back to its generic kernel.config).

So please notice that shown genkernel.log shows

Quote:
* Using kernel config file ‘/etc/kernels/kernel-config-5.4.60-gentoo-x86_64’ …

which means that something had created a config in there. This doesn’t match your story. Please verify…

  • Rebuild kernel and initramfs with «genkernel all» and ensure that your desired kernel.config was used for that run (—kernel-config=/proc/config.gz)
  • If genkernel-4.1.2 initramfs will be still unable to boot, get a shell in that environment and run «gksosreport» — attach this file to this thread like you did with genkernel.log

_________________
Regards,

Whissi

Back to top

View user's profile Send private message

alessio_demarchi
n00b
n00b

Joined: 03 Nov 2012
Posts: 36

PostPosted: Mon Aug 31, 2020 6:21 pm    Post subject: Reply with quote

Thanks Whissi

The method I used for configuring new kernel from previous kernel version source is explained in Gentoo wiki for kernel update (probably my english is not so good, and my explaination is not correct).

Typically I using genkernel —xconfig —clean all and I always check basic kernel configuration before compilation phase, and it seems to be correct.

I think the problem is not in initramfs file, but in vmlinuz. How can I run gksosreport, it is not and application installed in my system.

Now I try to run genkernel —kernel-config=/proc/config.gz all and then I try to reboot my system.

Back to top

View user's profile Send private message

Whissi
Retired Dev
Retired Dev

Joined: 12 Jan 2011
Posts: 222

PostPosted: Mon Aug 31, 2020 6:46 pm    Post subject: Reply with quote

«gksosreport» is part of genkernel’s initramfs. I.e. in case genkernel’s initramfs will fail to boot your system you can start a rescue shell and call that command.
_________________
Regards,

Whissi
Back to top

View user's profile Send private message

alessio_demarchi
n00b
n00b

Joined: 03 Nov 2012
Posts: 36

PostPosted: Mon Aug 31, 2020 6:48 pm    Post subject: Reply with quote

I try new kernel generated by genkernel —kernel-config=/proc/config.gz all, but nothing change

I think the problem is in vmlinuz, initramfs is not loaded, so I can’t run gksosreport.

The message reported at boot is:

Loading Linux x86_64-3_dfl …

error: invalid magic number

Loading initial ramdisk …

error: you need to load the kernel first.

Press any key to continue…

Last edited by alessio_demarchi on Mon Aug 31, 2020 6:51 pm; edited 1 time in total

Back to top

View user's profile Send private message

Whissi
Retired Dev
Retired Dev

Joined: 12 Jan 2011
Posts: 222

PostPosted: Mon Aug 31, 2020 6:50 pm    Post subject: Reply with quote

Which bootloader are you using? For grub, please show us /boot/grub/grub.cfg…
_________________
Regards,

Whissi
Back to top

View user's profile Send private message

alessio_demarchi
n00b
n00b

Joined: 03 Nov 2012
Posts: 36

PostPosted: Mon Aug 31, 2020 6:54 pm    Post subject: Reply with quote

I use grub2

this is my grub.cfg https://transfer.sh/%28%29.tar.gz

Back to top

View user's profile Send private message

Whissi
Retired Dev
Retired Dev

Joined: 12 Jan 2011
Posts: 222

PostPosted: Mon Aug 31, 2020 6:55 pm    Post subject: Reply with quote

That tar file is empty.
_________________
Regards,

Whissi
Back to top

View user's profile Send private message

alessio_demarchi
n00b
n00b

Joined: 03 Nov 2012
Posts: 36

PostPosted: Mon Aug 31, 2020 7:12 pm    Post subject: Reply with quote

Sorry

permission problem….

Try this

https://transfer.sh/%28%29.tar.gz

Back to top

View user's profile Send private message

alessio_demarchi
n00b
n00b

Joined: 03 Nov 2012
Posts: 36

PostPosted: Mon Aug 31, 2020 7:14 pm    Post subject: Reply with quote

#

# DO NOT EDIT THIS FILE

#

# It is automatically generated by grub-mkconfig using templates

# from /etc/grub.d and settings from /etc/default/grub

#

### BEGIN /etc/grub.d/00_header ###

if [ -s $prefix/grubenv ]; then

load_env

fi

if [ «${next_entry}» ] ; then

set default=»${next_entry}»

set next_entry=

save_env next_entry

set boot_once=true

else

set default=»${saved_entry}»

fi

if [ x»${feature_menuentry_id}» = xy ]; then

menuentry_id_option=»—id»

else

menuentry_id_option=»»

fi

export menuentry_id_option

if [ «${prev_saved_entry}» ]; then

set saved_entry=»${prev_saved_entry}»

save_env saved_entry

set prev_saved_entry=

save_env prev_saved_entry

set boot_once=true

fi

function savedefault {

if [ -z «${boot_once}» ]; then

saved_entry=»${chosen}»

save_env saved_entry

fi

}

function load_video {

if [ x$feature_all_video_module = xy ]; then

insmod all_video

else

insmod efi_gop

insmod efi_uga

insmod ieee1275_fb

insmod vbe

insmod vga

insmod video_bochs

insmod video_cirrus

fi

}

if [ x$feature_default_font_path = xy ] ; then

font=unicode

else

insmod part_msdos

insmod jfs

set root=’hd0,msdos7′

if [ x$feature_platform_search_hint = xy ]; then

search —no-floppy —fs-uuid —set=root —hint-bios=hd0,msdos7 —hint-efi=hd0,msdos7 —hint-baremetal=ahci0,msdos7 3e5f2da8-79d5-4cff-99cc-5fcc68cfa006

else

search —no-floppy —fs-uuid —set=root 3e5f2da8-79d5-4cff-99cc-5fcc68cfa006

fi

font=»/usr/share/grub/unicode.pf2″

fi

if loadfont $font ; then

set gfxmode=1920×1080,1440×900,1280×800,1024×600,auto

load_video

insmod gfxterm

set locale_dir=$prefix/locale

set lang=en_US

insmod gettext

fi

terminal_output gfxterm

insmod part_msdos

insmod ext2

set root=’hd0,msdos6′

if [ x$feature_platform_search_hint = xy ]; then

search —no-floppy —fs-uuid —set=root —hint-bios=hd0,msdos6 —hint-efi=hd0,msdos6 —hint-baremetal=ahci0,msdos6 48f55fb2-f9e9-404c-9916-8a1c09ab9030

else

search —no-floppy —fs-uuid —set=root 48f55fb2-f9e9-404c-9916-8a1c09ab9030

fi

insmod png

background_image -m stretch /grub/mybackground.png

if [ x$feature_timeout_style = xy ] ; then

set timeout_style=menu

set timeout=3

# Fallback normal timeout code in case the timeout_style feature is

# unavailable.

else

set timeout=3

fi

### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/10_linux ###

menuentry ‘Gentoo GNU/Linux’ —class gentoo —class gnu-linux —class gnu —class os $menuentry_id_option ‘gnulinux-simple-3e5f2da8-79d5-4cff-99cc-5fcc68cfa006’ {

savedefault

load_video

set gfxpayload=keep

insmod gzio

insmod part_msdos

insmod ext2

set root=’hd0,msdos6′

if [ x$feature_platform_search_hint = xy ]; then

search —no-floppy —fs-uuid —set=root —hint-bios=hd0,msdos6 —hint-efi=hd0,msdos6 —hint-baremetal=ahci0,msdos6 48f55fb2-f9e9-404c-9916-8a1c09ab9030

else

search —no-floppy —fs-uuid —set=root 48f55fb2-f9e9-404c-9916-8a1c09ab9030

fi

echo ‘Loading Linux x86_64-3_dfl …’

linux /kernel-genkernel-x86_64-3_dfl root=UUID=3e5f2da8-79d5-4cff-99cc-5fcc68cfa006 ro resume=/dev/sda5 quiet splash

echo ‘Loading initial ramdisk …’

initrd /initramfs-genkernel-x86_64-3_dfl

}

submenu ‘Advanced options for Gentoo GNU/Linux’ $menuentry_id_option ‘gnulinux-advanced-3e5f2da8-79d5-4cff-99cc-5fcc68cfa006’ {

menuentry ‘Gentoo GNU/Linux, with Linux x86_64-3_dfl’ —class gentoo —class gnu-linux —class gnu —class os $menuentry_id_option ‘gnulinux-x86_64-3_dfl-advanced-3e5f2da8-79d5-4cff-99cc-5fcc68cfa006’ {

savedefault

load_video

set gfxpayload=keep

insmod gzio

insmod part_msdos

insmod ext2

set root=’hd0,msdos6′

if [ x$feature_platform_search_hint = xy ]; then

search —no-floppy —fs-uuid —set=root —hint-bios=hd0,msdos6 —hint-efi=hd0,msdos6 —hint-baremetal=ahci0,msdos6 48f55fb2-f9e9-404c-9916-8a1c09ab9030

else

search —no-floppy —fs-uuid —set=root 48f55fb2-f9e9-404c-9916-8a1c09ab9030

fi

echo ‘Loading Linux x86_64-3_dfl …’

linux /kernel-genkernel-x86_64-3_dfl root=UUID=3e5f2da8-79d5-4cff-99cc-5fcc68cfa006 ro resume=/dev/sda5 quiet splash

echo ‘Loading initial ramdisk …’

initrd /initramfs-genkernel-x86_64-3_dfl

}

menuentry ‘Gentoo GNU/Linux, with Linux x86_64-3_dfl (recovery mode)’ —class gentoo —class gnu-linux —class gnu —class os $menuentry_id_option ‘gnulinux-x86_64-3_dfl-recovery-3e5f2da8-79d5-4cff-99cc-5fcc68cfa006’ {

load_video

set gfxpayload=keep

insmod gzio

insmod part_msdos

insmod ext2

set root=’hd0,msdos6′

if [ x$feature_platform_search_hint = xy ]; then

search —no-floppy —fs-uuid —set=root —hint-bios=hd0,msdos6 —hint-efi=hd0,msdos6 —hint-baremetal=ahci0,msdos6 48f55fb2-f9e9-404c-9916-8a1c09ab9030

else

search —no-floppy —fs-uuid —set=root 48f55fb2-f9e9-404c-9916-8a1c09ab9030

fi

echo ‘Loading Linux x86_64-3_dfl …’

linux /kernel-genkernel-x86_64-3_dfl root=UUID=3e5f2da8-79d5-4cff-99cc-5fcc68cfa006 ro single resume=/dev/sda5

echo ‘Loading initial ramdisk …’

initrd /initramfs-genkernel-x86_64-3_dfl

}

menuentry ‘Gentoo GNU/Linux, with Linux x86_64-2_tst’ —class gentoo —class gnu-linux —class gnu —class os $menuentry_id_option ‘gnulinux-x86_64-2_tst-advanced-3e5f2da8-79d5-4cff-99cc-5fcc68cfa006’ {

savedefault

load_video

set gfxpayload=keep

insmod gzio

insmod part_msdos

insmod ext2

set root=’hd0,msdos6′

if [ x$feature_platform_search_hint = xy ]; then

search —no-floppy —fs-uuid —set=root —hint-bios=hd0,msdos6 —hint-efi=hd0,msdos6 —hint-baremetal=ahci0,msdos6 48f55fb2-f9e9-404c-9916-8a1c09ab9030

else

search —no-floppy —fs-uuid —set=root 48f55fb2-f9e9-404c-9916-8a1c09ab9030

fi

echo ‘Loading Linux x86_64-2_tst …’

linux /kernel-genkernel-x86_64-2_tst root=UUID=3e5f2da8-79d5-4cff-99cc-5fcc68cfa006 ro resume=/dev/sda5 quiet splash

echo ‘Loading initial ramdisk …’

initrd /initramfs-genkernel-x86_64-2_tst

}

menuentry ‘Gentoo GNU/Linux, with Linux x86_64-2_tst (recovery mode)’ —class gentoo —class gnu-linux —class gnu —class os $menuentry_id_option ‘gnulinux-x86_64-2_tst-recovery-3e5f2da8-79d5-4cff-99cc-5fcc68cfa006’ {

load_video

set gfxpayload=keep

insmod gzio

insmod part_msdos

insmod ext2

set root=’hd0,msdos6′

if [ x$feature_platform_search_hint = xy ]; then

search —no-floppy —fs-uuid —set=root —hint-bios=hd0,msdos6 —hint-efi=hd0,msdos6 —hint-baremetal=ahci0,msdos6 48f55fb2-f9e9-404c-9916-8a1c09ab9030

else

search —no-floppy —fs-uuid —set=root 48f55fb2-f9e9-404c-9916-8a1c09ab9030

fi

echo ‘Loading Linux x86_64-2_tst …’

linux /kernel-genkernel-x86_64-2_tst root=UUID=3e5f2da8-79d5-4cff-99cc-5fcc68cfa006 ro single resume=/dev/sda5

echo ‘Loading initial ramdisk …’

initrd /initramfs-genkernel-x86_64-2_tst

}

menuentry ‘Gentoo GNU/Linux, with Linux x86_64-1_old’ —class gentoo —class gnu-linux —class gnu —class os $menuentry_id_option ‘gnulinux-x86_64-1_old-advanced-3e5f2da8-79d5-4cff-99cc-5fcc68cfa006’ {

savedefault

load_video

set gfxpayload=keep

insmod gzio

insmod part_msdos

insmod ext2

set root=’hd0,msdos6′

if [ x$feature_platform_search_hint = xy ]; then

search —no-floppy —fs-uuid —set=root —hint-bios=hd0,msdos6 —hint-efi=hd0,msdos6 —hint-baremetal=ahci0,msdos6 48f55fb2-f9e9-404c-9916-8a1c09ab9030

else

search —no-floppy —fs-uuid —set=root 48f55fb2-f9e9-404c-9916-8a1c09ab9030

fi

echo ‘Loading Linux x86_64-1_old …’

linux /kernel-genkernel-x86_64-1_old root=UUID=3e5f2da8-79d5-4cff-99cc-5fcc68cfa006 ro resume=/dev/sda5 quiet splash

echo ‘Loading initial ramdisk …’

initrd /initramfs-genkernel-x86_64-1_old

}

menuentry ‘Gentoo GNU/Linux, with Linux x86_64-1_old (recovery mode)’ —class gentoo —class gnu-linux —class gnu —class os $menuentry_id_option ‘gnulinux-x86_64-1_old-recovery-3e5f2da8-79d5-4cff-99cc-5fcc68cfa006’ {

load_video

set gfxpayload=keep

insmod gzio

insmod part_msdos

insmod ext2

set root=’hd0,msdos6′

if [ x$feature_platform_search_hint = xy ]; then

search —no-floppy —fs-uuid —set=root —hint-bios=hd0,msdos6 —hint-efi=hd0,msdos6 —hint-baremetal=ahci0,msdos6 48f55fb2-f9e9-404c-9916-8a1c09ab9030

else

search —no-floppy —fs-uuid —set=root 48f55fb2-f9e9-404c-9916-8a1c09ab9030

fi

echo ‘Loading Linux x86_64-1_old …’

linux /kernel-genkernel-x86_64-1_old root=UUID=3e5f2da8-79d5-4cff-99cc-5fcc68cfa006 ro single resume=/dev/sda5

echo ‘Loading initial ramdisk …’

initrd /initramfs-genkernel-x86_64-1_old

}

}

### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_linux_xen ###

### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/30_os-prober ###

menuentry ‘Windows 10 (on /dev/sda2)’ —class windows —class os $menuentry_id_option ‘osprober-chain-AE52157E52154C89’ {

savedefault

insmod part_msdos

insmod ntfs

set root=’hd0,msdos2′

if [ x$feature_platform_search_hint = xy ]; then

search —no-floppy —fs-uuid —set=root —hint-bios=hd0,msdos2 —hint-efi=hd0,msdos2 —hint-baremetal=ahci0,msdos2 AE52157E52154C89

else

search —no-floppy —fs-uuid —set=root AE52157E52154C89

fi

parttool ${root} hidden-

drivemap -s (hd0) ${root}

chainloader +1

}

### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/40_custom ###

# This file provides an easy way to add custom menu entries. Simply type the

# menu entries you want to add after this comment. Be careful not to change

# the ‘exec tail’ line above.

### END /etc/grub.d/40_custom ###

### BEGIN /etc/grub.d/41_custom ###

if [ -f ${config_directory}/custom.cfg ]; then

source ${config_directory}/custom.cfg

elif [ -z «${config_directory}» -a -f $prefix/custom.cfg ]; then

source $prefix/custom.cfg;

fi

### END /etc/grub.d/41_custom ###

Back to top

View user's profile Send private message

Whissi
Retired Dev
Retired Dev

Joined: 12 Jan 2011
Posts: 222

PostPosted: Mon Aug 31, 2020 7:18 pm    Post subject: Reply with quote

Note: In your first posting you mentioned

Quote:
vmlinuz-genkernel-x86_64-<version>

initramfs-genkernel-x86_64-<version>

Systemmap-genkernel-<version>.map

kernel-config-<version>

These are custom names.

The shown genkernel.log also shows that you created

Code:
/boot/initramfs-5.4.60-gentoo-x86_64.img

Your shown grub.cfg doesn’t use that name schema.

I would suggest cleaning up /boot and re-run

Code:
grub-mkconfig -o /boot/grub/grub.cfg

. Please double check before reboot that grub.cfg will contain an entry using initramfs-5.4.60-gentoo-x86_64.img and corresponding kernel.
_________________
Regards,

Whissi

Back to top

View user's profile Send private message

alessio_demarchi
n00b
n00b

Joined: 03 Nov 2012
Posts: 36

PostPosted: Mon Aug 31, 2020 7:23 pm    Post subject: Reply with quote

Sorry

In my first post I used a simplified sintax. The filenames are correct in grub.cfg.

I tried command that you suggest before opening this post

The filename that compare in grub.cfg are symbolik link to initramfs-genkernel-<version>.img and corresponding kernel file

I don’t know if it is usefull, this is my actual /boot directory:

drwxr-xr-x 2 root root 4096 Aug 31 21:15 default

drwxr-xr-x 6 root root 4096 Aug 29 13:05 grub

lrwxrwxrwx 1 root root 38 Aug 28 19:15 initramfs-genkernel-x86_64-1_old -> old/initramfs-5.4.48-gentoo-x86_64.img

lrwxrwxrwx 1 root root 39 Jul 17 11:22 initramfs-genkernel-x86_64-2_tst -> test/initramfs-5.4.48-gentoo-x86_64.img

lrwxrwxrwx 1 root root 42 Aug 28 19:43 initramfs-genkernel-x86_64-3_dfl -> default/initramfs-5.4.60-gentoo-x86_64.img

lrwxrwxrwx 1 root root 32 Aug 28 19:15 kernel-genkernel-x86_64-1_old -> old/vmlinuz-5.4.48-gentoo-x86_64

lrwxrwxrwx 1 root root 33 Jul 17 11:22 kernel-genkernel-x86_64-2_tst -> test/vmlinuz-5.4.48-gentoo-x86_64

lrwxrwxrwx 1 root root 42 Aug 28 19:43 kernel-genkernel-x86_64-3_dfl -> default/kernel-config-5.4.60-gentoo-x86_64

drwxr-xr-x 2 root root 4096 Aug 28 19:14 old

lrwxrwxrwx 1 root root 39 Aug 28 19:43 System.map -> default/System.map-5.4.60-gentoo-x86_64

drwxr-xr-x 2 root root 4096 Jul 17 11:23 test

Back to top

View user's profile Send private message

Whissi
Retired Dev
Retired Dev

Joined: 12 Jan 2011
Posts: 222

PostPosted: Mon Aug 31, 2020 8:39 pm    Post subject: Reply with quote

I am kind of lost here. Don’t get me wrong here but you are doing advanced stuff and I am not sure you understand what you are doing. I cannot help you with that.

All I can tell you:

If you manage to get genkernel’s initramfs loaded (you will see that on boot when initramfs will print you name and version) and it will fail, genkernel’s initramfs will offer you to enter rescue shell. If you enter rescue shell you can use «gksosreport» to get further help. If you don’t see such a prompt that is another indicator that you don’t use genkernel’s initramfs.

But at the moment it sounds like your problem is that you do not boot genkernel’s initramfs at all so this is not a genkernel problem.

So I recommend you to go back one step and follow handbook step by step. Build both, kernel and initramfs with genkernel (genkernell —kernel-config=/path/to/your/desired/kernel.config all) and tell bootloader to boot that image and initramfs. I am pretty sure that this will work when you use a working kernel config (for example /proc/config.gz from current running kernel).
_________________
Regards,

Whissi

Back to top

View user's profile Send private message

alessio_demarchi
n00b
n00b

Joined: 03 Nov 2012
Posts: 36

PostPosted: Tue Sep 01, 2020 8:15 am    Post subject: Reply with quote

Sorry Whissi. You have to be patience with me. I’m an old linux users (it is since 1994 that I recompile linux kernel source as hobbyist user), and a lot my solution it is not so «classical», but trust me, all are running and functional.

My problem is not in initramfs, initramfs is not loaded because vmlinuz (loaded before initramfs) is not recognized as right kernel file.

I don’t know why.

If I run «file /boot/default/vmlinuz…» this is the result:

# file /boot/default/vmlinuz-5.4.60-gentoo-x86_64

/boot/default/vmlinuz-5.4.60-gentoo-x86_64: Linux kernel x86 boot executable bzImage, version 5.4.60-gentoo-x86_64 (root@ganimede) #1 SMP PREEMPT Mon Aug 31 20:59:27 CEST 2020, RO-rootFS, swap_dev 0x6, Normal VGA

Now I try to clear my /boot partition (all link and directory old, test and default), launch your suggested command (genkernel —kernel-config=/proc/config.gz all) then grub-mkconfig -o /boot/grub.cfg and then reboot my system.

wait a moment and then I write the result

Last edited by alessio_demarchi on Tue Sep 01, 2020 8:44 am; edited 1 time in total

Back to top

View user's profile Send private message

alessio_demarchi
n00b
n00b

Joined: 03 Nov 2012
Posts: 36

PostPosted: Tue Sep 01, 2020 8:43 am    Post subject: [solved] Reply with quote

Ok.

I don’t know why, but now it is working.

I have cleared my /boot directory (copied my old functioning kernels file), copy /boot/default/vmlinuz…, initramfs.. and System.map-genkernel.. in /boot.

Run grub-mkconfig -o /boot/grub/grub.cfg

Reboot.

And now my new kernel is running.

Whissi thank a lot. For your patience and competence.

How can I mark as solved this topic?

Back to top

View user's profile Send private message

Whissi
Retired Dev
Retired Dev

Joined: 12 Jan 2011
Posts: 222

PostPosted: Tue Sep 01, 2020 8:51 am    Post subject: Reply with quote

Glad you sorted the issue.

Next to your first posting you should find an «EDIT» button which will allow you to change title to add «SOLVED» I think.
_________________
Regards,

Whissi

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

  • Печать

Страницы: [1] 2  Все   Вниз

Тема: После пропажи напряжения не грузится система  (Прочитано 3435 раз)

0 Пользователей и 1 Гость просматривают эту тему.

Оффлайн
bobrovsky

Здравствуйте!
После пропажи напряжения система выдает ошибки(первая картинка) и появляется окно загрузчика. Нажимаю «е», заходит в меню(вторая картинка), удаляю вручную recordfail и нажимаю ctrl+x, система начинает снова грузиться и выдает ошибки, но всего две: «error:invalid magic number», «error:you need to load the kernel first».
Пробовал нажимать «с» и писать в консоле ls: пишет (hd0) (hd0,msdos1)
Помогите запустить систему без livecd, сижу почти без интернета.

Система Ubuntu 14.03lts

https://cloud.mail.ru/public/5spS/krpssGBPq

https://cloud.mail.ru/public/5Bs6/vX3guLdK4

UPD: Как я понял, то дело в какой-то неисправности ядро. Выход-установить новую систему или попробовать восстановиться через LiveCD.

« Последнее редактирование: 26 Ноября 2015, 12:37:14 от bobrovsky »


Оффлайн
alecsartania

Ну как минимум надо грузится с Livecd и оттуда отчекать загрузочный раздел.

Дома Linux Mint 20.1 / 20.02


Оффлайн
bobrovsky

Получается что-то потерялось на жестком :'(
Как я понял загрузчик в порядке, навернулся образ. Вообще без вариантов livecd нужен?
Не сталкивался еще с загрузочным разделом, так и искать в поиске «восстановление загрузочного раздела»?


Оффлайн
Виктор Перестукин


Оффлайн
bobrovsky

В качестве эксперимента пробовал. Система загрузилась. Хорошая статья:
http://www.lexpr.ru/node/413

Проходил раннее по ссылке, верхнюю часть статью выполнял, он показывает при вводе ls только:
(hd0) (hd0,msdos1)
Но это, думаю, ничего особо не означает(возможно, что у меня все на одном разделе?)

Потом попробовал так:

set root=(hd0,1)
linux /boot/vmlinuz root=/dev/sda1
(выбрав в строке linux табуляцией продолжение фразы vmlinuz)

и консоль сразу пишет invalid magic number

Что-то не нашел в сети какой смысл этой фразы в данном случае.


Оффлайн
БТР

bobrovsky, загрузись с LiveCD и проверь файловую систему, потом попробуй смонтировать и посмотреть, что на ней есть.


Оффлайн
bobrovsky

bobrovsky, загрузись с LiveCD и проверь файловую систему, потом попробуй смонтировать и посмотреть, что на ней есть.

Дело в том, что livecd нет, объект удаленный и интернета нет.


Оффлайн
Sly_tom_cat

объект удаленный и интернета нет.

расшифруй.


Оффлайн
bobrovsky

объект удаленный и интернета нет.

расшифруй.

Физически банка(типа тонкий клиент) находится на севере, на объекте. Связь телефонная с коллегой, передача инструкций такая же, еще по смс. Там бывает интернет, но не всегда и плохой.


Оффлайн
Виктор Перестукин

У меня всё загрузилось:

set root=(hd0,1)
linux /vmlinuz root=/dev/sda1 ro
initrd /initrd.img
boot

Lubuntu 14.04 на Virtualbox


Оффлайн
bobrovsky


Оффлайн
Виктор Перестукин

Оставьте просто vmlinuz — это ссылка.

PS
да ещё «ro» забыли.


alex_ander

а режим восстановления в груб работает?


Оффлайн
bobrovsky

Оставьте просто vmlinuz — это ссылка.

PS
да ещё «ro» забыли.

Попробовал, не получается. При вводе второй строки и нажатии Enter появляется сообщение об ошибке
error: invalid magic number

а режим восстановления в груб работает?

Нет, не работает. При выборе его из меню появляются те же ошибки, но только со знаками вопроса на конце


alex_ander

с более старого ядра загрузиться? если есть конечно


  • Печать

Страницы: [1] 2  Все   Вверх

Actually I doubt this has anything to do with kernel modules. As it seems the kernel itself is being refered to as a module. It is possible the kernel got built incorrectly or is being loaded incorrectly possibly from the grub commandline.

http://forums.gentoo.org/viewtopic-t-932358-start-0.html try that.

It is possible that some file in the kernel build didn’t get cleaned up properly an so has incorrect data in it since any changes you made in a previous attempt at building it.

Also do note that the x86 images will end up at arch/x86_64/boot/bzImage or arch/x86/boot/bzImage inside the kernel source make sure you actually have copied the kernel itself and not some other incorrect file.

If that fails try grub 1.x as its simpler to use than grub 2.x just note that alot of things are different and you should read tutorials for the correct version of grub. Often grub 1.x will be in a grub-legacy or similar package depending on the distro.

Edit: If you are building your kernel for your hardware only… do not use an initramfs its overkill. There are places you would want to do this is if your system is incapable of loading a kernel large enough for essential drivers (sparc for instance is very limited in kernel image size). another being booting over network possibly but by and large it isn’t needed. If you must use an initramfs get your kernel build working without it first.

Also personally I build my kernel with essential drivers included (disk and filesystem basically) and build it with.

make mrproper (save/backup your .config first) ; 
make menuconfig ; 
make -j8 ; 
make modules_install ; 
cp arch/x86_64/boot/bzImage /boot/linux-3.7.1 ; 

(modify grub to boot the new kernel) and im done and ready to reboot.

Any chance you could attach a screenshot of the failure?

Понравилась статья? Поделить с друзьями:
  • Error invalid left hand side in assignment maple
  • Error invalid language selected кузя жукодром
  • Error invalid key required
  • Error invalid json rpc response
  • Error invalid item in proxylist section