The OS with Ubuntu 20.04.3 LTS Desktop 64-bit
is located in the gpt2 partition with the filesystem NTFS.
This is the structure of the gpt1 partition with the filesystem FAT32:
.
├── boot
│ └── grub
│ └── grub.cfg
└── efi
└── boot
├── bootx64.efi
├── grubx64.efi
└── mmx64.efi
4 directories, 4 files
This is the grub menù of the NTFS partition (default grub.cfg):
if loadfont /boot/grub/font.pf2 ; then
set gfxmode=auto
insmod efi_gop
insmod efi_uga
insmod gfxterm
terminal_output gfxterm
fi
set menu_color_normal=white/black
set menu_color_highlight=black/light-gray
set timeout=5
menuentry "Ubuntu" {
set gfxpayload=keep
linux /casper/vmlinuz file=/cdrom/preseed/ubuntu.seed maybe-ubiquity quiet splash ---
initrd /casper/initrd
}
menuentry "Ubuntu (safe graphics)" {
set gfxpayload=keep
linux /casper/vmlinuz file=/cdrom/preseed/ubuntu.seed maybe-ubiquity quiet splash nomodeset ---
initrd /casper/initrd
}
menuentry "OEM install (for manufacturers)" {
set gfxpayload=keep
linux /casper/vmlinuz file=/cdrom/preseed/ubuntu.seed only-ubiquity quiet splash oem-config/enable=true ---
initrd /casper/initrd
}
grub_platform
if [ "$grub_platform" = "efi" ]; then
menuentry 'Boot from next volume' {
exit 1
}
menuentry 'UEFI Firmware Settings' {
fwsetup
}
fi
If the grub.cfg file (FAT32 partition) contains:
search --no-floppy --set=root --fs-uuid 2E92F36515DD4A5A
chainloader /EFI/BOOT/BOOTx64.EFI
boot
After making a choice from the grub selection menu, placed in the default grub.cfg file (NTFS partition) which is the same as the default contained within an iso image of Ubuntu 20.04.3 LTS Desktop 64-bit
, the error message appears:
error: can't allocate initrd.
Press any key to continue...
I have to underline that the NTFS partition bootloader starts correctly with the chainloader
command, otherwise I would not have seen the grub selection menu, it is the initrd
command that gives an error.
If instead the grub.cfg file (FAT32 partition) contains:
search --no-floppy --set=root --fs-uuid 2E92F36515DD4A5A
configfile /boot/grub/grub.cfg
After the selection menu, everything works correctly, therefore the initrd command no longer gives an error.
What's wrong with running the NTFS partition bootloader to boot initrd
using the default grub.cfg file inside it?
I have tested that if partition 2 has Windows, using chainloader
everything works correctly.
UPDATE 1:
I tried to swap partitions, the error persists.
UPDATE 2:
I would like to get more detailed error output from the initrd
command but I don't know how to do it.
I have tried
linux /casper/vmlinuz file=/cdrom/preseed/ubuntu.seed nosplash debug ignore_loglevel ---
initrd /casper/initrd
but the error output is still the same, no rows added.
UPDATE 3:
Summarizing and clarifying what I am going to do, I from the partition with FAT32 do the chainload of the bootloader located on the NTFS partition.
If I boot the NTFS partition directly from BIOS, everything works, if instead I chainload starting from the FAT32 partition, problems appear.
Everything works correctly even if I call the menu of the grub.cfg (NTFS partition) using the configfile
command rather than the chainloader
command inside the grub.cfg
file of the FAT32 partition, of which I have already shown the lines it contains.
UPDATE 4:
I am going to use the chainloader
command anyway for generalization reasons, even being able to use the configfile
command that would solve the problem, because I would have the possibility to execute the same command both to start a partition with Windows and Ubuntu.
UPDATE 5:
The ntfs
module is already built into the bootloader of both partitions. The lsmod
command confirmed this. In any case I have tried to insert insmod ntfs
in the grub.cfg
files of both partitions and, as expected, the error does not change.
UPDATE 6:
I don't boot NTFS partition directly from BIOS, because UEFI on older computers cannot read NTFS directly.
UPDATE 7:
I HAVE DISCOVERED AN ERROR! Before I didn't notice it because it lasts a fraction of a second. But with a video from the phone, which I had to set to 60 fps to be able to catch the error, I recorded it, then took it to the PC, from the PC I took a screenshot of that video fragment, then rotated it and cropped with gimp.
The error is as follows:
error: can't find command `grub_platform`.
Here is the screenshot:
menuentry
in the grub.cfg? is there anything else in the menuentry? – Esther Mar 28 '22 at 17:54/efi/boot/bootx64.efi
? Can you boot to the second partition directly from the BIOS? – Esther Mar 28 '22 at 18:06lsblk
and add to your question. There might be some details there. Also did you try running boot-repair? https://askubuntu.com/questions/1104855/how-to-make-grub-menu-appear-instead-grub-minimal-bash-like-in-booting/1105737#1105737 – WinEunuuchs2Unix Mar 28 '22 at 22:22grub.cfg
file that I showed, which is that of theFAT32
partition, does not contain the menu. Thegrub.cfg
that contains the menu, which is located in theNTFS
partition, I have not shown it, as it is the same as that of default contained within an iso image ofUbuntu 20.04 LTS Desktop 64-bit
. – Mario Palumbo Mar 29 '22 at 16:28initrd
on the Ubuntu system? – Esther Mar 29 '22 at 16:47debug
at the beginning of your grub.cfg on the first grub and in the menuentry of the second grub to see Grub debug messages. – Esther Mar 29 '22 at 17:41lsblk
in grub terminal buterror: can't find command 'lsblk'
. – Mario Palumbo Mar 31 '22 at 09:06nosplash debug
. If you want output from upstart too, add--verbose
". I addednosplash debug
and the output stays the same (ie it doesn't work) but i didn't understand where I can add--verbose
, the answer didn't explain anything. What is anupstart
? – Mario Palumbo Mar 31 '22 at 11:01linux /casper/vmlinuz file=/cdrom/preseed/ubuntu.seed nosplash debug ignore_loglevel ---
but the output is the same, no rows added. – Mario Palumbo Apr 01 '22 at 08:43cat /path/to/40_custom
file. – abu-ahmed al-khatiri Apr 01 '22 at 10:01grub.cfg
file present in theFAT32
partition. i not have40_custom
file. If you mean the content of grub.cfg, that is present in the question. – Mario Palumbo Apr 01 '22 at 10:05sudo update-grub
and then boot it again – abu-ahmed al-khatiri Apr 01 '22 at 11:08boot=casper quiet persistent
. – abu-ahmed al-khatiri Apr 01 '22 at 12:09boot=casper quiet persistent
in your grub?. – abu-ahmed al-khatiri Apr 01 '22 at 13:08