My understanding of sudo -u <username> <command> was that it simply ran the <command> as the specified user. So can anyone explain the following:
As shown above, if I run the command XDG_RUNTIME_DIR=/run/user/1000 pactl list sinks, logged on as user pi then the command fails. However, if I run it as sudo -u pi ... then the command succeeds.
To provide some context, I have an old Pimoroni phat-beat, which I am for the first time trying to get to work. I am running on a Zero 2W, with Raspberry Pi OS Bookworm Desktop 64-bit installed. I did a desktop installation rather than lite to try and ensure that sound support was fully installed and configured.
I have not really played with Linux sound before, and don't really know what I am doing. I found the pactl command by examining the source of raspi-config.
Code:
pi@piradio:~ $ ls /run/user1000pi@piradio:~ $ XDG_RUNTIME_DIR=/run/user/1000 pactl list sinksConnection failure: Connection refusedpa_context_connect() failed: Connection refusedpi@piradio:~ $ sudo -u pi XDG_RUNTIME_DIR=/run/user/1000 pactl list sinksSink #67State: SUSPENDEDName: alsa_output.platform-soc_sound.stereo-fallbackDescription: Built-in Audio StereoDriver: PipeWireSample Specification: s32le 2ch 48000HzChannel Map: front-left,front-rightOwner Module: 4294967295Mute: noVolume: front-left: 26214 / 40% / -23.88 dB, front-right: 26214 / 40% / -23.88 dB balance 0.00Base Volume: 65536 / 100% / 0.00 dBMonitor Source: alsa_output.platform-soc_sound.stereo-fallback.monitorLatency: 0 usec, configured 0 usecFlags: HARDWARE DECIBEL_VOLUME LATENCY Properties:alsa.card = "1"alsa.card_name = "snd_rpi_hifiberry_dac"alsa.class = "generic"alsa.device = "0"alsa.driver_name = "snd_soc_rpi_simple_soundcard"alsa.id = "HifiBerry DAC HiFi pcm5102a-hifi-0"alsa.long_card_name = "snd_rpi_hifiberry_dac"alsa.name = "HifiBerry DAC HiFi pcm5102a-hifi-0"alsa.resolution_bits = "16"alsa.subclass = "generic-mix"alsa.subdevice = "0"alsa.subdevice_name = "subdevice #0"api.alsa.card.longname = "snd_rpi_hifiberry_dac"api.alsa.card.name = "snd_rpi_hifiberry_dac"api.alsa.path = "hw:1"api.alsa.pcm.card = "1"api.alsa.pcm.stream = "playback"audio.channels = "2"audio.position = "FL,FR"card.profile.device = "1"device.api = "alsa"device.class = "sound"device.id = "54"device.profile.description = "Stereo"device.profile.name = "stereo-fallback"device.routes = "1"factory.name = "api.alsa.pcm.sink"media.class = "Audio/Sink"device.description = "Built-in Audio"node.name = "alsa_output.platform-soc_sound.stereo-fallback"node.nick = "HifiBerry DAC HiFi pcm5102a-hifi-0"node.pause-on-idle = "false"object.path = "alsa:pcm:1:hw:1:playback"priority.driver = "1000"priority.session = "1000"factory.id = "18"clock.quantum-limit = "8192"client.id = "34"node.driver = "true"factory.mode = "merge"audio.adapt.follower = ""library.name = "audioconvert/libspa-audioconvert"object.id = "67"object.serial = "67"api.acp.auto-port = "false"api.acp.auto-profile = "false"api.alsa.card = "1"api.alsa.use-acp = "true"api.dbus.ReserveDevice1 = "Audio1"device.bus_path = "platform-soc:sound"device.enum.api = "udev"device.form_factor = "internal"device.icon_name = "audio-card-analog"device.name = "alsa_card.platform-soc_sound"device.nick = "snd_rpi_hifiberry_dac"device.plugged.usec = "12703175"device.subsystem = "sound"sysfs.path = "/devices/platform/soc/soc:sound/sound/card1"device.string = "1"Ports:analog-output: Analog Output (type: Analog, priority: 9900, availability unknown)Active Port: analog-outputFormats:pcmpi@piradio:~ $ XDG_RUNTIME_DIR=/run/user/1000 pactl list sinksConnection failure: Connection refusedpa_context_connect() failed: Connection refused
To provide some context, I have an old Pimoroni phat-beat, which I am for the first time trying to get to work. I am running on a Zero 2W, with Raspberry Pi OS Bookworm Desktop 64-bit installed. I did a desktop installation rather than lite to try and ensure that sound support was fully installed and configured.
I have not really played with Linux sound before, and don't really know what I am doing. I found the pactl command by examining the source of raspi-config.
Statistics: Posted by Memotech Bill — Wed Mar 06, 2024 2:53 pm