RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1160043 - virt-sysprep firstboot script is not deleted if it reboot a RHEL 7 guest
Summary: virt-sysprep firstboot script is not deleted if it reboot a RHEL 7 guest
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libguestfs
Version: 7.2
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Richard W.M. Jones
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On: 1159651
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-11-03 22:16 UTC by Richard W.M. Jones
Modified: 2015-06-10 14:09 UTC (History)
8 users (show)

Fixed In Version: libguestfs-1.28.1-1.8.el7
Doc Type: Bug Fix
Doc Text:
Due to an incorrect implementation of the libguestfs firstboot scripts runner, the firstboot scripts logged only the last executed script instead of all executed scripts. In addition, firstboot scripts that cause booting to stop, such as a script that reboots the guest, were unintentionally executed on every boot. These problems have now been fixed.
Clone Of: 1159651
Environment:
Last Closed: 2015-03-05 13:47:04 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:0303 0 normal SHIPPED_LIVE libguestfs bug fix and enhancement update 2015-03-05 17:34:44 UTC

Description Richard W.M. Jones 2014-11-03 22:16:40 UTC
+++ This bug was initially created as a clone of Bug #1159651 +++

Description of problem:

I use a very simple script to update my VM at first boot :

yum clean all
yum -y update
reboot

On rhel6.x guest, the script is deleted but on rhel7 guest, the script is never deleted and the guest is stuck in a infinity loop of reboot. If I remove the "reboot" command, the script is correctly deleted.

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

libguestfs-tools-1.20.11-11.el6.x86_64

Steps to Reproduce:
1. Create a RHEL7 VM on a RHEL6.6 host
2. Create a simple script with the reboot command
3. Use virt-sysprep --enable firstboot --firstboot script.sh -d rhel7_guest
4. Launch the VM

Actual results:

The script is never deleted and the guest is stuck in a infinity loop of reboot

Expected results:

The script should be deleted after its first execution

Additional info:

--- Additional comment from Pino Toscano on 2014-11-03 14:50:46 EST ---

This bug is not specific to RHEL guests, but practically on any guest.

Basically, /usr/lib/virt-sysprep/firstboot.sh (which is the helper script created by virt-sysprep/builder/customize to run the first boot scripts) does the following:

  if test "$1" = "start"
  then
    for f in $d/* ; do
      if test -x "$f"
      then
        echo '=== Running' $f '===' 2>&1 | tee $logfile
        $f 2>&1 | tee $logfile
        rm -f $f
      fi
    done
  fi

so, each first boot script is deleted only after it has been completed. Needless to say, if a script does not return then it is not removed, and thus executed again at the next boot.

Patch posted to the mailing list to attempt working around such situations:
  https://www.redhat.com/archives/libguestfs/2014-November/msg00005.html

--- Additional comment from  on 2014-11-03 15:52:29 EST ---

It's working with RHEL6.X guest. The script is always deleted, even if it reboot the system

--- Additional comment from Richard W.M. Jones on 2014-11-03 17:15:50 EST ---

This patch has been accepted upstream and should fix the
issue for all RHEL and other guests:

https://www.redhat.com/archives/libguestfs/2014-November/msg00007.html

Comment 3 yuliu 2014-11-11 10:20:54 UTC
Version: libguestfs-1.28.1-1.9.el7.x86_64

The script was deleted, it stops after execute once.

Verified.

Comment 5 errata-xmlrpc 2015-03-05 13:47:04 UTC
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


Note You need to log in before you can comment on or make changes to this bug.