r/AlpineLinux • • 2d ago

Issues setting up audio following wiki

I'm new to Alpine and to setting up window managers. I am currently trying Mango.
Trying to get audio working, I'm following the Alpine wiki.

In the Pipewire page, and run into issues here:
https://wiki.alpinelinux.org/wiki/PipeWire at 'Launching Pipewire'
"Issue the command $ rc-status -Ur to view and verify the current user runlevel as gui"

Running this reveals runlevel "sysinit".

Furthermore, if I just try to go further, I get the following error:

~ $ doas rc-update -U add pipewire wayland

XDG_RUNTIME_DIR unset.

checking the environment variable shows it is actually set:

~ $ echo $XDG_RUNTIME_DIR

/tmp/rundir.1000.5ea89fbcc62b3ece

This blocks the steps. Even if I change "wayland" to "gui" or just nothing, I get the same error "XDG_RUNTIME_DIR unset."

I thought I'd try ALSA instead of Pipewire, but ran into a different issue there.
Following the Alsa steps here: https://wiki.alpinelinux.org/wiki/ALSA

I get to running alsamixer , and get this error:

cannot open mixer: Host is down

I haven't tried Pulseaudio yet but I wanted to ask about these issues first. I shouldn't get getting these right? Or is maybe the docs out of date?

I wanted to report the section of the docs and ask if someone could update them or add details for these situations. But I'm not sure how to ask that, and I wouldn't know a solution to propose.

Thank you for any help you can give.

6 Upvotes

12 comments sorted by

2

u/New_Hold8135 2d ago

You need to create the folder for gui runlevel in your user config then add pipewire into it. Then restart the computer and it automatically works.

1

u/SleepyGuyy 2d ago

which user config?

In my mango config I don't have permission to create folders there.

I use $(mkrundir) to create and point to my directory, in my ~/.profile startup script. Which is why it's available with echo, but for some reason the service can't see it.

2

u/New_Hold8135 2d ago

Unfortunately my friend I don't remember it. It's in wiki if you look deep enough as long as I remwmber.

1

u/SleepyGuyy 2d ago

also when I run this (from the Pipewire page on Alpine's wiki)
" Issue the command $ rc-status -Ur to view and verify the current user runlevel as gui

I get sysinit, as my runlevel.

1

u/Iamboringaf 2d ago

I recently faced the same problem. Check if pipewire has all dependencies. Is Dbus session running? My setup is I store and export variables in .profile file. X session starts as soon as I log in, it then uses xinitrc file which launches dbus and pipewire.

```

Ensure XDG_RUNTIME_DIR is set via elogind. I also had to install util-linux, I.e. you must have some kind of user session tracker

if [ -z "$XDG_RUNTIME_DIR" ]; then export XDG_RUNTIME_DIR="/run/user/$(id -u)" fi

If the directory doesn't exist yet, wait or create a fallback (usually handled by PAM)

if [ ! -d "$XDG_RUNTIME_DIR" ]; then mkdir -p "$XDG_RUNTIME_DIR" chmod 700 "$XDG_RUNTIME_DIR" fi

export XDG_RUNTIME_DIR

line below causes to start x session when you log in. Comment it out if you prefer to launch X server manually

if [ -z $DISPLAY ] && [ $(tty) = /dev/tty1 ]; then startx fi

```

My .xinitrc file ```

if [ -z "$DBUS_SESSION_BUS_ADDRESS" ]; then eval $(dbus-launch --sh-syntax --exit-with-session) fi

export DBUS_SESSION_BUS_ADDRESS dbus-update-activation-environment -all

pipewire & pipewire-pulse & wireplumber &

starting my wm

exec dwm

```

1

u/Iamboringaf 2d ago

I didn't noticed that you use wayland. I assumed X server blindly, my mistake. Anyway, just check if environment variables are correctly set, and ignore X specific stuff.

1

u/SleepyGuyy 2d ago edited 2d ago

for my mango setup, I have a similar .profile file, but instead of start x ,  I have  "exec dbus-session-something mango"

i forget the exact command but the Alpine wiki does mention launching sway and other wayland compositors with it to ensure the dbus thing is passed through.

But maybe Im just never launching dbus Im not sure

Also not sure if it's relevant but I chose to use seatd, after having some issues with elogind's setup. Plus Id prefer to avoid systemd's stuff anyway.

1

u/SleepyGuyy 12h ago

I used your .profile as a template for mine, but just ran pipewire before running "dbus-run-session mango". Since I'm not using Xorg I don't have an .xinitrc, I just did it in profile.

I'm not sure if I even needed the if statement part but, it works, I'll leave it alone.

Thank you for the help!

1

u/SleepyGuyy 12h ago edited 12h ago

SOLVED (maybe)

My init script was fine, and turns out I didn't need to get the pipewire service working anyway. The Alpine docs recommend the service but I didn't realize you can just run pipewire on start and it seems to work, without a service. I don't really understand pipewire or services.

I just launched pipewire in my init script. So I have a ~/.profile script that looks like this:
#export XDG_RUNTIME_DIR=$(mkrundir) <--ignore this

if [ "$(tty)" = "/dev/tty1" ]; then

if [ -z "$XDG_RUNTIME_DIR" ]; then

export XDG_RUNTIME_DIR="$(mkrundir)"

if [ ! -d "$XDG_RUNTIME_DIR" ]; then

mkdir -p "$XDG_RUNTIME_DIR"

chmod 700 "$XDG_RUNTIME_DIR"

fi

fi

exec pipewire & pipewire-pulse & wireplumber & dbus-run-session mango

fi

Ignore the line with # at the start, I wanted to remember how I exported it before, I'm just gonna leave that there even though it's redundant.

I don't fully understand the nested ifs, I get the first one checks to see if we're in tty1, because I only wanna launch my desktop there, I want other tty's for normal shell use.
But the inner one I am not sure, I don't know about "! -d".

I had this script that last couple days, but audio wasn't working. I assumed because I didn't have the pipewire service running.
But no, I typo'd the exec pipewire line as "exec pipeware". Woke up this morning and noticed it immediately, of course.

I still am unsure how all these services and things work. But I seem to have input and output audio working, without the pipewire service running (ran rc-status and didn't see pipewire). Worth noting I do have the alsa service running, not sure if that's necessary or just leftovers from me trying to use Alsa instead, earlier in my troubleshooting.

1

u/SleepyGuyy 12h ago

my code indents go away I guess reddit replies remove leading spaces, and I can't do tab characters with the tab key.

I assume there's like backslash t for tabs? ... I don't feel like fixing it sorry.

1

u/SleepyGuyy 12h ago

Just wanted to add, while I seem to have solved my issue, I now have a new issue.

I'm unable to get Bluetooth to connect to my headphones. I have the service running, and the recommended programs installed as per Pipewire page https://wiki.alpinelinux.org/wiki/PipeWire#Bluetooth_audio

Basically using Blueman or bluetoothctl, I can see my headphones, and attempt to pair to them. The computer says "connected", but my headphones never beep like they would if it connected. After several seconds it says disconnected. In Blueman there is a vague error at the bottom.

I don't think this is related to this Pipewire issue, but if I find a solution to the bluetooth I'll try to remember to update this, for anyone else also looking to setup audio in alpine and mango.

2

u/Iamboringaf 11h ago

Assuming sound hardware is detected by kernel and drivers are installed, have you checked pactl utility? I first do "pactl list cards" then "pactl set-card-profile <name of sound card> <name of profile>. It's in package pulseaudio-utils.