8

I'm trying to record audio from an application on a server with FFmpeg. Apparently, I need an Alsa loopback driver for this. I've read that this should work on Ubuntu 14.04:

modprobe snd-aloop

Unfortunately, that isn't available on my kernel:

modprobe: FATAL: Module snd-aloop not found.

Is this a difference between server and desktop distributions of Ubuntu?

How can I get this driver installed?

Googling leads me here: https://wiki.ubuntu.com/Audio/InstallingLinuxAlsaDriverModules

That page then says I need to go here: https://wiki.ubuntu.com/Audio/UpgradingAlsa

That page sensibly says to use DKMS: https://wiki.ubuntu.com/Audio/UpgradingAlsa/DKMS

However, the DKMS instructions only list Intel drivers: https://code.launchpad.net/~ubuntu-audio-dev/+archive/ubuntu/alsa-daily/+packages

Am I missing something?

2
  • Sound drivers are part of the kernel (package). But isn't 14.04 somewhat oldish?
    – CL.
    Mar 10, 2017 at 8:01
  • @CL. It doesn't exist in Xenial either...
    – Brad
    Mar 17, 2017 at 0:38

4 Answers 4

7
+100
  • Well, I could try loading it in Ubuntu 16.04 Desktop Edition (VirtualBox with disabled audio card). As you can see, it is installed with linux-image-extra package which may be you don't have already.

    ~$ modinfo snd-aloop
    
    filename:       /lib/modules/4.4.0-42-generic/kernel/sound/drivers/snd-aloop.ko
    license:        GPL
    description:    A loopback soundcard
    author:         Jaroslav Kysela <[email protected]>
    srcversion:     0A4CE16C028DAB4BC8260D3
    depends:        snd-pcm,snd
    intree:         Y
    vermagic:       4.4.0-42-generic SMP mod_unload modversions 
    parm:           index:Index value for loopback soundcard. (array of int)
    parm:           id:ID string for loopback soundcard. (array of charp)
    parm:           enable:Enable this loopback soundcard. (array of bool)
    parm:           pcm_substreams:PCM substreams # (1-8) for loopback driver. (array of int)
    parm:           pcm_notify:Break capture when PCM format/rate/channels changes. (array of int)
    
    ~$ dpkg -S /lib/modules/4.4.0-42-generic/kernel/sound/drivers/snd-aloop.ko
    
    linux-image-extra-4.4.0-42-generic: /lib/modules/4.4.0-42-generic/kernel/sound/drivers/snd-aloop.ko
    
    ~$ sudo modprobe snd-aloop
    ~$ alsa-info.sh --stdout
    
    upload=true&script=true&cardinfo=
    !!################################
    !!ALSA Information Script v 0.4.64
    !!################################
    
    !!Script ran on: Thu Mar 23 10:28:23 UTC 2017
    
    
    !!Linux Distribution
    !!------------------
    
    Ubuntu 16.04 LTS \n \l DISTRIB_ID=Ubuntu DISTRIB_DESCRIPTION="Ubuntu 16.04 LTS" NAME="Ubuntu" ID=ubuntu ID_LIKE=debian PRETTY_NAME="Ubuntu 16.04 LTS" HOME_URL="http://www.ubuntu.com/" SUPPORT_URL="http://help.ubuntu.com/" BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/" UBUNTU_CODENAME=xenial
    
    
    !!DMI Information
    !!---------------
    
    Manufacturer:      innotek GmbH
    Product Name:      VirtualBox
    Product Version:   1.2
    Firmware Version:  VirtualBox
    
    
    !!Kernel Information
    !!------------------
    
    Kernel release:    4.4.0-42-generic
    Operating System:  GNU/Linux
    Architecture:      x86_64
    Processor:         x86_64
    SMP Enabled:       Yes
    
    
    !!ALSA Version
    !!------------
    
    Driver version:     k4.4.0-42-generic
    Library version:    1.1.0
    Utilities version:  1.1.0
    
    
    !!Loaded ALSA modules
    !!-------------------
    
    snd_aloop
    
    
    !!Sound Servers on this system
    !!----------------------------
    
    Pulseaudio:
          Installed - Yes (/usr/bin/pulseaudio)
          Running - Yes
    
    
    !!Soundcards recognised by ALSA
    !!-----------------------------
    
     0 [Loopback       ]: Loopback - Loopback
                          Loopback 1
    
    
    !!PCI Soundcards installed in the system
    !!--------------------------------------
    
    
    
    !!Advanced information - PCI Vendor/Device/Subsystem ID's
    !!-------------------------------------------------------
    
    
    
    !!Modprobe options (Sound related)
    !!--------------------------------
    
    snd_pcsp: index=-2
    snd_usb_audio: index=-2
    snd_atiixp_modem: index=-2
    snd_intel8x0m: index=-2
    snd_via82xx_modem: index=-2
    snd_atiixp_modem: index=-2
    snd_intel8x0m: index=-2
    snd_via82xx_modem: index=-2
    snd_usb_audio: index=-2
    snd_usb_caiaq: index=-2
    snd_usb_ua101: index=-2
    snd_usb_us122l: index=-2
    snd_usb_usx2y: index=-2
    snd_cmipci: mpu_port=0x330 fm_port=0x388
    snd_pcsp: index=-2
    snd_usb_audio: index=-2
    
    
    !!Loaded sound module options
    !!---------------------------
    
    !!Module: snd_aloop
        enable : Y,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N
        id : (null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null)
        index : -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
        pcm_notify : 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
        pcm_substreams : 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8
    
    
    !!ALSA Device nodes
    !!-----------------
    
    crw-rw----+ 1 root audio 116,  2 Mar 23 11:18 /dev/snd/controlC0
    crw-rw----+ 1 root audio 116,  4 Mar 23 11:18 /dev/snd/pcmC0D0c
    crw-rw----+ 1 root audio 116,  3 Mar 23 11:18 /dev/snd/pcmC0D0p
    crw-rw----+ 1 root audio 116,  6 Mar 23 11:18 /dev/snd/pcmC0D1c
    crw-rw----+ 1 root audio 116,  5 Mar 23 11:18 /dev/snd/pcmC0D1p
    crw-rw----+ 1 root audio 116,  1 Mar 23 11:18 /dev/snd/seq
    crw-rw----+ 1 root audio 116, 33 Mar 23 11:18 /dev/snd/timer
    
    /dev/snd/by-path:
    total 0
    drwxr-xr-x 2 root root  60 Mar 23 11:18 .
    drwxr-xr-x 3 root root 200 Mar 23 11:18 ..
    lrwxrwxrwx 1 root root  12 Mar 23 11:18 platform-snd_aloop.0 -> ../controlC0
    
    
    !!Aplay/Arecord output
    !!--------------------
    
    APLAY
    
    **** List of PLAYBACK Hardware Devices ****
    card 0: Loopback [Loopback], device 0: Loopback PCM [Loopback PCM]
      Subdevices: 8/8
      Subdevice #0: subdevice #0
      Subdevice #1: subdevice #1
      Subdevice #2: subdevice #2
      Subdevice #3: subdevice #3
      Subdevice #4: subdevice #4
      Subdevice #5: subdevice #5
      Subdevice #6: subdevice #6
      Subdevice #7: subdevice #7
    card 0: Loopback [Loopback], device 1: Loopback PCM [Loopback PCM]
      Subdevices: 8/8
      Subdevice #0: subdevice #0
      Subdevice #1: subdevice #1
      Subdevice #2: subdevice #2
      Subdevice #3: subdevice #3
      Subdevice #4: subdevice #4
      Subdevice #5: subdevice #5
      Subdevice #6: subdevice #6
      Subdevice #7: subdevice #7
    
    ARECORD
    
    **** List of CAPTURE Hardware Devices ****
    card 0: Loopback [Loopback], device 0: Loopback PCM [Loopback PCM]
      Subdevices: 8/8
      Subdevice #0: subdevice #0
      Subdevice #1: subdevice #1
      Subdevice #2: subdevice #2
      Subdevice #3: subdevice #3
      Subdevice #4: subdevice #4
      Subdevice #5: subdevice #5
      Subdevice #6: subdevice #6
      Subdevice #7: subdevice #7
    card 0: Loopback [Loopback], device 1: Loopback PCM [Loopback PCM]
      Subdevices: 8/8
      Subdevice #0: subdevice #0
      Subdevice #1: subdevice #1
      Subdevice #2: subdevice #2
      Subdevice #3: subdevice #3
      Subdevice #4: subdevice #4
      Subdevice #5: subdevice #5
      Subdevice #6: subdevice #6
      Subdevice #7: subdevice #7
    
    !!Amixer output
    !!-------------
    
    !!-------Mixer controls for card 0 [Loopback]
    
    Card hw:0 'Loopback'/'Loopback 1'
      Mixer name    : 'Loopback Mixer'
      Components    : ''
      Controls      : 97
      Simple ctrls  : 1
    Simple mixer control 'PCM',0
      Capabilities: pvolume
      Playback channels: Front Left - Front Right
      Limits: Playback 0 - 255
      Mono:
      Front Left: Playback 255 [100%] [0.00dB]
      Front Right: Playback 255 [100%] [0.00dB]
    ...
    
  • For general solution, look at:

    How do I find the package that provides a file?

  • Just checked a fresh Ubuntu 16.04.1 Server. It has the snd-aloop module. linux-image-extra* package was installed as dependency of linux-image-generic meta package which is also a dependency of linux-generic meta package. So a quick fix:

    sudo apt install linux-generic
    
2
  • Thank you for your help! I was using sudo apt-get install linux-image-extra-$(uname -r). If I use linux-generic instead, I imagine that I will get linux-image-extra for the new kernel when kernel updates are automatically applied?
    – Brad
    Mar 23, 2017 at 21:30
  • @Brad, yeah, that's correct. linux-generic will updated also headers.
    – user.dz
    Mar 23, 2017 at 21:45
3

SK Venkat's answer worked for me. Only thing was the ls command had to be run on folder: /lib/modules/$(uname -r)/kernel/sound/drivers

He missed out the s at the end of drivers. Not enough rep to comment so adding an answer here.

The ls did not show the snd-aloop for me. As he suggested, below commands did the trick.

sudo apt install linux-modules-extra-$(uname -r)
sudo reboot
2

If the ls /lib/modules/$(uname -r)/kernel/sound/drivers doesn't list the snd-aloop.ko then try the following command to installed the additional modules :

$ sudo apt install linux-modules-extra-$(uname -r)
$ sudo reboot

Since the cloud provider's Linux distro doesn't have some modules by default and it's required to add it to our system depends on our need.

After rebooting, try the same ls command mentioned in the top and you'll see the snd-aloop.ko file.

0

Are you able to run this

alsactl restore -P

If not able, can you try to install

Ubuntu server: install Alsa sound and MOC (Music On Console)

If not able to install from APT, you can try to compile it from source, according here

Compile

If no others is working, I suggest reading this:

Jack and Loopback device as Alsa-to-Jack bridge

1
  • No, alsactl doesn't do anything. I have no sound cards, so there's nothing for it to do. I need the loopback driver so I can record. Is there no way to get the loopback driver installed without compiling it? It seems like something that would be commonly needed. I'm trying to avoid any lengthy steps as part of a development machine setup script in Vagrant.
    – Brad
    Mar 21, 2017 at 23:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .