#878401 [systemd] Dependency on /tmp not correctly stated for some sound.target (or /tmp/pulse-* shows up underneath my /tmp mount)

Package:
alsa-utils
Source:
alsa-utils
Description:
Utilities for configuring and using ALSA
Submitter:
Date:
2021-09-22 04:47:50 UTC
Severity:
normal
Tags:
#878401#5
Date:
2017-10-13 11:21:18 UTC
From:
To:
--- Please enter the report below this line. ---
I mount a filesystem over /tmp in /etc/fstab, but if I take a peek underneath,

Triangulating with journalctl -b (and stat to get the right microsecond)
shows these being created right after the first soundcard is processed
by the kernel.

It seems that sound.target should depend on /tmp mount, at least
until pulse stops putting this directory in /tmp.

Debian Release: buster/sid
   300 testing         ftp.us.debian.org   250 unstable        ftp.us.debian.org   200 experimental    ftp.us.debian.org
--- Package information. ---
Depends                              (Version) | Installed
==============================================-+-============================
libacl1                          (>= 2.2.51-8) | libapparmor1                 (>= 2.9.0-3+exp2) | libaudit1                         (>= 1:2.2.1)
| libblkid1                          (>= 2.19.1) | libc6                                (>= 2.17) | libcap2                            (>=
1:2.10) | libcryptsetup4                    (>= 2:1.4.3) | libgcrypt20                         (>= 1.7.0) | libgpg-error0
(>= 1.14) | libidn11                             (>= 1.13) | libip4tc0          (>= 1.6.0+snapshot20161117) | libkmod2
    (>= 5~) | liblz4-1                         (>= 0.0~r130) | liblzma5              (>= 5.1.1alpha+20120614) | libmount1
  (>= 2.26.2) | libpam0g                         (>= 0.99.7.1) | libseccomp2                         (>= 2.3.1) | libselinux1
     (>= 2.1.9) | libsystemd0                          (= 234-3) | util-linux                         (>= 2.27.1) | mount
        (>= 2.26) | adduser                                        | procps                                         |

Package Status       (Version) | Installed
==============================-+-===========
udev                           | 234-3
dracut                         | initramfs-tools                | 0.130


Recommends          (Version) | Installed
=============================-+-===========
libpam-systemd                | 234-3
dbus                          | 1.11.20-1


Suggests               (Version) | Installed
================================-+-===========
systemd-container                | policykit-1                      | 0.105-18
--- Output from package bug script ---

#878401#10
Date:
2017-10-13 11:30:24 UTC
From:
To:
Control: tags -1 moreinfo
dependencies on /tmp.
If anything, it's pulseaudio which should ensure that /tmp is mounted.

I am confused though: Are you suggesteting that pulseaudio is started by
sound.target?
pulseaudio.service is supposed to be a systemd user service so this
doesn't really make sense.

Is it possible that pulseaudio is started via other means which are not
under systemd's control?

Michael

#878401#17
Date:
2017-10-13 12:38:48 UTC
From:
To:
This might be caused by the alsa units. The pulse plugin might be
attempting to connect to pulseaudio, but it's not running yet.

Could you attach the relevant journalctl output to determine this?

#878401#22
Date:
2017-10-13 12:58:07 UTC
From:
To:
I agree, wholeheartedly. But getting this directory out of /tmp has
been a bug for 7 years [1].

I don't know why a pulse directory is being created, but its right after
sound.target and after sound devices start getting loaded by the kernel.
Maybe there's some weird udev hook I should look for? Everything in

/lib/udev/rules.d

that has the word "pulse" in it, only seems to have environment variables
being set in them.

I will say that on other machines I'm looking at, the pulse directory is
created much later on, relative to the beginning of the systemd log.

***This particular machine has to wait around a long time for udev to settle,
(for a zpool import to start and finish). Maybe there's some race that
just usually isn't a problem otherwise?***

I sent you journalctl -b in a private email. If there's anywhere else you
can think of looking, I'm open to suggestions.

When I get a chance, I'll try to add a dependency on /tmp to
sound.target to see if that delays the creation of /tmp/pulse-* .

Antonio

[1]: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=561777

#878401#27
Date:
2017-10-13 13:27:27 UTC
From:
To:
On Fri, Oct 13, 2017 at 9:58 AM, Antonio Russo <antonio.e.russo@gmail.com> wrote:

Well, it's not usually a grave problem to have an empty dir in /tmp,
so nobody gave it much priority
no suitable runtime dir, so it creates its own runtime dir in /tmp.
Please try the following change: edit
/lib/udev/rules.d/90-alsa-restore.rules , and change the alsactl lines
to add a new flag:


/usr/sbin/alsactl -E HOME=/run/alsa -E PULSE_RUNTIME_PATH=/run/alsa/runtime restore $attr{device/number}

(and the same for the nrestore command).

#878401#32
Date:
2017-10-13 14:11:13 UTC
From:
To:
Yeah, I bumped my head on this because zfs mount will not, by
default, mount on top of a nonempty directory.

Honestly, I wouldn't have noticed otherwise.

Yep, that fixes it. Should this be reassigned to alsa-utils, then? This
probably also resolves pulseaudio bug 561777.

Antonio Russo

#878401#37
Date:
2017-10-13 15:27:32 UTC
From:
To:
The same changes should also be applied to
/lib/systemd/system/alsa-restore.service
/etc/init.d/alsa-utils

#878401#46
Date:
2019-09-22 15:40:14 UTC
From:
To:
Setting PULSE_RUNTIME_PATH did not do it for me.

I borrowed the following from Fedora, and did:

1. /etc/udev/rules.d/90-alsa-restore.rules:

ACTION=="add", SUBSYSTEM=="sound", KERNEL=="controlC*", KERNELS!="card*", GOTO="alsa_restore_go"
GOTO="alsa_restore_end"

LABEL="alsa_restore_go"
TEST!="/etc/alsa/state-daemon.conf", RUN+="/usr/sbin/alsactl -E HOME=/run/alsa -E ALSA_CONFIG_PATH=/etc/alsa/alsactl.conf --initfile=/usr/share/alsa/init/00main restore /dev/$name"
TEST=="/etc/alsa/state-daemon.conf", RUN+="/usr/sbin/alsactl -E HOME=/run/alsa -E ALSA_CONFIG_PATH=/etc/alsa/alsactl.conf --initfile=/usr/share/alsa/init/00main nrestore /dev/$name"

LABEL="alsa_restore_end"

2. /etc/systemd/system/alsa-state.service:

#
# Note that two different ALSA card state management schemes exist and they
# can be switched using a file exist check - /etc/alsa/state-daemon.conf .
#

[Unit]
Description=Manage Sound Card State (restore and store)
Documentation=man:alsactl(1)
ConditionPathExists=/etc/alsa/state-daemon.conf

[Service]
Type=simple
ExecStart=-/usr/sbin/alsactl -E HOME=/run/alsa -E ALSA_CONFIG_PATH=/etc/alsa/alsactl.conf --initfile=/usr/share/alsa/init/00main -s -n 19 -c rdaemon
ExecStop=-/usr/sbin/alsactl -E HOME=/run/alsa -s kill save_and_quit

3. /etc/systemd/system/alsa-restore.service:

#
# Note that two different ALSA card state management schemes exist and they
# can be switched using a file exist check - /etc/alsa/state-daemon.conf .
#

[Unit]
Description=Save/Restore Sound Card State
Documentation=man:alsactl(1)
ConditionPathExists=!/etc/alsa/state-daemon.conf

[Service]
Type=oneshot
RemainAfterExit=true
ExecStart=-/usr/sbin/alsactl -E HOME=/run/alsa -E ALSA_CONFIG_PATH=/etc/alsa/alsactl.conf --initfile=/usr/share/alsa/init/00main restore
ExecStop=-/usr/sbin/alsactl -E HOME=/run/alsa -E ALSA_CONFIG_PATH=/etc/alsa/alsactl.conf store
StandardOutput=syslog


... seems to work

#878401#51
Date:
2019-09-22 15:43:18 UTC
From:
To:
Oh and:

4. cat /etc/alsa/alsactl.conf:

ctl.hw {
    @args [ CARD ]
    @args.CARD {
        type string
        default "0"
    }
    type hw
    card $CARD
}

5. cat /etc/alsa/state-daemon.conf:

# Remove this file to disable the alsactl daemon mode

#878401#58
Date:
2021-09-22 04:22:54 UTC
From:
To:
Hello,

Good morning,

We have gone through your samples from a partner and Here is our  Order
List. Please do bear in mind that we are very much in  need of this
order, quote your competitive prices.

Kindly send the Order confirmation.

Your early reply will be much appreciated.

Best Regards,

Maryanah Erwin.

PT FINDORA INTERNUSA

Jln Pahlawan 66 Kec. Arjawinangun

45162 CIREBON West-Java INDONESIA

tel : +62 231 357334

fax: +62 231 357260

email: marketing@findora.com