View previous topic :: View next topic |
Author |
Message |
pjp Administrator
Joined: 16 Apr 2002 Posts: 20498
|
Posted: Wed Aug 21, 2024 7:36 pm Post subject: [void] Repurpos laptop, how to recreate the EFI partition? |
|
|
I'd like to clean up the no longer needed Windows related stuff and reduce the size of the partition.
Specifically: Code: | root@sysresccd /root % fdisk -l /dev/sda
Disk /dev/sda: 465.8 GiB, 500107862016 bytes, 976773168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x76692ca8
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 30716279 30714232 14.7G c W95 FAT32 (LBA)
/dev/sda2 30716280 975849519 945133240 450.7G 7 HPFS/NTFS/exFAT
/dev/sda3 975851520 976771071 919552 449M 27 Hidden NTFS WinRE | It's 15G with 6.7G used. That seems excessive, and was at least in part for Windows stuff. Code: | root@sysresccd /root % find /mnt/1 -size +100M -exec ls -ldh {} \+
-rwxr-xr-x 1 root root 384M Nov 4 2012 /mnt/1/ASUS.000/user-006.dat
-rwxr-xr-x 1 root root 1.7G Feb 3 2010 /mnt/1/asus2.swm
-rwxr-xr-x 1 root root 3.9G Feb 3 2010 /mnt/1/asus.swm
-rwxr-xr-x 1 root root 104M May 22 2009 /mnt/1/ASUS.SYS/va-FF.AR-8.1.2.sqx
-rwxr-xr-x 1 root root 158M Sep 16 2009 /mnt/1/sources/boot.wim
-rwxr-xr-x 1 root root 156M Sep 13 2007 /mnt/1/winre.wim | The .swm and .wim seem to be Windows images. There are also some other things, including but not limited to: Code: | '$RECYCLE.BIN'
'System Volume Information' |
What I'd like is to be able to reduce that partition to about 1GB, but obviously I don't want to lose import EFI things. Currently I think EFI was 'disabled' in the BIOS, which may explain: Code: | root@sysresccd /root % efibootmgr -v
EFI variables are not supported on this system. | And in case it could b important, this System Rescue CD is old: Code: | Portage 2.3.6 (python 3.4.5-final-0, default/linux/x86/13.0, gcc-5.4.0, glibc-2.23-r4, 4.9.44-std504-amd64 x86_64)
================================================================= |
So far all I've come across is managing entries with efibootmgr and not much else.
EDIT:
I guess I should be able to delete the partition and it's supposed to still have the important bits still in nvram?
On my daily use laptop, I created a 128MB partition for /boot and it only contains kernel image stuff. Under it, /boot/EFI/BOOT/bootx64.efi seems to be the only notable file (other than icons/ and keys/). But it seems I read about multiple .efi files, so I wonder if I lost one in the process. Thus this thread.
EDIT 2:
I don't see any similar .efi files on the laptop to be repurposed. It seems mostly Microsoft related: Code: | root@sysresccd /root % ls /mnt/1/boot
bcd BCD.LOG boot.sdi etfsboot.com fonts
root@sysresccd /root % ls /mnt/1/EFI/microsoft/boot
bcd fonts |
And even after enabling UEFI in the BIOS: Code: | root@sysresccd /root % efibootmgr -v
EFI variables are not supported on this system. |
_________________ Quis separabit? Quo animo?
Last edited by pjp on Wed Aug 28, 2024 4:58 pm; edited 1 time in total |
|
Back to top |
|
|
charles17 Advocate
Joined: 02 Mar 2008 Posts: 3685
|
|
Back to top |
|
|
Goverp Advocate
Joined: 07 Mar 2007 Posts: 2182
|
Posted: Thu Aug 22, 2024 9:59 am Post subject: |
|
|
Interesting. My dual-boot Win 11/Gentoo laptop has just 256 MB of efi patition, of which currently 84 MB is in use. And that includes GRUB, and old copy of rEFInd, and a load of cr*p from hp.
It looks to me like yours has been somehow "combined" with the windows recovery environment, which "ought" to be a separate partition. Even then, on mine that's just another 1 GB. Perhaps you also have it combined with the files needed for a "Reset to factory defaults" Windows partition - I had one, which was about 15 GB AFAIR, but I deleted it, preferring a proper backup of my current Windows partition to a USB external drive. _________________ Greybeard |
|
Back to top |
|
|
DawgG l33t
Joined: 17 Sep 2003 Posts: 872
|
Posted: Thu Aug 22, 2024 10:26 am Post subject: |
|
|
check /sys/firmware/efi/ (there must be stuff inside) if you booted in EFI-mode.
also, it might ne necessary to manually mount
Code: | mount -t efivarfs none /sys/firmware/efi |
in sysresccd and inside the chroot yout're trying to install grub in. /boot/efi must also be mounted to a FAT32-partition, i think.
if any of this runs is manufacturer-dependent in my experience. efibootmgr might run or not in sysresccd or the chroot.
in some cases, when grub or efibootmgr install with errors, the firmware offers to "boot from file" and you can boot with grub from the hd and succesfully install it after.
GOOD LUCK! _________________ DUMM KLICKT GUT. |
|
Back to top |
|
|
sMueggli Guru
Joined: 03 Sep 2022 Posts: 501
|
Posted: Thu Aug 22, 2024 3:40 pm Post subject: |
|
|
I do not think that you have an EFI System Partition. You only have a FAT-formatted partition and that's it (check it with "lsblk -o +PARTTYPE").
The partition table is DOS. If it is DOS, then Windows is installed in the BIOS (legacy) mode. If the partition table is GPT, then Windows will be installed in UEFI mode.
If you want to install something in UEFI mode, you should start from the beginning with creating an GPT partition table (not mandatory for Linux but recommended) and install whatever you want to install. |
|
Back to top |
|
|
pjp Administrator
Joined: 16 Apr 2002 Posts: 20498
|
Posted: Thu Aug 22, 2024 7:16 pm Post subject: |
|
|
Thanks. I've read that, but perhaps not thoroughly enough. I'm not just trying to create the partition, but make sure I don't lose something important from the existing partition.
Goverp wrote: | Interesting. My dual-boot Win 11/Gentoo laptop has just 256 MB of efi patition, of which currently 84 MB is in use. And that includes GRUB, and old copy of rEFInd, and a load of cr*p from hp.
It looks to me like yours has been somehow "combined" with the windows recovery environment, which "ought" to be a separate partition. Even then, on mine that's just another 1 GB. Perhaps you also have it combined with the files needed for a "Reset to factory defaults" Windows partition - I had one, which was about 15 GB AFAIR, but I deleted it, preferring a proper backup of my current Windows partition to a USB external drive. | That's possible. And since EFI was disabled in the BIOS, maybe it came from the vendor or whomever set up the hardware.
The 3rd partition may be related to that as well: "449M 27 Hidden NTFS WinRE"
I stopped meaningfully dealing with windows ~2010, so I'm not familiar with how they've changed things, especially with EFI and recovery. _________________ Quis separabit? Quo animo? |
|
Back to top |
|
|
pjp Administrator
Joined: 16 Apr 2002 Posts: 20498
|
Posted: Thu Aug 22, 2024 7:21 pm Post subject: |
|
|
DawgG wrote: | check /sys/firmware/efi/ (there must be stuff inside) if you booted in EFI-mode. | Code: | root@sysresccd /root % ls /sys/firmware/
acpi dmi memmap | So I enabled EFI mode, then only "save settings" followed by selecting the USB thumb drive to boot. I haven't found a regular boot menu, so I have to use the BIOS. Maybe it didn't save enabling EFI. I'll double check.
DawgG wrote: | also, it might ne necessary to manually mount
Code: | mount -t efivarfs none /sys/firmware/efi |
| And maybe the problem is my sysreesccd is too old: Code: | root@sysresccd /root % mount -t efivars none /mnt/0
mount: unknown filesystem type 'efivars' | I was really hoping to not have to find something else.
DawgG wrote: | in sysresccd and inside the chroot yout're trying to install grub in. /boot/efi must also be mounted to a FAT32-partition, i think.
if any of this runs is manufacturer-dependent in my experience. efibootmgr might run or not in sysresccd or the chroot.
in some cases, when grub or efibootmgr install with errors, the firmware offers to "boot from file" and you can boot with grub from the hd and succesfully install it after. | /boot/efi, or I think /efi/efi is the newer location. Although on my daily laptop, /boot/EFI is just a sub-directory. EFI seems like it was designed to make javascript's genesis well planned and considered. Code: | # df -h /boot/EFI/
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 121M 64M 57M 54% /boot |
_________________ Quis separabit? Quo animo? |
|
Back to top |
|
|
pjp Administrator
Joined: 16 Apr 2002 Posts: 20498
|
Posted: Thu Aug 22, 2024 7:31 pm Post subject: |
|
|
sMueggli wrote: | I do not think that you have an EFI System Partition. You only have a FAT-formatted partition and that's it (check it with "lsblk -o +PARTTYPE"). | It's not labeled as efi, but some parts have the suggestion of it. I suppose it's /boot and /EFI directories may be red herrings, unless the sysreccd's lack of support matters. Code: | root@sysresccd /root % lsblk -o +PARTTYPE /dev/sda1
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT PARTTYPE
sda1 8:1 0 14.7G 0 part /mnt/1 0xc | Code: | root@sysresccd /root % ls -1 /mnt/1/{boot,EFI}
/mnt/1/boot:
bcd
BCD.LOG
boot.sdi
etfsboot.com
fonts
/mnt/1/EFI:
microsoft |
sMueggli wrote: | The partition table is DOS. If it is DOS, then Windows is installed in the BIOS (legacy) mode. If the partition table is GPT, then Windows will be installed in UEFI mode. | I forgot about the disk label dos vs gpt. That also explains why UEFI was disabled in BIOS.
sMueggli wrote: | If you want to install something in UEFI mode, you should start from the beginning with creating an GPT partition table (not mandatory for Linux but recommended) and install whatever you want to install. | Thanks. Before doing that I wanted to create a backup of possible important pieces since I've read about people deleting and losing .efi files. But none of those appear to exist, so that resolves that concern.
However, last night I decided to run a smartctl long test. Hah! If, no pun intended, I read this correctly, the drive is about dead: Code: | SMART Extended Self-test Log Version: 1 (1 sectors)
Num Test_Description Status Remaining LifeTime(hours) LBA_of_first_error
# 1 Extended offline Completed: read failure 90% 15004 37087320 | My understanding is any failures are bad, and if 90% means that's the failure rate, then yikes.
I started with this laptop because it seemed the least capable, so I guess I'll try another. I don't think it's worth replacing the drive.
/proc/cpuinfo: | processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 37
model name : Intel(R) Core(TM) i3 CPU M 330 @ 2.13GHz
stepping : 2
microcode : 0x8
cpu MHz : 933.000
cache size : 3072 KB
physical id : 0
siblings : 4
core id : 0
cpu cores : 2
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 11
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm sse4_1 sse4_2 popcnt lahf_lm tpr_shadow vnmi flexpriority ept vpid dtherm arat
bugs :
bogomips : 4255.89
clflush size : 64
cache_alignment : 64
address sizes : 36 bits physical, 48 bits virtual
power management: |
_________________ Quis separabit? Quo animo? |
|
Back to top |
|
|
sMueggli Guru
Joined: 03 Sep 2022 Posts: 501
|
Posted: Fri Aug 23, 2024 5:42 pm Post subject: |
|
|
pjp wrote: | /boot/efi, or I think /efi/efi is the newer location. Although on my daily laptop, /boot/EFI is just a sub-directory. EFI seems like it was designed to make javascript's genesis well planned and considered. |
On every ESP there is a EFI directory in the partition root. Inside EFI there is at least a BOOT folder and normally other folders for the different operating systems (like "gentoo", "Microsoft", "fedora" and others).
The mountpoint for the ESP is either /boot/efi (which is the Grub default) or /efi (the newer way to avoid nested mounts and the "official" Gentoo mountpoint for the ESP). It is also possible to mount the ESP to /boot. But in this case you are storing a lot of files on the ESP that are only useful for the operating system or for the bootloader.
pjp wrote: | Code: | root@sysresccd /root % lsblk -o +PARTTYPE /dev/sda1
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT PARTTYPE
sda1 8:1 0 14.7G 0 part /mnt/1 0xc |
|
If I do interpret it correctly, the partition type "0x(0)c" is ambiguous. It is used for FAT32 LBA partitions, but seems to be used also on (older?) Windows systems for ESPs. There is also the partition type "0xef".
It looks like you have a quite old device (and I wonder whether the EFI firmware is 64bit or one of the 32 bit EFI firmwares with 64 bit processor). |
|
Back to top |
|
|
pjp Administrator
Joined: 16 Apr 2002 Posts: 20498
|
Posted: Sat Aug 24, 2024 5:30 am Post subject: |
|
|
There are definitely parts that seem like it might or could have been an EFI. Or maybe some common structure used for EFI / recovery, and since EFI boot was disabled, maybe the EFI specific stuff was never populated. Or at least the .efi files.
According to fdisk: Code: | c W95 FAT32 (LBA)
ef EFI (FAT-12/16/ |
sMueggli wrote: | It looks like you have a quite old device (and I wonder whether the EFI firmware is 64bit or one of the 32 bit EFI firmwares with 64 bit processor). | It seems to have been a cheap retail laptop, first available in July 2010. It's a 1st gen i3, with 4GB RAM, max 8.
I'm mainly going to use it for testing. I may first try Gentoo binaries, but I also want to try using my own. In theory I've built them to be generic amd_64, but I haven't tested that to confirm.
The other laptops I have also have only 4GB of RAM, so I won't be avoiding that any time soon. One even has a 1TB drive :).
Eventually I'm gong to try using this one to distribute ::gentoo, and eventually some other small stuff, or it won't justify it's power consumption. Wake on LAN would be nice too.
Anyway, I hope to get an install going on it this weekend. I had hoped to have it done by now, but fortunately it's nothing urgent. _________________ Quis separabit? Quo animo? |
|
Back to top |
|
|
pjp Administrator
Joined: 16 Apr 2002 Posts: 20498
|
Posted: Wed Aug 28, 2024 4:57 pm Post subject: |
|
|
It seems UEFI doesn't work on this system, despite the BIOS UEFI enable / disable option. Code: | (chroot) sysresccd / # refind-install --root /
ShimSource is none
Installing rEFInd on Linux....
ESP was found at /efi using vfat
Running in BIOS mode with no existing default boot loader; installing to
/efi/EFI/BOOT
Note: IA32 (x86) binary not installed!
Copied rEFInd binary files
Copying sample configuration file as refind.conf; edit this file to configure
rEFInd.
Installation has completed successfully. | /boot is part of /, which is where the dist kernel files were installed. On reboot, I only see a blinking cursor after the brand logo screen. It isn't "hard locked" as Ctrl-Alt-Del works to reboot it.
I didn't try to configure refind, expecting either an error or for it's "automagic" to work, but it doesn't load at all. Code: | root@sysresccd /mnt/gentoo % find efi |grep -Ev 'efi/EFI/BOOT/(icons|keys)'
efi
efi/EFI
efi/EFI/BOOT
efi/EFI/BOOT/bootx64.efi
efi/EFI/BOOT/refind.conf
efi/EFI/BOOT/refind.conf-sample
efi/EFI/BOOT/BOOT.CSV | I guess since this was mainly a test, I can make the efi partition ext4 /boot partition instead. At least that gives me an opportunity to try sys-boot/syslinux. _________________ Quis separabit? Quo animo? |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|