Modifying grub installer, to fix problem

Hello,

I tried to install recently EndeavourOS, but for no reason, auto installer (on any OS) fail at installing grub, i tried to modify files in /usr/lib/calamares/modules/bootloader/main.py, but during installation it looks like it goes back to normal making it impossible to modify. I would like to know if there is a way to modify it so i can add a flag to grub install, so it doesn’t bug?

Thanks a lot !
ArKrant ~

what is your system ?
is it an efi based systemn you cant install grub on?

Yes, trying to install endeavour-os from an usb-live.
EFI based with efi partitions etc,

But i know how to fix it, but i don’t know how to modify the main.py install to add the flag that miss to make it works :frowning:

Welcome @ArKrant,

If you are speaking to add the esp flag on the EFI, no need to format it, why You don’t make it with GParted from the live usb ?

1 Like

Hi,

Nah im talking about grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=EndeavourOS – force

and at the end of this line i would like to add “–removable” flag, (that’s usually how i make grub install works on any others OS, including arch)

i tried to add the flag in main.py (with --force), but files got (reset?) during installation process

you can possible also after install chroot intoo the system to do it manually.

May @fernandomaroto can give a hint?
https://github.com/endeavouros-team/Calamares_current/blob/master/src/modules/bootloader/main.py_add_recheck_remove_efi_directory
Looks like we do not use main.py

yes kinda tried to modify that calamares script to add the line i needed, but everytime it rollback to normal one. And i don’t know what happens after grub install (on the installer) since i fail at this part.

When triying to install arch/other os, had the same problems and looks like just adding this flag (–removable) works :confused:

that file was never tested and is not used yet, calamares in fact uses its original file from main.py.
What you can try is to edit main.py by the content of main.py_add_recheck_remove_efi_directory

That file need trials and errors in the code to see if calamares can handle the arch way to install grub. (it was my original idea, but real life takes too much time)

2 Likes

So modifying this :

    check_target_env_call([libcalamares.job.configuration["grubInstall"],
                           "--target=" + efi_target,
                           "--bootloader-id=" + efi_bootloader_id,
                           "--recheck",
                           "--force"])

to this

    check_target_env_call([libcalamares.job.configuration["grubInstall"],
                           "--target=" + efi_target,
                           "--bootloader-id=" + efi_bootloader_id,
                           "--recheck",
                           "--removable",
                           "--force"])

should works?

2 Likes

Maybe (we haven’t tested), if not, there are other options to try.
If you want to take a chance we can use your findings on this.

Possible options

Good candidate!

        check_target_env_call([libcalamares.job.configuration["grubInstall"],
                               "--target=" + efi_target,
                               "--bootloader-id=" + efi_bootloader_id,
                               "--recheck"])

OR

        check_target_env_call([libcalamares.job.configuration["grubInstall"],
                               "--target=" + efi_target,
                               "--bootloader-id=" + efi_bootloader_id,
                               "--recheck",
                               "--force"])
1 Like

Hi,

If i try to modify the files im getting this now :confused: if you have any idea

(changing files main.py with main.py_add_rechekc_remove_efi_directory’s content + adding “–removable” flag") @fernandomaroto

Screenshot_2019-11-03_03-08-11

@ArKrant What is it with the removable flag? Why are you trying to do this? Just curious. :thinking:

From experience, it’s the only way i found to install grub on my computer. There is maybe other solutions but with —removable flags it’s usually how i make things done

without the removable flag one of the options work?

If not, main.py can be “hacked” but will take more time to test.

Please notice that grub is the very last part installed using calamares, so if the install fails you can manually mount your partitions, chrooting and install grub following arch instructions. Then just unmount and reboot your system, should work.

This command had success when used by @pudge:
grub-install --target=x86_64-efi --bootloader-id=grub-efi --recheck

1 Like

shouldn’t it works like that?
its mounted on the right disk and stuffs, any ideas?

Screenshot_2019-11-03_17-03-03

@ArKrant I have the same m.2 drive and i have installed EndeavourOS with dual boot Windows 10. Currently i have Windows 10 only installed on the m.2 drive and Endeavour on an SSD drive with EFI partition on both. I previously had Endeavour installed with Windows 10 on the m.2 drive on it’s own partition using only one EFI partition in the Windows partition. I have no issues installing it. I find with calamares it does not always like to overwrite the partition scheme. It is better to always create a new GPT partition which will delete all partitions. Then use erase disc with or with out swap. It has no issue installing grub if the flag is et /boot/efi and select the proper drive.

Are you just installing it only on the m.2 drive by itself?

Screenshot%20from%202019-11-03%2011-51-46

Screenshot%20from%202019-11-03%2011-51-53

After the install (even if crash) i guess calamares should umount the disk.
If not i’d recommend you to umount and mount to /mnt which is sort of standard for archlinux. Then remember to arch-chroot to /mnt and install with a command like described before.

*remember to arch-chroot otherwise you’d be trying to install grub at the live environment.

I haven’t asked before how experienced you’re with arch/linux, if you need more detailed instructions let us know than we can detail more.

Single OS, wiped disk before and kept auto installer partioning and i only have one drive the m2 one

Are you not able to install EndeavourOS?