canonical / checkbox

Checkbox is a testing framework used to validate device compatibility with Ubuntu Linux. It’s the testing tool developed for the purposes of the Ubuntu Certification program.
https://checkbox.readthedocs.io
GNU General Public License v3.0
30 stars 47 forks source link

[snap] alsa-playback and alsa-loopback are malfunction on 22.04 ubuntu Server and Core image #273

Open baconYao opened 1 year ago

baconYao commented 1 year ago

Bug Description

Some of the audio cases such as audio/alsa-playback, audio/alsa-loopback are broken on Jammy.

Impact image: Ubuntu Server 22.04 and Ubuntu Core22

Result

Ubuntu Server 22.04

The following result is from the output of audio/alsa-playback case

ALSA lib conf.c:4553:(snd_config_update_r) Cannot access file /snap/checkbox/2020/usr/share/alsa/alsa.conf
ALSA lib conf.c:4553:(snd_config_update_r) Cannot access file /snap/checkbox/2020/usr/share/alsa/pcm/default.conf
ALSA lib conf.c:4110:(config_file_load) cannot stat file/directory /usr/share/alsa/cards/aliases.conf
ALSA lib conf.c:4553:(snd_config_update_r) Cannot access file /snap/checkbox/2020/usr/share/alsa/alsa.conf
ALSA lib conf.c:4553:(snd_config_update_r) Cannot access file /snap/checkbox/2020/usr/share/alsa/pcm/default.conf
ALSA lib control.c:1528:(snd_ctl_open_noupdate) Invalid CTL cards.ctl.default
Failed to change volume: Failed to attach HCTL to a Mixer
ALSA lib conf.c:4553:(snd_config_update_r) Cannot access file /snap/checkbox/2020/usr/share/alsa/alsa.conf
ALSA lib conf.c:4553:(snd_config_update_r) Cannot access file /snap/checkbox/2020/usr/share/alsa/pcm/default.conf
Verification:

The output of $ALSA_CONFIG_PATH is /snap/checkbox/2020/usr/share/alsa/alsa.conf:/snap/checkbox/2020/usr/share/alsa/pcm/default.conf:/snap/checkbox22/current/usr/share/alsa/alsa.conf:/snap/checkbox22/current/usr/share/alsa/pcm/default.conf

Ubuntu Core22

The following result is from the output of audio/alsa-playback case

ALSA lib conf.c:4110:(config_file_load) cannot stat file/directory /usr/share/alsa/cards/aliases.conf
ALSA lib control.c:1528:(snd_ctl_open_noupdate) Invalid CTL cards.ctl.default
Failed to change volume: Failed to attach HCTL to a Mixer

The output of $ALSA_CONFIG_PATH is /snap/checkbox/2034/checkbox-runtime/usr/share/alsa/alsa.conf:/snap/checkbox/2034/checkbox-runtime/usr/share/alsa/pcm/default.conf:/snap/checkbox/2034/checkbox-runtime/usr/share/alsa/alsa.conf:/snap/checkbox/2034/checkbox-runtime/usr/share/alsa/pcm/default.conf

To Reproduce

Ubuntu Server 22.04

  1. Install OS
  2. Install snap checkbox,
    sudo snap install checkbox22
    sudo snap install checkbox --edge --classic
  3. Checkbox remote run the audio/alsa-playback in com.canonical.certification::client-cert-iot-server-22-04-manual test plan

Ubuntu Core22

  1. Install OS
  2. Install snap checkbox
    sudo snap install checkbox22
    sudo snap install checkbox --channel=uc22/edge --devmode
  3. Checkbox remote run the audio/alsa-playback in com.canonical.certification::client-cert-iot-ubuntucore-22-manual test plan

Environment

Relevant log output

- Checkbox session(s) (located in `/var/tmp/checkbox-ng/sessions/`, you usually want to select the most recent one)

- logs from the impacted components (e.g. `lsblk` if this is related to an issue when testing a disk...); a safe option is to install and run `sosreport` to gather as much log as possible.

Additional context

Ubuntu Server 22.04

sosreport: sosreport-u-2022-12-15-hblcemw.zip

UC 22

sosreport: sosreport-ubuntu-2022-12-15-cynpkni.tar.gz

baconYao commented 1 year ago

One interesting thing is that if I install the alsa-utils or alsa-ucm-conf deb package on Ubuntu Server manually (not in checkbox shell), then the case can be executed and the I can hear the sound via headset without any problem. But I still got the output like below

ALSA lib conf.c:4553:(snd_config_update_r) Cannot access file /snap/checkbox/2020/usr/share/alsa/alsa.conf
ALSA lib conf.c:4553:(snd_config_update_r) Cannot access file /snap/checkbox/2020/usr/share/alsa/pcm/default.conf
ALSA lib conf.c:4553:(snd_config_update_r) Cannot access file /snap/checkbox/2020/usr/share/alsa/alsa.conf
ALSA lib conf.c:4553:(snd_config_update_r) Cannot access file /snap/checkbox/2020/usr/share/alsa/pcm/default.conf
ALSA lib conf.c:4553:(snd_config_update_r) Cannot access file /snap/checkbox/2020/usr/share/alsa/alsa.conf
ALSA lib conf.c:4553:(snd_config_update_r) Cannot access file /snap/checkbox/2020/usr/share/alsa/pcm/default.conf
ALSA lib conf.c:4553:(snd_config_update_r) Cannot access file /snap/checkbox/2020/usr/share/alsa/alsa.conf
ALSA lib conf.c:4553:(snd_config_update_r) Cannot access file /snap/checkbox/2020/usr/share/alsa/pcm/default.conf
ALSA lib conf.c:4553:(snd_config_update_r) Cannot access file /snap/checkbox/2020/usr/share/alsa/alsa.conf
ALSA lib conf.c:4553:(snd_config_update_r) Cannot access file /snap/checkbox/2020/usr/share/alsa/pcm/default.conf
ALSA lib conf.c:4553:(snd_config_update_r) Cannot access file /snap/checkbox/2020/usr/share/alsa/alsa.conf
ALSA lib conf.c:4553:(snd_config_update_r) Cannot access file /snap/checkbox/2020/usr/share/alsa/pcm/default.conf
ALSA lib conf.c:4553:(snd_config_update_r) Cannot access file /snap/checkbox/2020/usr/share/alsa/alsa.conf
ALSA lib conf.c:4553:(snd_config_update_r) Cannot access file /snap/checkbox/2020/usr/share/alsa/pcm/default.conf
ALSA lib conf.c:4553:(snd_config_update_r) Cannot access file /snap/checkbox/2020/usr/share/alsa/alsa.conf
ALSA lib conf.c:4553:(snd_config_update_r) Cannot access file /snap/checkbox/2020/usr/share/alsa/pcm/default.conf
ALSA lib conf.c:4553:(snd_config_update_r) Cannot access file /snap/checkbox/2020/usr/share/alsa/alsa.conf
ALSA lib conf.c:4553:(snd_config_update_r) Cannot access file /snap/checkbox/2020/usr/share/alsa/pcm/default.conf

Because I found the /usr/share/alsa path will appear after installing those alsa related deb package.

Another important thing is the path,/usr/share/alsa , exists in Ubuntu Server 20.04 and UC20 by default since the deb package alsa-ucm-conf is default package. So the case audio/alsa-playback can be executed on Server 20.04 and UC20 normally.

stanley31huang commented 1 year ago

For Ubuntu Server 22.04

the alsa-playback and alsa-loopback tests passed when if we install alsa-utils debian package.

For Ubuntu Core 22

We have integrated the alsa-utils in checkbox-ce-oem snap and added a workaround to bind the alsa config in checkbox snap to system. And the both alsa-playback and alsa-loopback could passed. https://git.launchpad.net/~oem-qa/+git/checkbox-ce-oem/tree/snap/snapcraft.yaml#n130

stanley31huang commented 1 year ago

@pieqq do you think the workaround is doable? Or we would like to have a better solution for this issue?