Jump to content
Welcome to our new Citrix community!
  • 0

Had issue with unclean poweroff of Host M2 drive, need to reinstall grub Xenserver 7.6.0

Rob Stockman


Hi all, wondering if you can help.


Had a Xen host suffer a power failure despite UPS and the main M2 drive didn't like it. Have managed to restore the M2 drive and all the XenHost data and partitions are all there, however the boot info has been lost from the M2 cache.


I can boot the Xenserver partition using SuperGrub2, so all good there, but the usual locations for a grub restore aren't working. 


Can someone please point me in the right direction for re-installing grub to the boot partition with the correct flags?


I have:

grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=grub (this errors saying directory not correct for EFI)


grub-mkconfig -o /boot/grub/grub.cfg (but there's not an existing grub.cfg at this location)


Am guessing XenServer uses some non-standard paths, just need to know what they are.


Many thanks

Link to comment

13 answers to this question

Recommended Posts

  • 0

Got it sorted, just took a bit of figuring out.


Turns out the server was set to boot both legacy and UEFI modes, which was causing some confusion with grub boot entries to use etc. Turns out didn't need changes to grub at all. The server had lost the UEFI information from it's NVRAM, hence the no-grub scenario, and the harddrive showing in the boot options menu was the legacy mode entry, which of course didn't exist as everything was originally set up UEFI.


If anyone else finds themselves in the same situation:


Download SuperGrub2 or similar, burn to CD/USB. 

Boot with SuperGrub (if you have a dual mode server, make sure you boot SuperGrub in UEFI mode). 

Use SG2's detect option, if it finds the boot information you're golden. Look for the entries in the /EFI/xenserver directories, make a note of the path and boot each one til you find the right one, mine was /EFI/xenserver/grubx64.efi

Xenserver will then boot as normal. Enter Admin Console mode when booted

Then, run 'efibootmgr' and 'efibootmgr -v' to get your current EFI boot options

Run 'findmnt /boot/efi' to get the partition and disk of the EFI partition

Then create a boot option for the above with

efibootmgr -c -d <path to disk not partition, i.e. /dev/sda or /dev/nvme0n1> -p <partition number from findmnt> -L <Label, I used XenServer> -l <path from SG2, in my case /EFI/xenserver/grubx64.efi>

Check with efibootmgr -v that you've created a valid entry (my first try the directory path didn't go in right)


Reboot server without SG2 and you should be there.


As an aside, if anyone else has issues with a supposedly dead SSD or M2 drive, if SSD detach the data cable and just leave power in, if M2 get a USB caddy, connect it up and then plug it into a USB charger (power only, no data). Leave the SSD/M2 for half an hour or more, most manufacturers have coded the option for the drive to rebuild its caches/tables if powered up with no data connections

  • Like 1
Link to comment
  • 0

I've just tried that, and Grub didn't throw any serious warnings but still not being picked up on system boot (yes, I did make sure to replace sda with the right drive :6_smile:)


Isn't Redhat/Centos 7 the underlying OS for XenServer? Might try and explore a few how-to's



Link to comment
  • 0
11 hours ago, Tobias Kreidl said:

Do you have another working system you can compare this to? As a first step, see if it will boot in single user mode. For help doing that, see:





Hi Tobias, I'm not getting the grub screen on boot (this is the root of the issue). I can only boot it using SuperGrub.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...