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 1132652 - virt-sysprep firstboot doesn't work with RHEL 7 guest
Summary: virt-sysprep firstboot doesn't work with RHEL 7 guest
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libguestfs
Version: 6.5
Hardware: Unspecified
OS: Linux
unspecified
low
Target Milestone: rc
: ---
Assignee: Pino Toscano
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-08-21 18:41 UTC by j.vandeville
Modified: 2015-11-18 10:30 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-11-18 10:30:27 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description j.vandeville 2014-08-21 18:41:11 UTC
Description of problem:

The /usr/lib/virt-sysprep/firstboot.sh script test if the argument $1 is "start". It's working with upstart/System V but not with systemd, the default init of RHEL7. $1 seems to be always empty and the script is never executed.

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

libguestfs-tools-c-1.20.11-2.el6.x86_64

How reproducible:


Steps to Reproduce:
1. Create a RHEL7 VM on a RHEL6.5 host
2. Use virt-sysprep with firstboot option
3. Check if the script is executed at first boot

Actual results:

The firstboot script is never executed

Expected results:

The firstboot script must be executed

Additional info:

Comment 2 Richard W.M. Jones 2014-08-21 19:52:27 UTC
Pino, can you check if the updated virt-sysprep in RHEL 6.6
(bug 1037166) can successfully create a working firstboot script
in a RHEL 7 guest?

Comment 3 Lingfei Kong 2014-08-28 09:53:46 UTC
Can reproduce with libguestfs-tools-c-1.20.11-2.el6.x86_64

Steps to reproduce:
1. Create a RHEL7 VM on a RHEL6.6 host
2. Create a script used to test:
#cat test.sh 
#!/bin/bash

echo "Hello World"
touch /hello_world

3. Use virt-sysprep with firstboot option
#virt-sysprep --firstboot test.sh -a rhel77.img

4. Check in rhel7 guest:
Can not find  /hello_world2
There no such lines in /root/virt-sysprep-firstboot.log:
"Hello World"




3. Check if the script is executed at first boot

Comment 4 Lingfei Kong 2014-08-28 10:01:25 UTC
(In reply to Richard W.M. Jones from comment #2)
> Pino, can you check if the updated virt-sysprep in RHEL 6.6
> (bug 1037166) can successfully create a working firstboot script
> in a RHEL 7 guest?

(In reply to Richard W.M. Jones from comment #2)
> Pino, can you check if the updated virt-sysprep in RHEL 6.6
> (bug 1037166) can successfully create a working firstboot script
> in a RHEL 7 guest?

Hi Richard,
I test with the latest libguestfs-1.20.11-10.el6,  it works well with this package

Steps:
Steps to reproduce:
1. Create a RHEL7 VM on a RHEL6.6 host
2. Create a script used to test:
#cat test.sh 
#!/bin/bash

echo "Hello World2"
touch /hello_world2

3. Use virt-sysprep with firstboot option
#virt-sysprep --firstboot test.sh -a rhel77.img

4. Check in rhel7 guest:
Can find file: /hello_world2
Can find the following line in /root/virt-sysprep-firstboot.log:
"Hello World2"

Comment 5 Richard W.M. Jones 2014-08-28 10:03:53 UTC
Looks good to me.

Comment 6 Lingfei Kong 2014-08-28 10:11:23 UTC
(In reply to Richard W.M. Jones from comment #5)
> Looks good to me.
I'm sorry, there is some thing wrong with my browser when i paste my comment, maybe cause by network delay and this lead to Comment 4 looks confusion. The actual result is 'virt-sysprep --firstboot' works well with rhel7 in libguestfs-1.20.11-10.el6. :-)

Comment 7 j.vandeville 2014-11-02 10:15:32 UTC
There is another bug with libguestfs-tools-1.20.11-11.el6.x86_64 and RHEL 7

I use a very simple script to update the guest at first boot :

yum clean all
yum -y update
reboot 

It’s working well with RHEL 6.X but with RHEL 7, the script is never deleted and the guest is stuck  in a infinity loop of reboot

Should I create a new bug for this ?

Thanks

Comment 8 Richard W.M. Jones 2014-11-02 11:08:57 UTC
(In reply to j.vandeville from comment #7)
> There is another bug with libguestfs-tools-1.20.11-11.el6.x86_64 and RHEL 7

RHEL 7 guest?

Anyway, yes, please file new bugs for any issues you find.

Comment 9 Pino Toscano 2014-11-04 08:33:35 UTC
So it seems like firstboot scripts work with RHEL 7 guests, right?

The problem reported in comment 7 is bug 1159651, which has just been fixed upstream (and affects only scripts which cause the virt-sysprep firstboot sequence to not complete).

(In reply to Lingfei Kong from comment #3)
> There no such lines in /root/virt-sysprep-firstboot.log:
> "Hello World"

There's a related issue, i.e. that the /root/virt-sysprep-firstboot.log log file will contain only the output of the last script run. A patch fixing this has been sent to the mailing list:
  https://www.redhat.com/archives/libguestfs/2014-November/msg00009.html

Comment 10 Hu Zhang 2015-11-18 10:13:11 UTC
Not reproduced with libguestfs-tools-c-1.20.11-14.el6.x86_64 on rhel 6.7.

Steps:
Steps to reproduce:
1. Create a RHEL7.1 VM on a RHEL6.7 host
2. Create a script used to test:
#cat test.sh 
#!/bin/bash

echo "Hello World2"
touch /hello_world2

3. Use virt-sysprep with firstboot option
#virt-sysprep --firstboot test.sh -a rhel7.1.img

4. Check in rhel7.1 guest:
Can find file: /hello_world2
Can find the following line in /root/virt-sysprep-firstboot.log:
"Hello World2"

Comment 11 Pino Toscano 2015-11-18 10:30:27 UTC
Thanks Hu Zhang for testing this.

I confirm that this was fixed by the updates for the virt-sysprep addition in RHEL 6.6.

Regarding the issue mentioned in comment #7, it is bug #1159651, fixed in RHEL 6.7.


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