Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Gamers & Players
  • Search

Get sound in Steam chroot installation?

Having problems getting your favorite Linux game to work? Want to discuss strategies? This is the place!
Post Reply
  • Print view
Advanced search
7 posts • Page 1 of 1
Author
Message
wintcape
n00b
n00b
Posts: 4
Joined: Sun Aug 28, 2022 1:55 pm

Get sound in Steam chroot installation?

  • Quote

Post by wintcape » Mon Nov 28, 2022 4:16 pm

Here is my script to run Steam from inside a chrooted environment with a user 'steam':

Code: Select all

#!/bin/sh

ARCH=linux64
DIR=/opt/steam

# ========== DO NOT MODIFY BELOW THIS LINE ========== #

mount --types proc  /proc                   $DIR/proc
mount --rbind       /sys                    $DIR/sys
mount --make-rslave $DIR/sys
mount --rbind       /dev                    $DIR/dev
mount --make-rslave $DIR/dev
mount --rbind       /run                    $DIR/run
mount --make-slave  $DIR/run
mount --rbind       /var/db/repos/gentoo    $DIR/var/db/repos/gentoo
mount -o bind       /dev/pts                $DIR/dev/pts

xhost +local:
$ARCH chroot $DIR su -c 'steam -no-cef-sandbox' steam
xhost -local:

umount  --verbose -l            $DIR/proc
umount  --verbose -l            $DIR/sys
umount  --verbose -l            $DIR/dev
umount  --verbose -l            $DIR/run
umount  --verbose -l            $DIR/pts
umount  --verbose -l            $DIR/var/db/repos/gentoo
This launches Steam and Steam games fine, but I use Pulseaudio and pulsemixer for sound, and no entries appear in the pulsemixer menu for any Steam games that I run. Sound works on all my non-chroot applications. What do I have to set up to get sound working in the chroot environment?
Top
capezotte
n00b
n00b
Posts: 7
Joined: Sun Nov 13, 2022 10:35 pm
Location: South America

  • Quote

Post by capezotte » Mon Nov 28, 2022 5:07 pm

The quickest solution is running your chroot under your UID. By default, XDG_RUNTIME_DIR (where the D-Bus and PA IPC endpoints are located - usually /run/user/$(id -u)) can only be accessed by your UID, so applications under your "steam" UID are locked out of it.

If you're chrooting steam for security purposes/due to not trusting proprietary software, I'd rather use Flatpak or Firejail. Allowing chrooted applications to access the "outside" D-Bus without introducing easy sandbox escapes involves ultimately duplicating what these solutions already do.
Top
wintcape
n00b
n00b
Posts: 4
Joined: Sun Aug 28, 2022 1:55 pm

  • Quote

Post by wintcape » Mon Nov 28, 2022 8:13 pm

capezotte wrote:The quickest solution is running your chroot under your UID. By default, XDG_RUNTIME_DIR (where the D-Bus and PA IPC endpoints are located - usually /run/user/$(id -u)) can only be accessed by your UID, so applications under your "steam" UID are locked out of it.
Running $(id -u steam) inside the chroot and $(id -u) outside the chroot yields the same UID. What else would I need to change?
Top
capezotte
n00b
n00b
Posts: 7
Joined: Sun Nov 13, 2022 10:35 pm
Location: South America

  • Quote

Post by capezotte » Mon Nov 28, 2022 11:31 pm

Arch wiki people report also needing to bind /var/lib/dbus inside the chroot. PA in my chroot works just fine without it, but it might help you.

While you're at it, does paplay some_file.wav work in your chroot?
Top
wintcape
n00b
n00b
Posts: 4
Joined: Sun Aug 28, 2022 1:55 pm

  • Quote

Post by wintcape » Tue Nov 29, 2022 4:37 pm

capezotte wrote:Arch wiki people report also needing to bind /var/lib/dbus inside the chroot. PA in my chroot works just fine without it, but it might help you.

While you're at it, does paplay some_file.wav work in your chroot?
Added the following line to my chroot script:

Code: Select all

mount --rbind       /var/lib/dbus           $DIR/var/lib/dbus
This happens in chroot when trying to paplay:

Code: Select all

 # paplay sound.wav
Connection failure: Connection refused
pa_context_connect() failed: Connection refused
Playing the same sound outside the chroot works.
Top
capezotte
n00b
n00b
Posts: 7
Joined: Sun Nov 13, 2022 10:35 pm
Location: South America

  • Quote

Post by capezotte » Tue Nov 29, 2022 10:28 pm

Just to be sure, is XDG_RUNTIME_DIR kept in the environment after you sudo? `sudo -E' (or adding it to env_keep in sudoers) should do it.

(For bonus info, try strace -e connect paplay ... inside the chroot -- it should have a line with sun_path="$XDG_RUNTIME_DIR/pulse/native").

I've renamed the user inside my chroot and it still worked (so username 'steam' being the problem is ruled out); it failed with the exact error message you posted after unsetting it.
Top
rh
n00b
n00b
Posts: 58
Joined: Tue Sep 19, 2006 1:47 pm

  • Quote

Post by rh » Mon Dec 05, 2022 8:47 am

I just run Pulseaudio system-wide.

https://www.freedesktop.org/wiki/Softwa ... ystemWide/
Top
Post Reply
  • Print view

7 posts • Page 1 of 1

Return to “Gamers & Players”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic