Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I was trying to install ncurses on a virtual Debian server on VMware and somehow was unsuccessful. After logging out of the console, I realized that I could not log in anymore. I cannot use tools such as scp, WinSCP or SSH client to get into the server. When I try to log in on the getty console, I get the below message and find myself at the login prompt again. In short, I'm locked out of the [virtual] server. This is a production server and therefore rebooting it would be a last resort.

I have downloaded a couple live CDs - Damn small Linux and Slitaz - which unfortunately cannot detect the VMs hard drives. Would changing the VM's hard drive controller lead to data loss?

login as: saichovsky
saichovsky@172.16.13.7's password:
Linux myhost 2.6.32-5-amd64 #1 SMP Wed Jan 11 14:00:43 UTC 2012 x86_64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Fri Nov  2 17:39:03 2012 from 192.168.3.166
-bash: error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory
share|improve this question
    
Since you did not mention anything about the file system, I assume it is a regular file system. Therefore, you can't mount it on another VM while your production VM is running. How exactly did you try to see the hard drives with a live CD while the VM is running, without rebooting it from the CD? –  pino42 Nov 6 '12 at 13:54

2 Answers 2

up vote 1 down vote accepted

Method 1 : ssh to sh shell

Try following if you have ssh access to the host

ssh username@hostname "/bin/sh -i"

That will let you login with sh instead of bash if successful.

Method 2 : mounting VM Disk with another VM

I posted the step at http://superuser.com/questions/501861/locked-out-of-opensuse-after-editing-etc-pam-d-xdm/501927#501927. But he was able to resolve in another way. I will just paste the step here if you want to go this route

VM1: The trouble VM

VM2: Another working VM with root access.

  1. Shutdown both VMs.
  2. Make a copy of VM1 virtual disk file.
  3. Addn VM1 virtual disk into VM2 disk controller as a second disk.
  4. Start VM2.
  5. Gain root access.
  6. Mount VM1 disk.
    Let assume VM1 root partition is /dev/sdb1
    mkdir /mnt/sdb1
    mount /dev/sdb1 /mnt/sdb1
  1. Modify the file accordingly.
  2. Shutdown VM2.
  3. Remove VM1 disk from VM2.
  4. Start VM1 and test.
share|improve this answer
    
Thanks John, I solved the problem yesterday. I used the second approach, using the lvm2 package. There was no data loss :-) I didn't know that I could specify the login shell that I wish to use on ssh. Thanks! –  Saichovsky Nov 9 '12 at 20:02

Use a Debian live CD to rescue the system. Many specialized live CDs such as those you mentioned have kernels with only a very limited set of drivers. Since it's a Debian system, the Debian installation media should have the necessary drivers.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.