Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exit installer if dpkg lock is held for more then 30 seconds #4682

Merged
merged 4 commits into from Apr 7, 2022

Conversation

yubiuser
Copy link
Member

@yubiuser yubiuser commented Apr 4, 2022

  • I have read and understood the contributors guide, as well as this entire template.
  • I have made only one major change in my proposed changes.
  • I have commented my proposed changes within the code.
  • I have tested my proposed changes, and have included unit tests where possible.
  • I am willing to help maintain this change if there are issues with it later.
  • I give this submission freely and claim no ownership.
  • It is compatible with the EUPL 1.2 license
  • I have squashed any insignificant commits. (git rebase)

Please make sure you Sign Off all commits. Pi-hole enforces the DCO.


What does this PR aim to accomplish?:
Fixes #3977.

When installing via apt we use a function to check if dpkg is holding a lock on /va/lib/dpkg/lock. If so we wait...until the lock is lifted. If there is no lifting we wait until forever.
This PR adds a safety check to stop the whole installer if the lock is not lifted within 30 seconds.The original PR #1286 already introduced a counter but never used it. We do use it now.

P.S. The PR additionally moves the function test_dpkg_lock out of package_manager_detect because it is not used in there. (Only later in install_dependent_packages)

Signed-off-by: Christian König <ckoenig@posteo.de>
Signed-off-by: Christian König <ckoenig@posteo.de>
Signed-off-by: Christian König <ckoenig@posteo.de>
@yubiuser yubiuser linked an issue Apr 4, 2022 that may be closed by this pull request
@yubiuser yubiuser requested a review from a team April 4, 2022 15:05
@yubiuser yubiuser changed the title Loop Exit installer if dpkg lock is held for more then 30 seconds Apr 4, 2022
@PromoFaux
Copy link
Member

No issue with this in theory, nobody wants an infinite loop with no user feedback, is 30 seconds a sensible default?

@yubiuser
Copy link
Member Author

yubiuser commented Apr 5, 2022

We can easily make it 60 seconds or more.... but at some point users will cancle the installer hard because they think it got stuck.

Co-authored-by: Adam Warner <me@adamwarner.co.uk>
@yubiuser yubiuser requested a review from PromoFaux April 7, 2022 07:12
@yubiuser yubiuser merged commit 21ae81f into development Apr 7, 2022
@yubiuser yubiuser deleted the loop branch April 7, 2022 13:26
@pralor-bot
Copy link

This pull request has been mentioned on Pi-hole Userspace. There might be relevant details there:

https://discourse.pi-hole.net/t/pi-hole-ftl-v5-15-web-v5-12-and-core-v5-10-released/54987/1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

endles loop for test_dpkg_lock() although has counter..
3 participants