WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: GRUB 2 always starts in command line - can't proceed - EFI Boot  (Read 33346 times)

Offline coreplayer2

  • Hero Member
  • *****
  • Posts: 3020
Re: GRUB 2 always starts in command line - can't proceed - EFI Boot
« Reply #15 on: July 24, 2019, 03:57:00 PM »
The "hack" is replacing the EFI directory from another distro, and having that boot the standard iso without dropping to the grub prompt.  Performing an ls using grub, we find that no filesystems are recognized on any of the available partitions.

Inside the alternate EFI, we find two files:

bootx64.efi
bootia32.efi

These seem to be the key.  I note that tcpure64 iso omits the bootia32.efi.  Even though we are uefi-only 64 bit, does bootia32.efi need to be present to use a fat32 filesystem?
No the 32 bit EFI  is not required for modern 64 bit hardware.  it’s there only to support what is now considered early EFI hardware.      Having said that, there are still some rare chip manufacturers supplying 32 bit CPU’s for special use scenario’s.  A point I often forget.

If you don’t know what kind of hardware you’re using then most likely it’s CPU is 64bit and is why we recommend booting the corepure64.iso  to install grub2 from.  Grub2 should match the hardware, thereafter you can boot either x86 or x86_64 OS architecture. 
AFAIK Here’s what is important,  you can’t boot a 64bit OS from a 32bit grub2 install even if installed on 64bit hardware.


Quote
I'm just doing layman type of investigations.  The other stuff such as finding grub.cfg and set gfxpayload are sideline operational issues.
Cool. Maybe I misread


Sent from my iPhone using Tapatalk

Offline PDP-8

  • Hero Member
  • *****
  • Posts: 915
Re: GRUB 2 always starts in command line - can't proceed - EFI Boot
« Reply #16 on: July 25, 2019, 01:08:53 AM »
Removed bootia32.efi since it was unnecessary.

I tried a different bootx64.efi from Porteus, but that only landed me in a black screen.  So for now, I guess this puppy version works.

What do they say? "whatever floats your boot" :)
That's a UNIX book! - cool  -- Garth

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11178
Re: GRUB 2 always starts in command line - can't proceed - EFI Boot
« Reply #17 on: July 25, 2019, 05:14:56 AM »
Hi PDP-8
What do they say? "whatever floats your boot" :)
OK, that's 10 minutes in the punalty box for you.

Offline coreplayer2

  • Hero Member
  • *****
  • Posts: 3020
Re: GRUB 2 always starts in command line - can't proceed - EFI Boot
« Reply #18 on: July 25, 2019, 09:22:30 AM »
Every time I try to boot up, I get sent into a Grub 2 shell and am unable to move forward.  I am using Corepure 64 10.1 and am booting from a USB drive partitioned in GPT format.  I am using Rufus to burn the ISO to the drive, but have also tried with etcher.  I have tried manually booting with grub commands 'linux' and 'initrd', but even then I get an 'unknown filesystem' error.  I don't have the option to boot in legacy mode.

I am really excited to use Tiny Core Linux, but this stumbling block is quite annoying.  Does anyone know what might be going on and how to fix it?
I returned to the OP's first post and regret not asking this,  when at the grub shell enter this command and post the output please
Code: [Select]
grub> echo ${cmdpath}
« Last Edit: July 25, 2019, 09:26:26 AM by coreplayer2 »

Offline PDP-8

  • Hero Member
  • *****
  • Posts: 915
Re: GRUB 2 always starts in command line - can't proceed - EFI Boot
« Reply #19 on: July 25, 2019, 12:34:11 PM »
Bummer:  grub 2.02~beta2

Code: [Select]
grub > echo ${cmdpath}
error: can't find command `echo`

Hitting tab for autocomplete gave me some others that might help..

But you pointed me as to where we're going looking at variables.  So like in a real shell, I just typed

Code: [Select]
grub> set

cmdpath=(hd0,gpt1)/EFI/BOOT
.
.
. other variables .....
.
.
prefix=(hd0)/EFI/BOOT/grub
root=hd0
..

Awesome.  Actually very helpful for further study.  Wonder if prefix needs a gpt1 too..

« Last Edit: July 25, 2019, 12:35:55 PM by PDP-8 »
That's a UNIX book! - cool  -- Garth

Offline PDP-8

  • Hero Member
  • *****
  • Posts: 915
Re: GRUB 2 always starts in command line - can't proceed - EFI Boot
« Reply #20 on: July 25, 2019, 12:52:18 PM »
Ok, can't wait - probably getting waaay too far ahead here.

So I tried to "ls" those paths from grub>

And they all ended up with
error: "unknown filesystem"

Code: [Select]
ls hd0,gpt1
ls hd0
.
.
ls hd0,gpt1/EFI/BOOT
ls hd0/EFI/BOOT/grub
.
l
ls /hd0,gpt1/EFI/BOOT
ls /hd0/EFI/BOOT

Seems like all my attempts to ls results in unknown filesystem.
That's a UNIX book! - cool  -- Garth

Offline PDP-8

  • Hero Member
  • *****
  • Posts: 915
Re: GRUB 2 always starts in command line - can't proceed - EFI Boot
« Reply #21 on: July 25, 2019, 01:03:58 PM »
Re: the pun

Corny, but I couldn't help myself.

I imagined that one of my idols, Brian Kernighan, would say it this way, whom Doug McIlroy claimed was an "expositor par excellence"..

Heh, us old guys. :)
That's a UNIX book! - cool  -- Garth

Offline coreplayer2

  • Hero Member
  • *****
  • Posts: 3020
GRUB 2 always starts in command line - can't proceed - EFI Boot
« Reply #22 on: July 25, 2019, 05:37:27 PM »
The other question is there some major difference in bootx64.efi between TC and the distro that this replacement came from?
Indeed there is and it’s by design.   You see each bootx64.efi boot loader is created by grub-mkimage  which is executed by grub-install with the the personalized parameters provided.  These parameters usually include the path to its configuration file (grub.cfg) known as the prefix and modules required to read file systems etc etc

You may also create an boot image file with all the modules included so that the grub modules folder is not required, but that’s another story




Quote
Seems like all my attempts to ls results in unknown filesystem.
Ok,  ls can’t read the file system if root has not been set..


Sent from my iPhone using Tapatalk
« Last Edit: July 25, 2019, 05:44:22 PM by coreplayer2 »

Offline PDP-8

  • Hero Member
  • *****
  • Posts: 915
Re: GRUB 2 always starts in command line - can't proceed - EFI Boot
« Reply #23 on: July 26, 2019, 01:29:10 AM »
Quote
Ok,  ls can’t read the file system if root has not been set..

Well, it is already set as hd0 being baked in when using grub>set to view the variables as delivered from the iso.

So, with root=hd0 already set as the baked in value from the iso, I tried to ls it:

Code: [Select]
ls (hd0)
Device hd0: No known filesystem detected - sector size 512B - Total size 152320000KiB

Hmm.  Ok, looks to be the entire size of my drive.

So lets step through all eleven of the possible HDx options as shown by grub>ls

Code: [Select]
set root=(hd0,gpt1)
ls (hd0,gpt1)

Partitions hd0,gpt1: No known filesystem detected - Partition start at 1024KiB - Total Size 15230959.5KiB

Seems like grub duly recognizes the partitions, but stubbornly refuses to recognize the filesystems.  I tried changing the root, and the ls'ing all of the other 11 HDx options that grub found, but the all report no known fileystem.  Partition sizes DO have different values!

So if it can't recognize the partitions with an ls, there is no point trying to start the kernel or initrd right?

I'll study up, but man this is sooo frustrating.  I appreciate the help.
« Last Edit: July 26, 2019, 01:35:29 AM by PDP-8 »
That's a UNIX book! - cool  -- Garth

Offline PDP-8

  • Hero Member
  • *****
  • Posts: 915
Re: GRUB 2 always starts in command line - can't proceed - EFI Boot
« Reply #24 on: July 26, 2019, 02:27:37 AM »
Not sure if this helps or if this is noise ...

So I forced the grub commandline from the working puppy bootx64.efi to take a peek with the set command:  Some interesting values

cmdpath=(hd0)/EFI/BOOT
prefix=(memdisk)/boot/grub
root=hd0,gpt1

MEMDISK?

Code: [Select]
ls (memdisk)
Filesystem type tarfs
Sector Size 512B Total Size 3070KiB

ls (memdisk)/
boot/ euro.pf2

ls (memdisk)/boot/grub
locale/ x86_64-efi/ grub.cfg

And I can ls any of the HDx partitions, and their filesystem is recognized and can browse through the systems, *EXCEPT* for hd0.  Yet this system boots.

Fascinating.  Sure beats the typical shade-tree recommendations out there to just put my computer in the fridge, change my boot order, delete my windows partition, run grub2 magic fixer/cleaner distro..... :)
« Last Edit: July 26, 2019, 02:44:10 AM by PDP-8 »
That's a UNIX book! - cool  -- Garth

Offline PDP-8

  • Hero Member
  • *****
  • Posts: 915
Re: GRUB 2 always starts in command line - can't proceed - EFI Boot
« Reply #25 on: July 26, 2019, 03:20:39 AM »
Sorry guys - I'm on a roll now ... :)

Wow - major differences between Grub 2.02~beta 2 and grub 2.03 as far as available commands go.

doing an lsmod between the two - wow.

Just breaking some *!3#? here - an lsmod with our original grub shows support for part_Amiga and part_Acorn filesystems.  We can drop those right?  :) :)
That's a UNIX book! - cool  -- Garth

Offline coreplayer2

  • Hero Member
  • *****
  • Posts: 3020
Re: GRUB 2 always starts in command line - can't proceed - EFI Boot
« Reply #26 on: July 26, 2019, 07:48:26 AM »
MEMDISK is because you’re using the forbidden puppy Distribution’s “Standalone” bootx64.efi version

The standalone version contains all the modules it’s creator deemed fit to include

I’m not sure why you’re surprised?
[emoji13]




Sent from my iPhone using Tapatalk

Offline PDP-8

  • Hero Member
  • *****
  • Posts: 915
Re: GRUB 2 always starts in command line - can't proceed - EFI Boot
« Reply #27 on: July 26, 2019, 12:55:44 PM »
Um - ok.  I think. :)

Which makes me wonder if we have our own catch-22 with the tcpure64 iso ...

To get the filesystem support we need, we have to add insmod modules into the grub.cfg file as an end user.

But to read that file, some sort of filesystem support needs to be baked into the bootx64.efi file in the first place?

More detail:
dd'ing the distribution doesn't boot - in fact, the bios doesn't even recognize the device, so only an iso burn makes it appear in the bios.

I'll keep searching for the smoking gun, but I feel like I'm not learning anything. :)
That's a UNIX book! - cool  -- Garth

Offline coreplayer2

  • Hero Member
  • *****
  • Posts: 3020
GRUB 2 always starts in command line - can't proceed - EFI Boot
« Reply #28 on: July 26, 2019, 01:23:17 PM »
I think there’s some confusion here..

In the standalone bootx64.efi version you’re using you can’t ls into the memdisk which is where all included modules and the grub.cfg file is located
I’m not familiar with any means to access the grub config file in a standalone bootx64.efi file.

Our bootx64.efi file is not a standalone type which doesn’t have a memdisk.   But the full partition path needs setting to use ls

Also the command to access a drive contents is
Code: [Select]
grub> ls /
Or if other than root
Code: [Select]
grub> ls (hd2,gpt1)/

Sent from my iPhone using Tapatalk
« Last Edit: July 26, 2019, 01:49:31 PM by coreplayer2 »

Offline coreplayer2

  • Hero Member
  • *****
  • Posts: 3020
Re: GRUB 2 always starts in command line - can't proceed - EFI Boot
« Reply #29 on: July 26, 2019, 02:16:28 PM »
To manually boot the kernel

Code: [Select]
grub> ls /
boot EFI
grub> linux /boot/vmlinuz64 quiet
grub> initrd /boot/corepure64.gz
grub> boot

Or

Code: [Select]
grub> linux (hd0,msdos1)/boot/vmlinuz64 quiet
grub> initrd (hd0,msdos1)/boot/corepure64.gz
grub> boot


If you need to add file system support then build your own boot loader

Code: [Select]
grub-mkimage -o bootx64.efi -p /EFI/BOOT -O x86_64-efi  (ext2 part_gpt +list of all additional modules)

cp /EFI/boot/grub/x86_64-efi/core.efi /EFI/BOOT/grubx64.efi
(something like that anyhow..)
« Last Edit: July 26, 2019, 02:39:19 PM by coreplayer2 »