Bug 1159651
Summary: | virt-sysprep firstboot script is not deleted if it reboot a RHEL 7 guest | |||
---|---|---|---|---|
Product: | Red Hat Enterprise Linux 6 | Reporter: | j.vandeville | |
Component: | libguestfs | Assignee: | Pino Toscano <ptoscano> | |
Status: | CLOSED ERRATA | QA Contact: | Virtualization Bugs <virt-bugs> | |
Severity: | unspecified | Docs Contact: | ||
Priority: | unspecified | |||
Version: | 6.6 | CC: | huzhan, jherrman, leiwang, mbooth, ptoscano, rjones, wshi | |
Target Milestone: | rc | |||
Target Release: | --- | |||
Hardware: | Unspecified | |||
OS: | Unspecified | |||
Whiteboard: | ||||
Fixed In Version: | libguestfs-1.20.11-12.el6 | 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.
|
Story Points: | --- | |
Clone Of: | ||||
: | 1160043 (view as bug list) | Environment: | ||
Last Closed: | 2015-07-22 05:56:11 UTC | Type: | Bug | |
Regression: | --- | Mount Type: | --- | |
Documentation: | --- | CRM: | ||
Verified Versions: | Category: | --- | ||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | ||
Cloudforms Team: | --- | Target Upstream Version: | ||
Embargoed: | ||||
Bug Depends On: | ||||
Bug Blocks: | 1160043 |
Description
j.vandeville
2014-11-02 17:00:03 UTC
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 It's working with RHEL6.X guest. The script is always deleted, even if it reboot the system 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 Fixed with upstream commit https://github.com/libguestfs/libguestfs/commit/f8ed15462fbb03c5b19972361f2a2e6fed4c5f02 which is in libguestfs >= 1.29.5. Verify with libguestfs-tools-1.20.11-12.el6.x86_64 Steps to verify: 1. Create a RHEL7 VM on a RHEL6.6 host #virsh define RHEL-Server-7.0-64-hvm.xml 2. Create a simple script with the reboot command #cat script.sh yum clean all yum -y update reboot 3. Use virt-sysprep --enable firstboot --firstboot script.sh -d rhel7_guest #virt-sysprep --enable firstboot --firstboot script.sh -d rhel7_guest 4. Launch the VM Launch the guest. The script has been deleted after its first execution. 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-1444.html |