Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
problem using mkdosfs to create efi partition [SOLVED]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
mikefot
Guru
Guru


Joined: 19 Nov 2014
Posts: 464

PostPosted: Sun Apr 28, 2019 8:16 am    Post subject: problem using mkdosfs to create efi partition [SOLVED] Reply with quote

Dear All,

I have reinstalled gentoo amd64 stable on a kaveri box.

The install has gone OK. I have installed a genkernel kernel.

I am chrooting from a debian install.

I created a fat32 partition using gparted in debian for gentoo to use.

Code:
 (chroot) fart /etc/init.d # gdisk -l /dev/sda
GPT fdisk (gdisk) version 1.0.3

Partition table scan:
  MBR: MBR only
  BSD: not present
  APM: not present
  GPT: not present


***************************************************************
Found invalid GPT and valid MBR; converting MBR to GPT format
in memory.
***************************************************************

Disk /dev/sda: 1953525168 sectors, 931.5 GiB
Model: TOSHIBA DT01ACA1
Sector size (logical/physical): 512/4096 bytes
Disk identifier (GUID): F4998443-013B-4B45-AB4D-8985CCAD2694
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 1953525134
Partitions will be aligned on 2048-sector boundaries
Total free space is 671214957 sectors (320.1 GiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048          206847   100.0 MiB   0700  Microsoft basic data
   2          206848       306278399   145.9 GiB   0700  Microsoft basic data
   3       306278400       307199999   450.0 MiB   2700  Windows RE
   5       732981248       752510975   9.3 GiB     8300  Linux filesystem
   6      1924405248      1953523711   13.9 GiB    8200  Linux swap
   7      1002424320      1003038719   300.0 MiB   8300  Linux filesystem
   8      1003040768      1207840767   97.7 GiB    8300  Linux filesystem
   9      1207842816      1924395007   341.7 GiB   8300  Linux filesystem
  10       752513024       757010431   2.1 GiB     0700  Microsoft basic data



I am going to use /dev/sda10 ie the last partition listed above. it is a FAT 32 partition and is 2.1GC in size (bigger than necessary but it doesn't matter).

I installed
Code:
sys-fs/dostools
.

I tried to run the mkdosfs command but it doesn't work.

I was following the instructions given in an old gentoo forums post:

https://forums.gentoo.org/viewtopic-t-1002254-start-0.html

See here:
Code:
(chroot) fart /etc/init.d # mkdosfs -F 32 -n efi-boot /dev/sda10
bash: mkdosfs: command not found


What am I doing wrong here?

Regards

Michael Fothergill

PS I have got the file system creation to work with this command:

Code:
mkfs.vfat -F 32 -n efi-boot /dev/sda10


i then ran these commands

Code:
mkdir /boot/efi

echo 'LABEL=efi-boot /boot/efi vfat defaults 0 2' >> /etc/fstab

and

Code:
mount /boot/efi


BUT

I then ran

Code:
grub-install --target=x86_64-efi --efi-directory=/boot
Installing for x86_64-efi platform.
grub-install: error: /boot doesn't look like an EFI partition.


What is wrong here?

The /boot partition I am using is ext2.

The separate EFI partition is FAT32.

What am I doing wrong here?

Comments appreciated

MF

PPS

My fstab file looks like this:

Code:
/etc/fstab: static file system information.
#
# noatime turns off atimes for increased performance (atimes normally aren't
# needed); notail increases performance of ReiserFS (at the expense of storage
# efficiency).  It's safe to drop the noatime options if you want and to
# switch between notail / tail freely.
#
# The root filesystem should have a pass number of either 0 or 1.
# All other filesystems should have a pass number of 0 or greater than 1.
#
# See the manpage fstab(5) for more information.
#

# <fs>                  <mountpoint>    <type>          <opts>          <dump/pass>

# NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.
#
# NOTE: Even though we list ext4 as the type here, it will work with ext2/ext3
#       filesystems.  This just tells the kernel to use the ext4 driver.
#
# NOTE: You can use full paths to devices like /dev/sda3, but it is often
#       more reliable to use filesystem labels or UUIDs. See your filesystem
#       documentation for details on setting a label. To obtain the UUID, use
#       the blkid(8) command.

/dev/sda7               /boot           ext2            defaults        0 2
/dev/sda8               /               ext4            noatime         0 1
/dev/sda6               none            swap            sw              0 0
#/dev/cdrom             /mnt/cdrom      auto            noauto,ro       0 0
/dev/sda10              /boot/efi       vfat            defaults        0 2[


Should I get rid of the first line and now just use the vfat partition only as the boot partition?

Regards

MF

PPPS I ran
Code:
grub-install --target=x86_64-efi --efi-directory=/boot


and now grub-install seems to have succeeded:

Code:
fart /etc # grub-install --target=x86_64-efi --efi-directory=/boot/efi
Installing for x86_64-efi platform.
EFI variables are not supported on this system.
EFI variables are not supported on this system.
Installation finished. No error reported.


Genkernel ran OK so I am going to try to finish the grub configuration.

Comments on doingthis correctly are appreciated.

Regards

MF


Last edited by mikefot on Tue Apr 30, 2019 7:39 am; edited 1 time in total
Back to top
View user's profile Send private message
ilnanny
Tux's lil' helper
Tux's lil' helper


Joined: 17 Jul 2017
Posts: 98
Location: Italy/Taranto

PostPosted: Sun Apr 28, 2019 12:26 pm    Post subject: Reply with quote

UEFI startup requires the availability of an encryption key that is accessible only to an operating system started with UEFI.
if you have not started the kernel with UEFI you cannot generate other kernels able to start with UEFI

I don't know if there is any gentoo cdrom already configured to boot from UEFI.
but to solve your problem, you can start from any usb key or cd-rom with SystemRescueCd.
To partition you better use gparted, in your case (efi) it is more secure than fdisk
_________________
== Lila-HD-icon-theme ==
https://github.com/ilnanny/Lila-HD-icon-theme
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43783
Location: 56N 3W

PostPosted: Sun Apr 28, 2019 12:42 pm    Post subject: Reply with quote

ilnanny,

You are confusing secureboot with EFI.

To install an EFI boot loader, its required to write the EFIVARS, that EFI needs to be able to boot the EFI compliant program.
That can be a suitable kernel, directly or a boot loader. The system must be running in EFI mode to perform this step.

If you also have secureboot, that EFI program must be signed by a key known to the firmware but this is a separate requirement.
On x86, secureboot can be turned off. On arm systems shipped with Windows, its a Microsoft requirement that disabling secureboot is not possible.

Recent (since end 2018) Gentoo minimal CDs can start in EFI mode.

Its OK to install in legacy mode then to reboot in EFI mode to install the boot leader and configure the EFIVARS but that's more a fallback than a recommended approach.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
mikefot
Guru
Guru


Joined: 19 Nov 2014
Posts: 464

PostPosted: Sun Apr 28, 2019 1:46 pm    Post subject: Reply with quote

Many thanks for the help once again.

I notice looking here

https://wiki.gentoo.org/wiki/EFI_stub_kernel

that has has been kindly pointed out that the kernel would need to have the EFI option turned on in it......

I am a bit worried that I have opened Pandora's box here.

But the only way to learn is by doing I guess.

I used genkernel to make the kernel in this installation.

I used Sakaki's installation guide at first to help install from debian via a chroot without using the gentoo install DVD.

It worked. As a result I ended up doing some stage 1 and stage 2 type installations. I also installed her method of emerging packages in parallel and a separate package that
monitors the installation process.

I didn't want to install the version of gnome mentioned in it and the buildkernel stuff etc so I switched to the
standard kernel installation at the kernel install step.

It went OK but Sakaki's guide is about an efi set up amoingst other things. it has
somehow started me trying to use the efi system it seems.

Is there a way to go back and rerun genkernel so it works in efi mode?

I am a bit confused on certain aspects of this. I am currently using the bios method of booting.

My PC has Windows 10, debian 10 and gentoo stable on it.

I could try turning on the uefi boot system in Windows. I would rather not at present.

But if I can try the efi system out in Gentoo and it would work OK that would be edifying.

Suggestions on a wise course of action appreciated.

Regards

MF

PPS
could this command help?

[url]mount -o remount,rw /[/url]

see here
https://superuser.com/questions/296373/cannot-lock-etc-passwd-try-again-later


Last edited by mikefot on Mon Apr 29, 2019 11:33 am; edited 1 time in total
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43783
Location: 56N 3W

PostPosted: Sun Apr 28, 2019 1:57 pm    Post subject: Reply with quote

mikefot,

Turn off secureboot in the BIOS, if its on. Windows will hate you.
Turn off legacy/BIOS mode - set UEFI mode.

Boot in UEFI mode with a UEFI capable liveCD.
Install your boot loader following the UEFI instructions.

If you have your heart set on using a UEFI stub kernel, make it work first.
You have to embed the initrd, if you need one and any kernel parameters into the kernel binary, so the smallest tweak is a kernel rebuild.

The differences between BIOS mode and UEFI mode end at loading the kernel.
Once the kernel has control, how it got there doesn't matter any more.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
ilnanny
Tux's lil' helper
Tux's lil' helper


Joined: 17 Jul 2017
Posts: 98
Location: Italy/Taranto

PostPosted: Sun Apr 28, 2019 3:12 pm    Post subject: Reply with quote

ops then sorry, I misunderstood. Please excuse me for giving an incorrect answer.
_________________
== Lila-HD-icon-theme ==
https://github.com/ilnanny/Lila-HD-icon-theme
Back to top
View user's profile Send private message
mikefot
Guru
Guru


Joined: 19 Nov 2014
Posts: 464

PostPosted: Sun Apr 28, 2019 4:42 pm    Post subject: Reply with quote

Many thanks again.

I checked Windows and Debian - they are both running on the BIOS setup not EFI yet.

But the Gigabyte motherboard I am using seems to say that the UEFI is enabled......

Something called IOMMO it says.

I am beginning to think this is not as simple as it looks.

If I would get rid of the EFI FAT partition and delete the efi and efi/grub directories in /boot, could I then make
grub work with the BIOS as usual?

I think that may be the safest route.

I need to be able to stop the grumbling from grub about not finding an efi partition or directory etc.

Comments on the best way to retreat from the efi option gracefully appreciated.

Regards


MF
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43783
Location: 56N 3W

PostPosted: Sun Apr 28, 2019 5:14 pm    Post subject: Reply with quote

mikefot,

grub will work on a VFAT partition but there is one wrinkle to be aware of.
VFAT does not support symbolic links.

Install grub as usual. If it ends up on VFAT, that works, with the caveat above.


ilnanny,

No worries. It was spotted and corrected.
That's the way the forum works.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
bunder
Bodhisattva
Bodhisattva


Joined: 10 Apr 2004
Posts: 5871

PostPosted: Mon Apr 29, 2019 9:35 am    Post subject: Reply with quote

whoops wrong thread, dunno how i did that
_________________
Neddyseagoon wrote:
The problem with leaving is that you can only do it once and it reduces your influence.

banned from #gentoo since sept 2017


Last edited by bunder on Mon Apr 29, 2019 7:55 pm; edited 1 time in total
Back to top
View user's profile Send private message
mikefot
Guru
Guru


Joined: 19 Nov 2014
Posts: 464

PostPosted: Mon Apr 29, 2019 10:26 am    Post subject: Reply with quote

Many thanks again.

I have deleted the /boot/efi directory and the fat32 efi partition.

I am trying to go back on the bios wagon again.

I ran this command:

Code:
(chroot) fart / # grub-install /dev/sda
grub-install: error: /usr/lib/grub/i386-pc/modinfo.sh doesn't exist. Please specify --target or --directory.


I think the problem could be that I need to change the grub platform.

See here:

https://www.reddit.com/r/Gentoo/comments/4vnhvm/accidentally_thought_i_was_using_uefi_wasnt/

I may have to set it to "pc". I will investigate this.

I might have done something to it when following the
the Sakaki installation guide:

https://wiki.gentoo.org/wiki/Sakaki%27s_EFI_Install_Guide/Building_the_Gentoo_Base_System_Minus_Kernel

I didn't go any further than that page of it before switching to the conventional handbook installation for the kernel installation.

Comments appreciated on this.

Regards

MF

PS I notice that I have
Code:
GRUB_PLATFORMS="efi-64"
present in my make.conf.

I am going to change the
Code:
"efi-64"
to
Code:
"pc"


Is that OK?

I tried this and then ran the grub mkconfig command and it ran OK.

I rebooted into the new installation.

For some reason it thinks there is no host name or domain name......

But I thought I had specified them.

I will go and check this.

Also when I tried to run the useradd command to create a user account and password
I got an error message saying "failed to unlock passwd" or something like that.

What could cause that kind of error?

Comments appreciated.

MF


PPS

Would the command
Code:
mount -o remount,rw /
help here:

See:

https://superuser.com/questions/296373/cannot-lock-etc-passwd-try-again-later


PPPS

I am getting errors about a read-only disk problem etc.

I may have an error in the disk set up in the installation.

My
Code:
fstab
file looks like this:

Code:
chroot) fart /etc # more fstab
# /etc/fstab: static file system information.
#
# noatime turns off atimes for increased performance (atimes normally aren't
# needed); notail increases performance of ReiserFS (at the expense of storage
# efficiency).  It's safe to drop the noatime options if you want and to
# switch between notail / tail freely.
#
# The root filesystem should have a pass number of either 0 or 1.
# All other filesystems should have a pass number of 0 or greater than 1.
#
# See the manpage fstab(5) for more information.
#

# <fs>                  <mountpoint>    <type>          <opts>          <dump/pass>

# NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.
#
# NOTE: Even though we list ext4 as the type here, it will work with ext2/ext3
#       filesystems.  This just tells the kernel to use the ext4 driver.
#
# NOTE: You can use full paths to devices like /dev/sda3, but it is often
#       more reliable to use filesystem labels or UUIDs. See your filesystem
#       documentation for details on setting a label. To obtain the UUID, use
#       the blkid(8) command.

/dev/sda7               /boot           ext2            defaults        0 2
/dev/sda8               /               ext4            noatime         0 1
/dev/sda6               none            swap            sw              0 0
#/dev/cdrom             /mnt/cdrom      auto            noauto,ro       0 0
#/dev/sda10             /boot/efi       vfat            defaults        0 2



I have done something silly to achieve this problem.

Comments appreciated.

Regards

MF

PPPS Since I have solved the efi problem I am going to move this discussion to the kernel and hardware section now I am dealing with a disk writing problem.

Thanks

MF
Back to top
View user's profile Send private message
g2g591
Apprentice
Apprentice


Joined: 17 Sep 2007
Posts: 240

PostPosted: Tue Apr 30, 2019 8:17 am    Post subject: Reply with quote

for efi, you MUST have a fat32 efi system partition, where the bootloader and/or kernel your uefi firmware directly runs are (when using grub, it can read kernels elsewhere) . This can be your whole /boot or another directory.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43783
Location: 56N 3W

PostPosted: Tue Apr 30, 2019 8:41 am    Post subject: Reply with quote

mikefot,

Too many potential issues and too little data to work with.
Can you post a summary of the first problem you hit and supporting information please?

To go back to BIOS boot on a GPT formatted volume, you must have a 2M bios_boot partition for grub to use.
Not all systems support mixing BIOS and GPT any more either, so you may find you can't make it work.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
bunder
Bodhisattva
Bodhisattva


Joined: 10 Apr 2004
Posts: 5871

PostPosted: Tue Apr 30, 2019 9:29 am    Post subject: Reply with quote

g2g591 wrote:
for efi, you MUST have a fat32 efi system partition, where the bootloader and/or kernel your uefi firmware directly runs are (when using grub, it can read kernels elsewhere) . This can be your whole /boot or another directory.


it doesn't have to be fat32, i have a dell laptop that only works when it's fat16. i intended to post that in another thread, but it wound up here by mistake.
_________________
Neddyseagoon wrote:
The problem with leaving is that you can only do it once and it reduces your influence.

banned from #gentoo since sept 2017
Back to top
View user's profile Send private message
g2g591
Apprentice
Apprentice


Joined: 17 Sep 2007
Posts: 240

PostPosted: Tue Apr 30, 2019 10:22 am    Post subject: Reply with quote

bunder wrote:
g2g591 wrote:
for efi, you MUST have a fat32 efi system partition, where the bootloader and/or kernel your uefi firmware directly runs are (when using grub, it can read kernels elsewhere) . This can be your whole /boot or another directory.


it doesn't have to be fat32, i have a dell laptop that only works when it's fat16. i intended to post that in another thread, but it wound up here by mistake.
yeah, specific implementations are different (my particular mobo also happens to read ntfs in addition to fat32, but doesn't like boot entries pointing to secondary drives aside from the fallback bootx64.efi), but the spec says fat32.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
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