0

I am attempting to install nfs-utils (and thus all its dependencies) in a stateless RHEL6.5 KVM VM. The VM is configured to have a read-only root via the /etc/sysconfig/readonly-root file, Linux magic that I didn't implement, and the "Readonly" option in the VM settings GUI. The installation is done using virt-customize -a image.img --run install_script.sh. The script uses a here-document to build the .repo file (which goes to the CentOS vault for 6.5), then I use yum install -y nfs-utils to do the actual installation. I've taken this approach because it appears easier, cleaner, and less error-prone than getting the VM to boot in read/write mode, installing, cleaning up, then shutting down. Also, I can't figure out how to get it to boot into read/write.

The output of the virt-customize showed that the packages were installed successfully. The only failure was the removal of the .repo due to a typo.

After this installation, I booted up the VM and attempted to login as usual. My attempts are now being rejected because Login incorrect.

I checked with virt-cat to make sure that the login shell for the user was set correctly, and the encrypted password in /etc/shadow looks the same as the original.

My original approach was to create an ISO image containing all the dependencies and nfs-utils, and attach that to the VM and have a script handle the installation. The same issue occurred then. I narrowed the issue's source down to the installation of one of the NFS packages: either nfs-utils or nfs-utils-lib (One of the two, I can't remember), and the rpcbind package. When one of these packages is installed, and then the VM is booted, login breaks. I am guessing that this is the same issue occurring now.

The image I'm using for the VM is cp-ed from the original VM's image as this is a test to figure out how to do the installation correctly.

Yes, I am entering the password correctly. I've tried to change the user's password (via libguestfs tools), but I still can't log in, so I'm not sure if the change failed (the return code for the commands indicates success) or the same problem is in effect.

Question:

  1. Can the login issue be debugged and fixed? If so, how?
  2. How do I do the installation correctly so that login doesn't get borked? Clearly this way doesn't work.
0

The core issue here was SELinux. There are multiple ways to install software into a VM, but they boil down to the VM being booted, or not being booted. The latter is what screws everything up, and it's how I did the install in the post.

As best as I can figure, when the VM is shutdown, and software is installed e.g. via the command in the question, SELinux realizes something changed, and it doesn't know what happened when the VM is booted after install, and locks everything down. Allowing SELinux to relabel fixes the issue, but broke a lot of other stuff for me. There is, effectively, no way to script an installation when the system is offline because you'll probably run into this. Note, this issue could just be with RHEL6.5 VMs and their version of SELinux (we are version-locked to RHEL6.5).

The proper way of doing an install for a VM like this is to boot it into read/write mode and carry out the installation either via mounting an ISO with the required RPMs, or using a package manager. While booted, SELinux will be aware of the installation, and everything will be fine and dandy.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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