Description of problem: Execution of `imgbase layout --init` failed in %post part of kickstart installation. 15:18:26,024 INFO program: + imgbase layout --init 15:18:26,025 INFO program: 2020-03-11 11:17:07,907 [INFO] (MainThread) Trying to create a manageable base from '/' 15:18:26,025 INFO program: 2020-03-11 11:17:08,693 [INFO] (MainThread) Initial base will be <Base rhvh-4.3.9.2-0.20200204.0 [] /> 15:18:26,025 INFO program: 2020-03-11 11:17:08,693 [INFO] (MainThread) Initial layer will be <Layer rhvh-4.3.9.2-0.20200204.0+1 /> 15:18:26,025 INFO program: 2020-03-11 11:17:08,694 [INFO] (MainThread) Creating an initial base <Base rhvh-4.3.9.2-0.20200204.0 [] /> for <LV 'rhvh_dell-per720-01/root' /> 15:18:26,025 INFO program: 2020-03-11 11:17:21,591 [INFO] (MainThread) Creating initial layer <Layer rhvh-4.3.9.2-0.20200204.0+1 /> for initial base 15:18:26,026 INFO program: 2020-03-11 11:17:21,593 [INFO] (MainThread) Adding a new layer after <Base rhvh-4.3.9.2-0.20200204.0 [] /> 15:18:26,026 INFO program: 2020-03-11 11:17:21,593 [INFO] (MainThread) Adding a new layer after <Base rhvh-4.3.9.2-0.20200204.0 [] /> 15:18:26,026 INFO program: 2020-03-11 11:17:21,594 [INFO] (MainThread) New layer will be: <Layer rhvh-4.3.9.2-0.20200204.0+1 /> 15:18:26,026 INFO program: 2020-03-11 11:17:35,167 [ERROR] (MainThread) The root volume does not look like an image 15:18:26,026 INFO program: 2020-03-11 11:17:36,170 [ERROR] (remediate_etc) The root volume does not look like an image 15:18:26,026 INFO program: 2020-03-11 11:17:39,383 [INFO] (MainThread) Volume for '/var/crash' was created successful 15:18:26,027 INFO program: 2020-03-11 11:17:39,799 [INFO] (MainThread) Volume for '/var/crash' was attached successful 15:18:26,027 INFO program: 2020-03-11 11:17:40,350 [INFO] (migrate_etc) Verifying stream compatability 15:18:26,027 INFO program: 2020-03-11 11:17:40,472 [INFO] (migrate_etc) Migrating /etc (from <LV 'rhvh_dell-per720-01/rhvh-4.3.9.2-0.20200204.0+1' />) 15:18:26,027 INFO program: 2020-03-11 11:17:43,988 [INFO] (migrate_etc) Configuring versionlock for /dev/rhvh_dell-per720-01/rhvh-4.3.9.2-0.20200204.0+1 15:18:26,027 INFO program: 2020-03-11 11:17:46,562 [INFO] (migrate_etc) Migrating /root 15:18:26,028 INFO program: 2020-03-11 11:17:46,569 [INFO] (fix_systemd_services) Syncing systemd levels 15:18:26,028 INFO program: 2020-03-11 11:18:20,869 [INFO] (MainThread) No SCAP evaluation found, skipping 15:18:26,028 INFO program: 2020-03-11 11:18:24,187 [INFO] (MainThread) Inspecting if the layer contains OS data 15:18:26,028 INFO program: 2020-03-11 11:18:24,187 [INFO] (MainThread) Adjusting mount and boot related points 15:18:26,028 INFO program: 2020-03-11 11:18:25,744 [INFO] (MainThread) Failed to reinstall persisted RPMs! 15:18:26,029 INFO program: 2020-03-11 11:18:25,745 [INFO] (MainThread) Result: Spawning container dell-per720-01.rhts.eng.pek2.redhat.com on /tmp/mnt.Qza81. 15:18:26,029 INFO program: Press ^] three times within 1s to kill container. 15:18:26,029 INFO program: Failed to read link /sys/fs/cgroup/devices: No such file or directory 15:18:26,029 INFO program: Container dell-per720-01.rhts.eng.pek2.redhat.com failed with error code 1. 15:18:26,029 INFO program: 15:18:26,029 INFO program: 2020-03-11 11:18:25,825 [ERROR] (MainThread) Failed to reinstall persisted RPMs 15:18:26,030 INFO program: Traceback (most recent call last): 15:18:26,030 INFO program: File "/usr/lib/python2.7/site-packages/imgbased/plugins/rpmpersistence.py", line 60, in on_os_upgraded 15:18:26,030 INFO program: reinstall_rpms(imgbase, new_lv, previous_layer_lv) 15:18:26,030 INFO program: File "/usr/lib/python2.7/site-packages/imgbased/plugins/rpmpersistence.py", line 79, in reinstall_rpms 15:18:26,030 INFO program: install_rpms(new_fs) 15:18:26,031 INFO program: File "/usr/lib/python2.7/site-packages/imgbased/utils.py", line 280, in __exit__ 15:18:26,031 INFO program: self.mp.umount() 15:18:26,031 INFO program: File "/usr/lib/python2.7/site-packages/imgbased/utils.py", line 259, in umount 15:18:26,031 INFO program: self.run.call(["rmdir", self.tmpdir]) 15:18:26,031 INFO program: File "/usr/lib/python2.7/site-packages/imgbased/utils.py", line 422, in call 15:18:26,032 INFO program: stdout = call(*args, **kwargs) 15:18:26,032 INFO program: File "/usr/lib/python2.7/site-packages/imgbased/utils.py", line 186, in call 15:18:26,032 INFO program: return subprocess.check_output(*args, **kwargs).strip() 15:18:26,032 INFO program: File "/usr/lib64/python2.7/subprocess.py", line 575, in check_output 15:18:26,032 INFO program: raise CalledProcessError(retcode, cmd, output=output) 15:18:26,032 INFO program: CalledProcessError: Command '['rmdir', u'/tmp/mnt.Qza81']' returned non-zero exit status 1 15:18:26,033 INFO program: 2020-03-11 11:18:25,828 [ERROR] (MainThread) Failed to update OS 15:18:26,033 INFO program: Traceback (most recent call last): 15:18:26,033 INFO program: File "/usr/lib/python2.7/site-packages/imgbased/plugins/osupdater.py", line 260, in migrate_boot 15:18:26,033 INFO program: adjust_mounts_and_boot(imgbase, new_lv, previous_layer_lv) 15:18:26,033 INFO program: File "/usr/lib/python2.7/site-packages/imgbased/plugins/osupdater.py", line 1179, in adjust_mounts_and_boot 15:18:26,034 INFO program: imgbase.hooks.emit("os-upgraded", previous_lv.lv_name, new_lvm_name) 15:18:26,034 INFO program: File "/usr/lib/python2.7/site-packages/imgbased/hooks.py", line 120, in emit 15:18:26,034 INFO program: cb(self.context, *args) 15:18:26,034 INFO program: File "/usr/lib/python2.7/site-packages/imgbased/plugins/rpmpersistence.py", line 63, in on_os_upgraded 15:18:26,034 INFO program: raise RpmPersistenceError() 15:18:26,034 INFO program: RpmPersistenceError 15:18:26,035 INFO program: Traceback (most recent call last): 15:18:26,035 INFO program: File "/usr/lib64/python2.7/runpy.py", line 162, in _run_module_as_main 15:18:26,035 INFO program: "__main__", fname, loader, pkg_name) 15:18:26,035 INFO program: File "/usr/lib64/python2.7/runpy.py", line 72, in _run_code 15:18:26,035 INFO program: exec code in run_globals 15:18:26,035 INFO program: File "/usr/lib/python2.7/site-packages/imgbased/__main__.py", line 53, in <module> 15:18:26,036 INFO program: CliApplication() 15:18:26,036 INFO program: File "/usr/lib/python2.7/site-packages/imgbased/__init__.py", line 82, in CliApplication 15:18:26,036 INFO program: app.hooks.emit("post-arg-parse", args) 15:18:26,036 INFO program: File "/usr/lib/python2.7/site-packages/imgbased/hooks.py", line 120, in emit 15:18:26,036 INFO program: cb(self.context, *args) 15:18:26,037 INFO program: File "/usr/lib/python2.7/site-packages/imgbased/plugins/core.py", line 173, in post_argparse 15:18:26,037 INFO program: layout.initialize(args.source, args.init_nvr) 15:18:26,037 INFO program: File "/usr/lib/python2.7/site-packages/imgbased/plugins/core.py", line 220, in initialize 15:18:26,037 INFO program: self.app.imgbase.init_layout_from(source, init_nvr) 15:18:26,037 INFO program: File "/usr/lib/python2.7/site-packages/imgbased/imgbase.py", line 307, in init_layout_from 15:18:26,037 INFO program: self.add_layer(initial_base, new_layer) 15:18:26,038 INFO program: File "/usr/lib/python2.7/site-packages/imgbased/imgbase.py", line 208, in add_layer 15:18:26,038 INFO program: self.hooks.emit("new-layer-added", prev_lv, new_lv) 15:18:26,038 INFO program: File "/usr/lib/python2.7/site-packages/imgbased/hooks.py", line 120, in emit 15:18:26,038 INFO program: cb(self.context, *args) 15:18:26,038 INFO program: File "/usr/lib/python2.7/site-packages/imgbased/plugins/osupdater.py", line 124, in on_new_layer 15:18:26,038 INFO program: migrate_boot(imgbase, new_lv, previous_layer_lv) 15:18:26,039 INFO program: File "/usr/lib/python2.7/site-packages/imgbased/plugins/osupdater.py", line 264, in migrate_boot 15:18:26,039 INFO program: raise BootSetupError() 15:18:26,039 INFO program: imgbased.plugins.osupdater.BootSetupError 15:18:27,155 DEBUG program: Return code: 1 Distribution used - RHVH-4.3-RHEL-7-20200218.0 RHVH x86_64 https://beaker.engineering.redhat.com/distrotrees/107871#install-options Kernel options console=ttyS0,115200n81 inst.stage2=http://download.eng.pek2.redhat.com/rhel-7/devel/candidate-trees/RHV/RHVH-4.3-RHEL-7-20200218.0/compose/RHVH/x86_64/os ks=http://beaker.engineering.redhat.com/kickstart/6582649 ksdevice=B8:CA:3A:61:4E:70 netbootloader=pxelinux.0 Kickstart used https://beaker.engineering.redhat.com/kickstart/6582649 Version-Release number of selected component (if applicable): rhvh-4.3.9.2 How reproducible: Do the installation with KS https://beaker.engineering.redhat.com/kickstart/6582649 Actual results: Exception Expected results: imgbase layout --init return 0 and everything is fine. Additional info:
In the given ks file, `$package_command -y install restraint-0.1.39` is called before `imgbase layout --init`, restraint rpm will be put in /var/imgbased/persisted/, imgbased will try to reinstall it during init. imgbased shouldn't reinstall the rpm when it's in installation but not upgrade phase. One workaround is to download the rpm first, then use rpm install in the ks, such as: yumdownloader restraint-0.1.39 && rpm -i restraint*
Closing not a bug as per comment #1. Please fix your kickstart.
(In reply to Sandro Bonazzola from comment #2) > Closing not a bug as per comment #1. > Please fix your kickstart. Not sure If I'm understanding this correctly. Comment 1 mentioned that imgbased shouldn't reinstall the rpm when it's in installation but not upgrade phase. We are speaking about installation not upgrade. Are you sure this is not a bug?
The reason why imgbased tried to reinstall persisted rpms during installation phase is that it identifies the phase as installation only when "inst.ks" is in /proc/cmdline, unfortunately, "ks" but not "inst.ks" is used in this issue, so imgbased treated it as upgrade phase. I think it would be better if we could improve the way to identify installation phase, though there are workarounds, such as use inst.ks instead of ks in kernel options line, or use rpm -i instead of yum install in ks file.
Thank you for clarification. Yes, I agree workarounds are in place and I will take a look at how we can apply. I just didn't understand why the issue was closed. I'm glad for reopening this issue.
Is this issue relevant to 4.4 as well?
No, this mechanism was changed in 4.4
Verified with: RHVH-4.3-20200422.1-RHVH-x86_64-dvd1.iso imgbased-1.1.15-0.1.el7ev.noarch 1. Checked on beaker, the boot option is inst.ks now, provisioning works. 2. Tested boot option ks= with the following post section in ksfile: %post --erroronfail # Add Harness Repo cat <<"EOF" >/etc/yum.repos.d/beaker-harness.repo [beaker-harness] name=beaker-harness baseurl=http://beaker.engineering.redhat.com/harness/RHVH4/ enabled=1 gpgcheck=0 EOF yum -y install restraint-0.1.39 imgbase --debug layout --init %end Installation succeeded: 1) restraint rpm was put in /var/imgbased/persisted-rpms/ [root@dell-per730-34 ~]# ls -al /var/imgbased/persisted-rpms/ total 7192 drwxr-xr-x. 2 root root 4096 Apr 24 11:25 . drwxr-xr-x. 4 root root 4096 Apr 24 11:26 .. -rw-r--r--. 1 root root 7354548 Feb 28 2019 restraint-0.1.39-1.el7bkr.x86_64.rpm 2) reinstall flow was skipped during installation 11:27:50,077 INFO program: 2020-04-24 11:26:32,204 [INFO] (MainThread) Not reinstalling RPMs during system installation
Hi Yuval, please review this doc text for the Errata: "Before this update, imgbase layout --init failed during Red Hat Virtualization Host installation with Kickstart. In this release, the installation with Kickstart succeeds."
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://access.redhat.com/errata/RHBA-2020:2399
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 1000 days