https://wiki.archlinux.org/api.php?action=feedcontributions&user=Stelterd&feedformat=atomArchWiki - User contributions [en]2024-03-28T15:18:23ZUser contributionsMediaWiki 1.41.0https://wiki.archlinux.org/index.php?title=JACK_Audio_Connection_Kit&diff=151125JACK Audio Connection Kit2011-08-09T19:39:04Z<p>Stelterd: /* Playing nice with ALSA */</p>
<hr />
<div>{{stub}}<br />
<br />
If you know anything about JACK, please expand this article. I've uninstalled it, so I can't really expand it any further.<br />
<br />
=Install=<br />
==Multiprocessor implementation (soon: JACK2)==<br />
JACK2 is currently available in the [community] and can be installed from there<br />
pacman -S jack2<br />
<br />
<br />
You can compile Jack2 with the new dbus-based control system or the 'classic' interface. Which one you have depends on whether you compiled Jack2 with the --dbus configure option or not.<br />
<br />
Jack2 without --dbus executes similarly to Jack1. With --dbus, control is done using the jack_control utility. Run `jack_control` to see what it does. The important commands are listed below:<br />
jack_control start - starts the jack server<br />
jack_control stop - stops the jack server<br />
jack_control ds alsa - selects alsa as the driver (backend)<br />
jack_control eps realtime True - set engine parameters, such as realtime<br />
jack_control dps period 256 - set the driver parameter period to 256<br />
<br />
You may also need to play with the driver parameters nperiods and rate.<br />
<br />
==JACK==<br />
Alternatively, there is the normal version from the extra repository, install it with:<br />
pacman -S jack<br />
<br />
You probably also want a GUI connection tool:<br />
pacman -S qjackctl<br />
<br />
=== Jack for a multi-user system ===<br />
So, you have a descent multiuser system as it was designed more than 20 years ago, and now some developers decided that sound is only for a mono-user system... No I can not believe it !<br />
<br />
{{Warning|Before following the below instructions, please note that there is a security risk to any service running as root, and, more importantly, the developers for jack do not test it for running as root. In other words, it could eat your babies, data, or both}}<br />
<br />
Fortunately some time ago someone convinced the developers to allow jack to run as a system wide daemon. Here is the procedure to follow:<br />
<br />
'''Create a <tt>/etc/profile.d/jack.sh</tt> file''' containing:<br />
export JACK_PROMISCUOUS_SERVER=""<br />
<br />
'''Replace <tt>/etc/rc.d/jack-audio-connection-kit</tt>''' with the following content<br />
<pre><br />
#!/bin/bash <br />
<br />
. /etc/rc.conf<br />
. /etc/rc.d/functions<br />
<br />
# source application-specific settings<br />
[ -f /etc/conf.d/jack-audio-connection-kit ] && . /etc/conf.d/jack-audio-connection-kit<br />
<br />
PID=`pidof -o %PPID /usr/bin/jackd`<br />
<br />
[ -n "$JACKUSER" ] && HOME="/home/$JACKUSER"<br />
[ -z "$JACK_PARAMS" ] && JACK_PARAMS=$(sed 's:/usr/bin/jackd ::' $HOME/.jackdrc)<br />
<br />
case "$1" in<br />
start)<br />
stat_busy "Starting JACK"<br />
if [ -z "$PID" ]; then<br />
if [ -n "$JACKUSER" ]; then<br />
su - $JACKUSER -c 'export JACK_PROMISCUOUS_SERVER="" && . /etc/conf.d/jack-audio-connection-kit && umask 0000 && /usr/bin/jackd $JACK_PARAMS &> /dev/null &'<br />
else<br />
export JACK_PROMISCUOUS_SERVER=""<br />
umask 0000<br />
/usr/bin/jackd $JACK_PARAMS &> /dev/null &<br />
fi<br />
fi<br />
<br />
if [ ! -z "$PID" -o $? -gt 0 ]; then<br />
stat_fail<br />
else<br />
add_daemon jack<br />
stat_done<br />
fi<br />
;;<br />
stop)<br />
stat_busy "Stopping JACK"<br />
[ ! -z "$PID" ] && kill $PID &> /dev/null<br />
if [ $? -gt 0 ]; then<br />
stat_fail<br />
else<br />
rm_daemon jack<br />
stat_done<br />
fi<br />
;;<br />
restart)<br />
$0 stop<br />
sleep 1<br />
$0 start<br />
;;<br />
*)<br />
echo "usage: $0 {sta|stop|restart}"<br />
esac<br />
exit 0<br />
</pre><br />
<br />
Where my '''<tt>/etc/conf.d/jack-audio-connection-kit</tt>''' is<br />
<pre><br />
# Configuration for starting JACK at boot<br />
<br />
# Uncomment this to run as user (recommended)<br />
#JACKUSER="root"<br />
<br />
# Uncomment this to not source ~/.jackdrc<br />
JACK_PARAMS="-R -P89 -dalsa -dhw:1 -r48000 -p512 -n3"<br />
</pre><br />
<br />
==Playing nice with ALSA==<br />
To allow Alsa programs to play while jack is running you must install the jack plugin for alsa:<br />
<pre>pacman -S alsa-plugins</pre><br />
<br />
And enable it by editing (or creating) /etc/asound.conf (system wide settings) to have these lines:<br />
<pre><br />
# convert alsa API over jack API<br />
# use it with<br />
# % aplay foo.wav<br />
<br />
# use this as default<br />
pcm.!default {<br />
type plug<br />
slave { pcm "jack" }<br />
}<br />
<br />
ctl.mixer0 {<br />
type hw<br />
card 1<br />
}<br />
<br />
# pcm type jack<br />
pcm.jack {<br />
type jack<br />
playback_ports {<br />
0 system:playback_1<br />
1 system:playback_2<br />
}<br />
capture_ports {<br />
0 system:capture_1<br />
1 system:capture_2<br />
}<br />
}</pre><br />
<br />
You needn't restart your computer or anything. Just edit the alsa config files, start up jack, and there you go...<br />
<br />
Remember to start it as a '''user'''. If you start it with "jackd -d alsa" as user X, it won't work for user Y.<br />
<br />
== gstreamer ==<br />
Example: watching a live stream without gconf<br />
gst-launch-0.10 playbin2 uri=http://streamer.stackingdwarves.net/bewerungeroom.ogv audio-sink="jackaudiosink"<br />
<br />
Setting gstreamer to use jack using gconftool-2<br />
gconftool-2 --type string --set /system/gstreamer/0.10/audio/default/audiosink "jackaudiosink buffer-time=2000000"<br />
gconftool-2 --type string --set /system/gstreamer/0.10/audio/default/musicaudiosink "jackaudiosink buffer-time=2000000"<br />
gconftool-2 --type string --set /system/gstreamer/0.10/audio/default/chataudiosink "jackaudiosink buffer-time=2000000"<br />
<br />
Further information: http://jackaudio.org/gstreamer_via_jack<br />
<br />
== PulseAudio ==<br />
:''See: [[PulseAudio#PulseAudio_through_JACK_the_new_way]]''<br />
<br />
=Troubleshooting=<br />
=="Cannot lock down memory area (Cannot allocate memory)" message on startup==<br />
:''See: [[Realtime_for_Users#Add_user_to_audio_group]]''<br />
<br />
=Related Articles=<br />
*[[Pro Audio]]</div>Stelterdhttps://wiki.archlinux.org/index.php?title=Xen&diff=112214Xen2010-07-18T18:01:18Z<p>Stelterd: /* Notes */</p>
<hr />
<div>[[Category:Emulators (English)]]<br />
[[Category:HOWTOs (English)]]<br />
This document explains how to setup Xen within Arch Linux.<br />
<br />
==What is Xen?==<br />
According to the Xen development team: "The Xen hypervisor, the powerful open source industry standard for virtualization, offers a powerful, efficient, and secure feature set for virtualization of x86, x86_64, IA64, PowerPC, and other CPU architectures. It supports a wide range of guest operating systems including Windows®, Linux®, Solaris®, and various versions of the BSD operating systems."<br />
<br />
The Xen hypervisor is a thin layer of software which emulates a computer architecture. It is started by the boot loader and allows several operating systems to run simultaneously on top of it. Once the Xen hypervisor is loaded, it starts the "dom0" (for "domain 0"), or privileged domain, which in our case runs a modified Linux kernel (other possible dom0 operating systems are NetBSD and OpenSolaris). The [http://aur.archlinux.org/packages.php?ID=29023 dom0 kernel in the AUR] is currently based on a recent version of Linux kernel 2.6 and there is [http://aur.archlinux.org/packages.php?ID=38175 a more unstable -dev version] as well; hardware must, of course, be supported by this kernel to run Xen. Once the dom0 has started, one or more "domU" (unprivileged) domains can be started and controlled from dom0.<br />
<br />
==Setting up Xen==<br />
<br />
===Installing the necessary packages===<br />
Before building xen4, you need to build the required package lib32-glibc-devel from the AUR first. <br />
<pre>yaourt -S lib32-glibc-devel</pre><br />
<br />
After installing it, create a temporary symlink:<br />
<pre>ln -s /opt/lib32/usr/include/gnu/stubs-32.h /usr/include/gnu</pre><br />
<br />
The next step is to install xen from the AUR. You can either install xen version 3 or 4 by choosing either the xen or xen4 package. This wiki focuses on xen4, to prevent confusion :)<br />
<pre><br />
yaourt -S libxenctrl ## this is currently missing from the dependencies of xen4 (23.5.2010)<br />
yaourt -S xen4<br />
</pre><br />
<br />
If you need only the xen-tools, version 4 can be installed by using the xen-hv-tools package.<br />
<br />
The next step is to build and install the dom0 kernel. To do so, build the kernel26-xen-dom0 package from the AUR.<br />
<br />
<pre>yaourt -S kernel26-xen-dom0</pre><br />
<br />
'''Please note: currently the kernel configuration is not yet adapted to 2.6.32 so you have to run through the new parameters of 2.6.32 and agree to use the defaults (or whatever else you may want) - so just press enter each time you are asked. There may also be issues with installing as this overwrites the linux-firmware in /usr/lib/firmware.'''<br />
<br />
..and there you go: the building part has been finished. Now you can configure Grub and boot into the kernel that's just been built.<br />
<br />
===Configuring GRUB===<br />
Grub must be configured so that the Xen hypervisor is booted followed by the dom0 kernel. Add the following entry to /boot/grub/menu.lst:<br />
<br />
<pre><br />
title Xen with Arch Linux<br />
root (hd0,X)<br />
kernel /xen.gz dom0_mem=524288<br />
module /vmlinuz26-xen-dom0 root=/dev/sdaY ro console=tty0 vga=gfx-1024x768x8<br />
module /kernel26-xen-dom0.img<br />
</pre><br />
<br />
where X and Y are the appropriate numbers for your disk configuration; and dom0_mem, console, and vga are optional, customizable parameters. Nice little detail: you can use LVM volumes too. So instead of /dev/sdaY you can also fill in /dev/mapper/somelvm. Also, notice that the vga-parameter works a bit differently from usual kernel configuration lines. It has been discussed on the Xen-devel list: [http://lists.xensource.com/archives/html/xen-devel/2008-05/msg00576.html]<br />
<br />
The standard arch kernel can be use to boot the domUs. In order for this to work one must add 'xen-blkfront' to the modules array in /etc/mkinitcpio.conf:<br />
<br />
<pre><br />
MODULES="... xen-blkfront ..."<br />
</pre><br />
<br />
So, next step is to reboot into the xen kernel. <br />
<br />
Next step: start xend:<br />
<br />
<pre><br />
# /etc/rc.d/xend start<br />
</pre><br />
<br />
Allocating a fixed amount of memory is recommended when using xen. Also, if you're running IO intensive guests it might be a good idea to dedicate (pin) a CPU core only for dom0 use. Please see the external [http://wiki.xensource.com/xenwiki/XenCommonProblems XenCommonProblems] wiki page section "Can I dedicate a cpu core (or cores) only for dom0?" for more information. <br />
<br />
===Configuring GRUB2===<br />
<br />
This works just like with Grub, but here you need to use the command 'multiboot' instead of using 'kernel'. So it becomes:<br />
<pre><br />
# (2) Arch Linux(XEN)<br />
menuentry "Arch Linux(XEN)" {<br />
set root=(hd0,X)<br />
multiboot /boot/xen.gz dom0_mem=2048M<br />
module /boot/vmlinuz26-xen-dom0 root=/dev/sdaY ro<br />
module /boot/kernel26-xen-dom0.gz<br />
</pre><br />
<br />
If you had success when booting up into the dom0 kernel, we can continue.<br />
<br />
===Add domU instances===<br />
<br />
The basic idea behind adding a domU is as follows. We must get the domU kernels, allocate space for the virtual hard disk, create a configuration file for the domU, and finally start the domU with xm.<br />
<br />
<pre><br />
$ mkfs.ext4 /dev/sdb1 ## format partition<br />
$ mkdir /tmp/install<br />
$ mount /dev/sdb1 /tmp/install<br />
$ mkdir -p /tmp/install/dev /tmp/install/proc /tmp/install/sys /tmp/install/var/lib/pacman /tmp/install/var/cache/pacman/pkg /tmp/install/var/lib/pacman<br />
$ mount -o bind /dev /tmp/install/dev<br />
$ mount -t proc none /tmp/install/proc<br />
$ mount -o bind /sys /tmp/install/sys<br />
$ pacman -Sy -r /tmp/install --cachedir /tmp/install/var/cache/pacman/pkg -b /tmp/install/var/lib/pacman base<br />
$ cp -r /etc/pacman* /tmp/install/etc<br />
$ chroot /tmp/install /bin/bash<br />
$ vi /etc/resolv.conf<br />
$ vi /etc/fstab<br />
/dev/xvda / ext4 defaults 0 1<br />
<br />
$ vi /etc/inittab<br />
c1:2345:respawn:/sbin/agetty -8 38400 hvc0 linux<br />
#c1:2345:respawn:/sbin/agetty -8 38400 tty1 linux<br />
#c2:2345:respawn:/sbin/agetty -8 38400 tty2 linux<br />
#c3:2345:respawn:/sbin/agetty -8 38400 tty3 linux<br />
#c4:2345:respawn:/sbin/agetty -8 38400 tty4 linux<br />
#c5:2345:respawn:/sbin/agetty -8 38400 tty5 linux<br />
#c6:2345:respawn:/sbin/agetty -8 38400 tty6 linux<br />
<br />
<br />
$ exit ## exit chroot<br />
$ umount /tmp/install/dev<br />
$ umount /tmp/install/proc<br />
$ umount /tmp/install/sys<br />
$ umount /tmp/install<br />
</pre><br />
If not starting from a fresh install and one wants to rsync from an existing system:<br />
<pre><br />
$ mkfs.ext4 /dev/sdb1 ## format lv partition<br />
$ mkdir /tmp/install<br />
$ mount /dev/sdb1 /tmp/install<br />
$ mkdir /tmp/install/{proc,sys}<br />
$ chmod 555 /tmp/install/proc<br />
$ rsync -avzH --delete --exclude=proc/ --exclude=sys/ old_ooga:/ /tmp/install/<br />
<br />
$ vi /etc/xen/dom01 ## create config file<br />
# -*- mode: python; -*-<br />
kernel = "/boot/vmlinuz26"<br />
ramdisk = "/boot/kernel26.img"<br />
memory = 1024<br />
name = "dom01"<br />
vif = [ 'mac=00:16:3e:00:01:01' ]<br />
disk = [ 'phy:/dev/sdb1,xvda,w' ]<br />
dhcp="dhcp"<br />
hostname = "ooga"<br />
root = "/dev/xvda ro"<br />
<br />
$ xm create -c dom01<br />
</pre><br />
<br />
== Alternative method ==<br />
<br />
To set up Xen by hand, see [[Xen_Install]]. This page is marked for deletion because it's very old, so be careful. It details installing a custom xen kernel and the xen userland tools by hand, rather than by taking advantage of packages in the AUR, as described above. Perhaps someone can write an up to date howto in this page instead, so that we can delete the other article.<br />
<br />
==Arch as Xen guest (PV mode)==<br />
<br />
To get paravirtualization you need to install:<br />
* [http://aur.archlinux.org/packages.php?ID=16087 kernel26-xen]<br />
* (optional) [http://aur.archlinux.org/packages.php?ID=28591 xe-guest-utilities]<br />
<br />
Change mode to PV with commands (on dom0):<br />
xe vm-param-set uuid=<vm uuid> HVM-boot-policy=""<br />
xe vm-param-set uuid=<vm uuid> PV-bootloader=pygrub<br />
<br />
Edit /boot/grub/menu.lst and add kernel26-xen:<br />
# (1) Arch Linux (domU)<br />
title Arch Linux (domU)<br />
root (hd0,0)<br />
kernel /boot/vmlinuz26-xen root=/dev/xvda1 ro console=hvc0<br />
initrd /boot/kernel26-xen.img<br />
<br />
=== xe-guest-utilities ===<br />
To use xe-guest-utilities, add xenfs mount point into /etc/fstab:<br />
xenfs /proc/xen xenfs defaults 0 0<br />
and add xe-linux-distribution into /etc/rc.conf:DAEMONS array.<br />
<br />
===Notes===<br />
* pygrub does not show boot menu.<br />
* To avoid hwclock error messages, set HARDWARECLOCK="xen" in /etc/rc.conf (actually you can use any value here except "UTC" and "localtime")<br />
* If you want to return to hardware VM, set HVM-boot-policy="BIOS order"<br />
* If you get a kernel panic when booting Xen and it suggests 'use apic="debug" and send an error report', try setting noapic on the kernel line in menu.lst<br />
<br />
==Xen management tools==<br />
You can use following tools:<br />
virt-manager<br />
<br />
==Packages==<br />
As there are quite some packages available in AUR and you can have a pretty hard time figuring out what is needed here a small collection of most of the (intersting) xen packages (last updated: 23.5.2010)<br />
<br />
===Hypervisor (dom0)===<br />
* Kernel: [http://aur.archlinux.org/packages.php?ID=29023 kernel26-xen-dom0]<br />
* Userspace tools of Xen4: [xen4]<br />
Needed to compile xen4: [http://aur.archlinux.org/packages.php?ID=36346 libxenctrl]<br />
* Userspace tools of Xen4 (conflicting with xen4): [http://aur.archlinux.org/packages.php?ID=28984 xen-hv-tools]<br />
* Userspace tools of Xen3: [http://aur.archlinux.org/packages.php?ID=14640 xen]<br />
* Some (debian) scripts for disk creation, etc: [http://aur.archlinux.org/packages.php?ID=37421 xen-tools]<br />
<br />
===Guest (domU)===<br />
* Kernel: [http://aur.archlinux.org/packages.php?ID=16087 kernel26-xen]<br />
* Guest utils: [http://aur.archlinux.org/packages.php?ID=28591 xe-guest-utils]<br />
<br />
===Monitoring===<br />
?? (something similar like xsconsole for xenserver available?)<br />
<br />
===Unknown===<br />
* [http://aur.archlinux.org/packages.php?ID=36373 libxen4]<br />
* [http://aur.archlinux.org/packages.php?ID=36457 libxenserver]<br />
<br />
===Unrelated packages===<br />
(e.g. for XenServer/Xen Cloud Platform)<br />
* XenServer frontend: [http://aur.archlinux.org/packages.php?ID=34398 openxencenter]<br />
* XenServer frontend svn version: [http://aur.archlinux.org/packages.php?ID=36074 openxencenter-svn]<br />
* Xen Cloud Platform frontend: [http://aur.archlinux.org/packages.php?ID=36458 xvp]<br />
<br />
==Resources==<br />
<br />
* Xen's homepage: [http://www.xen.org/]<br />
* The Xen Wiki: [http://wiki.xensource.com/xenwiki/]<br />
* Xen kernel patches: [http://code.google.com/p/gentoo-xen-kernel/]</div>Stelterd