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

Dynamic audiovm switching #8975

Closed
4 tasks done
marmarek opened this issue Feb 25, 2024 · 19 comments · Fixed by QubesOS/qubes-core-admin#589 or QubesOS/qubes-vmm-xen-stubdom-linux#66
Closed
4 tasks done

Dynamic audiovm switching #8975

marmarek opened this issue Feb 25, 2024 · 19 comments · Fixed by QubesOS/qubes-core-admin#589 or QubesOS/qubes-vmm-xen-stubdom-linux#66
Assignees
Labels
C: audio 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. r4.2-host-stable r4.2-vm-bookworm-stable r4.2-vm-fc37-stable r4.2-vm-fc38-stable r4.2-vm-fc39-stable r4.2-vm-fc40-stable r4.2-vm-trixie-stable r4.3-host-cur-test r4.3-vm-bookworm-cur-test r4.3-vm-fc39-cur-test r4.3-vm-fc40-cur-test r4.3-vm-trixie-cur-test T: enhancement Type: enhancement. A new feature that does not yet exist or improvement of existing functionality.

Comments

@marmarek
Copy link
Member

marmarek commented Feb 25, 2024

How to file a helpful issue

The problem you're addressing (if any)

Currently, changing audiovm requires target qube restart in practice. Technically, it is possible to change it without qube restart, if you know which services to restart in what order etc, but that's very much not obvious. This also includes the case of restarting said audiovm.

The solution you'd like

Changing audiovm at runtime should be seamless, as is changing netvm.

The value to a user, and who that user might be

Easier to use non-dom0 audiovm, mostly relevant for USB audio devices. Related to #7750, #8093.

Details

Implementation-wise, this requires:

  • dom0 changing relevant qubesdb (or else) entry when audiovm is changed or (re)started
  • pulseaudio agent watching said qubesdb entry and re-establishing vchan connection when needed
  • pipewire agent doing the same
  • stubdomain (currently also pulseaudio) agent doing the same - a caveat here, currently stubdomain doesn't have qubesdb at all (and has hardcoded domid=0 as audiovm), but it does have qrexec-agent
@marmarek marmarek added T: enhancement Type: enhancement. A new feature that does not yet exist or improvement of existing functionality. P: default Priority: default. Default priority for new issues, to be replaced given sufficient information. C: audio labels Feb 25, 2024
@marmarek marmarek moved this to In progress in Current team tasks Mar 11, 2024
marmarek added a commit to marmarek/qubes-core-admin that referenced this issue Apr 4, 2024
Besides new tests, rename "prepare_audio_vm" to "prepare_audio_test" to
avoid confusion with "audiovm".

QubesOS/qubes-issues#8975
marmarek added a commit to marmarek/qubes-core-admin that referenced this issue Apr 5, 2024
Besides new tests, rename "prepare_audio_vm" to "prepare_audio_test" to
avoid confusion with "audiovm".

QubesOS/qubes-issues#8975
marmarek added a commit to marmarek/qubes-core-admin that referenced this issue Apr 6, 2024
Besides new tests, rename "prepare_audio_vm" to "prepare_audio_test" to
avoid confusion with "audiovm".

QubesOS/qubes-issues#8975
marmarek added a commit to marmarek/qubes-core-admin that referenced this issue Apr 8, 2024
Besides new tests, rename "prepare_audio_vm" to "prepare_audio_test" to
avoid confusion with "audiovm".

QubesOS/qubes-issues#8975
marmarek added a commit to marmarek/qubes-core-admin that referenced this issue Apr 11, 2024
Besides new tests, rename "prepare_audio_vm" to "prepare_audio_test" to
avoid confusion with "audiovm".

QubesOS/qubes-issues#8975
marmarek added a commit to marmarek/qubes-core-admin that referenced this issue Apr 11, 2024
Besides new tests, rename "prepare_audio_vm" to "prepare_audio_test" to
avoid confusion with "audiovm".

Since starting/stopping pacat is asynchronous, retry up to 10s.

QubesOS/qubes-issues#8975
@marmarek marmarek moved this from In progress to Done in Current team tasks Apr 14, 2024
@marmarek marmarek moved this from Done to In review in Current team tasks Apr 14, 2024
fepitre added a commit to fepitre/qubes-core-admin-client that referenced this issue Apr 23, 2024
@marmarek
Copy link
Member Author

Changing audiovm when recording is enabled is confusing. It's because the recording state is in fact hold by the pacat process in a specific audiovm - after switching, the new audiovm doesn't know if it was enabled. The result is recording gets disabled after switching (until you switch back, where the old pacat still knows it), but the devices widget thinks it's still enabled (and fails to detach microphone). qvm-device mic shows the correct state.

Steps to reproduce:

  1. Set audiovm of testvm to dom0
  2. Start testvm
  3. Enable recording (either via widget or via qvm-device mic at testvm dom0:mic)
  4. Set testvm's audiovm to sys-audio
  5. Observe the widget still shows mic attached, but qvm-device mic doesn't. Recording doesn't work. Can be fixed with qvm-device mic at testvm dom0:mic again
  6. Switch audiovm back to dom0.
  7. Observe recording remains enabled (as it was enabled in dom0 before).

I see two options:

  1. Re-enable microphone after switching audiovm, if recording was enabled before (and similarly, ensure it's disabled after if it was disabled before).
  2. Emit synthetic mic detach event on audiovm switch, so the widget knows it got disabled. But also, ensure it really gets disabled (see the case of switching back and forth).

fepitre added a commit to fepitre/qubes-gui-agent-linux that referenced this issue Apr 26, 2024
fepitre added a commit to fepitre/qubes-gui-agent-linux that referenced this issue Apr 26, 2024
@github-project-automation github-project-automation bot moved this from In review to Done in Current team tasks Apr 28, 2024
@marmarek marmarek reopened this Apr 28, 2024
@marmarek marmarek moved this from Done to In progress in Current team tasks Apr 28, 2024
@fepitre
Copy link
Member

fepitre commented May 13, 2024

@marmarek only remains this recording issue right? I think I've experimented it but I would need to retry.

@marmarek
Copy link
Member Author

marmarek commented May 13, 2024 via email

@andrewdavidwong andrewdavidwong added the pr submitted A pull request has been submitted for this issue. label May 13, 2024
marmarek added a commit to QubesOS/qubes-core-admin that referenced this issue May 14, 2024
Use pulseaudio inside VM as that's more compatible.

This also tests starting HVM with a non-dom0 audiovm.

QubesOS/qubes-issues#8975
@qubesos-bot
Copy link

Automated announcement from builder-github

The component core-admin-client (including package core-admin-client) has been pushed to the r4.2 testing repository for the Fedora template.
To test this update, please install it with the following command:

sudo dnf update --enablerepo=qubes-vm-r4.2-current-testing

Changes included in this update

@qubesos-bot
Copy link

Automated announcement from builder-github

The package core-admin-client has been pushed to the r4.2 stable repository for the Debian template.
To install this update, please use the standard update command:

sudo apt-get update && sudo apt-get dist-upgrade

Changes included in this update

@qubesos-bot
Copy link

Automated announcement from builder-github

The package core-admin-client has been pushed to the r4.2 stable repository for the Debian template.
To install this update, please use the standard update command:

sudo apt-get update && sudo apt-get dist-upgrade

Changes included in this update

@qubesos-bot
Copy link

Automated announcement from builder-github

The component core-admin-client (including package core-admin-client) has been pushed to the r4.2 stable repository for the Fedora template.
To install this update, please use the standard update command:

sudo dnf update

Changes included in this update

@qubesos-bot
Copy link

Automated announcement from builder-github

The component core-admin-client (including package core-admin-client) has been pushed to the r4.2 stable repository for the Fedora template.
To install this update, please use the standard update command:

sudo dnf update

Changes included in this update

@qubesos-bot
Copy link

Automated announcement from builder-github

The component core-admin-client (including package core-admin-client) has been pushed to the r4.2 stable repository for the Fedora template.
To install this update, please use the standard update command:

sudo dnf update

Changes included in this update

@qubesos-bot
Copy link

Automated announcement from builder-github

The component core-admin-client (including package core-admin-client) has been pushed to the r4.2 stable repository for the Fedora template.
To install this update, please use the standard update command:

sudo dnf update

Changes included in this update

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: audio 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. r4.2-host-stable r4.2-vm-bookworm-stable r4.2-vm-fc37-stable r4.2-vm-fc38-stable r4.2-vm-fc39-stable r4.2-vm-fc40-stable r4.2-vm-trixie-stable r4.3-host-cur-test r4.3-vm-bookworm-cur-test r4.3-vm-fc39-cur-test r4.3-vm-fc40-cur-test r4.3-vm-trixie-cur-test T: enhancement Type: enhancement. A new feature that does not yet exist or improvement of existing functionality.
Projects
Archived in project
4 participants