Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
problem running grub-mkconfig -o /boot/grub/grub.cfg
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
mikefot
l33t
l33t


Joined: 19 Nov 2014
Posts: 687

PostPosted: Thu Oct 15, 2020 9:58 am    Post subject: problem running grub-mkconfig -o /boot/grub/grub.cfg Reply with quote

Dear All

I am running gentoo stable on an FX 8350 box.

I tried running
Code:
grub-mkconfig -o /boot/grub/grub.cfg


to add a new kernel into the grub boot table.

I got the following output:

Code:
➜  mikef grub-mkconfig -o /boot/grub/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.8.14
Found initrd image: /boot/initramfs-5.8.14.img
Found linux image: /boot/vmlinuz-5.7.13
Found initrd image: /boot/initramfs-5.7.13.img
Found linux image: /boot/vmlinuz-5.4.38-gentoo
 WARNING: Failed to connect to lvmetad. Falling back to device scanning.
 WARNING: Device /dev/sda not initialized in udev database even after waiting 10000000 microseconds.
 WARNING: Device /dev/sda1 not initialized in udev database even after waiting 10000000 microseconds.
 WARNING: Device /dev/sda2 not initialized in udev database even after waiting 10000000 microseconds.
 WARNING: Device /dev/sda3 not initialized in udev database even after waiting 10000000 microseconds.
^C


I think I need to reinstall grub to fix this.

I think I have a uefi installation here. So I need to run a command like

Code:
grub-install --efi-directory=/boot/efi


to do it properly for my set up.

I tried running this command:

Code:
➜  mikef grub-install --efi-directory=/boot/efi
Installing for x86_64-efi platform.
grub-install: error: failed to get canonical path of `/boot/efi'.
➜  mikef



My fstab file is here:

Code:
➜  /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/sda1               /boot/efi       vfat            noauto,noaatime 1 2
/dev/sda4               /               ext4            noatime         0 1
/dev/sda3               none            swap            sw              0 0
#/dev/cdrom             /mnt/cdrom      auto            noauto,ro       0 0
➜  /etc


I think I might need to run a mount command to mount the
Code:
 /boot/efi
partition on
Code:
/dev/sda1
or something to make grub reinstall properly.
Suggestions appreciated on this.

Regards

MF

PS

The
Code:
make.conf
file I am using looks like this:

Code:
➜  portage more make.conf
# These settings were set by the catalyst build script that automatically
# built this stage.
# Please consult /usr/share/portage/config/make.conf.example for a more
# detailed example.
COMMON_FLAGS="-O2 -pipe"
CFLAGS="${COMMON_FLAGS}"
CXXFLAGS="${COMMON_FLAGS}"
FCFLAGS="${COMMON_FLAGS}"
FFLAGS="${COMMON_FLAGS}"
MAKEOPTS="-j9"

USE="elogind X alsa mdev pulseaudio consolekit ipv6 udev"


VIDEO_CARDS="nouveau"

INPUT_DEVICES="libinput synaptics"

ACCEPT_LICENSE="* =@EULA"


# NOTE: This stage was built with the bindist Use flag enabled
PORTDIR="/var/db/repos/gentoo"
DISTDIR="/var/cache/distfiles"
PKGDIR="/var/cache/binpkgs"

# This sets the language of build output to English.
# Please keep this setting intact when reporting bugs.
LC_MESSAGES=C

GENTOO_MIRRORS="https://mirror.bytemark.co.uk/gentoo/"
GRUB_PLATFORMS="efi-64"
➜  portage
Back to top
View user's profile Send private message
yxprogramming
n00b
n00b


Joined: 25 Oct 2020
Posts: 21

PostPosted: Mon Oct 26, 2020 4:57 pm    Post subject: Reply with quote

Can you run "fdisk -l" for your hard drive? It's possible you're mounting the wrong partition to /boot/efi. Please paste the output for /dev/sda here.
Back to top
View user's profile Send private message
mikefot
l33t
l33t


Joined: 19 Nov 2014
Posts: 687

PostPosted: Tue Oct 27, 2020 2:34 pm    Post subject: Reply with quote

Many thanks for your reply and suggestion.

Here is the output from running
Code:
fdisk -l
:

Code:
➜  mikef fdisk -l
Disk /dev/sda: 232.91 GiB, 250059350016 bytes, 488397168 sectors
Disk model: WDC WD2500AAJS-6
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: 0x94e26dd6

Device     Boot     Start       End   Sectors   Size Id Type
/dev/sda1  *         2048  17326079  17324032   8.3G ef EFI (FAT-12/16/32)
/dev/sda2        17326080 198555647 181229568  86.4G 83 Linux
/dev/sda3       198555648 208795647  10240000   4.9G 82 Linux swap / Solaris
/dev/sda4       208795648 488396799 279601152 133.3G 83 Linux
➜  mikef


Comments appreciated.

Regards

MF

PS
Code:
/boot
seems to be mounted automatically when I log in now:

Code:
➜  mikef ls /boot
System.map-5.4.38-gentoo        grub
System.map-5.7.13               initramfs-5.7.13.img
System.map-5.8.14               initramfs-5.8.14.img
System.map-5.9.0-gentoo         initramfs-5.9.1-gentoo-x86_64.img
System.map-5.9.1                initramfs-5.9.1.img
System.map-5.9.1-gentoo-x86_64  vmlinuz-5.4.38-gentoo
config-5.4.38-gentoo            vmlinuz-5.7.13
config-5.7.13                   vmlinuz-5.8.14
config-5.8.14                   vmlinuz-5.9.0-gentoo
config-5.9.0-gentoo             vmlinuz-5.9.1
config-5.9.1                    vmlinuz-5.9.1-gentoo-x86_64
efi
➜  mikef
Back to top
View user's profile Send private message
yxprogramming
n00b
n00b


Joined: 25 Oct 2020
Posts: 21

PostPosted: Tue Oct 27, 2020 5:30 pm    Post subject: Reply with quote

So your issue seems to be that /dev/sda1 is your ESP, not your actual boot partition. You need /dev/sda2 to be your boot partition. Use fdisk to remove the boot flag from /dev/sda1 and mark /dev/sda2 as bootable. Unfortunately this messes most of your installation, as you'll need to repartition the disks and rebuild the filesystems, which'll erase all of your previous progress.

The is is just a suggestion, but your boot partition and ESP seem very large. If there's not a reason for this, you can shrink them down considerably. If you're only booting Gentoo you can get away with a 2MiB ESP and a 128MiB boot partition.

For partitioning your disk I'd reccomend following the Gentoo handbook, as it explains the process much better than I could.
Back to top
View user's profile Send private message
mikefot
l33t
l33t


Joined: 19 Nov 2014
Posts: 687

PostPosted: Fri Oct 30, 2020 5:53 pm    Post subject: Reply with quote

Many thanks for your suggestions.

I think part of the problem was that I installed Ubuntu on the drive first I think and did my best to do an EFI install that ubuntu was happy with. Ubuntu is on /dev/sda2.

The common linux swap is on
Code:
/dev/sda3
.

Gentoo /root partition and general install is on
Code:
/dev/sda4
.

What I could do here is to format
Code:
/dev/sda1
and then convert the free space created into a new correctly configured efi boot partition according to your best recipe.

I can then recompile the kernels and put new boot loader files into the new efi boot directory.

Then gentoo should work again.

PS I could also create this ESP thing adjacent ot the new boot partition as needed. Does it need to be a separate partition?

If so
Code:
/dev/sda1
would be the new efi boot partition ;
Code:
/dev/sda2
would be the new ESP partition and the other parttions would be renamed
Code:
/dev/sda3
(ubuntu) and
Code:
/dev/sda4
(common swap area)and
Code:
/dev/sda5
would become the gentoo root partition.

As you say both need to be small.

Suggestions welcome.

Regards

MF

PS After that I can likely persuade the ubuntu installer to recognise the new gentoo fashioned efi boot partition and then repair the ubuntu install.

I could also use the ubuntu boot repair software I have on a USB drive to help do the same thing.

Supergrub helps when you do this stuff.

The legacy pc boot regime was simpler than the efi boot system.

I need to play around with it to get used to it better.
Back to top
View user's profile Send private message
GDH-gentoo
Guru
Guru


Joined: 20 Jul 2019
Posts: 548
Location: South America

PostPosted: Fri Oct 30, 2020 11:16 pm    Post subject: Reply with quote

Let's see.

mikefot wrote:
Code:
➜  mikef fdisk -l
[...]
Device     Boot     Start       End   Sectors   Size Id Type
/dev/sda1  *         2048  17326079  17324032   8.3G ef EFI (FAT-12/16/32)
/dev/sda2        17326080 198555647 181229568  86.4G 83 Linux
/dev/sda3       198555648 208795647  10240000   4.9G 82 Linux swap / Solaris
/dev/sda4       208795648 488396799 279601152 133.3G 83 Linux
This drive already has an EFI System Partition (ESP): it's /dev/sda1. That's where GRUB installs itself on a UEFI system.

mikefot wrote:
Gentoo /root partition and general install is on
Code:
/dev/sda4
.
Which likely means that /boot is in the same partition as the rest of Gentoo (/dev/sda4), and not a separate partition. In that case:

mikefot wrote:
Code:
/boot
seems to be mounted automatically when I log in now:
It's not automatically mounted, there is simply nothing to mount. When Gentoo's kernel mounts the root filesystem, /boot 'appears' with it as well. There's nothing wrong with setup, and I think GRUB supports this.

mikefot wrote:
Code:
➜  /etc more fstab
[...]
/dev/sda1               /boot/efi       vfat            noauto,noaatime 1 2
This specifies that the ESP must be mounted at /boot/efi, but noauto means that you'll have to do it manually before running grub-install.

This requires attention:

mikefot wrote:
I think part of the problem was that I installed Ubuntu on the drive first I think and did my best to do an EFI install that ubuntu was happy with. Ubuntu is on /dev/sda2.
So that makes this system dual-boot (Gentoo + Ubuntu), and the Ubuntu installer has probably already installed GRUB on the ESP. You need to set things up so that those two distributions don't fight for the control of the bootloader, unless you want to get rid of Ubuntu after you install Gentoo.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming 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