LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > CentOS
User Name
Password
CentOS This forum is for the discussion of CentOS Linux. Note: This forum does not have any official participation.

Notices


Reply
  Search this Thread
Old 09-30-2018, 01:56 PM   #1
Bruce Hill
HCL Maintainer
 
Registered: Jun 2003
Location: McCalla, AL, USA
Distribution: Arch, Gentoo
Posts: 6,940

Rep: Reputation: 129Reputation: 129
Recover CentOS UEFI entry


I have a messed up UEFI implementation, and can't seem to get CentOS' entry working again. Originally, both CentOS on /dev/sdb and Gentoo on /dev/sda could be loaded from a GrUB menu when starting the laptop. The boot order in GrUB was controlled by the GrUB on CentOS, not Gentoo.

Last week I decided to move it to Gentoo, and now I can't boot CentOS at all. I was able to get it to boot Gentoo again by using the "File Browser Add Boot Options" and navigating to the /EFI/gentoo/grubx64.efi entry, but can't seem to do the same for CentOS. (It is a Dell XPS 15 9530) NB: I would be quite happy to somehow add CentOS to Gentoo's GrUB menu and boot from it.


I've booted the laptop, gone into Setup, and removed all the "Boot Option Priorities" via "File Browser Del Boot Options". No matter how many times I have done this, it will always, somehow, restore the Ubuntu entry, which was on sdb before CentOS. Even when I removed all the options, hit F10 to Save and reboot, hit F12 to get the Boot Option menu, it has UEFI Options: Ubuntu and USB1 - UEFI OS (which is CentOS USB).

I am trying to add CentOS' GrUB from /dev/sdb by booting the CentOS USB and choosing Troubleshooting --> Restore a CentOS system. This allows me to:
1) Continue, then enter my LUKS passphrase, then for Boot Selection it offers:
[x] 1) Unknown Linux on /dev/sda3
[ ] 2) CentOS Linux Linux 7.5.1804 for x86_64 on /dev/mapper/centos-root

After choosing 2 for CentOS then c to continue, it states the system has been mounted at /mnt/sysimage and press Enter to get a shell and run `chroot /mnt/sysimage` to make your system the root environment. I can chroot, but can't seem to get the correct combination to get a CentOS entry to UEFI and boot it.

Previously I have entered `efibootmgr -c -L CentOS -l /EFI/centos/grubx64 -d /dev/sdb` (and also /dev/sda) as well as other options under /boot/efi/EFI/centos/ but none results in a bootable entry.
These are details of disks, specifically for /dev/sdb:
Code:
/etc/fstab:
Filesystem              Type      Size  Used Avail Use% Mounted on
/dev/mapper/centos-root xfs        26G   19G  7.3G  72% /
devtmpfs                devtmpfs  3.9G     0  3.9G   0% /dev
tmpfs                   tmpfs     3.9G     0  3.9G   0% /dev/shm
tmpfs                   tmpfs     3.9G   17M  3.9G   1% /run
/dev/sdb2               xfs      1014M  281M  734M  28% /boot
/dev/sdb1               vfat      200M   11M  190M   6% /boot/efi
/dev/sdd1               xfs        15G  6.0G  8.8G  41% /mnt/gentoo
Code:
fdisk -l /dev/sd[b,a]:
Disk /dev/sdb: 32.0 GB, 32017047552 bytes, 62533296 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
Disk label type: gpt
Disk identifier: 866F27F1-9A02-4865-826A-149D5C963E6B


#         Start          End    Size  Type            Name
 1         2048       411647    200M  EFI System      EFI System Partition
 2       411648      2508799      1G  Microsoft basic 
 3      2508800     62531583   28.6G  Microsoft basic 

Disk /dev/sda: 512.1 GB, 512110190592 bytes, 1000215216 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
Disk label type: gpt
Disk identifier: CAE3F3FC-01B5-403E-AF15-FBDDAB7395D0


#         Start          End    Size  Type            Name
 1         2048      1026047    500M  EFI System      EFI System
 2      1026048      9414655      4G  Linux swap      Linux swap
 3      9414656    219129855    100G  Linux filesyste Linux filesystem
 4    219129856   1000215182  372.5G  Linux filesyste Linux filesystem
Code:
lsblk
NAME                                          MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sda                                             8:0    0   477G  0 disk  
├─sda1                                          8:1    0   500M  0 part  
├─sda2                                          8:2    0     4G  0 part  [SWAP]
├─sda3                                          8:3    0   100G  0 part  
└─sda4                                          8:4    0 372.5G  0 part  
sdb                                             8:16   0  29.8G  0 disk  
├─sdb1                                          8:17   0   200M  0 part  /boot/efi
├─sdb2                                          8:18   0     1G  0 part  /boot
└─sdb3                                          8:19   0  28.6G  0 part  
  └─luks-91958809-4dcf-441a-82fe-d210b830b89e 253:2    0  28.6G  0 crypt 
    ├─centos-swap                             253:3    0     3G  0 lvm   [SWAP]
    └─centos-root                             253:4    0  25.6G  0 lvm   /
Code:
mount (with LiveUSB and a flash drive):
/dev/mapper/centos-root on / type xfs (rw,relatime,seclabel,attr2,inode64,noquota)
/dev/sdb2 on /boot type xfs (rw,relatime,seclabel,attr2,inode64,noquota)
/dev/sdb1 on /boot/efi type vfat (rw,relatime,fmask=0077,dmask=0077,codepage=437,iocharset=ascii,shortname=winnt,errors=remount-ro)
devtmpfs on /dev type devtmpfs (rw,nosuid,seclabel,size=4010000k,nr_inodes=1002500,mode=755)
devpts on /dev/pts type devpts (rw,relatime,seclabel,gid=5,mode=620,ptmxmode=000)
tmpfs on /dev/shm type tmpfs (rw,relatime,seclabel)
proc on /proc type proc (rw,relatime)
tmpfs on /run type tmpfs (rw,nosuid,nodev,seclabel,mode=755)
sysfs on /sys type sysfs (rw,relatime,seclabel)
efivarfs on /sys/firmware/efi/efivars type efivarfs (rw,relatime)
selinuxfs on /sys/fs/selinux type selinuxfs (rw,relatime)
/dev/sdd1 on /mnt/gentoo type xfs (rw,relatime,seclabel,attr2,inode64,noquota)
Code:
parted /dev/sdb print:
Model: ATA Micron C400 Real (scsi)
Disk /dev/sdb: 32.0GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    File system  Name                  Flags
 1      1049kB  211MB   210MB   fat16        EFI System Partition  boot
 2      211MB   1285MB  1074MB  xfs
 3      1285MB  32.0GB  30.7GB
Does anyone know how to fix this so I can create a bootable entry for CentOS?
 
Old 09-30-2018, 06:42 PM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,152

Rep: Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125
I usually just take the easy route and re-install grub - as in grub-install, not a full package (re-)install. That creates the NVRAM entry automagically, and then it's just a matter of fixing the default boot entry with efibootmgr.
Been a while since I looked at CentOS, and I never tried this, but a quick search found this - note the differences in parms passed to efibootmgr.
 
Old 09-30-2018, 08:15 PM   #3
Bruce Hill
HCL Maintainer
 
Registered: Jun 2003
Location: McCalla, AL, USA
Distribution: Arch, Gentoo
Posts: 6,940

Original Poster
Rep: Reputation: 129Reputation: 129
From the link you provided
Code:
efibootmgr --create --label CentOS --disk /dev/sda1 --loader "\EFI\centos\shim.efi"
is what I already tried, from my first post:
Quote:
Previously I have entered `efibootmgr -c -L CentOS -l /EFI/centos/grubx64 -d /dev/sdb` (and also /dev/sda) as well as other options under /boot/efi/EFI/centos/ but none results in a bootable entry.
From `man efibootmgr`:
-c | --create
-L | --label LABEL
-l | --loader NAME
-d | --disk DISK

I did not, however, try the shim.efi entry. I don't get a "Failed to open" or "Failed to load image" or "... Not found", because the image is there, and it does create a CEntOS entry. It just won't boot from it.

Just now tried /boot/efi/EFI/centos/shim64.efi and /boot/efi/EFI/centos/shim64-centos.efi. All fail to boot.
 
Old 09-30-2018, 08:57 PM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,152

Rep: Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125
Quote:
Originally Posted by Bruce Hill View Post
From the link you provided
Code:
efibootmgr --create --label CentOS --disk /dev/sda1 --loader "\EFI\centos\shim.efi"
is what I already tried,
No it isn't. The look at the --disk parm; that's the EFI partition, not the device node you used. I have no idea which is (more) valid.
 
Old 10-01-2018, 08:22 AM   #5
Bruce Hill
HCL Maintainer
 
Registered: Jun 2003
Location: McCalla, AL, USA
Distribution: Arch, Gentoo
Posts: 6,940

Original Poster
Rep: Reputation: 129Reputation: 129
Quote:
Originally Posted by syg00 View Post
No it isn't. The look at the --disk parm; that's the EFI partition, not the device node you used. I have no idea which is (more) valid.
That noobie guide was incorrect.

From `man efibootmanager`
Code:
       -d | --disk DISK
              The disk containing the loader (defaults to /dev/sda)
I ran out of time to try this and that. Since I already had everything backed up,
it was more efficient to reinstall CentOS, during which it installed GrUB, along
with an entry for Gentoo.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to get UEFI Entry for FreeBSD in menu paracoder *BSD 2 08-30-2018 11:43 AM
need help regarding PXE boot through 1G,10 G UEFI using centos 6.5 elili Linux - Networking 1 03-19-2014 08:04 PM
Lost UEFI boot entry. Richy_T Slackware 4 02-08-2014 07:04 PM
How to recover CentOS rahilmaknojia Linux - Server 3 08-03-2008 12:31 AM
CentOS - Triple Boot - GRUB Entry shankariyer Red Hat 4 10-27-2007 10:32 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > CentOS

All times are GMT -5. The time now is 07:52 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration