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

qubes-dom0-update: prevent concurrent execution #6345

Closed
iamahuman opened this issue Jan 16, 2021 · 4 comments · Fixed by QubesOS/qubes-core-admin-linux#161 or QubesOS/qubes-core-admin-linux#167
Assignees
Labels
C: core C: updates P: default Priority: default. Default priority for new issues, to be replaced given sufficient information. pr submitted A pull request has been submitted for this issue. T: enhancement Type: enhancement. A new feature that does not yet exist or improvement of existing functionality.

Comments

@iamahuman
Copy link

iamahuman commented Jan 16, 2021

Qubes OS version
R4.0

Affected component(s) or functionality
qubes-core-admin-linux: qubes-dom0-update

Brief summary
Multiple instances of qubes-dom0-update may run concurrently (e.g. qubes-dom0-update --check-only cron job running simultaneously with Qubes Updater), resulting in update cache corruption.

How Reproducible
100%

To Reproduce

Steps to reproduce the behavior:

  1. Open terminal in dom0.
  2. Start qubes-dom0-update.
  3. Open another terminal in dom0.
  4. Before the first update command finishes, wait for a while and start another qubes-dom0-update.

Expected behavior
Two instances of update command seralize with respect to each other.

Actual behavior
There are no attempts in synchronization, resulting in potential update data corruption.

Screenshots
TBD

Additional context
TBD

Solutions you've tried
Cleaning up cache every time such race condition happens is cumbersome.

Simplest solution would be to use locks to prevent concurrent invocation of qubes-dom0-update.

Relevant documentation you've consulted

Related, non-duplicate issues
TBD

@iamahuman iamahuman added P: default Priority: default. Default priority for new issues, to be replaced given sufficient information. T: enhancement Type: enhancement. A new feature that does not yet exist or improvement of existing functionality. labels Jan 16, 2021
@andrewdavidwong andrewdavidwong added this to the TBD milestone Jan 16, 2021
@andrewdavidwong andrewdavidwong removed this from the Release TBD milestone Aug 13, 2023
alimirjamali added a commit to alimirjamali/qubes-core-admin-linux that referenced this issue Jun 30, 2024
@alimirjamali
Copy link

PR Submitted. Low priority for review

alimirjamali added a commit to alimirjamali/qubes-core-admin-linux that referenced this issue Jul 1, 2024
@andrewdavidwong andrewdavidwong added the pr submitted A pull request has been submitted for this issue. label Jul 1, 2024
alimirjamali added a commit to alimirjamali/qubes-core-admin-linux that referenced this issue Jul 5, 2024
@apparatius
Copy link

apparatius commented Sep 12, 2024

The qubes-dom0-update is calling itself from inside when switching the audio:
https://github.com/QubesOS/qubes-core-admin-linux/blob/3f0afb7030276f7afc0212bbaec187abdab72860/dom0-updates/qubes-dom0-update#L433
So this change is breaking the audio switching option:
https://forum.qubes-os.org/t/terrible-audio-quality-after-suspend-switching-to-pipewire-in-dom0-does-not-work/28893
Maybe add an option for qubes-dom0-update to skip the lock file check and use this option for qubes-dom0-update commands called from inside qubes-dom0-update?
Or skip the lock file check if SWITCHING_AUDIO_IN_PROGRESS variable is set.

@alimirjamali
Copy link

The qubes-dom0-update is calling itself from inside when switching the audio:
https://github.com/QubesOS/qubes-core-admin-linux/blob/3f0afb7030276f7afc0212bbaec187abdab72860/dom0-updates/qubes-dom0-update#L433
So this change is breaking the audio switching option:
https://forum.qubes-os.org/t/terrible-audio-quality-after-suspend-switching-to-pipewire-in-dom0-does-not-work/28893
Maybe add an option for qubes-dom0-update to skip the lock file check and use this option for qubes-dom0-update commands called from inside qubes-dom0-update?
Or skip the lock file check if SWITCHING_AUDIO_IN_PROGRESS variable is set.

Ops. I did not foresee that. I will work on a fix.

@alimirjamali
Copy link

PR Submitted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: core C: updates P: default Priority: default. Default priority for new issues, to be replaced given sufficient information. pr submitted A pull request has been submitted for this issue. T: enhancement Type: enhancement. A new feature that does not yet exist or improvement of existing functionality.
Projects
None yet
4 participants