On Fri, Apr 20, 2012 at 05:48:06PM +0400, Daneel Yaitskov wrote:
I have a VM with CentOs6.2 on KVM. I mount an image of the VM when it's not working with guestmount:
root@diehard:~# guestmount -a named-centos.img -i tmp
vi /etc/shadow
Hopefully you edited the guest's tmp/etc/shadow, not your host's /etc/shadow ...
insert comment line into the file (esc yy p 0 i # esc :wq!), save changes, unmount the image, turn on the VM, and I cannot login.
I cannot login even if I recover the shadow file.
Not much information to go on here, but my guess is that /etc/shadow has the wrong permissions or SELinux context after you edited it. We recently fixed this bug in virt-edit: https://bugzilla.redhat.com/show_bug.cgi?id=788641 but that doesn't help you if you're using guestmount. These are what they should be on a RHEL 6 system: $ ll -Z /etc/shadow ----------. root root system_u:object_r:shadow_t:s0 /etc/shadow If that doesn't help, have a look for the error (/var/log/messages, /var/log/secure, or /var/log/audit/audit.log): $ guestfish --ro -a named-centos.img -i
<fs> less /var/log/messages [etc]
Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-df lists disk usage of guests without needing to install any software inside the virtual machine. Supports Linux and Windows. http://et.redhat.com/~rjones/virt-df/