Thank You for your reply.
>What was the output of the 'virt-rescue --suggest -d XYZ'?
Inspecting the virtual machine or disk image ...

This disk contains one or more operating systems.  You can use these mount
commands in virt-rescue (at the ><rescue> prompt) to mount the filesystems.

# /dev/sda1 is the root of a linux operating system
# type: linux, distro: ubuntu, version: 12.4
# Ubuntu 12.04.3 LTS

mount /dev/sda1 /sysroot/
mount --bind /dev /sysroot/dev
mount --bind /dev/pts /sysroot/dev/pts
mount --bind /proc /sysroot/proc
mount --bind /sys /sysroot/sys

>And did you run _all_ those commands?
yes I run all those commands in this sequence:
virt-rescue --network -d XYZ
mou
nt /dev/sda1 /sysroot/
chroot /sysroot
update-initramfs -c -k 3.2.0-58-generic

But it failed with following error:
update-initramfs: failed for /boot/initrd.img-3.2.0-58-generic with 1.


Actually one of my VM in KVM platform got corrupted.When I try to start it,I get the menu and after selecting Ubuntu, with Linux 3.2.0-58-generic it gives an error "Kernel Panic - not Syncing: VFS: Unable to mount root fs on unknown-block(0,0).So I thought of updating the initramfs to see if the problem is resolved.But updation is failing.Your valuable suggestion is awaited.

On Tue, Dec 2, 2014 at 11:05 PM, Richard W.M. Jones <rjones@redhat.com> wrote:
On Tue, Dec 02, 2014 at 02:26:49PM +0000, Suvajit Sarkar wrote:
> Hello,
> I am trying to run this command
> virt-rescue --suggest -d XYZ
> virt-rescue --network -d XYZ
> the prompt is looking like this:
> I have no name!@(none):

This is probably:
https://bugzilla.redhat.com/show_bug.cgi?id=812970
It is supposed to be fixed in libguestfs >= 1.28.

> now I mounted the root partition suggested by virt-rescue to /sysroot
> then chroot /sysroot
> after that I tried to rebuild an initrd.img with the following command
>
> update-initramfs -c -k 3.2.0-58-generic
>
> But it failed with following error:
> update-initramfs: failed for /boot/initrd.img-3.2.0-58-generic with 1.

What was the output of the 'virt-rescue --suggest -d XYZ'?

And did you run _all_ those commands?

> Also when running  apt-get update , it fails saying "no address associated
> with hostname.

Likely you need to copy /etc/resolv.conf to /sysroot/etc/resolv.conf
as well, so that name resolution works inside the chroot.

> host configuration:ubuntu 14.04
> guest:ubuntu 12.04

Rich.

--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
libguestfs lets you edit virtual machines.  Supports shell scripting,
bindings from many languages.  http://libguestfs.org



--
Thanks and regards,
Suvajit Sarkar