I have broken my Ubuntu Server VM, which is hosted on Xenserver, by improper entry in /etc/sudoers. Hence, I was stuck without the possiblity to run any command with sudo.
The solution in case of a desktop installation is to press ESC during boot and then simply select a recovery console in GRUB. However, no matter how fanatically you will press ESC when booting VM through Xenceter, AFAIK you would not be able to access the Recovery Console.
In some posts (eg. here or here) people recommend to start the VM in Recovery Mode that is provided by Xenserver (accessible by VM -> Start/Shutdown -> Start in Recovery Mode). The problem is that by default in this mode the system starts to boot from CD/DVD. This would be ok if Ubuntu Live CD would work in Xenserver, but it doesn’t! (vide this question on StackExchange).
Luckily, there is a simple solution! The Root Console can be called directly by change the VM boot options (eg. through Xencenter):
Backup! Make a snapshot of the problematic VM.
Right click on the problematic VM -> Properties, then go to the Boot Options tab.
Modify OS Boot Parameters from:
-- quiet console=hvc0
Boot/reboot the VM normally and select Drop to root shell prompt
Voila! Now you can perform as root the operations needed to recover the system.
Change back the OS Boot Parameters and reboot.
Somehow this is not described in Xenserver docs. I have fond it here.
I have just shown a Turnkey Linux Rails (VirtualBox edition) to my RoR developer friend. He really enjoyed using it, however after a few days he mentioned that he had a problem – every time he moved his laptop to a different network, he needed to restart Linux in orded to detect the proper IP through bridged network card connection. This is a distinct loss of time!
There is a simple command to renew (restart, or rather reflush) the ethernet connection, that will result in the renewing of DHPC IP. Assuming your network connection is eth0 (you can check it with ifconfig command), just type:
And that’s all! The new IP would be printed in the output of the last command.