Reset root password on Xen DomU

Heres a simple method to get this accomplished.What we normally do on a PC if root password is lost is..console the machine and when the grub boot menu startsup edit the kernel commandline parameter to include init=/bin/sh which makes the kernel to use the sh shell as the init program instead of the hardcoded /sbin/init program .Since /sbin/init is designed to spawn the login program in the end you will need a password to login .Luckily the sh shell doesnt prompt you a password and just gives you a prompt wherein you can run the passwd command ( simple isnt it)

xm shutdown <domain>  if it is already running

xm create -c <domain>

on the pygrub screen just edit the kernel command line options and add init=/bin/sh to the end

Press b to boot this kernel and you will be dropped to the sh shell

!Remember to delete the ro (read only ) option in the kernel command line or else the first command you must run once inside the domU must be

mount -o remount,rw /

Otherwise passwd command will throw out the following error

====

passwd: Authentication token lock busy

====

Share and Enjoy:
  • Digg
  • Mixx
  • del.icio.us
  • StumbleUpon
  • Facebook
  • TwitThis
  • Technorati
  • Google

Tags:

One Response to “Reset root password on Xen DomU”

  1. bathroom suites Says:

    Food for thought.

Leave a Reply