Fixing audio after update

Well, my story is old as this world.

Ive updated qubes os on 30-th of December. It is 2 of January and my sound remains broken.
My plan is to use this post as blog, to accumulate knowledge about qubes audio in hope that this journey in text will save at lest one other pure soul.

Useful links:

Current setup:
Qubes 4.3 upgraded from 4.2.
sys-usb as audio vm.
usb dongle with 3.5 jack input

Running in sys-usb

qvm-start-daemon --all --watch

Results in:

<some fedora 42 xfce based qube>: Starting AUDIO
asyncio: Task exception was never retrieved
future: <Task finished name='Task-4' coro=<DAEMONLauncher.start_audio() done, defined at /usr/lib/python3.13/site-packages/qubesadmin/tools/qvm_start_daemon.py:623> exception=TypeError('expected str, bytes or os.PathLike object, not int')>
Traceback (most recent call last):
  File "/usr/lib/python3.13/site-packages/qubesadmin/tools/qvm_start_daemon.py", line 640, in start_audio
    await self.start_audio_for_vm(vm)
  File "/usr/lib/python3.13/site-packages/qubesadmin/tools/qvm_start_daemon.py", line 597, in start_audio_for_vm
    await asyncio.create_subprocess_exec(*pacat_cmd)
  File "/usr/lib64/python3.13/asyncio/subprocess.py", line 224, in create_subprocess_exec
    transport, protocol = await loop.subprocess_exec(
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<3 lines>...
        stderr=stderr, **kwds)
        ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.13/asyncio/base_events.py", line 1802, in subprocess_exec
    transport = await self._make_subprocess_transport(
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        protocol, popen_args, False, stdin, stdout, stderr,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        bufsize, **kwargs)
        ^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.13/asyncio/unix_events.py", line 213, in _make_subprocess_transport
    transp = _UnixSubprocessTransport(self, protocol, args, shell,
                                    stdin, stdout, stderr, bufsize,
                                    waiter=waiter, extra=extra,
                                    **kwargs)
  File "/usr/lib64/python3.13/asyncio/base_subprocess.py", line 40, in __init__
    self._start(args=args, shell=shell, stdin=stdin, stdout=stdout,
    ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                stderr=stderr, bufsize=bufsize, **kwargs)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.13/asyncio/unix_events.py", line 855, in _start
    self._proc = subprocess.Popen(
                 ~~~~~~~~~~~~~~~~^
        args, shell=shell, stdin=stdin, stdout=stdout, stderr=stderr,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        universal_newlines=False, bufsize=bufsize, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.13/subprocess.py", line 1039, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
    ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                        pass_fds, cwd, env,
                        ^^^^^^^^^^^^^^^^^^^
    ...<5 lines>...
                        gid, gids, uid, umask,
                        ^^^^^^^^^^^^^^^^^^^^^^
                        start_new_session, process_group)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.13/subprocess.py", line 1876, in _execute_child
    self._posix_spawn(args, executable, env, restore_signals, close_fds,
    ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                      p2cread, p2cwrite,
                      ^^^^^^^^^^^^^^^^^^
                      c2pread, c2pwrite,
                      ^^^^^^^^^^^^^^^^^^
                      errread, errwrite)
                      ^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.13/subprocess.py", line 1820, in _posix_spawn
    self.pid = os.posix_spawn(executable, args, env, **kwargs)
               ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: expected str, bytes or os.PathLike object, not int

After checking error message and embedding dozens of print I found that issue is related to:

That is async def start_audio_for_vm(self, vm) function.

It looks like I have a bug in my version of a start_audio_for_vm,

pacat_cmd = [PACAT_DAEMON_PATH, '-l', self.pacat_domid(vm), vm.name]

That is missing str conversion. In comparison to current implementation on git.

Making code in /usr/lib/python3.13/site-packages/qubesadmin/tools/qvm_start_daemon.py resemble code in git fixed the issue.

Yet the question remains — why?

# dnf provides /usr/lib/python3.13/site-packages/qubesadmin/tools/qvm_start_daemon.py
Updating and loading repositories:
Repositories loaded.
python3-qubesadmin-4.2.17-1.fc42.noarch : Python3 module qubesadmin
Repo         : @System
Matched From : 
Filename     : /usr/lib/python3.13/site-packages/qubesadmin/tools/qvm_start_daemon.py

python3-qubesadmin-4.2.17-1.fc42.noarch : Python3 module qubesadmin
Repo         : qubes-vm-r4.2-current
Matched From : 
Filename     : /usr/lib/python3.13/site-packages/qubesadmin/tools/qvm_start_daemon.py
cat /etc/redhat-release 
Fedora release 42 (Adams)

May be, if I update my sys-usb that serves as audio vm from from fedora 42 to 43, I will get never version of code?

Attempt to update template VM based on fedora 42(previously updated from 40), failed:

sudo dnf --releasever=43 distro-sync --best --allowerasing

Updating and loading repositories:
 Qubes OS Repository for VM (updates)   100% | 308.0   B/s | 612.0   B |  00m02s
>>> Status code: 404 for https://yum.qubes-os.org/r4.2/current/vm/fc43/repodata/
>>> Status code: 404 for https://yum.qubes-os.org/r4.2/current/vm/fc43/repodata/
>>> Status code: 404 for https://yum.qubes-os.org/r4.2/current/vm/fc43/repodata/
>>> Status code: 404 for https://yum.qubes-os.org/r4.2/current/vm/fc43/repodata/
>>> Usable URL not found                                                        
 Fedora 43 openh264 (From Cisco) - x86_ 100% | 823.0   B/s |   5.8 KiB |  00m07s
 Fedora 43 - x86_64 - Updates           100% |   1.4 MiB/s |  11.9 MiB |  00m08s
 Fedora 43 - x86_64                     100% |   1.1 MiB/s |  15.7 MiB |  00m14s
Failed to download metadata (baseurl: "https://yum.qubes-os.org/r4.2/current/vm/fc43") for repository "qubes-vm-r4.2-current": Usable URL not found

Well, I guess fedora 43 is not supported by qubes 4.2, but Im on qubes 4.3, now, am I?

Ive decided to comment out all 4.2 repos in /etc/yum.repos.d/qubes-r4.repo and try to update according to How to upgrade a Fedora template in-place — Qubes OS Documentation

Well updating fedora 42 to 43 failed.
It kinda worked but some qubes agents/services are not able to connect to template vm when it starts, so vm auto shuts down itself soon after start.
Sad thing is that it is my sys-usb template, and probably if I fail in template changing my access to machine will be f*cked up, because I use usb keyboard and mouse.

Your issue is probably related to a missing package needed by QubesOS during your manual upgrade attempt. Check if there is any logs screaming about “dbus” and if the “dbus-x11” package is installed

Ive re-done guide Audio qube with fedora-42 as template and things sims to be working now.

Well not all as Im not able to regulate sound through dom0 panel.