Description of problem: virt-sysprep option '--user-accounts' don't work well Version-Release number of selected component (if applicable): libguestfs-1.27.43-1.1.el7 How reproducible: 100% Steps to Reproduce: 1. Create a raw format guest image: rhel6.6.img 2. Start the guest and create a new user lkong in the guest # useradd lkong 3. #virt-sysprep --user-accounts lkong -a rhel6.6.img [ 0.0] Examining the guest ... [ 5.0] Performing "abrt-data" ... [ 5.0] Performing "bash-history" ... [ 5.0] Performing "blkid-tab" ... [ 5.0] Performing "crash-data" ... [ 5.0] Performing "cron-spool" ... [ 5.0] Performing "dhcp-client-state" ... [ 5.0] Performing "dhcp-server-state" ... [ 5.0] Performing "dovecot-data" ... [ 5.0] Performing "logfiles" ... [ 5.0] Performing "machine-id" ... [ 5.0] Performing "mail-spool" ... [ 5.0] Performing "net-hostname" ... [ 5.0] Performing "net-hwaddr" ... [ 5.0] Performing "pacct-log" ... [ 5.0] Performing "package-manager-cache" ... [ 5.0] Performing "pam-data" ... [ 5.0] Performing "puppet-data-log" ... [ 5.0] Performing "rh-subscription-manager" ... [ 5.0] Performing "rhn-systemid" ... [ 5.0] Performing "rpm-db" ... [ 5.0] Performing "samba-db-log" ... [ 5.0] Performing "script" ... [ 5.0] Performing "smolt-uuid" ... [ 5.0] Performing "ssh-hostkeys" ... [ 5.0] Performing "ssh-userdir" ... [ 5.0] Performing "sssd-db-log" ... [ 5.0] Performing "tmp-files" ... [ 5.0] Performing "udev-persistent-net" ... [ 5.0] Performing "utmp" ... [ 5.0] Performing "yum-uuid" ... [ 5.0] Performing "customize" ... [ 5.0] Setting a random seed [ 6.0] Performing "lvm-uuids" ... 4. Login the guest and check Actual results: At step 4, lkong account was not removed from the guest Expected results: At step 4, lkong account was removed from the guest Additional info:
(In reply to Lingfei Kong from comment #0) > 3. #virt-sysprep --user-accounts lkong -a rhel6.6.img > [ 0.0] Examining the guest ... > [ 5.0] Performing "abrt-data" ... > [ 5.0] Performing "bash-history" ... > [ 5.0] Performing "blkid-tab" ... > [ 5.0] Performing "crash-data" ... > [ 5.0] Performing "cron-spool" ... > [ 5.0] Performing "dhcp-client-state" ... > [ 5.0] Performing "dhcp-server-state" ... > [ 5.0] Performing "dovecot-data" ... > [ 5.0] Performing "logfiles" ... > [ 5.0] Performing "machine-id" ... > [ 5.0] Performing "mail-spool" ... > [ 5.0] Performing "net-hostname" ... > [ 5.0] Performing "net-hwaddr" ... > [ 5.0] Performing "pacct-log" ... > [ 5.0] Performing "package-manager-cache" ... > [ 5.0] Performing "pam-data" ... > [ 5.0] Performing "puppet-data-log" ... > [ 5.0] Performing "rh-subscription-manager" ... > [ 5.0] Performing "rhn-systemid" ... > [ 5.0] Performing "rpm-db" ... > [ 5.0] Performing "samba-db-log" ... > [ 5.0] Performing "script" ... > [ 5.0] Performing "smolt-uuid" ... > [ 5.0] Performing "ssh-hostkeys" ... > [ 5.0] Performing "ssh-userdir" ... > [ 5.0] Performing "sssd-db-log" ... > [ 5.0] Performing "tmp-files" ... > [ 5.0] Performing "udev-persistent-net" ... > [ 5.0] Performing "utmp" ... > [ 5.0] Performing "yum-uuid" ... > [ 5.0] Performing "customize" ... > [ 5.0] Setting a random seed > [ 6.0] Performing "lvm-uuids" ... --user-accounts is just the optional parameter for the user-account operation, which you are not actually enabling there; see the output of `virt-sysprep --list-operations` (user-account has no '*', so it is not enabled by default). In the documentation there is: --user-accounts USERS (see "user-account" below) which yes, gives the idea that --user-accounts is related to the user-account operation, but not actually saying more than that. Rich, what do you think about turning the documentation text (see "OP" below) into (needs the "OP" operation; see below) ?
I have a slightly different take on this problem. See: https://www.redhat.com/archives/libguestfs/2014-September/thread.html#00063
Version: libguestfs-1.28.1-1.9.el7.x86_64 Steps: 1. Login guest and create an user account test1 2. #virt-sysprep --enable user-account -a guest-image.qcow2 3. Login guest again by the account test1. test1 was deleted already. Verified.
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://rhn.redhat.com/errata/RHBA-2015-0303.html