You are not logged in.

#1 2017-12-08 11:19:20

lah
Member
Registered: 2014-08-26
Posts: 28

[SOLVED] Grub minimal bash-like after removing ubuntu

Hello,

I installed arch on my laptop with a dual boot. Other distro is ubuntu. My system had an EFI partition. Now, as I do not need it, I remove ubuntu partition and updated grub. It broke my grub.
Grub displays bash-like terminal, I can see grub version is an ubuntu one.

I can boot into my arch system doing

grub> set root=(hd0,gpt4)
grub> linux /boot/vmlinuz root=/dev/nvme0n1p4
grub> initrd  initramfs-linux.img
grub> boot

and in my arch I've tryied doing :

grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=arch --recheck
grub-mkconfig -o /boot/grub/grub.cfg

Here is content of EFI folder :

sudo tree /boot/efi/EFI
/boot/efi/EFI
├── arch
│   ├── grub.cfg
│   ├── grubx64.efi
│   ├── MokManager.efi
│   └── shimx64.efi
├── Boot
│   ├── en-us
│   │   └── bootx64.efi.mui
│   └── shimx64.efi
├── dell
│   ├── bios
│   │   └── recovery
│   │       └── bios_cur.rcv
│   └── logs
│       ├── diags_current.xml
│       └── diags_previous.xml
├── EFI
│   └── arch
│       └── grubx64.efi
├── Microsoft
│   └── Boot
│       ├── BCD
│       ├── BCD.LOG
│       ├── en-us
│       ├── Fonts
│       │   ├── chs_boot.ttf
│       │   ├── cht_boot.ttf
│       │   ├── jpn_boot.ttf
│       │   ├── kor_boot.ttf
│       │   ├── malgun_boot.ttf
│       │   ├── meiryo_boot.ttf
│       │   ├── msjh_boot.ttf
│       │   ├── msyh_boot.ttf
│       │   ├── segmono_boot.ttf
│       │   ├── segoe_slboot.ttf
│       │   └── wgl4_boot.ttf
│       └── Resources
│           └── bootres.dll
└── ubuntu
    ├── fw
    ├── fwupx64.efi
    ├── grub.cfg
    ├── grubx64.efi
    ├── MokManager.efi
    └── shimx64.efi

If I move /boot/efi/EFI/ubuntu folder, ubuntu grub does not load anymore.

Why is ubuntu grub still loaded during startup?
How can I bring back my grub to life?

Last edited by lah (2017-12-08 15:25:02)

Offline

#2 2017-12-08 11:57:19

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,534
Website

Re: [SOLVED] Grub minimal bash-like after removing ubuntu


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#3 2017-12-08 13:27:53

lah
Member
Registered: 2014-08-26
Posts: 28

Re: [SOLVED] Grub minimal bash-like after removing ubuntu

As a workaround, I did :

mv  /boot/efi/EFI/ubuntu /boot/efi/EFI/ubuntu.bak 
mv  /boot/efi/EFI/arch /boot/efi/EFI/ubuntu

Now I get my arch grub and can boot normally.
But I prefer doing a clean install.

Why isn't arch present in efi entries?

sudo efibootmgr -v
[sudo] Mot de passe de remi : 
BootCurrent: 0001
Timeout: 0 seconds
BootOrder: 0001
Boot0000* ubuntu	HD(1,GPT,f2429231-be60-4d73-bfcc-fbbfadedc1cc,0x800,0x12c000)/File(\EFI\ubuntu\shimx64.efi)
Boot0001* UEFI: PC300 NVMe SK hynix 512GB, Partition 1	HD(1,GPT,f2429231-be60-4d73-bfcc-fbbfadedc1cc,0x800,0x12c000)/File(EFI\Ubuntu\shimx64.efi)..BO
Boot0007* UEFI: PC300 NVMe SK hynix 512GB, Partition 1	HD(1,GPT,f2429231-be60-4d73-bfcc-fbbfadedc1cc,0x800,0x12c000)/File(EFI\boot\bootx64.efi)..BO
Boot0008* M.2 PCIe SSD	BBS(HD,P0: PC300 NVMe SK hynix 512GB,0x0)..BO

How does the system loads GRUB into memory in UEFI case?

We have a :
/boot/grub/x86_64-efi/grub.efi

and several :
/boot/efi/EFI/some_distro/grubx64.efi

How is grub selected when several grub are present under /boot/efi/EFI/ ?

lah

Last edited by lah (2017-12-08 13:43:01)

Offline

#4 2017-12-08 13:48:47

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,743

Re: [SOLVED] Grub minimal bash-like after removing ubuntu

The path set in the NVRAM entries is used to select which one to boot. Why it isn't there on your system depends on how you installed it.

https://wiki.archlinux.org/index.php/GR … allation_2

Last edited by V1del (2017-12-08 13:49:07)

Offline

#5 2017-12-08 14:10:35

lah
Member
Registered: 2014-08-26
Posts: 28

Re: [SOLVED] Grub minimal bash-like after removing ubuntu

During arch install, before exiting chroot , I did:

grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=arch --recheck
grub-mkconfig -o /boot/grub/grub.cfg

After that I got a working grub, but UEFI loaded ubuntu grub.

Now, with my workaround I can boot into my new arch install, but It is still grub from /boot/efi/EFI/ubuntu that is loaded.

I did

grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=arch --recheck
grub-mkconfig -o /boot/grub/grub.cfg

in my running arch install, and now I have a Boot0002* arch entry :

BootCurrent: 0001
Timeout: 0 seconds
BootOrder: 0001
Boot0000* ubuntu	HD(1,GPT,f2429231-be60-4d73-bfcc-fbbfadedc1cc,0x800,0x12c000)/File(\EFI\ubuntu\shimx64.efi)
Boot0001* UEFI: PC300 NVMe SK hynix 512GB, Partition 1	HD(1,GPT,f2429231-be60-4d73-bfcc-fbbfadedc1cc,0x800,0x12c000)/File(EFI\Ubuntu\shimx64.efi)..BO
Boot0002* arch	HD(1,GPT,f2429231-be60-4d73-bfcc-fbbfadedc1cc,0x800,0x12c000)/File(\EFI\arch\grubx64.efi)
Boot0007* UEFI: PC300 NVMe SK hynix 512GB, Partition 1	HD(1,GPT,f2429231-be60-4d73-bfcc-fbbfadedc1cc,0x800,0x12c000)/File(EFI\boot\bootx64.efi)..BO
Boot0008* M.2 PCIe SSD	BBS(HD,P0: PC300 NVMe SK hynix 512GB,0x0)..BO

But, what are Boot0001*, Boot0007*, Boot0008* entries?
How can I generate a clean entry table with only arch?

Last edited by lah (2017-12-08 14:13:05)

Offline

#6 2017-12-08 14:17:08

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,743

Re: [SOLVED] Grub minimal bash-like after removing ubuntu

man efibootmgr -- will tell you both, how to define the order and how to remove obsolete entries. alternatively check if your UEFI firmware has options you can set.

Offline

#7 2017-12-08 14:46:04

lah
Member
Registered: 2014-08-26
Posts: 28

Re: [SOLVED] Grub minimal bash-like after removing ubuntu

I've tried deleting unused entries and also arch entry, after I generated a clean efi boot sequence (arch first in boot order ) calling :

grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=arch --recheck

I also deleted /boot/efi/EFI/arch /boot/efi/EFI/ubuntu

when rebooting, grub does not load, I get a Dell (my laptop is a precision 5520) UEFI tool that checks memory. After that, I booted using a live cd and

cp -r  /boot/efi/EFI/arch /boot/efi/EFI/ubuntu

After that, grub is loaded and loads arch.

But when running efibootmgr in my arch system, I can see an entry has been added, and my arch entry has been removed from boot order :

BootCurrent: 0001
Timeout: 0 seconds
BootOrder: 0001
Boot0000* arch	HD(1,GPT,f2429231-be60-4d73-bfcc-fbbfadedc1cc,0x800,0x12c000)/File(\EFI\arch\grubx64.efi)
Boot0001* UEFI: PC300 NVMe SK hynix 512GB, Partition 1	HD(1,GPT,f2429231-be60-4d73-bfcc-fbbfadedc1cc,0x800,0x12c000)/File(EFI\Ubuntu\shimx64.efi)..BO
Boot0007* UEFI: PC300 NVMe SK hynix 512GB, Partition 1	HD(1,GPT,f2429231-be60-4d73-bfcc-fbbfadedc1cc,0x800,0x12c000)/File(EFI\boot\bootx64.efi)..BO
Boot0008* M.2 PCIe SSD	BBS(HD,P0: PC300 NVMe SK hynix 512GB,0x0)..BO

It seems dell tools modify efi boot options... :-(

Last edited by lah (2017-12-08 14:49:18)

Offline

#8 2017-12-08 15:21:51

lah
Member
Registered: 2014-08-26
Posts: 28

Re: [SOLVED] Grub minimal bash-like after removing ubuntu

I solved my problem...
Originally, when booting ubuntu, before grub screen I got "booting into insecure mode". So I thought UEFI was configured in insecure mode. I did not check that as described here :
https://wiki.archlinux.org/index.php/De … _9560#UEFI

After changing UEFI entries (either with grub-install or directly calling efibootmgr) to have arch grub loading arch grub was not loading and I got a dell UEFI memory check and EFI boot entries modified.
I think UEFI FW detected it was loading an unsecure system... It couldn't load arch bootloader and loaded some recovery tools.

After checking UEFI options,  I discovered secure mode was enabled. It could load ubuntu preinstalled system showing "booting into insecure mode" but it couldn't load any arch system.
I disabled it and now I can get grub loading arch, there is no "booting into insecure mode" message.

I cannot explain how UEFI configured in secure mode could load ubuntu preinstalled system in an insecure mode (as displayed in log)...

Last edited by lah (2017-12-08 15:24:29)

Offline

#9 2017-12-08 15:48:38

progandy
Member
Registered: 2012-05-17
Posts: 5,199

Re: [SOLVED] Grub minimal bash-like after removing ubuntu

lah wrote:

I cannot explain how UEFI configured in secure mode could load ubuntu preinstalled system in an insecure mode (as displayed in log)...

Ubuntu uses a signed shimx64.efi preloader to load grub. It looks like it is configured to use the insecure mode by default. In that case, secure boot verifies that shim is signed, but then shim breaks the verification chain and simply loads grub without checking the signature.

You should be able to do the same with arch, you just have to install shim and then "disable secureboot" in mokmanager. That is only useful if you are dualbooting to windows, though. Or you can sign grub and your kernels and use secure boot.
https://wiki.archlinux.org/index.php/Secure_Boot#shim


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

Board footer

Powered by FluxBB