Bug 988863
| Summary: | virt-sysprep --firstboot option writes incorrect "99" (instead of "S99") sysv-init-style start up script | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 6 | Reporter: | Richard W.M. Jones <rjones> |
| Component: | libguestfs | Assignee: | Richard W.M. Jones <rjones> |
| Status: | CLOSED ERRATA | QA Contact: | Virtualization Bugs <virt-bugs> |
| Severity: | unspecified | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 6.5 | CC: | acathrow, bfan, leiwang, lkong, mbooth, wshi |
| Target Milestone: | rc | ||
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | libguestfs-1.20.10-1.el6 | Doc Type: | Bug Fix |
| Doc Text: |
(This was never in a released version of libguestfs so does not need to be documented)
|
Story Points: | --- |
| Clone Of: | 988860 | Environment: | |
| Last Closed: | 2013-11-21 04:46:10 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: | 988860 | ||
| Bug Blocks: | |||
|
Description
Richard W.M. Jones
2013-07-26 15:12:34 UTC
Can reprodece with libguestfs-1.20.9-6.el6.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 I can not find libguestfs 1.20.9, 1.22.4, 1.23.10 for RHEL6.5 from https://brewweb.devel.redhat.com. So, I skip the reproduce step. Also, I can not find libguestfs-1.20.10-1.el6 from https://brewweb.devel.redhat.com, so I choose libguestfs-1.20.10-3.el6 to Verify this bug. Verified: 1. Install libguestfs-1.20.10-3.el6 on RHEL6.5 host. 2. Create test script: [host]#cat touch.sh #!/bin/bash touch /root/1.20.10-2.el6.txt 3. Execute the following command: [host]#export LIBGUESTFS_TRACE=1 [host]#virt-sysprep --firstboot ./touch.sh -a kvm-6.5-64-1.img 4. Login the guest check whether the is a /root/1.20.10-2.el6.txt on guest Result: /root/1.20.10-2.el6.txt file exists on the guest. This is the "virt-sysprep --firstboot ./touch.sh -a kvm-6.5-64-1.img" command output: libguestfs: trace: is_dir "/etc/systemd" libguestfs: trace: is_dir = 0 libguestfs: trace: mkdir_p "/etc/rc.d/rc2.d" libguestfs: trace: mkdir_p = 0 libguestfs: trace: mkdir_p "/etc/rc.d/rc3.d" libguestfs: trace: mkdir_p = 0 libguestfs: trace: mkdir_p "/etc/rc.d/rc5.d" libguestfs: trace: mkdir_p = 0 libguestfs: trace: ln_sf "/usr/lib/virt-sysprep/firstboot.sh" "/etc/rc.d/rc2.d/S99virt-sysprep-firstboot" libguestfs: trace: ln_sf = 0 libguestfs: trace: ln_sf "/usr/lib/virt-sysprep/firstboot.sh" "/etc/rc.d/rc3.d/S99virt-sysprep-firstboot" libguestfs: trace: ln_sf = 0 libguestfs: trace: ln_sf "/usr/lib/virt-sysprep/firstboot.sh" "/etc/rc.d/rc5.d/S99virt-sysprep-firstboot" libguestfs: trace: ln_sf = 0 libguestfs: trace: write "/usr/lib/virt-sysprep/scripts/1381992707-gpsyazqb-touch-sh" "#!/bin/bash\x0a\x0atouch /root/1.20.10-3.el6.txt\x0a\x0a" libguestfs: trace: internal_write "/usr/lib/virt-sysprep/scripts/1381992707-gpsyazqb-touch-sh" "#!/bin/bash\x0a\x0atouch /root/1.20.10-3.el6.txt\x0a\x0a" virt-sysprep called "/etc/rc.d/rc2.d/S99virt-sysprep-firstboot". (In reply to Lingfei Kong from comment #4) > I can not find libguestfs 1.20.9, 1.22.4, 1.23.10 for RHEL6.5 from > https://brewweb.devel.redhat.com. So, I skip the reproduce step. Also, I can > not find libguestfs-1.20.10-1.el6 from https://brewweb.devel.redhat.com, so > I choose libguestfs-1.20.10-3.el6 to Verify this bug. Correct: This is a new feature in RHEL 6. > Verified: > 1. Install libguestfs-1.20.10-3.el6 on RHEL6.5 host. > 2. Create test script: > [host]#cat touch.sh > #!/bin/bash > > touch /root/1.20.10-2.el6.txt > > 3. Execute the following command: > [host]#export LIBGUESTFS_TRACE=1 > [host]#virt-sysprep --firstboot ./touch.sh -a kvm-6.5-64-1.img > > 4. Login the guest check whether the is a /root/1.20.10-2.el6.txt on guest > Result: /root/1.20.10-2.el6.txt file exists on the guest. > > > This is the "virt-sysprep --firstboot ./touch.sh -a kvm-6.5-64-1.img" > command output: > libguestfs: trace: is_dir "/etc/systemd" > libguestfs: trace: is_dir = 0 > libguestfs: trace: mkdir_p "/etc/rc.d/rc2.d" > libguestfs: trace: mkdir_p = 0 > libguestfs: trace: mkdir_p "/etc/rc.d/rc3.d" > libguestfs: trace: mkdir_p = 0 > libguestfs: trace: mkdir_p "/etc/rc.d/rc5.d" > libguestfs: trace: mkdir_p = 0 > libguestfs: trace: ln_sf "/usr/lib/virt-sysprep/firstboot.sh" > "/etc/rc.d/rc2.d/S99virt-sysprep-firstboot" > libguestfs: trace: ln_sf = 0 > libguestfs: trace: ln_sf "/usr/lib/virt-sysprep/firstboot.sh" > "/etc/rc.d/rc3.d/S99virt-sysprep-firstboot" > libguestfs: trace: ln_sf = 0 > libguestfs: trace: ln_sf "/usr/lib/virt-sysprep/firstboot.sh" > "/etc/rc.d/rc5.d/S99virt-sysprep-firstboot" > libguestfs: trace: ln_sf = 0 > libguestfs: trace: write > "/usr/lib/virt-sysprep/scripts/1381992707-gpsyazqb-touch-sh" > "#!/bin/bash\x0a\x0atouch /root/1.20.10-3.el6.txt\x0a\x0a" > libguestfs: trace: internal_write > "/usr/lib/virt-sysprep/scripts/1381992707-gpsyazqb-touch-sh" > "#!/bin/bash\x0a\x0atouch /root/1.20.10-3.el6.txt\x0a\x0a" > > > virt-sysprep called "/etc/rc.d/rc2.d/S99virt-sysprep-firstboot". It'd be nice to test if, when the guest boots up, it actually runs the firstboot script. I have recently fixed a lot of bugs in this area of the code, but *hopefully* none of those bugs affect RHEL guests so this ought to work. To verify this: qemu-kvm -drive file=disk.img,snapshot=on -m 1024 When the guest boots, log in and verify that /root/virt-sysprep-firstboot.log exists and any firstboot actions/logs that you were expecting to happen did happen. (In reply to Richard W.M. Jones from comment #5) > When the guest boots, log in and verify that /root/virt-sysprep-firstboot.log > exists and any firstboot actions/logs that you were expecting to > happen did happen. Sorry, I'm not quite understand about "any firstboot actions/logs that you were expecting to happen did happen", Could you explain more about it? I boot RHEL6.5 guest with "/usr/libexec/qemu-kvm -drive file=kvm-6.5-64-1.img,snapshot=on -m 1024", then login the guesst, and found there is a /root/virt-sysprep-firstboot.log file exist, but there are only three lines inside the file, I can not get more infromation from virt-sysprep-firstboot.log. [guest]cat #/root/virt-sysprep-firstboot.log = = = Running /usr/lib/virt-sysprep/scripts/1381993196-gpsyazqb-touch-sh = = = = = = Running /usr/lib/virt-sysprep/scripts/1381993196-gpsyazqb-touch-sh = = = = = = Running /usr/lib/virt-sysprep/scripts/1381993196-gpsyazqb-touch-sh = = = (In reply to Lingfei Kong from comment #6) > I boot RHEL6.5 guest with "/usr/libexec/qemu-kvm -drive > file=kvm-6.5-64-1.img,snapshot=on -m 1024", then login the guesst, and found > there is a /root/virt-sysprep-firstboot.log file exist, but there are only > three lines inside the file, I can not get more infromation from > virt-sysprep-firstboot.log. > > [guest]cat #/root/virt-sysprep-firstboot.log > = = = Running /usr/lib/virt-sysprep/scripts/1381993196-gpsyazqb-touch-sh = = > = > = = = Running /usr/lib/virt-sysprep/scripts/1381993196-gpsyazqb-touch-sh = = > = > = = = Running /usr/lib/virt-sysprep/scripts/1381993196-gpsyazqb-touch-sh = = > = It looks like the script ran 3 times. That might be a bug ... You can put some echo commands into the script, and they should appear in the log file. In fact I did the test for two times before the test in Comment 4(use the same guest image and test script: touch.sh), this would explain why there are three lines inside /root/virt-sysprep-firstboot.log. And this time I delete /root/virt-sysprep-firstboot.log and the files I have touched. Doing the test with a test.sh script: [host]#cat test.sh #!/bin/bash touch /root/1.20.10-3.el6.txt echo "Hello World" 1. [host]#virt-sysprep --firstboot ./test.sh -a kvm-6.5-64-1.img 2. [host]#/usr/libexec/qemu-kvm -drive file=kvm-6.5-64-1.img,snapshot=on -m 1024 -vnc :0 login the guest and check /root/virt-sysprep-firstboot.log, happy to see: [guest]cat #/root/virt-sysprep-firstboot.log = = = Running /usr/lib/virt-sysprep/scripts/1381993196-gpsyazqb-test-sh = = = Hello World that's to say firstboot actions/logs what I am expecting to happen and only ran 1 time. So, this bug is fixed. 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. http://rhn.redhat.com/errata/RHSA-2013-1536.html |