Transaction lock during installation of Git
Boris-Stefanov opened this issue · comments
Overview of the Issue
I have written a simple provisioner for installing Git with 'yum' package manager on rhel8 OS. During the installation a transaction lock occurs failing the installation.
I've added packer options 'retry=5' and 'pause_before: 30s'.
I've removed provisioners before 'git' in order not to interfere with it.
I've added a provisioner to clean yum repos - "sudo yum -y clean packages". It doesn't make a difference.
Reproduction Steps
Create a provisoner:
{
"provisioners": [{
"type": "shell",
"inline": [
"sudo yum -y install git"
],
"pause_before": "30s",
"max_retries": 5
}]
}
Add the rest of the provisioner which are also using yum to install tools and packages.
Run Packer pipeline.
Packer version
Current installed packer version is 1.8.6.
Simplified Packer Template
template: image-builder-pipeline.yaml@IBP # do not touch this!
parameters:
image_name: RHEL-8-UM-RHEL-8-Image # do not touch this!
deploy_feature_branch_test_vm: false # Builds on the main branch will always create DTL VM. Set this value to true if you want DTL test VMs deployed for feature branches as well.
image_version: 1 # Change this whenever you create a new official release
size: S # Size of VM used to build image. Options: XS, S, M, L, XL (refer to docs for size details)
os: rhel_8 # Base OS used for this image. Options: ubuntu_1804, ubuntu_2004, ubuntu_2204, centos_7, alma_8, alma_9, rhel_7, rhel_8, rhel_9, sles_15, windows_2019, windows_2022, windows_10
platform: # Platforms to deploy to. Options: azure, vmware
- azure
variables: # your variables
pipeline_file_var: "test variable"
devops_library_basic_var: $(var-example)
devops_library_secret_var: $(devtestlabs-vm-password)
provisioners: # your provisioners
- directory: provisioners/expand-home-partition-rhel
# - directory: provisioners/remove-rhui-repo-v2
- directory: provisioners/clean-yum-packages
- directory: provisioners/git
- directory: provisioners/ant
Operating system and Environment details
rhel_8
Log Fragments and crash.log files
Set the env var PACKER_LOG=1
for maximum log detail.
azure-arm.azure-rhel_8: (44/47): git-2.39.3-1.el8_8.x86_64.rpm 1.5 MB/s | 104 kB 00:00
azure-arm.azure-rhel_8: (45/47): perl-Git-2.39.3-1.el8_8.noarch.rpm 2.0 MB/s | 79 kB 00:00
azure-arm.azure-rhel_8: (46/47): git-core-doc-2.39.3-1.el8_8.noarch.rpm 20 MB/s | 3.0 MB 00:00
azure-arm.azure-rhel_8: (47/47): git-core-2.39.3-1.el8_8.x86_64.rpm 24 MB/s | 11 MB 00:00
azure-arm.azure-rhel_8: --------------------------------------------------------------------------------
azure-arm.azure-rhel_8: Total 14 MB/s | 26 MB 00:01
azure-arm.azure-rhel_8: Running transaction check
azure-arm.azure-rhel_8: Transaction check succeeded.
azure-arm.azure-rhel_8: Running transaction test
azure-arm.azure-rhel_8: Transaction test succeeded.
azure-arm.azure-rhel_8: Running transaction
==> azure-arm.azure-rhel_8: RPM: error: can't create transaction lock on /var/lib/rpm/.rpm.lock (Resource temporarily unavailable)
azure-arm.azure-rhel_8: The downloaded packages were saved in cache until the next successful transaction.
azure-arm.azure-rhel_8: You can remove cached packages by executing 'yum clean packages'.
==> azure-arm.azure-rhel_8: Error: Could not run transaction.
==> azure-arm.azure-rhel_8: Provisioner failed with "Script exited with non-zero exit status: 1. Allowed exit codes are: [0]", retrying with 5 trie(s) left
==> azure-arm.azure-rhel_8: Pausing 30s before the next provisioner...
Hi @Boris-Stefanov,
We're a bit puzzled by the YAML file you are sharing in this description, Packer does not support this format at all, only JSON (legacy) and HCL2. Are you using a third-party tool to generate those?
Aside from this, this looks like a problem with YUM, the lockfile was probably leftover from a previous invocation on the VM you are provisioning, this is not something Packer or a plugin will be able to fix at first glance. I suggest you try to take a look at the processes that are running, if there is another YUM process alive, that is probably the reason why the lockfile is present.
That or it could be a YUM bug, which we do not maintain ourselves, and I suggest you open an issue on their end to look into it.
With this said, I'll close the issue since this does not seem like a bug on our end, but please feel free to reopen if you think we've missed something.
If you're struggling to get Packer working for the first time, I'd recommend reaching out to the community forum for help. The GitHub issue tracker is only watched by a small subset of maintainers and is really reserved for bugs rather than questions. You'll have a better chance of finding someone who can help you in the forum.
Thanks!
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.