WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Frugal install UEFI  (Read 6823 times)

Offline Demontager

  • Newbie
  • *
  • Posts: 18
Frugal install UEFI
« on: July 01, 2022, 04:59:51 AM »
I am trying to make frugal persistent install TC on mini-PC which only supports UEFI boot. The iso i have used is TinyCorePure64-13.1.iso, but direct boot not working, so i used Ventoy then i got tc booted. Then followed this guide to install TC to internal storage https://iotbytes.wordpress.com/install-microcore-tiny-linux-on-local-disk/
Code: [Select]
tc-load -wi tc-installBefore making install i did partitioning like that. Chosen ext4 partition for TC (not whole disk)
Code: [Select]
/dev/mmcblk0p1  fat32 for EFI
/dev/mmcblk0p2  ext4
At that point i need to install grub to /dev/mmcblk0p1 Partly I followed that guide http://forum.tinycorelinux.net/index.php/topic,19364.msg119228.html#msg119228

Code: [Select]
$ tce-load -i grub2-multi
$ sudo mount /dev/mmcblk0p1
$ sudo mount /dev/mmcblk0p2
$ sudo grub-install --target=x86_64-efi --boot-directory=/mnt/dev/mmcblk0p1/EFI/BOOT --efi-directory=/mnt/dev/mmcblk0p1
Installing for x86_64-efi platform
grub-install: warning: cannot open directory '/usr/local/share/locale': No such file or directory.
grub-install: error: efibootmgr: not found


Offline Demontager

  • Newbie
  • *
  • Posts: 18
Re: Frugal install UEFI
« Reply #1 on: July 01, 2022, 06:05:28 AM »
Figured out that i missed efibootmgr

Code: [Select]
tce-load -wi efibootmgrThen again did
Code: [Select]
sudo grub-install --target=x86_64-efi --boot-directory=/mnt/dev/mmcblk0p1/EFI/BOOT --efi-directory=/mnt/dev/mmcblk0p1
Installation reported as successful except warning
Code: [Select]
grub-install: warning: cannot open directory '/usr/local/share/locale': No such file or directory.
Now i got grub directory created

Code: [Select]
tc@box:/mnt/mmcblk0p1/EFI/grub$ ls -al
total 138
drwxrwxrwx    2 root     root           512 Jul  1 09:55 ./
drwxrwxrwx    4 root     root           512 Jul  1 08:18 ../
-rwxrwxrwx    1 root     root        139264 Jul  1 09:33 grubx64.efi

I know that i need to create grub.cfg within this folder. What will be the minimum config ?

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14815
Re: Frugal install UEFI
« Reply #2 on: July 01, 2022, 07:39:27 AM »
If you search the forums on dual boot uefi bios you should find an example grub.conf.

Offline Demontager

  • Newbie
  • *
  • Posts: 18
Re: Frugal install UEFI
« Reply #3 on: July 01, 2022, 10:52:24 AM »
If you search the forums on dual boot uefi bios you should find an example grub.conf.

Yes, i found some and compiled own grub.cfg


And it worked, partly. I got grub menu loaded with my entry, TC booted, but after trying to install some utils found that i can't install any, for example htop

Code: [Select]
tc@box:$ tce-load -wi htop
tc@box:$
means nothing happened. Also tried filetool
Code: [Select]
tc@box:$ filetool.sh -bv
Invalid device

tcedir shows
Code: [Select]
readlink /etc/sysconfig/tcedir
/tce

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14815
Re: Frugal install UEFI
« Reply #4 on: July 01, 2022, 10:55:26 AM »
Can you post your grub.cfg?

Offline Demontager

  • Newbie
  • *
  • Posts: 18
Re: Frugal install UEFI
« Reply #5 on: July 01, 2022, 11:03:42 AM »
I tried to post few times grub.cfg in previous message but having this error

Code: [Select]
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at webmaster@forum.tinycorelinux.net to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.


So used pastebin instead  https://pastebin.com/NSUhvqs8

Offline Demontager

  • Newbie
  • *
  • Posts: 18
Re: Frugal install UEFI
« Reply #6 on: July 01, 2022, 12:18:49 PM »
Code: [Select]
loadfont unicode
insmod all_video
terminal_output gfxterm
 

search --no-floppy --fs-uuid --set=root "5d1b7f4a-0806-4447-af34-9c9920e1be79"

menuentry "TinyCorePure64-13.1" {
linux /tce/boot/vmlinuz64 loglevel=3 tce=UUID="5d1b7f4a-0806-4447-af34-9c9920e1be79" opt=UUID="5d1b7f4a-0806-4447-af34-9c9920e1be79"
initrd /tce/boot/corepure64.gz
}

Removed set lines from grub.cfg, seems they causing error in posting to forum

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11619
Re: Frugal install UEFI
« Reply #7 on: July 01, 2022, 02:51:08 PM »
Hi Demontager
Did you forget to hit the carriage return after the closing  }  character?

For those who do not care to visit pastebin, a copy of  grub.cfg  is attached.

Offline Demontager

  • Newbie
  • *
  • Posts: 18
Re: Frugal install UEFI
« Reply #8 on: July 03, 2022, 03:31:54 AM »
Hi Demontager
Did you forget to hit the carriage return after the closing  }  character?

For those who do not care to visit pastebin, a copy of  grub.cfg  is attached.

hmm, i have inserted grub.cfg lines within code blocks. The

Code: [Select]
[/code]
was the last line.

Offline Demontager

  • Newbie
  • *
  • Posts: 18
Re: Frugal install UEFI
« Reply #9 on: July 04, 2022, 08:55:41 AM »
Okay, now got TC working nearly properly.
After trying some different grub configs i found that if waitusb=5 option not present it causing errors described earlier.
Below attached current grub.cfg which working as intended( for admin:still not able to post it directly to forum 500Error).
Code: [Select]
Command line: BOOT_IMAGE=/tce/boot/vmlinuz64 loglevel=3 waitusb=5:UUID=5d1v7f4a-0806-4447-af34-9c9920e1be79 tce=UUID=5d1b7f4a-0806-4447-af34-9c9920e1be79 opt=UUID=5d1b7f4a-0806-4447-af34-9c9920e1be79

According to FAQ this option needs to be set for pendrives and as you can see applicable for internal mmc storage too. http://distro.ibiblio.org/tinycorelinux/faq.html#pendrives
Also i found strange behavior with boot partition where grub.cfg resides, for some reason no boot partition files seen. Means i only see /mnt/mmcblk0p1 folder but no more files. i checked /etc/fstab and there indeed vfat exists. And mount command also confirmed that /dev/mmcblk0p1 mounted

Code: [Select]
# /etc/fstab
proc            /proc        proc    defaults          0       0
sysfs           /sys         sysfs   defaults          0       0
devpts          /dev/pts     devpts  defaults          0       0
tmpfs           /dev/shm     tmpfs   defaults          0       0
/dev/zram0  swap         swap    defaults,noauto   0       0
/dev/mmcblk0p1  /mnt/mmcblk0p1  vfat     noauto,users,exec,umask=000 0 0 # Added by TC
/dev/mmcblk0p2  /mnt/mmcblk0p2  ext4     noauto,users,exec    0 0 # Added by TC

In such way i was unable to access grub.cfg. Then i tried to mount it again manually and it worked i may see all files
Code: [Select]
sudo mount /dev/mmcblk0p1  /mnt/mmcblk0p1
tc@box:~$ ls -al /mnt/mmcblk0p1/EFI/BOOT/grub/grub.cfg
-rwxr-xr-x    1 root     root           542 Jul  4 12:23 /mnt/mmcblk0p1/EFI/BOOT/grub/grub.cfg
tc@box:~$


So it strange to me why it not working automatically from fstab






« Last Edit: July 04, 2022, 09:23:11 AM by Demontager »

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11619
Re: Frugal install UEFI
« Reply #10 on: July 04, 2022, 09:33:24 AM »
Hi Demontager
Tinycore will populate  fstab  with all of the devices it is aware of. It then creates mount points for those devices
in  /mnt  but does not automatically mount them all. It will only mount the devices that contain directories it
needs to run, such as  tce , and persistent  /home  and  /opt  if they exist.

The  VFAT  partition is only used by the UEFI firmware and grub.


Offline Demontager

  • Newbie
  • *
  • Posts: 18
Re: Frugal install UEFI
« Reply #11 on: July 04, 2022, 02:33:24 PM »
Now clear, understood why fstab not worked in auto mode. I guess i need to add mount command to bootlocal.sh then, right? Actually i already done, but  found that vfat partition sometimes after reboot  randomly changing device name either mmcblk1p1 or mmcblk0p1 to overcome this i do mount
sudo mount /dev/mmcblk1p1 /mnt/mmcblk1p1
or
sudo mount /dev/mmcblk0p1 /mnt/mmcblk0p1

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11619
Re: Frugal install UEFI
« Reply #12 on: July 04, 2022, 10:48:41 PM »
Hi Demontager
... but  found that vfat partition sometimes after reboot  randomly changing device name either mmcblk1p1 or mmcblk0p1 ...
The only time I've seen device names change like that is when devices are added/removed and the remaining devices get reordered.

Commands in  bootlocal.sh  do not require  sudo.
When mounting devices listed in  fstab  you don't need  sudo.
When mounting devices listed in  fstab  it's enough to specify one parameter. Either of these commands will work:
Code: [Select]
mount /dev/mmcblk0p1or:
Code: [Select]
mount /mnt/mmcblk0p1
If you add the following commands to your  bootlocal.sh , it will scan  fstab  for lines containing
mmcblk  and  vfat.  If found and not currently mounted, it will mount them.
Code: [Select]
for Drive in `grep mmcblk /etc/fstab | grep vfat | tr -s " " | cut -d " " -f1`
do
    grep -q "$Drive" /etc/mtab || mount "$Drive"
done
« Last Edit: July 21, 2024, 08:23:18 AM by Rich »

Offline PDP-8

  • Hero Member
  • *****
  • Posts: 915
Re: Frugal install UEFI
« Reply #13 on: July 05, 2022, 02:46:45 AM »
Demontager - I have your hardware and have bad news:

I run into the same partitioning problem and is one of the reasons I never do a frugal or even boot an iso from the internal mmc device - it changes randomly.

What will make your hair gray is that it also depends on whether you do a reboot, or a total shutdown and power up.  Sometimes it stays the same, and sometimes it goes haywire.

In addition, if you run from say an external usb stick, do a normal shutdown, and move the stick to another port, that seems to be a problem too randomly.

The only way to start from a known state is to actually *pull the dc jack* and reinsert.  You'll see the blue light come on where the system is apparently scanning the ports and shuts off again, waiting for you to power up manually.

Even powering up manually can result in different port partitions depending on whether you do a short-press power up, or a long-press (3 seconds or more held) and let it power up that way.

What I'm saying is that this particular Wintel hockey-puck is best left under a sledge-hammer.  Ask me how I know!

Sorry to be the bearer of bad news, but perhaps this knowledge will add years to your life. :)
« Last Edit: July 05, 2022, 02:48:31 AM by PDP-8 »
That's a UNIX book! - cool  -- Garth

Offline Demontager

  • Newbie
  • *
  • Posts: 18
Re: Frugal install UEFI
« Reply #14 on: July 05, 2022, 05:16:50 AM »
I have added mount command as Rich suggested to bootlocal.sh and it does job great with mounting any partition name.
I did several reboots to test as it goes and got one hang after issuing sudo reboot command, box wasn't replying pings and no screen image. Guess it was not TC issue but hardware related.
The only problems i'm aware are those listed in dmesg, might be also related to above hang. However once system booted and running i found no issues, no lookups at least . BTW I'm using this Wintel hockey brick as openvpn server and internet router.
Code: [Select]

ACPI: AC: found native INT33F4 PMIC, not loading
ACPI Error: No handler for Region [GMMR] (000000005fbfafcb) [UserDefinedRegion] (20210730/evregion-130)
ACPI Error: Region UserDefinedRegion (ID=146) has no handler (20210730/exfldio-261)
ACPI Error: Aborting method \_SB.GPO1._E03 due to previous error (AE_NOT_EXIST) (20210730/psparse-529)

........
loop26: detected capacity change from 0 to 32
loop27: detected capacity change from 0 to 2968
loop28: detected capacity change from 0 to 688
loop29: detected capacity change from 0 to 2432
loop30: detected capacity change from 0 to 72
ACPI: AC: found native INT33F4 PMIC, not loading
ACPI: AC: found native INT33F4 PMIC, not loading
ACPI: AC: found native INT33F4 PMIC, not loading
ACPI: AC: found native INT33F4 PMIC, not loading
................
« Last Edit: July 05, 2022, 05:24:47 AM by Demontager »