Jack audio not working on Ubuntu 20.04 running on a Thinkpad Carbon X1 (7th gen)

Bug #1872244 reported by John Smith

This bug report was converted into a question: question #692397: Jack audio not working on Ubuntu 20.04 running on a Thinkpad Carbon X1 (7th gen).

28
This bug affects 5 people
Affects Status Importance Assigned to Milestone
jackd-defaults (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

I'm using the beta version of Ubuntu 20.04 and Jack Audio is not working. My computer is a Thinkpad X1 Carbon 7th generation and am using the internal audio interface (hw:sofhdadsp). I include more details about my configuration at the end of the message.

When running qjackctl, I get a pop up saying "D-BUS: JACK server could not be started" and the following messages in the log:

12:01:13.413 Statistics reset.
12:01:13.422 ALSA connection change.
12:01:13.424 D-BUS: Service is available (org.jackaudio.service aka jackdbus).
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
12:01:13.524 ALSA connection graph change.
12:01:26.640 D-BUS: JACK server could not be started. Sorry
Sat Apr 11 12:01:26 2020: Starting jack server...
Sat Apr 11 12:01:26 2020: JACK server starting in realtime mode with priority 10
Sat Apr 11 12:01:26 2020: self-connect-mode is "Don't restrict self connect requests"
Sat Apr 11 12:01:26 2020: ERROR: Cannot lock down 82280346 byte memory area (Cannot allocate memory)
Sat Apr 11 12:01:26 2020: Acquired audio card Audio0
Sat Apr 11 12:01:26 2020: creating alsa driver ... hw:sofhdadsp,1|hw:sofhdadsp,1|512|2|48000|0|0|nomon|swmeter|-|32bit
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
Sat Apr 11 12:01:26 2020: ERROR: ALSA: Cannot open PCM device alsa_pcm for playback. Falling back to capture-only mode
Sat Apr 11 12:01:26 2020: Released audio card Audio0
Sat Apr 11 12:01:26 2020: ERROR: Cannot initialize driver
Sat Apr 11 12:01:26 2020: ERROR: JackServer::Open failed with -1
Sat Apr 11 12:01:26 2020: ERROR: Failed to open server
Sat Apr 11 12:01:27 2020: Saving settings to "/home/felipe/.config/jack/conf.xml" ...
qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow), sequence: 1002, resource id: 19008475, major code: 40 (TranslateCoords), minor code: 0
12:01:31.990 Could not connect to JACK server as client. - Overall operation failed. - Unable to connect to server. Please check the messages window for more info.
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock

I also tried installing Ubuntu Studio, there I get the same errors with qjackctl and also "Ubuntu Studio Controls" doesn't start.

The output of "lsb_release -rd" is:
Description: Ubuntu Focal Fossa (development branch)
Release: 20.04

The output of "apt-cache policy jackd" is:
jackd:
  Installed: 5+nmu1
  Candidate: 5+nmu1
  Version table:
 *** 5+nmu1 500
        500 http://us.archive.ubuntu.com/ubuntu focal/universe amd64 Packages
        500 http://us.archive.ubuntu.com/ubuntu focal/universe i386 Packages
        100 /var/lib/dpkg/status

ProblemType: Bug
DistroRelease: Ubuntu 20.04
Package: jackd 5+nmu1
ProcVersionSignature: Ubuntu 5.4.0-21.25-lowlatency 5.4.27
Uname: Linux 5.4.0-21-lowlatency x86_64
ApportVersion: 2.20.11-0ubuntu26
Architecture: amd64
CasperMD5CheckResult: skip
CurrentDesktop: XFCE
Date: Sat Apr 11 16:28:19 2020
InstallationDate: Installed on 2020-04-06 (5 days ago)
InstallationMedia: Ubuntu 20.04 LTS "Focal Fossa" - Beta amd64 (20200402)
PackageArchitecture: all
SourcePackage: jackd-defaults
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
John Smith (johnqsmith) wrote :
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in jackd-defaults (Ubuntu):
status: New → Confirmed
Revision history for this message
John Andersen (jp7x7) wrote :

So in digging through this I got mine working. I am on a 2nd Gen X1 Carbon and have been getting the same error.

At least in my case it seems alsa is not selecting the correct audio device, preventing jackd from starting. When run manually it works:

I listed my alsa devices with this:

$aplay -l

Which returns a list of audio devices including the one I want (card 1, device 0):
---
card 1: PCH [HDA Intel PCH], device 0: ALC3232 Analog [ALC3232 Analog]
  Subdevices: 0/1
  Subdevice #0: subdevice #0
---
I then run jackd manually with this command:
$jackd -R -d alsa -d hw:1,0

And it works. From there, I was able to manually adjust any of the GUI tools like qjackctl or Ardour and they are now working.

Revision history for this message
Len Ovens (len-ovenwerks) wrote :

"internal audio interface (hw:sofhdadsp)" I am wondering where you got the "hw:sofhdadsp" from was PCH,0,0 not listed? from your output of aplay -l it would seem the device you want is hw:PCH,0,0 or just hw:PCH even.

Revision history for this message
Erich Eickmeyer (eeickmeyer) wrote :

Based on Len's response, this seems more like a support request. As such, per Launchpad policy, this does not belong on a bug tracker. Please use appropriate support forums, such as askubuntu.com, in the future.

Changed in jackd-defaults (Ubuntu):
status: Confirmed → Invalid
Revision history for this message
Ross Gammon (rosco2) wrote :

Just a tip.
The best thing to do when it is a support request rather than a bug, is to convert it to a question. See the option near the top-right. I will do it.

Changed in jackd-defaults (Ubuntu):
status: Invalid → Confirmed
Revision history for this message
Ross Gammon (rosco2) wrote :

This seems like a support request, rather than a bug. Let us know if Len's suggestion helps.

Changed in jackd-defaults (Ubuntu):
status: Confirmed → Invalid
Revision history for this message
Daniel Zrlrink (dzrlrink) wrote :

Hi all,

I think we're confusing OP, who is using the correct 7th gen audio interface, with someone who chimed in with their 2nd gen audio interface aplay results.

I've got a solution. The period that this driver uses is an EXTREMELY non-standard 1008 samples.

I discovered this by making a dummy jackd server and adding the card manually via alsa_in:

[19:36:16]daniel@daniel-ThinkPad-X1-Carbon-7th:~>
$alsa_in -d hw:CARD=sofhdadsp,DEV=0 -r 48000
WARNING: buffer size does not match: (requested 2048, got 2040)
WARNING: period size does not match: (requested 1024, got 1008)
selected sample format: 32bit
delay = 4208
delay = 1022

Anyway, the solution here is to use a period of 1008. This can be assigned in qjackctl by typing it in instead of using the dropdown, or via cli with the `--period 1008` option.

Some audio applications will need additional config. For example, supercollider requires a 2^n block size that is a factor of the sample rate. This can be achieved by executing `s.options.blockSize = 16;` before booting the server.

Other than the bizarre period, most of the defaults work quite well. Obviously this can be tuned, but at a bare minimum, jackd can be successfully started on my machine via:

[02:37:47]daniel@daniel-ThinkPad-X1-Carbon-7th:/usr/lib/firmware/intel/sof-tplg>
$jackd -d alsa --period 1008

Revision history for this message
apienk (andrzej-pienkowski) wrote :

Daniel, thanks for the workaround! It works! I can confirm that JACK not starting on SOF can be fixed by just setting the period to 1008 or 2040. I'm on Dell G5.

However, JACK with such a setup is completely unusable for me. All applications produce noise instead of proper sound, probably expecting a power of 2 frame sizes. The only setting which helps somewhat is "Force 16-bit" ("works" only for period of 1080, not for 2040) which makes the sound almost normal, but with crackling distortion.

Revision history for this message
Andrew Bailey (apps4uco) wrote :

Please can you look into this. It has been marked as Invalid, however, it is not a support request as has been assumed.

My card is a

card 1: sofhdadsp [sof-hda-dsp], device 0: HDA Analog (*) []
  Subdevices: 0/1
  Subdevice #0: subdevice #0

uname -a
Linux rtx 5.8.0-50-generic #56~20.04.1-Ubuntu SMP Mon Apr 12 21:46:35 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

All software has been updated to the latest versions.

With the default configuration

jackd -R -d alsa -d hw:1,0
...
ALSA: cannot set period size to 1024 frames for capture
ALSA: cannot configure capture channel

As reported jackd starts with a buffer size of 1008, a non standard, non power of 2

jackd -R -d alsa -d hw:1,0 -p 1008

creating alsa driver ... hw:1,0|hw:1,0|1008|2|48000|0|0|nomon|swmeter|-|32bit
configuring for 48000Hz, period = 1008 frames (21.0 ms), buffer = 2 periods
ALSA: final selected sample format for capture: 24bit little-endian
ALSA: use 2 periods for capture
ALSA: final selected sample format for playback: 24bit little-endian
ALSA: use 2 periods for playback

I consider this a bug as the manual page for jackd states

-p, --period int

Specify the number of frames between JACK process() calls. This value must be a power of 2, and the default is 1024.

And the current situation is that the only way jackd starts is with a non power of 2.

Also buffer sizes of 240, 120 works

jackd -R -d alsa -d hw:1,0 -p 240

creating alsa driver ... hw:1,0|hw:1,0|240|2|48000|0|0|nomon|swmeter|-|32bit
configuring for 48000Hz, period = 240 frames (5.0 ms), buffer = 2 periods

jackd -R -d alsa -d hw:1,0 -p 120

creating alsa driver ... hw:1,0|hw:1,0|120|2|48000|0|0|nomon|swmeter|-|32bit
configuring for 48000Hz, period = 120 frames (2.5 ms), buffer = 2 periods

FYI a buffer size of 48 also works however I get another message (maybe because I am not running with a low latency kernel ... yet)

Please see attachment for details.

Revision history for this message
Andrew Bailey (apps4uco) wrote :

Hi Im still affected by this and know of no workaround.

So as this bug report got downgraded to a question I submitted a bug, Bug #1927802 to see if we can get a fix.

Please follow the new bug report.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.