dictee icon indicating copy to clipboard operation
dictee copied to clipboard

Arch: sg no longer exists — dictee-ptt.service crash-loops and text injection fails silently

Open farkmi opened this issue 2 months ago • 3 comments

Summary

dictee depends on sg (from shadow) in two places. Arch Linux no longer ships /usr/bin/sg, so on Arch and derivatives:

  1. dictee-ptt.service never starts — it crash-loops on 203/EXEC.
  2. Text injection fails silently, because the fallback path pipes into sg with stderr discarded.

The result is that push-to-talk never works, and on affected setups dictation appears to do nothing at all.

Environment

  • CachyOS (Arch-based), kernel 7.2.6-1-cachyos
  • KDE Plasma 6.7.5, Wayland
  • dictee 1.3.6-1
  • shadow 4.20.0.arch1-1.1
  • pacman -Qo /usr/bin/sg → error: No package owns /usr/bin/sg

1. dictee-ptt.service crash-loops

/usr/lib/systemd/user/dictee-ptt.service:

ExecStart=/usr/bin/sg input -c "/usr/bin/dictee-ptt"
(sg)[209302]: dictee-ptt.service: Unable to locate executable '/usr/bin/sg': No such file or directory
(sg)[209302]: dictee-ptt.service: Failed at step EXEC spawning /usr/bin/sg: No such file or directory
systemd[2137]: dictee-ptt.service: Main process exited, code=exited, status=203/EXEC
systemd[2137]: dictee-ptt.service: Scheduled restart job, restart counter is at 119.

With Restart=on-failure this loops indefinitely. Nothing surfaces to the user: the plasmoid still works, so the only symptom is that the hotkey does nothing.

2. safe_dotool() fails silently

/usr/bin/dictee:

if id -nG 2>/dev/null | grep -qw input; then
    _DOTOOL_NEEDS_SG=0
else
    _DOTOOL_NEEDS_SG=1
fi

safe_dotool() {
    if [[ $_DOTOOL_NEEDS_SG -eq 1 ]]; then
        { ...; cat; } | sg input -c 'dotool' 2>/dev/null || true
    else
        { ...; cat; } | dotool 2>/dev/null || true
    fi
}

The sg branch is taken exactly in the case the comment describes — the user was added to input by the package's post-install, after the graphical session had already started, so plasmashell (and anything it spawns) still lacks the group. On Arch that branch cannot work, and 2>/dev/null || true discards both the missing-binary error and any dotool error, so transcription succeeds and the text is simply never typed, with nothing in the logs.

Suggested fix

sg is not portable. Two independent changes:

  1. Drop sg from ExecStart. The shipped udev rule already grants the input group access to /dev/uinput, and the package adds the user to input, so the wrapper is only needed to bridge the window before the user re-logs in. Removing it and documenting "log out and back in after install" is simpler and works everywhere. (SupplementaryGroups= is not available to systemd user units, so it is not an alternative here.)
  2. Do not swallow dotool's stderr. At minimum route it to the debug log when DICTEE_DEBUG=true; a silent failure here is very hard to diagnose.

If the sg bridge is worth keeping, gate it on command -v sg and fall back to calling dotool directly, plus a warning, rather than failing silently.

Workaround for affected users

# ~/.config/systemd/user/dictee-ptt.service.d/override.conf
[Service]
ExecStart=
ExecStart=/usr/bin/dictee-ptt

after confirming id -nG lists input (log out and back in once if it does not).

farkmi avatar Sep 22 '26 09:09 farkmi

Thanks for your precise report, good catch. Reproduced on an Arch VM: Arch's shadow 4.20 no longer ships sg, and nothing else provides it.

sg was only there so that the input group works right after install, without logging out. On Arch the newgrp from util-linux can do the same job with -c, so dictee-ptt and dictee now use sg when it exists and newgrp -c otherwise. The unit no longer calls sg at all. Tested on the same VM: push-to-talk starts and types.

This ships in 1.3.7. Until then, your override plus one logout is the right workaround.

rcspam avatar Sep 22 '26 11:09 rcspam

1.3.7-rc4 is out as a pre-release. It has the sg/newgrp fix from this issue, the extra-devices change from #36, and the headset and silence threshold changes from #37. On Arch:

curl -fsSL https://github.com/rcspam/dictee/releases/download/v1.3.7-rc4/install.sh | bash -s -- --version 1.3.7-rc4

Your override is no longer needed, systemctl --user revert dictee-ptt removes it. If push-to-talk starts and types without it, that's the confirmation I'm after.

rcspam avatar Oct 26 '26 15:10 rcspam

1.3.7 is out as the final release. The code is the same as rc4, only the version number changed. If you already run rc4, you don't need to do anything. Otherwise, to update:

curl -fsSL https://github.com/rcspam/dictee/releases/download/v1.3.7/install.sh | bash

If something still doesn't work for you, tell me here.

rcspam avatar Oct 27 '26 13:10 rcspam