1

I've been trying to enable sound for the linux-virtual kernel as I want to run an ultra slim Ubuntu server under VirtualBox but need audio. The resource usage difference between virtual and generic/server is surprisingly large, with the virtual kernel system using 80Mb less RAM after a clean boot (130Mb vs 210Mb), and I really want to squeeze every clock cycle and available byte I can out of the system. Besides, the virtual kernel has some additional optimisations enabled specifically for virtual machines (or so I am told).

Now I have compiled my own kernel a few times in the past, for example to include the Intel-PHC module (for improved power management on Thinkpads), so the concept is not entirely alien to me, but I've run into a strange problem which I'm hoping someone can help explain: When I do a diff between the config files for Linux-generic and Linux-virtual there are precious few differences, and certainly none which pertain to sound support; there are really only five or six lines which differ, and they're mainly to do with i/o timing, sleep state and priorities. What gives? I expected the differences to be extensive, and that I would be able to identify the options that enabled audio by looking at them, but my problem doesn't seem to be related to the config file at all (yes, I know about the sound drivers section - it is identical between the two kernel configs). Am I looking in the wrong place?

Many thanks!

2
  • Actually, looking again at my minimal install with the virtual kernel again, top now reports memory usage as a mere 67Mb after a clean boot. That ups the difference from generic to a whopping 140Mb! Aug 28, 2012 at 0:26
  • Following izx's advice below worked perfectly, but I couldn't get VirtualBox's "Intel HD Audio" card to work - I had to switch to the "ICH AC97" card. Ubuntu would recognise the Intel HD card ok but I couldn't get any sound and some apps even crashed when trying to play audio. After switching card it all works beautifully. Sep 1, 2012 at 16:41

1 Answer 1

3

The -virtual kernel does not auto-load the snd module, that's the only difference (it contains snd and all its various sub-modules).

Simply run sudo modprobe snd to enable sound. To make this permanent, just add snd to the list in /etc/modules and run sudo update-initramfs -u.

If any modules appear to be missing, please install the linux-image-extra-virtual (Linux kernel extra modules for virtual machines) package.

Note: in my experience, the other things a -virtual kernel may suffer from and which may need manual loading include no support for Unity 3D/OpenGL emulation, no bluetooth and no enhanced USB HID support.

5
  • Many thanks, I've been able to modprobe snd and it's now enabled at boot. I've also added myself to the "sound" and "video" user groups, but I still can't get aplay -l to list any cards. It seems the snd-hda-intel module is missing; sudo modprobe snd-hda-intel yields FATAL: Module snd_hda_intel not found. Aug 28, 2012 at 1:30
  • Ola, please see edit. You need to install the linux-image-extra-virtual package.
    – ish
    Aug 28, 2012 at 2:16
  • izx - Yep, many thanks, I have not seen that package mentioned anywhere despite many hours researching - sounds like just the ticket! Just one final question before I install it: will this not mean I basically end up with the full set of kernel modules (similar to the generic kernel)? Or will it let me load just the audio module I need, while leaving the rest out? Aug 29, 2012 at 10:54
  • The full set of kernel module files will be installed, but they will not be preloaded like the generic kernel; you can pick and choose which ones to load in /etc/modules.
    – ish
    Aug 30, 2012 at 7:53
  • Awesome, just what I wanted. 1000 thanks for the great answer - and you patience! Aug 30, 2012 at 19:22

You must log in to answer this question.

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