Bug 1317180

Summary: virt-sysprep fails with immutable files
Product: [Community] Virtualization Tools Reporter: Nicholas Westlake <nickwniko89>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: NEW --- QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: aouadi, ptoscano
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Nicholas Westlake 2016-03-12 19:57:19 UTC
Description of problem:
virt-systemprep fails with immutable files.

Version-Release number of selected component (if applicable):
virt-sysprep 1.24.5

How reproducible:
Calling virt-systemprep with an immutable file.

Steps to Reproduce:
1. Create a VM, e.g. Centos 6, with a raw disk image for /.
2. Make ~/.ssh/authorized_keys immutable for any user in the image using  chattr +i ~/.ssh/authorized_keys.
3. Shut down the vm. 
4. Call virt-systemprep on the hard drive image.

Actual results:
The step fails.

Expected results:
The process succeeds: with root access, the file could be removed, e.g. with chattr -i.

Additional info:
- I believe ssh-userdir was the one which causes it to fail.
- Note that rm -rf fails here too, even as root.

Comment 1 Richard W.M. Jones 2016-03-31 12:18:23 UTC
Link back to the upstream thread that discussed this:
https://www.redhat.com/archives/libguestfs/2016-March/thread.html#00104

Comment 2 Adam Ouadi 2016-09-19 08:48:41 UTC
Actually I've got the same problem with my VMWare exported ova files with an immutable resolv.conf

libguestfs error: command_lines: rename: /sysroot/etc/resolv.conf to /sysroot/etc/654d4atl: Operation not permitted

Comment 3 Richard W.M. Jones 2016-09-19 09:07:57 UTC
(In reply to Adam Ouadi from comment #2)
> Actually I've got the same problem with my VMWare exported ova files with an
> immutable resolv.conf
> 
> libguestfs error: command_lines: rename: /sysroot/etc/resolv.conf to
> /sysroot/etc/654d4atl: Operation not permitted

I have machines with immutable /etc/resolv.conf too -- the best way
to stop NetworkMangler etc etc from messing it up.

This is certainly a bug.

Comment 4 Adam Ouadi 2016-09-20 07:19:56 UTC
(In reply to Richard W.M. Jones from comment #3)

> This is certainly a bug.

Is there any workaround involving no change of my ova files ?

Comment 5 Richard W.M. Jones 2016-09-20 07:35:08 UTC
Not as far as I know.  It's a bug that needs to be fixed.