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 988862 - virt-sysprep --firstboot option writes incorrect "99" (instead of "S99") sysv-init-style start up script
Summary: virt-sysprep --firstboot option writes incorrect "99" (instead of "S99") sysv...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libguestfs
Version: 7.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Richard W.M. Jones
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On: 988860
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-07-26 15:12 UTC by Richard W.M. Jones
Modified: 2014-06-18 02:00 UTC (History)
6 users (show)

Fixed In Version: libguestfs-1.22.5-1.el7
Doc Type: Bug Fix
Doc Text:
Clone Of: 988860
Environment:
Last Closed: 2014-06-13 09:22:38 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Richard W.M. Jones 2013-07-26 15:12:25 UTC
+++ This bug was initially created as a clone of Bug #988860 +++

Description of problem:

When you use virt-sysprep on a pre-systemd guest (eg. RHEL 6 guest),
with the --firstboot option, it writes a start-up script called

/etc/rc.d/rc3.d/99virt-sysprep-firstboot

This is of course wrong.  The file should be called

/etc/rc.d/rc3.d/S99virt-sysprep-firstboot
                ^NB

As a result of the incorrect name, the firstboot script does not run.

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

libguestfs 1.20.9, 1.22.4, 1.23.10

Note I have fixed this upstream already:
https://github.com/libguestfs/libguestfs/commit/44c5026d9e06cf5f01098608ddd0aa4acb7bb6eb
This bug exists so that I can check the fix goes into RHEL 6 & RHEL 7.

How reproducible:

100%

Steps to Reproduce:

Create a small shell script that "does something useful".  eg.
It could touch a file at a known location.

export LIBGUESTFS_TRACE=1
virt-sysprep --firstboot ./some-script.sh -a RHEL6.guest
Try to boot the guest.

Observe whether or not the firstboot script ran when the
guest booted (eg. was the file touched?)

Additional info:

The bug was found by Nick Strugnell.

Comment 1 bfan 2013-07-29 09:01:17 UTC
Can reproduce with libguestfs-1.22.4-2.el7.x86_64

[root]# cat some-script.sh 

#!/bin/bash

touch /home/usefulfile

[root]# virt-sysprep --firstboot ./some-script.sh -a RHEL-Server-6.4-64-hvm.raw
/home/usefulfile

then, boot up the rhel6.4 guest, and there is no /home/usefulfile

Comment 3 Lingfei Kong 2013-11-17 02:57:16 UTC
Verified with libguestfs-1.22.6-15.el7

Steps:
1. Create test script:
[root@rhel7libguestfs ~]# cat test.sh 
#!/bin/bash

touch /root/test.txt
echo "Hello World!"

2. [root@rhel7libguestfs ~]#  virt-sysprep --firstboot ./test.sh  -a RHEL-Server-6.5-64-20131024.1-hvm.qcow 

3. Check in the guest:
#ls /root/
#test.txt virt-sysprep-firstboot.log


Additional info:
In the guest
#cat virt-sysprep-firstboot.log
=== Running /usr/lib/virt-sysprep/scripts/1384656116-azw3p6uu-test-sh ===
Hello World!

Comment 4 Ludek Smid 2014-06-13 09:22:38 UTC
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.


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