Resetting XCP-ng lost root password

I need to reset my XCP-ng host root password. Not sure how but I set it something completely non-standard and have now forgotten it. I have tried every password I can think of. I scoured my password manager database - embarrassing lack of information there.

Lesson learnt: (note to self) put the hypervisor root password in the password manager stupid.

How to fix this?

Options:

  1. Find the XCP-ng Center configuration where the password must be…
    I spent time looking for where XCP-ng Center stores the configured hosts data, as it knows the password and it can reboot the host just fine. A long search on the desktop where XCP-ng center is installed and nothing found by searching the registry. Nothing found relating to the configured host looking all over the filesystem. Issue not helped by my naming the host xcp-ng.

  2. Look for a password reset procedure. Citrix to post such a document
    Resetting Lost Root Password in XenServer 7.0
    This does not exactly match my xcp-ng 8.0.0 install, but the grub boot entry is very similar and I tried changing “ro” for “rw init=/sysroot/bin/sh” and booting. I did not get “Emergency mode” so I can set the root password.

So - has anyone had to reset their XCP-ng root password? How did you do it?

Thanks for any help in advance. Fortunately, I can wait and not do anything rash as everything is still working ok, except I presumably cannot upgrade or change system settings.

Thanks,

I found a tantalising post on the xcp-ng.org forum:
Reset Root Password Procedure

Basically the idea is to boot to “safe mode”, then update the password as with the Citrix process…

However, when I select “XCP-NG Safe Mode” in the grub boot menu, I get to the usual screen and no command prompt. Argh!

An ideas very welcome.

I have never had to do this on an XCP-NG system, but following the " Reset Lost Root Password Using Live CD" process might work.

1 Like

Thanks Tom. Your steer was enough! :smiley:

I tried downloading UIbuntu live CD, but found it confusing to download an installer, boot from it to create a live CD… perhaps the server ISO was a mistake and desktop iso would allow live boot. Taking a hint from your endless recommendations I tried Debian and it worked fine first time. I recommend Debian Live ISO to anyone who later follows this path - below is a summary of my steps, all of which came from the recommended page from Tom (above).

  1. Download Debian Live am64 standard ISO, and create a bootable USB memory stick with belana Etcher. Use a USB memory stick which is ordinary so the BIOS will access it. Hint - not USB3 :wink:
  2. Boot from USB stick: Dell t410 +F11 at boot --> UEFI boot menu, select memory stick…
  3. From boot menu, choose Live boot, at linux prompt …
  4. sudo su - to switch to root user, prompt changes
  5. fdisk -l to list partitions. Find the one which is the boot drive (I found my by size) and look for the sd[abc][0-9] that is a good size, probably the system partition. This is THE critical thing to get right
  6. mkdir /mnt/recover to attach the system partition to.
  7. mount /dev/sd[abc][0-9] /mnt/recover to attach the system partition
  8. chroot /mnt/recover to swtich to the mounted system partition. The prompt changes?
  9. passwd root, and enter the new password and confirm
  10. exit
  11. umount /mnt/recover
  12. exit
  13. sudo reboot now, and remove the USB stick

The system reboots, and log in with the new password.

  1. Record the password in your password manager, stupid.

Thank you Tom. I owe you (again). The generosity of your time and experience is what makes your channel really worthwhile watching, and I am sure your customers in the US loyal and long term.

Best regards from the UK.