https://wiki.archlinux.org/api.php?action=feedcontributions&user=Blo&feedformat=atomArchWiki - User contributions [en]2024-03-28T19:43:29ZUser contributionsMediaWiki 1.41.0https://wiki.archlinux.org/index.php?title=Pacman&diff=83478Pacman2009-11-13T16:37:28Z<p>Blo: </p>
<hr />
<div>[[Category:Package management (English)]]<br />
[[Category:Utilities (English)]]<br />
[[Category:HOWTOs (English)]]<br />
{{i18n_links_start}}<br />
{{i18n_entry|Česky|:Pacman (Česky)}}<br />
{{i18n_entry|Dansk|:Pacman_(Dansk)}}<br />
{{i18n_entry|Deutsch|:Pacman (Deutsch)}}<br />
{{i18n_entry|English|:Pacman}}<br />
{{i18n_entry|Español|:Pacman (Español)}}<br />
{{i18n_entry|Français|:Pacman (Français)}}<br />
{{i18n_entry|Italiano|:Pacman (Italiano)}}<br />
{{i18n_entry|Nederlands|:Pacman (Nederlands)}}<br />
{{i18n_entry|Polski|:Pacman (Polski)}}<br />
{{i18n_entry|Português de Portugal|:Pacman (Portugues)}}<br />
{{i18n_entry|Romanian|:Pacman (română)}}<br />
{{i18n_entry|Русский|:Pacman (Русский)}}<br />
{{i18n_entry|简体中文|:Pacman (简体中文)}}<br />
{{i18n_entry|한국어|:Pacman (한국어)}}<br />
{{i18n_entry|Türkçe|:Pacman (Türkçe)}}<br />
{{i18n_entry|Ελληνικά|:Pacman_(Ελληνικά)}}<br />
{{i18n_entry|日本語|:Pacman_(日本語)}}<br />
{{i18n_links_end}}<br />
<br />
The '''[http://archlinux.org/pacman/ Pacman]''' package manager is one of the main features of Arch Linux. It combines a simple binary package format with an easy-to-use build system (see [[makepkg]] and [[ABS]]). The goal of Pacman is to make it possible to easily manage packages, whether they are from the official Arch repositories or the user's own builds.<br />
<br />
Pacman keeps the system up to date by synchronizing package lists with the master server. This server/client model also allows you to download/install packages with a simple command, complete with all required dependencies.<br />
<br />
Pacman is written in the C programming language. It uses the .tar.gz package format, in an effort to further enhance its speed; Gzipped tarballs, though slightly larger, are decompressed much faster than their Bzipped counterparts, and are therefore generally installed more expediently.<br />
<br />
==Configuration==<br />
Pacman configuration is located in {{Filename|/etc/pacman.conf}}. This is the place where the user configures the program to work in the desired manner. In depth information about the configuration file can be found in [http://www.archlinux.org/pacman/pacman.conf.5.html man pacman.conf].<br />
<br />
===General options===<br />
General options are in the {{Codeline|[options]}} section. Read the man page or look in the default {{Filename|pacman.conf}} for information on what can be done here.<br />
<br />
====Skip package from being upgraded====<br />
To skip upgrading a specific package, add it to the pertinent section:<br />
IgnorePkg=kernel26<br />
<br />
====Skip package group from being upgraded====<br />
As with packages, skipping a whole package group is also possible:<br />
IgnoreGroup=gnome<br />
<br />
===Repositories===<br />
This section defines which repositories to use, as referred to in {{Filename|pacman.conf}}. They can be stated here directly, or included from another file.<br />
<br />
All official repositories use the same {{Filename|/etc/pacman.d/mirrorlist}} file which contains a variable, '{{Codeline|$repo}}', making it a requisite to maintain only one list.<br />
<br />
The following is an example for the official repositories which have numerous [[mirrors]]. Avoid using ftp.archlinux.org as it is [http://www.archlinux.org/news/302/ throttled].<br />
<pre><br />
[core]<br />
# Add your preferred servers here, they will be used first<br />
Include=/etc/pacman.d/mirrorlist<br />
<br />
[extra]<br />
# Add your preferred servers here, they will be used first<br />
Include=/etc/pacman.d/mirrorlist<br />
<br />
[community]<br />
# Add your preferred servers here, they will be used first<br />
Include=/etc/pacman.d/mirrorlist<br />
</pre><br />
{{Note|Care should be taken when using the {{Codeline|[testing]}} repository.}}<br />
<br />
==Usage==<br />
To read other examples of what pacman can do, refer to [http://archlinux.org/pacman/pacman.8.html man pacman]. The examples below are just a small sample of operations that can be performed.<br />
<br />
===Installing packages===<br />
To install a single package or list of packages (including dependencies), issue the following command:<br />
# pacman -S package_name1 package_name2<br />
<br />
Sometimes there are multiple versions of a package in different repositories (e.g. extra and testing). Specify which one to install:<br />
# pacman -S extra/package_name<br />
# pacman -S testing/package_name<br />
<br />
===Removing packages===<br />
To remove a single package, leaving all of its dependencies installed:<br />
# pacman -R package_name<br />
<br />
To remove a package's dependencies which are not required by any other installed package:<br />
# pacman -Rs package_name<br />
<br />
Pacman saves important configuration files when removing certain applications and names them with the extension: {{Filename|.pacsave}}. To delete these backup files use the -n option:<br />
# pacman -Rn package_name<br />
# pacman -Rns package_name<br />
<br />
{{Note|Pacman will not remove configurations that the application itself creates (for example {{Filename|.dot}} files in the home folder).}}<br />
<br />
===Upgrading packages===<br />
Pacman can update all packages on the system with just one command. This could take quite a while depending on how up-to-date the system is. The best option is to synchronize the repository databases ''and'' update the system in one go, with the following:<br />
# pacman -Syu<br />
<br />
Please read [[Package Management FAQs]] for more information about updating and maintaining systems with pacman.<br />
<br />
===Querying package databases===<br />
Pacman queries the local package database with the -Q flag; see:<br />
$ pacman -Q --help<br />
<br />
and queries the sync databases with the -S flag; see:<br />
$ pacman -S --help<br />
<br />
Pacman can search for packages in the database, searching both in packages' names and descriptions:<br />
$ pacman -Ss package<br />
<br />
To search for already installed packages:<br />
$ pacman -Qs package<br />
<br />
To display extensive information about a given package:<br />
$ pacman -Si package<br />
for locally installed packages:<br />
$ pacman -Qi package<br />
<br />
To retrieve a list of the files installed by a package:<br />
$ pacman -Ql package<br />
<br />
One can also query the database to know which package a file on the file system belongs to.<br />
$ pacman -Qo /path/to/a/file<br />
<br />
To list all packages no longer required as dependencies (orphans):<br />
$ pacman -Qdt<br />
<br />
===Additional commands===<br />
Download a package without installing it:<br />
# pacman -Sw package<br />
<br />
Install a 'local' package that is not from a repository:<br />
# pacman -U /path/to/package/package_name-version.pkg.tar.gz<br />
<br />
Install a 'remote' package (not from a repository):<br />
# pacman -U http://www.examplepackage/repo/examplepkg.tar.gz<br />
<br />
Clean the package cache of packages that are not currently installed (/var/cache/pacman/pkg):<br />
# pacman -Sc<br />
<br />
Clean the entire package cache:<br />
{{Warning|Only do this when certain that [[Downgrade_packages| downgrading packges]] will not be a necessity, as pacman -Scc removes ''all'' packages from the cache.}}<br />
# pacman -Scc <br />
<br />
<!-- the rest of this section: to merge with [[Pacman Tips]] --><br />
For ''recursively'' removing orphans (''be careful''):<br />
# pacman -Rs $(pacman -Qtdq)<br />
<br />
For reinstalling all packages on the system (which are available in a repository):<br />
# pacman -S $(pacman -Qq | grep -v "$(pacman -Qmq)")<br />
<br />
To get a sorted list of local packages and their size:<br />
$ LANG=C pacman -Qi | sed -n '/^Name[^:]*: \(.*\)/{s//\1 /;x};/^Installed[^:]*: \(.*\)/{s//\1/;H;x;s/\n//;p}' | sort -nk2<br />
<br />
===Backing up and retrieving a list of installed packages===<br />
<!-- to merge with [[Pacman Tips]] --><br />
It is good practice to keep periodic backups of all pacman-installed packages. In the event of a system crash which is unrecoverable by other means, Pacman can then easily reinstall the very same packages onto a new installation. <br />
<br />
*First, backup the current list of packages (which are available in a repository):<br />
$ comm -13 <(pacman -Qmq | sort) <(pacman -Qqe | sort) > pkglist<br />
<br />
*Store the pkglist on a USB key or other convenient medium.<br />
<br />
*Copy the pkglist file to the new installation, and navigate to the directory containing it.<br />
<br />
*Issue the following command to install from the backup list:<br />
# pacman -S $(cat pkglist)<br />
<br />
===Getting a list of files not owned by any package===<br />
<!-- to merge with [[Pacman Tips]] --><br />
In the interest of keeping a clean system and respecting [[The Arch Way]], periodic checks for files outside of pacman database are recommended. These files are often some 3rd party applications installed using the usual procedure (e.g., '''./configure; make; make install''', etc.) Search the file-system for these files (or symlinks) using this simple script:<br />
<pre><br />
#!/bin/bash<br />
time /usr/bin/pacman -Ql | cut -d ' ' -f 2- | sort -u > db.txt<br />
time find /arch /bin /boot /etc /lib /opt /sbin /usr 2>/dev/null | while read i; do<br />
if [ ! -d "$i" ]; then<br />
echo "$i"<br />
fi;<br />
done | sort -u > fs.txt<br />
time comm -23 fs.txt db.txt > non-db.txt<br />
<br />
#test it:<br />
#cat non-db.txt | while read i; do pacman -Qo "$i" 2>&1; done | tee test.txt<br />
</pre><br />
Note that one ''should not'' delete all files listed in non-db.txt without confirming each entry. There could be various configuration files, logs, etc., so use this list responsibly and only proceed after extensively searching for cross-references using {{Codeline|grep}}.<br />
<br />
===Troubleshooting===<br />
'''not found in sync db'''<br />
<br />
Is likely due to the package not being located because the repository has not been set correctly.<br />
<br />
'''Duplicated entries aka pacman wants to upgrade the same packages over and over again.'''<br />
<br />
You have duplicated entries in /var/lib/pacman/local. Like two kernel26 package. With -Qi you will see the new package but using -Qu it will recognize the old version and therefor it will be upgraded.<br />
<br />
'''Pacman crash during upgrade.'''<br />
<br />
If you encounter a crash during upgrade it can be painful. In my state pacman crashed with "can't write database" error and uninstalled the acl, binutils, bash packages but couldn't install the new versions because of the crash. I couldn't invoke pacman anymore to correct this. In this case you should:<br />
<br />
Boot using the Arch LiveCD.<br />
Mount your root fs.<br />
Update the pacman database via -Syy.<br />
And install the broken or uninstalled packages via: pacman -r /your/root/here -S packages.<br />
<br />
==Further reading==<br />
<br />
===Man pages===<br />
*[http://www.archlinux.org/pacman/pacman.8.html pacman]<br />
*[http://www.archlinux.org/pacman/pacman.conf.5.html pacman.conf]<br />
*[http://www.archlinux.org/pacman/repo-add.8.html repo-add]<br />
*[http://www.archlinux.org/pacman/libalpm.3.html libalpm]<br />
*[http://www.archlinux.org/pacman/makepkg.8.html makepkg]<br />
*[http://www.archlinux.org/pacman/makepkg.conf.5.html makepkg.conf]<br />
*[http://www.archlinux.org/pacman/PKGBUILD.5.html PKGBUILD]<br />
<br />
===Related articles===<br />
* [[Improve Pacman Performance]] - Recommended<br />
* [[Colored Pacman output]]<br />
* [[Downgrade packages]]<br />
* [[Redownloading all installed packages]]<br />
* [[ArchLinux User-community Repository (AUR)]]<br />
* [[Local repository HOW-TO]]<br />
* [[Custom local repository with ABS and gensync]]<br />
* [[Howto Upgrade via Home Network]] - Network shared Pacman cache<br />
* [[Rucksack]]<br />
* [[Pacman GUI Frontends]]<br />
* [[Pacman_Aliases|Pacman Aliases (for Bash and Zsh)]]<br />
* [[Mirrors]]<br />
* [[Pacman rosetta]] - Pacman for yum/apt-get/rug/zypper converts<br />
<br />
==External links==<br />
* [http://archux.com/page/using-pacman Using Pacman]<br />
* [http://bbs.archlinux.org/viewtopic.php?id=14849 GUI Frontends]<br />
* [http://bbs.archlinux.org/viewtopic.php?pid=431164 Powerpill] - Wrapper and download accelerator for Pacman<br />
* [http://aur.archlinux.org/packages.php?ID=23592 Pkgd] - Daemon for sharing package caches in LAN; ideal for laptop-desktop-server LANs</div>Blohttps://wiki.archlinux.org/index.php?title=Open_Sound_System&diff=81344Open Sound System2009-10-31T20:19:02Z<p>Blo: /* Suspend and Hibernation */</p>
<hr />
<div>[[Category:Audio/Video (English)]]<br />
[[Category:HOWTOs (English)]]<br />
{{i18n_links_start}}<br />
{{i18n_entry|English|OSS}}<br />
{{i18n_entry|简体中文|OSS (简体中文)}}<br />
{{i18n_entry|Français|OSS (Français)}}<br />
{{i18n_entry|Türkçe|OSS (Türkçe)}}<br />
{{i18n_links_end}}<br />
<br />
= Introduction =<br />
The [http://developer.opensound.com Open Sound System] is a [http://4front-tech.com commercially-supported] sound architecture that works on several UNIX-like and POSIX-compatible systems, including Linux, FreeBSD, Solaris and BeOS/Haiku.<br />
<br />
Please note that this article is not about the old OSS, which is included in the Linux kernel sources and is more than 10 years old by now.<br />
<br />
This article is about the new OSS versions (often called OSSv4). These versions were previously proprietary - OSS became open source again in July 2007, and is currently available under GPL, BSD or CDDL licenses.<br />
<br />
= Advantages and disadvantages vs. ALSA =<br />
<br />
== Advantages over ALSA (for users) ==<br />
* Includes a transparent software mixer (vmix) in kernel space. This means multiple applications can access the sound device at the same time without problems.<br />
* The vmix mixer controls allow you to adjust the volume of each application individually.<br />
* Better support for some sound card models, for example for the Creative X-Fi.<br />
* Sound quality is usually better. '''reference needed to validate this statement'''<br />
* Better support for applications written for the OSS API, of course. The OSS API is widely spread and a lot of applications support it. The ALSA's OSS API emulation, however, is often buggy.<br />
<br />
== Advantages over ALSA (for developers) ==<br />
* Cleaner and easier to use API.<br />
* API is much better [http://manuals.opensound.com/developer documented].<br />
* Support for sound drivers in the userspace (oss_userdev).<br />
* Portability across all supported platforms. If the application works using OSS under Linux, it will work under FreeBSD and Solaris too, for example.<br />
* Portability across operating systems. It's [http://revolf.free.fr/Alchimie-7/Alchimie7_OSS_Haiku.en.pdf easier] to port OSS to a new operating system.<br />
<br />
== Disadvantages vs. ALSA ==<br />
* USB audio devices support is currently experimental and USB recording is not implemented.<br />
* Bluetooth audio devices are currently not supported.<br />
* AC'97 and HDAudio dial-up soft-modems (for example Si3055) are currently not supported.<br />
* MIDI support is currently not finished. However, you can still use MIDI with a software synthesizer like timidity or fluidsynth.<br />
* Suspend is currently not supported. You need to unload OSS (by using {{Codeline|soundoff}}) before suspending, and to reload OSS (by using {{Codeline|soundon}}) after resuming.<br />
* Automatic jack sensing currently doesn't work properly with '''some''' HDAudio-powered motherboards. This means that, depending on your motherboard model, you may have to manually switch off your speakers when plugging your earphone.<br />
<br />
= Installing =<br />
<br />
The OSS install script unload all ALSA modules automatically. If it fails for some reason to remove the modules issue the command: modprobe -r soundcore. You should balcklist the ALSA modules (to prevent them loading at boot) by editing {{Filename|/etc/rc.conf}} as described below. <br />
<br />
MODULES=(!soundcore ..............<br />
<br />
Install OSS by running:<br />
<br />
# pacman -S oss<br />
<br />
Be sure the user is part of the audio group:<br />
<br />
# gpasswd -a USERNAME audio<br />
<br />
Start OSS by running:<br />
<br />
# /etc/rc.d/oss start<br />
<br />
Add <tt>oss</tt> to your <tt>DAEMONS</tt> variable at {{Filename|/etc/rc.conf}}, so OSS is loaded automatically at each boot.<br />
<br />
In the case OSS is not able to detect your card when starting it, run :<br />
<br />
# ossdetect -v<br />
<br />
Then {{Codeline|soundoff && soundon}} to reactivate it.<br />
<br />
= Testing =<br />
<br />
You can test OSS by running:<br />
<br />
$ osstest<br />
<br />
{{Note| Beware the default volume is very loud. Avoid using earphones or lower the volume by using <tt>ossxmix</tt>. }}<br />
<br />
You should be able to hear music during the test process. If there is no audio, try to adjust the mixer as explained in the following sections and/or read the Troubleshooting sections.<br />
<br />
= Volume control =<br />
<br />
To control the volume of various devices, mixers levels will need to be set. The command line mixer is called <tt>ossmix</tt>. It's very like the BSD audio mixer (<tt>mixerctl</tt>).<br />
<br />
A graphical mixer, is available too. It's called <tt>ossxmix</tt>. It needs the optional depend <tt>gtk2</tt> to work.<br />
<br />
The <tt>ossxmix</tt> controls are explained in the following example:<br />
<br />
______________________________<br />
/ High Definition Audio ALC262 \ ----------------------------------> One tab for each sound card<br />
/________________________________\_______________________________<br />
|<br />
| [x] vmix0-enable [vmix0-rate: 48.000kHz] vmix0-channels \ The vmix (virtual mixer) special configurations<br />
| [ Stereo [v] ] |--> appear at the top. These include sampling rate<br />
| / and mixer priority. They are provided by OSS.<br />
| __codec1______________________________________________________ <br />
| | _jack_______________________________________________________ \ <br />
| | | _int-speaker____________________ __green_________________ |<br />
| | | | | | | These are your sound card configurations.<br />
| | | | _mode______ | | | | _mode______ | | | Every mixer control that is shown here is<br />
| | | | [ mix [v] ] o o [x] [ ]mute | | [ mix [v] ] o o [x] |--> provided by your sound card. Every sound card<br />
| | | | | | | | | | | specific control is shown here.<br />
| | | |________________________________| |_______________________ |<br />
| | |____________________________________________________________ |<br />
| |______________________________________________________________ /<br />
|<br />
| ___vmix0_______________________________________________________ \<br />
| | __mocp___ O O _firefox_ O O __pcm7___ O O | Here are the vmix mixer controls. These are<br />
| | | | O O | | x x | | O O | virtual mixer controls provided by OSS. Each<br />
| | | | | | x O | | | | x x | | | | O O | slider is the volume control of a different<br />
| | | o o [x] | x x | o o [x] | x x | o o [x] | O O |--> application. When one application uses the<br />
| | | | | | x x | | | | x x | | | | O O | sound card, its name is shown in the place of<br />
| | |_________| x x |_________| x x |_________| O O | the 'pcm#' labels. There are also sound level<br />
| |______________________________________________________________ | meter levels for each application.<br />
|________________________________________________________________ /<br />
<br />
=== Jack Definitions ===<br />
For high definition audio, ossxmix will highlight the jacks to their corresponding plug color. For 5.1 surround sound the [http://en.wikipedia.org/wiki/Audio_and_video_connector jack colors] are: <br />
{| border="1"<br />
|-<br />
! Connector Type<br />
! Purpose<br />
! OSS<br />
|- style=color:black;background:lightgreen<br />
|green TRS 3.5mm<br />
| stereo output, front channels<br />
|front<br />
|- style=color:white;background:black <br />
|black TRS 3.5mm<br />
| stereo output, rear channels<br />
|rear<br />
|- style=color:white;background:gray<br />
|grey TRS 3.5mm<br />
| stereo output, side channels<br />
|side<br />
|- style=color:black;background:gold<br />
|gold TRS 3.5mm<br />
| dual output, center and subwoofer<br />
|center/LFE<br />
|- style=color:black;background:lightblue<br />
|blue TRS 3.5mm<br />
| stereo input, line level<br />
|input<br />
|- style=color:black;background:pink <br />
|pink TS 3.5mm<br />
| mono microphone input<br />
|input<br />
|}<br />
For the most part and for most people just make sure that:<br />
# All green jacks (green and fp-green) are "front" and 75% from max volume.<br />
# All pink jacks (pink and fp-pink) are input and 50% of max to avoid distortion.<br />
<br />
== Other Mixers ==<br />
<br />
Other desktop environments may have support for OSS:<br />
<br />
* Gnome - Gnome Volume Control has support for OSS. Some users report that using Gnome Volume Control is easier to setup than <tt>ossxmix</tt>.<br />
* KDE - Kmix now has preliminary support for OSS.<br />
<br />
== Saving and restoring mixer settings ==<br />
<br />
If you wish to save your mixer settings manually, run {{Codeline|savemixer}}. As regular user you will need permissions to use {{Codeline|/usr/sbin/savemixer}} in the sudoers file or you can modify write permissions to {{Filename|/usr/lib/oss/etc/mixer.save}}. Alternately, the <tt>-f</tt> switch can be used to save the mixer to a file and {{Codeline|savemixer -L}} to restore it.<br />
<br />
Please note that the init scripts run these commands before shutdown/after starting to keep mixer settings across boot, so most users don't need to worry about it.<br />
<br />
= Configuring Applications for OSS =<br />
<br />
== Skype ==<br />
<br />
The <tt>skype</tt> package only includes support for ALSA. To get an OSS-capable Skype, install the <tt>skype-oss</tt> package:<br />
<br />
# pacman -S skype-oss<br />
<br />
If you are using x86_64, you can get the [http://aur.archlinux.org/packages.php?ID=18312 bin32-skype-oss] package from AUR.<br />
<br />
== Wine ==<br />
<br />
* Run <tt>winecfg</tt>.<br />
<br />
$ winecfg<br />
<br />
* Go to the <tt>Audio</tt> tab.<br />
<br />
* Select <tt>OSS Driver</tt>.<br />
<br />
== Gajim ==<br />
By default Gajim uses {{Codeline|aplay -q}} to play a sound. To change this go in Advanced Settings and search for the {{Codeline|soundplayer}} variable. The ossplay program included in the oss package is a good replacement:<br />
<br />
{{Codeline|ossplay -qq}}<br />
<br />
== MOC ==<br />
<br />
To use MOC with OSS v4.1 you must change section OSSMixerDevice to OSSMixerDevice= /dev/ossmix in your config (located in /home/yourusername/.moc).<br />
And now MOC should work with OSS v4.1.<br />
Or you can compile moc-svn package from AUR (he got support for new vmix).<br />
For issue with interface change OSSMixerChannel = to OSSMixerChannel = Any channel and after start mocp press w (change to sofware mixex) that will help and you can change the volume power.<br />
<br />
== Applications that use Gstreamer ==<br />
<br />
Remove pulseaudio and gstreamer*-pulse programs and libraries.<br />
<br />
To change the gstreamer setting to output the sound to OSS instead of the default ALSA, run:<br />
<br />
gstreamer-properties<br />
<br />
Change the '''Default Output''' plugin to custom and the change the pipeline to:<br />
<br />
oss4sink<br />
<br />
For the input:<br />
<br />
oss4src<br />
<br />
{{Note|It's not certain that the input will sound better with oss4src compared to osssrc, so change this only if it improves your input sound. < confirmation on this please >}}<br />
<br />
If you are using phonon with the gstreamer backend you will need to set the environmental variable. To add to your current user:<br />
<br />
export PHONON_GST_AUDIOSINK=oss4sink<br />
<br />
Add this to your {{Filename|~/.bashrc}} to be loaded on login.<br />
<br />
== Firefox >=3.5 ==<br />
<br />
Firefox 3.5 introduces the <video> and <audio> tag support and can play ogg media out of the box. However, it currently can't be compiled with ALSA and OSS support at the same time. So you need to install the [http://aur.archlinux.org/packages.php?ID=28110 xulrunner-oss] package.<br />
<br />
1. Stop firefox.<br />
2. Remove the xulrunner package without dependency check: sudo pacman -Rd xulrunner<br />
3. Install xulrunner-oss package from AUR using yaourt or [http://wiki.archlinux.org/index.php/ABS ABS].<br />
4. Start firefox.<br />
<br />
== Mplayer ==<br />
<br />
If you are using gui (smplayer etc.) you will find the oss output at the audio settings. Using on cli you should specify the sound output: mplayer -ao oss /some/file/to/play.mkv If you don't want to brother typing it over and over again add "ao=oss" to your config file. (/home/$USER/.mplayer/config)<br />
<br />
== Other applications ==<br />
<br />
* If you can't get sound from an application not listed here, try looking at the [http://www.4front-tech.com/wiki/index.php/Configuring_Applications_for_OSSv4 Configuring Applications for OSSv4] page.<br />
* Search OSS specific packages by using {{Codeline|pacman -Ss -- '-oss'}} and [http://aur.archlinux.org/packages.php?K=-oss&start=0&PP=100| in AUR].<br />
<br />
= Troubleshooting =<br />
<br />
== Troubleshooting HDAudio devices ==<br />
<br />
=== Understanding why problems arise ===<br />
<br />
If you have a HDAudio sound device, it's very likely that you will have to adjust some mixer settings before your sound works.<br />
<br />
HDAudio devices are very powerful in the sense that they can contain a lot of small circuits (called ''widgets'') that can be adjusted by software at any time. These controls are exposed to the mixer, and they can be used, for example, to turn the earphone jack into a sound input jack instead of a sound output jack.<br />
<br />
However, there is a side effect, mainly because the HDAudio standard is more flexible than it perhaps should be, and because the vendors often only care to get their ''official drivers'' working.<br />
<br />
Then, when using HDAudio devices, you often find disorganized mixer controls, that doesn't work at all by default, and you are forced to try every mixer control combination, until it works.<br />
<br />
=== How to solve ===<br />
<br />
Open <tt>ossxmix</tt> and try to change every mixer control in the ''middle area'', that contains the sound card specific controls, as explained in the previous "[[OSS#The_mixer|The mixer]]" section.<br />
<br />
You'll probably want to setup a program to record/play continously in the background (e.g. {{Codeline|ossrecord - | ossplay -}} for recording or {{Codeline|osstest -lV}} for playing), while changing mixer settings in ossxmix in the foreground.<br />
<br />
* Raise every volume control slider.<br />
* In each option box, try to change the selected option, trying all the possible combinations.<br />
* If you get noise, try to lower and/or mute some volume controls, until you find the source of the noise.<br />
<br />
Please note again that you do '''not''' need to change any controls in the ''top area'' nor in the ''bottom area'', as they are virtual <tt>vmix</tt>-related mixer controls.<br />
<br />
* Editing {{Codeline|/usr/lib/oss/conf/oss_hdaudio.conf}} uncommenting and changing ''hdaudio_noskip=0'' to a value from 0-7 can give you more jack options in ossxmix<br />
I had to edit mine to ''hdaudio_noskip=7'' for my sub/rear speaker to work on my laptop, restart oss for the changes to take effect {{Codeline|/etc/rc.d/oss restart}}<br />
<br />
== MMS sound cracking in totem ==<br />
If your stream sounds with cracks or strange noise in totem like it did with me then you could try to play it with another backend like ffmpeg (mplayer). That "fixed" the issue for me. This will not fix the issue that somehow pops up in gstreamer when playing MMS streams but it will give you the option to play it with good sound quality. Playing it in mplayer is simple:<br />
# mplayer mmsh://yourstreamurl<br />
<br />
== Microphone playing through output channels ==<br />
<br />
OSS by default plays back the microphone through the speakers. To disable this in ossxmix find the misc section. Check off every "input-mix-mute" to disable this.<br />
<br />
== Troubleshooting other issues ==<br />
<br />
* If you get distorted sound, try lowering some volume control sliders.<br />
<br />
* If you need to change the default sound card, look at [http://www.opensound.com/wiki/index.php/Tips_And_Tricks#Changing_the_default_sound_output here].<br />
<br />
* If you have another issues, try searching or asking for help at the [http://www.4front-tech.com/forum 4front forums].<br />
<br />
= Tips and Tricks =<br />
<br />
== Using multimedia keys with OSS ==<br />
An easy way to mute/unmute and increase/decrease the volume is to use the [http://www.opensound.com/wiki/index.php/Tips_And_Tricks#ossvol {{Codeline|ossvol}} script] available in [[AUR]].<br />
<br />
Once you installed it try to toggle the sound:<br />
$ ossvol -t<br />
<br />
Type {{Codeline|ossvol -h}} for the other commands.<br />
<br />
If you don't know how to assign commands to your multimedia keys, see [[Extra Keyboard Keys]].<br />
<br />
==={{Codeline|ossvol}} troubleshooting===<br />
If you get an error like:<br />
Bad mixer control name(987) 'vol'<br />
you need to edit the script ({{Filename|/usr/bin/ossvol}}) and change the value of the {{Codeline|CHANNEL}} variable which is at the beginning of the script. For example mine is {{Codeline|CHANNEL<nowiki>=</nowiki>"vmix0-outvol"}}.<br />
<br />
*'''Note''' if you are using xbindkeys for your multimedia keys adding this<br />
"ossmix vmix0-outvol -- +1"<br />
raise volume<br />
"ossmix vmix0-outvol -- -1"<br />
lower volume<br />
<br />
to the raise/lower volume section of your .xbindkeysrc file is an easy way to adjust the volume<br />
<br />
== Changing the Sample Rate ==<br />
<br />
Changing the output sample rate is not obvious at first. Sample rates can only be changed by the superuser and vmix must be unused by any programs when a change is requested. Before you follow any of these steps, ensure you are going through a receiver/amplifier and using quality speakers and not simply computer speakers. If you are only using computer speakers, don't bother changing anything here as you won't notice a difference.<br />
<br />
By default the sample rate is 48000hz. There are several conditions in which you may want to change this. This all depends on your usage patterns. You want the sample rate you are using to match the media you use the most. If your computer has to change the sampling rate of the media to suit the hardware it is likely, though not guaranteed that you will have a loss in audio quality. This is most noticable in downsampling (ie. 96000hz &rarr; 48000hz). There is an article about this issue in [http://www.stereophile.com/news/121707lucky/ "Stereophile"] which was [http://lists.apple.com/archives/coreaudio-api/2008/Jan/msg00272.html discussed] on Apple's "CoreAudio API" mailing list if you wish to learn more about this issue. <br />
<br />
Some example sample rates:<br />
<br />
* 44100hz - Sample rate of standard [http://en.wikipedia.org/wiki/Red_Book_%28audio_CD_standard%29 Red Book] audio cds.<br />
* 88000hz - Sample rate of [http://en.wikipedia.org/wiki/Super_Audio_CD SACD] high definition audio discs/downloads. It is rare that your motherboard will support this sample rate.<br />
* 96000hz - Sample rate of most high definition audio downloads. If your motherboard is an [http://en.wikipedia.org/wiki/AC%2797 AC'97] motherboard, this is likely to be your highest bitrate.<br />
* 192000hz - Sample rate of BluRay, and some (very few) high definition downloads. Support for external audio reciever equipment is limited to high end audio. Not all motherboards support this. An example of a motherboard chipset that would support this includes [http://en.wikipedia.org/wiki/Intel_High_Definition_Audio Intel HDA audio]. <br />
<br />
To check what your sample rate is currently set to:<br />
<br />
# Run <code>"ossmix | grep rate"</code>. <br />
<br />
You are likely to see <code>"vmix0-rate <decimal value> (currently 48000) (Read-only)"</code>.<br />
<br />
If you do not see a "vmix0-rate" (or "vmix1-rate", etc.) being outputted, than it probably means that vmix is disabled. In that case, OSS will use the rate requested by the program which uses the device, so this section doesn't apply. Exception: envy24(ht) cards have a setting envy24.rate which has a similiar function (see "oss_envy24" manpage). You can follow these steps, but at step 2, change with ossmix the value of "envy24.rate" as well.<br />
<br />
Steps to affect the change:<br />
<br />
# First, make sure your card is able to use the new rate. Run "ossinfo -v2" and see if the wanted rate is in the "Native sample rates" output.<br />
# As root, run <code>"/usr/lib/oss/scripts/killprocs.sh"</code>. Be aware, this will close any program that currently has an open sound channel (examples being media players, Firefox as of 3.5 if you have xulrunner-oss installed, and the gnome volume control).<br />
# After all programs occupying vmix are terminated, run as root: <code>"vmixctl rate /dev/dsp 96000"</code> replacing the rate with your desired sample rate.<br />
# Run <code>"ossmix | grep rate"</code> and check for <code>"vmix0-rate <decimal value> (currently 96000) (Read-only)"</code> to see if you were successful.<br />
<br />
== Start ossxmix docked to systray on startup ==<br />
<br />
'''KDE 4'''<br />
<br />
Create an application launcher file named <code>ossxmix.desktop</code> in you local application launchers directory (<code>~/.local/share/applications/</code> then enter:<br />
<br />
<pre>[Desktop Entry]<br />
Name=Open Sound System Mixer<br />
GenericName=Audio Mixer<br />
Exec=ossxmix -b<br />
Icon=audio-card<br />
Categories=Application;GTK;AudioVideo;Player;<br />
Terminal=false<br />
Type=Application<br />
Encoding=UTF-8</pre><br />
<br />
To add it to autostart when loading the desktop environment:<br />
<br />
System Settings > Advanced tab > Autostart. Then click add program and choose it from the 'Multimedia' list.<br />
<br />
'''Gnome''' <br />
<br />
*As Root create a file /usr/local/bin/ossxmix_bg with the following content:<br />
<br />
<pre><br />
#!/bin/bash<br />
exec /usr/bin/ossxmix -b<br />
</pre><br />
<br />
Goto System > Preferences > Start Up Applications<br />
<br />
*Click Add, Type OSSMIX in Name field and <code>/usr/local/bin/ossxmix_bg</code> in Command field then click Add button.<br />
<br />
*Login and Logout to see the changes.<br />
<br />
== Record sound output from a program ==<br />
<br />
* [http://www.opensound.com/wiki/index.php/Tips_And_Tricks#Recording_sound_output_of_a_program Recording sound output of a program].<br />
<br />
== Suspend and Hibernation ==<br />
<br />
OSS does not automatically support suspend meaning that OSS must be manually stopped prior to suspending or hibernating.<br />
<br />
OSS provides <tt>soundon</tt> and <tt>soundoff</tt> to enable and disable OSS, although any processes that use sound must be terminated first.<br />
<br />
The following script is a rather basic method of automatically unloading OSS prior to suspending and reloading afterwards.<br />
<br />
#!/bin/sh<br />
. "${PM_FUNCTIONS}"<br />
<br />
suspend_osssound()<br />
{<br />
/usr/lib/oss/scripts/killprocs.sh<br />
/usr/sbin/soundoff<br />
}<br />
<br />
resume_osssound()<br />
{<br />
/usr/sbin/soundon<br />
}<br />
<br />
case "$1" in<br />
hibernate|suspend)<br />
suspend_osssound<br />
;;<br />
thaw|resume)<br />
resume_osssound<br />
;;<br />
*) exit $NA<br />
;;<br />
esac<br />
<br />
Save the contents of the script (as root) into {{Filename|/etc/pm/sleep.d/50ossound}} and make it executable. {{Filename| chmod a+x /etc/pm/sleep.d/50ossound}}<br />
<br />
{{Note|This script is rather basic and will terminate any application directly accessing OSS, save your work prior to suspending/hibernating.}}<br />
<br />
OSS does not support suspending but we don't care or better [http://wiki.archlinux.org/index.php/Suspend_to_RAM s2ram] works fine without stopping OSS.<br />
Just create a nice suspend script to /sbin/suspend and make it executable.<br />
<br />
<pre><br />
#!/bin/bash<br />
<br />
if [ [ $EUID -ne 0 ] ]; then<br />
## Checking if you are a root or not<br />
echo "This script must be run as root" 1>&2<br />
exit 1<br />
fi<br />
<br />
s2ram -f<br />
<br />
sleep 2<br />
<br />
/etc/rc.d/oss restart 2>/tmp/oss.txt<br />
<br />
if [ $? -gt 0 ]; then<br />
echo "OSS restart failed check /tmp/oss.txt for advice"<br />
fi<br />
<br />
exit 0<br />
</pre><br />
<br />
That's all your apps are fine and suspend works. \o/<br />
<br />
{{Note | If you are using Opera you must kill operapluginwrapper before suspend. To do this add '''<nowiki>PID=`pidof operapluginwrapper`;kill -9 $PID</nowiki>''' before s2ram -f. }}<br />
<br />
== ALSA emulation ==<br />
<br />
=== Introduction ===<br />
<br />
You can instruct <tt>alsa-lib</tt> to use OSS as its audio output system. This works as a sort of ALSA emulation.<br />
<br />
Note, however, that this method may introduce additional latency in your sound output, and that the emulation is not complete and doesn't work with all applications. It doesn't work, for example, with programs that try to detect devices using ALSA.<br />
<br />
So, as most applications support OSS directly, use this method only as a last resort.<br />
<br />
In the future, more complete methods may be available for emulating ALSA, such as <tt>libsalsa</tt> and <tt>cuckoo</tt>.<br />
<br />
=== HOW-TO ===<br />
<br />
* Install the <tt>alsa-plugins</tt> package.<br />
<br />
# pacman -S alsa-plugins<br />
<br />
* Edit {{Filename|/etc/asound.conf}} as follows.<br />
<br />
pcm.oss {<br />
type oss<br />
device /dev/dsp<br />
}<br />
<br />
pcm.!default {<br />
type oss<br />
device /dev/dsp<br />
}<br />
<br />
ctl.oss {<br />
type oss<br />
device /dev/mixer<br />
}<br />
<br />
ctl.!default {<br />
type oss<br />
device /dev/mixer<br />
}<br />
<br />
{{Note | If you don't want to use OSS anymore, don't forget to revert changes that you do here in {{Filename|/etc/asound.conf}}.}}<br />
<br />
= Experimental packages =<br />
<br />
== Mercurial repository version ==<br />
<br />
There is a [http://aur.archlinux.org/packages.php?ID=21126 oss-mercurial package] in AUR. This package compiles and installs the latest OSS development version direcly from the Mercurial repository.<br />
<br />
You can try this package if you want to contribute code to OSS or if only a very recent change in OSS code introduced support to your sound device.<br />
<br />
If you want oss to take care of your flash sound you will need to install libflashsupport:<br />
<br />
# pacman -S libflashsupport</div>Blohttps://wiki.archlinux.org/index.php?title=Ramdisk&diff=81280Ramdisk2009-10-31T12:23:14Z<p>Blo: </p>
<hr />
<div>[[Category:File systems (English)]]<br />
==What is a ramdisk?==<br />
<br />
A ramdisk is a portion of RAM utilised as a disk. Many distributions use /dev/ram for this, however Arch does not have a /dev/ram so we must use /etc/fstab to create ramdisks. The most important thing to remember about a ramdisk is that it is stored in RAM and thus volatile. Anything stored on a ramdisk will be lost if the computer completely seizes up, or loses power. Therefore, it is necessary to save the contents of your ramdisk to the harddrive if you want to save them.<br />
<br />
==Why use one?==<br />
<br />
As a ramdisk is stored in RAM, it is much faster than a conventional harddrive. So, if you need to manipulate files at high speed, a ramdisk could be the best solution. Possible uses are for /tmp, /var/cache/pacman, or /var/lib/pacman, although I'm sure you could think of many others.<br />
<br />
==How to create a ramdisk==<br />
<br />
To create a ramdisk, you must treat it as any other mounted filesystem. You must first pick and create a location for it to reside on, and then add it to your /etc/fstab file as follows:<br />
<br />
none /path/to/location ramfs 0 0<br />
<br />
If you don't have a lot of spare ram, it is recommended to use 'tmpfs' instead of 'ramfs', as tmpfs uses Swap when the available RAM starts to run out, whereas ramfs doesn't. of course, dipping into swap loses the performance benefits of RAM, so it's a little pointless unless you have a lot of spare RAM.<br />
<br />
==Example usage==<br />
<br />
Here is an example of the current (as of this writing) set up on my computer. I have edited /etc/fstab, /etc/rc.local, and /etc/rc.local.shutdown to store /tmp, /var/cache/pacman, and /var/lib/pacman in RAM, and sync them to disk before shutting down. I have removed portions of the files not relevant to the topic at hand to save space<br />
<br />
'''/etc/fstab:'''<br />
none /tmp ramfs defaults 0 0<br />
none /mnt/ramdisk ramfs defaults 0 0<br />
<br />
'''/etc/rc.local:'''<br />
chmod 777 /tmp<br />
touch /etc/ramdisk.sh<br />
<br />
echo "#!/bin/dash" >> /etc/ramdisk.sh<br />
<br />
echo "cd /var/ && tar cf abs.tar abs/" >> /etc/ramdisk.sh<br />
echo "cd /var/cache/ && tar cf pacman.tar pacman/" >> /etc/ramdisk.sh<br />
echo "cd /var/lib/ && tar cf pacman.tar pacman/" >> /etc/ramdisk.sh<br />
<br />
echo "mkdir /mnt/ramdisk/var/" >> /etc/ramdisk.sh<br />
echo "mkdir /mnt/ramdisk/var/cache/" >> /etc/ramdisk.sh<br />
echo "mkdir /mnt/ramdisk/var/lib/" >> /etc/ramdisk.sh<br />
<br />
echo "mv /var/abs /mnt/ramdisk/var" >> /etc/ramdisk.sh<br />
echo "mv /var/cache/pacman /mnt/ramdisk/var/cache" >> /etc/ramdisk.sh<br />
echo "mv /var/lib/pacman /mnt/ramdisk/var/lib" >> /etc/ramdisk.sh<br />
<br />
echo "ln -s /mnt/ramdisk/var/abs /var/abs" >> /etc/ramdisk.sh<br />
echo "ln -s /mnt/ramdisk/var/cache/pacman /var/cache/pacman" >> /etc/ramdisk.sh<br />
echo "ln -s /mnt/ramdisk/var/lib/pacman /var/lib/pacman" >> /etc/ramdisk.sh<br />
echo "ln -s /tmp /mnt/ramdisk/tmp" >> /etc/ramdisk.sh<br />
<br />
echo "chmod 777 /mnt/ramdisk/tmp" >> /etc/ramdisk.sh<br />
echo "rm /etc/ramdisk.sh" >> /etc/ramdisk.sh<br />
<br />
chmod +x /etc/ramdisk.sh<br />
/etc/ramdisk.sh &<br />
<br />
'''/etc/rc.local.shutdown:'''<br />
echo "Saving contents of ramdisk to harddrive"<br />
rm /var/abs<br />
rm /var/cache/pacman<br />
rm /var/lib/pacman<br />
mv /mnt/ramdisk/var/abs /var<br />
mv /mnt/ramdisk/var/cache/pacman /var/cache<br />
mv /mnt/ramdisk/var/lib/pacman /var/lib<br />
<br />
==Useful links==<br />
<br />
[http://bbs.archlinux.org/viewtopic.php?id=50893 How to mount Ramdisk]<br />
[http://bbs.archlinux.org/viewtopic.php?pid=326269 Ramdrive setup]</div>Blohttps://wiki.archlinux.org/index.php?title=Ramdisk&diff=81279Ramdisk2009-10-31T12:22:41Z<p>Blo: </p>
<hr />
<div>[[Category:File systems (English)]]<br />
==What is a ramdisk?==<br />
<br />
A ramdisk is a portion of RAM utilised as a disk. Many distributions use /dev/ram for this, however Arch does not have a /dev/ram so we must use /etc/fstab to create ramdisks. The most important thing to remember about a ramdisk is that it is stored in RAM and thus volatile. Anything stored on a ramdisk will be lost if the computer completely seizes up, or loses power. Therefore, it is necessary to save the contents of your ramdisk to the harddrive if you want to save them.<br />
<br />
==Why use one?==<br />
<br />
As a ramdisk is stored in RAM, it is much faster than a conventional harddrive. So, if you need to manipulate files at high speed, a ramdisk could be the best solution. Possible uses are for /tmp, /var/cache/pacman, or /var/lib/pacman, although I'm sure you could think of many others.<br />
<br />
==How to create a ramdisk==<br />
<br />
To create a ramdisk, you must treat it as any other mounted filesystem. You must first pick and create a location for it to reside on, and then add it to your /etc/fstab file as follows:<br />
<br />
none /path/to/location ramfs 0 0<br />
<br />
If you don't have a lot of spare ram, it is recommended to use 'tmpfs' instead of 'ramfs', as tmpfs uses Swap when the available RAM starts to run out, whereas ramfs doesn't. of course, dipping into swap loses the performance benefits of RAM, so it's a little pointless unless you have a lot of spare RAM.<br />
<br />
==Example usage==<br />
<br />
Here is an example of the current (as of this writing) set up on my computer. I have edited /etc/fstab, /etc/rc.local, and /etc/rc.local.shutdown to store /tmp, /var/cache/pacman, and /var/lib/pacman in RAM, and sync them to disk before shutting down. I have removed portions of the files not relevant to the topic at hand to save space<br />
<br />
'''/etc/fstab:'''<br />
none /tmp ramfs defaults 0 0<br />
none /mnt/ramdisk ramfs defaults 0 0<br />
<br />
'''/etc/rc.local:'''<br />
chmod 777 /tmp<br />
touch /etc/ramdisk.sh<br />
<br />
echo "#!/bin/dash" >> /etc/ramdisk.sh<br />
<br />
echo "cd /var/ && tar cf abs.tar abs/" >> /etc/ramdisk.sh<br />
echo "cd /var/cache/ && tar cf pacman.tar pacman/" >> /etc/ramdisk.sh<br />
echo "cd /var/lib/ && tar cf pacman.tar pacman/" >> /etc/ramdisk.sh<br />
<br />
echo "mkdir /mnt/ramdisk/var/" >> /etc/ramdisk.sh<br />
echo "mkdir /mnt/ramdisk/var/cache/" >> /etc/ramdisk.sh<br />
echo "mkdir /mnt/ramdisk/var/lib/" >> /etc/ramdisk.sh<br />
<br />
echo "mv /var/abs /mnt/ramdisk/var" >> /etc/ramdisk.sh<br />
echo "mv /var/cache/pacman /mnt/ramdisk/var/cache" >> /etc/ramdisk.sh<br />
echo "mv /var/lib/pacman /mnt/ramdisk/var/lib" >> /etc/ramdisk.sh<br />
<br />
echo "ln -s /mnt/ramdisk/var/abs /var/abs" >> /etc/ramdisk.sh<br />
echo "ln -s /mnt/ramdisk/var/cache/pacman /var/cache/pacman" >> /etc/ramdisk.sh<br />
echo "ln -s /mnt/ramdisk/var/lib/pacman /var/lib/pacman" >> /etc/ramdisk.sh<br />
echo "ln -s /tmp /mnt/ramdisk/tmp" >> /etc/ramdisk.sh<br />
<br />
echo "chmod 777 /mnt/ramdisk/tmp" >> /etc/ramdisk.sh<br />
echo "rm /etc/ramdisk.sh" >> /etc/ramdisk.sh<br />
<br />
chmod +x /etc/ramdisk.sh<br />
/etc/ramdisk.sh &<br />
<br />
'''/etc/rc.local.shutdown:'''<br />
echo "Saving contents of ramdisk to harddrive"<br />
rm /var/abs<br />
rm /var/cache/pacman<br />
rm /var/lib/pacman<br />
mv /mnt/ramdisk/var/abs /var<br />
mv /mnt/ramdisk/var/cache/pacman /var/cache<br />
mv /mnt/ramdisk/var/lib/pacman /var/lib<br />
<br />
==Useful links==<br />
<br />
[http://bbs.archlinux.org/viewtopic.php?id=50893 How to mount Ramdisk]<br />
[http://bbs.archlinux.org/viewtopic.php?pid=326269 Ramdrive setup]</div>Blohttps://wiki.archlinux.org/index.php?title=Open_Sound_System&diff=80896Open Sound System2009-10-28T19:43:27Z<p>Blo: /* Suspend and Hibernation */</p>
<hr />
<div>[[Category:Audio/Video (English)]]<br />
[[Category:HOWTOs (English)]]<br />
{{i18n_links_start}}<br />
{{i18n_entry|English|OSS}}<br />
{{i18n_entry|简体中文|OSS (简体中文)}}<br />
{{i18n_entry|Français|OSS (Français)}}<br />
{{i18n_entry|Türkçe|OSS (Türkçe)}}<br />
{{i18n_links_end}}<br />
<br />
= Introduction =<br />
The [http://developer.opensound.com Open Sound System] is a [http://4front-tech.com commercially-supported] sound architecture that works on several UNIX-like and POSIX-compatible systems, including Linux, FreeBSD, Solaris and BeOS/Haiku.<br />
<br />
Please note that this article is not about the old OSS, which is included in the Linux kernel sources and is more than 10 years old by now.<br />
<br />
This article is about the new OSS versions (often called OSSv4). These versions were previously proprietary - OSS became open source again in July 2007, and is currently available under GPL, BSD or CDDL licenses.<br />
<br />
= Advantages and disadvantages vs. ALSA =<br />
<br />
== Advantages over ALSA (for users) ==<br />
* Includes a transparent software mixer (vmix) in kernel space. This means multiple applications can access the sound device at the same time without problems.<br />
* The vmix mixer controls allow you to adjust the volume of each application individually.<br />
* Better support for some sound card models, for example for the Creative X-Fi.<br />
* Sound quality is usually better. '''reference needed to validate this statement'''<br />
* Better support for applications written for the OSS API, of course. The OSS API is widely spread and a lot of applications support it. The ALSA's OSS API emulation, however, is often buggy.<br />
<br />
== Advantages over ALSA (for developers) ==<br />
* Cleaner and easier to use API.<br />
* API is much better [http://manuals.opensound.com/developer documented].<br />
* Support for sound drivers in the userspace (oss_userdev).<br />
* Portability across all supported platforms. If the application works using OSS under Linux, it will work under FreeBSD and Solaris too, for example.<br />
* Portability across operating systems. It's [http://revolf.free.fr/Alchimie-7/Alchimie7_OSS_Haiku.en.pdf easier] to port OSS to a new operating system.<br />
<br />
== Disadvantages vs. ALSA ==<br />
* USB audio devices support is currently experimental and USB recording is not implemented.<br />
* Bluetooth audio devices are currently not supported.<br />
* AC'97 and HDAudio dial-up soft-modems (for example Si3055) are currently not supported.<br />
* MIDI support is currently not finished. However, you can still use MIDI with a software synthesizer like timidity or fluidsynth.<br />
* Suspend is currently not supported. You need to unload OSS (by using {{Codeline|soundoff}}) before suspending, and to reload OSS (by using {{Codeline|soundon}}) after resuming.<br />
* Automatic jack sensing currently doesn't work properly with '''some''' HDAudio-powered motherboards. This means that, depending on your motherboard model, you may have to manually switch off your speakers when plugging your earphone.<br />
<br />
= Installing =<br />
<br />
The OSS install script unload all ALSA modules automatically. If it fails for some reason to remove the modules issue the command: modprobe -r soundcore. You should balcklist the ALSA modules (to prevent them loading at boot) by editing {{Filename|/etc/rc.conf}} as described below. <br />
<br />
MODULES=(!soundcore ..............<br />
<br />
Install OSS by running:<br />
<br />
# pacman -S oss<br />
<br />
Be sure the user is part of the audio group:<br />
<br />
# gpasswd -a USERNAME audio<br />
<br />
Start OSS by running:<br />
<br />
# /etc/rc.d/oss start<br />
<br />
Add <tt>oss</tt> to your <tt>DAEMONS</tt> variable at {{Filename|/etc/rc.conf}}, so OSS is loaded automatically at each boot.<br />
<br />
In the case OSS is not able to detect your card when starting it, run :<br />
<br />
# ossdetect -v<br />
<br />
Then {{Codeline|soundoff && soundon}} to reactivate it.<br />
<br />
= Testing =<br />
<br />
You can test OSS by running:<br />
<br />
$ osstest<br />
<br />
{{Note| Beware the default volume is very loud. Avoid using earphones or lower the volume by using <tt>ossxmix</tt>. }}<br />
<br />
You should be able to hear music during the test process. If there is no audio, try to adjust the mixer as explained in the following sections and/or read the Troubleshooting sections.<br />
<br />
= Volume control =<br />
<br />
To control the volume of various devices, mixers levels will need to be set. The command line mixer is called <tt>ossmix</tt>. It's very like the BSD audio mixer (<tt>mixerctl</tt>).<br />
<br />
A graphical mixer, is available too. It's called <tt>ossxmix</tt>. It needs the optional depend <tt>gtk2</tt> to work.<br />
<br />
The <tt>ossxmix</tt> controls are explained in the following example:<br />
<br />
______________________________<br />
/ High Definition Audio ALC262 \ ----------------------------------> One tab for each sound card<br />
/________________________________\_______________________________<br />
|<br />
| [x] vmix0-enable [vmix0-rate: 48.000kHz] vmix0-channels \ The vmix (virtual mixer) special configurations<br />
| [ Stereo [v] ] |--> appear at the top. These include sampling rate<br />
| / and mixer priority. They are provided by OSS.<br />
| __codec1______________________________________________________ <br />
| | _jack_______________________________________________________ \ <br />
| | | _int-speaker____________________ __green_________________ |<br />
| | | | | | | These are your sound card configurations.<br />
| | | | _mode______ | | | | _mode______ | | | Every mixer control that is shown here is<br />
| | | | [ mix [v] ] o o [x] [ ]mute | | [ mix [v] ] o o [x] |--> provided by your sound card. Every sound card<br />
| | | | | | | | | | | specific control is shown here.<br />
| | | |________________________________| |_______________________ |<br />
| | |____________________________________________________________ |<br />
| |______________________________________________________________ /<br />
|<br />
| ___vmix0_______________________________________________________ \<br />
| | __mocp___ O O _firefox_ O O __pcm7___ O O | Here are the vmix mixer controls. These are<br />
| | | | O O | | x x | | O O | virtual mixer controls provided by OSS. Each<br />
| | | | | | x O | | | | x x | | | | O O | slider is the volume control of a different<br />
| | | o o [x] | x x | o o [x] | x x | o o [x] | O O |--> application. When one application uses the<br />
| | | | | | x x | | | | x x | | | | O O | sound card, its name is shown in the place of<br />
| | |_________| x x |_________| x x |_________| O O | the 'pcm#' labels. There are also sound level<br />
| |______________________________________________________________ | meter levels for each application.<br />
|________________________________________________________________ /<br />
<br />
=== Jack Definitions ===<br />
For high definition audio, ossxmix will highlight the jacks to their corresponding plug color. For 5.1 surround sound the [http://en.wikipedia.org/wiki/Audio_and_video_connector jack colors] are: <br />
{| border="1"<br />
|-<br />
! Connector Type<br />
! Purpose<br />
! OSS<br />
|- style=color:black;background:lightgreen<br />
|green TRS 3.5mm<br />
| stereo output, front channels<br />
|front<br />
|- style=color:white;background:black <br />
|black TRS 3.5mm<br />
| stereo output, rear channels<br />
|rear<br />
|- style=color:white;background:gray<br />
|grey TRS 3.5mm<br />
| stereo output, side channels<br />
|side<br />
|- style=color:black;background:gold<br />
|gold TRS 3.5mm<br />
| dual output, center and subwoofer<br />
|center/LFE<br />
|- style=color:black;background:lightblue<br />
|blue TRS 3.5mm<br />
| stereo input, line level<br />
|input<br />
|- style=color:black;background:pink <br />
|pink TS 3.5mm<br />
| mono microphone input<br />
|input<br />
|}<br />
For the most part and for most people just make sure that:<br />
# All green jacks (green and fp-green) are "front" and 75% from max volume.<br />
# All pink jacks (pink and fp-pink) are input and 50% of max to avoid distortion.<br />
<br />
== Other Mixers ==<br />
<br />
Other desktop environments may have support for OSS:<br />
<br />
* Gnome - Gnome Volume Control has support for OSS. Some users report that using Gnome Volume Control is easier to setup than <tt>ossxmix</tt>.<br />
* KDE - Kmix now has preliminary support for OSS.<br />
<br />
== Saving and restoring mixer settings ==<br />
<br />
If you wish to save your mixer settings manually, run {{Codeline|savemixer}}. As regular user you will need permissions to use {{Codeline|/usr/sbin/savemixer}} in the sudoers file or you can modify write permissions to {{Filename|/usr/lib/oss/etc/mixer.save}}. Alternately, the <tt>-f</tt> switch can be used to save the mixer to a file and {{Codeline|savemixer -L}} to restore it.<br />
<br />
Please note that the init scripts run these commands before shutdown/after starting to keep mixer settings across boot, so most users don't need to worry about it.<br />
<br />
= Configuring Applications for OSS =<br />
<br />
== Skype ==<br />
<br />
The <tt>skype</tt> package only includes support for ALSA. To get an OSS-capable Skype, install the <tt>skype-oss</tt> package:<br />
<br />
# pacman -S skype-oss<br />
<br />
If you are using x86_64, you can get the [http://aur.archlinux.org/packages.php?ID=18312 bin32-skype-oss] package from AUR.<br />
<br />
== Wine ==<br />
<br />
* Run <tt>winecfg</tt>.<br />
<br />
$ winecfg<br />
<br />
* Go to the <tt>Audio</tt> tab.<br />
<br />
* Select <tt>OSS Driver</tt>.<br />
<br />
== Gajim ==<br />
By default Gajim uses {{Codeline|aplay -q}} to play a sound. To change this go in Advanced Settings and search for the {{Codeline|soundplayer}} variable. The ossplay program included in the oss package is a good replacement:<br />
<br />
{{Codeline|ossplay -qq}}<br />
<br />
== MOC ==<br />
<br />
To use MOC with OSS v4.1 you must change section OSSMixerDevice to OSSMixerDevice= /dev/ossmix in your config (located in /home/yourusername/.moc).<br />
And now MOC should work with OSS v4.1.<br />
Or you can compile moc-svn package from AUR (he got support for new vmix).<br />
For issue with interface change OSSMixerChannel = to OSSMixerChannel = Any channel and after start mocp press w (change to sofware mixex) that will help and you can change the volume power.<br />
<br />
== Applications that use Gstreamer ==<br />
<br />
Remove pulseaudio and gstreamer*-pulse programs and libraries.<br />
<br />
To change the gstreamer setting to output the sound to OSS instead of the default ALSA, run:<br />
<br />
gstreamer-properties<br />
<br />
Change the '''Default Output''' plugin to custom and the change the pipeline to:<br />
<br />
oss4sink<br />
<br />
For the input:<br />
<br />
oss4src<br />
<br />
{{Note|It's not certain that the input will sound better with oss4src compared to osssrc, so change this only if it improves your input sound. < confirmation on this please >}}<br />
<br />
If you are using phonon with the gstreamer backend you will need to set the environmental variable. To add to your current user:<br />
<br />
export PHONON_GST_AUDIOSINK=oss4sink<br />
<br />
Add this to your {{Filename|~/.bashrc}} to be loaded on login.<br />
<br />
== Firefox >=3.5 ==<br />
<br />
Firefox 3.5 introduces the <video> and <audio> tag support and can play ogg media out of the box. However, it currently can't be compiled with ALSA and OSS support at the same time. So you need to install the [http://aur.archlinux.org/packages.php?ID=28110 xulrunner-oss] package.<br />
<br />
1. Stop firefox.<br />
2. Remove the xulrunner package without dependency check: sudo pacman -Rd xulrunner<br />
3. Install xulrunner-oss package from AUR using yaourt or [http://wiki.archlinux.org/index.php/ABS ABS].<br />
4. Start firefox.<br />
<br />
== Mplayer ==<br />
<br />
If you are using gui (smplayer etc.) you will find the oss output at the audio settings. Using on cli you should specify the sound output: mplayer -ao oss /some/file/to/play.mkv If you don't want to brother typing it over and over again add "ao=oss" to your config file. (/home/$USER/.mplayer/config)<br />
<br />
== Other applications ==<br />
<br />
* If you can't get sound from an application not listed here, try looking at the [http://www.4front-tech.com/wiki/index.php/Configuring_Applications_for_OSSv4 Configuring Applications for OSSv4] page.<br />
* Search OSS specific packages by using {{Codeline|pacman -Ss -- '-oss'}} and [http://aur.archlinux.org/packages.php?K=-oss&start=0&PP=100| in AUR].<br />
<br />
= Troubleshooting =<br />
<br />
== Troubleshooting HDAudio devices ==<br />
<br />
=== Understanding why problems arise ===<br />
<br />
If you have a HDAudio sound device, it's very likely that you will have to adjust some mixer settings before your sound works.<br />
<br />
HDAudio devices are very powerful in the sense that they can contain a lot of small circuits (called ''widgets'') that can be adjusted by software at any time. These controls are exposed to the mixer, and they can be used, for example, to turn the earphone jack into a sound input jack instead of a sound output jack.<br />
<br />
However, there is a side effect, mainly because the HDAudio standard is more flexible than it perhaps should be, and because the vendors often only care to get their ''official drivers'' working.<br />
<br />
Then, when using HDAudio devices, you often find disorganized mixer controls, that doesn't work at all by default, and you are forced to try every mixer control combination, until it works.<br />
<br />
=== How to solve ===<br />
<br />
Open <tt>ossxmix</tt> and try to change every mixer control in the ''middle area'', that contains the sound card specific controls, as explained in the previous "[[OSS#The_mixer|The mixer]]" section.<br />
<br />
You'll probably want to setup a program to record/play continously in the background (e.g. {{Codeline|ossrecord - | ossplay -}} for recording or {{Codeline|osstest -lV}} for playing), while changing mixer settings in ossxmix in the foreground.<br />
<br />
* Raise every volume control slider.<br />
* In each option box, try to change the selected option, trying all the possible combinations.<br />
* If you get noise, try to lower and/or mute some volume controls, until you find the source of the noise.<br />
<br />
Please note again that you do '''not''' need to change any controls in the ''top area'' nor in the ''bottom area'', as they are virtual <tt>vmix</tt>-related mixer controls.<br />
<br />
* Editing {{Codeline|/usr/lib/oss/conf/oss_hdaudio.conf}} uncommenting and changing ''hdaudio_noskip=0'' to a value from 0-7 can give you more jack options in ossxmix<br />
I had to edit mine to ''hdaudio_noskip=7'' for my sub/rear speaker to work on my laptop, restart oss for the changes to take effect {{Codeline|/etc/rc.d/oss restart}}<br />
<br />
== MMS sound cracking in totem ==<br />
If your stream sounds with cracks or strange noise in totem like it did with me then you could try to play it with another backend like ffmpeg (mplayer). That "fixed" the issue for me. This will not fix the issue that somehow pops up in gstreamer when playing MMS streams but it will give you the option to play it with good sound quality. Playing it in mplayer is simple:<br />
# mplayer mmsh://yourstreamurl<br />
<br />
== Microphone playing through output channels ==<br />
<br />
OSS by default plays back the microphone through the speakers. To disable this in ossxmix find the misc section. Check off every "input-mix-mute" to disable this.<br />
<br />
== Troubleshooting other issues ==<br />
<br />
* If you get distorted sound, try lowering some volume control sliders.<br />
<br />
* If you need to change the default sound card, look at [http://www.opensound.com/wiki/index.php/Tips_And_Tricks#Changing_the_default_sound_output here].<br />
<br />
* If you have another issues, try searching or asking for help at the [http://www.4front-tech.com/forum 4front forums].<br />
<br />
= Tips and Tricks =<br />
<br />
== Using multimedia keys with OSS ==<br />
An easy way to mute/unmute and increase/decrease the volume is to use the [http://www.opensound.com/wiki/index.php/Tips_And_Tricks#ossvol {{Codeline|ossvol}} script] available in [[AUR]].<br />
<br />
Once you installed it try to toggle the sound:<br />
$ ossvol -t<br />
<br />
Type {{Codeline|ossvol -h}} for the other commands.<br />
<br />
If you don't know how to assign commands to your multimedia keys, see [[Extra Keyboard Keys]].<br />
<br />
==={{Codeline|ossvol}} troubleshooting===<br />
If you get an error like:<br />
Bad mixer control name(987) 'vol'<br />
you need to edit the script ({{Filename|/usr/bin/ossvol}}) and change the value of the {{Codeline|CHANNEL}} variable which is at the beginning of the script. For example mine is {{Codeline|CHANNEL<nowiki>=</nowiki>"vmix0-outvol"}}.<br />
<br />
*'''Note''' if you are using xbindkeys for your multimedia keys adding this<br />
"ossmix vmix0-outvol -- +1"<br />
raise volume<br />
"ossmix vmix0-outvol -- -1"<br />
lower volume<br />
<br />
to the raise/lower volume section of your .xbindkeysrc file is an easy way to adjust the volume<br />
<br />
== Changing the Sample Rate ==<br />
<br />
Changing the output sample rate is not obvious at first. Sample rates can only be changed by the superuser and vmix must be unused by any programs when a change is requested. Before you follow any of these steps, ensure you are going through a receiver/amplifier and using quality speakers and not simply computer speakers. If you are only using computer speakers, don't bother changing anything here as you won't notice a difference.<br />
<br />
By default the sample rate is 48000hz. There are several conditions in which you may want to change this. This all depends on your usage patterns. You want the sample rate you are using to match the media you use the most. If your computer has to change the sampling rate of the media to suit the hardware it is likely, though not guaranteed that you will have a loss in audio quality. This is most noticable in downsampling (ie. 96000hz &rarr; 48000hz). There is an article about this issue in [http://www.stereophile.com/news/121707lucky/ "Stereophile"] which was [http://lists.apple.com/archives/coreaudio-api/2008/Jan/msg00272.html discussed] on Apple's "CoreAudio API" mailing list if you wish to learn more about this issue. <br />
<br />
Some example sample rates:<br />
<br />
* 44100hz - Sample rate of standard [http://en.wikipedia.org/wiki/Red_Book_%28audio_CD_standard%29 Red Book] audio cds.<br />
* 88000hz - Sample rate of [http://en.wikipedia.org/wiki/Super_Audio_CD SACD] high definition audio discs/downloads. It is rare that your motherboard will support this sample rate.<br />
* 96000hz - Sample rate of most high definition audio downloads. If your motherboard is an [http://en.wikipedia.org/wiki/AC%2797 AC'97] motherboard, this is likely to be your highest bitrate.<br />
* 192000hz - Sample rate of BluRay, and some (very few) high definition downloads. Support for external audio reciever equipment is limited to high end audio. Not all motherboards support this. An example of a motherboard chipset that would support this includes [http://en.wikipedia.org/wiki/Intel_High_Definition_Audio Intel HDA audio]. <br />
<br />
To check what your sample rate is currently set to:<br />
<br />
# Run <code>"ossmix | grep rate"</code>. <br />
<br />
You are likely to see <code>"vmix0-rate <decimal value> (currently 48000) (Read-only)"</code>.<br />
<br />
If you do not see a "vmix0-rate" (or "vmix1-rate", etc.) being outputted, than it probably means that vmix is disabled. In that case, OSS will use the rate requested by the program which uses the device, so this section doesn't apply. Exception: envy24(ht) cards have a setting envy24.rate which has a similiar function (see "oss_envy24" manpage). You can follow these steps, but at step 2, change with ossmix the value of "envy24.rate" as well.<br />
<br />
Steps to affect the change:<br />
<br />
# First, make sure your card is able to use the new rate. Run "ossinfo -v2" and see if the wanted rate is in the "Native sample rates" output.<br />
# As root, run <code>"/usr/lib/oss/scripts/killprocs.sh"</code>. Be aware, this will close any program that currently has an open sound channel (examples being media players, Firefox as of 3.5 if you have xulrunner-oss installed, and the gnome volume control).<br />
# After all programs occupying vmix are terminated, run as root: <code>"vmixctl rate /dev/dsp 96000"</code> replacing the rate with your desired sample rate.<br />
# Run <code>"ossmix | grep rate"</code> and check for <code>"vmix0-rate <decimal value> (currently 96000) (Read-only)"</code> to see if you were successful.<br />
<br />
== Start ossxmix docked to systray on startup ==<br />
<br />
'''KDE 4'''<br />
<br />
Create an application launcher file named <code>ossxmix.desktop</code> in you local application launchers directory (<code>~/.local/share/applications/</code> then enter:<br />
<br />
<pre>[Desktop Entry]<br />
Name=Open Sound System Mixer<br />
GenericName=Audio Mixer<br />
Exec=ossxmix -b<br />
Icon=audio-card<br />
Categories=Application;GTK;AudioVideo;Player;<br />
Terminal=false<br />
Type=Application<br />
Encoding=UTF-8</pre><br />
<br />
To add it to autostart when loading the desktop environment:<br />
<br />
System Settings > Advanced tab > Autostart. Then click add program and choose it from the 'Multimedia' list.<br />
<br />
'''Gnome''' <br />
<br />
*As Root create a file /usr/local/bin/ossxmix_bg with the following content:<br />
<br />
<pre><br />
#!/bin/bash<br />
exec /usr/bin/ossxmix -b<br />
</pre><br />
<br />
Goto System > Preferences > Start Up Applications<br />
<br />
*Click Add, Type OSSMIX in Name field and <code>/usr/local/bin/ossxmix_bg</code> in Command field then click Add button.<br />
<br />
*Login and Logout to see the changes.<br />
<br />
== Record sound output from a program ==<br />
<br />
* [http://www.opensound.com/wiki/index.php/Tips_And_Tricks#Recording_sound_output_of_a_program Recording sound output of a program].<br />
<br />
== Suspend and Hibernation ==<br />
<br />
OSS does not automatically support suspend meaning that OSS must be manually stopped prior to suspending or hibernating.<br />
<br />
OSS provides <tt>soundon</tt> and <tt>soundoff</tt> to enable and disable OSS, although any processes that use sound must be terminated first.<br />
<br />
The following script is a rather basic method of automatically unloading OSS prior to suspending and reloading afterwards.<br />
<br />
#!/bin/sh<br />
. "${PM_FUNCTIONS}"<br />
<br />
suspend_osssound()<br />
{<br />
/usr/lib/oss/scripts/killprocs.sh<br />
/usr/sbin/soundoff<br />
}<br />
<br />
resume_osssound()<br />
{<br />
/usr/sbin/soundon<br />
}<br />
<br />
case "$1" in<br />
hibernate|suspend)<br />
suspend_osssound<br />
;;<br />
thaw|resume)<br />
resume_osssound<br />
;;<br />
*) exit $NA<br />
;;<br />
esac<br />
<br />
Save the contents of the script (as root) into {{Filename|/etc/pm/sleep.d/50ossound}} and make it executable. {{Filename| chmod a+x /etc/pm/sleep.d/50ossound}}<br />
<br />
{{Note|This script is rather basic and will terminate any application directly accessing OSS, save your work prior to suspending/hibernating.}}<br />
<br />
OSS does not support suspending but we don't care or better [http://wiki.archlinux.org/index.php/Suspend_to_RAM s2ram] works fine without stopping OSS.<br />
Just create a nice suspend script to /sbin/suspend and make it executable.<br />
<br />
<pre><br />
#!/bin/bash<br />
<br />
if [ [ $EUID -ne 0 ] ]; then<br />
## Checking if you are a root or not<br />
echo "This script must be run as root" 1>&2<br />
exit 1<br />
fi<br />
<br />
s2ram -f<br />
<br />
sleep 2<br />
<br />
/etc/rc.d/oss restart 2>/tmp/oss.txt<br />
<br />
if [ $? -gt 0 ]; then<br />
echo "OSS restart failed check /tmp/oss.txt for advice"<br />
fi<br />
<br />
exit 0<br />
</pre><br />
<br />
That's all your apps are fine and suspend works. \o/<br />
<br />
== ALSA emulation ==<br />
<br />
=== Introduction ===<br />
<br />
You can instruct <tt>alsa-lib</tt> to use OSS as its audio output system. This works as a sort of ALSA emulation.<br />
<br />
Note, however, that this method may introduce additional latency in your sound output, and that the emulation is not complete and doesn't work with all applications. It doesn't work, for example, with programs that try to detect devices using ALSA.<br />
<br />
So, as most applications support OSS directly, use this method only as a last resort.<br />
<br />
In the future, more complete methods may be available for emulating ALSA, such as <tt>libsalsa</tt> and <tt>cuckoo</tt>.<br />
<br />
=== HOW-TO ===<br />
<br />
* Install the <tt>alsa-plugins</tt> package.<br />
<br />
# pacman -S alsa-plugins<br />
<br />
* Edit {{Filename|/etc/asound.conf}} as follows.<br />
<br />
pcm.oss {<br />
type oss<br />
device /dev/dsp<br />
}<br />
<br />
pcm.!default {<br />
type oss<br />
device /dev/dsp<br />
}<br />
<br />
ctl.oss {<br />
type oss<br />
device /dev/mixer<br />
}<br />
<br />
ctl.!default {<br />
type oss<br />
device /dev/mixer<br />
}<br />
<br />
{{Note | If you don't want to use OSS anymore, don't forget to revert changes that you do here in {{Filename|/etc/asound.conf}}.}}<br />
<br />
= Experimental packages =<br />
<br />
== Mercurial repository version ==<br />
<br />
There is a [http://aur.archlinux.org/packages.php?ID=21126 oss-mercurial package] in AUR. This package compiles and installs the latest OSS development version direcly from the Mercurial repository.<br />
<br />
You can try this package if you want to contribute code to OSS or if only a very recent change in OSS code introduced support to your sound device.<br />
<br />
If you want oss to take care of your flash sound you will need to install libflashsupport:<br />
<br />
# pacman -S libflashsupport</div>Blohttps://wiki.archlinux.org/index.php?title=Open_Sound_System&diff=80895Open Sound System2009-10-28T19:42:26Z<p>Blo: /* Suspend and Hibernation */</p>
<hr />
<div>[[Category:Audio/Video (English)]]<br />
[[Category:HOWTOs (English)]]<br />
{{i18n_links_start}}<br />
{{i18n_entry|English|OSS}}<br />
{{i18n_entry|简体中文|OSS (简体中文)}}<br />
{{i18n_entry|Français|OSS (Français)}}<br />
{{i18n_entry|Türkçe|OSS (Türkçe)}}<br />
{{i18n_links_end}}<br />
<br />
= Introduction =<br />
The [http://developer.opensound.com Open Sound System] is a [http://4front-tech.com commercially-supported] sound architecture that works on several UNIX-like and POSIX-compatible systems, including Linux, FreeBSD, Solaris and BeOS/Haiku.<br />
<br />
Please note that this article is not about the old OSS, which is included in the Linux kernel sources and is more than 10 years old by now.<br />
<br />
This article is about the new OSS versions (often called OSSv4). These versions were previously proprietary - OSS became open source again in July 2007, and is currently available under GPL, BSD or CDDL licenses.<br />
<br />
= Advantages and disadvantages vs. ALSA =<br />
<br />
== Advantages over ALSA (for users) ==<br />
* Includes a transparent software mixer (vmix) in kernel space. This means multiple applications can access the sound device at the same time without problems.<br />
* The vmix mixer controls allow you to adjust the volume of each application individually.<br />
* Better support for some sound card models, for example for the Creative X-Fi.<br />
* Sound quality is usually better. '''reference needed to validate this statement'''<br />
* Better support for applications written for the OSS API, of course. The OSS API is widely spread and a lot of applications support it. The ALSA's OSS API emulation, however, is often buggy.<br />
<br />
== Advantages over ALSA (for developers) ==<br />
* Cleaner and easier to use API.<br />
* API is much better [http://manuals.opensound.com/developer documented].<br />
* Support for sound drivers in the userspace (oss_userdev).<br />
* Portability across all supported platforms. If the application works using OSS under Linux, it will work under FreeBSD and Solaris too, for example.<br />
* Portability across operating systems. It's [http://revolf.free.fr/Alchimie-7/Alchimie7_OSS_Haiku.en.pdf easier] to port OSS to a new operating system.<br />
<br />
== Disadvantages vs. ALSA ==<br />
* USB audio devices support is currently experimental and USB recording is not implemented.<br />
* Bluetooth audio devices are currently not supported.<br />
* AC'97 and HDAudio dial-up soft-modems (for example Si3055) are currently not supported.<br />
* MIDI support is currently not finished. However, you can still use MIDI with a software synthesizer like timidity or fluidsynth.<br />
* Suspend is currently not supported. You need to unload OSS (by using {{Codeline|soundoff}}) before suspending, and to reload OSS (by using {{Codeline|soundon}}) after resuming.<br />
* Automatic jack sensing currently doesn't work properly with '''some''' HDAudio-powered motherboards. This means that, depending on your motherboard model, you may have to manually switch off your speakers when plugging your earphone.<br />
<br />
= Installing =<br />
<br />
The OSS install script unload all ALSA modules automatically. If it fails for some reason to remove the modules issue the command: modprobe -r soundcore. You should balcklist the ALSA modules (to prevent them loading at boot) by editing {{Filename|/etc/rc.conf}} as described below. <br />
<br />
MODULES=(!soundcore ..............<br />
<br />
Install OSS by running:<br />
<br />
# pacman -S oss<br />
<br />
Be sure the user is part of the audio group:<br />
<br />
# gpasswd -a USERNAME audio<br />
<br />
Start OSS by running:<br />
<br />
# /etc/rc.d/oss start<br />
<br />
Add <tt>oss</tt> to your <tt>DAEMONS</tt> variable at {{Filename|/etc/rc.conf}}, so OSS is loaded automatically at each boot.<br />
<br />
In the case OSS is not able to detect your card when starting it, run :<br />
<br />
# ossdetect -v<br />
<br />
Then {{Codeline|soundoff && soundon}} to reactivate it.<br />
<br />
= Testing =<br />
<br />
You can test OSS by running:<br />
<br />
$ osstest<br />
<br />
{{Note| Beware the default volume is very loud. Avoid using earphones or lower the volume by using <tt>ossxmix</tt>. }}<br />
<br />
You should be able to hear music during the test process. If there is no audio, try to adjust the mixer as explained in the following sections and/or read the Troubleshooting sections.<br />
<br />
= Volume control =<br />
<br />
To control the volume of various devices, mixers levels will need to be set. The command line mixer is called <tt>ossmix</tt>. It's very like the BSD audio mixer (<tt>mixerctl</tt>).<br />
<br />
A graphical mixer, is available too. It's called <tt>ossxmix</tt>. It needs the optional depend <tt>gtk2</tt> to work.<br />
<br />
The <tt>ossxmix</tt> controls are explained in the following example:<br />
<br />
______________________________<br />
/ High Definition Audio ALC262 \ ----------------------------------> One tab for each sound card<br />
/________________________________\_______________________________<br />
|<br />
| [x] vmix0-enable [vmix0-rate: 48.000kHz] vmix0-channels \ The vmix (virtual mixer) special configurations<br />
| [ Stereo [v] ] |--> appear at the top. These include sampling rate<br />
| / and mixer priority. They are provided by OSS.<br />
| __codec1______________________________________________________ <br />
| | _jack_______________________________________________________ \ <br />
| | | _int-speaker____________________ __green_________________ |<br />
| | | | | | | These are your sound card configurations.<br />
| | | | _mode______ | | | | _mode______ | | | Every mixer control that is shown here is<br />
| | | | [ mix [v] ] o o [x] [ ]mute | | [ mix [v] ] o o [x] |--> provided by your sound card. Every sound card<br />
| | | | | | | | | | | specific control is shown here.<br />
| | | |________________________________| |_______________________ |<br />
| | |____________________________________________________________ |<br />
| |______________________________________________________________ /<br />
|<br />
| ___vmix0_______________________________________________________ \<br />
| | __mocp___ O O _firefox_ O O __pcm7___ O O | Here are the vmix mixer controls. These are<br />
| | | | O O | | x x | | O O | virtual mixer controls provided by OSS. Each<br />
| | | | | | x O | | | | x x | | | | O O | slider is the volume control of a different<br />
| | | o o [x] | x x | o o [x] | x x | o o [x] | O O |--> application. When one application uses the<br />
| | | | | | x x | | | | x x | | | | O O | sound card, its name is shown in the place of<br />
| | |_________| x x |_________| x x |_________| O O | the 'pcm#' labels. There are also sound level<br />
| |______________________________________________________________ | meter levels for each application.<br />
|________________________________________________________________ /<br />
<br />
=== Jack Definitions ===<br />
For high definition audio, ossxmix will highlight the jacks to their corresponding plug color. For 5.1 surround sound the [http://en.wikipedia.org/wiki/Audio_and_video_connector jack colors] are: <br />
{| border="1"<br />
|-<br />
! Connector Type<br />
! Purpose<br />
! OSS<br />
|- style=color:black;background:lightgreen<br />
|green TRS 3.5mm<br />
| stereo output, front channels<br />
|front<br />
|- style=color:white;background:black <br />
|black TRS 3.5mm<br />
| stereo output, rear channels<br />
|rear<br />
|- style=color:white;background:gray<br />
|grey TRS 3.5mm<br />
| stereo output, side channels<br />
|side<br />
|- style=color:black;background:gold<br />
|gold TRS 3.5mm<br />
| dual output, center and subwoofer<br />
|center/LFE<br />
|- style=color:black;background:lightblue<br />
|blue TRS 3.5mm<br />
| stereo input, line level<br />
|input<br />
|- style=color:black;background:pink <br />
|pink TS 3.5mm<br />
| mono microphone input<br />
|input<br />
|}<br />
For the most part and for most people just make sure that:<br />
# All green jacks (green and fp-green) are "front" and 75% from max volume.<br />
# All pink jacks (pink and fp-pink) are input and 50% of max to avoid distortion.<br />
<br />
== Other Mixers ==<br />
<br />
Other desktop environments may have support for OSS:<br />
<br />
* Gnome - Gnome Volume Control has support for OSS. Some users report that using Gnome Volume Control is easier to setup than <tt>ossxmix</tt>.<br />
* KDE - Kmix now has preliminary support for OSS.<br />
<br />
== Saving and restoring mixer settings ==<br />
<br />
If you wish to save your mixer settings manually, run {{Codeline|savemixer}}. As regular user you will need permissions to use {{Codeline|/usr/sbin/savemixer}} in the sudoers file or you can modify write permissions to {{Filename|/usr/lib/oss/etc/mixer.save}}. Alternately, the <tt>-f</tt> switch can be used to save the mixer to a file and {{Codeline|savemixer -L}} to restore it.<br />
<br />
Please note that the init scripts run these commands before shutdown/after starting to keep mixer settings across boot, so most users don't need to worry about it.<br />
<br />
= Configuring Applications for OSS =<br />
<br />
== Skype ==<br />
<br />
The <tt>skype</tt> package only includes support for ALSA. To get an OSS-capable Skype, install the <tt>skype-oss</tt> package:<br />
<br />
# pacman -S skype-oss<br />
<br />
If you are using x86_64, you can get the [http://aur.archlinux.org/packages.php?ID=18312 bin32-skype-oss] package from AUR.<br />
<br />
== Wine ==<br />
<br />
* Run <tt>winecfg</tt>.<br />
<br />
$ winecfg<br />
<br />
* Go to the <tt>Audio</tt> tab.<br />
<br />
* Select <tt>OSS Driver</tt>.<br />
<br />
== Gajim ==<br />
By default Gajim uses {{Codeline|aplay -q}} to play a sound. To change this go in Advanced Settings and search for the {{Codeline|soundplayer}} variable. The ossplay program included in the oss package is a good replacement:<br />
<br />
{{Codeline|ossplay -qq}}<br />
<br />
== MOC ==<br />
<br />
To use MOC with OSS v4.1 you must change section OSSMixerDevice to OSSMixerDevice= /dev/ossmix in your config (located in /home/yourusername/.moc).<br />
And now MOC should work with OSS v4.1.<br />
Or you can compile moc-svn package from AUR (he got support for new vmix).<br />
For issue with interface change OSSMixerChannel = to OSSMixerChannel = Any channel and after start mocp press w (change to sofware mixex) that will help and you can change the volume power.<br />
<br />
== Applications that use Gstreamer ==<br />
<br />
Remove pulseaudio and gstreamer*-pulse programs and libraries.<br />
<br />
To change the gstreamer setting to output the sound to OSS instead of the default ALSA, run:<br />
<br />
gstreamer-properties<br />
<br />
Change the '''Default Output''' plugin to custom and the change the pipeline to:<br />
<br />
oss4sink<br />
<br />
For the input:<br />
<br />
oss4src<br />
<br />
{{Note|It's not certain that the input will sound better with oss4src compared to osssrc, so change this only if it improves your input sound. < confirmation on this please >}}<br />
<br />
If you are using phonon with the gstreamer backend you will need to set the environmental variable. To add to your current user:<br />
<br />
export PHONON_GST_AUDIOSINK=oss4sink<br />
<br />
Add this to your {{Filename|~/.bashrc}} to be loaded on login.<br />
<br />
== Firefox >=3.5 ==<br />
<br />
Firefox 3.5 introduces the <video> and <audio> tag support and can play ogg media out of the box. However, it currently can't be compiled with ALSA and OSS support at the same time. So you need to install the [http://aur.archlinux.org/packages.php?ID=28110 xulrunner-oss] package.<br />
<br />
1. Stop firefox.<br />
2. Remove the xulrunner package without dependency check: sudo pacman -Rd xulrunner<br />
3. Install xulrunner-oss package from AUR using yaourt or [http://wiki.archlinux.org/index.php/ABS ABS].<br />
4. Start firefox.<br />
<br />
== Mplayer ==<br />
<br />
If you are using gui (smplayer etc.) you will find the oss output at the audio settings. Using on cli you should specify the sound output: mplayer -ao oss /some/file/to/play.mkv If you don't want to brother typing it over and over again add "ao=oss" to your config file. (/home/$USER/.mplayer/config)<br />
<br />
== Other applications ==<br />
<br />
* If you can't get sound from an application not listed here, try looking at the [http://www.4front-tech.com/wiki/index.php/Configuring_Applications_for_OSSv4 Configuring Applications for OSSv4] page.<br />
* Search OSS specific packages by using {{Codeline|pacman -Ss -- '-oss'}} and [http://aur.archlinux.org/packages.php?K=-oss&start=0&PP=100| in AUR].<br />
<br />
= Troubleshooting =<br />
<br />
== Troubleshooting HDAudio devices ==<br />
<br />
=== Understanding why problems arise ===<br />
<br />
If you have a HDAudio sound device, it's very likely that you will have to adjust some mixer settings before your sound works.<br />
<br />
HDAudio devices are very powerful in the sense that they can contain a lot of small circuits (called ''widgets'') that can be adjusted by software at any time. These controls are exposed to the mixer, and they can be used, for example, to turn the earphone jack into a sound input jack instead of a sound output jack.<br />
<br />
However, there is a side effect, mainly because the HDAudio standard is more flexible than it perhaps should be, and because the vendors often only care to get their ''official drivers'' working.<br />
<br />
Then, when using HDAudio devices, you often find disorganized mixer controls, that doesn't work at all by default, and you are forced to try every mixer control combination, until it works.<br />
<br />
=== How to solve ===<br />
<br />
Open <tt>ossxmix</tt> and try to change every mixer control in the ''middle area'', that contains the sound card specific controls, as explained in the previous "[[OSS#The_mixer|The mixer]]" section.<br />
<br />
You'll probably want to setup a program to record/play continously in the background (e.g. {{Codeline|ossrecord - | ossplay -}} for recording or {{Codeline|osstest -lV}} for playing), while changing mixer settings in ossxmix in the foreground.<br />
<br />
* Raise every volume control slider.<br />
* In each option box, try to change the selected option, trying all the possible combinations.<br />
* If you get noise, try to lower and/or mute some volume controls, until you find the source of the noise.<br />
<br />
Please note again that you do '''not''' need to change any controls in the ''top area'' nor in the ''bottom area'', as they are virtual <tt>vmix</tt>-related mixer controls.<br />
<br />
* Editing {{Codeline|/usr/lib/oss/conf/oss_hdaudio.conf}} uncommenting and changing ''hdaudio_noskip=0'' to a value from 0-7 can give you more jack options in ossxmix<br />
I had to edit mine to ''hdaudio_noskip=7'' for my sub/rear speaker to work on my laptop, restart oss for the changes to take effect {{Codeline|/etc/rc.d/oss restart}}<br />
<br />
== MMS sound cracking in totem ==<br />
If your stream sounds with cracks or strange noise in totem like it did with me then you could try to play it with another backend like ffmpeg (mplayer). That "fixed" the issue for me. This will not fix the issue that somehow pops up in gstreamer when playing MMS streams but it will give you the option to play it with good sound quality. Playing it in mplayer is simple:<br />
# mplayer mmsh://yourstreamurl<br />
<br />
== Microphone playing through output channels ==<br />
<br />
OSS by default plays back the microphone through the speakers. To disable this in ossxmix find the misc section. Check off every "input-mix-mute" to disable this.<br />
<br />
== Troubleshooting other issues ==<br />
<br />
* If you get distorted sound, try lowering some volume control sliders.<br />
<br />
* If you need to change the default sound card, look at [http://www.opensound.com/wiki/index.php/Tips_And_Tricks#Changing_the_default_sound_output here].<br />
<br />
* If you have another issues, try searching or asking for help at the [http://www.4front-tech.com/forum 4front forums].<br />
<br />
= Tips and Tricks =<br />
<br />
== Using multimedia keys with OSS ==<br />
An easy way to mute/unmute and increase/decrease the volume is to use the [http://www.opensound.com/wiki/index.php/Tips_And_Tricks#ossvol {{Codeline|ossvol}} script] available in [[AUR]].<br />
<br />
Once you installed it try to toggle the sound:<br />
$ ossvol -t<br />
<br />
Type {{Codeline|ossvol -h}} for the other commands.<br />
<br />
If you don't know how to assign commands to your multimedia keys, see [[Extra Keyboard Keys]].<br />
<br />
==={{Codeline|ossvol}} troubleshooting===<br />
If you get an error like:<br />
Bad mixer control name(987) 'vol'<br />
you need to edit the script ({{Filename|/usr/bin/ossvol}}) and change the value of the {{Codeline|CHANNEL}} variable which is at the beginning of the script. For example mine is {{Codeline|CHANNEL<nowiki>=</nowiki>"vmix0-outvol"}}.<br />
<br />
*'''Note''' if you are using xbindkeys for your multimedia keys adding this<br />
"ossmix vmix0-outvol -- +1"<br />
raise volume<br />
"ossmix vmix0-outvol -- -1"<br />
lower volume<br />
<br />
to the raise/lower volume section of your .xbindkeysrc file is an easy way to adjust the volume<br />
<br />
== Changing the Sample Rate ==<br />
<br />
Changing the output sample rate is not obvious at first. Sample rates can only be changed by the superuser and vmix must be unused by any programs when a change is requested. Before you follow any of these steps, ensure you are going through a receiver/amplifier and using quality speakers and not simply computer speakers. If you are only using computer speakers, don't bother changing anything here as you won't notice a difference.<br />
<br />
By default the sample rate is 48000hz. There are several conditions in which you may want to change this. This all depends on your usage patterns. You want the sample rate you are using to match the media you use the most. If your computer has to change the sampling rate of the media to suit the hardware it is likely, though not guaranteed that you will have a loss in audio quality. This is most noticable in downsampling (ie. 96000hz &rarr; 48000hz). There is an article about this issue in [http://www.stereophile.com/news/121707lucky/ "Stereophile"] which was [http://lists.apple.com/archives/coreaudio-api/2008/Jan/msg00272.html discussed] on Apple's "CoreAudio API" mailing list if you wish to learn more about this issue. <br />
<br />
Some example sample rates:<br />
<br />
* 44100hz - Sample rate of standard [http://en.wikipedia.org/wiki/Red_Book_%28audio_CD_standard%29 Red Book] audio cds.<br />
* 88000hz - Sample rate of [http://en.wikipedia.org/wiki/Super_Audio_CD SACD] high definition audio discs/downloads. It is rare that your motherboard will support this sample rate.<br />
* 96000hz - Sample rate of most high definition audio downloads. If your motherboard is an [http://en.wikipedia.org/wiki/AC%2797 AC'97] motherboard, this is likely to be your highest bitrate.<br />
* 192000hz - Sample rate of BluRay, and some (very few) high definition downloads. Support for external audio reciever equipment is limited to high end audio. Not all motherboards support this. An example of a motherboard chipset that would support this includes [http://en.wikipedia.org/wiki/Intel_High_Definition_Audio Intel HDA audio]. <br />
<br />
To check what your sample rate is currently set to:<br />
<br />
# Run <code>"ossmix | grep rate"</code>. <br />
<br />
You are likely to see <code>"vmix0-rate <decimal value> (currently 48000) (Read-only)"</code>.<br />
<br />
If you do not see a "vmix0-rate" (or "vmix1-rate", etc.) being outputted, than it probably means that vmix is disabled. In that case, OSS will use the rate requested by the program which uses the device, so this section doesn't apply. Exception: envy24(ht) cards have a setting envy24.rate which has a similiar function (see "oss_envy24" manpage). You can follow these steps, but at step 2, change with ossmix the value of "envy24.rate" as well.<br />
<br />
Steps to affect the change:<br />
<br />
# First, make sure your card is able to use the new rate. Run "ossinfo -v2" and see if the wanted rate is in the "Native sample rates" output.<br />
# As root, run <code>"/usr/lib/oss/scripts/killprocs.sh"</code>. Be aware, this will close any program that currently has an open sound channel (examples being media players, Firefox as of 3.5 if you have xulrunner-oss installed, and the gnome volume control).<br />
# After all programs occupying vmix are terminated, run as root: <code>"vmixctl rate /dev/dsp 96000"</code> replacing the rate with your desired sample rate.<br />
# Run <code>"ossmix | grep rate"</code> and check for <code>"vmix0-rate <decimal value> (currently 96000) (Read-only)"</code> to see if you were successful.<br />
<br />
== Start ossxmix docked to systray on startup ==<br />
<br />
'''KDE 4'''<br />
<br />
Create an application launcher file named <code>ossxmix.desktop</code> in you local application launchers directory (<code>~/.local/share/applications/</code> then enter:<br />
<br />
<pre>[Desktop Entry]<br />
Name=Open Sound System Mixer<br />
GenericName=Audio Mixer<br />
Exec=ossxmix -b<br />
Icon=audio-card<br />
Categories=Application;GTK;AudioVideo;Player;<br />
Terminal=false<br />
Type=Application<br />
Encoding=UTF-8</pre><br />
<br />
To add it to autostart when loading the desktop environment:<br />
<br />
System Settings > Advanced tab > Autostart. Then click add program and choose it from the 'Multimedia' list.<br />
<br />
'''Gnome''' <br />
<br />
*As Root create a file /usr/local/bin/ossxmix_bg with the following content:<br />
<br />
<pre><br />
#!/bin/bash<br />
exec /usr/bin/ossxmix -b<br />
</pre><br />
<br />
Goto System > Preferences > Start Up Applications<br />
<br />
*Click Add, Type OSSMIX in Name field and <code>/usr/local/bin/ossxmix_bg</code> in Command field then click Add button.<br />
<br />
*Login and Logout to see the changes.<br />
<br />
== Record sound output from a program ==<br />
<br />
* [http://www.opensound.com/wiki/index.php/Tips_And_Tricks#Recording_sound_output_of_a_program Recording sound output of a program].<br />
<br />
== Suspend and Hibernation ==<br />
<br />
OSS does not automatically support suspend meaning that OSS must be manually stopped prior to suspending or hibernating.<br />
<br />
OSS provides <tt>soundon</tt> and <tt>soundoff</tt> to enable and disable OSS, although any processes that use sound must be terminated first.<br />
<br />
The following script is a rather basic method of automatically unloading OSS prior to suspending and reloading afterwards.<br />
<br />
#!/bin/sh<br />
. "${PM_FUNCTIONS}"<br />
<br />
suspend_osssound()<br />
{<br />
/usr/lib/oss/scripts/killprocs.sh<br />
/usr/sbin/soundoff<br />
}<br />
<br />
resume_osssound()<br />
{<br />
/usr/sbin/soundon<br />
}<br />
<br />
case "$1" in<br />
hibernate|suspend)<br />
suspend_osssound<br />
;;<br />
thaw|resume)<br />
resume_osssound<br />
;;<br />
*) exit $NA<br />
;;<br />
esac<br />
<br />
Save the contents of the script (as root) into {{Filename|/etc/pm/sleep.d/50ossound}} and make it executable. {{Filename| chmod a+x /etc/pm/sleep.d/50ossound}}<br />
<br />
{{Note|This script is rather basic and will terminate any application directly accessing OSS, save your work prior to suspending/hibernating.}}<br />
<br />
OSS does not support suspending but we don't care or better [http://wiki.archlinux.org/index.php/Suspend_to_RAM s2ram] works fine without stopping OSS.<br />
Just create a nice suspend script to /sbin/suspend and make it executable.<br />
<br />
#!/bin/bash<br />
<br />
if [ [ $EUID -ne 0 ] ]; then<br />
## Checking if you are a root or not<br />
echo "This script must be run as root" 1>&2<br />
exit 1<br />
fi<br />
<br />
s2ram -f<br />
<br />
sleep 2<br />
<br />
/etc/rc.d/oss restart 2>/tmp/oss.txt<br />
<br />
if [ $? -gt 0 ]; then<br />
echo "OSS restart failed check /tmp/oss.txt for advice"<br />
fi<br />
<br />
exit 0<br />
<br />
<br />
That's all your apps are fine and suspend works. \o/<br />
<br />
== ALSA emulation ==<br />
<br />
=== Introduction ===<br />
<br />
You can instruct <tt>alsa-lib</tt> to use OSS as its audio output system. This works as a sort of ALSA emulation.<br />
<br />
Note, however, that this method may introduce additional latency in your sound output, and that the emulation is not complete and doesn't work with all applications. It doesn't work, for example, with programs that try to detect devices using ALSA.<br />
<br />
So, as most applications support OSS directly, use this method only as a last resort.<br />
<br />
In the future, more complete methods may be available for emulating ALSA, such as <tt>libsalsa</tt> and <tt>cuckoo</tt>.<br />
<br />
=== HOW-TO ===<br />
<br />
* Install the <tt>alsa-plugins</tt> package.<br />
<br />
# pacman -S alsa-plugins<br />
<br />
* Edit {{Filename|/etc/asound.conf}} as follows.<br />
<br />
pcm.oss {<br />
type oss<br />
device /dev/dsp<br />
}<br />
<br />
pcm.!default {<br />
type oss<br />
device /dev/dsp<br />
}<br />
<br />
ctl.oss {<br />
type oss<br />
device /dev/mixer<br />
}<br />
<br />
ctl.!default {<br />
type oss<br />
device /dev/mixer<br />
}<br />
<br />
{{Note | If you don't want to use OSS anymore, don't forget to revert changes that you do here in {{Filename|/etc/asound.conf}}.}}<br />
<br />
= Experimental packages =<br />
<br />
== Mercurial repository version ==<br />
<br />
There is a [http://aur.archlinux.org/packages.php?ID=21126 oss-mercurial package] in AUR. This package compiles and installs the latest OSS development version direcly from the Mercurial repository.<br />
<br />
You can try this package if you want to contribute code to OSS or if only a very recent change in OSS code introduced support to your sound device.<br />
<br />
If you want oss to take care of your flash sound you will need to install libflashsupport:<br />
<br />
# pacman -S libflashsupport</div>Blohttps://wiki.archlinux.org/index.php?title=Open_Sound_System&diff=80894Open Sound System2009-10-28T19:41:53Z<p>Blo: /* Suspend and Hibernation */</p>
<hr />
<div>[[Category:Audio/Video (English)]]<br />
[[Category:HOWTOs (English)]]<br />
{{i18n_links_start}}<br />
{{i18n_entry|English|OSS}}<br />
{{i18n_entry|简体中文|OSS (简体中文)}}<br />
{{i18n_entry|Français|OSS (Français)}}<br />
{{i18n_entry|Türkçe|OSS (Türkçe)}}<br />
{{i18n_links_end}}<br />
<br />
= Introduction =<br />
The [http://developer.opensound.com Open Sound System] is a [http://4front-tech.com commercially-supported] sound architecture that works on several UNIX-like and POSIX-compatible systems, including Linux, FreeBSD, Solaris and BeOS/Haiku.<br />
<br />
Please note that this article is not about the old OSS, which is included in the Linux kernel sources and is more than 10 years old by now.<br />
<br />
This article is about the new OSS versions (often called OSSv4). These versions were previously proprietary - OSS became open source again in July 2007, and is currently available under GPL, BSD or CDDL licenses.<br />
<br />
= Advantages and disadvantages vs. ALSA =<br />
<br />
== Advantages over ALSA (for users) ==<br />
* Includes a transparent software mixer (vmix) in kernel space. This means multiple applications can access the sound device at the same time without problems.<br />
* The vmix mixer controls allow you to adjust the volume of each application individually.<br />
* Better support for some sound card models, for example for the Creative X-Fi.<br />
* Sound quality is usually better. '''reference needed to validate this statement'''<br />
* Better support for applications written for the OSS API, of course. The OSS API is widely spread and a lot of applications support it. The ALSA's OSS API emulation, however, is often buggy.<br />
<br />
== Advantages over ALSA (for developers) ==<br />
* Cleaner and easier to use API.<br />
* API is much better [http://manuals.opensound.com/developer documented].<br />
* Support for sound drivers in the userspace (oss_userdev).<br />
* Portability across all supported platforms. If the application works using OSS under Linux, it will work under FreeBSD and Solaris too, for example.<br />
* Portability across operating systems. It's [http://revolf.free.fr/Alchimie-7/Alchimie7_OSS_Haiku.en.pdf easier] to port OSS to a new operating system.<br />
<br />
== Disadvantages vs. ALSA ==<br />
* USB audio devices support is currently experimental and USB recording is not implemented.<br />
* Bluetooth audio devices are currently not supported.<br />
* AC'97 and HDAudio dial-up soft-modems (for example Si3055) are currently not supported.<br />
* MIDI support is currently not finished. However, you can still use MIDI with a software synthesizer like timidity or fluidsynth.<br />
* Suspend is currently not supported. You need to unload OSS (by using {{Codeline|soundoff}}) before suspending, and to reload OSS (by using {{Codeline|soundon}}) after resuming.<br />
* Automatic jack sensing currently doesn't work properly with '''some''' HDAudio-powered motherboards. This means that, depending on your motherboard model, you may have to manually switch off your speakers when plugging your earphone.<br />
<br />
= Installing =<br />
<br />
The OSS install script unload all ALSA modules automatically. If it fails for some reason to remove the modules issue the command: modprobe -r soundcore. You should balcklist the ALSA modules (to prevent them loading at boot) by editing {{Filename|/etc/rc.conf}} as described below. <br />
<br />
MODULES=(!soundcore ..............<br />
<br />
Install OSS by running:<br />
<br />
# pacman -S oss<br />
<br />
Be sure the user is part of the audio group:<br />
<br />
# gpasswd -a USERNAME audio<br />
<br />
Start OSS by running:<br />
<br />
# /etc/rc.d/oss start<br />
<br />
Add <tt>oss</tt> to your <tt>DAEMONS</tt> variable at {{Filename|/etc/rc.conf}}, so OSS is loaded automatically at each boot.<br />
<br />
In the case OSS is not able to detect your card when starting it, run :<br />
<br />
# ossdetect -v<br />
<br />
Then {{Codeline|soundoff && soundon}} to reactivate it.<br />
<br />
= Testing =<br />
<br />
You can test OSS by running:<br />
<br />
$ osstest<br />
<br />
{{Note| Beware the default volume is very loud. Avoid using earphones or lower the volume by using <tt>ossxmix</tt>. }}<br />
<br />
You should be able to hear music during the test process. If there is no audio, try to adjust the mixer as explained in the following sections and/or read the Troubleshooting sections.<br />
<br />
= Volume control =<br />
<br />
To control the volume of various devices, mixers levels will need to be set. The command line mixer is called <tt>ossmix</tt>. It's very like the BSD audio mixer (<tt>mixerctl</tt>).<br />
<br />
A graphical mixer, is available too. It's called <tt>ossxmix</tt>. It needs the optional depend <tt>gtk2</tt> to work.<br />
<br />
The <tt>ossxmix</tt> controls are explained in the following example:<br />
<br />
______________________________<br />
/ High Definition Audio ALC262 \ ----------------------------------> One tab for each sound card<br />
/________________________________\_______________________________<br />
|<br />
| [x] vmix0-enable [vmix0-rate: 48.000kHz] vmix0-channels \ The vmix (virtual mixer) special configurations<br />
| [ Stereo [v] ] |--> appear at the top. These include sampling rate<br />
| / and mixer priority. They are provided by OSS.<br />
| __codec1______________________________________________________ <br />
| | _jack_______________________________________________________ \ <br />
| | | _int-speaker____________________ __green_________________ |<br />
| | | | | | | These are your sound card configurations.<br />
| | | | _mode______ | | | | _mode______ | | | Every mixer control that is shown here is<br />
| | | | [ mix [v] ] o o [x] [ ]mute | | [ mix [v] ] o o [x] |--> provided by your sound card. Every sound card<br />
| | | | | | | | | | | specific control is shown here.<br />
| | | |________________________________| |_______________________ |<br />
| | |____________________________________________________________ |<br />
| |______________________________________________________________ /<br />
|<br />
| ___vmix0_______________________________________________________ \<br />
| | __mocp___ O O _firefox_ O O __pcm7___ O O | Here are the vmix mixer controls. These are<br />
| | | | O O | | x x | | O O | virtual mixer controls provided by OSS. Each<br />
| | | | | | x O | | | | x x | | | | O O | slider is the volume control of a different<br />
| | | o o [x] | x x | o o [x] | x x | o o [x] | O O |--> application. When one application uses the<br />
| | | | | | x x | | | | x x | | | | O O | sound card, its name is shown in the place of<br />
| | |_________| x x |_________| x x |_________| O O | the 'pcm#' labels. There are also sound level<br />
| |______________________________________________________________ | meter levels for each application.<br />
|________________________________________________________________ /<br />
<br />
=== Jack Definitions ===<br />
For high definition audio, ossxmix will highlight the jacks to their corresponding plug color. For 5.1 surround sound the [http://en.wikipedia.org/wiki/Audio_and_video_connector jack colors] are: <br />
{| border="1"<br />
|-<br />
! Connector Type<br />
! Purpose<br />
! OSS<br />
|- style=color:black;background:lightgreen<br />
|green TRS 3.5mm<br />
| stereo output, front channels<br />
|front<br />
|- style=color:white;background:black <br />
|black TRS 3.5mm<br />
| stereo output, rear channels<br />
|rear<br />
|- style=color:white;background:gray<br />
|grey TRS 3.5mm<br />
| stereo output, side channels<br />
|side<br />
|- style=color:black;background:gold<br />
|gold TRS 3.5mm<br />
| dual output, center and subwoofer<br />
|center/LFE<br />
|- style=color:black;background:lightblue<br />
|blue TRS 3.5mm<br />
| stereo input, line level<br />
|input<br />
|- style=color:black;background:pink <br />
|pink TS 3.5mm<br />
| mono microphone input<br />
|input<br />
|}<br />
For the most part and for most people just make sure that:<br />
# All green jacks (green and fp-green) are "front" and 75% from max volume.<br />
# All pink jacks (pink and fp-pink) are input and 50% of max to avoid distortion.<br />
<br />
== Other Mixers ==<br />
<br />
Other desktop environments may have support for OSS:<br />
<br />
* Gnome - Gnome Volume Control has support for OSS. Some users report that using Gnome Volume Control is easier to setup than <tt>ossxmix</tt>.<br />
* KDE - Kmix now has preliminary support for OSS.<br />
<br />
== Saving and restoring mixer settings ==<br />
<br />
If you wish to save your mixer settings manually, run {{Codeline|savemixer}}. As regular user you will need permissions to use {{Codeline|/usr/sbin/savemixer}} in the sudoers file or you can modify write permissions to {{Filename|/usr/lib/oss/etc/mixer.save}}. Alternately, the <tt>-f</tt> switch can be used to save the mixer to a file and {{Codeline|savemixer -L}} to restore it.<br />
<br />
Please note that the init scripts run these commands before shutdown/after starting to keep mixer settings across boot, so most users don't need to worry about it.<br />
<br />
= Configuring Applications for OSS =<br />
<br />
== Skype ==<br />
<br />
The <tt>skype</tt> package only includes support for ALSA. To get an OSS-capable Skype, install the <tt>skype-oss</tt> package:<br />
<br />
# pacman -S skype-oss<br />
<br />
If you are using x86_64, you can get the [http://aur.archlinux.org/packages.php?ID=18312 bin32-skype-oss] package from AUR.<br />
<br />
== Wine ==<br />
<br />
* Run <tt>winecfg</tt>.<br />
<br />
$ winecfg<br />
<br />
* Go to the <tt>Audio</tt> tab.<br />
<br />
* Select <tt>OSS Driver</tt>.<br />
<br />
== Gajim ==<br />
By default Gajim uses {{Codeline|aplay -q}} to play a sound. To change this go in Advanced Settings and search for the {{Codeline|soundplayer}} variable. The ossplay program included in the oss package is a good replacement:<br />
<br />
{{Codeline|ossplay -qq}}<br />
<br />
== MOC ==<br />
<br />
To use MOC with OSS v4.1 you must change section OSSMixerDevice to OSSMixerDevice= /dev/ossmix in your config (located in /home/yourusername/.moc).<br />
And now MOC should work with OSS v4.1.<br />
Or you can compile moc-svn package from AUR (he got support for new vmix).<br />
For issue with interface change OSSMixerChannel = to OSSMixerChannel = Any channel and after start mocp press w (change to sofware mixex) that will help and you can change the volume power.<br />
<br />
== Applications that use Gstreamer ==<br />
<br />
Remove pulseaudio and gstreamer*-pulse programs and libraries.<br />
<br />
To change the gstreamer setting to output the sound to OSS instead of the default ALSA, run:<br />
<br />
gstreamer-properties<br />
<br />
Change the '''Default Output''' plugin to custom and the change the pipeline to:<br />
<br />
oss4sink<br />
<br />
For the input:<br />
<br />
oss4src<br />
<br />
{{Note|It's not certain that the input will sound better with oss4src compared to osssrc, so change this only if it improves your input sound. < confirmation on this please >}}<br />
<br />
If you are using phonon with the gstreamer backend you will need to set the environmental variable. To add to your current user:<br />
<br />
export PHONON_GST_AUDIOSINK=oss4sink<br />
<br />
Add this to your {{Filename|~/.bashrc}} to be loaded on login.<br />
<br />
== Firefox >=3.5 ==<br />
<br />
Firefox 3.5 introduces the <video> and <audio> tag support and can play ogg media out of the box. However, it currently can't be compiled with ALSA and OSS support at the same time. So you need to install the [http://aur.archlinux.org/packages.php?ID=28110 xulrunner-oss] package.<br />
<br />
1. Stop firefox.<br />
2. Remove the xulrunner package without dependency check: sudo pacman -Rd xulrunner<br />
3. Install xulrunner-oss package from AUR using yaourt or [http://wiki.archlinux.org/index.php/ABS ABS].<br />
4. Start firefox.<br />
<br />
== Mplayer ==<br />
<br />
If you are using gui (smplayer etc.) you will find the oss output at the audio settings. Using on cli you should specify the sound output: mplayer -ao oss /some/file/to/play.mkv If you don't want to brother typing it over and over again add "ao=oss" to your config file. (/home/$USER/.mplayer/config)<br />
<br />
== Other applications ==<br />
<br />
* If you can't get sound from an application not listed here, try looking at the [http://www.4front-tech.com/wiki/index.php/Configuring_Applications_for_OSSv4 Configuring Applications for OSSv4] page.<br />
* Search OSS specific packages by using {{Codeline|pacman -Ss -- '-oss'}} and [http://aur.archlinux.org/packages.php?K=-oss&start=0&PP=100| in AUR].<br />
<br />
= Troubleshooting =<br />
<br />
== Troubleshooting HDAudio devices ==<br />
<br />
=== Understanding why problems arise ===<br />
<br />
If you have a HDAudio sound device, it's very likely that you will have to adjust some mixer settings before your sound works.<br />
<br />
HDAudio devices are very powerful in the sense that they can contain a lot of small circuits (called ''widgets'') that can be adjusted by software at any time. These controls are exposed to the mixer, and they can be used, for example, to turn the earphone jack into a sound input jack instead of a sound output jack.<br />
<br />
However, there is a side effect, mainly because the HDAudio standard is more flexible than it perhaps should be, and because the vendors often only care to get their ''official drivers'' working.<br />
<br />
Then, when using HDAudio devices, you often find disorganized mixer controls, that doesn't work at all by default, and you are forced to try every mixer control combination, until it works.<br />
<br />
=== How to solve ===<br />
<br />
Open <tt>ossxmix</tt> and try to change every mixer control in the ''middle area'', that contains the sound card specific controls, as explained in the previous "[[OSS#The_mixer|The mixer]]" section.<br />
<br />
You'll probably want to setup a program to record/play continously in the background (e.g. {{Codeline|ossrecord - | ossplay -}} for recording or {{Codeline|osstest -lV}} for playing), while changing mixer settings in ossxmix in the foreground.<br />
<br />
* Raise every volume control slider.<br />
* In each option box, try to change the selected option, trying all the possible combinations.<br />
* If you get noise, try to lower and/or mute some volume controls, until you find the source of the noise.<br />
<br />
Please note again that you do '''not''' need to change any controls in the ''top area'' nor in the ''bottom area'', as they are virtual <tt>vmix</tt>-related mixer controls.<br />
<br />
* Editing {{Codeline|/usr/lib/oss/conf/oss_hdaudio.conf}} uncommenting and changing ''hdaudio_noskip=0'' to a value from 0-7 can give you more jack options in ossxmix<br />
I had to edit mine to ''hdaudio_noskip=7'' for my sub/rear speaker to work on my laptop, restart oss for the changes to take effect {{Codeline|/etc/rc.d/oss restart}}<br />
<br />
== MMS sound cracking in totem ==<br />
If your stream sounds with cracks or strange noise in totem like it did with me then you could try to play it with another backend like ffmpeg (mplayer). That "fixed" the issue for me. This will not fix the issue that somehow pops up in gstreamer when playing MMS streams but it will give you the option to play it with good sound quality. Playing it in mplayer is simple:<br />
# mplayer mmsh://yourstreamurl<br />
<br />
== Microphone playing through output channels ==<br />
<br />
OSS by default plays back the microphone through the speakers. To disable this in ossxmix find the misc section. Check off every "input-mix-mute" to disable this.<br />
<br />
== Troubleshooting other issues ==<br />
<br />
* If you get distorted sound, try lowering some volume control sliders.<br />
<br />
* If you need to change the default sound card, look at [http://www.opensound.com/wiki/index.php/Tips_And_Tricks#Changing_the_default_sound_output here].<br />
<br />
* If you have another issues, try searching or asking for help at the [http://www.4front-tech.com/forum 4front forums].<br />
<br />
= Tips and Tricks =<br />
<br />
== Using multimedia keys with OSS ==<br />
An easy way to mute/unmute and increase/decrease the volume is to use the [http://www.opensound.com/wiki/index.php/Tips_And_Tricks#ossvol {{Codeline|ossvol}} script] available in [[AUR]].<br />
<br />
Once you installed it try to toggle the sound:<br />
$ ossvol -t<br />
<br />
Type {{Codeline|ossvol -h}} for the other commands.<br />
<br />
If you don't know how to assign commands to your multimedia keys, see [[Extra Keyboard Keys]].<br />
<br />
==={{Codeline|ossvol}} troubleshooting===<br />
If you get an error like:<br />
Bad mixer control name(987) 'vol'<br />
you need to edit the script ({{Filename|/usr/bin/ossvol}}) and change the value of the {{Codeline|CHANNEL}} variable which is at the beginning of the script. For example mine is {{Codeline|CHANNEL<nowiki>=</nowiki>"vmix0-outvol"}}.<br />
<br />
*'''Note''' if you are using xbindkeys for your multimedia keys adding this<br />
"ossmix vmix0-outvol -- +1"<br />
raise volume<br />
"ossmix vmix0-outvol -- -1"<br />
lower volume<br />
<br />
to the raise/lower volume section of your .xbindkeysrc file is an easy way to adjust the volume<br />
<br />
== Changing the Sample Rate ==<br />
<br />
Changing the output sample rate is not obvious at first. Sample rates can only be changed by the superuser and vmix must be unused by any programs when a change is requested. Before you follow any of these steps, ensure you are going through a receiver/amplifier and using quality speakers and not simply computer speakers. If you are only using computer speakers, don't bother changing anything here as you won't notice a difference.<br />
<br />
By default the sample rate is 48000hz. There are several conditions in which you may want to change this. This all depends on your usage patterns. You want the sample rate you are using to match the media you use the most. If your computer has to change the sampling rate of the media to suit the hardware it is likely, though not guaranteed that you will have a loss in audio quality. This is most noticable in downsampling (ie. 96000hz &rarr; 48000hz). There is an article about this issue in [http://www.stereophile.com/news/121707lucky/ "Stereophile"] which was [http://lists.apple.com/archives/coreaudio-api/2008/Jan/msg00272.html discussed] on Apple's "CoreAudio API" mailing list if you wish to learn more about this issue. <br />
<br />
Some example sample rates:<br />
<br />
* 44100hz - Sample rate of standard [http://en.wikipedia.org/wiki/Red_Book_%28audio_CD_standard%29 Red Book] audio cds.<br />
* 88000hz - Sample rate of [http://en.wikipedia.org/wiki/Super_Audio_CD SACD] high definition audio discs/downloads. It is rare that your motherboard will support this sample rate.<br />
* 96000hz - Sample rate of most high definition audio downloads. If your motherboard is an [http://en.wikipedia.org/wiki/AC%2797 AC'97] motherboard, this is likely to be your highest bitrate.<br />
* 192000hz - Sample rate of BluRay, and some (very few) high definition downloads. Support for external audio reciever equipment is limited to high end audio. Not all motherboards support this. An example of a motherboard chipset that would support this includes [http://en.wikipedia.org/wiki/Intel_High_Definition_Audio Intel HDA audio]. <br />
<br />
To check what your sample rate is currently set to:<br />
<br />
# Run <code>"ossmix | grep rate"</code>. <br />
<br />
You are likely to see <code>"vmix0-rate <decimal value> (currently 48000) (Read-only)"</code>.<br />
<br />
If you do not see a "vmix0-rate" (or "vmix1-rate", etc.) being outputted, than it probably means that vmix is disabled. In that case, OSS will use the rate requested by the program which uses the device, so this section doesn't apply. Exception: envy24(ht) cards have a setting envy24.rate which has a similiar function (see "oss_envy24" manpage). You can follow these steps, but at step 2, change with ossmix the value of "envy24.rate" as well.<br />
<br />
Steps to affect the change:<br />
<br />
# First, make sure your card is able to use the new rate. Run "ossinfo -v2" and see if the wanted rate is in the "Native sample rates" output.<br />
# As root, run <code>"/usr/lib/oss/scripts/killprocs.sh"</code>. Be aware, this will close any program that currently has an open sound channel (examples being media players, Firefox as of 3.5 if you have xulrunner-oss installed, and the gnome volume control).<br />
# After all programs occupying vmix are terminated, run as root: <code>"vmixctl rate /dev/dsp 96000"</code> replacing the rate with your desired sample rate.<br />
# Run <code>"ossmix | grep rate"</code> and check for <code>"vmix0-rate <decimal value> (currently 96000) (Read-only)"</code> to see if you were successful.<br />
<br />
== Start ossxmix docked to systray on startup ==<br />
<br />
'''KDE 4'''<br />
<br />
Create an application launcher file named <code>ossxmix.desktop</code> in you local application launchers directory (<code>~/.local/share/applications/</code> then enter:<br />
<br />
<pre>[Desktop Entry]<br />
Name=Open Sound System Mixer<br />
GenericName=Audio Mixer<br />
Exec=ossxmix -b<br />
Icon=audio-card<br />
Categories=Application;GTK;AudioVideo;Player;<br />
Terminal=false<br />
Type=Application<br />
Encoding=UTF-8</pre><br />
<br />
To add it to autostart when loading the desktop environment:<br />
<br />
System Settings > Advanced tab > Autostart. Then click add program and choose it from the 'Multimedia' list.<br />
<br />
'''Gnome''' <br />
<br />
*As Root create a file /usr/local/bin/ossxmix_bg with the following content:<br />
<br />
<pre><br />
#!/bin/bash<br />
exec /usr/bin/ossxmix -b<br />
</pre><br />
<br />
Goto System > Preferences > Start Up Applications<br />
<br />
*Click Add, Type OSSMIX in Name field and <code>/usr/local/bin/ossxmix_bg</code> in Command field then click Add button.<br />
<br />
*Login and Logout to see the changes.<br />
<br />
== Record sound output from a program ==<br />
<br />
* [http://www.opensound.com/wiki/index.php/Tips_And_Tricks#Recording_sound_output_of_a_program Recording sound output of a program].<br />
<br />
== Suspend and Hibernation ==<br />
<br />
OSS does not automatically support suspend meaning that OSS must be manually stopped prior to suspending or hibernating.<br />
<br />
OSS provides <tt>soundon</tt> and <tt>soundoff</tt> to enable and disable OSS, although any processes that use sound must be terminated first.<br />
<br />
The following script is a rather basic method of automatically unloading OSS prior to suspending and reloading afterwards.<br />
<br />
#!/bin/sh<br />
. "${PM_FUNCTIONS}"<br />
<br />
suspend_osssound()<br />
{<br />
/usr/lib/oss/scripts/killprocs.sh<br />
/usr/sbin/soundoff<br />
}<br />
<br />
resume_osssound()<br />
{<br />
/usr/sbin/soundon<br />
}<br />
<br />
case "$1" in<br />
hibernate|suspend)<br />
suspend_osssound<br />
;;<br />
thaw|resume)<br />
resume_osssound<br />
;;<br />
*) exit $NA<br />
;;<br />
esac<br />
<br />
Save the contents of the script (as root) into {{Filename|/etc/pm/sleep.d/50ossound}} and make it executable. {{Filename| chmod a+x /etc/pm/sleep.d/50ossound}}<br />
<br />
{{Note|This script is rather basic and will terminate any application directly accessing OSS, save your work prior to suspending/hibernating.}}<br />
<br />
OSS does not support suspending but we don't care or better [http://wiki.archlinux.org/index.php/Suspend_to_RAM s2ram] works fine without stopping OSS.<br />
Just create a nice suspend script to /sbin/suspend and make it executable.<br />
<br />
#!/bin/bash<br />
<br />
if [[ $EUID -ne 0 ]]; then<br />
## Checking if you are a root or not<br />
echo "This script must be run as root" 1>&2<br />
exit 1<br />
fi<br />
<br />
s2ram -f<br />
<br />
sleep 2<br />
<br />
/etc/rc.d/oss restart 2>/tmp/oss.txt<br />
<br />
if [ $? -gt 0 ]; then<br />
echo "OSS restart failed check /tmp/oss.txt for advice"<br />
fi<br />
<br />
exit 0<br />
<br />
<br />
That's all your apps are fine and suspend works. \o/<br />
<br />
== ALSA emulation ==<br />
<br />
=== Introduction ===<br />
<br />
You can instruct <tt>alsa-lib</tt> to use OSS as its audio output system. This works as a sort of ALSA emulation.<br />
<br />
Note, however, that this method may introduce additional latency in your sound output, and that the emulation is not complete and doesn't work with all applications. It doesn't work, for example, with programs that try to detect devices using ALSA.<br />
<br />
So, as most applications support OSS directly, use this method only as a last resort.<br />
<br />
In the future, more complete methods may be available for emulating ALSA, such as <tt>libsalsa</tt> and <tt>cuckoo</tt>.<br />
<br />
=== HOW-TO ===<br />
<br />
* Install the <tt>alsa-plugins</tt> package.<br />
<br />
# pacman -S alsa-plugins<br />
<br />
* Edit {{Filename|/etc/asound.conf}} as follows.<br />
<br />
pcm.oss {<br />
type oss<br />
device /dev/dsp<br />
}<br />
<br />
pcm.!default {<br />
type oss<br />
device /dev/dsp<br />
}<br />
<br />
ctl.oss {<br />
type oss<br />
device /dev/mixer<br />
}<br />
<br />
ctl.!default {<br />
type oss<br />
device /dev/mixer<br />
}<br />
<br />
{{Note | If you don't want to use OSS anymore, don't forget to revert changes that you do here in {{Filename|/etc/asound.conf}}.}}<br />
<br />
= Experimental packages =<br />
<br />
== Mercurial repository version ==<br />
<br />
There is a [http://aur.archlinux.org/packages.php?ID=21126 oss-mercurial package] in AUR. This package compiles and installs the latest OSS development version direcly from the Mercurial repository.<br />
<br />
You can try this package if you want to contribute code to OSS or if only a very recent change in OSS code introduced support to your sound device.<br />
<br />
If you want oss to take care of your flash sound you will need to install libflashsupport:<br />
<br />
# pacman -S libflashsupport</div>Blohttps://wiki.archlinux.org/index.php?title=Open_Sound_System&diff=80893Open Sound System2009-10-28T19:32:04Z<p>Blo: /* Suspend and Hibernation */</p>
<hr />
<div>[[Category:Audio/Video (English)]]<br />
[[Category:HOWTOs (English)]]<br />
{{i18n_links_start}}<br />
{{i18n_entry|English|OSS}}<br />
{{i18n_entry|简体中文|OSS (简体中文)}}<br />
{{i18n_entry|Français|OSS (Français)}}<br />
{{i18n_entry|Türkçe|OSS (Türkçe)}}<br />
{{i18n_links_end}}<br />
<br />
= Introduction =<br />
The [http://developer.opensound.com Open Sound System] is a [http://4front-tech.com commercially-supported] sound architecture that works on several UNIX-like and POSIX-compatible systems, including Linux, FreeBSD, Solaris and BeOS/Haiku.<br />
<br />
Please note that this article is not about the old OSS, which is included in the Linux kernel sources and is more than 10 years old by now.<br />
<br />
This article is about the new OSS versions (often called OSSv4). These versions were previously proprietary - OSS became open source again in July 2007, and is currently available under GPL, BSD or CDDL licenses.<br />
<br />
= Advantages and disadvantages vs. ALSA =<br />
<br />
== Advantages over ALSA (for users) ==<br />
* Includes a transparent software mixer (vmix) in kernel space. This means multiple applications can access the sound device at the same time without problems.<br />
* The vmix mixer controls allow you to adjust the volume of each application individually.<br />
* Better support for some sound card models, for example for the Creative X-Fi.<br />
* Sound quality is usually better. '''reference needed to validate this statement'''<br />
* Better support for applications written for the OSS API, of course. The OSS API is widely spread and a lot of applications support it. The ALSA's OSS API emulation, however, is often buggy.<br />
<br />
== Advantages over ALSA (for developers) ==<br />
* Cleaner and easier to use API.<br />
* API is much better [http://manuals.opensound.com/developer documented].<br />
* Support for sound drivers in the userspace (oss_userdev).<br />
* Portability across all supported platforms. If the application works using OSS under Linux, it will work under FreeBSD and Solaris too, for example.<br />
* Portability across operating systems. It's [http://revolf.free.fr/Alchimie-7/Alchimie7_OSS_Haiku.en.pdf easier] to port OSS to a new operating system.<br />
<br />
== Disadvantages vs. ALSA ==<br />
* USB audio devices support is currently experimental and USB recording is not implemented.<br />
* Bluetooth audio devices are currently not supported.<br />
* AC'97 and HDAudio dial-up soft-modems (for example Si3055) are currently not supported.<br />
* MIDI support is currently not finished. However, you can still use MIDI with a software synthesizer like timidity or fluidsynth.<br />
* Suspend is currently not supported. You need to unload OSS (by using {{Codeline|soundoff}}) before suspending, and to reload OSS (by using {{Codeline|soundon}}) after resuming.<br />
* Automatic jack sensing currently doesn't work properly with '''some''' HDAudio-powered motherboards. This means that, depending on your motherboard model, you may have to manually switch off your speakers when plugging your earphone.<br />
<br />
= Installing =<br />
<br />
The OSS install script unload all ALSA modules automatically. If it fails for some reason to remove the modules issue the command: modprobe -r soundcore. You should balcklist the ALSA modules (to prevent them loading at boot) by editing {{Filename|/etc/rc.conf}} as described below. <br />
<br />
MODULES=(!soundcore ..............<br />
<br />
Install OSS by running:<br />
<br />
# pacman -S oss<br />
<br />
Be sure the user is part of the audio group:<br />
<br />
# gpasswd -a USERNAME audio<br />
<br />
Start OSS by running:<br />
<br />
# /etc/rc.d/oss start<br />
<br />
Add <tt>oss</tt> to your <tt>DAEMONS</tt> variable at {{Filename|/etc/rc.conf}}, so OSS is loaded automatically at each boot.<br />
<br />
In the case OSS is not able to detect your card when starting it, run :<br />
<br />
# ossdetect -v<br />
<br />
Then {{Codeline|soundoff && soundon}} to reactivate it.<br />
<br />
= Testing =<br />
<br />
You can test OSS by running:<br />
<br />
$ osstest<br />
<br />
{{Note| Beware the default volume is very loud. Avoid using earphones or lower the volume by using <tt>ossxmix</tt>. }}<br />
<br />
You should be able to hear music during the test process. If there is no audio, try to adjust the mixer as explained in the following sections and/or read the Troubleshooting sections.<br />
<br />
= Volume control =<br />
<br />
To control the volume of various devices, mixers levels will need to be set. The command line mixer is called <tt>ossmix</tt>. It's very like the BSD audio mixer (<tt>mixerctl</tt>).<br />
<br />
A graphical mixer, is available too. It's called <tt>ossxmix</tt>. It needs the optional depend <tt>gtk2</tt> to work.<br />
<br />
The <tt>ossxmix</tt> controls are explained in the following example:<br />
<br />
______________________________<br />
/ High Definition Audio ALC262 \ ----------------------------------> One tab for each sound card<br />
/________________________________\_______________________________<br />
|<br />
| [x] vmix0-enable [vmix0-rate: 48.000kHz] vmix0-channels \ The vmix (virtual mixer) special configurations<br />
| [ Stereo [v] ] |--> appear at the top. These include sampling rate<br />
| / and mixer priority. They are provided by OSS.<br />
| __codec1______________________________________________________ <br />
| | _jack_______________________________________________________ \ <br />
| | | _int-speaker____________________ __green_________________ |<br />
| | | | | | | These are your sound card configurations.<br />
| | | | _mode______ | | | | _mode______ | | | Every mixer control that is shown here is<br />
| | | | [ mix [v] ] o o [x] [ ]mute | | [ mix [v] ] o o [x] |--> provided by your sound card. Every sound card<br />
| | | | | | | | | | | specific control is shown here.<br />
| | | |________________________________| |_______________________ |<br />
| | |____________________________________________________________ |<br />
| |______________________________________________________________ /<br />
|<br />
| ___vmix0_______________________________________________________ \<br />
| | __mocp___ O O _firefox_ O O __pcm7___ O O | Here are the vmix mixer controls. These are<br />
| | | | O O | | x x | | O O | virtual mixer controls provided by OSS. Each<br />
| | | | | | x O | | | | x x | | | | O O | slider is the volume control of a different<br />
| | | o o [x] | x x | o o [x] | x x | o o [x] | O O |--> application. When one application uses the<br />
| | | | | | x x | | | | x x | | | | O O | sound card, its name is shown in the place of<br />
| | |_________| x x |_________| x x |_________| O O | the 'pcm#' labels. There are also sound level<br />
| |______________________________________________________________ | meter levels for each application.<br />
|________________________________________________________________ /<br />
<br />
=== Jack Definitions ===<br />
For high definition audio, ossxmix will highlight the jacks to their corresponding plug color. For 5.1 surround sound the [http://en.wikipedia.org/wiki/Audio_and_video_connector jack colors] are: <br />
{| border="1"<br />
|-<br />
! Connector Type<br />
! Purpose<br />
! OSS<br />
|- style=color:black;background:lightgreen<br />
|green TRS 3.5mm<br />
| stereo output, front channels<br />
|front<br />
|- style=color:white;background:black <br />
|black TRS 3.5mm<br />
| stereo output, rear channels<br />
|rear<br />
|- style=color:white;background:gray<br />
|grey TRS 3.5mm<br />
| stereo output, side channels<br />
|side<br />
|- style=color:black;background:gold<br />
|gold TRS 3.5mm<br />
| dual output, center and subwoofer<br />
|center/LFE<br />
|- style=color:black;background:lightblue<br />
|blue TRS 3.5mm<br />
| stereo input, line level<br />
|input<br />
|- style=color:black;background:pink <br />
|pink TS 3.5mm<br />
| mono microphone input<br />
|input<br />
|}<br />
For the most part and for most people just make sure that:<br />
# All green jacks (green and fp-green) are "front" and 75% from max volume.<br />
# All pink jacks (pink and fp-pink) are input and 50% of max to avoid distortion.<br />
<br />
== Other Mixers ==<br />
<br />
Other desktop environments may have support for OSS:<br />
<br />
* Gnome - Gnome Volume Control has support for OSS. Some users report that using Gnome Volume Control is easier to setup than <tt>ossxmix</tt>.<br />
* KDE - Kmix now has preliminary support for OSS.<br />
<br />
== Saving and restoring mixer settings ==<br />
<br />
If you wish to save your mixer settings manually, run {{Codeline|savemixer}}. As regular user you will need permissions to use {{Codeline|/usr/sbin/savemixer}} in the sudoers file or you can modify write permissions to {{Filename|/usr/lib/oss/etc/mixer.save}}. Alternately, the <tt>-f</tt> switch can be used to save the mixer to a file and {{Codeline|savemixer -L}} to restore it.<br />
<br />
Please note that the init scripts run these commands before shutdown/after starting to keep mixer settings across boot, so most users don't need to worry about it.<br />
<br />
= Configuring Applications for OSS =<br />
<br />
== Skype ==<br />
<br />
The <tt>skype</tt> package only includes support for ALSA. To get an OSS-capable Skype, install the <tt>skype-oss</tt> package:<br />
<br />
# pacman -S skype-oss<br />
<br />
If you are using x86_64, you can get the [http://aur.archlinux.org/packages.php?ID=18312 bin32-skype-oss] package from AUR.<br />
<br />
== Wine ==<br />
<br />
* Run <tt>winecfg</tt>.<br />
<br />
$ winecfg<br />
<br />
* Go to the <tt>Audio</tt> tab.<br />
<br />
* Select <tt>OSS Driver</tt>.<br />
<br />
== Gajim ==<br />
By default Gajim uses {{Codeline|aplay -q}} to play a sound. To change this go in Advanced Settings and search for the {{Codeline|soundplayer}} variable. The ossplay program included in the oss package is a good replacement:<br />
<br />
{{Codeline|ossplay -qq}}<br />
<br />
== MOC ==<br />
<br />
To use MOC with OSS v4.1 you must change section OSSMixerDevice to OSSMixerDevice= /dev/ossmix in your config (located in /home/yourusername/.moc).<br />
And now MOC should work with OSS v4.1.<br />
Or you can compile moc-svn package from AUR (he got support for new vmix).<br />
For issue with interface change OSSMixerChannel = to OSSMixerChannel = Any channel and after start mocp press w (change to sofware mixex) that will help and you can change the volume power.<br />
<br />
== Applications that use Gstreamer ==<br />
<br />
Remove pulseaudio and gstreamer*-pulse programs and libraries.<br />
<br />
To change the gstreamer setting to output the sound to OSS instead of the default ALSA, run:<br />
<br />
gstreamer-properties<br />
<br />
Change the '''Default Output''' plugin to custom and the change the pipeline to:<br />
<br />
oss4sink<br />
<br />
For the input:<br />
<br />
oss4src<br />
<br />
{{Note|It's not certain that the input will sound better with oss4src compared to osssrc, so change this only if it improves your input sound. < confirmation on this please >}}<br />
<br />
If you are using phonon with the gstreamer backend you will need to set the environmental variable. To add to your current user:<br />
<br />
export PHONON_GST_AUDIOSINK=oss4sink<br />
<br />
Add this to your {{Filename|~/.bashrc}} to be loaded on login.<br />
<br />
== Firefox >=3.5 ==<br />
<br />
Firefox 3.5 introduces the <video> and <audio> tag support and can play ogg media out of the box. However, it currently can't be compiled with ALSA and OSS support at the same time. So you need to install the [http://aur.archlinux.org/packages.php?ID=28110 xulrunner-oss] package.<br />
<br />
1. Stop firefox.<br />
2. Remove the xulrunner package without dependency check: sudo pacman -Rd xulrunner<br />
3. Install xulrunner-oss package from AUR using yaourt or [http://wiki.archlinux.org/index.php/ABS ABS].<br />
4. Start firefox.<br />
<br />
== Mplayer ==<br />
<br />
If you are using gui (smplayer etc.) you will find the oss output at the audio settings. Using on cli you should specify the sound output: mplayer -ao oss /some/file/to/play.mkv If you don't want to brother typing it over and over again add "ao=oss" to your config file. (/home/$USER/.mplayer/config)<br />
<br />
== Other applications ==<br />
<br />
* If you can't get sound from an application not listed here, try looking at the [http://www.4front-tech.com/wiki/index.php/Configuring_Applications_for_OSSv4 Configuring Applications for OSSv4] page.<br />
* Search OSS specific packages by using {{Codeline|pacman -Ss -- '-oss'}} and [http://aur.archlinux.org/packages.php?K=-oss&start=0&PP=100| in AUR].<br />
<br />
= Troubleshooting =<br />
<br />
== Troubleshooting HDAudio devices ==<br />
<br />
=== Understanding why problems arise ===<br />
<br />
If you have a HDAudio sound device, it's very likely that you will have to adjust some mixer settings before your sound works.<br />
<br />
HDAudio devices are very powerful in the sense that they can contain a lot of small circuits (called ''widgets'') that can be adjusted by software at any time. These controls are exposed to the mixer, and they can be used, for example, to turn the earphone jack into a sound input jack instead of a sound output jack.<br />
<br />
However, there is a side effect, mainly because the HDAudio standard is more flexible than it perhaps should be, and because the vendors often only care to get their ''official drivers'' working.<br />
<br />
Then, when using HDAudio devices, you often find disorganized mixer controls, that doesn't work at all by default, and you are forced to try every mixer control combination, until it works.<br />
<br />
=== How to solve ===<br />
<br />
Open <tt>ossxmix</tt> and try to change every mixer control in the ''middle area'', that contains the sound card specific controls, as explained in the previous "[[OSS#The_mixer|The mixer]]" section.<br />
<br />
You'll probably want to setup a program to record/play continously in the background (e.g. {{Codeline|ossrecord - | ossplay -}} for recording or {{Codeline|osstest -lV}} for playing), while changing mixer settings in ossxmix in the foreground.<br />
<br />
* Raise every volume control slider.<br />
* In each option box, try to change the selected option, trying all the possible combinations.<br />
* If you get noise, try to lower and/or mute some volume controls, until you find the source of the noise.<br />
<br />
Please note again that you do '''not''' need to change any controls in the ''top area'' nor in the ''bottom area'', as they are virtual <tt>vmix</tt>-related mixer controls.<br />
<br />
* Editing {{Codeline|/usr/lib/oss/conf/oss_hdaudio.conf}} uncommenting and changing ''hdaudio_noskip=0'' to a value from 0-7 can give you more jack options in ossxmix<br />
I had to edit mine to ''hdaudio_noskip=7'' for my sub/rear speaker to work on my laptop, restart oss for the changes to take effect {{Codeline|/etc/rc.d/oss restart}}<br />
<br />
== MMS sound cracking in totem ==<br />
If your stream sounds with cracks or strange noise in totem like it did with me then you could try to play it with another backend like ffmpeg (mplayer). That "fixed" the issue for me. This will not fix the issue that somehow pops up in gstreamer when playing MMS streams but it will give you the option to play it with good sound quality. Playing it in mplayer is simple:<br />
# mplayer mmsh://yourstreamurl<br />
<br />
== Microphone playing through output channels ==<br />
<br />
OSS by default plays back the microphone through the speakers. To disable this in ossxmix find the misc section. Check off every "input-mix-mute" to disable this.<br />
<br />
== Troubleshooting other issues ==<br />
<br />
* If you get distorted sound, try lowering some volume control sliders.<br />
<br />
* If you need to change the default sound card, look at [http://www.opensound.com/wiki/index.php/Tips_And_Tricks#Changing_the_default_sound_output here].<br />
<br />
* If you have another issues, try searching or asking for help at the [http://www.4front-tech.com/forum 4front forums].<br />
<br />
= Tips and Tricks =<br />
<br />
== Using multimedia keys with OSS ==<br />
An easy way to mute/unmute and increase/decrease the volume is to use the [http://www.opensound.com/wiki/index.php/Tips_And_Tricks#ossvol {{Codeline|ossvol}} script] available in [[AUR]].<br />
<br />
Once you installed it try to toggle the sound:<br />
$ ossvol -t<br />
<br />
Type {{Codeline|ossvol -h}} for the other commands.<br />
<br />
If you don't know how to assign commands to your multimedia keys, see [[Extra Keyboard Keys]].<br />
<br />
==={{Codeline|ossvol}} troubleshooting===<br />
If you get an error like:<br />
Bad mixer control name(987) 'vol'<br />
you need to edit the script ({{Filename|/usr/bin/ossvol}}) and change the value of the {{Codeline|CHANNEL}} variable which is at the beginning of the script. For example mine is {{Codeline|CHANNEL<nowiki>=</nowiki>"vmix0-outvol"}}.<br />
<br />
*'''Note''' if you are using xbindkeys for your multimedia keys adding this<br />
"ossmix vmix0-outvol -- +1"<br />
raise volume<br />
"ossmix vmix0-outvol -- -1"<br />
lower volume<br />
<br />
to the raise/lower volume section of your .xbindkeysrc file is an easy way to adjust the volume<br />
<br />
== Changing the Sample Rate ==<br />
<br />
Changing the output sample rate is not obvious at first. Sample rates can only be changed by the superuser and vmix must be unused by any programs when a change is requested. Before you follow any of these steps, ensure you are going through a receiver/amplifier and using quality speakers and not simply computer speakers. If you are only using computer speakers, don't bother changing anything here as you won't notice a difference.<br />
<br />
By default the sample rate is 48000hz. There are several conditions in which you may want to change this. This all depends on your usage patterns. You want the sample rate you are using to match the media you use the most. If your computer has to change the sampling rate of the media to suit the hardware it is likely, though not guaranteed that you will have a loss in audio quality. This is most noticable in downsampling (ie. 96000hz &rarr; 48000hz). There is an article about this issue in [http://www.stereophile.com/news/121707lucky/ "Stereophile"] which was [http://lists.apple.com/archives/coreaudio-api/2008/Jan/msg00272.html discussed] on Apple's "CoreAudio API" mailing list if you wish to learn more about this issue. <br />
<br />
Some example sample rates:<br />
<br />
* 44100hz - Sample rate of standard [http://en.wikipedia.org/wiki/Red_Book_%28audio_CD_standard%29 Red Book] audio cds.<br />
* 88000hz - Sample rate of [http://en.wikipedia.org/wiki/Super_Audio_CD SACD] high definition audio discs/downloads. It is rare that your motherboard will support this sample rate.<br />
* 96000hz - Sample rate of most high definition audio downloads. If your motherboard is an [http://en.wikipedia.org/wiki/AC%2797 AC'97] motherboard, this is likely to be your highest bitrate.<br />
* 192000hz - Sample rate of BluRay, and some (very few) high definition downloads. Support for external audio reciever equipment is limited to high end audio. Not all motherboards support this. An example of a motherboard chipset that would support this includes [http://en.wikipedia.org/wiki/Intel_High_Definition_Audio Intel HDA audio]. <br />
<br />
To check what your sample rate is currently set to:<br />
<br />
# Run <code>"ossmix | grep rate"</code>. <br />
<br />
You are likely to see <code>"vmix0-rate <decimal value> (currently 48000) (Read-only)"</code>.<br />
<br />
If you do not see a "vmix0-rate" (or "vmix1-rate", etc.) being outputted, than it probably means that vmix is disabled. In that case, OSS will use the rate requested by the program which uses the device, so this section doesn't apply. Exception: envy24(ht) cards have a setting envy24.rate which has a similiar function (see "oss_envy24" manpage). You can follow these steps, but at step 2, change with ossmix the value of "envy24.rate" as well.<br />
<br />
Steps to affect the change:<br />
<br />
# First, make sure your card is able to use the new rate. Run "ossinfo -v2" and see if the wanted rate is in the "Native sample rates" output.<br />
# As root, run <code>"/usr/lib/oss/scripts/killprocs.sh"</code>. Be aware, this will close any program that currently has an open sound channel (examples being media players, Firefox as of 3.5 if you have xulrunner-oss installed, and the gnome volume control).<br />
# After all programs occupying vmix are terminated, run as root: <code>"vmixctl rate /dev/dsp 96000"</code> replacing the rate with your desired sample rate.<br />
# Run <code>"ossmix | grep rate"</code> and check for <code>"vmix0-rate <decimal value> (currently 96000) (Read-only)"</code> to see if you were successful.<br />
<br />
== Start ossxmix docked to systray on startup ==<br />
<br />
'''KDE 4'''<br />
<br />
Create an application launcher file named <code>ossxmix.desktop</code> in you local application launchers directory (<code>~/.local/share/applications/</code> then enter:<br />
<br />
<pre>[Desktop Entry]<br />
Name=Open Sound System Mixer<br />
GenericName=Audio Mixer<br />
Exec=ossxmix -b<br />
Icon=audio-card<br />
Categories=Application;GTK;AudioVideo;Player;<br />
Terminal=false<br />
Type=Application<br />
Encoding=UTF-8</pre><br />
<br />
To add it to autostart when loading the desktop environment:<br />
<br />
System Settings > Advanced tab > Autostart. Then click add program and choose it from the 'Multimedia' list.<br />
<br />
'''Gnome''' <br />
<br />
*As Root create a file /usr/local/bin/ossxmix_bg with the following content:<br />
<br />
<pre><br />
#!/bin/bash<br />
exec /usr/bin/ossxmix -b<br />
</pre><br />
<br />
Goto System > Preferences > Start Up Applications<br />
<br />
*Click Add, Type OSSMIX in Name field and <code>/usr/local/bin/ossxmix_bg</code> in Command field then click Add button.<br />
<br />
*Login and Logout to see the changes.<br />
<br />
== Record sound output from a program ==<br />
<br />
* [http://www.opensound.com/wiki/index.php/Tips_And_Tricks#Recording_sound_output_of_a_program Recording sound output of a program].<br />
<br />
== Suspend and Hibernation ==<br />
<br />
OSS does not automatically support suspend meaning that OSS must be manually stopped prior to suspending or hibernating.<br />
<br />
OSS provides <tt>soundon</tt> and <tt>soundoff</tt> to enable and disable OSS, although any processes that use sound must be terminated first.<br />
<br />
The following script is a rather basic method of automatically unloading OSS prior to suspending and reloading afterwards.<br />
<br />
#!/bin/sh<br />
. "${PM_FUNCTIONS}"<br />
<br />
suspend_osssound()<br />
{<br />
/usr/lib/oss/scripts/killprocs.sh<br />
/usr/sbin/soundoff<br />
}<br />
<br />
resume_osssound()<br />
{<br />
/usr/sbin/soundon<br />
}<br />
<br />
case "$1" in<br />
hibernate|suspend)<br />
suspend_osssound<br />
;;<br />
thaw|resume)<br />
resume_osssound<br />
;;<br />
*) exit $NA<br />
;;<br />
esac<br />
<br />
Save the contents of the script (as root) into {{Filename|/etc/pm/sleep.d/50ossound}} and make it executable. {{Filename| chmod a+x /etc/pm/sleep.d/50ossound}}<br />
<br />
{{Note|This script is rather basic and will terminate any application directly accessing OSS, save your work prior to suspending/hibernating.}}<br />
<br />
OSS does not support suspending but we don't care or better [http://wiki.archlinux.org/index.php/Suspend_to_RAM s2ram] works fine without stopping OSS.<br />
Just create a nice suspend script to /sbin/suspend and make it executable.<br />
<br />
#!/bin/bash<br />
<br />
if [[ $EUID -ne 0 ]]; then<br />
## Checking if you are a root or not<br />
echo "This script must be run as root" 1>&2<br />
exit 1<br />
fi<br />
<br />
s2ram -f<br />
<br />
sleep 2<br />
<br />
echo "Restarting OSS."<br />
<br />
/etc/rc.d/oss restart<br />
<br />
exit 0<br />
<br />
That's all your apps are fine and suspend works. \o/<br />
<br />
== ALSA emulation ==<br />
<br />
=== Introduction ===<br />
<br />
You can instruct <tt>alsa-lib</tt> to use OSS as its audio output system. This works as a sort of ALSA emulation.<br />
<br />
Note, however, that this method may introduce additional latency in your sound output, and that the emulation is not complete and doesn't work with all applications. It doesn't work, for example, with programs that try to detect devices using ALSA.<br />
<br />
So, as most applications support OSS directly, use this method only as a last resort.<br />
<br />
In the future, more complete methods may be available for emulating ALSA, such as <tt>libsalsa</tt> and <tt>cuckoo</tt>.<br />
<br />
=== HOW-TO ===<br />
<br />
* Install the <tt>alsa-plugins</tt> package.<br />
<br />
# pacman -S alsa-plugins<br />
<br />
* Edit {{Filename|/etc/asound.conf}} as follows.<br />
<br />
pcm.oss {<br />
type oss<br />
device /dev/dsp<br />
}<br />
<br />
pcm.!default {<br />
type oss<br />
device /dev/dsp<br />
}<br />
<br />
ctl.oss {<br />
type oss<br />
device /dev/mixer<br />
}<br />
<br />
ctl.!default {<br />
type oss<br />
device /dev/mixer<br />
}<br />
<br />
{{Note | If you don't want to use OSS anymore, don't forget to revert changes that you do here in {{Filename|/etc/asound.conf}}.}}<br />
<br />
= Experimental packages =<br />
<br />
== Mercurial repository version ==<br />
<br />
There is a [http://aur.archlinux.org/packages.php?ID=21126 oss-mercurial package] in AUR. This package compiles and installs the latest OSS development version direcly from the Mercurial repository.<br />
<br />
You can try this package if you want to contribute code to OSS or if only a very recent change in OSS code introduced support to your sound device.<br />
<br />
If you want oss to take care of your flash sound you will need to install libflashsupport:<br />
<br />
# pacman -S libflashsupport</div>Blohttps://wiki.archlinux.org/index.php?title=Installing_with_Software_RAID_or_LVM&diff=80501Installing with Software RAID or LVM2009-10-26T12:52:59Z<p>Blo: /* Removing device, stop using the array */</p>
<hr />
<div>[[Category:Getting and installing Arch (English)]]<br />
[[Category:File systems (English)]]<br />
[[Category:HOWTOs (English)]]<br />
<br />
== Disclaimer==<br />
<br />
{{ Warning | Installing a system with RAID is a complex process. Anything could go wrong. You could make a mistake, I could make a mistake, there could be a bug in something. Backup all your data first. Make sure only the drives involved in the installation are attached while doing the install. You've been warned! }}<br />
<br />
Also note that this document is up-to-date with all "Archisms" as of 2008.06 'Overlord'. It may not be applicable to previous releases of Arch Linux.<br />
<br />
=== RAID ===<br />
<br />
RAID (Redundant Array of Independent Disks) is designed to prevent data loss in the event of a hard disk failure. There are different "levels" of RAID. RAID 0 (striping) isn't really RAID at all, because it provides no redundancy. It does, however, provide speed benefit. We'll use RAID 0 for swap, on the assumption that you're using a desktop, where the speed increase is worth the possibility of having your system crash if one of your drives fails. On a server, you'd almost certainly want RAID 1 or RAID 5. The size of a RAID 0 array block device is the size of the smallest component partition times the number of component partitions.<br />
<br />
RAID 1 is the most straightforward RAID level: straight mirroring. As with other RAID levels, it only makes sense if the partitions are on different physical disk drives. If one of those drives fails, the block device provided by the RAID array will continue to function as normal. We'll be using RAID 1 for everything except swap. Note that RAID 1 is the only option for the boot partition, because bootloaders (which read the boot partition) don't understand RAID, but a RAID 1 component partition can be read as a normal partition. The size of a RAID 1 array block device is the size of the smallest component partition.<br />
<br />
RAID 5 is the only other RAID level you're likely to want. It requires 3 or more physical drives, and provides the redundancy of RAID 1 combined with the speed and size benefits of RAID 0. RAID 5 uses striping, like RAID 0, but also stores parity blocks distributed across each member disk. In the event of a failed disk, these parity blocks are used to reconstruct the data on a replacement disk. RAID 5 can withstand the loss of one member disk.<br />
<br />
'''ATTENTION: Having RAID does not mean you don't need backups - read the CAVEATS section below!'''<br />
<br />
=== LVM ===<br />
<br />
[http://sourceware.org/lvm2/ LVM] (Logical Volume Management) makes use of the [http://sources.redhat.com/dm/ device-mapper] feature of the Linux kernel. It provides a system of specifying partitions independently of the layout of the underlying disk. What this means for you is that you can extend and shrink partitions (subject to the filesystem you use allowing this) and add and remove partitions without worrying about whether you have enough contiguous space on a particular disk, without getting caught up in the problems of fdisking a disk that is in use (and wondering whether the kernel is using the old or new partition table) and without having to move other partition out of the way.<br />
<br />
This is strictly an ease-of-management issue: it doesn't provide any addition security. However, it sits nicely with the other two technologies we're using.<br />
<br />
Note that we're not using LVM for the boot partition (because of the bootloader problem).<br />
<br />
==CAVEATS==<br />
<br />
=== Security (redundancy) ===<br />
<br />
Again, RAID does not provide a guarantee that your data is safe. If there is a fire, if your computer is stolen or if you have multiple hard drive failures, RAID won't protect you. So '''make backups'''. Whether you use tape drives, DVDs, CDROMs or another computer, keep a copy of your data out of your computer (and preferably offsite) and keep it up to date. Get into the habit of making regular backups. If you organize the data on your computer in a way that separates things you are currently working on from "archived" things that are unlikely to change, you can back up the "current" stuff frequently, and the "archived" stuff occasionally.<br />
<br />
== General Approach==<br />
<br />
For starters, note that this document seeks primarily to give you a good example walkthrough of how to install Arch with Software RAID or LVM support for a typical case. It won't try to explain all the possible things you can do -- it's more to give you an example of something that will work that you can then tweak to your own purposes.<br />
<br />
In this example, the machine I'm using will have three similar IDE hard drives, at least 80GB each in size, installed as primary master, primary slave, and secondary master, with my installation CD-ROM drive as the secondary slave. I will assume these can be reached as /dev/sda, /dev/sdb, and /dev/sdc, and that the cdrom drive is /dev/cdrom.<br />
<br />
We'll create a 100MB /boot partition, a 2048MB (2GB) swap partition and a ~ 78GB root partition using LVM. The boot and swap partitions will be RAID1, while the root partition will be RAID5. Why RAID1? For boot, it's so you can boot the kernel from grub (which has no RAID drivers!), and for swap, it's for redundancy, so that your machine will not lose its swap state even if 1 or 2 drives fail.<br />
<br />
Each RAID1 redundant partition will have three physical partitions, all the same size, one on each of the drives. The total storage capacity will be the size of a single one of these physical partitions. A RAID1 redundant partition with 3 physical partitions can lose any two of its physical partitions and still function.<br />
<br />
Each RAID5 redundant partition will also have three physical partitions, all the same size, one on each of the drives. The total storage capacity will be the combined size of ''two'' of these physical partitions, with the third drive being consumed to provide parity information. A RAID5 redundant partition with 3 physical partitions can lose any one of its physical partitions and still function.<br />
<br />
== Get the Arch Installer CD ==<br />
<br />
Please note that in order to use LVM, you need the <code>lvm2</code> and <code>dev-mapper</code> packages installed, otherwise you won't be able to see any LVM partitions on reboot, until you install those packages. Note that the Arch 0.7.1 Base installer ''does not'' contain these packages, but the Arch 0.7.1 Full installer does. So if you're going to use LVM, you'll need to download the bigger ISO. My example will describe you using the Full installer; the changes should be minimal if you wish to use the Base installer instead.<br />
<br />
== Outline ==<br />
<br />
Just to give you an idea of how all this will work, I'll outline the steps. The details for these will be filled in below.<br />
<br />
# Boot the Installer CD<br />
# Partition the Hard Drives<br />
# Create the RAID Redundant Partitions<br />
# Create and Mount the Main Filesystems<br />
# Setup LVM and Create the / (root) LVM Volume<br />
# Install and Configure Arch<br />
# Install Grub on the Primary Hard Drive<br />
# Unmount Filesystems and Reboot<br />
# Install Grub on the Alternate Boot Drives<br />
# Archive your Filesystem Partition Scheme<br />
<br />
== Procedure==<br />
<br />
=== Boot the Installer CD===<br />
<br />
First, load all your drives in the machine. Then boot the Arch Linux 0.7 ''Full'' installation CD.<br />
<br />
At the syslinux boot prompt, hit enter: we want to use the SCSI kernel, which has support for RAID and LVM built in.<br />
<br />
So far, this is easy. Don't worry, it gets harder.<br />
<br />
=== Partition the Hard Drives===<br />
If your hard drives are already prepared and all you want to do is activate RAID and LVM jump to [[Installing_with_Software_RAID_or_LVM#Activate_existing_RAID_devices_and_LVM_volumes|Activate exsiting RAID devices and LVM volumes]].<br />
<br />
We'll use <code>cfdisk</code> to do this partitioning. We want to create 3 partitions on each of the three drive:<br />
<br />
Partition 1 (/boot): 100MB, type FD, bootable<br><br />
Partition 2 (swap): 2048MB, type FD<br><br />
Partition 3 (LVM): <Rest of the drive>, type FD<br />
<br />
Note that in general, in <code>cfdisk</code>, you can use the first letter of each <code>[[Bracketed Option]]</code> to select it; however, this is not true for the <code>[[Write]]</code> command, you have to hold SHIFT as well to select it.<br />
<br />
First run:<br />
<pre><br />
# cfdisk /dev/sda<br />
</pre><br />
<br />
Create each partition in order:<br />
<br />
# Select <code>'''New'''</code>.<br />
# Hit Enter to make it a <code>'''Primary'''</code> partition.<br />
# Type the appropriate size (in MB), or for Partition 3, just hit enter to select the remainder of the drive.<br />
# Hit Enter to choose to place the partition at the <code>'''Beginning'''</code>.<br />
# Select <code>'''Type'''</code>, hit enter to see the second page of the list, and then type <code>fd</code> for the Linux RAID Autodetect type.<br />
# ''For Partition 1 on each drive'', select <code>'''Bootable'''</code>.<br />
# Hit down arrow (selecting the remaining free space) to go on to the next partition to be created.<br />
<br />
When you're done, select <code>'''Write'''</code>, and confirm <code>y-e-s</code> that you want to write the partition information to disk.<br />
<br />
Then select <code>'''Quit'''</code>.<br />
<br />
Repeat this for the other two drives:<br />
<br />
<pre><br />
# cfdisk /dev/sdb<br />
# cfdisk /dev/sdc<br />
</pre><br />
<br />
Create the same exact partitions on each disk. If a group of partitions of different sizes are assembled to create a redundant RAID partition, it ''will'' work, but the redundant partition will be in multiples of the size of the smallest one, leaving the rest of the allocated drive space to waste.<br />
<br />
=== Load the RAID Modules ===<br />
<br />
Before using <code>mdadm</code>, you need load the modules for the RAID levels you'll be using. In this example, we're using levels 1 and 5, so we'll load those. You can ignore any modprobe errors like <code>"cannot insert md-mod.ko: File exists"</code>. Busybox's modprobe can be a little slow sometimes.<br />
<br />
<pre><br />
# modprobe raid1<br />
# modprobe raid5<br />
</pre><br />
<br />
=== Create the RAID Redundant Partitions ===<br />
<br />
Now that you've created all the physical partitions, you're ready to set up RAID. The tool you use to create RAID arrays is <code>mdadm</code>.<br />
<br />
To create /dev/md0 (/):<br />
<pre><br />
# mdadm --create /dev/md0 --level=5 --raid-devices=3 /dev/sda3 /dev/sdb3 /dev/sdc3<br />
</pre><br />
<br />
To create /dev/md1 (/boot):<br />
<pre><br />
# mdadm --create /dev/md1 --level=1 --raid-devices=3 /dev/sda1 /dev/sdb1 /dev/sdc1<br />
</pre><br />
<br />
To create /dev/md2 (swap):<br />
<pre><br />
# mdadm --create /dev/md2 --level=1 --raid-devices=3 /dev/sda2 /dev/sdb2 /dev/sdc2<br />
</pre><br />
<br />
At this point, you should have working RAID partitions. When you create the RAID partitions, they need to sync themselves so the contents of all three physical partitions are the same on all three drives. The hard drives lights will come on as they try to sync up. You can monitor the progress by typing:<br />
<pre><br />
# cat /proc/mdstat<br />
</pre><br />
<br />
You can also get particular information about, say, the root partition by typing:<br />
<pre><br />
# mdadm --misc --detail /dev/md0<br />
</pre><br />
<br />
You don't have to wait for synchronization to finish -- you may proceed with the installation while syncronization is still occurring. You can even reboot at the end of the installation with synchronization still going.<br />
<br />
=== Setup LVM and Create the / (root) LVM Volume===<br />
This is where you create the LVM volumes. LVM works with abstract layers, check out [[LVM|LVM]] and/or it's documentation to discover more. What you will be doing in short:<br />
* Turn block devices (e.g. /dev/sda1 or /dev/md0) into Physical Volume(s) that can be used by LVM<br />
* Create a Volume Group consisting of Physical Volume(s)<br />
* Create Logical Volume(s) within the Volume Group <br />
<br />
'''Note:'''<br />
If you are using an Arch Linux install CD <= 0.7.1, you have to create and mount a sysfs partition on /sys, to keep lvm from getting cranky. Otherwise you can skip this mounting of sysfs, unless you run into trouble. If you forget to do this, instead of giving you an intelligent error message, lvm will simply Segmentation fault at various inconvenient times.<br />
<br />
To mount the sysfs partition, do:<br />
<pre><br />
# mkdir /sys<br />
# mount -t sysfs none /sys<br />
</pre><br />
<br />
'''Let's get started:'''<br />
<br />
Make sure that the device-mapper module is loaded:<br />
<pre><br />
# modprobe dm-mod<br />
</pre><br />
<br />
Now you need to do is tell LVM you have a Physical Volume for it to use. It's really a virtual RAID volume (<code>/dev/md0</code>), but LVM doesn't know this, or really care. Do:<br />
<pre><br />
# pvcreate /dev/md0<br />
</pre><br />
<br />
This might fail if you're using raid or creating PV on an existing Volume Group. If so you might want to add -ff option.<br />
<br />
LVM should report back that it has added the Physical Volume. You can confirm this with:<br />
<pre><br />
# pvdisplay<br />
</pre><br />
<br />
Now it's time to create a Volume Group (which I'll call <code>array</code>) which has control over the LVM Physical Volume we created. Do:<br />
<pre><br />
# vgcreate array /dev/md0<br />
</pre><br />
<br />
LVM should report that it has created the Volume Group <code>array</code>. You can confirm this with:<br />
<pre><br />
# vgdisplay<br />
</pre><br />
<br />
Next, we create a Logical Volume called <code>root</code> in Volume Group <code>array</code> which is 50GB in size:<br />
<pre><br />
# lvcreate --size 50G --name root array<br />
</pre><br />
<br />
LVM should report that it created the Logical Volume <code>root</code>. You can confirm this with:<br />
<pre><br />
# lvdisplay<br />
</pre><br />
<br />
The LVM volume should now be available as <code>/dev/mapper/array-root</code>. Or something similar, LVM will also be able to tell you which when you issue the display command.<br />
<br />
=== Activate existing RAID devices and LVM volumes ===<br />
<br />
If you already have RAID partitions created on your system and you've also set up LVM and all you want is enabling them<br />
follow this simple procedure. ''This might come in handy if you're switching distros and don't want to lose data in /home<br />
for example.'' <br />
<br />
First you need to enable RAID support. RAID1 and RAID5 in this case.<br />
<pre><br />
modprobe raid1<br />
modprobe raid5<br />
</pre><br />
<br />
Activate RAID devices: md1 for /boot and md0 for LVM where two logical volumes will reside.<br />
<pre><br />
mdadm --assemble /dev/md0 /dev/sda3 /dev/sdb3 /dev/sdc3<br />
mdadm --assemble /dev/md1 /dev/sda1 /dev/sdb1 /dev/sdc1<br />
</pre><br />
<br />
RAID devices should now be enabled. Check /proc/mdstat.<br />
<br />
If you haven't loaded kernel LVM support do so now.<br />
<pre><br />
modprobe dm-mod<br />
</pre><br />
Startup of LVM requires just the following two commands: <br />
<pre><br />
vgscan<br />
vgchange -ay<br />
</pre><br />
<br />
You can now jump to '''[3] Set Filesystem Mountpoints''' in your menu based setup and mount created<br />
partitions as needed.<br />
<br />
=== Create and Mount the Filesystems ===<br />
'''When you are using a setup that is newer then 2008.03; this step is optional!'''<br />
<br />
I like Reiser (3.x), so I use it for almost everything. GRUB supports it for booting, and it handles small files well. It's about as well tested as EXT3. You can choose other types if you wish.<br />
<br />
To create /boot:<br />
<pre><br />
# mkreiserfs /dev/md1<br />
</pre><br />
<br />
To create swap space:<br />
<pre><br />
# mkswap /dev/md2<br />
</pre><br />
<br />
To create /:<br />
<pre><br />
# mkreiserfs /dev/array/root<br />
</pre><br />
<br />
Now, mount the boot and root partitions where the installer expects them:<br />
<pre><br />
# mount /dev/array/root /mnt<br />
# mkdir /mnt/boot<br />
# mount /dev/md1 /mnt/boot<br />
</pre><br />
<br />
We've created all our filesystems! And we're ready to install the OS!<br />
<br />
=== Install and Configure Arch ===<br />
<br />
This section doesn't attempt to teach you all about the Arch Installer. It leaves out some details here and there for brevity, but still seeks to be basically follow-able. If you're having trouble with the installer, you may wish to seek help elsewhere in the Wiki or forums.<br />
<br />
'''Note:''' Because the installer builds the initrd using /etc/mdadm.conf, you should update that file with your RAID configuration. The original file can simply be deleted because it contains comments on how to fill it correctly, and that is something mdadm can do automaticly for you. So let's delete the original and have mdadm create you a new one with the currect setup:<br />
<pre><br />
rm /etc/mdadm.conf<br />
mdadm –D –-scan >> /etc/mdadm.conf<br />
</pre><br />
<br />
Now you can continue using the installer to set-up the system and install the packages you need.<br />
Here's the walkthrough:<br />
<br />
* Type <code>/arch/setup</code> to launch the main installer.<br />
* Select <code> < OK ></code> at the opening screen.<br />
* Select <code>1 CD_ROM</code> to install from CD-ROM (or <code>2 FTP</code> if you have a local Arch mirror on FTP).<br />
* If you have skipped the optional step (''Create and Mount the Filesystems'') above, and haven't created a fileystem yet, select <code>1 Prepare Hard Drive</code> > <code>3 Set Filesystem Mountpoints</code> and create your filesystems and mountpoints here'''<br />
* Now at the main menu, Select <code>2 Select Packages</code> and select all the packages in the ''base'' category, as well as the <code>mdadm</code> and <code>lvm2</code> packages from the ''system'' category. Note: mdadm & lvm2 are included in ''base'' category since arch-base-0.7.2.<br />
* Select <code>3 Install Packages</code>. This will take a little while.<br />
* Select <code>4 Configure System</code>:<br />
<br />
Add the ''mdadm'' and ''lvm2'' hook to the HOOKS list in /etc/mkinitcpio.conf '''(before 'filesystems', NOT after)'''.<br />
See [[Configuring_mkinitcpio#Using_raid|Configuring mkinitpcio using RAID]] for more details. <br />
<br />
Edit your <code>/etc/rc.conf</code>. It should contain a <code>USELVM</code> entry already, which you should change to:<br />
<pre><br />
USELVM="yes"<br />
</pre><br />
''Please Note'': The <code>rc.sysinit</code> script that parses the <code>USELVM</code> variable entry will accept either <code>yes</code> or <code>YES</code>, however it will not accept mixed case. Please be sure you've got your capitalization correct.<br />
<br />
Edit your <code>/etc/fstab</code> to contain the entries:<br />
<pre><br />
/dev/array/root / reiserfs defaults 0 1<br />
/dev/md2 swap swap defaults 0 0<br />
/dev/md1 /boot reiserfs defaults 0 0<br />
</pre><br />
<br />
At this point, make any other configuration changes you need to other files.<br />
<br />
Then exit the configuration menu.<br />
<br />
Since you will not be installing Grub from the installer, select <code>7 Exit Install</code> to leave the installer program.<br />
<br />
<br />
'''Old style:'''<br />
<br />
Then specify the raid array you're booting from in /mnt/boot/grub/menu.lst like:<br />
# Example with /dev/array/root for ''/'' & /dev/md1 for ''/boot'':<br />
kernel /kernel26 root=/dev/array/root ro md=1,/dev/sda1,/dev/sdb1,/dev/sdc1 md=0,/dev/sda3,/dev/sdb3,/dev/sdc3<br />
<br />
<br />
'''Nowadays (2009.02), with the mdadm hook in the initrd it it no longer necessary to add kernel parameters concerning the RAID array(s).''' <br />
<br />
The arrays can be assembled on boot by the kernel using that hook and the contents of /etc/mdadm.conf, which is included in the initrd image when it's build. (See [[Configuring_mkinitcpio#Using_raid|Configuring mkinitpcio using RAID]] )<br />
<br />
An example of a GRUB boot configuration for booting of a RAIDed root like this:<br />
<pre><br />
# (0) Arch Linux<br />
title Arch Linux<br />
root (hd0,0)<br />
kernel /vmlinuz26 root=/dev/md0 ro<br />
initrd /kernel26.img<br />
</pre><br />
<br />
=== Install Grub on the Primary Hard Drive (and save the RAID config) ===<br />
<br />
This is the last and final step before you have a bootable system!<br />
<br />
As an overview, the basic concept is to copy over the grub bootloader files into /boot/grub, mount a procfs and a device tree inside of /mnt, then chroot to /mnt so you're effectively inside your new system. Once in your new system, you will run grub to install the bootloader in the boot area of your first hard drive. Then we save our new RAID configuration in <tt>/etc/mdadm.conf</tt> so it can be re-assembled automatically after we reboot.<br />
<br />
Copy the GRUB files into place and get into our chroot:<br />
<pre><br />
# cp -a /mnt/usr/lib/grub/i386-pc/* /mnt/boot/grub<br />
# sync<br />
# mount -o bind /dev /mnt/dev<br />
# mount -t proc none /mnt/proc<br />
# chroot /mnt /bin/bash<br />
</pre><br />
<br />
At this point, you may no longer be able to see keys you type at your console. I'm not sure of the reason for this (NOTE: try "chroot /mnt /bin/<shell>"), but it you can fix it by typing <code>reset</code> at the prompt.<br />
<br />
Once you've got console echo back on, type:<br />
<pre><br />
# grub<br />
</pre><br />
<br />
After a short wait while grub does some looking around, it should come back with a grub prompt. Do:<br />
<br />
<pre><br />
grub> root (hd0,0)<br />
grub> setup (hd0)<br />
grub> quit<br />
</pre><br />
<br />
Now you need to save our RAID configuration so it can be re-assembled automatically each time we boot. Previously, this was an unnecessary step in Arch because the RAID drivers were built in to the kernel. But when loaded after the kernel boots (as modules), arrays are not autodetected. Hence this configuration file.<br />
<br />
The default <code>/etc/mdadm.conf</code> on your chrooted system should be pretty much empty (except for a lot of explanatory comments). All you need to do is capture the output from an mdadm query command and append it to the end of <code>mdadm.conf</code>.<br />
<br />
<pre><br />
# mdadm -D --scan >>/etc/mdadm.conf<br />
</pre><br />
<br />
That's it. You can exit your chroot now by hitting <code>CTRL-D</code> or typing <code>exit</code>.<br />
<br />
=== Reboot ===<br />
<br />
The hard part is all over! Now remove the CD from your CD-ROM drive, and type:<br />
<pre><br />
# reboot<br />
</pre><br />
<br />
=== Install Grub on the Alternate Boot Drives===<br />
<br />
Once you've successfully booted your new system for the first time, you will want to install Grub onto the other two disks (or on the other disk if you have only 2 HDDs) so that, in the event of disk failure, the system can be booted from another drive. Log in to your new system as root and do:<br />
<br />
<pre><br />
# grub<br />
grub> device (hd0) /dev/sdb<br />
grub> root (hd0,0)<br />
grub> setup (hd0)<br />
grub> device (hd0) /dev/sdc<br />
grub> root (hd0,0)<br />
grub> setup (hd0)<br />
grub> quit<br />
</pre><br />
<br />
=== Archive your Filesystem Partition Scheme ===<br />
<br />
Now that you're done, it's worth taking a second to archive off the partition state of each of your drives. This guarantees that it will be trivially easy to replace/rebuild a disk in the event that one fails. You do this with the <code>sfdisk</code> tool and the following steps:<br />
<br />
<pre><br />
# mkdir /etc/partitions<br />
# sfdisk --dump /dev/sda >/etc/partitions/disc0.partitions<br />
# sfdisk --dump /dev/sdb >/etc/partitions/disc1.partitions<br />
# sfdisk --dump /dev/sdc >/etc/partitions/disc2.partitions<br />
</pre><br />
<br />
== Management ==<br />
<br />
For LVM management, please have a look at [[LVM]]<br />
<br />
== Mounting from a Live CD ==<br />
<br />
If you want to mount your RAID partition from a Live CD, use<br />
<br />
<pre><br />
mdadm --assemble /dev/md0 /dev/sda3 /dev/sdb3 /dev/sdc3<br />
</pre><br />
<br />
(or whatever mdX and drives apply to you)<br />
<br />
{{Note | Live CDs like [http://www.sysresccd.org/Main_Page SystemrescueCD] assemble the RAID arrays automatically at boot time if you used the partition type fd at the install of the array)}}<br />
<br />
==Removing device, stop using the array==<br />
<br />
You can remove a device from the array after you mark it as faulty.<br />
<br />
mdadm --fail /dev/md0 /dev/sdxx<br />
<br />
Then you can remove it from the array.<br />
<br />
mdadm -r /dev/md0 /dev/sdxx<br />
<br />
Remove device permanently (for example in the case you want to use it individally from now on).<br />
Issue the two commands described above then:<br />
<br />
mdadm --zero-superblock /dev/sdxx<br />
<br />
After this you can use the disk as you did before creating the array.<br />
<br />
{{Warning | If you reuse the removed disk without zeroing the superblock you will '''LOSE''' all your data next boot. (After mdadm will try to use it as the part of the raid array). '''DO NOT''' issue this command on linear or RAID0 arrays or you will '''LOSE''' all your data on the raid array. }}<br />
<br />
Stop using an array:<br />
<br />
1. Umount target array<br />
2. Stop the array with: <code>mdadm --stop /dev/md0</code><br />
3. Repeat the three command described in the beginning of this section on each device.<br />
4. Remove the corresponding line from /etc/mdadm.conf<br />
<br />
== Conclusion==<br />
<br />
You're done! I hope you've succeeded in setting up Arch Linux on your server with RAID and LVM!<br />
<br />
==Troubleshooting==<br />
If you are getting error when you reboot about "invalid raid superblock magic" and you have additional hard drives other than the ones you installed to, check that your hard drive order is correct. During installation, your RAID devices may be hdd, hde and hdf, but during boot they may be hda, hdb and hdc. Adjust your kernel line in /boot/grub/menu.lst accordingly. This is what happened to me anyway.<br />
<br />
== Credits==<br />
<br />
This document was written by Paul Mattal with with significant help from others. Comments and suggestions are welcome at paul at archlinux dot org.<br />
<br />
Thanks to all who have contributed information and suggestions! This includes:<br />
<br />
* Carl Chave<br />
* Guillaume Darbonne<br />
<br />
== Additional Resources==<br />
<br />
* [http://en.gentoo-wiki.com/wiki/RAID/Software Gentoo wiki entry]</div>Blohttps://wiki.archlinux.org/index.php?title=Installing_with_Software_RAID_or_LVM&diff=80500Installing with Software RAID or LVM2009-10-26T12:51:44Z<p>Blo: /* Removing device, stop using the array */</p>
<hr />
<div>[[Category:Getting and installing Arch (English)]]<br />
[[Category:File systems (English)]]<br />
[[Category:HOWTOs (English)]]<br />
<br />
== Disclaimer==<br />
<br />
{{ Warning | Installing a system with RAID is a complex process. Anything could go wrong. You could make a mistake, I could make a mistake, there could be a bug in something. Backup all your data first. Make sure only the drives involved in the installation are attached while doing the install. You've been warned! }}<br />
<br />
Also note that this document is up-to-date with all "Archisms" as of 2008.06 'Overlord'. It may not be applicable to previous releases of Arch Linux.<br />
<br />
=== RAID ===<br />
<br />
RAID (Redundant Array of Independent Disks) is designed to prevent data loss in the event of a hard disk failure. There are different "levels" of RAID. RAID 0 (striping) isn't really RAID at all, because it provides no redundancy. It does, however, provide speed benefit. We'll use RAID 0 for swap, on the assumption that you're using a desktop, where the speed increase is worth the possibility of having your system crash if one of your drives fails. On a server, you'd almost certainly want RAID 1 or RAID 5. The size of a RAID 0 array block device is the size of the smallest component partition times the number of component partitions.<br />
<br />
RAID 1 is the most straightforward RAID level: straight mirroring. As with other RAID levels, it only makes sense if the partitions are on different physical disk drives. If one of those drives fails, the block device provided by the RAID array will continue to function as normal. We'll be using RAID 1 for everything except swap. Note that RAID 1 is the only option for the boot partition, because bootloaders (which read the boot partition) don't understand RAID, but a RAID 1 component partition can be read as a normal partition. The size of a RAID 1 array block device is the size of the smallest component partition.<br />
<br />
RAID 5 is the only other RAID level you're likely to want. It requires 3 or more physical drives, and provides the redundancy of RAID 1 combined with the speed and size benefits of RAID 0. RAID 5 uses striping, like RAID 0, but also stores parity blocks distributed across each member disk. In the event of a failed disk, these parity blocks are used to reconstruct the data on a replacement disk. RAID 5 can withstand the loss of one member disk.<br />
<br />
'''ATTENTION: Having RAID does not mean you don't need backups - read the CAVEATS section below!'''<br />
<br />
=== LVM ===<br />
<br />
[http://sourceware.org/lvm2/ LVM] (Logical Volume Management) makes use of the [http://sources.redhat.com/dm/ device-mapper] feature of the Linux kernel. It provides a system of specifying partitions independently of the layout of the underlying disk. What this means for you is that you can extend and shrink partitions (subject to the filesystem you use allowing this) and add and remove partitions without worrying about whether you have enough contiguous space on a particular disk, without getting caught up in the problems of fdisking a disk that is in use (and wondering whether the kernel is using the old or new partition table) and without having to move other partition out of the way.<br />
<br />
This is strictly an ease-of-management issue: it doesn't provide any addition security. However, it sits nicely with the other two technologies we're using.<br />
<br />
Note that we're not using LVM for the boot partition (because of the bootloader problem).<br />
<br />
==CAVEATS==<br />
<br />
=== Security (redundancy) ===<br />
<br />
Again, RAID does not provide a guarantee that your data is safe. If there is a fire, if your computer is stolen or if you have multiple hard drive failures, RAID won't protect you. So '''make backups'''. Whether you use tape drives, DVDs, CDROMs or another computer, keep a copy of your data out of your computer (and preferably offsite) and keep it up to date. Get into the habit of making regular backups. If you organize the data on your computer in a way that separates things you are currently working on from "archived" things that are unlikely to change, you can back up the "current" stuff frequently, and the "archived" stuff occasionally.<br />
<br />
== General Approach==<br />
<br />
For starters, note that this document seeks primarily to give you a good example walkthrough of how to install Arch with Software RAID or LVM support for a typical case. It won't try to explain all the possible things you can do -- it's more to give you an example of something that will work that you can then tweak to your own purposes.<br />
<br />
In this example, the machine I'm using will have three similar IDE hard drives, at least 80GB each in size, installed as primary master, primary slave, and secondary master, with my installation CD-ROM drive as the secondary slave. I will assume these can be reached as /dev/sda, /dev/sdb, and /dev/sdc, and that the cdrom drive is /dev/cdrom.<br />
<br />
We'll create a 100MB /boot partition, a 2048MB (2GB) swap partition and a ~ 78GB root partition using LVM. The boot and swap partitions will be RAID1, while the root partition will be RAID5. Why RAID1? For boot, it's so you can boot the kernel from grub (which has no RAID drivers!), and for swap, it's for redundancy, so that your machine will not lose its swap state even if 1 or 2 drives fail.<br />
<br />
Each RAID1 redundant partition will have three physical partitions, all the same size, one on each of the drives. The total storage capacity will be the size of a single one of these physical partitions. A RAID1 redundant partition with 3 physical partitions can lose any two of its physical partitions and still function.<br />
<br />
Each RAID5 redundant partition will also have three physical partitions, all the same size, one on each of the drives. The total storage capacity will be the combined size of ''two'' of these physical partitions, with the third drive being consumed to provide parity information. A RAID5 redundant partition with 3 physical partitions can lose any one of its physical partitions and still function.<br />
<br />
== Get the Arch Installer CD ==<br />
<br />
Please note that in order to use LVM, you need the <code>lvm2</code> and <code>dev-mapper</code> packages installed, otherwise you won't be able to see any LVM partitions on reboot, until you install those packages. Note that the Arch 0.7.1 Base installer ''does not'' contain these packages, but the Arch 0.7.1 Full installer does. So if you're going to use LVM, you'll need to download the bigger ISO. My example will describe you using the Full installer; the changes should be minimal if you wish to use the Base installer instead.<br />
<br />
== Outline ==<br />
<br />
Just to give you an idea of how all this will work, I'll outline the steps. The details for these will be filled in below.<br />
<br />
# Boot the Installer CD<br />
# Partition the Hard Drives<br />
# Create the RAID Redundant Partitions<br />
# Create and Mount the Main Filesystems<br />
# Setup LVM and Create the / (root) LVM Volume<br />
# Install and Configure Arch<br />
# Install Grub on the Primary Hard Drive<br />
# Unmount Filesystems and Reboot<br />
# Install Grub on the Alternate Boot Drives<br />
# Archive your Filesystem Partition Scheme<br />
<br />
== Procedure==<br />
<br />
=== Boot the Installer CD===<br />
<br />
First, load all your drives in the machine. Then boot the Arch Linux 0.7 ''Full'' installation CD.<br />
<br />
At the syslinux boot prompt, hit enter: we want to use the SCSI kernel, which has support for RAID and LVM built in.<br />
<br />
So far, this is easy. Don't worry, it gets harder.<br />
<br />
=== Partition the Hard Drives===<br />
If your hard drives are already prepared and all you want to do is activate RAID and LVM jump to [[Installing_with_Software_RAID_or_LVM#Activate_existing_RAID_devices_and_LVM_volumes|Activate exsiting RAID devices and LVM volumes]].<br />
<br />
We'll use <code>cfdisk</code> to do this partitioning. We want to create 3 partitions on each of the three drive:<br />
<br />
Partition 1 (/boot): 100MB, type FD, bootable<br><br />
Partition 2 (swap): 2048MB, type FD<br><br />
Partition 3 (LVM): <Rest of the drive>, type FD<br />
<br />
Note that in general, in <code>cfdisk</code>, you can use the first letter of each <code>[[Bracketed Option]]</code> to select it; however, this is not true for the <code>[[Write]]</code> command, you have to hold SHIFT as well to select it.<br />
<br />
First run:<br />
<pre><br />
# cfdisk /dev/sda<br />
</pre><br />
<br />
Create each partition in order:<br />
<br />
# Select <code>'''New'''</code>.<br />
# Hit Enter to make it a <code>'''Primary'''</code> partition.<br />
# Type the appropriate size (in MB), or for Partition 3, just hit enter to select the remainder of the drive.<br />
# Hit Enter to choose to place the partition at the <code>'''Beginning'''</code>.<br />
# Select <code>'''Type'''</code>, hit enter to see the second page of the list, and then type <code>fd</code> for the Linux RAID Autodetect type.<br />
# ''For Partition 1 on each drive'', select <code>'''Bootable'''</code>.<br />
# Hit down arrow (selecting the remaining free space) to go on to the next partition to be created.<br />
<br />
When you're done, select <code>'''Write'''</code>, and confirm <code>y-e-s</code> that you want to write the partition information to disk.<br />
<br />
Then select <code>'''Quit'''</code>.<br />
<br />
Repeat this for the other two drives:<br />
<br />
<pre><br />
# cfdisk /dev/sdb<br />
# cfdisk /dev/sdc<br />
</pre><br />
<br />
Create the same exact partitions on each disk. If a group of partitions of different sizes are assembled to create a redundant RAID partition, it ''will'' work, but the redundant partition will be in multiples of the size of the smallest one, leaving the rest of the allocated drive space to waste.<br />
<br />
=== Load the RAID Modules ===<br />
<br />
Before using <code>mdadm</code>, you need load the modules for the RAID levels you'll be using. In this example, we're using levels 1 and 5, so we'll load those. You can ignore any modprobe errors like <code>"cannot insert md-mod.ko: File exists"</code>. Busybox's modprobe can be a little slow sometimes.<br />
<br />
<pre><br />
# modprobe raid1<br />
# modprobe raid5<br />
</pre><br />
<br />
=== Create the RAID Redundant Partitions ===<br />
<br />
Now that you've created all the physical partitions, you're ready to set up RAID. The tool you use to create RAID arrays is <code>mdadm</code>.<br />
<br />
To create /dev/md0 (/):<br />
<pre><br />
# mdadm --create /dev/md0 --level=5 --raid-devices=3 /dev/sda3 /dev/sdb3 /dev/sdc3<br />
</pre><br />
<br />
To create /dev/md1 (/boot):<br />
<pre><br />
# mdadm --create /dev/md1 --level=1 --raid-devices=3 /dev/sda1 /dev/sdb1 /dev/sdc1<br />
</pre><br />
<br />
To create /dev/md2 (swap):<br />
<pre><br />
# mdadm --create /dev/md2 --level=1 --raid-devices=3 /dev/sda2 /dev/sdb2 /dev/sdc2<br />
</pre><br />
<br />
At this point, you should have working RAID partitions. When you create the RAID partitions, they need to sync themselves so the contents of all three physical partitions are the same on all three drives. The hard drives lights will come on as they try to sync up. You can monitor the progress by typing:<br />
<pre><br />
# cat /proc/mdstat<br />
</pre><br />
<br />
You can also get particular information about, say, the root partition by typing:<br />
<pre><br />
# mdadm --misc --detail /dev/md0<br />
</pre><br />
<br />
You don't have to wait for synchronization to finish -- you may proceed with the installation while syncronization is still occurring. You can even reboot at the end of the installation with synchronization still going.<br />
<br />
=== Setup LVM and Create the / (root) LVM Volume===<br />
This is where you create the LVM volumes. LVM works with abstract layers, check out [[LVM|LVM]] and/or it's documentation to discover more. What you will be doing in short:<br />
* Turn block devices (e.g. /dev/sda1 or /dev/md0) into Physical Volume(s) that can be used by LVM<br />
* Create a Volume Group consisting of Physical Volume(s)<br />
* Create Logical Volume(s) within the Volume Group <br />
<br />
'''Note:'''<br />
If you are using an Arch Linux install CD <= 0.7.1, you have to create and mount a sysfs partition on /sys, to keep lvm from getting cranky. Otherwise you can skip this mounting of sysfs, unless you run into trouble. If you forget to do this, instead of giving you an intelligent error message, lvm will simply Segmentation fault at various inconvenient times.<br />
<br />
To mount the sysfs partition, do:<br />
<pre><br />
# mkdir /sys<br />
# mount -t sysfs none /sys<br />
</pre><br />
<br />
'''Let's get started:'''<br />
<br />
Make sure that the device-mapper module is loaded:<br />
<pre><br />
# modprobe dm-mod<br />
</pre><br />
<br />
Now you need to do is tell LVM you have a Physical Volume for it to use. It's really a virtual RAID volume (<code>/dev/md0</code>), but LVM doesn't know this, or really care. Do:<br />
<pre><br />
# pvcreate /dev/md0<br />
</pre><br />
<br />
This might fail if you're using raid or creating PV on an existing Volume Group. If so you might want to add -ff option.<br />
<br />
LVM should report back that it has added the Physical Volume. You can confirm this with:<br />
<pre><br />
# pvdisplay<br />
</pre><br />
<br />
Now it's time to create a Volume Group (which I'll call <code>array</code>) which has control over the LVM Physical Volume we created. Do:<br />
<pre><br />
# vgcreate array /dev/md0<br />
</pre><br />
<br />
LVM should report that it has created the Volume Group <code>array</code>. You can confirm this with:<br />
<pre><br />
# vgdisplay<br />
</pre><br />
<br />
Next, we create a Logical Volume called <code>root</code> in Volume Group <code>array</code> which is 50GB in size:<br />
<pre><br />
# lvcreate --size 50G --name root array<br />
</pre><br />
<br />
LVM should report that it created the Logical Volume <code>root</code>. You can confirm this with:<br />
<pre><br />
# lvdisplay<br />
</pre><br />
<br />
The LVM volume should now be available as <code>/dev/mapper/array-root</code>. Or something similar, LVM will also be able to tell you which when you issue the display command.<br />
<br />
=== Activate existing RAID devices and LVM volumes ===<br />
<br />
If you already have RAID partitions created on your system and you've also set up LVM and all you want is enabling them<br />
follow this simple procedure. ''This might come in handy if you're switching distros and don't want to lose data in /home<br />
for example.'' <br />
<br />
First you need to enable RAID support. RAID1 and RAID5 in this case.<br />
<pre><br />
modprobe raid1<br />
modprobe raid5<br />
</pre><br />
<br />
Activate RAID devices: md1 for /boot and md0 for LVM where two logical volumes will reside.<br />
<pre><br />
mdadm --assemble /dev/md0 /dev/sda3 /dev/sdb3 /dev/sdc3<br />
mdadm --assemble /dev/md1 /dev/sda1 /dev/sdb1 /dev/sdc1<br />
</pre><br />
<br />
RAID devices should now be enabled. Check /proc/mdstat.<br />
<br />
If you haven't loaded kernel LVM support do so now.<br />
<pre><br />
modprobe dm-mod<br />
</pre><br />
Startup of LVM requires just the following two commands: <br />
<pre><br />
vgscan<br />
vgchange -ay<br />
</pre><br />
<br />
You can now jump to '''[3] Set Filesystem Mountpoints''' in your menu based setup and mount created<br />
partitions as needed.<br />
<br />
=== Create and Mount the Filesystems ===<br />
'''When you are using a setup that is newer then 2008.03; this step is optional!'''<br />
<br />
I like Reiser (3.x), so I use it for almost everything. GRUB supports it for booting, and it handles small files well. It's about as well tested as EXT3. You can choose other types if you wish.<br />
<br />
To create /boot:<br />
<pre><br />
# mkreiserfs /dev/md1<br />
</pre><br />
<br />
To create swap space:<br />
<pre><br />
# mkswap /dev/md2<br />
</pre><br />
<br />
To create /:<br />
<pre><br />
# mkreiserfs /dev/array/root<br />
</pre><br />
<br />
Now, mount the boot and root partitions where the installer expects them:<br />
<pre><br />
# mount /dev/array/root /mnt<br />
# mkdir /mnt/boot<br />
# mount /dev/md1 /mnt/boot<br />
</pre><br />
<br />
We've created all our filesystems! And we're ready to install the OS!<br />
<br />
=== Install and Configure Arch ===<br />
<br />
This section doesn't attempt to teach you all about the Arch Installer. It leaves out some details here and there for brevity, but still seeks to be basically follow-able. If you're having trouble with the installer, you may wish to seek help elsewhere in the Wiki or forums.<br />
<br />
'''Note:''' Because the installer builds the initrd using /etc/mdadm.conf, you should update that file with your RAID configuration. The original file can simply be deleted because it contains comments on how to fill it correctly, and that is something mdadm can do automaticly for you. So let's delete the original and have mdadm create you a new one with the currect setup:<br />
<pre><br />
rm /etc/mdadm.conf<br />
mdadm –D –-scan >> /etc/mdadm.conf<br />
</pre><br />
<br />
Now you can continue using the installer to set-up the system and install the packages you need.<br />
Here's the walkthrough:<br />
<br />
* Type <code>/arch/setup</code> to launch the main installer.<br />
* Select <code> < OK ></code> at the opening screen.<br />
* Select <code>1 CD_ROM</code> to install from CD-ROM (or <code>2 FTP</code> if you have a local Arch mirror on FTP).<br />
* If you have skipped the optional step (''Create and Mount the Filesystems'') above, and haven't created a fileystem yet, select <code>1 Prepare Hard Drive</code> > <code>3 Set Filesystem Mountpoints</code> and create your filesystems and mountpoints here'''<br />
* Now at the main menu, Select <code>2 Select Packages</code> and select all the packages in the ''base'' category, as well as the <code>mdadm</code> and <code>lvm2</code> packages from the ''system'' category. Note: mdadm & lvm2 are included in ''base'' category since arch-base-0.7.2.<br />
* Select <code>3 Install Packages</code>. This will take a little while.<br />
* Select <code>4 Configure System</code>:<br />
<br />
Add the ''mdadm'' and ''lvm2'' hook to the HOOKS list in /etc/mkinitcpio.conf '''(before 'filesystems', NOT after)'''.<br />
See [[Configuring_mkinitcpio#Using_raid|Configuring mkinitpcio using RAID]] for more details. <br />
<br />
Edit your <code>/etc/rc.conf</code>. It should contain a <code>USELVM</code> entry already, which you should change to:<br />
<pre><br />
USELVM="yes"<br />
</pre><br />
''Please Note'': The <code>rc.sysinit</code> script that parses the <code>USELVM</code> variable entry will accept either <code>yes</code> or <code>YES</code>, however it will not accept mixed case. Please be sure you've got your capitalization correct.<br />
<br />
Edit your <code>/etc/fstab</code> to contain the entries:<br />
<pre><br />
/dev/array/root / reiserfs defaults 0 1<br />
/dev/md2 swap swap defaults 0 0<br />
/dev/md1 /boot reiserfs defaults 0 0<br />
</pre><br />
<br />
At this point, make any other configuration changes you need to other files.<br />
<br />
Then exit the configuration menu.<br />
<br />
Since you will not be installing Grub from the installer, select <code>7 Exit Install</code> to leave the installer program.<br />
<br />
<br />
'''Old style:'''<br />
<br />
Then specify the raid array you're booting from in /mnt/boot/grub/menu.lst like:<br />
# Example with /dev/array/root for ''/'' & /dev/md1 for ''/boot'':<br />
kernel /kernel26 root=/dev/array/root ro md=1,/dev/sda1,/dev/sdb1,/dev/sdc1 md=0,/dev/sda3,/dev/sdb3,/dev/sdc3<br />
<br />
<br />
'''Nowadays (2009.02), with the mdadm hook in the initrd it it no longer necessary to add kernel parameters concerning the RAID array(s).''' <br />
<br />
The arrays can be assembled on boot by the kernel using that hook and the contents of /etc/mdadm.conf, which is included in the initrd image when it's build. (See [[Configuring_mkinitcpio#Using_raid|Configuring mkinitpcio using RAID]] )<br />
<br />
An example of a GRUB boot configuration for booting of a RAIDed root like this:<br />
<pre><br />
# (0) Arch Linux<br />
title Arch Linux<br />
root (hd0,0)<br />
kernel /vmlinuz26 root=/dev/md0 ro<br />
initrd /kernel26.img<br />
</pre><br />
<br />
=== Install Grub on the Primary Hard Drive (and save the RAID config) ===<br />
<br />
This is the last and final step before you have a bootable system!<br />
<br />
As an overview, the basic concept is to copy over the grub bootloader files into /boot/grub, mount a procfs and a device tree inside of /mnt, then chroot to /mnt so you're effectively inside your new system. Once in your new system, you will run grub to install the bootloader in the boot area of your first hard drive. Then we save our new RAID configuration in <tt>/etc/mdadm.conf</tt> so it can be re-assembled automatically after we reboot.<br />
<br />
Copy the GRUB files into place and get into our chroot:<br />
<pre><br />
# cp -a /mnt/usr/lib/grub/i386-pc/* /mnt/boot/grub<br />
# sync<br />
# mount -o bind /dev /mnt/dev<br />
# mount -t proc none /mnt/proc<br />
# chroot /mnt /bin/bash<br />
</pre><br />
<br />
At this point, you may no longer be able to see keys you type at your console. I'm not sure of the reason for this (NOTE: try "chroot /mnt /bin/<shell>"), but it you can fix it by typing <code>reset</code> at the prompt.<br />
<br />
Once you've got console echo back on, type:<br />
<pre><br />
# grub<br />
</pre><br />
<br />
After a short wait while grub does some looking around, it should come back with a grub prompt. Do:<br />
<br />
<pre><br />
grub> root (hd0,0)<br />
grub> setup (hd0)<br />
grub> quit<br />
</pre><br />
<br />
Now you need to save our RAID configuration so it can be re-assembled automatically each time we boot. Previously, this was an unnecessary step in Arch because the RAID drivers were built in to the kernel. But when loaded after the kernel boots (as modules), arrays are not autodetected. Hence this configuration file.<br />
<br />
The default <code>/etc/mdadm.conf</code> on your chrooted system should be pretty much empty (except for a lot of explanatory comments). All you need to do is capture the output from an mdadm query command and append it to the end of <code>mdadm.conf</code>.<br />
<br />
<pre><br />
# mdadm -D --scan >>/etc/mdadm.conf<br />
</pre><br />
<br />
That's it. You can exit your chroot now by hitting <code>CTRL-D</code> or typing <code>exit</code>.<br />
<br />
=== Reboot ===<br />
<br />
The hard part is all over! Now remove the CD from your CD-ROM drive, and type:<br />
<pre><br />
# reboot<br />
</pre><br />
<br />
=== Install Grub on the Alternate Boot Drives===<br />
<br />
Once you've successfully booted your new system for the first time, you will want to install Grub onto the other two disks (or on the other disk if you have only 2 HDDs) so that, in the event of disk failure, the system can be booted from another drive. Log in to your new system as root and do:<br />
<br />
<pre><br />
# grub<br />
grub> device (hd0) /dev/sdb<br />
grub> root (hd0,0)<br />
grub> setup (hd0)<br />
grub> device (hd0) /dev/sdc<br />
grub> root (hd0,0)<br />
grub> setup (hd0)<br />
grub> quit<br />
</pre><br />
<br />
=== Archive your Filesystem Partition Scheme ===<br />
<br />
Now that you're done, it's worth taking a second to archive off the partition state of each of your drives. This guarantees that it will be trivially easy to replace/rebuild a disk in the event that one fails. You do this with the <code>sfdisk</code> tool and the following steps:<br />
<br />
<pre><br />
# mkdir /etc/partitions<br />
# sfdisk --dump /dev/sda >/etc/partitions/disc0.partitions<br />
# sfdisk --dump /dev/sdb >/etc/partitions/disc1.partitions<br />
# sfdisk --dump /dev/sdc >/etc/partitions/disc2.partitions<br />
</pre><br />
<br />
== Management ==<br />
<br />
For LVM management, please have a look at [[LVM]]<br />
<br />
== Mounting from a Live CD ==<br />
<br />
If you want to mount your RAID partition from a Live CD, use<br />
<br />
<pre><br />
mdadm --assemble /dev/md0 /dev/sda3 /dev/sdb3 /dev/sdc3<br />
</pre><br />
<br />
(or whatever mdX and drives apply to you)<br />
<br />
{{Note | Live CDs like [http://www.sysresccd.org/Main_Page SystemrescueCD] assemble the RAID arrays automatically at boot time if you used the partition type fd at the install of the array)}}<br />
<br />
==Removing device, stop using the array==<br />
<br />
You can remove a device from the array after you mark it as faulty.<br />
<br />
mdadm --fail /dev/md0 /dev/sdxx<br />
<br />
Then you can remove it from the array.<br />
<br />
mdadm -r /dev/md0 /dev/sdxx<br />
<br />
Remove device permanently (for example in the case you want to use it individally from now on).<br />
Issue the two commands described above then:<br />
<br />
mdadm --zero-superblock /dev/sdxx<br />
<br />
After this you can use the disk as you did before creating the array.<br />
<br />
{{Warning | If you reuse the removed disk without zeroing the superblock you will '''LOSE''' all your data next boot. (After mdadm will try to use it as the part of the raid array). '''DO NOT''' issue this command on linear or raid arrays or you will '''LOSE''' all your data on the raid array. }}<br />
<br />
Stop using an array:<br />
<br />
1. Umount target array<br />
2. Stop the array with: <code>mdadm --stop /dev/md0</code><br />
3. Repeat the three command described in the beginning of this section on each device.<br />
4. Remove the corresponding line from /etc/mdadm.conf<br />
<br />
== Conclusion==<br />
<br />
You're done! I hope you've succeeded in setting up Arch Linux on your server with RAID and LVM!<br />
<br />
==Troubleshooting==<br />
If you are getting error when you reboot about "invalid raid superblock magic" and you have additional hard drives other than the ones you installed to, check that your hard drive order is correct. During installation, your RAID devices may be hdd, hde and hdf, but during boot they may be hda, hdb and hdc. Adjust your kernel line in /boot/grub/menu.lst accordingly. This is what happened to me anyway.<br />
<br />
== Credits==<br />
<br />
This document was written by Paul Mattal with with significant help from others. Comments and suggestions are welcome at paul at archlinux dot org.<br />
<br />
Thanks to all who have contributed information and suggestions! This includes:<br />
<br />
* Carl Chave<br />
* Guillaume Darbonne<br />
<br />
== Additional Resources==<br />
<br />
* [http://en.gentoo-wiki.com/wiki/RAID/Software Gentoo wiki entry]</div>Blohttps://wiki.archlinux.org/index.php?title=Installing_with_Software_RAID_or_LVM&diff=80499Installing with Software RAID or LVM2009-10-26T12:50:35Z<p>Blo: </p>
<hr />
<div>[[Category:Getting and installing Arch (English)]]<br />
[[Category:File systems (English)]]<br />
[[Category:HOWTOs (English)]]<br />
<br />
== Disclaimer==<br />
<br />
{{ Warning | Installing a system with RAID is a complex process. Anything could go wrong. You could make a mistake, I could make a mistake, there could be a bug in something. Backup all your data first. Make sure only the drives involved in the installation are attached while doing the install. You've been warned! }}<br />
<br />
Also note that this document is up-to-date with all "Archisms" as of 2008.06 'Overlord'. It may not be applicable to previous releases of Arch Linux.<br />
<br />
=== RAID ===<br />
<br />
RAID (Redundant Array of Independent Disks) is designed to prevent data loss in the event of a hard disk failure. There are different "levels" of RAID. RAID 0 (striping) isn't really RAID at all, because it provides no redundancy. It does, however, provide speed benefit. We'll use RAID 0 for swap, on the assumption that you're using a desktop, where the speed increase is worth the possibility of having your system crash if one of your drives fails. On a server, you'd almost certainly want RAID 1 or RAID 5. The size of a RAID 0 array block device is the size of the smallest component partition times the number of component partitions.<br />
<br />
RAID 1 is the most straightforward RAID level: straight mirroring. As with other RAID levels, it only makes sense if the partitions are on different physical disk drives. If one of those drives fails, the block device provided by the RAID array will continue to function as normal. We'll be using RAID 1 for everything except swap. Note that RAID 1 is the only option for the boot partition, because bootloaders (which read the boot partition) don't understand RAID, but a RAID 1 component partition can be read as a normal partition. The size of a RAID 1 array block device is the size of the smallest component partition.<br />
<br />
RAID 5 is the only other RAID level you're likely to want. It requires 3 or more physical drives, and provides the redundancy of RAID 1 combined with the speed and size benefits of RAID 0. RAID 5 uses striping, like RAID 0, but also stores parity blocks distributed across each member disk. In the event of a failed disk, these parity blocks are used to reconstruct the data on a replacement disk. RAID 5 can withstand the loss of one member disk.<br />
<br />
'''ATTENTION: Having RAID does not mean you don't need backups - read the CAVEATS section below!'''<br />
<br />
=== LVM ===<br />
<br />
[http://sourceware.org/lvm2/ LVM] (Logical Volume Management) makes use of the [http://sources.redhat.com/dm/ device-mapper] feature of the Linux kernel. It provides a system of specifying partitions independently of the layout of the underlying disk. What this means for you is that you can extend and shrink partitions (subject to the filesystem you use allowing this) and add and remove partitions without worrying about whether you have enough contiguous space on a particular disk, without getting caught up in the problems of fdisking a disk that is in use (and wondering whether the kernel is using the old or new partition table) and without having to move other partition out of the way.<br />
<br />
This is strictly an ease-of-management issue: it doesn't provide any addition security. However, it sits nicely with the other two technologies we're using.<br />
<br />
Note that we're not using LVM for the boot partition (because of the bootloader problem).<br />
<br />
==CAVEATS==<br />
<br />
=== Security (redundancy) ===<br />
<br />
Again, RAID does not provide a guarantee that your data is safe. If there is a fire, if your computer is stolen or if you have multiple hard drive failures, RAID won't protect you. So '''make backups'''. Whether you use tape drives, DVDs, CDROMs or another computer, keep a copy of your data out of your computer (and preferably offsite) and keep it up to date. Get into the habit of making regular backups. If you organize the data on your computer in a way that separates things you are currently working on from "archived" things that are unlikely to change, you can back up the "current" stuff frequently, and the "archived" stuff occasionally.<br />
<br />
== General Approach==<br />
<br />
For starters, note that this document seeks primarily to give you a good example walkthrough of how to install Arch with Software RAID or LVM support for a typical case. It won't try to explain all the possible things you can do -- it's more to give you an example of something that will work that you can then tweak to your own purposes.<br />
<br />
In this example, the machine I'm using will have three similar IDE hard drives, at least 80GB each in size, installed as primary master, primary slave, and secondary master, with my installation CD-ROM drive as the secondary slave. I will assume these can be reached as /dev/sda, /dev/sdb, and /dev/sdc, and that the cdrom drive is /dev/cdrom.<br />
<br />
We'll create a 100MB /boot partition, a 2048MB (2GB) swap partition and a ~ 78GB root partition using LVM. The boot and swap partitions will be RAID1, while the root partition will be RAID5. Why RAID1? For boot, it's so you can boot the kernel from grub (which has no RAID drivers!), and for swap, it's for redundancy, so that your machine will not lose its swap state even if 1 or 2 drives fail.<br />
<br />
Each RAID1 redundant partition will have three physical partitions, all the same size, one on each of the drives. The total storage capacity will be the size of a single one of these physical partitions. A RAID1 redundant partition with 3 physical partitions can lose any two of its physical partitions and still function.<br />
<br />
Each RAID5 redundant partition will also have three physical partitions, all the same size, one on each of the drives. The total storage capacity will be the combined size of ''two'' of these physical partitions, with the third drive being consumed to provide parity information. A RAID5 redundant partition with 3 physical partitions can lose any one of its physical partitions and still function.<br />
<br />
== Get the Arch Installer CD ==<br />
<br />
Please note that in order to use LVM, you need the <code>lvm2</code> and <code>dev-mapper</code> packages installed, otherwise you won't be able to see any LVM partitions on reboot, until you install those packages. Note that the Arch 0.7.1 Base installer ''does not'' contain these packages, but the Arch 0.7.1 Full installer does. So if you're going to use LVM, you'll need to download the bigger ISO. My example will describe you using the Full installer; the changes should be minimal if you wish to use the Base installer instead.<br />
<br />
== Outline ==<br />
<br />
Just to give you an idea of how all this will work, I'll outline the steps. The details for these will be filled in below.<br />
<br />
# Boot the Installer CD<br />
# Partition the Hard Drives<br />
# Create the RAID Redundant Partitions<br />
# Create and Mount the Main Filesystems<br />
# Setup LVM and Create the / (root) LVM Volume<br />
# Install and Configure Arch<br />
# Install Grub on the Primary Hard Drive<br />
# Unmount Filesystems and Reboot<br />
# Install Grub on the Alternate Boot Drives<br />
# Archive your Filesystem Partition Scheme<br />
<br />
== Procedure==<br />
<br />
=== Boot the Installer CD===<br />
<br />
First, load all your drives in the machine. Then boot the Arch Linux 0.7 ''Full'' installation CD.<br />
<br />
At the syslinux boot prompt, hit enter: we want to use the SCSI kernel, which has support for RAID and LVM built in.<br />
<br />
So far, this is easy. Don't worry, it gets harder.<br />
<br />
=== Partition the Hard Drives===<br />
If your hard drives are already prepared and all you want to do is activate RAID and LVM jump to [[Installing_with_Software_RAID_or_LVM#Activate_existing_RAID_devices_and_LVM_volumes|Activate exsiting RAID devices and LVM volumes]].<br />
<br />
We'll use <code>cfdisk</code> to do this partitioning. We want to create 3 partitions on each of the three drive:<br />
<br />
Partition 1 (/boot): 100MB, type FD, bootable<br><br />
Partition 2 (swap): 2048MB, type FD<br><br />
Partition 3 (LVM): <Rest of the drive>, type FD<br />
<br />
Note that in general, in <code>cfdisk</code>, you can use the first letter of each <code>[[Bracketed Option]]</code> to select it; however, this is not true for the <code>[[Write]]</code> command, you have to hold SHIFT as well to select it.<br />
<br />
First run:<br />
<pre><br />
# cfdisk /dev/sda<br />
</pre><br />
<br />
Create each partition in order:<br />
<br />
# Select <code>'''New'''</code>.<br />
# Hit Enter to make it a <code>'''Primary'''</code> partition.<br />
# Type the appropriate size (in MB), or for Partition 3, just hit enter to select the remainder of the drive.<br />
# Hit Enter to choose to place the partition at the <code>'''Beginning'''</code>.<br />
# Select <code>'''Type'''</code>, hit enter to see the second page of the list, and then type <code>fd</code> for the Linux RAID Autodetect type.<br />
# ''For Partition 1 on each drive'', select <code>'''Bootable'''</code>.<br />
# Hit down arrow (selecting the remaining free space) to go on to the next partition to be created.<br />
<br />
When you're done, select <code>'''Write'''</code>, and confirm <code>y-e-s</code> that you want to write the partition information to disk.<br />
<br />
Then select <code>'''Quit'''</code>.<br />
<br />
Repeat this for the other two drives:<br />
<br />
<pre><br />
# cfdisk /dev/sdb<br />
# cfdisk /dev/sdc<br />
</pre><br />
<br />
Create the same exact partitions on each disk. If a group of partitions of different sizes are assembled to create a redundant RAID partition, it ''will'' work, but the redundant partition will be in multiples of the size of the smallest one, leaving the rest of the allocated drive space to waste.<br />
<br />
=== Load the RAID Modules ===<br />
<br />
Before using <code>mdadm</code>, you need load the modules for the RAID levels you'll be using. In this example, we're using levels 1 and 5, so we'll load those. You can ignore any modprobe errors like <code>"cannot insert md-mod.ko: File exists"</code>. Busybox's modprobe can be a little slow sometimes.<br />
<br />
<pre><br />
# modprobe raid1<br />
# modprobe raid5<br />
</pre><br />
<br />
=== Create the RAID Redundant Partitions ===<br />
<br />
Now that you've created all the physical partitions, you're ready to set up RAID. The tool you use to create RAID arrays is <code>mdadm</code>.<br />
<br />
To create /dev/md0 (/):<br />
<pre><br />
# mdadm --create /dev/md0 --level=5 --raid-devices=3 /dev/sda3 /dev/sdb3 /dev/sdc3<br />
</pre><br />
<br />
To create /dev/md1 (/boot):<br />
<pre><br />
# mdadm --create /dev/md1 --level=1 --raid-devices=3 /dev/sda1 /dev/sdb1 /dev/sdc1<br />
</pre><br />
<br />
To create /dev/md2 (swap):<br />
<pre><br />
# mdadm --create /dev/md2 --level=1 --raid-devices=3 /dev/sda2 /dev/sdb2 /dev/sdc2<br />
</pre><br />
<br />
At this point, you should have working RAID partitions. When you create the RAID partitions, they need to sync themselves so the contents of all three physical partitions are the same on all three drives. The hard drives lights will come on as they try to sync up. You can monitor the progress by typing:<br />
<pre><br />
# cat /proc/mdstat<br />
</pre><br />
<br />
You can also get particular information about, say, the root partition by typing:<br />
<pre><br />
# mdadm --misc --detail /dev/md0<br />
</pre><br />
<br />
You don't have to wait for synchronization to finish -- you may proceed with the installation while syncronization is still occurring. You can even reboot at the end of the installation with synchronization still going.<br />
<br />
=== Setup LVM and Create the / (root) LVM Volume===<br />
This is where you create the LVM volumes. LVM works with abstract layers, check out [[LVM|LVM]] and/or it's documentation to discover more. What you will be doing in short:<br />
* Turn block devices (e.g. /dev/sda1 or /dev/md0) into Physical Volume(s) that can be used by LVM<br />
* Create a Volume Group consisting of Physical Volume(s)<br />
* Create Logical Volume(s) within the Volume Group <br />
<br />
'''Note:'''<br />
If you are using an Arch Linux install CD <= 0.7.1, you have to create and mount a sysfs partition on /sys, to keep lvm from getting cranky. Otherwise you can skip this mounting of sysfs, unless you run into trouble. If you forget to do this, instead of giving you an intelligent error message, lvm will simply Segmentation fault at various inconvenient times.<br />
<br />
To mount the sysfs partition, do:<br />
<pre><br />
# mkdir /sys<br />
# mount -t sysfs none /sys<br />
</pre><br />
<br />
'''Let's get started:'''<br />
<br />
Make sure that the device-mapper module is loaded:<br />
<pre><br />
# modprobe dm-mod<br />
</pre><br />
<br />
Now you need to do is tell LVM you have a Physical Volume for it to use. It's really a virtual RAID volume (<code>/dev/md0</code>), but LVM doesn't know this, or really care. Do:<br />
<pre><br />
# pvcreate /dev/md0<br />
</pre><br />
<br />
This might fail if you're using raid or creating PV on an existing Volume Group. If so you might want to add -ff option.<br />
<br />
LVM should report back that it has added the Physical Volume. You can confirm this with:<br />
<pre><br />
# pvdisplay<br />
</pre><br />
<br />
Now it's time to create a Volume Group (which I'll call <code>array</code>) which has control over the LVM Physical Volume we created. Do:<br />
<pre><br />
# vgcreate array /dev/md0<br />
</pre><br />
<br />
LVM should report that it has created the Volume Group <code>array</code>. You can confirm this with:<br />
<pre><br />
# vgdisplay<br />
</pre><br />
<br />
Next, we create a Logical Volume called <code>root</code> in Volume Group <code>array</code> which is 50GB in size:<br />
<pre><br />
# lvcreate --size 50G --name root array<br />
</pre><br />
<br />
LVM should report that it created the Logical Volume <code>root</code>. You can confirm this with:<br />
<pre><br />
# lvdisplay<br />
</pre><br />
<br />
The LVM volume should now be available as <code>/dev/mapper/array-root</code>. Or something similar, LVM will also be able to tell you which when you issue the display command.<br />
<br />
=== Activate existing RAID devices and LVM volumes ===<br />
<br />
If you already have RAID partitions created on your system and you've also set up LVM and all you want is enabling them<br />
follow this simple procedure. ''This might come in handy if you're switching distros and don't want to lose data in /home<br />
for example.'' <br />
<br />
First you need to enable RAID support. RAID1 and RAID5 in this case.<br />
<pre><br />
modprobe raid1<br />
modprobe raid5<br />
</pre><br />
<br />
Activate RAID devices: md1 for /boot and md0 for LVM where two logical volumes will reside.<br />
<pre><br />
mdadm --assemble /dev/md0 /dev/sda3 /dev/sdb3 /dev/sdc3<br />
mdadm --assemble /dev/md1 /dev/sda1 /dev/sdb1 /dev/sdc1<br />
</pre><br />
<br />
RAID devices should now be enabled. Check /proc/mdstat.<br />
<br />
If you haven't loaded kernel LVM support do so now.<br />
<pre><br />
modprobe dm-mod<br />
</pre><br />
Startup of LVM requires just the following two commands: <br />
<pre><br />
vgscan<br />
vgchange -ay<br />
</pre><br />
<br />
You can now jump to '''[3] Set Filesystem Mountpoints''' in your menu based setup and mount created<br />
partitions as needed.<br />
<br />
=== Create and Mount the Filesystems ===<br />
'''When you are using a setup that is newer then 2008.03; this step is optional!'''<br />
<br />
I like Reiser (3.x), so I use it for almost everything. GRUB supports it for booting, and it handles small files well. It's about as well tested as EXT3. You can choose other types if you wish.<br />
<br />
To create /boot:<br />
<pre><br />
# mkreiserfs /dev/md1<br />
</pre><br />
<br />
To create swap space:<br />
<pre><br />
# mkswap /dev/md2<br />
</pre><br />
<br />
To create /:<br />
<pre><br />
# mkreiserfs /dev/array/root<br />
</pre><br />
<br />
Now, mount the boot and root partitions where the installer expects them:<br />
<pre><br />
# mount /dev/array/root /mnt<br />
# mkdir /mnt/boot<br />
# mount /dev/md1 /mnt/boot<br />
</pre><br />
<br />
We've created all our filesystems! And we're ready to install the OS!<br />
<br />
=== Install and Configure Arch ===<br />
<br />
This section doesn't attempt to teach you all about the Arch Installer. It leaves out some details here and there for brevity, but still seeks to be basically follow-able. If you're having trouble with the installer, you may wish to seek help elsewhere in the Wiki or forums.<br />
<br />
'''Note:''' Because the installer builds the initrd using /etc/mdadm.conf, you should update that file with your RAID configuration. The original file can simply be deleted because it contains comments on how to fill it correctly, and that is something mdadm can do automaticly for you. So let's delete the original and have mdadm create you a new one with the currect setup:<br />
<pre><br />
rm /etc/mdadm.conf<br />
mdadm –D –-scan >> /etc/mdadm.conf<br />
</pre><br />
<br />
Now you can continue using the installer to set-up the system and install the packages you need.<br />
Here's the walkthrough:<br />
<br />
* Type <code>/arch/setup</code> to launch the main installer.<br />
* Select <code> < OK ></code> at the opening screen.<br />
* Select <code>1 CD_ROM</code> to install from CD-ROM (or <code>2 FTP</code> if you have a local Arch mirror on FTP).<br />
* If you have skipped the optional step (''Create and Mount the Filesystems'') above, and haven't created a fileystem yet, select <code>1 Prepare Hard Drive</code> > <code>3 Set Filesystem Mountpoints</code> and create your filesystems and mountpoints here'''<br />
* Now at the main menu, Select <code>2 Select Packages</code> and select all the packages in the ''base'' category, as well as the <code>mdadm</code> and <code>lvm2</code> packages from the ''system'' category. Note: mdadm & lvm2 are included in ''base'' category since arch-base-0.7.2.<br />
* Select <code>3 Install Packages</code>. This will take a little while.<br />
* Select <code>4 Configure System</code>:<br />
<br />
Add the ''mdadm'' and ''lvm2'' hook to the HOOKS list in /etc/mkinitcpio.conf '''(before 'filesystems', NOT after)'''.<br />
See [[Configuring_mkinitcpio#Using_raid|Configuring mkinitpcio using RAID]] for more details. <br />
<br />
Edit your <code>/etc/rc.conf</code>. It should contain a <code>USELVM</code> entry already, which you should change to:<br />
<pre><br />
USELVM="yes"<br />
</pre><br />
''Please Note'': The <code>rc.sysinit</code> script that parses the <code>USELVM</code> variable entry will accept either <code>yes</code> or <code>YES</code>, however it will not accept mixed case. Please be sure you've got your capitalization correct.<br />
<br />
Edit your <code>/etc/fstab</code> to contain the entries:<br />
<pre><br />
/dev/array/root / reiserfs defaults 0 1<br />
/dev/md2 swap swap defaults 0 0<br />
/dev/md1 /boot reiserfs defaults 0 0<br />
</pre><br />
<br />
At this point, make any other configuration changes you need to other files.<br />
<br />
Then exit the configuration menu.<br />
<br />
Since you will not be installing Grub from the installer, select <code>7 Exit Install</code> to leave the installer program.<br />
<br />
<br />
'''Old style:'''<br />
<br />
Then specify the raid array you're booting from in /mnt/boot/grub/menu.lst like:<br />
# Example with /dev/array/root for ''/'' & /dev/md1 for ''/boot'':<br />
kernel /kernel26 root=/dev/array/root ro md=1,/dev/sda1,/dev/sdb1,/dev/sdc1 md=0,/dev/sda3,/dev/sdb3,/dev/sdc3<br />
<br />
<br />
'''Nowadays (2009.02), with the mdadm hook in the initrd it it no longer necessary to add kernel parameters concerning the RAID array(s).''' <br />
<br />
The arrays can be assembled on boot by the kernel using that hook and the contents of /etc/mdadm.conf, which is included in the initrd image when it's build. (See [[Configuring_mkinitcpio#Using_raid|Configuring mkinitpcio using RAID]] )<br />
<br />
An example of a GRUB boot configuration for booting of a RAIDed root like this:<br />
<pre><br />
# (0) Arch Linux<br />
title Arch Linux<br />
root (hd0,0)<br />
kernel /vmlinuz26 root=/dev/md0 ro<br />
initrd /kernel26.img<br />
</pre><br />
<br />
=== Install Grub on the Primary Hard Drive (and save the RAID config) ===<br />
<br />
This is the last and final step before you have a bootable system!<br />
<br />
As an overview, the basic concept is to copy over the grub bootloader files into /boot/grub, mount a procfs and a device tree inside of /mnt, then chroot to /mnt so you're effectively inside your new system. Once in your new system, you will run grub to install the bootloader in the boot area of your first hard drive. Then we save our new RAID configuration in <tt>/etc/mdadm.conf</tt> so it can be re-assembled automatically after we reboot.<br />
<br />
Copy the GRUB files into place and get into our chroot:<br />
<pre><br />
# cp -a /mnt/usr/lib/grub/i386-pc/* /mnt/boot/grub<br />
# sync<br />
# mount -o bind /dev /mnt/dev<br />
# mount -t proc none /mnt/proc<br />
# chroot /mnt /bin/bash<br />
</pre><br />
<br />
At this point, you may no longer be able to see keys you type at your console. I'm not sure of the reason for this (NOTE: try "chroot /mnt /bin/<shell>"), but it you can fix it by typing <code>reset</code> at the prompt.<br />
<br />
Once you've got console echo back on, type:<br />
<pre><br />
# grub<br />
</pre><br />
<br />
After a short wait while grub does some looking around, it should come back with a grub prompt. Do:<br />
<br />
<pre><br />
grub> root (hd0,0)<br />
grub> setup (hd0)<br />
grub> quit<br />
</pre><br />
<br />
Now you need to save our RAID configuration so it can be re-assembled automatically each time we boot. Previously, this was an unnecessary step in Arch because the RAID drivers were built in to the kernel. But when loaded after the kernel boots (as modules), arrays are not autodetected. Hence this configuration file.<br />
<br />
The default <code>/etc/mdadm.conf</code> on your chrooted system should be pretty much empty (except for a lot of explanatory comments). All you need to do is capture the output from an mdadm query command and append it to the end of <code>mdadm.conf</code>.<br />
<br />
<pre><br />
# mdadm -D --scan >>/etc/mdadm.conf<br />
</pre><br />
<br />
That's it. You can exit your chroot now by hitting <code>CTRL-D</code> or typing <code>exit</code>.<br />
<br />
=== Reboot ===<br />
<br />
The hard part is all over! Now remove the CD from your CD-ROM drive, and type:<br />
<pre><br />
# reboot<br />
</pre><br />
<br />
=== Install Grub on the Alternate Boot Drives===<br />
<br />
Once you've successfully booted your new system for the first time, you will want to install Grub onto the other two disks (or on the other disk if you have only 2 HDDs) so that, in the event of disk failure, the system can be booted from another drive. Log in to your new system as root and do:<br />
<br />
<pre><br />
# grub<br />
grub> device (hd0) /dev/sdb<br />
grub> root (hd0,0)<br />
grub> setup (hd0)<br />
grub> device (hd0) /dev/sdc<br />
grub> root (hd0,0)<br />
grub> setup (hd0)<br />
grub> quit<br />
</pre><br />
<br />
=== Archive your Filesystem Partition Scheme ===<br />
<br />
Now that you're done, it's worth taking a second to archive off the partition state of each of your drives. This guarantees that it will be trivially easy to replace/rebuild a disk in the event that one fails. You do this with the <code>sfdisk</code> tool and the following steps:<br />
<br />
<pre><br />
# mkdir /etc/partitions<br />
# sfdisk --dump /dev/sda >/etc/partitions/disc0.partitions<br />
# sfdisk --dump /dev/sdb >/etc/partitions/disc1.partitions<br />
# sfdisk --dump /dev/sdc >/etc/partitions/disc2.partitions<br />
</pre><br />
<br />
== Management ==<br />
<br />
For LVM management, please have a look at [[LVM]]<br />
<br />
== Mounting from a Live CD ==<br />
<br />
If you want to mount your RAID partition from a Live CD, use<br />
<br />
<pre><br />
mdadm --assemble /dev/md0 /dev/sda3 /dev/sdb3 /dev/sdc3<br />
</pre><br />
<br />
(or whatever mdX and drives apply to you)<br />
<br />
{{Note | Live CDs like [http://www.sysresccd.org/Main_Page SystemrescueCD] assemble the RAID arrays automatically at boot time if you used the partition type fd at the install of the array)}}<br />
<br />
==Removing device, stop using the array==<br />
<br />
You can remove a device from the array after you mark it as faulty.<br />
<br />
mdadm --fail /dev/md0 /dev/sdxx<br />
<br />
Then you can remove it from the array.<br />
<br />
mdadm -r /dev/md0 /dev/sdxx<br />
<br />
Remove device permanently (for example in the case you want to use it individally from now on).<br />
Issue the two commands described above then:<br />
<br />
mdadm --zero-superblock /dev/sdxx<br />
<br />
After this you can use the disk as you did before creating the array.<br />
<br />
{{Warning | If you reuse the removed disk without zeroing the superblock you will '''LOSE''' all your data next boot. (After mdadm will try to use it as the part of the raid array). '''DO NOT''' issue this command on linear or raid arrays or you will LOOSE all your data on the raid array. }}<br />
<br />
Stop using an array:<br />
<br />
1. Umount target array<br />
2. Stop the array with: <code>mdadm --stop /dev/md0</code><br />
3. Repeat the three command described in the beginning of this section on each device.<br />
4. Remove the corresponding line from /etc/mdadm.conf<br />
<br />
<br />
== Conclusion==<br />
<br />
You're done! I hope you've succeeded in setting up Arch Linux on your server with RAID and LVM!<br />
<br />
==Troubleshooting==<br />
If you are getting error when you reboot about "invalid raid superblock magic" and you have additional hard drives other than the ones you installed to, check that your hard drive order is correct. During installation, your RAID devices may be hdd, hde and hdf, but during boot they may be hda, hdb and hdc. Adjust your kernel line in /boot/grub/menu.lst accordingly. This is what happened to me anyway.<br />
<br />
== Credits==<br />
<br />
This document was written by Paul Mattal with with significant help from others. Comments and suggestions are welcome at paul at archlinux dot org.<br />
<br />
Thanks to all who have contributed information and suggestions! This includes:<br />
<br />
* Carl Chave<br />
* Guillaume Darbonne<br />
<br />
== Additional Resources==<br />
<br />
* [http://en.gentoo-wiki.com/wiki/RAID/Software Gentoo wiki entry]</div>Blohttps://wiki.archlinux.org/index.php?title=Installing_with_Software_RAID_or_LVM&diff=80493Installing with Software RAID or LVM2009-10-26T12:18:22Z<p>Blo: /* Create the RAID Redundant Partitions */</p>
<hr />
<div>[[Category:Getting and installing Arch (English)]]<br />
[[Category:File systems (English)]]<br />
[[Category:HOWTOs (English)]]<br />
<br />
== Disclaimer==<br />
<br />
{{ Warning | Installing a system with RAID is a complex process. Anything could go wrong. You could make a mistake, I could make a mistake, there could be a bug in something. Backup all your data first. Make sure only the drives involved in the installation are attached while doing the install. You've been warned! }}<br />
<br />
Also note that this document is up-to-date with all "Archisms" as of 2008.06 'Overlord'. It may not be applicable to previous releases of Arch Linux.<br />
<br />
=== RAID ===<br />
<br />
RAID (Redundant Array of Independent Disks) is designed to prevent data loss in the event of a hard disk failure. There are different "levels" of RAID. RAID 0 (striping) isn't really RAID at all, because it provides no redundancy. It does, however, provide speed benefit. We'll use RAID 0 for swap, on the assumption that you're using a desktop, where the speed increase is worth the possibility of having your system crash if one of your drives fails. On a server, you'd almost certainly want RAID 1 or RAID 5. The size of a RAID 0 array block device is the size of the smallest component partition times the number of component partitions.<br />
<br />
RAID 1 is the most straightforward RAID level: straight mirroring. As with other RAID levels, it only makes sense if the partitions are on different physical disk drives. If one of those drives fails, the block device provided by the RAID array will continue to function as normal. We'll be using RAID 1 for everything except swap. Note that RAID 1 is the only option for the boot partition, because bootloaders (which read the boot partition) don't understand RAID, but a RAID 1 component partition can be read as a normal partition. The size of a RAID 1 array block device is the size of the smallest component partition.<br />
<br />
RAID 5 is the only other RAID level you're likely to want. It requires 3 or more physical drives, and provides the redundancy of RAID 1 combined with the speed and size benefits of RAID 0. RAID 5 uses striping, like RAID 0, but also stores parity blocks distributed across each member disk. In the event of a failed disk, these parity blocks are used to reconstruct the data on a replacement disk. RAID 5 can withstand the loss of one member disk.<br />
<br />
'''ATTENTION: Having RAID does not mean you don't need backups - read the CAVEATS section below!'''<br />
<br />
=== LVM ===<br />
<br />
[http://sourceware.org/lvm2/ LVM] (Logical Volume Management) makes use of the [http://sources.redhat.com/dm/ device-mapper] feature of the Linux kernel. It provides a system of specifying partitions independently of the layout of the underlying disk. What this means for you is that you can extend and shrink partitions (subject to the filesystem you use allowing this) and add and remove partitions without worrying about whether you have enough contiguous space on a particular disk, without getting caught up in the problems of fdisking a disk that is in use (and wondering whether the kernel is using the old or new partition table) and without having to move other partition out of the way.<br />
<br />
This is strictly an ease-of-management issue: it doesn't provide any addition security. However, it sits nicely with the other two technologies we're using.<br />
<br />
Note that we're not using LVM for the boot partition (because of the bootloader problem).<br />
<br />
==CAVEATS==<br />
<br />
=== Security (redundancy) ===<br />
<br />
Again, RAID does not provide a guarantee that your data is safe. If there is a fire, if your computer is stolen or if you have multiple hard drive failures, RAID won't protect you. So '''make backups'''. Whether you use tape drives, DVDs, CDROMs or another computer, keep a copy of your data out of your computer (and preferably offsite) and keep it up to date. Get into the habit of making regular backups. If you organize the data on your computer in a way that separates things you are currently working on from "archived" things that are unlikely to change, you can back up the "current" stuff frequently, and the "archived" stuff occasionally.<br />
<br />
== General Approach==<br />
<br />
For starters, note that this document seeks primarily to give you a good example walkthrough of how to install Arch with Software RAID or LVM support for a typical case. It won't try to explain all the possible things you can do -- it's more to give you an example of something that will work that you can then tweak to your own purposes.<br />
<br />
In this example, the machine I'm using will have three similar IDE hard drives, at least 80GB each in size, installed as primary master, primary slave, and secondary master, with my installation CD-ROM drive as the secondary slave. I will assume these can be reached as /dev/sda, /dev/sdb, and /dev/sdc, and that the cdrom drive is /dev/cdrom.<br />
<br />
We'll create a 100MB /boot partition, a 2048MB (2GB) swap partition and a ~ 78GB root partition using LVM. The boot and swap partitions will be RAID1, while the root partition will be RAID5. Why RAID1? For boot, it's so you can boot the kernel from grub (which has no RAID drivers!), and for swap, it's for redundancy, so that your machine will not lose its swap state even if 1 or 2 drives fail.<br />
<br />
Each RAID1 redundant partition will have three physical partitions, all the same size, one on each of the drives. The total storage capacity will be the size of a single one of these physical partitions. A RAID1 redundant partition with 3 physical partitions can lose any two of its physical partitions and still function.<br />
<br />
Each RAID5 redundant partition will also have three physical partitions, all the same size, one on each of the drives. The total storage capacity will be the combined size of ''two'' of these physical partitions, with the third drive being consumed to provide parity information. A RAID5 redundant partition with 3 physical partitions can lose any one of its physical partitions and still function.<br />
<br />
== Get the Arch Installer CD ==<br />
<br />
Please note that in order to use LVM, you need the <code>lvm2</code> and <code>dev-mapper</code> packages installed, otherwise you won't be able to see any LVM partitions on reboot, until you install those packages. Note that the Arch 0.7.1 Base installer ''does not'' contain these packages, but the Arch 0.7.1 Full installer does. So if you're going to use LVM, you'll need to download the bigger ISO. My example will describe you using the Full installer; the changes should be minimal if you wish to use the Base installer instead.<br />
<br />
== Outline ==<br />
<br />
Just to give you an idea of how all this will work, I'll outline the steps. The details for these will be filled in below.<br />
<br />
# Boot the Installer CD<br />
# Partition the Hard Drives<br />
# Create the RAID Redundant Partitions<br />
# Create and Mount the Main Filesystems<br />
# Setup LVM and Create the / (root) LVM Volume<br />
# Install and Configure Arch<br />
# Install Grub on the Primary Hard Drive<br />
# Unmount Filesystems and Reboot<br />
# Install Grub on the Alternate Boot Drives<br />
# Archive your Filesystem Partition Scheme<br />
<br />
== Procedure==<br />
<br />
=== Boot the Installer CD===<br />
<br />
First, load all your drives in the machine. Then boot the Arch Linux 0.7 ''Full'' installation CD.<br />
<br />
At the syslinux boot prompt, hit enter: we want to use the SCSI kernel, which has support for RAID and LVM built in.<br />
<br />
So far, this is easy. Don't worry, it gets harder.<br />
<br />
=== Partition the Hard Drives===<br />
If your hard drives are already prepared and all you want to do is activate RAID and LVM jump to [[Installing_with_Software_RAID_or_LVM#Activate_existing_RAID_devices_and_LVM_volumes|Activate exsiting RAID devices and LVM volumes]].<br />
<br />
We'll use <code>cfdisk</code> to do this partitioning. We want to create 3 partitions on each of the three drive:<br />
<br />
Partition 1 (/boot): 100MB, type FD, bootable<br><br />
Partition 2 (swap): 2048MB, type FD<br><br />
Partition 3 (LVM): <Rest of the drive>, type FD<br />
<br />
Note that in general, in <code>cfdisk</code>, you can use the first letter of each <code>[[Bracketed Option]]</code> to select it; however, this is not true for the <code>[[Write]]</code> command, you have to hold SHIFT as well to select it.<br />
<br />
First run:<br />
<pre><br />
# cfdisk /dev/sda<br />
</pre><br />
<br />
Create each partition in order:<br />
<br />
# Select <code>'''New'''</code>.<br />
# Hit Enter to make it a <code>'''Primary'''</code> partition.<br />
# Type the appropriate size (in MB), or for Partition 3, just hit enter to select the remainder of the drive.<br />
# Hit Enter to choose to place the partition at the <code>'''Beginning'''</code>.<br />
# Select <code>'''Type'''</code>, hit enter to see the second page of the list, and then type <code>fd</code> for the Linux RAID Autodetect type.<br />
# ''For Partition 1 on each drive'', select <code>'''Bootable'''</code>.<br />
# Hit down arrow (selecting the remaining free space) to go on to the next partition to be created.<br />
<br />
When you're done, select <code>'''Write'''</code>, and confirm <code>y-e-s</code> that you want to write the partition information to disk.<br />
<br />
Then select <code>'''Quit'''</code>.<br />
<br />
Repeat this for the other two drives:<br />
<br />
<pre><br />
# cfdisk /dev/sdb<br />
# cfdisk /dev/sdc<br />
</pre><br />
<br />
Create the same exact partitions on each disk. If a group of partitions of different sizes are assembled to create a redundant RAID partition, it ''will'' work, but the redundant partition will be in multiples of the size of the smallest one, leaving the rest of the allocated drive space to waste.<br />
<br />
=== Load the RAID Modules ===<br />
<br />
Before using <code>mdadm</code>, you need load the modules for the RAID levels you'll be using. In this example, we're using levels 1 and 5, so we'll load those. You can ignore any modprobe errors like <code>"cannot insert md-mod.ko: File exists"</code>. Busybox's modprobe can be a little slow sometimes.<br />
<br />
<pre><br />
# modprobe raid1<br />
# modprobe raid5<br />
</pre><br />
<br />
=== Create the RAID Redundant Partitions ===<br />
<br />
Now that you've created all the physical partitions, you're ready to set up RAID. The tool you use to create RAID arrays is <code>mdadm</code>.<br />
<br />
To create /dev/md0 (/):<br />
<pre><br />
# mdadm --create /dev/md0 --level=5 --raid-devices=3 /dev/sda3 /dev/sdb3 /dev/sdc3<br />
</pre><br />
<br />
To create /dev/md1 (/boot):<br />
<pre><br />
# mdadm --create /dev/md1 --level=1 --raid-devices=3 /dev/sda1 /dev/sdb1 /dev/sdc1<br />
</pre><br />
<br />
To create /dev/md2 (swap):<br />
<pre><br />
# mdadm --create /dev/md2 --level=1 --raid-devices=3 /dev/sda2 /dev/sdb2 /dev/sdc2<br />
</pre><br />
<br />
At this point, you should have working RAID partitions. When you create the RAID partitions, they need to sync themselves so the contents of all three physical partitions are the same on all three drives. The hard drives lights will come on as they try to sync up. You can monitor the progress by typing:<br />
<pre><br />
# cat /proc/mdstat<br />
</pre><br />
<br />
You can also get particular information about, say, the root partition by typing:<br />
<pre><br />
# mdadm --misc --detail /dev/md0<br />
</pre><br />
<br />
You don't have to wait for synchronization to finish -- you may proceed with the installation while syncronization is still occurring. You can even reboot at the end of the installation with synchronization still going.<br />
<br />
=== Setup LVM and Create the / (root) LVM Volume===<br />
This is where you create the LVM volumes. LVM works with abstract layers, check out [[LVM|LVM]] and/or it's documentation to discover more. What you will be doing in short:<br />
* Turn block devices (e.g. /dev/sda1 or /dev/md0) into Physical Volume(s) that can be used by LVM<br />
* Create a Volume Group consisting of Physical Volume(s)<br />
* Create Logical Volume(s) within the Volume Group <br />
<br />
'''Note:'''<br />
If you are using an Arch Linux install CD <= 0.7.1, you have to create and mount a sysfs partition on /sys, to keep lvm from getting cranky. Otherwise you can skip this mounting of sysfs, unless you run into trouble. If you forget to do this, instead of giving you an intelligent error message, lvm will simply Segmentation fault at various inconvenient times.<br />
<br />
To mount the sysfs partition, do:<br />
<pre><br />
# mkdir /sys<br />
# mount -t sysfs none /sys<br />
</pre><br />
<br />
'''Let's get started:'''<br />
<br />
Make sure that the device-mapper module is loaded:<br />
<pre><br />
# modprobe dm-mod<br />
</pre><br />
<br />
Now you need to do is tell LVM you have a Physical Volume for it to use. It's really a virtual RAID volume (<code>/dev/md0</code>), but LVM doesn't know this, or really care. Do:<br />
<pre><br />
# pvcreate /dev/md0<br />
</pre><br />
<br />
This might fail if you're using raid or creating PV on an existing Volume Group. If so you might want to add -ff option.<br />
<br />
LVM should report back that it has added the Physical Volume. You can confirm this with:<br />
<pre><br />
# pvdisplay<br />
</pre><br />
<br />
Now it's time to create a Volume Group (which I'll call <code>array</code>) which has control over the LVM Physical Volume we created. Do:<br />
<pre><br />
# vgcreate array /dev/md0<br />
</pre><br />
<br />
LVM should report that it has created the Volume Group <code>array</code>. You can confirm this with:<br />
<pre><br />
# vgdisplay<br />
</pre><br />
<br />
Next, we create a Logical Volume called <code>root</code> in Volume Group <code>array</code> which is 50GB in size:<br />
<pre><br />
# lvcreate --size 50G --name root array<br />
</pre><br />
<br />
LVM should report that it created the Logical Volume <code>root</code>. You can confirm this with:<br />
<pre><br />
# lvdisplay<br />
</pre><br />
<br />
The LVM volume should now be available as <code>/dev/mapper/array-root</code>. Or something similar, LVM will also be able to tell you which when you issue the display command.<br />
<br />
=== Activate existing RAID devices and LVM volumes ===<br />
<br />
If you already have RAID partitions created on your system and you've also set up LVM and all you want is enabling them<br />
follow this simple procedure. ''This might come in handy if you're switching distros and don't want to lose data in /home<br />
for example.'' <br />
<br />
First you need to enable RAID support. RAID1 and RAID5 in this case.<br />
<pre><br />
modprobe raid1<br />
modprobe raid5<br />
</pre><br />
<br />
Activate RAID devices: md1 for /boot and md0 for LVM where two logical volumes will reside.<br />
<pre><br />
mdadm --assemble /dev/md0 /dev/sda3 /dev/sdb3 /dev/sdc3<br />
mdadm --assemble /dev/md1 /dev/sda1 /dev/sdb1 /dev/sdc1<br />
</pre><br />
<br />
RAID devices should now be enabled. Check /proc/mdstat.<br />
<br />
If you haven't loaded kernel LVM support do so now.<br />
<pre><br />
modprobe dm-mod<br />
</pre><br />
Startup of LVM requires just the following two commands: <br />
<pre><br />
vgscan<br />
vgchange -ay<br />
</pre><br />
<br />
You can now jump to '''[3] Set Filesystem Mountpoints''' in your menu based setup and mount created<br />
partitions as needed.<br />
<br />
=== Create and Mount the Filesystems ===<br />
'''When you are using a setup that is newer then 2008.03; this step is optional!'''<br />
<br />
I like Reiser (3.x), so I use it for almost everything. GRUB supports it for booting, and it handles small files well. It's about as well tested as EXT3. You can choose other types if you wish.<br />
<br />
To create /boot:<br />
<pre><br />
# mkreiserfs /dev/md1<br />
</pre><br />
<br />
To create swap space:<br />
<pre><br />
# mkswap /dev/md2<br />
</pre><br />
<br />
To create /:<br />
<pre><br />
# mkreiserfs /dev/array/root<br />
</pre><br />
<br />
Now, mount the boot and root partitions where the installer expects them:<br />
<pre><br />
# mount /dev/array/root /mnt<br />
# mkdir /mnt/boot<br />
# mount /dev/md1 /mnt/boot<br />
</pre><br />
<br />
We've created all our filesystems! And we're ready to install the OS!<br />
<br />
=== Install and Configure Arch ===<br />
<br />
This section doesn't attempt to teach you all about the Arch Installer. It leaves out some details here and there for brevity, but still seeks to be basically follow-able. If you're having trouble with the installer, you may wish to seek help elsewhere in the Wiki or forums.<br />
<br />
'''Note:''' Because the installer builds the initrd using /etc/mdadm.conf, you should update that file with your RAID configuration. The original file can simply be deleted because it contains comments on how to fill it correctly, and that is something mdadm can do automaticly for you. So let's delete the original and have mdadm create you a new one with the currect setup:<br />
<pre><br />
rm /etc/mdadm.conf<br />
mdadm –D –-scan >> /etc/mdadm.conf<br />
</pre><br />
<br />
Now you can continue using the installer to set-up the system and install the packages you need.<br />
Here's the walkthrough:<br />
<br />
* Type <code>/arch/setup</code> to launch the main installer.<br />
* Select <code> < OK ></code> at the opening screen.<br />
* Select <code>1 CD_ROM</code> to install from CD-ROM (or <code>2 FTP</code> if you have a local Arch mirror on FTP).<br />
* If you have skipped the optional step (''Create and Mount the Filesystems'') above, and haven't created a fileystem yet, select <code>1 Prepare Hard Drive</code> > <code>3 Set Filesystem Mountpoints</code> and create your filesystems and mountpoints here'''<br />
* Now at the main menu, Select <code>2 Select Packages</code> and select all the packages in the ''base'' category, as well as the <code>mdadm</code> and <code>lvm2</code> packages from the ''system'' category. Note: mdadm & lvm2 are included in ''base'' category since arch-base-0.7.2.<br />
* Select <code>3 Install Packages</code>. This will take a little while.<br />
* Select <code>4 Configure System</code>:<br />
<br />
Add the ''mdadm'' and ''lvm2'' hook to the HOOKS list in /etc/mkinitcpio.conf '''(before 'filesystems', NOT after)'''.<br />
See [[Configuring_mkinitcpio#Using_raid|Configuring mkinitpcio using RAID]] for more details. <br />
<br />
Edit your <code>/etc/rc.conf</code>. It should contain a <code>USELVM</code> entry already, which you should change to:<br />
<pre><br />
USELVM="yes"<br />
</pre><br />
''Please Note'': The <code>rc.sysinit</code> script that parses the <code>USELVM</code> variable entry will accept either <code>yes</code> or <code>YES</code>, however it will not accept mixed case. Please be sure you've got your capitalization correct.<br />
<br />
Edit your <code>/etc/fstab</code> to contain the entries:<br />
<pre><br />
/dev/array/root / reiserfs defaults 0 1<br />
/dev/md2 swap swap defaults 0 0<br />
/dev/md1 /boot reiserfs defaults 0 0<br />
</pre><br />
<br />
At this point, make any other configuration changes you need to other files.<br />
<br />
Then exit the configuration menu.<br />
<br />
Since you will not be installing Grub from the installer, select <code>7 Exit Install</code> to leave the installer program.<br />
<br />
<br />
'''Old style:'''<br />
<br />
Then specify the raid array you're booting from in /mnt/boot/grub/menu.lst like:<br />
# Example with /dev/array/root for ''/'' & /dev/md1 for ''/boot'':<br />
kernel /kernel26 root=/dev/array/root ro md=1,/dev/sda1,/dev/sdb1,/dev/sdc1 md=0,/dev/sda3,/dev/sdb3,/dev/sdc3<br />
<br />
<br />
'''Nowadays (2009.02), with the mdadm hook in the initrd it it no longer necessary to add kernel parameters concerning the RAID array(s).''' <br />
<br />
The arrays can be assembled on boot by the kernel using that hook and the contents of /etc/mdadm.conf, which is included in the initrd image when it's build. (See [[Configuring_mkinitcpio#Using_raid|Configuring mkinitpcio using RAID]] )<br />
<br />
An example of a GRUB boot configuration for booting of a RAIDed root like this:<br />
<pre><br />
# (0) Arch Linux<br />
title Arch Linux<br />
root (hd0,0)<br />
kernel /vmlinuz26 root=/dev/md0 ro<br />
initrd /kernel26.img<br />
</pre><br />
<br />
=== Install Grub on the Primary Hard Drive (and save the RAID config) ===<br />
<br />
This is the last and final step before you have a bootable system!<br />
<br />
As an overview, the basic concept is to copy over the grub bootloader files into /boot/grub, mount a procfs and a device tree inside of /mnt, then chroot to /mnt so you're effectively inside your new system. Once in your new system, you will run grub to install the bootloader in the boot area of your first hard drive. Then we save our new RAID configuration in <tt>/etc/mdadm.conf</tt> so it can be re-assembled automatically after we reboot.<br />
<br />
Copy the GRUB files into place and get into our chroot:<br />
<pre><br />
# cp -a /mnt/usr/lib/grub/i386-pc/* /mnt/boot/grub<br />
# sync<br />
# mount -o bind /dev /mnt/dev<br />
# mount -t proc none /mnt/proc<br />
# chroot /mnt /bin/bash<br />
</pre><br />
<br />
At this point, you may no longer be able to see keys you type at your console. I'm not sure of the reason for this (NOTE: try "chroot /mnt /bin/<shell>"), but it you can fix it by typing <code>reset</code> at the prompt.<br />
<br />
Once you've got console echo back on, type:<br />
<pre><br />
# grub<br />
</pre><br />
<br />
After a short wait while grub does some looking around, it should come back with a grub prompt. Do:<br />
<br />
<pre><br />
grub> root (hd0,0)<br />
grub> setup (hd0)<br />
grub> quit<br />
</pre><br />
<br />
Now you need to save our RAID configuration so it can be re-assembled automatically each time we boot. Previously, this was an unnecessary step in Arch because the RAID drivers were built in to the kernel. But when loaded after the kernel boots (as modules), arrays are not autodetected. Hence this configuration file.<br />
<br />
The default <code>/etc/mdadm.conf</code> on your chrooted system should be pretty much empty (except for a lot of explanatory comments). All you need to do is capture the output from an mdadm query command and append it to the end of <code>mdadm.conf</code>.<br />
<br />
<pre><br />
# mdadm -D --scan >>/etc/mdadm.conf<br />
</pre><br />
<br />
That's it. You can exit your chroot now by hitting <code>CTRL-D</code> or typing <code>exit</code>.<br />
<br />
=== Reboot ===<br />
<br />
The hard part is all over! Now remove the CD from your CD-ROM drive, and type:<br />
<pre><br />
# reboot<br />
</pre><br />
<br />
=== Install Grub on the Alternate Boot Drives===<br />
<br />
Once you've successfully booted your new system for the first time, you will want to install Grub onto the other two disks (or on the other disk if you have only 2 HDDs) so that, in the event of disk failure, the system can be booted from another drive. Log in to your new system as root and do:<br />
<br />
<pre><br />
# grub<br />
grub> device (hd0) /dev/sdb<br />
grub> root (hd0,0)<br />
grub> setup (hd0)<br />
grub> device (hd0) /dev/sdc<br />
grub> root (hd0,0)<br />
grub> setup (hd0)<br />
grub> quit<br />
</pre><br />
<br />
=== Archive your Filesystem Partition Scheme ===<br />
<br />
Now that you're done, it's worth taking a second to archive off the partition state of each of your drives. This guarantees that it will be trivially easy to replace/rebuild a disk in the event that one fails. You do this with the <code>sfdisk</code> tool and the following steps:<br />
<br />
<pre><br />
# mkdir /etc/partitions<br />
# sfdisk --dump /dev/sda >/etc/partitions/disc0.partitions<br />
# sfdisk --dump /dev/sdb >/etc/partitions/disc1.partitions<br />
# sfdisk --dump /dev/sdc >/etc/partitions/disc2.partitions<br />
</pre><br />
<br />
== Management ==<br />
<br />
For LVM management, please have a look at [[LVM]]<br />
<br />
== Mounting from a Live CD ==<br />
<br />
If you want to mount your RAID partition from a Live CD, use<br />
<br />
<pre><br />
mdadm --assemble /dev/md0 /dev/sda3 /dev/sdb3 /dev/sdc3<br />
</pre><br />
<br />
(or whatever mdX and drives apply to you)<br />
<br />
== Conclusion==<br />
<br />
You're done! I hope you've succeeded in setting up Arch Linux on your server with RAID and LVM!<br />
<br />
==Troubleshooting==<br />
If you are getting error when you reboot about "invalid raid superblock magic" and you have additional hard drives other than the ones you installed to, check that your hard drive order is correct. During installation, your RAID devices may be hdd, hde and hdf, but during boot they may be hda, hdb and hdc. Adjust your kernel line in /boot/grub/menu.lst accordingly. This is what happened to me anyway.<br />
<br />
== Credits==<br />
<br />
This document was written by Paul Mattal with with significant help from others. Comments and suggestions are welcome at paul at archlinux dot org.<br />
<br />
Thanks to all who have contributed information and suggestions! This includes:<br />
<br />
* Carl Chave<br />
* Guillaume Darbonne<br />
<br />
== Additional Resources==<br />
<br />
* [http://en.gentoo-wiki.com/wiki/RAID/Software Gentoo wiki entry]</div>Blohttps://wiki.archlinux.org/index.php?title=MPlayer&diff=80489MPlayer2009-10-26T12:03:52Z<p>Blo: </p>
<hr />
<div>{{i18n_links_start}}<br />
{{i18n_entry|English|:MPlayer}}<br />
{{i18n_entry|Italiano|:MPlayer_(Italiano)}}<br />
{{i18n_entry|Ελληνικά|:MPlayer_(Ελληνικά)}}<br />
{{i18n_entry|简体中文|:MPlayer_(简体中文)}}<br />
{{i18n_entry|Українська|:MPlayer_(Українська)}}<br />
{{i18n_entry|Русский|:MPlayer_(Русский)}}<br />
{{i18n_links_end}}<br />
<br />
<br />
'''MPlayer''' is the oh-so-popular movie player for Linux. MPlayer has support for pretty much every video and audio format out there and is hence very versatile, even though most people use it for viewing videos.<br />
<br />
==Installation==<br />
Type <code>pacman -S mplayer</code> in a shell as root.<br />
<br />
==Install the lates version from git with multithread ffmpeg support==<br />
{{Box Note |(experimental, but works in most cases) }}<br />
<br />
Install git:<br />
<br />
sudo pacman -S git<br />
<br />
Create a directory for the source files then clone the git repo:<br />
<br />
git clone git://repo.or.cz/mplayer-build.git<br />
<br />
Follow the README in the mplayer-build directory.<br />
<br />
==Additional installation tips==<br />
<br />
===More codecs===<br />
To get the most out of MPlayer, you should really consider installing the <code>codecs</code> package, which adds support for Windows codecs, Real9 and QuickTime (.mov).<br />
<br />
Install it with: <code>pacman -S codecs</code>. [Note: this package is no longer in the repository; see http://bbs.archlinux.org/viewtopic.php?id=73230].<br />
<br />
===Frontends/GUIs===<br />
There are several GUIs for MPlayer.<br />
* Qt: <code>smplayer</code> is in the extra repository. The <code>smplayer-themes</code> package provides themes for it.<br />
* Gtk+: <code>pymp</code> and <code>gnome-mplayer</code> are in the AUR and community repos, respectively.<br />
* gmplayer: this gui is no longer included in the mplayer package. There is an alternative mplayer package (<code>mplayer-x</code>) in AUR in which the gmplayer gui is enabled.<br />
<br />
===Browser integration===<br />
<br />
If you want to let MPlayer control video viewing in your favorite web browser, try one of the following:<br />
<br />
====Firefox====<br />
<code>pacman -S mplayer-plugin</code><br />
<br />
<code>pacman -S gecko-mediaplayer</code><br />
<br />
====Konqueror====<br />
<code>pacman -S kmplayer</code> (also provides a complete frontend to MPlayer.)<br />
<br />
==Usage==<br />
<br />
===Configuration===<br />
System-wide configuration is located in <code>/etc/mplayer/mplayer.conf</code>, whereas the user-local settings are stored in <code>~/.mplayer/config</code>. The file <code>/etc/mplayer/example.conf</code> is a good starting point, and here is an example:<br />
<br />
#profile for up-mixing two channels audio to six channels<br />
# use -profile 2chto6ch to activate<br />
[2chto6ch]<br />
af-add=pan=6:1:0:.4:0:.6:2:0:1:0:.4:.6:2<br />
<br />
#profile to down-mixing six channels audio to two channels<br />
# use -profile 6chto2ch to activate<br />
[6chto2ch]<br />
af-add=pan=2:0.7:0:0:0.7:0.5:0:0:0.5:0.6:0.6:0:0<br />
<br />
#default configuration that applies to every file<br />
[default]<br />
#use X11 for video output<br />
vo=x11<br />
#use also for audio output<br />
ao=alsa<br />
#prefere using six channels audio<br />
channels = 6<br />
#scale the subtitles to the 3% of the screen size<br />
subfont-text-scale = 3<br />
#never use font config<br />
nofontconfig = 1<br />
#add black borders so the movies have the same aspect ratio of the monitor<br />
#change if your monitor is not 16/9<br />
vf-add=expand=::::1:16/9:16<br />
<br />
===Translucent Video with radeon and Composite enabled===<br />
<br />
To get translucent video output in X you have to enable textured video in mplayer:<br />
<br />
mplayer -vo xv:adaptor=1 <File><br />
<br />
Or add the following line to ~/.mplayer/config:<br />
<br />
vo=xv:adaptor=1<br />
<br />
You can use <code>xvinfo</code> to check which video modes your graphic card supports.<br />
<br />
===Transparent SMPlayer in Gnome with Composite enabled===<br />
<br />
Have you noticed the transparent screen of smplayer when you are using compiz and maybe cairo-dock? Well it’s ridiculous that when you open your videos using SMplayer you can just hear audio and no video! Here’s how you fix this: [copy paste into terminal]<br />
<br />
sudo bash -c “cat > /usr/bin/smplayer.helper” <<EOF<br />
export XLIB_SKIP_ARGB_VISUALS=1<br />
exec smplayer.real “\$@”<br />
EOF<br />
sudo chmod 755 /usr/bin/smplayer.helper<br />
sudo mv /usr/bin/smplayer{,.real}<br />
sudo ln -sf smplayer.helper /usr/bin/smplayer<br />
<br />
If you don’t use sudo then just use “su” to login as root and do the above!<br />
<br />
===Watching streamed video===<br />
If you want to play a video stream (e.g *.asx link) use <code>mplayer -playlist linktostream.asx</code> to play the stream as these are playlists of streams and won't be playable omitting the -playlist option.<br />
<br />
===Stream mplayer audio to jackd===<br />
<br />
Edit ~/.mplayer/config<br />
add:<br />
<br />
ao=jack<br />
<br />
===Keybindings===<br />
<br />
:''This is a list of the most basic MPlayer keys.''<br />
<br />
{|<br />
! width=50 align=left | Key<br />
! align=left | Description<br />
|-<br />
| p<br />
| Toggle pause/play.<br />
|-<br />
| Space<br />
| Toggle pause/play.<br />
|-<br />
| Left<br />
| Seek backward ten seconds.<br />
|-<br />
| Right<br />
| Seek forward ten seconds.<br />
|-<br />
| Down<br />
| Seek backward one minute.<br />
|-<br />
| Up<br />
| Seek forward one minute.<br />
|-<br />
| <<br />
| Go back in the playlist.<br />
|-<br />
| ><br />
| Go forward in the playlist.<br />
|-<br />
| m<br />
| Mute the sound.<br />
|-<br />
| 0<br />
| Volume up.<br />
|-<br />
| 9<br />
| Volume down.<br />
|-<br />
| f<br />
| Toggle fullscreen mode.<br />
|-<br />
| o<br />
| Toggle OSD state.<br />
|-<br />
| j<br />
| Toggle subtitle visibility.<br />
|-<br />
| <code>I</code><br />
| Show filename.<br />
|-<br />
| 1, 2<br />
| Adjust contrast.<br />
|-<br />
| 3, 4<br />
| Adjust brightness.<br />
|}<br />
<br />
=== Mplayer fails to open files with spaces ===<br />
<br />
If you try to open a file with spaces (The Movie) and mplayer fails, saying that it could not open the file (file:///The%20Movie), where all spaces are converted to %20, then open<br />
<br />
/usr/share/applications/mplayer.desktop<br />
<br />
and change the line<br />
<br />
Exec=mplayer %U<br />
<br />
to<br />
<br />
Exec=mplayer %F<br />
<br />
If you got frontend/GUI enter GUI name in Exec=GUI name %F.<br />
<br />
==External links==<br />
* [http://www.mplayerhq.hu/ Official MPlayer website]<br />
<br />
[[Category:Audio/Video (English)]]</div>Blohttps://wiki.archlinux.org/index.php?title=NTFS-3G&diff=80488NTFS-3G2009-10-26T11:53:06Z<p>Blo: /* Manual mounting */</p>
<hr />
<div>[[Category:File systems (English)]]<br />
[[Category:Emulators (English)]]<br />
[[Category:HOWTOs (English)]]<br />
{{i18n_links_start}}<br />
{{i18n_entry|English|NTFS Write Support}}<br />
{{i18n_entry|Italiano|Supporto di scrittura su NTFS}}<br />
{{i18n_entry|עברית|תמיכה בכתיבה במחיצות NTFS}}<br />
{{i18n_entry|Русский|Поддержка NTFS Записи}}<br />
{{i18n_entry|简体中文|NTFS (简体中文)}}<br />
{{i18n_entry|Español|Capacidad de escritura en NTFS (Español)}}<br />
{{i18n_links_end}}<br />
<br />
This document guides you in setting up read/write access to NTFS partitions using ntfs-3g.<br />
<br />
<br />
==Installing ntfs-3g==<br />
Make sure the [extra] repo is enabled and then install ntfs-3g:<br />
# pacman -Sy ntfs-3g<br />
<br />
==Basic configuration==<br />
===Manual mounting===<br />
In order to mount an NTFS partion manually, issue the following command in a teminal.<br />
ntfs-3g /dev/sda1 /mnt/<mount point><br />
OR<br />
mount -t ntfs-3g /dev/sda1 /mnt/mount_point<br />
<br />
===Editing fstab===<br />
The basic ntfs-3g {{Filename|/etc/fstab}} entry:<br />
<partition> <mount point> ntfs-3g defaults 0 0<br />
<br />
For example:<br />
/dev/sda1 /mnt/windows ntfs-3g defaults 0 0<br />
<br />
{{Box Note | If you have an older version of ntfs-3g than 2009.1.1, add the option {{Codeline|locale&#61;<locale>}}, e.g. {{Codeline|defaults,locale&#61;en_PH.utf8}}, so file names will be shown correctly.}}<br />
<br />
==Advanced configuration==<br />
If you don't want to allow full access to everybody, you'll want to change the {{Codeline|defaults}} option to a more specific setting.<br />
<br />
===Editing fstab===<br />
Edit your {{Filename|/etc/fstab}} accordingly:<br />
<partition> <mount point> ntfs-3g <options> 0 0<br />
<br />
Example:<br />
/dev/sda1 /mnt/windows ntfs-3g users,uid=1000,gid=100,fmask=0113,dmask=0002 0 0<br />
<br />
* '''The example above will make:'''<br />
#Your NTFS partitions to be unmountable by any user (mounting not implemented yet).<br />
#The user ({{Codeline|uid&#61;1000}}) and group ({{Codeline|gid&#61;100}}) to "own" everything in the partition and to have permissions -rw-rw-r-- (0664) for files and drwxrwxr-x (0775) for directories (not implemented yet).<br />
<br />
===The basic ntfs-3g options===<br />
* '''users''' &ndash; allow anybody to (un)mount NTFS partitions provided that the ntfs-3g binary is set SUID root ''(Command: {{Codeline|chmod u+s /bin/ntfs-3g}})''. Take note that you have to use '''users''' instead of '''user'''.<br />
* '''uid''' &ndash; the decimal value of the owner of the files and directories in a particular NTFS partition<br />
* '''gid''' &ndash; the decimal value of the group of the files and directories in a particular NTFS partition<br />
* '''fmask''' &ndash; the octal value of the bitmask of the file permissions<br />
* '''dmask''' &ndash; the octal value of the bitmask of the directory permissions<br />
* '''locale''' &ndash; once required to make files with national characters visible - no longer needed with ntfs-3g 2009.1.1 and newer.<br />
* '''noauto''' &ndash; if noauto is set entries in fstab do not get mounted automatically (not implemented yet).<br />
<br />
===Bitmask Values===<br />
To easily know the bitmask value for a particular permission setting without doing any calculations, all you have to do is:<br />
#Fire up a new shell session. Use whatever terminal emulator you like.<br />
#Use the '''umask''' command to give you the octal representation of a particular permission setting.<br />
##"Set" the file mode creation mask using umask. e.g.:<pre>$ umask ug=rw,o=r</pre>Take note that {{Codeline|ug&#61;rw,o&#61;r}} is equivalent to -rw-rw-r-- or 0664.<br />
##Get the octal equivalent by simply executing umask without any arguments.<pre>$ umask</pre>You should get this:<pre>0113</pre><br />
<br />
* Consult the '''EXTENDED DESCRIPTION''' section of the chmod manpage for more info about the '''mode''' operand (string format of the new file mode creation mask).<br />
<br />
==Damaged NTFS Filesystems==<br />
<br />
If an NTFS filesystem has errors on it ntfs-3g will mount it as read only. To fix an NTFS filesystem load Windows and run it's disk checking program. Repairs of an NTFS filesystem isn't possible yet in Linux.<br />
<br />
==Mounting the partition==<br />
This part can be used to mount your NTFS partition to test if everything works fine. If you wrote everything in {{Filename|fstab}}, it will be mounted automatically everytime the computer starts.<br />
# mount <partition><br />
or<br />
# mount <mount point><br />
<br />
Examples:<br />
# mount /dev/sda1<br />
# mount /mnt/backup<br />
<br />
== Mounting the partition using HAL ==<br />
[[HAL]] can automatically mount your NTFS partition via hotplugging. Create a [[HAL#NTFS_write_access|custom HAL policy]] and add yourself to the '''storage''' group to obtain write permission.<br />
<br />
==Troubleshooting==<br />
If you can't mount your NTFS partion even when following this guide, try to add the UUID section to your {{Filename|fstab}} to all ntfs partions.<br />
<br />
If you'd like to be able to toggle write access to an NTFS drive or partition take a look at [http://aur.archlinux.org/packages.php?ID=8178 ntfs-config] in AUR.</div>Blohttps://wiki.archlinux.org/index.php?title=Installing_with_Software_RAID_or_LVM&diff=80487Installing with Software RAID or LVM2009-10-26T11:50:27Z<p>Blo: /* Create the RAID Redundant Partitions */</p>
<hr />
<div>[[Category:Getting and installing Arch (English)]]<br />
[[Category:File systems (English)]]<br />
[[Category:HOWTOs (English)]]<br />
<br />
== Disclaimer==<br />
<br />
{{ Warning | Installing a system with RAID is a complex process. Anything could go wrong. You could make a mistake, I could make a mistake, there could be a bug in something. Backup all your data first. Make sure only the drives involved in the installation are attached while doing the install. You've been warned! }}<br />
<br />
Also note that this document is up-to-date with all "Archisms" as of 2008.06 'Overlord'. It may not be applicable to previous releases of Arch Linux.<br />
<br />
=== RAID ===<br />
<br />
RAID (Redundant Array of Independent Disks) is designed to prevent data loss in the event of a hard disk failure. There are different "levels" of RAID. RAID 0 (striping) isn't really RAID at all, because it provides no redundancy. It does, however, provide speed benefit. We'll use RAID 0 for swap, on the assumption that you're using a desktop, where the speed increase is worth the possibility of having your system crash if one of your drives fails. On a server, you'd almost certainly want RAID 1 or RAID 5. The size of a RAID 0 array block device is the size of the smallest component partition times the number of component partitions.<br />
<br />
RAID 1 is the most straightforward RAID level: straight mirroring. As with other RAID levels, it only makes sense if the partitions are on different physical disk drives. If one of those drives fails, the block device provided by the RAID array will continue to function as normal. We'll be using RAID 1 for everything except swap. Note that RAID 1 is the only option for the boot partition, because bootloaders (which read the boot partition) don't understand RAID, but a RAID 1 component partition can be read as a normal partition. The size of a RAID 1 array block device is the size of the smallest component partition.<br />
<br />
RAID 5 is the only other RAID level you're likely to want. It requires 3 or more physical drives, and provides the redundancy of RAID 1 combined with the speed and size benefits of RAID 0. RAID 5 uses striping, like RAID 0, but also stores parity blocks distributed across each member disk. In the event of a failed disk, these parity blocks are used to reconstruct the data on a replacement disk. RAID 5 can withstand the loss of one member disk.<br />
<br />
'''ATTENTION: Having RAID does not mean you don't need backups - read the CAVEATS section below!'''<br />
<br />
=== LVM ===<br />
<br />
[http://sourceware.org/lvm2/ LVM] (Logical Volume Management) makes use of the [http://sources.redhat.com/dm/ device-mapper] feature of the Linux kernel. It provides a system of specifying partitions independently of the layout of the underlying disk. What this means for you is that you can extend and shrink partitions (subject to the filesystem you use allowing this) and add and remove partitions without worrying about whether you have enough contiguous space on a particular disk, without getting caught up in the problems of fdisking a disk that is in use (and wondering whether the kernel is using the old or new partition table) and without having to move other partition out of the way.<br />
<br />
This is strictly an ease-of-management issue: it doesn't provide any addition security. However, it sits nicely with the other two technologies we're using.<br />
<br />
Note that we're not using LVM for the boot partition (because of the bootloader problem).<br />
<br />
==CAVEATS==<br />
<br />
=== Security (redundancy) ===<br />
<br />
Again, RAID does not provide a guarantee that your data is safe. If there is a fire, if your computer is stolen or if you have multiple hard drive failures, RAID won't protect you. So '''make backups'''. Whether you use tape drives, DVDs, CDROMs or another computer, keep a copy of your data out of your computer (and preferably offsite) and keep it up to date. Get into the habit of making regular backups. If you organize the data on your computer in a way that separates things you are currently working on from "archived" things that are unlikely to change, you can back up the "current" stuff frequently, and the "archived" stuff occasionally.<br />
<br />
== General Approach==<br />
<br />
For starters, note that this document seeks primarily to give you a good example walkthrough of how to install Arch with Software RAID or LVM support for a typical case. It won't try to explain all the possible things you can do -- it's more to give you an example of something that will work that you can then tweak to your own purposes.<br />
<br />
In this example, the machine I'm using will have three similar IDE hard drives, at least 80GB each in size, installed as primary master, primary slave, and secondary master, with my installation CD-ROM drive as the secondary slave. I will assume these can be reached as /dev/sda, /dev/sdb, and /dev/sdc, and that the cdrom drive is /dev/cdrom.<br />
<br />
We'll create a 100MB /boot partition, a 2048MB (2GB) swap partition and a ~ 78GB root partition using LVM. The boot and swap partitions will be RAID1, while the root partition will be RAID5. Why RAID1? For boot, it's so you can boot the kernel from grub (which has no RAID drivers!), and for swap, it's for redundancy, so that your machine will not lose its swap state even if 1 or 2 drives fail.<br />
<br />
Each RAID1 redundant partition will have three physical partitions, all the same size, one on each of the drives. The total storage capacity will be the size of a single one of these physical partitions. A RAID1 redundant partition with 3 physical partitions can lose any two of its physical partitions and still function.<br />
<br />
Each RAID5 redundant partition will also have three physical partitions, all the same size, one on each of the drives. The total storage capacity will be the combined size of ''two'' of these physical partitions, with the third drive being consumed to provide parity information. A RAID5 redundant partition with 3 physical partitions can lose any one of its physical partitions and still function.<br />
<br />
== Get the Arch Installer CD ==<br />
<br />
Please note that in order to use LVM, you need the <code>lvm2</code> and <code>dev-mapper</code> packages installed, otherwise you won't be able to see any LVM partitions on reboot, until you install those packages. Note that the Arch 0.7.1 Base installer ''does not'' contain these packages, but the Arch 0.7.1 Full installer does. So if you're going to use LVM, you'll need to download the bigger ISO. My example will describe you using the Full installer; the changes should be minimal if you wish to use the Base installer instead.<br />
<br />
== Outline ==<br />
<br />
Just to give you an idea of how all this will work, I'll outline the steps. The details for these will be filled in below.<br />
<br />
# Boot the Installer CD<br />
# Partition the Hard Drives<br />
# Create the RAID Redundant Partitions<br />
# Create and Mount the Main Filesystems<br />
# Setup LVM and Create the / (root) LVM Volume<br />
# Install and Configure Arch<br />
# Install Grub on the Primary Hard Drive<br />
# Unmount Filesystems and Reboot<br />
# Install Grub on the Alternate Boot Drives<br />
# Archive your Filesystem Partition Scheme<br />
<br />
== Procedure==<br />
<br />
=== Boot the Installer CD===<br />
<br />
First, load all your drives in the machine. Then boot the Arch Linux 0.7 ''Full'' installation CD.<br />
<br />
At the syslinux boot prompt, hit enter: we want to use the SCSI kernel, which has support for RAID and LVM built in.<br />
<br />
So far, this is easy. Don't worry, it gets harder.<br />
<br />
=== Partition the Hard Drives===<br />
If your hard drives are already prepared and all you want to do is activate RAID and LVM jump to [[Installing_with_Software_RAID_or_LVM#Activate_existing_RAID_devices_and_LVM_volumes|Activate exsiting RAID devices and LVM volumes]].<br />
<br />
We'll use <code>cfdisk</code> to do this partitioning. We want to create 3 partitions on each of the three drive:<br />
<br />
Partition 1 (/boot): 100MB, type FD, bootable<br><br />
Partition 2 (swap): 2048MB, type FD<br><br />
Partition 3 (LVM): <Rest of the drive>, type FD<br />
<br />
Note that in general, in <code>cfdisk</code>, you can use the first letter of each <code>[[Bracketed Option]]</code> to select it; however, this is not true for the <code>[[Write]]</code> command, you have to hold SHIFT as well to select it.<br />
<br />
First run:<br />
<pre><br />
# cfdisk /dev/sda<br />
</pre><br />
<br />
Create each partition in order:<br />
<br />
# Select <code>'''New'''</code>.<br />
# Hit Enter to make it a <code>'''Primary'''</code> partition.<br />
# Type the appropriate size (in MB), or for Partition 3, just hit enter to select the remainder of the drive.<br />
# Hit Enter to choose to place the partition at the <code>'''Beginning'''</code>.<br />
# Select <code>'''Type'''</code>, hit enter to see the second page of the list, and then type <code>fd</code> for the Linux RAID Autodetect type.<br />
# ''For Partition 1 on each drive'', select <code>'''Bootable'''</code>.<br />
# Hit down arrow (selecting the remaining free space) to go on to the next partition to be created.<br />
<br />
When you're done, select <code>'''Write'''</code>, and confirm <code>y-e-s</code> that you want to write the partition information to disk.<br />
<br />
Then select <code>'''Quit'''</code>.<br />
<br />
Repeat this for the other two drives:<br />
<br />
<pre><br />
# cfdisk /dev/sdb<br />
# cfdisk /dev/sdc<br />
</pre><br />
<br />
Create the same exact partitions on each disk. If a group of partitions of different sizes are assembled to create a redundant RAID partition, it ''will'' work, but the redundant partition will be in multiples of the size of the smallest one, leaving the rest of the allocated drive space to waste.<br />
<br />
=== Load the RAID Modules ===<br />
<br />
Before using <code>mdadm</code>, you need load the modules for the RAID levels you'll be using. In this example, we're using levels 1 and 5, so we'll load those. You can ignore any modprobe errors like <code>"cannot insert md-mod.ko: File exists"</code>. Busybox's modprobe can be a little slow sometimes.<br />
<br />
<pre><br />
# modprobe raid1<br />
# modprobe raid5<br />
</pre><br />
<br />
=== Create the RAID Redundant Partitions ===<br />
<br />
Now that you've created all the physical partitions, you're ready to set up RAID. The tool you use to create RAID arrays is <code>mdadm</code>.<br />
<br />
To create /dev/md0 (/):<br />
<pre><br />
# mdadm --create /dev/md0 --level=5 --raid-devices=3 /dev/sda3 /dev/sdb3 /dev/sdc3<br />
</pre><br />
<br />
To create /dev/md1 (/boot):<br />
<pre><br />
# mdadm --create /dev/md1 --level=1 --raid-devices=3 /dev/sda1 /dev/sdb1 /dev/sdc1<br />
</pre><br />
<br />
To create /dev/md2 (swap):<br />
<pre><br />
# mdadm --create /dev/md2 --level=1 --raid-devices=3 /dev/sda2 /dev/sdb2 /dev/sdc2<br />
</pre><br />
<br />
At this point, you should have working RAID partitions. When you create the RAID partitions, they need to sync themselves so the contents of all three physical partitions are the same on all three drives. The hard drives lights will come on as they try to sync up. You can monitor the progress by typing:<br />
<pre><br />
# cat /proc/mdstat<br />
</pre><br />
<br />
You can also get particular information about, say, the root partition by typing:<br />
<pre><br />
# mdadm --misc --detail /dev/md0<br />
</pre><br />
<br />
You don't have to wait for synchronization to finish -- you may proceed with the installation while syncronization is still occurring. You can even reboot at the end of the installation with synchronization still going.<br />
<br />
If you want to reuse the parts of a raid array you should issue this command to zero the superblock of the raid device.<br />
<pre><br />
#mdadm --zero-superblock /dev/sdxx<br />
</pre><br />
<br />
=== Setup LVM and Create the / (root) LVM Volume===<br />
This is where you create the LVM volumes. LVM works with abstract layers, check out [[LVM|LVM]] and/or it's documentation to discover more. What you will be doing in short:<br />
* Turn block devices (e.g. /dev/sda1 or /dev/md0) into Physical Volume(s) that can be used by LVM<br />
* Create a Volume Group consisting of Physical Volume(s)<br />
* Create Logical Volume(s) within the Volume Group <br />
<br />
'''Note:'''<br />
If you are using an Arch Linux install CD <= 0.7.1, you have to create and mount a sysfs partition on /sys, to keep lvm from getting cranky. Otherwise you can skip this mounting of sysfs, unless you run into trouble. If you forget to do this, instead of giving you an intelligent error message, lvm will simply Segmentation fault at various inconvenient times.<br />
<br />
To mount the sysfs partition, do:<br />
<pre><br />
# mkdir /sys<br />
# mount -t sysfs none /sys<br />
</pre><br />
<br />
'''Let's get started:'''<br />
<br />
Make sure that the device-mapper module is loaded:<br />
<pre><br />
# modprobe dm-mod<br />
</pre><br />
<br />
Now you need to do is tell LVM you have a Physical Volume for it to use. It's really a virtual RAID volume (<code>/dev/md0</code>), but LVM doesn't know this, or really care. Do:<br />
<pre><br />
# pvcreate /dev/md0<br />
</pre><br />
<br />
This might fail if you're using raid or creating PV on an existing Volume Group. If so you might want to add -ff option.<br />
<br />
LVM should report back that it has added the Physical Volume. You can confirm this with:<br />
<pre><br />
# pvdisplay<br />
</pre><br />
<br />
Now it's time to create a Volume Group (which I'll call <code>array</code>) which has control over the LVM Physical Volume we created. Do:<br />
<pre><br />
# vgcreate array /dev/md0<br />
</pre><br />
<br />
LVM should report that it has created the Volume Group <code>array</code>. You can confirm this with:<br />
<pre><br />
# vgdisplay<br />
</pre><br />
<br />
Next, we create a Logical Volume called <code>root</code> in Volume Group <code>array</code> which is 50GB in size:<br />
<pre><br />
# lvcreate --size 50G --name root array<br />
</pre><br />
<br />
LVM should report that it created the Logical Volume <code>root</code>. You can confirm this with:<br />
<pre><br />
# lvdisplay<br />
</pre><br />
<br />
The LVM volume should now be available as <code>/dev/mapper/array-root</code>. Or something similar, LVM will also be able to tell you which when you issue the display command.<br />
<br />
=== Activate existing RAID devices and LVM volumes ===<br />
<br />
If you already have RAID partitions created on your system and you've also set up LVM and all you want is enabling them<br />
follow this simple procedure. ''This might come in handy if you're switching distros and don't want to lose data in /home<br />
for example.'' <br />
<br />
First you need to enable RAID support. RAID1 and RAID5 in this case.<br />
<pre><br />
modprobe raid1<br />
modprobe raid5<br />
</pre><br />
<br />
Activate RAID devices: md1 for /boot and md0 for LVM where two logical volumes will reside.<br />
<pre><br />
mdadm --assemble /dev/md0 /dev/sda3 /dev/sdb3 /dev/sdc3<br />
mdadm --assemble /dev/md1 /dev/sda1 /dev/sdb1 /dev/sdc1<br />
</pre><br />
<br />
RAID devices should now be enabled. Check /proc/mdstat.<br />
<br />
If you haven't loaded kernel LVM support do so now.<br />
<pre><br />
modprobe dm-mod<br />
</pre><br />
Startup of LVM requires just the following two commands: <br />
<pre><br />
vgscan<br />
vgchange -ay<br />
</pre><br />
<br />
You can now jump to '''[3] Set Filesystem Mountpoints''' in your menu based setup and mount created<br />
partitions as needed.<br />
<br />
=== Create and Mount the Filesystems ===<br />
'''When you are using a setup that is newer then 2008.03; this step is optional!'''<br />
<br />
I like Reiser (3.x), so I use it for almost everything. GRUB supports it for booting, and it handles small files well. It's about as well tested as EXT3. You can choose other types if you wish.<br />
<br />
To create /boot:<br />
<pre><br />
# mkreiserfs /dev/md1<br />
</pre><br />
<br />
To create swap space:<br />
<pre><br />
# mkswap /dev/md2<br />
</pre><br />
<br />
To create /:<br />
<pre><br />
# mkreiserfs /dev/array/root<br />
</pre><br />
<br />
Now, mount the boot and root partitions where the installer expects them:<br />
<pre><br />
# mount /dev/array/root /mnt<br />
# mkdir /mnt/boot<br />
# mount /dev/md1 /mnt/boot<br />
</pre><br />
<br />
We've created all our filesystems! And we're ready to install the OS!<br />
<br />
=== Install and Configure Arch ===<br />
<br />
This section doesn't attempt to teach you all about the Arch Installer. It leaves out some details here and there for brevity, but still seeks to be basically follow-able. If you're having trouble with the installer, you may wish to seek help elsewhere in the Wiki or forums.<br />
<br />
'''Note:''' Because the installer builds the initrd using /etc/mdadm.conf, you should update that file with your RAID configuration. The original file can simply be deleted because it contains comments on how to fill it correctly, and that is something mdadm can do automaticly for you. So let's delete the original and have mdadm create you a new one with the currect setup:<br />
<pre><br />
rm /etc/mdadm.conf<br />
mdadm –D –-scan >> /etc/mdadm.conf<br />
</pre><br />
<br />
Now you can continue using the installer to set-up the system and install the packages you need.<br />
Here's the walkthrough:<br />
<br />
* Type <code>/arch/setup</code> to launch the main installer.<br />
* Select <code> < OK ></code> at the opening screen.<br />
* Select <code>1 CD_ROM</code> to install from CD-ROM (or <code>2 FTP</code> if you have a local Arch mirror on FTP).<br />
* If you have skipped the optional step (''Create and Mount the Filesystems'') above, and haven't created a fileystem yet, select <code>1 Prepare Hard Drive</code> > <code>3 Set Filesystem Mountpoints</code> and create your filesystems and mountpoints here'''<br />
* Now at the main menu, Select <code>2 Select Packages</code> and select all the packages in the ''base'' category, as well as the <code>mdadm</code> and <code>lvm2</code> packages from the ''system'' category. Note: mdadm & lvm2 are included in ''base'' category since arch-base-0.7.2.<br />
* Select <code>3 Install Packages</code>. This will take a little while.<br />
* Select <code>4 Configure System</code>:<br />
<br />
Add the ''mdadm'' and ''lvm2'' hook to the HOOKS list in /etc/mkinitcpio.conf '''(before 'filesystems', NOT after)'''.<br />
See [[Configuring_mkinitcpio#Using_raid|Configuring mkinitpcio using RAID]] for more details. <br />
<br />
Edit your <code>/etc/rc.conf</code>. It should contain a <code>USELVM</code> entry already, which you should change to:<br />
<pre><br />
USELVM="yes"<br />
</pre><br />
''Please Note'': The <code>rc.sysinit</code> script that parses the <code>USELVM</code> variable entry will accept either <code>yes</code> or <code>YES</code>, however it will not accept mixed case. Please be sure you've got your capitalization correct.<br />
<br />
Edit your <code>/etc/fstab</code> to contain the entries:<br />
<pre><br />
/dev/array/root / reiserfs defaults 0 1<br />
/dev/md2 swap swap defaults 0 0<br />
/dev/md1 /boot reiserfs defaults 0 0<br />
</pre><br />
<br />
At this point, make any other configuration changes you need to other files.<br />
<br />
Then exit the configuration menu.<br />
<br />
Since you will not be installing Grub from the installer, select <code>7 Exit Install</code> to leave the installer program.<br />
<br />
<br />
'''Old style:'''<br />
<br />
Then specify the raid array you're booting from in /mnt/boot/grub/menu.lst like:<br />
# Example with /dev/array/root for ''/'' & /dev/md1 for ''/boot'':<br />
kernel /kernel26 root=/dev/array/root ro md=1,/dev/sda1,/dev/sdb1,/dev/sdc1 md=0,/dev/sda3,/dev/sdb3,/dev/sdc3<br />
<br />
<br />
'''Nowadays (2009.02), with the mdadm hook in the initrd it it no longer necessary to add kernel parameters concerning the RAID array(s).''' <br />
<br />
The arrays can be assembled on boot by the kernel using that hook and the contents of /etc/mdadm.conf, which is included in the initrd image when it's build. (See [[Configuring_mkinitcpio#Using_raid|Configuring mkinitpcio using RAID]] )<br />
<br />
An example of a GRUB boot configuration for booting of a RAIDed root like this:<br />
<pre><br />
# (0) Arch Linux<br />
title Arch Linux<br />
root (hd0,0)<br />
kernel /vmlinuz26 root=/dev/md0 ro<br />
initrd /kernel26.img<br />
</pre><br />
<br />
=== Install Grub on the Primary Hard Drive (and save the RAID config) ===<br />
<br />
This is the last and final step before you have a bootable system!<br />
<br />
As an overview, the basic concept is to copy over the grub bootloader files into /boot/grub, mount a procfs and a device tree inside of /mnt, then chroot to /mnt so you're effectively inside your new system. Once in your new system, you will run grub to install the bootloader in the boot area of your first hard drive. Then we save our new RAID configuration in <tt>/etc/mdadm.conf</tt> so it can be re-assembled automatically after we reboot.<br />
<br />
Copy the GRUB files into place and get into our chroot:<br />
<pre><br />
# cp -a /mnt/usr/lib/grub/i386-pc/* /mnt/boot/grub<br />
# sync<br />
# mount -o bind /dev /mnt/dev<br />
# mount -t proc none /mnt/proc<br />
# chroot /mnt /bin/bash<br />
</pre><br />
<br />
At this point, you may no longer be able to see keys you type at your console. I'm not sure of the reason for this (NOTE: try "chroot /mnt /bin/<shell>"), but it you can fix it by typing <code>reset</code> at the prompt.<br />
<br />
Once you've got console echo back on, type:<br />
<pre><br />
# grub<br />
</pre><br />
<br />
After a short wait while grub does some looking around, it should come back with a grub prompt. Do:<br />
<br />
<pre><br />
grub> root (hd0,0)<br />
grub> setup (hd0)<br />
grub> quit<br />
</pre><br />
<br />
Now you need to save our RAID configuration so it can be re-assembled automatically each time we boot. Previously, this was an unnecessary step in Arch because the RAID drivers were built in to the kernel. But when loaded after the kernel boots (as modules), arrays are not autodetected. Hence this configuration file.<br />
<br />
The default <code>/etc/mdadm.conf</code> on your chrooted system should be pretty much empty (except for a lot of explanatory comments). All you need to do is capture the output from an mdadm query command and append it to the end of <code>mdadm.conf</code>.<br />
<br />
<pre><br />
# mdadm -D --scan >>/etc/mdadm.conf<br />
</pre><br />
<br />
That's it. You can exit your chroot now by hitting <code>CTRL-D</code> or typing <code>exit</code>.<br />
<br />
=== Reboot ===<br />
<br />
The hard part is all over! Now remove the CD from your CD-ROM drive, and type:<br />
<pre><br />
# reboot<br />
</pre><br />
<br />
=== Install Grub on the Alternate Boot Drives===<br />
<br />
Once you've successfully booted your new system for the first time, you will want to install Grub onto the other two disks (or on the other disk if you have only 2 HDDs) so that, in the event of disk failure, the system can be booted from another drive. Log in to your new system as root and do:<br />
<br />
<pre><br />
# grub<br />
grub> device (hd0) /dev/sdb<br />
grub> root (hd0,0)<br />
grub> setup (hd0)<br />
grub> device (hd0) /dev/sdc<br />
grub> root (hd0,0)<br />
grub> setup (hd0)<br />
grub> quit<br />
</pre><br />
<br />
=== Archive your Filesystem Partition Scheme ===<br />
<br />
Now that you're done, it's worth taking a second to archive off the partition state of each of your drives. This guarantees that it will be trivially easy to replace/rebuild a disk in the event that one fails. You do this with the <code>sfdisk</code> tool and the following steps:<br />
<br />
<pre><br />
# mkdir /etc/partitions<br />
# sfdisk --dump /dev/sda >/etc/partitions/disc0.partitions<br />
# sfdisk --dump /dev/sdb >/etc/partitions/disc1.partitions<br />
# sfdisk --dump /dev/sdc >/etc/partitions/disc2.partitions<br />
</pre><br />
<br />
== Management ==<br />
<br />
For LVM management, please have a look at [[LVM]]<br />
<br />
== Mounting from a Live CD ==<br />
<br />
If you want to mount your RAID partition from a Live CD, use<br />
<br />
<pre><br />
mdadm --assemble /dev/md0 /dev/sda3 /dev/sdb3 /dev/sdc3<br />
</pre><br />
<br />
(or whatever mdX and drives apply to you)<br />
<br />
== Conclusion==<br />
<br />
You're done! I hope you've succeeded in setting up Arch Linux on your server with RAID and LVM!<br />
<br />
==Troubleshooting==<br />
If you are getting error when you reboot about "invalid raid superblock magic" and you have additional hard drives other than the ones you installed to, check that your hard drive order is correct. During installation, your RAID devices may be hdd, hde and hdf, but during boot they may be hda, hdb and hdc. Adjust your kernel line in /boot/grub/menu.lst accordingly. This is what happened to me anyway.<br />
<br />
== Credits==<br />
<br />
This document was written by Paul Mattal with with significant help from others. Comments and suggestions are welcome at paul at archlinux dot org.<br />
<br />
Thanks to all who have contributed information and suggestions! This includes:<br />
<br />
* Carl Chave<br />
* Guillaume Darbonne<br />
<br />
== Additional Resources==<br />
<br />
* [http://en.gentoo-wiki.com/wiki/RAID/Software Gentoo wiki entry]</div>Blohttps://wiki.archlinux.org/index.php?title=Installing_with_Software_RAID_or_LVM&diff=80486Installing with Software RAID or LVM2009-10-26T11:49:53Z<p>Blo: /* Create the RAID Redundant Partitions */</p>
<hr />
<div>[[Category:Getting and installing Arch (English)]]<br />
[[Category:File systems (English)]]<br />
[[Category:HOWTOs (English)]]<br />
<br />
== Disclaimer==<br />
<br />
{{ Warning | Installing a system with RAID is a complex process. Anything could go wrong. You could make a mistake, I could make a mistake, there could be a bug in something. Backup all your data first. Make sure only the drives involved in the installation are attached while doing the install. You've been warned! }}<br />
<br />
Also note that this document is up-to-date with all "Archisms" as of 2008.06 'Overlord'. It may not be applicable to previous releases of Arch Linux.<br />
<br />
=== RAID ===<br />
<br />
RAID (Redundant Array of Independent Disks) is designed to prevent data loss in the event of a hard disk failure. There are different "levels" of RAID. RAID 0 (striping) isn't really RAID at all, because it provides no redundancy. It does, however, provide speed benefit. We'll use RAID 0 for swap, on the assumption that you're using a desktop, where the speed increase is worth the possibility of having your system crash if one of your drives fails. On a server, you'd almost certainly want RAID 1 or RAID 5. The size of a RAID 0 array block device is the size of the smallest component partition times the number of component partitions.<br />
<br />
RAID 1 is the most straightforward RAID level: straight mirroring. As with other RAID levels, it only makes sense if the partitions are on different physical disk drives. If one of those drives fails, the block device provided by the RAID array will continue to function as normal. We'll be using RAID 1 for everything except swap. Note that RAID 1 is the only option for the boot partition, because bootloaders (which read the boot partition) don't understand RAID, but a RAID 1 component partition can be read as a normal partition. The size of a RAID 1 array block device is the size of the smallest component partition.<br />
<br />
RAID 5 is the only other RAID level you're likely to want. It requires 3 or more physical drives, and provides the redundancy of RAID 1 combined with the speed and size benefits of RAID 0. RAID 5 uses striping, like RAID 0, but also stores parity blocks distributed across each member disk. In the event of a failed disk, these parity blocks are used to reconstruct the data on a replacement disk. RAID 5 can withstand the loss of one member disk.<br />
<br />
'''ATTENTION: Having RAID does not mean you don't need backups - read the CAVEATS section below!'''<br />
<br />
=== LVM ===<br />
<br />
[http://sourceware.org/lvm2/ LVM] (Logical Volume Management) makes use of the [http://sources.redhat.com/dm/ device-mapper] feature of the Linux kernel. It provides a system of specifying partitions independently of the layout of the underlying disk. What this means for you is that you can extend and shrink partitions (subject to the filesystem you use allowing this) and add and remove partitions without worrying about whether you have enough contiguous space on a particular disk, without getting caught up in the problems of fdisking a disk that is in use (and wondering whether the kernel is using the old or new partition table) and without having to move other partition out of the way.<br />
<br />
This is strictly an ease-of-management issue: it doesn't provide any addition security. However, it sits nicely with the other two technologies we're using.<br />
<br />
Note that we're not using LVM for the boot partition (because of the bootloader problem).<br />
<br />
==CAVEATS==<br />
<br />
=== Security (redundancy) ===<br />
<br />
Again, RAID does not provide a guarantee that your data is safe. If there is a fire, if your computer is stolen or if you have multiple hard drive failures, RAID won't protect you. So '''make backups'''. Whether you use tape drives, DVDs, CDROMs or another computer, keep a copy of your data out of your computer (and preferably offsite) and keep it up to date. Get into the habit of making regular backups. If you organize the data on your computer in a way that separates things you are currently working on from "archived" things that are unlikely to change, you can back up the "current" stuff frequently, and the "archived" stuff occasionally.<br />
<br />
== General Approach==<br />
<br />
For starters, note that this document seeks primarily to give you a good example walkthrough of how to install Arch with Software RAID or LVM support for a typical case. It won't try to explain all the possible things you can do -- it's more to give you an example of something that will work that you can then tweak to your own purposes.<br />
<br />
In this example, the machine I'm using will have three similar IDE hard drives, at least 80GB each in size, installed as primary master, primary slave, and secondary master, with my installation CD-ROM drive as the secondary slave. I will assume these can be reached as /dev/sda, /dev/sdb, and /dev/sdc, and that the cdrom drive is /dev/cdrom.<br />
<br />
We'll create a 100MB /boot partition, a 2048MB (2GB) swap partition and a ~ 78GB root partition using LVM. The boot and swap partitions will be RAID1, while the root partition will be RAID5. Why RAID1? For boot, it's so you can boot the kernel from grub (which has no RAID drivers!), and for swap, it's for redundancy, so that your machine will not lose its swap state even if 1 or 2 drives fail.<br />
<br />
Each RAID1 redundant partition will have three physical partitions, all the same size, one on each of the drives. The total storage capacity will be the size of a single one of these physical partitions. A RAID1 redundant partition with 3 physical partitions can lose any two of its physical partitions and still function.<br />
<br />
Each RAID5 redundant partition will also have three physical partitions, all the same size, one on each of the drives. The total storage capacity will be the combined size of ''two'' of these physical partitions, with the third drive being consumed to provide parity information. A RAID5 redundant partition with 3 physical partitions can lose any one of its physical partitions and still function.<br />
<br />
== Get the Arch Installer CD ==<br />
<br />
Please note that in order to use LVM, you need the <code>lvm2</code> and <code>dev-mapper</code> packages installed, otherwise you won't be able to see any LVM partitions on reboot, until you install those packages. Note that the Arch 0.7.1 Base installer ''does not'' contain these packages, but the Arch 0.7.1 Full installer does. So if you're going to use LVM, you'll need to download the bigger ISO. My example will describe you using the Full installer; the changes should be minimal if you wish to use the Base installer instead.<br />
<br />
== Outline ==<br />
<br />
Just to give you an idea of how all this will work, I'll outline the steps. The details for these will be filled in below.<br />
<br />
# Boot the Installer CD<br />
# Partition the Hard Drives<br />
# Create the RAID Redundant Partitions<br />
# Create and Mount the Main Filesystems<br />
# Setup LVM and Create the / (root) LVM Volume<br />
# Install and Configure Arch<br />
# Install Grub on the Primary Hard Drive<br />
# Unmount Filesystems and Reboot<br />
# Install Grub on the Alternate Boot Drives<br />
# Archive your Filesystem Partition Scheme<br />
<br />
== Procedure==<br />
<br />
=== Boot the Installer CD===<br />
<br />
First, load all your drives in the machine. Then boot the Arch Linux 0.7 ''Full'' installation CD.<br />
<br />
At the syslinux boot prompt, hit enter: we want to use the SCSI kernel, which has support for RAID and LVM built in.<br />
<br />
So far, this is easy. Don't worry, it gets harder.<br />
<br />
=== Partition the Hard Drives===<br />
If your hard drives are already prepared and all you want to do is activate RAID and LVM jump to [[Installing_with_Software_RAID_or_LVM#Activate_existing_RAID_devices_and_LVM_volumes|Activate exsiting RAID devices and LVM volumes]].<br />
<br />
We'll use <code>cfdisk</code> to do this partitioning. We want to create 3 partitions on each of the three drive:<br />
<br />
Partition 1 (/boot): 100MB, type FD, bootable<br><br />
Partition 2 (swap): 2048MB, type FD<br><br />
Partition 3 (LVM): <Rest of the drive>, type FD<br />
<br />
Note that in general, in <code>cfdisk</code>, you can use the first letter of each <code>[[Bracketed Option]]</code> to select it; however, this is not true for the <code>[[Write]]</code> command, you have to hold SHIFT as well to select it.<br />
<br />
First run:<br />
<pre><br />
# cfdisk /dev/sda<br />
</pre><br />
<br />
Create each partition in order:<br />
<br />
# Select <code>'''New'''</code>.<br />
# Hit Enter to make it a <code>'''Primary'''</code> partition.<br />
# Type the appropriate size (in MB), or for Partition 3, just hit enter to select the remainder of the drive.<br />
# Hit Enter to choose to place the partition at the <code>'''Beginning'''</code>.<br />
# Select <code>'''Type'''</code>, hit enter to see the second page of the list, and then type <code>fd</code> for the Linux RAID Autodetect type.<br />
# ''For Partition 1 on each drive'', select <code>'''Bootable'''</code>.<br />
# Hit down arrow (selecting the remaining free space) to go on to the next partition to be created.<br />
<br />
When you're done, select <code>'''Write'''</code>, and confirm <code>y-e-s</code> that you want to write the partition information to disk.<br />
<br />
Then select <code>'''Quit'''</code>.<br />
<br />
Repeat this for the other two drives:<br />
<br />
<pre><br />
# cfdisk /dev/sdb<br />
# cfdisk /dev/sdc<br />
</pre><br />
<br />
Create the same exact partitions on each disk. If a group of partitions of different sizes are assembled to create a redundant RAID partition, it ''will'' work, but the redundant partition will be in multiples of the size of the smallest one, leaving the rest of the allocated drive space to waste.<br />
<br />
=== Load the RAID Modules ===<br />
<br />
Before using <code>mdadm</code>, you need load the modules for the RAID levels you'll be using. In this example, we're using levels 1 and 5, so we'll load those. You can ignore any modprobe errors like <code>"cannot insert md-mod.ko: File exists"</code>. Busybox's modprobe can be a little slow sometimes.<br />
<br />
<pre><br />
# modprobe raid1<br />
# modprobe raid5<br />
</pre><br />
<br />
=== Create the RAID Redundant Partitions ===<br />
<br />
Now that you've created all the physical partitions, you're ready to set up RAID. The tool you use to create RAID arrays is <code>mdadm</code>.<br />
<br />
To create /dev/md0 (/):<br />
<pre><br />
# mdadm --create /dev/md0 --level=5 --raid-devices=3 /dev/sda3 /dev/sdb3 /dev/sdc3<br />
</pre><br />
<br />
To create /dev/md1 (/boot):<br />
<pre><br />
# mdadm --create /dev/md1 --level=1 --raid-devices=3 /dev/sda1 /dev/sdb1 /dev/sdc1<br />
</pre><br />
<br />
To create /dev/md2 (swap):<br />
<pre><br />
# mdadm --create /dev/md2 --level=1 --raid-devices=3 /dev/sda2 /dev/sdb2 /dev/sdc2<br />
</pre><br />
<br />
At this point, you should have working RAID partitions. When you create the RAID partitions, they need to sync themselves so the contents of all three physical partitions are the same on all three drives. The hard drives lights will come on as they try to sync up. You can monitor the progress by typing:<br />
<pre><br />
# cat /proc/mdstat<br />
</pre><br />
<br />
You can also get particular information about, say, the root partition by typing:<br />
<pre><br />
# mdadm --misc --detail /dev/md0<br />
</pre><br />
<br />
You don't have to wait for synchronization to finish -- you may proceed with the installation while syncronization is still occurring. You can even reboot at the end of the installation with synchronization still going.<br />
<br />
If you want to reuse the parts of a raid array you should issue this command to zero the superblock of the raid device.<br />
<pre><br />
<code>mdadm --zero-superblock /dev/sdxx</code><br />
</pre><br />
<br />
=== Setup LVM and Create the / (root) LVM Volume===<br />
This is where you create the LVM volumes. LVM works with abstract layers, check out [[LVM|LVM]] and/or it's documentation to discover more. What you will be doing in short:<br />
* Turn block devices (e.g. /dev/sda1 or /dev/md0) into Physical Volume(s) that can be used by LVM<br />
* Create a Volume Group consisting of Physical Volume(s)<br />
* Create Logical Volume(s) within the Volume Group <br />
<br />
'''Note:'''<br />
If you are using an Arch Linux install CD <= 0.7.1, you have to create and mount a sysfs partition on /sys, to keep lvm from getting cranky. Otherwise you can skip this mounting of sysfs, unless you run into trouble. If you forget to do this, instead of giving you an intelligent error message, lvm will simply Segmentation fault at various inconvenient times.<br />
<br />
To mount the sysfs partition, do:<br />
<pre><br />
# mkdir /sys<br />
# mount -t sysfs none /sys<br />
</pre><br />
<br />
'''Let's get started:'''<br />
<br />
Make sure that the device-mapper module is loaded:<br />
<pre><br />
# modprobe dm-mod<br />
</pre><br />
<br />
Now you need to do is tell LVM you have a Physical Volume for it to use. It's really a virtual RAID volume (<code>/dev/md0</code>), but LVM doesn't know this, or really care. Do:<br />
<pre><br />
# pvcreate /dev/md0<br />
</pre><br />
<br />
This might fail if you're using raid or creating PV on an existing Volume Group. If so you might want to add -ff option.<br />
<br />
LVM should report back that it has added the Physical Volume. You can confirm this with:<br />
<pre><br />
# pvdisplay<br />
</pre><br />
<br />
Now it's time to create a Volume Group (which I'll call <code>array</code>) which has control over the LVM Physical Volume we created. Do:<br />
<pre><br />
# vgcreate array /dev/md0<br />
</pre><br />
<br />
LVM should report that it has created the Volume Group <code>array</code>. You can confirm this with:<br />
<pre><br />
# vgdisplay<br />
</pre><br />
<br />
Next, we create a Logical Volume called <code>root</code> in Volume Group <code>array</code> which is 50GB in size:<br />
<pre><br />
# lvcreate --size 50G --name root array<br />
</pre><br />
<br />
LVM should report that it created the Logical Volume <code>root</code>. You can confirm this with:<br />
<pre><br />
# lvdisplay<br />
</pre><br />
<br />
The LVM volume should now be available as <code>/dev/mapper/array-root</code>. Or something similar, LVM will also be able to tell you which when you issue the display command.<br />
<br />
=== Activate existing RAID devices and LVM volumes ===<br />
<br />
If you already have RAID partitions created on your system and you've also set up LVM and all you want is enabling them<br />
follow this simple procedure. ''This might come in handy if you're switching distros and don't want to lose data in /home<br />
for example.'' <br />
<br />
First you need to enable RAID support. RAID1 and RAID5 in this case.<br />
<pre><br />
modprobe raid1<br />
modprobe raid5<br />
</pre><br />
<br />
Activate RAID devices: md1 for /boot and md0 for LVM where two logical volumes will reside.<br />
<pre><br />
mdadm --assemble /dev/md0 /dev/sda3 /dev/sdb3 /dev/sdc3<br />
mdadm --assemble /dev/md1 /dev/sda1 /dev/sdb1 /dev/sdc1<br />
</pre><br />
<br />
RAID devices should now be enabled. Check /proc/mdstat.<br />
<br />
If you haven't loaded kernel LVM support do so now.<br />
<pre><br />
modprobe dm-mod<br />
</pre><br />
Startup of LVM requires just the following two commands: <br />
<pre><br />
vgscan<br />
vgchange -ay<br />
</pre><br />
<br />
You can now jump to '''[3] Set Filesystem Mountpoints''' in your menu based setup and mount created<br />
partitions as needed.<br />
<br />
=== Create and Mount the Filesystems ===<br />
'''When you are using a setup that is newer then 2008.03; this step is optional!'''<br />
<br />
I like Reiser (3.x), so I use it for almost everything. GRUB supports it for booting, and it handles small files well. It's about as well tested as EXT3. You can choose other types if you wish.<br />
<br />
To create /boot:<br />
<pre><br />
# mkreiserfs /dev/md1<br />
</pre><br />
<br />
To create swap space:<br />
<pre><br />
# mkswap /dev/md2<br />
</pre><br />
<br />
To create /:<br />
<pre><br />
# mkreiserfs /dev/array/root<br />
</pre><br />
<br />
Now, mount the boot and root partitions where the installer expects them:<br />
<pre><br />
# mount /dev/array/root /mnt<br />
# mkdir /mnt/boot<br />
# mount /dev/md1 /mnt/boot<br />
</pre><br />
<br />
We've created all our filesystems! And we're ready to install the OS!<br />
<br />
=== Install and Configure Arch ===<br />
<br />
This section doesn't attempt to teach you all about the Arch Installer. It leaves out some details here and there for brevity, but still seeks to be basically follow-able. If you're having trouble with the installer, you may wish to seek help elsewhere in the Wiki or forums.<br />
<br />
'''Note:''' Because the installer builds the initrd using /etc/mdadm.conf, you should update that file with your RAID configuration. The original file can simply be deleted because it contains comments on how to fill it correctly, and that is something mdadm can do automaticly for you. So let's delete the original and have mdadm create you a new one with the currect setup:<br />
<pre><br />
rm /etc/mdadm.conf<br />
mdadm –D –-scan >> /etc/mdadm.conf<br />
</pre><br />
<br />
Now you can continue using the installer to set-up the system and install the packages you need.<br />
Here's the walkthrough:<br />
<br />
* Type <code>/arch/setup</code> to launch the main installer.<br />
* Select <code> < OK ></code> at the opening screen.<br />
* Select <code>1 CD_ROM</code> to install from CD-ROM (or <code>2 FTP</code> if you have a local Arch mirror on FTP).<br />
* If you have skipped the optional step (''Create and Mount the Filesystems'') above, and haven't created a fileystem yet, select <code>1 Prepare Hard Drive</code> > <code>3 Set Filesystem Mountpoints</code> and create your filesystems and mountpoints here'''<br />
* Now at the main menu, Select <code>2 Select Packages</code> and select all the packages in the ''base'' category, as well as the <code>mdadm</code> and <code>lvm2</code> packages from the ''system'' category. Note: mdadm & lvm2 are included in ''base'' category since arch-base-0.7.2.<br />
* Select <code>3 Install Packages</code>. This will take a little while.<br />
* Select <code>4 Configure System</code>:<br />
<br />
Add the ''mdadm'' and ''lvm2'' hook to the HOOKS list in /etc/mkinitcpio.conf '''(before 'filesystems', NOT after)'''.<br />
See [[Configuring_mkinitcpio#Using_raid|Configuring mkinitpcio using RAID]] for more details. <br />
<br />
Edit your <code>/etc/rc.conf</code>. It should contain a <code>USELVM</code> entry already, which you should change to:<br />
<pre><br />
USELVM="yes"<br />
</pre><br />
''Please Note'': The <code>rc.sysinit</code> script that parses the <code>USELVM</code> variable entry will accept either <code>yes</code> or <code>YES</code>, however it will not accept mixed case. Please be sure you've got your capitalization correct.<br />
<br />
Edit your <code>/etc/fstab</code> to contain the entries:<br />
<pre><br />
/dev/array/root / reiserfs defaults 0 1<br />
/dev/md2 swap swap defaults 0 0<br />
/dev/md1 /boot reiserfs defaults 0 0<br />
</pre><br />
<br />
At this point, make any other configuration changes you need to other files.<br />
<br />
Then exit the configuration menu.<br />
<br />
Since you will not be installing Grub from the installer, select <code>7 Exit Install</code> to leave the installer program.<br />
<br />
<br />
'''Old style:'''<br />
<br />
Then specify the raid array you're booting from in /mnt/boot/grub/menu.lst like:<br />
# Example with /dev/array/root for ''/'' & /dev/md1 for ''/boot'':<br />
kernel /kernel26 root=/dev/array/root ro md=1,/dev/sda1,/dev/sdb1,/dev/sdc1 md=0,/dev/sda3,/dev/sdb3,/dev/sdc3<br />
<br />
<br />
'''Nowadays (2009.02), with the mdadm hook in the initrd it it no longer necessary to add kernel parameters concerning the RAID array(s).''' <br />
<br />
The arrays can be assembled on boot by the kernel using that hook and the contents of /etc/mdadm.conf, which is included in the initrd image when it's build. (See [[Configuring_mkinitcpio#Using_raid|Configuring mkinitpcio using RAID]] )<br />
<br />
An example of a GRUB boot configuration for booting of a RAIDed root like this:<br />
<pre><br />
# (0) Arch Linux<br />
title Arch Linux<br />
root (hd0,0)<br />
kernel /vmlinuz26 root=/dev/md0 ro<br />
initrd /kernel26.img<br />
</pre><br />
<br />
=== Install Grub on the Primary Hard Drive (and save the RAID config) ===<br />
<br />
This is the last and final step before you have a bootable system!<br />
<br />
As an overview, the basic concept is to copy over the grub bootloader files into /boot/grub, mount a procfs and a device tree inside of /mnt, then chroot to /mnt so you're effectively inside your new system. Once in your new system, you will run grub to install the bootloader in the boot area of your first hard drive. Then we save our new RAID configuration in <tt>/etc/mdadm.conf</tt> so it can be re-assembled automatically after we reboot.<br />
<br />
Copy the GRUB files into place and get into our chroot:<br />
<pre><br />
# cp -a /mnt/usr/lib/grub/i386-pc/* /mnt/boot/grub<br />
# sync<br />
# mount -o bind /dev /mnt/dev<br />
# mount -t proc none /mnt/proc<br />
# chroot /mnt /bin/bash<br />
</pre><br />
<br />
At this point, you may no longer be able to see keys you type at your console. I'm not sure of the reason for this (NOTE: try "chroot /mnt /bin/<shell>"), but it you can fix it by typing <code>reset</code> at the prompt.<br />
<br />
Once you've got console echo back on, type:<br />
<pre><br />
# grub<br />
</pre><br />
<br />
After a short wait while grub does some looking around, it should come back with a grub prompt. Do:<br />
<br />
<pre><br />
grub> root (hd0,0)<br />
grub> setup (hd0)<br />
grub> quit<br />
</pre><br />
<br />
Now you need to save our RAID configuration so it can be re-assembled automatically each time we boot. Previously, this was an unnecessary step in Arch because the RAID drivers were built in to the kernel. But when loaded after the kernel boots (as modules), arrays are not autodetected. Hence this configuration file.<br />
<br />
The default <code>/etc/mdadm.conf</code> on your chrooted system should be pretty much empty (except for a lot of explanatory comments). All you need to do is capture the output from an mdadm query command and append it to the end of <code>mdadm.conf</code>.<br />
<br />
<pre><br />
# mdadm -D --scan >>/etc/mdadm.conf<br />
</pre><br />
<br />
That's it. You can exit your chroot now by hitting <code>CTRL-D</code> or typing <code>exit</code>.<br />
<br />
=== Reboot ===<br />
<br />
The hard part is all over! Now remove the CD from your CD-ROM drive, and type:<br />
<pre><br />
# reboot<br />
</pre><br />
<br />
=== Install Grub on the Alternate Boot Drives===<br />
<br />
Once you've successfully booted your new system for the first time, you will want to install Grub onto the other two disks (or on the other disk if you have only 2 HDDs) so that, in the event of disk failure, the system can be booted from another drive. Log in to your new system as root and do:<br />
<br />
<pre><br />
# grub<br />
grub> device (hd0) /dev/sdb<br />
grub> root (hd0,0)<br />
grub> setup (hd0)<br />
grub> device (hd0) /dev/sdc<br />
grub> root (hd0,0)<br />
grub> setup (hd0)<br />
grub> quit<br />
</pre><br />
<br />
=== Archive your Filesystem Partition Scheme ===<br />
<br />
Now that you're done, it's worth taking a second to archive off the partition state of each of your drives. This guarantees that it will be trivially easy to replace/rebuild a disk in the event that one fails. You do this with the <code>sfdisk</code> tool and the following steps:<br />
<br />
<pre><br />
# mkdir /etc/partitions<br />
# sfdisk --dump /dev/sda >/etc/partitions/disc0.partitions<br />
# sfdisk --dump /dev/sdb >/etc/partitions/disc1.partitions<br />
# sfdisk --dump /dev/sdc >/etc/partitions/disc2.partitions<br />
</pre><br />
<br />
== Management ==<br />
<br />
For LVM management, please have a look at [[LVM]]<br />
<br />
== Mounting from a Live CD ==<br />
<br />
If you want to mount your RAID partition from a Live CD, use<br />
<br />
<pre><br />
mdadm --assemble /dev/md0 /dev/sda3 /dev/sdb3 /dev/sdc3<br />
</pre><br />
<br />
(or whatever mdX and drives apply to you)<br />
<br />
== Conclusion==<br />
<br />
You're done! I hope you've succeeded in setting up Arch Linux on your server with RAID and LVM!<br />
<br />
==Troubleshooting==<br />
If you are getting error when you reboot about "invalid raid superblock magic" and you have additional hard drives other than the ones you installed to, check that your hard drive order is correct. During installation, your RAID devices may be hdd, hde and hdf, but during boot they may be hda, hdb and hdc. Adjust your kernel line in /boot/grub/menu.lst accordingly. This is what happened to me anyway.<br />
<br />
== Credits==<br />
<br />
This document was written by Paul Mattal with with significant help from others. Comments and suggestions are welcome at paul at archlinux dot org.<br />
<br />
Thanks to all who have contributed information and suggestions! This includes:<br />
<br />
* Carl Chave<br />
* Guillaume Darbonne<br />
<br />
== Additional Resources==<br />
<br />
* [http://en.gentoo-wiki.com/wiki/RAID/Software Gentoo wiki entry]</div>Blohttps://wiki.archlinux.org/index.php?title=Open_Sound_System&diff=80482Open Sound System2009-10-26T11:25:13Z<p>Blo: /* Installing */</p>
<hr />
<div>[[Category:Audio/Video (English)]]<br />
[[Category:HOWTOs (English)]]<br />
{{i18n_links_start}}<br />
{{i18n_entry|English|OSS}}<br />
{{i18n_entry|简体中文|OSS (简体中文)}}<br />
{{i18n_entry|Français|OSS (Français)}}<br />
{{i18n_entry|Türkçe|OSS (Türkçe)}}<br />
{{i18n_links_end}}<br />
<br />
= Introduction =<br />
The [http://developer.opensound.com Open Sound System] is a [http://4front-tech.com commercially-supported] sound architecture that works on several UNIX-like and POSIX-compatible systems, including Linux, FreeBSD, Solaris and BeOS/Haiku.<br />
<br />
Please note that this article is not about the old OSS, which is included in the Linux kernel sources and is more than 10 years old by now.<br />
<br />
This article is about the new OSS versions (often called OSSv4). These versions were previously proprietary - OSS became open source again in July 2007, and is currently available under GPL, BSD or CDDL licenses.<br />
<br />
= Advantages and disadvantages vs. ALSA =<br />
<br />
== Advantages over ALSA (for users) ==<br />
* Includes a transparent software mixer (vmix) in kernel space. This means multiple applications can access the sound device at the same time without problems.<br />
* The vmix mixer controls allow you to adjust the volume of each application individually.<br />
* Better support for some sound card models, for example for the Creative X-Fi.<br />
* Sound quality is usually better. '''reference needed to validate this statement'''<br />
* Better support for applications written for the OSS API, of course. The OSS API is widely spread and a lot of applications support it. The ALSA's OSS API emulation, however, is often buggy.<br />
<br />
== Advantages over ALSA (for developers) ==<br />
* Cleaner and easier to use API.<br />
* API is much better [http://manuals.opensound.com/developer documented].<br />
* Support for sound drivers in the userspace (oss_userdev).<br />
* Portability across all supported platforms. If the application works using OSS under Linux, it will work under FreeBSD and Solaris too, for example.<br />
* Portability across operating systems. It's [http://revolf.free.fr/Alchimie-7/Alchimie7_OSS_Haiku.en.pdf easier] to port OSS to a new operating system.<br />
<br />
== Disadvantages vs. ALSA ==<br />
* USB audio devices support is currently experimental and USB recording is not implemented.<br />
* Bluetooth audio devices are currently not supported.<br />
* AC'97 and HDAudio dial-up soft-modems (for example Si3055) are currently not supported.<br />
* MIDI support is currently not finished. However, you can still use MIDI with a software synthesizer like timidity or fluidsynth.<br />
* Suspend is currently not supported. You need to unload OSS (by using {{Codeline|soundoff}}) before suspending, and to reload OSS (by using {{Codeline|soundon}}) after resuming.<br />
* Automatic jack sensing currently doesn't work properly with '''some''' HDAudio-powered motherboards. This means that, depending on your motherboard model, you may have to manually switch off your speakers when plugging your earphone.<br />
<br />
= Installing =<br />
<br />
The OSS install script unload all ALSA modules automatically. If it fails for some reason to remove the modules issue the command: modprobe -r soundcore. You should balcklist the ALSA modules (to prevent them loading at boot) by editing {{Filename|/etc/rc.conf}} as described below. <br />
<br />
MODULES=(!soundcore ..............<br />
<br />
Install OSS by running:<br />
<br />
# pacman -S oss<br />
<br />
Be sure the user is part of the audio group:<br />
<br />
# gpasswd -a USERNAME audio<br />
<br />
Start OSS by running:<br />
<br />
# /etc/rc.d/oss start<br />
<br />
Add <tt>oss</tt> to your <tt>DAEMONS</tt> variable at {{Filename|/etc/rc.conf}}, so OSS is loaded automatically at each boot.<br />
<br />
In the case OSS is not able to detect your card when starting it, run :<br />
<br />
# ossdetect -v<br />
<br />
Then {{Codeline|soundoff && soundon}} to reactivate it.<br />
<br />
= Testing =<br />
<br />
You can test OSS by running:<br />
<br />
$ osstest<br />
<br />
{{Note| Beware the default volume is very loud. Avoid using earphones or lower the volume by using <tt>ossxmix</tt>. }}<br />
<br />
You should be able to hear music during the test process. If there is no audio, try to adjust the mixer as explained in the following sections and/or read the Troubleshooting sections.<br />
<br />
= Volume control =<br />
<br />
To control the volume of various devices, mixers levels will need to be set. The command line mixer is called <tt>ossmix</tt>. It's very like the BSD audio mixer (<tt>mixerctl</tt>).<br />
<br />
A graphical mixer, is available too. It's called <tt>ossxmix</tt>. It needs the optional depend <tt>gtk2</tt> to work.<br />
<br />
The <tt>ossxmix</tt> controls are explained in the following example:<br />
<br />
______________________________<br />
/ High Definition Audio ALC262 \ ----------------------------------> One tab for each sound card<br />
/________________________________\_______________________________<br />
|<br />
| [x] vmix0-enable [vmix0-rate: 48.000kHz] vmix0-channels \ The vmix (virtual mixer) special configurations<br />
| [ Stereo [v] ] |--> appear at the top. These include sampling rate<br />
| / and mixer priority. They are provided by OSS.<br />
| __codec1______________________________________________________ <br />
| | _jack_______________________________________________________ \ <br />
| | | _int-speaker____________________ __green_________________ |<br />
| | | | | | | These are your sound card configurations.<br />
| | | | _mode______ | | | | _mode______ | | | Every mixer control that is shown here is<br />
| | | | [ mix [v] ] o o [x] [ ]mute | | [ mix [v] ] o o [x] |--> provided by your sound card. Every sound card<br />
| | | | | | | | | | | specific control is shown here.<br />
| | | |________________________________| |_______________________ |<br />
| | |____________________________________________________________ |<br />
| |______________________________________________________________ /<br />
|<br />
| ___vmix0_______________________________________________________ \<br />
| | __mocp___ O O _firefox_ O O __pcm7___ O O | Here are the vmix mixer controls. These are<br />
| | | | O O | | x x | | O O | virtual mixer controls provided by OSS. Each<br />
| | | | | | x O | | | | x x | | | | O O | slider is the volume control of a different<br />
| | | o o [x] | x x | o o [x] | x x | o o [x] | O O |--> application. When one application uses the<br />
| | | | | | x x | | | | x x | | | | O O | sound card, its name is shown in the place of<br />
| | |_________| x x |_________| x x |_________| O O | the 'pcm#' labels. There are also sound level<br />
| |______________________________________________________________ | meter levels for each application.<br />
|________________________________________________________________ /<br />
<br />
=== Jack Definitions ===<br />
For high definition audio, ossxmix will highlight the jacks to their corresponding plug color. For 5.1 surround sound the [http://en.wikipedia.org/wiki/Audio_and_video_connector jack colors] are: <br />
{| border="1"<br />
|-<br />
! Connector Type<br />
! Purpose<br />
! OSS<br />
|- style=color:black;background:lightgreen<br />
|green TRS 3.5mm<br />
| stereo output, front channels<br />
|front<br />
|- style=color:white;background:black <br />
|black TRS 3.5mm<br />
| stereo output, rear channels<br />
|rear<br />
|- style=color:white;background:gray<br />
|grey TRS 3.5mm<br />
| stereo output, side channels<br />
|side<br />
|- style=color:black;background:gold<br />
|gold TRS 3.5mm<br />
| dual output, center and subwoofer<br />
|center/LFE<br />
|- style=color:black;background:lightblue<br />
|blue TRS 3.5mm<br />
| stereo input, line level<br />
|input<br />
|- style=color:black;background:pink <br />
|pink TS 3.5mm<br />
| mono microphone input<br />
|input<br />
|}<br />
For the most part and for most people just make sure that:<br />
# All green jacks (green and fp-green) are "front" and 75% from max volume.<br />
# All pink jacks (pink and fp-pink) are input and 50% of max to avoid distortion.<br />
<br />
== Other Mixers ==<br />
<br />
Other desktop environments may have support for OSS:<br />
<br />
* Gnome - Gnome Volume Control has support for OSS. Some users report that using Gnome Volume Control is easier to setup than <tt>ossxmix</tt>.<br />
* KDE - Kmix now has preliminary support for OSS.<br />
<br />
== Saving and restoring mixer settings ==<br />
<br />
If you wish to save your mixer settings manually, run {{Codeline|savemixer}}. As regular user you will need permissions to use {{Codeline|/usr/sbin/savemixer}} in the sudoers file or you can modify write permissions to {{Filename|/usr/lib/oss/etc/mixer.save}}. Alternately, the <tt>-f</tt> switch can be used to save the mixer to a file and {{Codeline|savemixer -L}} to restore it.<br />
<br />
Please note that the init scripts run these commands before shutdown/after starting to keep mixer settings across boot, so most users don't need to worry about it.<br />
<br />
= Configuring Applications for OSS =<br />
<br />
== Skype ==<br />
<br />
The <tt>skype</tt> package only includes support for ALSA. To get an OSS-capable Skype, install the <tt>skype-oss</tt> package:<br />
<br />
# pacman -S skype-oss<br />
<br />
If you are using x86_64, you can get the [http://aur.archlinux.org/packages.php?ID=18312 bin32-skype-oss] package from AUR.<br />
<br />
== Wine ==<br />
<br />
* Run <tt>winecfg</tt>.<br />
<br />
$ winecfg<br />
<br />
* Go to the <tt>Audio</tt> tab.<br />
<br />
* Select <tt>OSS Driver</tt>.<br />
<br />
== Gajim ==<br />
By default Gajim uses {{Codeline|aplay -q}} to play a sound. To change this go in Advanced Settings and search for the {{Codeline|soundplayer}} variable. The ossplay program included in the oss package is a good replacement:<br />
<br />
{{Codeline|ossplay -qq}}<br />
<br />
== MOC ==<br />
<br />
To use MOC with OSS v4.1 you must change section OSSMixerDevice to OSSMixerDevice= /dev/ossmix in your config (located in /home/yourusername/.moc).<br />
And now MOC should work with OSS v4.1.<br />
Or you can compile moc-svn package from AUR (he got support for new vmix).<br />
For issue with interface change OSSMixerChannel = to OSSMixerChannel = Any channel and after start mocp press w (change to sofware mixex) that will help and you can change the volume power.<br />
<br />
== Applications that use Gstreamer ==<br />
<br />
Remove pulseaudio and gstreamer*-pulse programs and libraries.<br />
<br />
To change the gstreamer setting to output the sound to OSS instead of the default ALSA, run:<br />
<br />
gstreamer-properties<br />
<br />
Change the '''Default Output''' plugin to custom and the change the pipeline to:<br />
<br />
oss4sink<br />
<br />
For the input:<br />
<br />
oss4src<br />
<br />
{{Note|It's not certain that the input will sound better with oss4src compared to osssrc, so change this only if it improves your input sound. < confirmation on this please >}}<br />
<br />
If you are using phonon with the gstreamer backend you will need to set the environmental variable. To add to your current user:<br />
<br />
export PHONON_GST_AUDIOSINK=oss4sink<br />
<br />
Add this to your {{Filename|~/.bashrc}} to be loaded on login.<br />
<br />
== Firefox >=3.5 ==<br />
<br />
Firefox 3.5 introduces the <video> and <audio> tag support and can play ogg media out of the box. However, it currently can't be compiled with ALSA and OSS support at the same time. So you need to install the [http://aur.archlinux.org/packages.php?ID=28110 xulrunner-oss] package.<br />
<br />
1. Stop firefox.<br />
2. Remove the xulrunner package without dependency check: sudo pacman -Rd xulrunner<br />
3. Install xulrunner-oss package from AUR using yaourt or [http://wiki.archlinux.org/index.php/ABS ABS].<br />
4. Start firefox.<br />
<br />
== Mplayer ==<br />
<br />
If you are using gui (smplayer etc.) you will find the oss output at the audio settings. Using on cli you should specify the sound output: mplayer -ao oss /some/file/to/play.mkv If you don't want to brother typing it over and over again add "ao=oss" to your config file. (/home/$USER/.mplayer/config)<br />
<br />
== Other applications ==<br />
<br />
* If you can't get sound from an application not listed here, try looking at the [http://www.4front-tech.com/wiki/index.php/Configuring_Applications_for_OSSv4 Configuring Applications for OSSv4] page.<br />
* Search OSS specific packages by using {{Codeline|pacman -Ss -- '-oss'}} and [http://aur.archlinux.org/packages.php?K=-oss&start=0&PP=100| in AUR].<br />
<br />
= Troubleshooting =<br />
<br />
== Troubleshooting HDAudio devices ==<br />
<br />
=== Understanding why problems arise ===<br />
<br />
If you have a HDAudio sound device, it's very likely that you will have to adjust some mixer settings before your sound works.<br />
<br />
HDAudio devices are very powerful in the sense that they can contain a lot of small circuits (called ''widgets'') that can be adjusted by software at any time. These controls are exposed to the mixer, and they can be used, for example, to turn the earphone jack into a sound input jack instead of a sound output jack.<br />
<br />
However, there is a side effect, mainly because the HDAudio standard is more flexible than it perhaps should be, and because the vendors often only care to get their ''official drivers'' working.<br />
<br />
Then, when using HDAudio devices, you often find disorganized mixer controls, that doesn't work at all by default, and you are forced to try every mixer control combination, until it works.<br />
<br />
=== How to solve ===<br />
<br />
Open <tt>ossxmix</tt> and try to change every mixer control in the ''middle area'', that contains the sound card specific controls, as explained in the previous "[[OSS#The_mixer|The mixer]]" section.<br />
<br />
You'll probably want to setup a program to record/play continously in the background (e.g. {{Codeline|ossrecord - | ossplay -}} for recording or {{Codeline|osstest -lV}} for playing), while changing mixer settings in ossxmix in the foreground.<br />
<br />
* Raise every volume control slider.<br />
* In each option box, try to change the selected option, trying all the possible combinations.<br />
* If you get noise, try to lower and/or mute some volume controls, until you find the source of the noise.<br />
<br />
Please note again that you do '''not''' need to change any controls in the ''top area'' nor in the ''bottom area'', as they are virtual <tt>vmix</tt>-related mixer controls.<br />
<br />
* Editing {{Codeline|/usr/lib/oss/conf/oss_hdaudio.conf}} uncommenting and changing ''hdaudio_noskip=0'' to a value from 0-7 can give you more jack options in ossxmix<br />
I had to edit mine to ''hdaudio_noskip=7'' for my sub/rear speaker to work on my laptop, restart oss for the changes to take effect {{Codeline|/etc/rc.d/oss restart}}<br />
<br />
== MMS sound cracking in totem ==<br />
If your stream sounds with cracks or strange noise in totem like it did with me then you could try to play it with another backend like ffmpeg (mplayer). That "fixed" the issue for me. This will not fix the issue that somehow pops up in gstreamer when playing MMS streams but it will give you the option to play it with good sound quality. Playing it in mplayer is simple:<br />
# mplayer mmsh://yourstreamurl<br />
<br />
== Microphone playing through output channels ==<br />
<br />
OSS by default plays back the microphone through the speakers. To disable this in ossxmix find the misc section. Check off every "input-mix-mute" to disable this.<br />
<br />
== Troubleshooting other issues ==<br />
<br />
* If you get distorted sound, try lowering some volume control sliders.<br />
<br />
* If you need to change the default sound card, look at [http://www.opensound.com/wiki/index.php/Tips_And_Tricks#Changing_the_default_sound_output here].<br />
<br />
* If you have another issues, try searching or asking for help at the [http://www.4front-tech.com/forum 4front forums].<br />
<br />
= Tips and Tricks =<br />
<br />
== Using multimedia keys with OSS ==<br />
An easy way to mute/unmute and increase/decrease the volume is to use the [http://www.opensound.com/wiki/index.php/Tips_And_Tricks#ossvol {{Codeline|ossvol}} script] available in [[AUR]].<br />
<br />
Once you installed it try to toggle the sound:<br />
$ ossvol -t<br />
<br />
Type {{Codeline|ossvol -h}} for the other commands.<br />
<br />
If you don't know how to assign commands to your multimedia keys, see [[Extra Keyboard Keys]].<br />
<br />
==={{Codeline|ossvol}} troubleshooting===<br />
If you get an error like:<br />
Bad mixer control name(987) 'vol'<br />
you need to edit the script ({{Filename|/usr/bin/ossvol}}) and change the value of the {{Codeline|CHANNEL}} variable which is at the beginning of the script. For example mine is {{Codeline|CHANNEL<nowiki>=</nowiki>"vmix0-outvol"}}.<br />
<br />
*'''Note''' if you are using xbindkeys for your multimedia keys adding this<br />
"ossmix vmix0-outvol -- +1"<br />
raise volume<br />
"ossmix vmix0-outvol -- -1"<br />
lower volume<br />
<br />
to the raise/lower volume section of your .xbindkeysrc file is an easy way to adjust the volume<br />
<br />
== Changing the Sample Rate ==<br />
<br />
Changing the output sample rate is not obvious at first. Sample rates can only be changed by the superuser and vmix must be unused by any programs when a change is requested. Before you follow any of these steps, ensure you are going through a receiver/amplifier and using quality speakers and not simply computer speakers. If you are only using computer speakers, don't bother changing anything here as you won't notice a difference.<br />
<br />
By default the sample rate is 48000hz. There are several conditions in which you may want to change this. This all depends on your usage patterns. You want the sample rate you are using to match the media you use the most. If your computer has to change the sampling rate of the media to suit the hardware it is likely, though not guaranteed that you will have a loss in audio quality. This is most noticable in downsampling (ie. 96000hz &rarr; 48000hz). There is an article about this issue in [http://www.stereophile.com/news/121707lucky/ "Stereophile"] which was [http://lists.apple.com/archives/coreaudio-api/2008/Jan/msg00272.html discussed] on Apple's "CoreAudio API" mailing list if you wish to learn more about this issue. <br />
<br />
Some example sample rates:<br />
<br />
* 44100hz - Sample rate of standard [http://en.wikipedia.org/wiki/Red_Book_%28audio_CD_standard%29 Red Book] audio cds.<br />
* 88000hz - Sample rate of [http://en.wikipedia.org/wiki/Super_Audio_CD SACD] high definition audio discs/downloads. It is rare that your motherboard will support this sample rate.<br />
* 96000hz - Sample rate of most high definition audio downloads. If your motherboard is an [http://en.wikipedia.org/wiki/AC%2797 AC'97] motherboard, this is likely to be your highest bitrate.<br />
* 192000hz - Sample rate of BluRay, and some (very few) high definition downloads. Support for external audio reciever equipment is limited to high end audio. Not all motherboards support this. An example of a motherboard chipset that would support this includes [http://en.wikipedia.org/wiki/Intel_High_Definition_Audio Intel HDA audio]. <br />
<br />
To check what your sample rate is currently set to:<br />
<br />
# Run <code>"ossmix | grep rate"</code>. <br />
<br />
You are likely to see <code>"vmix0-rate <decimal value> (currently 48000) (Read-only)"</code>.<br />
<br />
If you do not see a "vmix0-rate" (or "vmix1-rate", etc.) being outputted, than it probably means that vmix is disabled. In that case, OSS will use the rate requested by the program which uses the device, so this section doesn't apply. Exception: envy24(ht) cards have a setting envy24.rate which has a similiar function (see "oss_envy24" manpage). You can follow these steps, but at step 2, change with ossmix the value of "envy24.rate" as well.<br />
<br />
Steps to affect the change:<br />
<br />
# First, make sure your card is able to use the new rate. Run "ossinfo -v2" and see if the wanted rate is in the "Native sample rates" output.<br />
# As root, run <code>"/usr/lib/oss/scripts/killprocs.sh"</code>. Be aware, this will close any program that currently has an open sound channel (examples being media players, Firefox as of 3.5 if you have xulrunner-oss installed, and the gnome volume control).<br />
# After all programs occupying vmix are terminated, run as root: <code>"vmixctl rate /dev/dsp 96000"</code> replacing the rate with your desired sample rate.<br />
# Run <code>"ossmix | grep rate"</code> and check for <code>"vmix0-rate <decimal value> (currently 96000) (Read-only)"</code> to see if you were successful.<br />
<br />
== Start ossxmix docked to systray on startup ==<br />
<br />
'''KDE 4'''<br />
<br />
Create an application launcher file named <code>ossxmix.desktop</code> in you local application launchers directory (<code>~/.local/share/applications/</code> then enter:<br />
<br />
<pre>[Desktop Entry]<br />
Name=Open Sound System Mixer<br />
GenericName=Audio Mixer<br />
Exec=ossxmix -b<br />
Icon=audio-card<br />
Categories=Application;GTK;AudioVideo;Player;<br />
Terminal=false<br />
Type=Application<br />
Encoding=UTF-8</pre><br />
<br />
To add it to autostart when loading the desktop environment:<br />
<br />
System Settings > Advanced tab > Autostart. Then click add program and choose it from the 'Multimedia' list.<br />
<br />
'''Gnome''' <br />
<br />
*As Root create a file /usr/local/bin/ossxmix_bg with the following content:<br />
<br />
<pre><br />
#!/bin/bash<br />
exec /usr/bin/ossxmix -b<br />
</pre><br />
<br />
Goto System > Preferences > Start Up Applications<br />
<br />
*Click Add, Type OSSMIX in Name field and <code>/usr/local/bin/ossxmix_bg</code> in Command field then click Add button.<br />
<br />
*Login and Logout to see the changes.<br />
<br />
== Record sound output from a program ==<br />
<br />
* [http://www.opensound.com/wiki/index.php/Tips_And_Tricks#Recording_sound_output_of_a_program Recording sound output of a program].<br />
<br />
== Suspend and Hibernation ==<br />
<br />
OSS does not automatically support suspend meaning that OSS must be manually stopped prior to suspending or hibernating.<br />
<br />
OSS provides <tt>soundon</tt> and <tt>soundoff</tt> to enable and disable OSS, although any processes that use sound must be terminated first.<br />
<br />
The following script is a rather basic method of automatically unloading OSS prior to suspending and reloading afterwards.<br />
<br />
#!/bin/sh<br />
. "${PM_FUNCTIONS}"<br />
<br />
suspend_osssound()<br />
{<br />
/usr/lib/oss/scripts/killprocs.sh<br />
/usr/sbin/soundoff<br />
}<br />
<br />
resume_osssound()<br />
{<br />
/usr/sbin/soundon<br />
}<br />
<br />
case "$1" in<br />
hibernate|suspend)<br />
suspend_osssound<br />
;;<br />
thaw|resume)<br />
resume_osssound<br />
;;<br />
*) exit $NA<br />
;;<br />
esac<br />
<br />
Save the contents of the script (as root) into {{Filename|/etc/pm/sleep.d/50ossound}} and make it executable. {{Filename| chmod a+x /etc/pm/sleep.d/50ossound}}<br />
<br />
{{Note|This script is rather basic and will terminate any application directly accessing OSS, save your work prior to suspending/hibernating.}}<br />
<br />
== ALSA emulation ==<br />
<br />
=== Introduction ===<br />
<br />
You can instruct <tt>alsa-lib</tt> to use OSS as its audio output system. This works as a sort of ALSA emulation.<br />
<br />
Note, however, that this method may introduce additional latency in your sound output, and that the emulation is not complete and doesn't work with all applications. It doesn't work, for example, with programs that try to detect devices using ALSA.<br />
<br />
So, as most applications support OSS directly, use this method only as a last resort.<br />
<br />
In the future, more complete methods may be available for emulating ALSA, such as <tt>libsalsa</tt> and <tt>cuckoo</tt>.<br />
<br />
=== HOW-TO ===<br />
<br />
* Install the <tt>alsa-plugins</tt> package.<br />
<br />
# pacman -S alsa-plugins<br />
<br />
* Edit {{Filename|/etc/asound.conf}} as follows.<br />
<br />
pcm.oss {<br />
type oss<br />
device /dev/dsp<br />
}<br />
<br />
pcm.!default {<br />
type oss<br />
device /dev/dsp<br />
}<br />
<br />
ctl.oss {<br />
type oss<br />
device /dev/mixer<br />
}<br />
<br />
ctl.!default {<br />
type oss<br />
device /dev/mixer<br />
}<br />
<br />
{{Note | If you don't want to use OSS anymore, don't forget to revert changes that you do here in {{Filename|/etc/asound.conf}}.}}<br />
<br />
= Experimental packages =<br />
<br />
== Mercurial repository version ==<br />
<br />
There is a [http://aur.archlinux.org/packages.php?ID=21126 oss-mercurial package] in AUR. This package compiles and installs the latest OSS development version direcly from the Mercurial repository.<br />
<br />
You can try this package if you want to contribute code to OSS or if only a very recent change in OSS code introduced support to your sound device.<br />
<br />
If you want oss to take care of your flash sound you will need to install libflashsupport:<br />
<br />
# pacman -S libflashsupport</div>Blohttps://wiki.archlinux.org/index.php?title=Open_Sound_System&diff=80481Open Sound System2009-10-26T11:22:07Z<p>Blo: /* Installing */</p>
<hr />
<div>[[Category:Audio/Video (English)]]<br />
[[Category:HOWTOs (English)]]<br />
{{i18n_links_start}}<br />
{{i18n_entry|English|OSS}}<br />
{{i18n_entry|简体中文|OSS (简体中文)}}<br />
{{i18n_entry|Français|OSS (Français)}}<br />
{{i18n_entry|Türkçe|OSS (Türkçe)}}<br />
{{i18n_links_end}}<br />
<br />
= Introduction =<br />
The [http://developer.opensound.com Open Sound System] is a [http://4front-tech.com commercially-supported] sound architecture that works on several UNIX-like and POSIX-compatible systems, including Linux, FreeBSD, Solaris and BeOS/Haiku.<br />
<br />
Please note that this article is not about the old OSS, which is included in the Linux kernel sources and is more than 10 years old by now.<br />
<br />
This article is about the new OSS versions (often called OSSv4). These versions were previously proprietary - OSS became open source again in July 2007, and is currently available under GPL, BSD or CDDL licenses.<br />
<br />
= Advantages and disadvantages vs. ALSA =<br />
<br />
== Advantages over ALSA (for users) ==<br />
* Includes a transparent software mixer (vmix) in kernel space. This means multiple applications can access the sound device at the same time without problems.<br />
* The vmix mixer controls allow you to adjust the volume of each application individually.<br />
* Better support for some sound card models, for example for the Creative X-Fi.<br />
* Sound quality is usually better. '''reference needed to validate this statement'''<br />
* Better support for applications written for the OSS API, of course. The OSS API is widely spread and a lot of applications support it. The ALSA's OSS API emulation, however, is often buggy.<br />
<br />
== Advantages over ALSA (for developers) ==<br />
* Cleaner and easier to use API.<br />
* API is much better [http://manuals.opensound.com/developer documented].<br />
* Support for sound drivers in the userspace (oss_userdev).<br />
* Portability across all supported platforms. If the application works using OSS under Linux, it will work under FreeBSD and Solaris too, for example.<br />
* Portability across operating systems. It's [http://revolf.free.fr/Alchimie-7/Alchimie7_OSS_Haiku.en.pdf easier] to port OSS to a new operating system.<br />
<br />
== Disadvantages vs. ALSA ==<br />
* USB audio devices support is currently experimental and USB recording is not implemented.<br />
* Bluetooth audio devices are currently not supported.<br />
* AC'97 and HDAudio dial-up soft-modems (for example Si3055) are currently not supported.<br />
* MIDI support is currently not finished. However, you can still use MIDI with a software synthesizer like timidity or fluidsynth.<br />
* Suspend is currently not supported. You need to unload OSS (by using {{Codeline|soundoff}}) before suspending, and to reload OSS (by using {{Codeline|soundon}}) after resuming.<br />
* Automatic jack sensing currently doesn't work properly with '''some''' HDAudio-powered motherboards. This means that, depending on your motherboard model, you may have to manually switch off your speakers when plugging your earphone.<br />
<br />
= Installing =<br />
<br />
The OSS install script unload all ALSA modules. If it fails for some reason to remove the ALSA modules issue the command: modprobe -r soundcore. You should balcklist the ALSA modules (to prevent them loading at boot) as described below and you are good to go. <br />
Disable ALSA at boot by blocking the <tt>soundcore</tt> module in {{Filename|/etc/rc.conf}}:<br />
<br />
MODULES=(!soundcore ..............<br />
<br />
Install OSS by running:<br />
<br />
# pacman -S oss<br />
<br />
Be sure the user is part of the audio group:<br />
<br />
# gpasswd -a USERNAME audio<br />
<br />
Start OSS by running:<br />
<br />
# /etc/rc.d/oss start<br />
<br />
Add <tt>oss</tt> to your <tt>DAEMONS</tt> variable at {{Filename|/etc/rc.conf}}, so OSS is loaded automatically at each boot.<br />
<br />
In the case OSS is not able to detect your card when starting it, run :<br />
<br />
# ossdetect -v<br />
<br />
Then {{Codeline|soundoff && soundon}} to reactivate it.<br />
<br />
= Testing =<br />
<br />
You can test OSS by running:<br />
<br />
$ osstest<br />
<br />
{{Note| Beware the default volume is very loud. Avoid using earphones or lower the volume by using <tt>ossxmix</tt>. }}<br />
<br />
You should be able to hear music during the test process. If there is no audio, try to adjust the mixer as explained in the following sections and/or read the Troubleshooting sections.<br />
<br />
= Volume control =<br />
<br />
To control the volume of various devices, mixers levels will need to be set. The command line mixer is called <tt>ossmix</tt>. It's very like the BSD audio mixer (<tt>mixerctl</tt>).<br />
<br />
A graphical mixer, is available too. It's called <tt>ossxmix</tt>. It needs the optional depend <tt>gtk2</tt> to work.<br />
<br />
The <tt>ossxmix</tt> controls are explained in the following example:<br />
<br />
______________________________<br />
/ High Definition Audio ALC262 \ ----------------------------------> One tab for each sound card<br />
/________________________________\_______________________________<br />
|<br />
| [x] vmix0-enable [vmix0-rate: 48.000kHz] vmix0-channels \ The vmix (virtual mixer) special configurations<br />
| [ Stereo [v] ] |--> appear at the top. These include sampling rate<br />
| / and mixer priority. They are provided by OSS.<br />
| __codec1______________________________________________________ <br />
| | _jack_______________________________________________________ \ <br />
| | | _int-speaker____________________ __green_________________ |<br />
| | | | | | | These are your sound card configurations.<br />
| | | | _mode______ | | | | _mode______ | | | Every mixer control that is shown here is<br />
| | | | [ mix [v] ] o o [x] [ ]mute | | [ mix [v] ] o o [x] |--> provided by your sound card. Every sound card<br />
| | | | | | | | | | | specific control is shown here.<br />
| | | |________________________________| |_______________________ |<br />
| | |____________________________________________________________ |<br />
| |______________________________________________________________ /<br />
|<br />
| ___vmix0_______________________________________________________ \<br />
| | __mocp___ O O _firefox_ O O __pcm7___ O O | Here are the vmix mixer controls. These are<br />
| | | | O O | | x x | | O O | virtual mixer controls provided by OSS. Each<br />
| | | | | | x O | | | | x x | | | | O O | slider is the volume control of a different<br />
| | | o o [x] | x x | o o [x] | x x | o o [x] | O O |--> application. When one application uses the<br />
| | | | | | x x | | | | x x | | | | O O | sound card, its name is shown in the place of<br />
| | |_________| x x |_________| x x |_________| O O | the 'pcm#' labels. There are also sound level<br />
| |______________________________________________________________ | meter levels for each application.<br />
|________________________________________________________________ /<br />
<br />
=== Jack Definitions ===<br />
For high definition audio, ossxmix will highlight the jacks to their corresponding plug color. For 5.1 surround sound the [http://en.wikipedia.org/wiki/Audio_and_video_connector jack colors] are: <br />
{| border="1"<br />
|-<br />
! Connector Type<br />
! Purpose<br />
! OSS<br />
|- style=color:black;background:lightgreen<br />
|green TRS 3.5mm<br />
| stereo output, front channels<br />
|front<br />
|- style=color:white;background:black <br />
|black TRS 3.5mm<br />
| stereo output, rear channels<br />
|rear<br />
|- style=color:white;background:gray<br />
|grey TRS 3.5mm<br />
| stereo output, side channels<br />
|side<br />
|- style=color:black;background:gold<br />
|gold TRS 3.5mm<br />
| dual output, center and subwoofer<br />
|center/LFE<br />
|- style=color:black;background:lightblue<br />
|blue TRS 3.5mm<br />
| stereo input, line level<br />
|input<br />
|- style=color:black;background:pink <br />
|pink TS 3.5mm<br />
| mono microphone input<br />
|input<br />
|}<br />
For the most part and for most people just make sure that:<br />
# All green jacks (green and fp-green) are "front" and 75% from max volume.<br />
# All pink jacks (pink and fp-pink) are input and 50% of max to avoid distortion.<br />
<br />
== Other Mixers ==<br />
<br />
Other desktop environments may have support for OSS:<br />
<br />
* Gnome - Gnome Volume Control has support for OSS. Some users report that using Gnome Volume Control is easier to setup than <tt>ossxmix</tt>.<br />
* KDE - Kmix now has preliminary support for OSS.<br />
<br />
== Saving and restoring mixer settings ==<br />
<br />
If you wish to save your mixer settings manually, run {{Codeline|savemixer}}. As regular user you will need permissions to use {{Codeline|/usr/sbin/savemixer}} in the sudoers file or you can modify write permissions to {{Filename|/usr/lib/oss/etc/mixer.save}}. Alternately, the <tt>-f</tt> switch can be used to save the mixer to a file and {{Codeline|savemixer -L}} to restore it.<br />
<br />
Please note that the init scripts run these commands before shutdown/after starting to keep mixer settings across boot, so most users don't need to worry about it.<br />
<br />
= Configuring Applications for OSS =<br />
<br />
== Skype ==<br />
<br />
The <tt>skype</tt> package only includes support for ALSA. To get an OSS-capable Skype, install the <tt>skype-oss</tt> package:<br />
<br />
# pacman -S skype-oss<br />
<br />
If you are using x86_64, you can get the [http://aur.archlinux.org/packages.php?ID=18312 bin32-skype-oss] package from AUR.<br />
<br />
== Wine ==<br />
<br />
* Run <tt>winecfg</tt>.<br />
<br />
$ winecfg<br />
<br />
* Go to the <tt>Audio</tt> tab.<br />
<br />
* Select <tt>OSS Driver</tt>.<br />
<br />
== Gajim ==<br />
By default Gajim uses {{Codeline|aplay -q}} to play a sound. To change this go in Advanced Settings and search for the {{Codeline|soundplayer}} variable. The ossplay program included in the oss package is a good replacement:<br />
<br />
{{Codeline|ossplay -qq}}<br />
<br />
== MOC ==<br />
<br />
To use MOC with OSS v4.1 you must change section OSSMixerDevice to OSSMixerDevice= /dev/ossmix in your config (located in /home/yourusername/.moc).<br />
And now MOC should work with OSS v4.1.<br />
Or you can compile moc-svn package from AUR (he got support for new vmix).<br />
For issue with interface change OSSMixerChannel = to OSSMixerChannel = Any channel and after start mocp press w (change to sofware mixex) that will help and you can change the volume power.<br />
<br />
== Applications that use Gstreamer ==<br />
<br />
Remove pulseaudio and gstreamer*-pulse programs and libraries.<br />
<br />
To change the gstreamer setting to output the sound to OSS instead of the default ALSA, run:<br />
<br />
gstreamer-properties<br />
<br />
Change the '''Default Output''' plugin to custom and the change the pipeline to:<br />
<br />
oss4sink<br />
<br />
For the input:<br />
<br />
oss4src<br />
<br />
{{Note|It's not certain that the input will sound better with oss4src compared to osssrc, so change this only if it improves your input sound. < confirmation on this please >}}<br />
<br />
If you are using phonon with the gstreamer backend you will need to set the environmental variable. To add to your current user:<br />
<br />
export PHONON_GST_AUDIOSINK=oss4sink<br />
<br />
Add this to your {{Filename|~/.bashrc}} to be loaded on login.<br />
<br />
== Firefox >=3.5 ==<br />
<br />
Firefox 3.5 introduces the <video> and <audio> tag support and can play ogg media out of the box. However, it currently can't be compiled with ALSA and OSS support at the same time. So you need to install the [http://aur.archlinux.org/packages.php?ID=28110 xulrunner-oss] package.<br />
<br />
1. Stop firefox.<br />
2. Remove the xulrunner package without dependency check: sudo pacman -Rd xulrunner<br />
3. Install xulrunner-oss package from AUR using yaourt or [http://wiki.archlinux.org/index.php/ABS ABS].<br />
4. Start firefox.<br />
<br />
== Mplayer ==<br />
<br />
If you are using gui (smplayer etc.) you will find the oss output at the audio settings. Using on cli you should specify the sound output: mplayer -ao oss /some/file/to/play.mkv If you don't want to brother typing it over and over again add "ao=oss" to your config file. (/home/$USER/.mplayer/config)<br />
<br />
== Other applications ==<br />
<br />
* If you can't get sound from an application not listed here, try looking at the [http://www.4front-tech.com/wiki/index.php/Configuring_Applications_for_OSSv4 Configuring Applications for OSSv4] page.<br />
* Search OSS specific packages by using {{Codeline|pacman -Ss -- '-oss'}} and [http://aur.archlinux.org/packages.php?K=-oss&start=0&PP=100| in AUR].<br />
<br />
= Troubleshooting =<br />
<br />
== Troubleshooting HDAudio devices ==<br />
<br />
=== Understanding why problems arise ===<br />
<br />
If you have a HDAudio sound device, it's very likely that you will have to adjust some mixer settings before your sound works.<br />
<br />
HDAudio devices are very powerful in the sense that they can contain a lot of small circuits (called ''widgets'') that can be adjusted by software at any time. These controls are exposed to the mixer, and they can be used, for example, to turn the earphone jack into a sound input jack instead of a sound output jack.<br />
<br />
However, there is a side effect, mainly because the HDAudio standard is more flexible than it perhaps should be, and because the vendors often only care to get their ''official drivers'' working.<br />
<br />
Then, when using HDAudio devices, you often find disorganized mixer controls, that doesn't work at all by default, and you are forced to try every mixer control combination, until it works.<br />
<br />
=== How to solve ===<br />
<br />
Open <tt>ossxmix</tt> and try to change every mixer control in the ''middle area'', that contains the sound card specific controls, as explained in the previous "[[OSS#The_mixer|The mixer]]" section.<br />
<br />
You'll probably want to setup a program to record/play continously in the background (e.g. {{Codeline|ossrecord - | ossplay -}} for recording or {{Codeline|osstest -lV}} for playing), while changing mixer settings in ossxmix in the foreground.<br />
<br />
* Raise every volume control slider.<br />
* In each option box, try to change the selected option, trying all the possible combinations.<br />
* If you get noise, try to lower and/or mute some volume controls, until you find the source of the noise.<br />
<br />
Please note again that you do '''not''' need to change any controls in the ''top area'' nor in the ''bottom area'', as they are virtual <tt>vmix</tt>-related mixer controls.<br />
<br />
* Editing {{Codeline|/usr/lib/oss/conf/oss_hdaudio.conf}} uncommenting and changing ''hdaudio_noskip=0'' to a value from 0-7 can give you more jack options in ossxmix<br />
I had to edit mine to ''hdaudio_noskip=7'' for my sub/rear speaker to work on my laptop, restart oss for the changes to take effect {{Codeline|/etc/rc.d/oss restart}}<br />
<br />
== MMS sound cracking in totem ==<br />
If your stream sounds with cracks or strange noise in totem like it did with me then you could try to play it with another backend like ffmpeg (mplayer). That "fixed" the issue for me. This will not fix the issue that somehow pops up in gstreamer when playing MMS streams but it will give you the option to play it with good sound quality. Playing it in mplayer is simple:<br />
# mplayer mmsh://yourstreamurl<br />
<br />
== Microphone playing through output channels ==<br />
<br />
OSS by default plays back the microphone through the speakers. To disable this in ossxmix find the misc section. Check off every "input-mix-mute" to disable this.<br />
<br />
== Troubleshooting other issues ==<br />
<br />
* If you get distorted sound, try lowering some volume control sliders.<br />
<br />
* If you need to change the default sound card, look at [http://www.opensound.com/wiki/index.php/Tips_And_Tricks#Changing_the_default_sound_output here].<br />
<br />
* If you have another issues, try searching or asking for help at the [http://www.4front-tech.com/forum 4front forums].<br />
<br />
= Tips and Tricks =<br />
<br />
== Using multimedia keys with OSS ==<br />
An easy way to mute/unmute and increase/decrease the volume is to use the [http://www.opensound.com/wiki/index.php/Tips_And_Tricks#ossvol {{Codeline|ossvol}} script] available in [[AUR]].<br />
<br />
Once you installed it try to toggle the sound:<br />
$ ossvol -t<br />
<br />
Type {{Codeline|ossvol -h}} for the other commands.<br />
<br />
If you don't know how to assign commands to your multimedia keys, see [[Extra Keyboard Keys]].<br />
<br />
==={{Codeline|ossvol}} troubleshooting===<br />
If you get an error like:<br />
Bad mixer control name(987) 'vol'<br />
you need to edit the script ({{Filename|/usr/bin/ossvol}}) and change the value of the {{Codeline|CHANNEL}} variable which is at the beginning of the script. For example mine is {{Codeline|CHANNEL<nowiki>=</nowiki>"vmix0-outvol"}}.<br />
<br />
*'''Note''' if you are using xbindkeys for your multimedia keys adding this<br />
"ossmix vmix0-outvol -- +1"<br />
raise volume<br />
"ossmix vmix0-outvol -- -1"<br />
lower volume<br />
<br />
to the raise/lower volume section of your .xbindkeysrc file is an easy way to adjust the volume<br />
<br />
== Changing the Sample Rate ==<br />
<br />
Changing the output sample rate is not obvious at first. Sample rates can only be changed by the superuser and vmix must be unused by any programs when a change is requested. Before you follow any of these steps, ensure you are going through a receiver/amplifier and using quality speakers and not simply computer speakers. If you are only using computer speakers, don't bother changing anything here as you won't notice a difference.<br />
<br />
By default the sample rate is 48000hz. There are several conditions in which you may want to change this. This all depends on your usage patterns. You want the sample rate you are using to match the media you use the most. If your computer has to change the sampling rate of the media to suit the hardware it is likely, though not guaranteed that you will have a loss in audio quality. This is most noticable in downsampling (ie. 96000hz &rarr; 48000hz). There is an article about this issue in [http://www.stereophile.com/news/121707lucky/ "Stereophile"] which was [http://lists.apple.com/archives/coreaudio-api/2008/Jan/msg00272.html discussed] on Apple's "CoreAudio API" mailing list if you wish to learn more about this issue. <br />
<br />
Some example sample rates:<br />
<br />
* 44100hz - Sample rate of standard [http://en.wikipedia.org/wiki/Red_Book_%28audio_CD_standard%29 Red Book] audio cds.<br />
* 88000hz - Sample rate of [http://en.wikipedia.org/wiki/Super_Audio_CD SACD] high definition audio discs/downloads. It is rare that your motherboard will support this sample rate.<br />
* 96000hz - Sample rate of most high definition audio downloads. If your motherboard is an [http://en.wikipedia.org/wiki/AC%2797 AC'97] motherboard, this is likely to be your highest bitrate.<br />
* 192000hz - Sample rate of BluRay, and some (very few) high definition downloads. Support for external audio reciever equipment is limited to high end audio. Not all motherboards support this. An example of a motherboard chipset that would support this includes [http://en.wikipedia.org/wiki/Intel_High_Definition_Audio Intel HDA audio]. <br />
<br />
To check what your sample rate is currently set to:<br />
<br />
# Run <code>"ossmix | grep rate"</code>. <br />
<br />
You are likely to see <code>"vmix0-rate <decimal value> (currently 48000) (Read-only)"</code>.<br />
<br />
If you do not see a "vmix0-rate" (or "vmix1-rate", etc.) being outputted, than it probably means that vmix is disabled. In that case, OSS will use the rate requested by the program which uses the device, so this section doesn't apply. Exception: envy24(ht) cards have a setting envy24.rate which has a similiar function (see "oss_envy24" manpage). You can follow these steps, but at step 2, change with ossmix the value of "envy24.rate" as well.<br />
<br />
Steps to affect the change:<br />
<br />
# First, make sure your card is able to use the new rate. Run "ossinfo -v2" and see if the wanted rate is in the "Native sample rates" output.<br />
# As root, run <code>"/usr/lib/oss/scripts/killprocs.sh"</code>. Be aware, this will close any program that currently has an open sound channel (examples being media players, Firefox as of 3.5 if you have xulrunner-oss installed, and the gnome volume control).<br />
# After all programs occupying vmix are terminated, run as root: <code>"vmixctl rate /dev/dsp 96000"</code> replacing the rate with your desired sample rate.<br />
# Run <code>"ossmix | grep rate"</code> and check for <code>"vmix0-rate <decimal value> (currently 96000) (Read-only)"</code> to see if you were successful.<br />
<br />
== Start ossxmix docked to systray on startup ==<br />
<br />
'''KDE 4'''<br />
<br />
Create an application launcher file named <code>ossxmix.desktop</code> in you local application launchers directory (<code>~/.local/share/applications/</code> then enter:<br />
<br />
<pre>[Desktop Entry]<br />
Name=Open Sound System Mixer<br />
GenericName=Audio Mixer<br />
Exec=ossxmix -b<br />
Icon=audio-card<br />
Categories=Application;GTK;AudioVideo;Player;<br />
Terminal=false<br />
Type=Application<br />
Encoding=UTF-8</pre><br />
<br />
To add it to autostart when loading the desktop environment:<br />
<br />
System Settings > Advanced tab > Autostart. Then click add program and choose it from the 'Multimedia' list.<br />
<br />
'''Gnome''' <br />
<br />
*As Root create a file /usr/local/bin/ossxmix_bg with the following content:<br />
<br />
<pre><br />
#!/bin/bash<br />
exec /usr/bin/ossxmix -b<br />
</pre><br />
<br />
Goto System > Preferences > Start Up Applications<br />
<br />
*Click Add, Type OSSMIX in Name field and <code>/usr/local/bin/ossxmix_bg</code> in Command field then click Add button.<br />
<br />
*Login and Logout to see the changes.<br />
<br />
== Record sound output from a program ==<br />
<br />
* [http://www.opensound.com/wiki/index.php/Tips_And_Tricks#Recording_sound_output_of_a_program Recording sound output of a program].<br />
<br />
== Suspend and Hibernation ==<br />
<br />
OSS does not automatically support suspend meaning that OSS must be manually stopped prior to suspending or hibernating.<br />
<br />
OSS provides <tt>soundon</tt> and <tt>soundoff</tt> to enable and disable OSS, although any processes that use sound must be terminated first.<br />
<br />
The following script is a rather basic method of automatically unloading OSS prior to suspending and reloading afterwards.<br />
<br />
#!/bin/sh<br />
. "${PM_FUNCTIONS}"<br />
<br />
suspend_osssound()<br />
{<br />
/usr/lib/oss/scripts/killprocs.sh<br />
/usr/sbin/soundoff<br />
}<br />
<br />
resume_osssound()<br />
{<br />
/usr/sbin/soundon<br />
}<br />
<br />
case "$1" in<br />
hibernate|suspend)<br />
suspend_osssound<br />
;;<br />
thaw|resume)<br />
resume_osssound<br />
;;<br />
*) exit $NA<br />
;;<br />
esac<br />
<br />
Save the contents of the script (as root) into {{Filename|/etc/pm/sleep.d/50ossound}} and make it executable. {{Filename| chmod a+x /etc/pm/sleep.d/50ossound}}<br />
<br />
{{Note|This script is rather basic and will terminate any application directly accessing OSS, save your work prior to suspending/hibernating.}}<br />
<br />
== ALSA emulation ==<br />
<br />
=== Introduction ===<br />
<br />
You can instruct <tt>alsa-lib</tt> to use OSS as its audio output system. This works as a sort of ALSA emulation.<br />
<br />
Note, however, that this method may introduce additional latency in your sound output, and that the emulation is not complete and doesn't work with all applications. It doesn't work, for example, with programs that try to detect devices using ALSA.<br />
<br />
So, as most applications support OSS directly, use this method only as a last resort.<br />
<br />
In the future, more complete methods may be available for emulating ALSA, such as <tt>libsalsa</tt> and <tt>cuckoo</tt>.<br />
<br />
=== HOW-TO ===<br />
<br />
* Install the <tt>alsa-plugins</tt> package.<br />
<br />
# pacman -S alsa-plugins<br />
<br />
* Edit {{Filename|/etc/asound.conf}} as follows.<br />
<br />
pcm.oss {<br />
type oss<br />
device /dev/dsp<br />
}<br />
<br />
pcm.!default {<br />
type oss<br />
device /dev/dsp<br />
}<br />
<br />
ctl.oss {<br />
type oss<br />
device /dev/mixer<br />
}<br />
<br />
ctl.!default {<br />
type oss<br />
device /dev/mixer<br />
}<br />
<br />
{{Note | If you don't want to use OSS anymore, don't forget to revert changes that you do here in {{Filename|/etc/asound.conf}}.}}<br />
<br />
= Experimental packages =<br />
<br />
== Mercurial repository version ==<br />
<br />
There is a [http://aur.archlinux.org/packages.php?ID=21126 oss-mercurial package] in AUR. This package compiles and installs the latest OSS development version direcly from the Mercurial repository.<br />
<br />
You can try this package if you want to contribute code to OSS or if only a very recent change in OSS code introduced support to your sound device.<br />
<br />
If you want oss to take care of your flash sound you will need to install libflashsupport:<br />
<br />
# pacman -S libflashsupport</div>Blohttps://wiki.archlinux.org/index.php?title=Open_Sound_System&diff=80480Open Sound System2009-10-26T11:21:29Z<p>Blo: /* Installing */</p>
<hr />
<div>[[Category:Audio/Video (English)]]<br />
[[Category:HOWTOs (English)]]<br />
{{i18n_links_start}}<br />
{{i18n_entry|English|OSS}}<br />
{{i18n_entry|简体中文|OSS (简体中文)}}<br />
{{i18n_entry|Français|OSS (Français)}}<br />
{{i18n_entry|Türkçe|OSS (Türkçe)}}<br />
{{i18n_links_end}}<br />
<br />
= Introduction =<br />
The [http://developer.opensound.com Open Sound System] is a [http://4front-tech.com commercially-supported] sound architecture that works on several UNIX-like and POSIX-compatible systems, including Linux, FreeBSD, Solaris and BeOS/Haiku.<br />
<br />
Please note that this article is not about the old OSS, which is included in the Linux kernel sources and is more than 10 years old by now.<br />
<br />
This article is about the new OSS versions (often called OSSv4). These versions were previously proprietary - OSS became open source again in July 2007, and is currently available under GPL, BSD or CDDL licenses.<br />
<br />
= Advantages and disadvantages vs. ALSA =<br />
<br />
== Advantages over ALSA (for users) ==<br />
* Includes a transparent software mixer (vmix) in kernel space. This means multiple applications can access the sound device at the same time without problems.<br />
* The vmix mixer controls allow you to adjust the volume of each application individually.<br />
* Better support for some sound card models, for example for the Creative X-Fi.<br />
* Sound quality is usually better. '''reference needed to validate this statement'''<br />
* Better support for applications written for the OSS API, of course. The OSS API is widely spread and a lot of applications support it. The ALSA's OSS API emulation, however, is often buggy.<br />
<br />
== Advantages over ALSA (for developers) ==<br />
* Cleaner and easier to use API.<br />
* API is much better [http://manuals.opensound.com/developer documented].<br />
* Support for sound drivers in the userspace (oss_userdev).<br />
* Portability across all supported platforms. If the application works using OSS under Linux, it will work under FreeBSD and Solaris too, for example.<br />
* Portability across operating systems. It's [http://revolf.free.fr/Alchimie-7/Alchimie7_OSS_Haiku.en.pdf easier] to port OSS to a new operating system.<br />
<br />
== Disadvantages vs. ALSA ==<br />
* USB audio devices support is currently experimental and USB recording is not implemented.<br />
* Bluetooth audio devices are currently not supported.<br />
* AC'97 and HDAudio dial-up soft-modems (for example Si3055) are currently not supported.<br />
* MIDI support is currently not finished. However, you can still use MIDI with a software synthesizer like timidity or fluidsynth.<br />
* Suspend is currently not supported. You need to unload OSS (by using {{Codeline|soundoff}}) before suspending, and to reload OSS (by using {{Codeline|soundon}}) after resuming.<br />
* Automatic jack sensing currently doesn't work properly with '''some''' HDAudio-powered motherboards. This means that, depending on your motherboard model, you may have to manually switch off your speakers when plugging your earphone.<br />
<br />
= Installing =<br />
<br />
The OSS install script unload all ALSA modules. If the OSS install script fails for some reason to remove the ALSA modules issue the command: modprobe -r soundcore. You should balcklist the ALSA modules (to prevent them loading at boot) as described below and you are good to go. <br />
Disable ALSA at boot by blocking the <tt>soundcore</tt> module in {{Filename|/etc/rc.conf}}:<br />
<br />
MODULES=(!soundcore ..............<br />
<br />
Install OSS by running:<br />
<br />
# pacman -S oss<br />
<br />
Be sure the user is part of the audio group:<br />
<br />
# gpasswd -a USERNAME audio<br />
<br />
Start OSS by running:<br />
<br />
# /etc/rc.d/oss start<br />
<br />
Add <tt>oss</tt> to your <tt>DAEMONS</tt> variable at {{Filename|/etc/rc.conf}}, so OSS is loaded automatically at each boot.<br />
<br />
In the case OSS is not able to detect your card when starting it, run :<br />
<br />
# ossdetect -v<br />
<br />
Then {{Codeline|soundoff && soundon}} to reactivate it.<br />
<br />
= Testing =<br />
<br />
You can test OSS by running:<br />
<br />
$ osstest<br />
<br />
{{Note| Beware the default volume is very loud. Avoid using earphones or lower the volume by using <tt>ossxmix</tt>. }}<br />
<br />
You should be able to hear music during the test process. If there is no audio, try to adjust the mixer as explained in the following sections and/or read the Troubleshooting sections.<br />
<br />
= Volume control =<br />
<br />
To control the volume of various devices, mixers levels will need to be set. The command line mixer is called <tt>ossmix</tt>. It's very like the BSD audio mixer (<tt>mixerctl</tt>).<br />
<br />
A graphical mixer, is available too. It's called <tt>ossxmix</tt>. It needs the optional depend <tt>gtk2</tt> to work.<br />
<br />
The <tt>ossxmix</tt> controls are explained in the following example:<br />
<br />
______________________________<br />
/ High Definition Audio ALC262 \ ----------------------------------> One tab for each sound card<br />
/________________________________\_______________________________<br />
|<br />
| [x] vmix0-enable [vmix0-rate: 48.000kHz] vmix0-channels \ The vmix (virtual mixer) special configurations<br />
| [ Stereo [v] ] |--> appear at the top. These include sampling rate<br />
| / and mixer priority. They are provided by OSS.<br />
| __codec1______________________________________________________ <br />
| | _jack_______________________________________________________ \ <br />
| | | _int-speaker____________________ __green_________________ |<br />
| | | | | | | These are your sound card configurations.<br />
| | | | _mode______ | | | | _mode______ | | | Every mixer control that is shown here is<br />
| | | | [ mix [v] ] o o [x] [ ]mute | | [ mix [v] ] o o [x] |--> provided by your sound card. Every sound card<br />
| | | | | | | | | | | specific control is shown here.<br />
| | | |________________________________| |_______________________ |<br />
| | |____________________________________________________________ |<br />
| |______________________________________________________________ /<br />
|<br />
| ___vmix0_______________________________________________________ \<br />
| | __mocp___ O O _firefox_ O O __pcm7___ O O | Here are the vmix mixer controls. These are<br />
| | | | O O | | x x | | O O | virtual mixer controls provided by OSS. Each<br />
| | | | | | x O | | | | x x | | | | O O | slider is the volume control of a different<br />
| | | o o [x] | x x | o o [x] | x x | o o [x] | O O |--> application. When one application uses the<br />
| | | | | | x x | | | | x x | | | | O O | sound card, its name is shown in the place of<br />
| | |_________| x x |_________| x x |_________| O O | the 'pcm#' labels. There are also sound level<br />
| |______________________________________________________________ | meter levels for each application.<br />
|________________________________________________________________ /<br />
<br />
=== Jack Definitions ===<br />
For high definition audio, ossxmix will highlight the jacks to their corresponding plug color. For 5.1 surround sound the [http://en.wikipedia.org/wiki/Audio_and_video_connector jack colors] are: <br />
{| border="1"<br />
|-<br />
! Connector Type<br />
! Purpose<br />
! OSS<br />
|- style=color:black;background:lightgreen<br />
|green TRS 3.5mm<br />
| stereo output, front channels<br />
|front<br />
|- style=color:white;background:black <br />
|black TRS 3.5mm<br />
| stereo output, rear channels<br />
|rear<br />
|- style=color:white;background:gray<br />
|grey TRS 3.5mm<br />
| stereo output, side channels<br />
|side<br />
|- style=color:black;background:gold<br />
|gold TRS 3.5mm<br />
| dual output, center and subwoofer<br />
|center/LFE<br />
|- style=color:black;background:lightblue<br />
|blue TRS 3.5mm<br />
| stereo input, line level<br />
|input<br />
|- style=color:black;background:pink <br />
|pink TS 3.5mm<br />
| mono microphone input<br />
|input<br />
|}<br />
For the most part and for most people just make sure that:<br />
# All green jacks (green and fp-green) are "front" and 75% from max volume.<br />
# All pink jacks (pink and fp-pink) are input and 50% of max to avoid distortion.<br />
<br />
== Other Mixers ==<br />
<br />
Other desktop environments may have support for OSS:<br />
<br />
* Gnome - Gnome Volume Control has support for OSS. Some users report that using Gnome Volume Control is easier to setup than <tt>ossxmix</tt>.<br />
* KDE - Kmix now has preliminary support for OSS.<br />
<br />
== Saving and restoring mixer settings ==<br />
<br />
If you wish to save your mixer settings manually, run {{Codeline|savemixer}}. As regular user you will need permissions to use {{Codeline|/usr/sbin/savemixer}} in the sudoers file or you can modify write permissions to {{Filename|/usr/lib/oss/etc/mixer.save}}. Alternately, the <tt>-f</tt> switch can be used to save the mixer to a file and {{Codeline|savemixer -L}} to restore it.<br />
<br />
Please note that the init scripts run these commands before shutdown/after starting to keep mixer settings across boot, so most users don't need to worry about it.<br />
<br />
= Configuring Applications for OSS =<br />
<br />
== Skype ==<br />
<br />
The <tt>skype</tt> package only includes support for ALSA. To get an OSS-capable Skype, install the <tt>skype-oss</tt> package:<br />
<br />
# pacman -S skype-oss<br />
<br />
If you are using x86_64, you can get the [http://aur.archlinux.org/packages.php?ID=18312 bin32-skype-oss] package from AUR.<br />
<br />
== Wine ==<br />
<br />
* Run <tt>winecfg</tt>.<br />
<br />
$ winecfg<br />
<br />
* Go to the <tt>Audio</tt> tab.<br />
<br />
* Select <tt>OSS Driver</tt>.<br />
<br />
== Gajim ==<br />
By default Gajim uses {{Codeline|aplay -q}} to play a sound. To change this go in Advanced Settings and search for the {{Codeline|soundplayer}} variable. The ossplay program included in the oss package is a good replacement:<br />
<br />
{{Codeline|ossplay -qq}}<br />
<br />
== MOC ==<br />
<br />
To use MOC with OSS v4.1 you must change section OSSMixerDevice to OSSMixerDevice= /dev/ossmix in your config (located in /home/yourusername/.moc).<br />
And now MOC should work with OSS v4.1.<br />
Or you can compile moc-svn package from AUR (he got support for new vmix).<br />
For issue with interface change OSSMixerChannel = to OSSMixerChannel = Any channel and after start mocp press w (change to sofware mixex) that will help and you can change the volume power.<br />
<br />
== Applications that use Gstreamer ==<br />
<br />
Remove pulseaudio and gstreamer*-pulse programs and libraries.<br />
<br />
To change the gstreamer setting to output the sound to OSS instead of the default ALSA, run:<br />
<br />
gstreamer-properties<br />
<br />
Change the '''Default Output''' plugin to custom and the change the pipeline to:<br />
<br />
oss4sink<br />
<br />
For the input:<br />
<br />
oss4src<br />
<br />
{{Note|It's not certain that the input will sound better with oss4src compared to osssrc, so change this only if it improves your input sound. < confirmation on this please >}}<br />
<br />
If you are using phonon with the gstreamer backend you will need to set the environmental variable. To add to your current user:<br />
<br />
export PHONON_GST_AUDIOSINK=oss4sink<br />
<br />
Add this to your {{Filename|~/.bashrc}} to be loaded on login.<br />
<br />
== Firefox >=3.5 ==<br />
<br />
Firefox 3.5 introduces the <video> and <audio> tag support and can play ogg media out of the box. However, it currently can't be compiled with ALSA and OSS support at the same time. So you need to install the [http://aur.archlinux.org/packages.php?ID=28110 xulrunner-oss] package.<br />
<br />
1. Stop firefox.<br />
2. Remove the xulrunner package without dependency check: sudo pacman -Rd xulrunner<br />
3. Install xulrunner-oss package from AUR using yaourt or [http://wiki.archlinux.org/index.php/ABS ABS].<br />
4. Start firefox.<br />
<br />
== Mplayer ==<br />
<br />
If you are using gui (smplayer etc.) you will find the oss output at the audio settings. Using on cli you should specify the sound output: mplayer -ao oss /some/file/to/play.mkv If you don't want to brother typing it over and over again add "ao=oss" to your config file. (/home/$USER/.mplayer/config)<br />
<br />
== Other applications ==<br />
<br />
* If you can't get sound from an application not listed here, try looking at the [http://www.4front-tech.com/wiki/index.php/Configuring_Applications_for_OSSv4 Configuring Applications for OSSv4] page.<br />
* Search OSS specific packages by using {{Codeline|pacman -Ss -- '-oss'}} and [http://aur.archlinux.org/packages.php?K=-oss&start=0&PP=100| in AUR].<br />
<br />
= Troubleshooting =<br />
<br />
== Troubleshooting HDAudio devices ==<br />
<br />
=== Understanding why problems arise ===<br />
<br />
If you have a HDAudio sound device, it's very likely that you will have to adjust some mixer settings before your sound works.<br />
<br />
HDAudio devices are very powerful in the sense that they can contain a lot of small circuits (called ''widgets'') that can be adjusted by software at any time. These controls are exposed to the mixer, and they can be used, for example, to turn the earphone jack into a sound input jack instead of a sound output jack.<br />
<br />
However, there is a side effect, mainly because the HDAudio standard is more flexible than it perhaps should be, and because the vendors often only care to get their ''official drivers'' working.<br />
<br />
Then, when using HDAudio devices, you often find disorganized mixer controls, that doesn't work at all by default, and you are forced to try every mixer control combination, until it works.<br />
<br />
=== How to solve ===<br />
<br />
Open <tt>ossxmix</tt> and try to change every mixer control in the ''middle area'', that contains the sound card specific controls, as explained in the previous "[[OSS#The_mixer|The mixer]]" section.<br />
<br />
You'll probably want to setup a program to record/play continously in the background (e.g. {{Codeline|ossrecord - | ossplay -}} for recording or {{Codeline|osstest -lV}} for playing), while changing mixer settings in ossxmix in the foreground.<br />
<br />
* Raise every volume control slider.<br />
* In each option box, try to change the selected option, trying all the possible combinations.<br />
* If you get noise, try to lower and/or mute some volume controls, until you find the source of the noise.<br />
<br />
Please note again that you do '''not''' need to change any controls in the ''top area'' nor in the ''bottom area'', as they are virtual <tt>vmix</tt>-related mixer controls.<br />
<br />
* Editing {{Codeline|/usr/lib/oss/conf/oss_hdaudio.conf}} uncommenting and changing ''hdaudio_noskip=0'' to a value from 0-7 can give you more jack options in ossxmix<br />
I had to edit mine to ''hdaudio_noskip=7'' for my sub/rear speaker to work on my laptop, restart oss for the changes to take effect {{Codeline|/etc/rc.d/oss restart}}<br />
<br />
== MMS sound cracking in totem ==<br />
If your stream sounds with cracks or strange noise in totem like it did with me then you could try to play it with another backend like ffmpeg (mplayer). That "fixed" the issue for me. This will not fix the issue that somehow pops up in gstreamer when playing MMS streams but it will give you the option to play it with good sound quality. Playing it in mplayer is simple:<br />
# mplayer mmsh://yourstreamurl<br />
<br />
== Microphone playing through output channels ==<br />
<br />
OSS by default plays back the microphone through the speakers. To disable this in ossxmix find the misc section. Check off every "input-mix-mute" to disable this.<br />
<br />
== Troubleshooting other issues ==<br />
<br />
* If you get distorted sound, try lowering some volume control sliders.<br />
<br />
* If you need to change the default sound card, look at [http://www.opensound.com/wiki/index.php/Tips_And_Tricks#Changing_the_default_sound_output here].<br />
<br />
* If you have another issues, try searching or asking for help at the [http://www.4front-tech.com/forum 4front forums].<br />
<br />
= Tips and Tricks =<br />
<br />
== Using multimedia keys with OSS ==<br />
An easy way to mute/unmute and increase/decrease the volume is to use the [http://www.opensound.com/wiki/index.php/Tips_And_Tricks#ossvol {{Codeline|ossvol}} script] available in [[AUR]].<br />
<br />
Once you installed it try to toggle the sound:<br />
$ ossvol -t<br />
<br />
Type {{Codeline|ossvol -h}} for the other commands.<br />
<br />
If you don't know how to assign commands to your multimedia keys, see [[Extra Keyboard Keys]].<br />
<br />
==={{Codeline|ossvol}} troubleshooting===<br />
If you get an error like:<br />
Bad mixer control name(987) 'vol'<br />
you need to edit the script ({{Filename|/usr/bin/ossvol}}) and change the value of the {{Codeline|CHANNEL}} variable which is at the beginning of the script. For example mine is {{Codeline|CHANNEL<nowiki>=</nowiki>"vmix0-outvol"}}.<br />
<br />
*'''Note''' if you are using xbindkeys for your multimedia keys adding this<br />
"ossmix vmix0-outvol -- +1"<br />
raise volume<br />
"ossmix vmix0-outvol -- -1"<br />
lower volume<br />
<br />
to the raise/lower volume section of your .xbindkeysrc file is an easy way to adjust the volume<br />
<br />
== Changing the Sample Rate ==<br />
<br />
Changing the output sample rate is not obvious at first. Sample rates can only be changed by the superuser and vmix must be unused by any programs when a change is requested. Before you follow any of these steps, ensure you are going through a receiver/amplifier and using quality speakers and not simply computer speakers. If you are only using computer speakers, don't bother changing anything here as you won't notice a difference.<br />
<br />
By default the sample rate is 48000hz. There are several conditions in which you may want to change this. This all depends on your usage patterns. You want the sample rate you are using to match the media you use the most. If your computer has to change the sampling rate of the media to suit the hardware it is likely, though not guaranteed that you will have a loss in audio quality. This is most noticable in downsampling (ie. 96000hz &rarr; 48000hz). There is an article about this issue in [http://www.stereophile.com/news/121707lucky/ "Stereophile"] which was [http://lists.apple.com/archives/coreaudio-api/2008/Jan/msg00272.html discussed] on Apple's "CoreAudio API" mailing list if you wish to learn more about this issue. <br />
<br />
Some example sample rates:<br />
<br />
* 44100hz - Sample rate of standard [http://en.wikipedia.org/wiki/Red_Book_%28audio_CD_standard%29 Red Book] audio cds.<br />
* 88000hz - Sample rate of [http://en.wikipedia.org/wiki/Super_Audio_CD SACD] high definition audio discs/downloads. It is rare that your motherboard will support this sample rate.<br />
* 96000hz - Sample rate of most high definition audio downloads. If your motherboard is an [http://en.wikipedia.org/wiki/AC%2797 AC'97] motherboard, this is likely to be your highest bitrate.<br />
* 192000hz - Sample rate of BluRay, and some (very few) high definition downloads. Support for external audio reciever equipment is limited to high end audio. Not all motherboards support this. An example of a motherboard chipset that would support this includes [http://en.wikipedia.org/wiki/Intel_High_Definition_Audio Intel HDA audio]. <br />
<br />
To check what your sample rate is currently set to:<br />
<br />
# Run <code>"ossmix | grep rate"</code>. <br />
<br />
You are likely to see <code>"vmix0-rate <decimal value> (currently 48000) (Read-only)"</code>.<br />
<br />
If you do not see a "vmix0-rate" (or "vmix1-rate", etc.) being outputted, than it probably means that vmix is disabled. In that case, OSS will use the rate requested by the program which uses the device, so this section doesn't apply. Exception: envy24(ht) cards have a setting envy24.rate which has a similiar function (see "oss_envy24" manpage). You can follow these steps, but at step 2, change with ossmix the value of "envy24.rate" as well.<br />
<br />
Steps to affect the change:<br />
<br />
# First, make sure your card is able to use the new rate. Run "ossinfo -v2" and see if the wanted rate is in the "Native sample rates" output.<br />
# As root, run <code>"/usr/lib/oss/scripts/killprocs.sh"</code>. Be aware, this will close any program that currently has an open sound channel (examples being media players, Firefox as of 3.5 if you have xulrunner-oss installed, and the gnome volume control).<br />
# After all programs occupying vmix are terminated, run as root: <code>"vmixctl rate /dev/dsp 96000"</code> replacing the rate with your desired sample rate.<br />
# Run <code>"ossmix | grep rate"</code> and check for <code>"vmix0-rate <decimal value> (currently 96000) (Read-only)"</code> to see if you were successful.<br />
<br />
== Start ossxmix docked to systray on startup ==<br />
<br />
'''KDE 4'''<br />
<br />
Create an application launcher file named <code>ossxmix.desktop</code> in you local application launchers directory (<code>~/.local/share/applications/</code> then enter:<br />
<br />
<pre>[Desktop Entry]<br />
Name=Open Sound System Mixer<br />
GenericName=Audio Mixer<br />
Exec=ossxmix -b<br />
Icon=audio-card<br />
Categories=Application;GTK;AudioVideo;Player;<br />
Terminal=false<br />
Type=Application<br />
Encoding=UTF-8</pre><br />
<br />
To add it to autostart when loading the desktop environment:<br />
<br />
System Settings > Advanced tab > Autostart. Then click add program and choose it from the 'Multimedia' list.<br />
<br />
'''Gnome''' <br />
<br />
*As Root create a file /usr/local/bin/ossxmix_bg with the following content:<br />
<br />
<pre><br />
#!/bin/bash<br />
exec /usr/bin/ossxmix -b<br />
</pre><br />
<br />
Goto System > Preferences > Start Up Applications<br />
<br />
*Click Add, Type OSSMIX in Name field and <code>/usr/local/bin/ossxmix_bg</code> in Command field then click Add button.<br />
<br />
*Login and Logout to see the changes.<br />
<br />
== Record sound output from a program ==<br />
<br />
* [http://www.opensound.com/wiki/index.php/Tips_And_Tricks#Recording_sound_output_of_a_program Recording sound output of a program].<br />
<br />
== Suspend and Hibernation ==<br />
<br />
OSS does not automatically support suspend meaning that OSS must be manually stopped prior to suspending or hibernating.<br />
<br />
OSS provides <tt>soundon</tt> and <tt>soundoff</tt> to enable and disable OSS, although any processes that use sound must be terminated first.<br />
<br />
The following script is a rather basic method of automatically unloading OSS prior to suspending and reloading afterwards.<br />
<br />
#!/bin/sh<br />
. "${PM_FUNCTIONS}"<br />
<br />
suspend_osssound()<br />
{<br />
/usr/lib/oss/scripts/killprocs.sh<br />
/usr/sbin/soundoff<br />
}<br />
<br />
resume_osssound()<br />
{<br />
/usr/sbin/soundon<br />
}<br />
<br />
case "$1" in<br />
hibernate|suspend)<br />
suspend_osssound<br />
;;<br />
thaw|resume)<br />
resume_osssound<br />
;;<br />
*) exit $NA<br />
;;<br />
esac<br />
<br />
Save the contents of the script (as root) into {{Filename|/etc/pm/sleep.d/50ossound}} and make it executable. {{Filename| chmod a+x /etc/pm/sleep.d/50ossound}}<br />
<br />
{{Note|This script is rather basic and will terminate any application directly accessing OSS, save your work prior to suspending/hibernating.}}<br />
<br />
== ALSA emulation ==<br />
<br />
=== Introduction ===<br />
<br />
You can instruct <tt>alsa-lib</tt> to use OSS as its audio output system. This works as a sort of ALSA emulation.<br />
<br />
Note, however, that this method may introduce additional latency in your sound output, and that the emulation is not complete and doesn't work with all applications. It doesn't work, for example, with programs that try to detect devices using ALSA.<br />
<br />
So, as most applications support OSS directly, use this method only as a last resort.<br />
<br />
In the future, more complete methods may be available for emulating ALSA, such as <tt>libsalsa</tt> and <tt>cuckoo</tt>.<br />
<br />
=== HOW-TO ===<br />
<br />
* Install the <tt>alsa-plugins</tt> package.<br />
<br />
# pacman -S alsa-plugins<br />
<br />
* Edit {{Filename|/etc/asound.conf}} as follows.<br />
<br />
pcm.oss {<br />
type oss<br />
device /dev/dsp<br />
}<br />
<br />
pcm.!default {<br />
type oss<br />
device /dev/dsp<br />
}<br />
<br />
ctl.oss {<br />
type oss<br />
device /dev/mixer<br />
}<br />
<br />
ctl.!default {<br />
type oss<br />
device /dev/mixer<br />
}<br />
<br />
{{Note | If you don't want to use OSS anymore, don't forget to revert changes that you do here in {{Filename|/etc/asound.conf}}.}}<br />
<br />
= Experimental packages =<br />
<br />
== Mercurial repository version ==<br />
<br />
There is a [http://aur.archlinux.org/packages.php?ID=21126 oss-mercurial package] in AUR. This package compiles and installs the latest OSS development version direcly from the Mercurial repository.<br />
<br />
You can try this package if you want to contribute code to OSS or if only a very recent change in OSS code introduced support to your sound device.<br />
<br />
If you want oss to take care of your flash sound you will need to install libflashsupport:<br />
<br />
# pacman -S libflashsupport</div>Blohttps://wiki.archlinux.org/index.php?title=Open_Sound_System&diff=80468Open Sound System2009-10-26T10:33:09Z<p>Blo: </p>
<hr />
<div>[[Category:Audio/Video (English)]]<br />
[[Category:HOWTOs (English)]]<br />
{{i18n_links_start}}<br />
{{i18n_entry|English|OSS}}<br />
{{i18n_entry|简体中文|OSS (简体中文)}}<br />
{{i18n_entry|Français|OSS (Français)}}<br />
{{i18n_entry|Türkçe|OSS (Türkçe)}}<br />
{{i18n_links_end}}<br />
<br />
= Introduction =<br />
The [http://developer.opensound.com Open Sound System] is a [http://4front-tech.com commercially-supported] sound architecture that works on several UNIX-like and POSIX-compatible systems, including Linux, FreeBSD, Solaris and BeOS/Haiku.<br />
<br />
Please note that this article is not about the old OSS, which is included in the Linux kernel sources and is more than 10 years old by now.<br />
<br />
This article is about the new OSS versions (often called OSSv4). These versions were previously proprietary - OSS became open source again in July 2007, and is currently available under GPL, BSD or CDDL licenses.<br />
<br />
= Advantages and disadvantages vs. ALSA =<br />
<br />
== Advantages over ALSA (for users) ==<br />
* Includes a transparent software mixer (vmix) in kernel space. This means multiple applications can access the sound device at the same time without problems.<br />
* The vmix mixer controls allow you to adjust the volume of each application individually.<br />
* Better support for some sound card models, for example for the Creative X-Fi.<br />
* Sound quality is usually better. '''reference needed to validate this statement'''<br />
* Better support for applications written for the OSS API, of course. The OSS API is widely spread and a lot of applications support it. The ALSA's OSS API emulation, however, is often buggy.<br />
<br />
== Advantages over ALSA (for developers) ==<br />
* Cleaner and easier to use API.<br />
* API is much better [http://manuals.opensound.com/developer documented].<br />
* Support for sound drivers in the userspace (oss_userdev).<br />
* Portability across all supported platforms. If the application works using OSS under Linux, it will work under FreeBSD and Solaris too, for example.<br />
* Portability across operating systems. It's [http://revolf.free.fr/Alchimie-7/Alchimie7_OSS_Haiku.en.pdf easier] to port OSS to a new operating system.<br />
<br />
== Disadvantages vs. ALSA ==<br />
* USB audio devices support is currently experimental and USB recording is not implemented.<br />
* Bluetooth audio devices are currently not supported.<br />
* AC'97 and HDAudio dial-up soft-modems (for example Si3055) are currently not supported.<br />
* MIDI support is currently not finished. However, you can still use MIDI with a software synthesizer like timidity or fluidsynth.<br />
* Suspend is currently not supported. You need to unload OSS (by using {{Codeline|soundoff}}) before suspending, and to reload OSS (by using {{Codeline|soundon}}) after resuming.<br />
* Automatic jack sensing currently doesn't work properly with '''some''' HDAudio-powered motherboards. This means that, depending on your motherboard model, you may have to manually switch off your speakers when plugging your earphone.<br />
<br />
= Installing =<br />
<br />
Disable ALSA by blocking the <tt>soundcore</tt> module in {{Filename|/etc/rc.conf}}, then reboot:<br />
<br />
MODULES=(!soundcore ..............<br />
<br />
Install OSS by running:<br />
<br />
# pacman -S oss<br />
<br />
Be sure the user is part of the audio group:<br />
<br />
# gpasswd -a USERNAME audio<br />
<br />
Start OSS by running:<br />
<br />
# /etc/rc.d/oss start<br />
<br />
Add <tt>oss</tt> to your <tt>DAEMONS</tt> variable at {{Filename|/etc/rc.conf}}, so OSS is loaded automatically at each boot.<br />
<br />
In the case OSS is not able to detect your card when starting it, run :<br />
<br />
# ossdetect -v<br />
<br />
Then {{Codeline|soundoff && soundon}} to reactivate it.<br />
<br />
= Testing =<br />
<br />
You can test OSS by running:<br />
<br />
$ osstest<br />
<br />
{{Note| Beware the default volume is very loud. Avoid using earphones or lower the volume by using <tt>ossxmix</tt>. }}<br />
<br />
You should be able to hear music during the test process. If there is no audio, try to adjust the mixer as explained in the following sections and/or read the Troubleshooting sections.<br />
<br />
= Volume control =<br />
<br />
To control the volume of various devices, mixers levels will need to be set. The command line mixer is called <tt>ossmix</tt>. It's very like the BSD audio mixer (<tt>mixerctl</tt>).<br />
<br />
A graphical mixer, is available too. It's called <tt>ossxmix</tt>. It needs the optional depend <tt>gtk2</tt> to work.<br />
<br />
The <tt>ossxmix</tt> controls are explained in the following example:<br />
<br />
______________________________<br />
/ High Definition Audio ALC262 \ ----------------------------------> One tab for each sound card<br />
/________________________________\_______________________________<br />
|<br />
| [x] vmix0-enable [vmix0-rate: 48.000kHz] vmix0-channels \ The vmix (virtual mixer) special configurations<br />
| [ Stereo [v] ] |--> appear at the top. These include sampling rate<br />
| / and mixer priority. They are provided by OSS.<br />
| __codec1______________________________________________________ <br />
| | _jack_______________________________________________________ \ <br />
| | | _int-speaker____________________ __green_________________ |<br />
| | | | | | | These are your sound card configurations.<br />
| | | | _mode______ | | | | _mode______ | | | Every mixer control that is shown here is<br />
| | | | [ mix [v] ] o o [x] [ ]mute | | [ mix [v] ] o o [x] |--> provided by your sound card. Every sound card<br />
| | | | | | | | | | | specific control is shown here.<br />
| | | |________________________________| |_______________________ |<br />
| | |____________________________________________________________ |<br />
| |______________________________________________________________ /<br />
|<br />
| ___vmix0_______________________________________________________ \<br />
| | __mocp___ O O _firefox_ O O __pcm7___ O O | Here are the vmix mixer controls. These are<br />
| | | | O O | | x x | | O O | virtual mixer controls provided by OSS. Each<br />
| | | | | | x O | | | | x x | | | | O O | slider is the volume control of a different<br />
| | | o o [x] | x x | o o [x] | x x | o o [x] | O O |--> application. When one application uses the<br />
| | | | | | x x | | | | x x | | | | O O | sound card, its name is shown in the place of<br />
| | |_________| x x |_________| x x |_________| O O | the 'pcm#' labels. There are also sound level<br />
| |______________________________________________________________ | meter levels for each application.<br />
|________________________________________________________________ /<br />
<br />
=== Jack Definitions ===<br />
For high definition audio, ossxmix will highlight the jacks to their corresponding plug color. For 5.1 surround sound the [http://en.wikipedia.org/wiki/Audio_and_video_connector jack colors] are: <br />
{| border="1"<br />
|-<br />
! Connector Type<br />
! Purpose<br />
! OSS<br />
|- style=color:black;background:lightgreen<br />
|green TRS 3.5mm<br />
| stereo output, front channels<br />
|front<br />
|- style=color:white;background:black <br />
|black TRS 3.5mm<br />
| stereo output, rear channels<br />
|rear<br />
|- style=color:white;background:gray<br />
|grey TRS 3.5mm<br />
| stereo output, side channels<br />
|side<br />
|- style=color:black;background:gold<br />
|gold TRS 3.5mm<br />
| dual output, center and subwoofer<br />
|center/LFE<br />
|- style=color:black;background:lightblue<br />
|blue TRS 3.5mm<br />
| stereo input, line level<br />
|input<br />
|- style=color:black;background:pink <br />
|pink TS 3.5mm<br />
| mono microphone input<br />
|input<br />
|}<br />
For the most part and for most people just make sure that:<br />
# All green jacks (green and fp-green) are "front" and 75% from max volume.<br />
# All pink jacks (pink and fp-pink) are input and 50% of max to avoid distortion.<br />
<br />
== Other Mixers ==<br />
<br />
Other desktop environments may have support for OSS:<br />
<br />
* Gnome - Gnome Volume Control has support for OSS. Some users report that using Gnome Volume Control is easier to setup than <tt>ossxmix</tt>.<br />
* KDE - Kmix now has preliminary support for OSS.<br />
<br />
== Saving and restoring mixer settings ==<br />
<br />
If you wish to save your mixer settings manually, run {{Codeline|savemixer}}. As regular user you will need permissions to use {{Codeline|/usr/sbin/savemixer}} in the sudoers file or you can modify write permissions to {{Filename|/usr/lib/oss/etc/mixer.save}}. Alternately, the <tt>-f</tt> switch can be used to save the mixer to a file and {{Codeline|savemixer -L}} to restore it.<br />
<br />
Please note that the init scripts run these commands before shutdown/after starting to keep mixer settings across boot, so most users don't need to worry about it.<br />
<br />
= Configuring Applications for OSS =<br />
<br />
== Skype ==<br />
<br />
The <tt>skype</tt> package only includes support for ALSA. To get an OSS-capable Skype, install the <tt>skype-oss</tt> package:<br />
<br />
# pacman -S skype-oss<br />
<br />
If you are using x86_64, you can get the [http://aur.archlinux.org/packages.php?ID=18312 bin32-skype-oss] package from AUR.<br />
<br />
== Wine ==<br />
<br />
* Run <tt>winecfg</tt>.<br />
<br />
$ winecfg<br />
<br />
* Go to the <tt>Audio</tt> tab.<br />
<br />
* Select <tt>OSS Driver</tt>.<br />
<br />
== Gajim ==<br />
By default Gajim uses {{Codeline|aplay -q}} to play a sound. To change this go in Advanced Settings and search for the {{Codeline|soundplayer}} variable. The ossplay program included in the oss package is a good replacement:<br />
<br />
{{Codeline|ossplay -qq}}<br />
<br />
== MOC ==<br />
<br />
To use MOC with OSS v4.1 you must change section OSSMixerDevice to OSSMixerDevice= /dev/ossmix in your config (located in /home/yourusername/.moc).<br />
And now MOC should work with OSS v4.1.<br />
Or you can compile moc-svn package from AUR (he got support for new vmix).<br />
For issue with interface change OSSMixerChannel = to OSSMixerChannel = Any channel and after start mocp press w (change to sofware mixex) that will help and you can change the volume power.<br />
<br />
== Applications that use Gstreamer ==<br />
<br />
Remove pulseaudio and gstreamer*-pulse programs and libraries.<br />
<br />
To change the gstreamer setting to output the sound to OSS instead of the default ALSA, run:<br />
<br />
gstreamer-properties<br />
<br />
Change the '''Default Output''' plugin to custom and the change the pipeline to:<br />
<br />
oss4sink<br />
<br />
For the input:<br />
<br />
oss4src<br />
<br />
{{Note|It's not certain that the input will sound better with oss4src compared to osssrc, so change this only if it improves your input sound. < confirmation on this please >}}<br />
<br />
If you are using phonon with the gstreamer backend you will need to set the environmental variable. To add to your current user:<br />
<br />
export PHONON_GST_AUDIOSINK=oss4sink<br />
<br />
Add this to your {{Filename|~/.bashrc}} to be loaded on login.<br />
<br />
== Firefox >=3.5 ==<br />
<br />
Firefox 3.5 introduces the <video> and <audio> tag support and can play ogg media out of the box. However, it currently can't be compiled with ALSA and OSS support at the same time. So you need to install the [http://aur.archlinux.org/packages.php?ID=28110 xulrunner-oss] package.<br />
<br />
1. Stop firefox.<br />
2. Remove the xulrunner package without dependency check: sudo pacman -Rd xulrunner<br />
3. Install xulrunner-oss package from AUR using yaourt or [http://wiki.archlinux.org/index.php/ABS ABS].<br />
4. Start firefox.<br />
<br />
== Mplayer ==<br />
<br />
If you are using gui (smplayer etc.) you will find the oss output at the audio settings. Using on cli you should specify the sound output: mplayer -ao oss /some/file/to/play.mkv If you don't want to brother typing it over and over again add "ao=oss" to your config file. (/home/$USER/.mplayer/config)<br />
<br />
== Other applications ==<br />
<br />
* If you can't get sound from an application not listed here, try looking at the [http://www.4front-tech.com/wiki/index.php/Configuring_Applications_for_OSSv4 Configuring Applications for OSSv4] page.<br />
* Search OSS specific packages by using {{Codeline|pacman -Ss -- '-oss'}} and [http://aur.archlinux.org/packages.php?K=-oss&start=0&PP=100| in AUR].<br />
<br />
= Troubleshooting =<br />
<br />
== Troubleshooting HDAudio devices ==<br />
<br />
=== Understanding why problems arise ===<br />
<br />
If you have a HDAudio sound device, it's very likely that you will have to adjust some mixer settings before your sound works.<br />
<br />
HDAudio devices are very powerful in the sense that they can contain a lot of small circuits (called ''widgets'') that can be adjusted by software at any time. These controls are exposed to the mixer, and they can be used, for example, to turn the earphone jack into a sound input jack instead of a sound output jack.<br />
<br />
However, there is a side effect, mainly because the HDAudio standard is more flexible than it perhaps should be, and because the vendors often only care to get their ''official drivers'' working.<br />
<br />
Then, when using HDAudio devices, you often find disorganized mixer controls, that doesn't work at all by default, and you are forced to try every mixer control combination, until it works.<br />
<br />
=== How to solve ===<br />
<br />
Open <tt>ossxmix</tt> and try to change every mixer control in the ''middle area'', that contains the sound card specific controls, as explained in the previous "[[OSS#The_mixer|The mixer]]" section.<br />
<br />
You'll probably want to setup a program to record/play continously in the background (e.g. {{Codeline|ossrecord - | ossplay -}} for recording or {{Codeline|osstest -lV}} for playing), while changing mixer settings in ossxmix in the foreground.<br />
<br />
* Raise every volume control slider.<br />
* In each option box, try to change the selected option, trying all the possible combinations.<br />
* If you get noise, try to lower and/or mute some volume controls, until you find the source of the noise.<br />
<br />
Please note again that you do '''not''' need to change any controls in the ''top area'' nor in the ''bottom area'', as they are virtual <tt>vmix</tt>-related mixer controls.<br />
<br />
* Editing {{Codeline|/usr/lib/oss/conf/oss_hdaudio.conf}} uncommenting and changing ''hdaudio_noskip=0'' to a value from 0-7 can give you more jack options in ossxmix<br />
I had to edit mine to ''hdaudio_noskip=7'' for my sub/rear speaker to work on my laptop, restart oss for the changes to take effect {{Codeline|/etc/rc.d/oss restart}}<br />
<br />
== MMS sound cracking in totem ==<br />
If your stream sounds with cracks or strange noise in totem like it did with me then you could try to play it with another backend like ffmpeg (mplayer). That "fixed" the issue for me. This will not fix the issue that somehow pops up in gstreamer when playing MMS streams but it will give you the option to play it with good sound quality. Playing it in mplayer is simple:<br />
# mplayer mmsh://yourstreamurl<br />
<br />
== Microphone playing through output channels ==<br />
<br />
OSS by default plays back the microphone through the speakers. To disable this in ossxmix find the misc section. Check off every "input-mix-mute" to disable this.<br />
<br />
== Troubleshooting other issues ==<br />
<br />
* If you get distorted sound, try lowering some volume control sliders.<br />
<br />
* If you need to change the default sound card, look at [http://www.opensound.com/wiki/index.php/Tips_And_Tricks#Changing_the_default_sound_output here].<br />
<br />
* If you have another issues, try searching or asking for help at the [http://www.4front-tech.com/forum 4front forums].<br />
<br />
= Tips and Tricks =<br />
<br />
== Using multimedia keys with OSS ==<br />
An easy way to mute/unmute and increase/decrease the volume is to use the [http://www.opensound.com/wiki/index.php/Tips_And_Tricks#ossvol {{Codeline|ossvol}} script] available in [[AUR]].<br />
<br />
Once you installed it try to toggle the sound:<br />
$ ossvol -t<br />
<br />
Type {{Codeline|ossvol -h}} for the other commands.<br />
<br />
If you don't know how to assign commands to your multimedia keys, see [[Extra Keyboard Keys]].<br />
<br />
==={{Codeline|ossvol}} troubleshooting===<br />
If you get an error like:<br />
Bad mixer control name(987) 'vol'<br />
you need to edit the script ({{Filename|/usr/bin/ossvol}}) and change the value of the {{Codeline|CHANNEL}} variable which is at the beginning of the script. For example mine is {{Codeline|CHANNEL<nowiki>=</nowiki>"vmix0-outvol"}}.<br />
<br />
*'''Note''' if you are using xbindkeys for your multimedia keys adding this<br />
"ossmix vmix0-outvol -- +1"<br />
raise volume<br />
"ossmix vmix0-outvol -- -1"<br />
lower volume<br />
<br />
to the raise/lower volume section of your .xbindkeysrc file is an easy way to adjust the volume<br />
<br />
== Changing the Sample Rate ==<br />
<br />
Changing the output sample rate is not obvious at first. Sample rates can only be changed by the superuser and vmix must be unused by any programs when a change is requested. Before you follow any of these steps, ensure you are going through a receiver/amplifier and using quality speakers and not simply computer speakers. If you are only using computer speakers, don't bother changing anything here as you won't notice a difference.<br />
<br />
By default the sample rate is 48000hz. There are several conditions in which you may want to change this. This all depends on your usage patterns. You want the sample rate you are using to match the media you use the most. If your computer has to change the sampling rate of the media to suit the hardware it is likely, though not guaranteed that you will have a loss in audio quality. This is most noticable in downsampling (ie. 96000hz &rarr; 48000hz). There is an article about this issue in [http://www.stereophile.com/news/121707lucky/ "Stereophile"] which was [http://lists.apple.com/archives/coreaudio-api/2008/Jan/msg00272.html discussed] on Apple's "CoreAudio API" mailing list if you wish to learn more about this issue. <br />
<br />
Some example sample rates:<br />
<br />
* 44100hz - Sample rate of standard [http://en.wikipedia.org/wiki/Red_Book_%28audio_CD_standard%29 Red Book] audio cds.<br />
* 88000hz - Sample rate of [http://en.wikipedia.org/wiki/Super_Audio_CD SACD] high definition audio discs/downloads. It is rare that your motherboard will support this sample rate.<br />
* 96000hz - Sample rate of most high definition audio downloads. If your motherboard is an [http://en.wikipedia.org/wiki/AC%2797 AC'97] motherboard, this is likely to be your highest bitrate.<br />
* 192000hz - Sample rate of BluRay, and some (very few) high definition downloads. Support for external audio reciever equipment is limited to high end audio. Not all motherboards support this. An example of a motherboard chipset that would support this includes [http://en.wikipedia.org/wiki/Intel_High_Definition_Audio Intel HDA audio]. <br />
<br />
To check what your sample rate is currently set to:<br />
<br />
# Run <code>"ossmix | grep rate"</code>. <br />
<br />
You are likely to see <code>"vmix0-rate <decimal value> (currently 48000) (Read-only)"</code>.<br />
<br />
If you do not see a "vmix0-rate" (or "vmix1-rate", etc.) being outputted, than it probably means that vmix is disabled. In that case, OSS will use the rate requested by the program which uses the device, so this section doesn't apply. Exception: envy24(ht) cards have a setting envy24.rate which has a similiar function (see "oss_envy24" manpage). You can follow these steps, but at step 2, change with ossmix the value of "envy24.rate" as well.<br />
<br />
Steps to affect the change:<br />
<br />
# First, make sure your card is able to use the new rate. Run "ossinfo -v2" and see if the wanted rate is in the "Native sample rates" output.<br />
# As root, run <code>"/usr/lib/oss/scripts/killprocs.sh"</code>. Be aware, this will close any program that currently has an open sound channel (examples being media players, Firefox as of 3.5 if you have xulrunner-oss installed, and the gnome volume control).<br />
# After all programs occupying vmix are terminated, run as root: <code>"vmixctl rate /dev/dsp 96000"</code> replacing the rate with your desired sample rate.<br />
# Run <code>"ossmix | grep rate"</code> and check for <code>"vmix0-rate <decimal value> (currently 96000) (Read-only)"</code> to see if you were successful.<br />
<br />
== Start ossxmix docked to systray on startup ==<br />
<br />
'''KDE 4'''<br />
<br />
Create an application launcher file named <code>ossxmix.desktop</code> in you local application launchers directory (<code>~/.local/share/applications/</code> then enter:<br />
<br />
<pre>[Desktop Entry]<br />
Name=Open Sound System Mixer<br />
GenericName=Audio Mixer<br />
Exec=ossxmix -b<br />
Icon=audio-card<br />
Categories=Application;GTK;AudioVideo;Player;<br />
Terminal=false<br />
Type=Application<br />
Encoding=UTF-8</pre><br />
<br />
To add it to autostart when loading the desktop environment:<br />
<br />
System Settings > Advanced tab > Autostart. Then click add program and choose it from the 'Multimedia' list.<br />
<br />
'''Gnome''' <br />
<br />
*As Root create a file /usr/local/bin/ossxmix_bg with the following content:<br />
<br />
<pre><br />
#!/bin/bash<br />
exec /usr/bin/ossxmix -b<br />
</pre><br />
<br />
Goto System > Preferences > Start Up Applications<br />
<br />
*Click Add, Type OSSMIX in Name field and <code>/usr/local/bin/ossxmix_bg</code> in Command field then click Add button.<br />
<br />
*Login and Logout to see the changes.<br />
<br />
== Record sound output from a program ==<br />
<br />
* [http://www.opensound.com/wiki/index.php/Tips_And_Tricks#Recording_sound_output_of_a_program Recording sound output of a program].<br />
<br />
== Suspend and Hibernation ==<br />
<br />
OSS does not automatically support suspend meaning that OSS must be manually stopped prior to suspending or hibernating.<br />
<br />
OSS provides <tt>soundon</tt> and <tt>soundoff</tt> to enable and disable OSS, although any processes that use sound must be terminated first.<br />
<br />
The following script is a rather basic method of automatically unloading OSS prior to suspending and reloading afterwards.<br />
<br />
#!/bin/sh<br />
. "${PM_FUNCTIONS}"<br />
<br />
suspend_osssound()<br />
{<br />
/usr/lib/oss/scripts/killprocs.sh<br />
/usr/sbin/soundoff<br />
}<br />
<br />
resume_osssound()<br />
{<br />
/usr/sbin/soundon<br />
}<br />
<br />
case "$1" in<br />
hibernate|suspend)<br />
suspend_osssound<br />
;;<br />
thaw|resume)<br />
resume_osssound<br />
;;<br />
*) exit $NA<br />
;;<br />
esac<br />
<br />
Save the contents of the script (as root) into {{Filename|/etc/pm/sleep.d/50ossound}} and make it executable. {{Filename| chmod a+x /etc/pm/sleep.d/50ossound}}<br />
<br />
{{Note|This script is rather basic and will terminate any application directly accessing OSS, save your work prior to suspending/hibernating.}}<br />
<br />
== ALSA emulation ==<br />
<br />
=== Introduction ===<br />
<br />
You can instruct <tt>alsa-lib</tt> to use OSS as its audio output system. This works as a sort of ALSA emulation.<br />
<br />
Note, however, that this method may introduce additional latency in your sound output, and that the emulation is not complete and doesn't work with all applications. It doesn't work, for example, with programs that try to detect devices using ALSA.<br />
<br />
So, as most applications support OSS directly, use this method only as a last resort.<br />
<br />
In the future, more complete methods may be available for emulating ALSA, such as <tt>libsalsa</tt> and <tt>cuckoo</tt>.<br />
<br />
=== HOW-TO ===<br />
<br />
* Install the <tt>alsa-plugins</tt> package.<br />
<br />
# pacman -S alsa-plugins<br />
<br />
* Edit {{Filename|/etc/asound.conf}} as follows.<br />
<br />
pcm.oss {<br />
type oss<br />
device /dev/dsp<br />
}<br />
<br />
pcm.!default {<br />
type oss<br />
device /dev/dsp<br />
}<br />
<br />
ctl.oss {<br />
type oss<br />
device /dev/mixer<br />
}<br />
<br />
ctl.!default {<br />
type oss<br />
device /dev/mixer<br />
}<br />
<br />
{{Note | If you don't want to use OSS anymore, don't forget to revert changes that you do here in {{Filename|/etc/asound.conf}}.}}<br />
<br />
= Experimental packages =<br />
<br />
== Mercurial repository version ==<br />
<br />
There is a [http://aur.archlinux.org/packages.php?ID=21126 oss-mercurial package] in AUR. This package compiles and installs the latest OSS development version direcly from the Mercurial repository.<br />
<br />
You can try this package if you want to contribute code to OSS or if only a very recent change in OSS code introduced support to your sound device.<br />
<br />
If you want oss to take care of your flash sound you will need to install libflashsupport:<br />
<br />
# pacman -S libflashsupport</div>Blohttps://wiki.archlinux.org/index.php?title=Open_Sound_System&diff=80466Open Sound System2009-10-26T10:28:53Z<p>Blo: /* Firefox >=3.5 */</p>
<hr />
<div>[[Category:Audio/Video (English)]]<br />
[[Category:HOWTOs (English)]]<br />
{{i18n_links_start}}<br />
{{i18n_entry|English|OSS}}<br />
{{i18n_entry|简体中文|OSS (简体中文)}}<br />
{{i18n_entry|Français|OSS (Français)}}<br />
{{i18n_entry|Türkçe|OSS (Türkçe)}}<br />
{{i18n_links_end}}<br />
<br />
= Introduction =<br />
The [http://developer.opensound.com Open Sound System] is a [http://4front-tech.com commercially-supported] sound architecture that works on several UNIX-like and POSIX-compatible systems, including Linux, FreeBSD, Solaris and BeOS/Haiku.<br />
<br />
Please note that this article is not about the old OSS, which is included in the Linux kernel sources and is more than 10 years old by now.<br />
<br />
This article is about the new OSS versions (often called OSSv4). These versions were previously proprietary - OSS became open source again in July 2007, and is currently available under GPL, BSD or CDDL licenses.<br />
<br />
= Advantages and disadvantages vs. ALSA =<br />
<br />
== Advantages over ALSA (for users) ==<br />
* Includes a transparent software mixer (vmix) in kernel space. This means multiple applications can access the sound device at the same time without problems.<br />
* The vmix mixer controls allow you to adjust the volume of each application individually.<br />
* Better support for some sound card models, for example for the Creative X-Fi.<br />
* Sound quality is usually better. '''reference needed to validate this statement'''<br />
* Better support for applications written for the OSS API, of course. The OSS API is widely spread and a lot of applications support it. The ALSA's OSS API emulation, however, is often buggy.<br />
<br />
== Advantages over ALSA (for developers) ==<br />
* Cleaner and easier to use API.<br />
* API is much better [http://manuals.opensound.com/developer documented].<br />
* Support for sound drivers in the userspace (oss_userdev).<br />
* Portability across all supported platforms. If the application works using OSS under Linux, it will work under FreeBSD and Solaris too, for example.<br />
* Portability across operating systems. It's [http://revolf.free.fr/Alchimie-7/Alchimie7_OSS_Haiku.en.pdf easier] to port OSS to a new operating system.<br />
<br />
== Disadvantages vs. ALSA ==<br />
* USB audio devices support is currently experimental and USB recording is not implemented.<br />
* Bluetooth audio devices are currently not supported.<br />
* AC'97 and HDAudio dial-up soft-modems (for example Si3055) are currently not supported.<br />
* MIDI support is currently not finished. However, you can still use MIDI with a software synthesizer like timidity or fluidsynth.<br />
* Suspend is currently not supported. You need to unload OSS (by using {{Codeline|soundoff}}) before suspending, and to reload OSS (by using {{Codeline|soundon}}) after resuming.<br />
* Automatic jack sensing currently doesn't work properly with '''some''' HDAudio-powered motherboards. This means that, depending on your motherboard model, you may have to manually switch off your speakers when plugging your earphone.<br />
<br />
= Installing =<br />
<br />
Disable ALSA by blocking the <tt>soundcore</tt> module in {{Filename|/etc/rc.conf}}, then reboot:<br />
<br />
MODULES=(!soundcore ..............<br />
<br />
Install OSS by running:<br />
<br />
# pacman -S oss<br />
<br />
Be sure the user is part of the audio group:<br />
<br />
# gpasswd -a USERNAME audio<br />
<br />
Start OSS by running:<br />
<br />
# /etc/rc.d/oss start<br />
<br />
Add <tt>oss</tt> to your <tt>DAEMONS</tt> variable at {{Filename|/etc/rc.conf}}, so OSS is loaded automatically at each boot.<br />
<br />
In the case OSS is not able to detect your card when starting it, run :<br />
<br />
# ossdetect -v<br />
<br />
Then {{Codeline|soundoff && soundon}} to reactivate it.<br />
<br />
= Testing =<br />
<br />
You can test OSS by running:<br />
<br />
$ osstest<br />
<br />
{{Note| Beware the default volume is very loud. Avoid using earphones or lower the volume by using <tt>ossxmix</tt>. }}<br />
<br />
You should be able to hear music during the test process. If there is no audio, try to adjust the mixer as explained in the following sections and/or read the Troubleshooting sections.<br />
<br />
= Volume control =<br />
<br />
To control the volume of various devices, mixers levels will need to be set. The command line mixer is called <tt>ossmix</tt>. It's very like the BSD audio mixer (<tt>mixerctl</tt>).<br />
<br />
A graphical mixer, is available too. It's called <tt>ossxmix</tt>. It needs the optional depend <tt>gtk2</tt> to work.<br />
<br />
The <tt>ossxmix</tt> controls are explained in the following example:<br />
<br />
______________________________<br />
/ High Definition Audio ALC262 \ ----------------------------------> One tab for each sound card<br />
/________________________________\_______________________________<br />
|<br />
| [x] vmix0-enable [vmix0-rate: 48.000kHz] vmix0-channels \ The vmix (virtual mixer) special configurations<br />
| [ Stereo [v] ] |--> appear at the top. These include sampling rate<br />
| / and mixer priority. They are provided by OSS.<br />
| __codec1______________________________________________________ <br />
| | _jack_______________________________________________________ \ <br />
| | | _int-speaker____________________ __green_________________ |<br />
| | | | | | | These are your sound card configurations.<br />
| | | | _mode______ | | | | _mode______ | | | Every mixer control that is shown here is<br />
| | | | [ mix [v] ] o o [x] [ ]mute | | [ mix [v] ] o o [x] |--> provided by your sound card. Every sound card<br />
| | | | | | | | | | | specific control is shown here.<br />
| | | |________________________________| |_______________________ |<br />
| | |____________________________________________________________ |<br />
| |______________________________________________________________ /<br />
|<br />
| ___vmix0_______________________________________________________ \<br />
| | __mocp___ O O _firefox_ O O __pcm7___ O O | Here are the vmix mixer controls. These are<br />
| | | | O O | | x x | | O O | virtual mixer controls provided by OSS. Each<br />
| | | | | | x O | | | | x x | | | | O O | slider is the volume control of a different<br />
| | | o o [x] | x x | o o [x] | x x | o o [x] | O O |--> application. When one application uses the<br />
| | | | | | x x | | | | x x | | | | O O | sound card, its name is shown in the place of<br />
| | |_________| x x |_________| x x |_________| O O | the 'pcm#' labels. There are also sound level<br />
| |______________________________________________________________ | meter levels for each application.<br />
|________________________________________________________________ /<br />
<br />
=== Jack Definitions ===<br />
For high definition audio, ossxmix will highlight the jacks to their corresponding plug color. For 5.1 surround sound the [http://en.wikipedia.org/wiki/Audio_and_video_connector jack colors] are: <br />
{| border="1"<br />
|-<br />
! Connector Type<br />
! Purpose<br />
! OSS<br />
|- style=color:black;background:lightgreen<br />
|green TRS 3.5mm<br />
| stereo output, front channels<br />
|front<br />
|- style=color:white;background:black <br />
|black TRS 3.5mm<br />
| stereo output, rear channels<br />
|rear<br />
|- style=color:white;background:gray<br />
|grey TRS 3.5mm<br />
| stereo output, side channels<br />
|side<br />
|- style=color:black;background:gold<br />
|gold TRS 3.5mm<br />
| dual output, center and subwoofer<br />
|center/LFE<br />
|- style=color:black;background:lightblue<br />
|blue TRS 3.5mm<br />
| stereo input, line level<br />
|input<br />
|- style=color:black;background:pink <br />
|pink TS 3.5mm<br />
| mono microphone input<br />
|input<br />
|}<br />
For the most part and for most people just make sure that:<br />
# All green jacks (green and fp-green) are "front" and 75% from max volume.<br />
# All pink jacks (pink and fp-pink) are input and 50% of max to avoid distortion.<br />
<br />
== Other Mixers ==<br />
<br />
Other desktop environments may have support for OSS:<br />
<br />
* Gnome - Gnome Volume Control has support for OSS. Some users report that using Gnome Volume Control is easier to setup than <tt>ossxmix</tt>.<br />
* KDE - Kmix now has preliminary support for OSS.<br />
<br />
== Saving and restoring mixer settings ==<br />
<br />
If you wish to save your mixer settings manually, run {{Codeline|savemixer}}. As regular user you will need permissions to use {{Codeline|/usr/sbin/savemixer}} in the sudoers file or you can modify write permissions to {{Filename|/usr/lib/oss/etc/mixer.save}}. Alternately, the <tt>-f</tt> switch can be used to save the mixer to a file and {{Codeline|savemixer -L}} to restore it.<br />
<br />
Please note that the init scripts run these commands before shutdown/after starting to keep mixer settings across boot, so most users don't need to worry about it.<br />
<br />
= Configuring Applications for OSS =<br />
<br />
== Skype ==<br />
<br />
The <tt>skype</tt> package only includes support for ALSA. To get an OSS-capable Skype, install the <tt>skype-oss</tt> package:<br />
<br />
# pacman -S skype-oss<br />
<br />
If you are using x86_64, you can get the [http://aur.archlinux.org/packages.php?ID=18312 bin32-skype-oss] package from AUR.<br />
<br />
== Wine ==<br />
<br />
* Run <tt>winecfg</tt>.<br />
<br />
$ winecfg<br />
<br />
* Go to the <tt>Audio</tt> tab.<br />
<br />
* Select <tt>OSS Driver</tt>.<br />
<br />
== Gajim ==<br />
By default Gajim uses {{Codeline|aplay -q}} to play a sound. To change this go in Advanced Settings and search for the {{Codeline|soundplayer}} variable. The ossplay program included in the oss package is a good replacement:<br />
<br />
{{Codeline|ossplay -qq}}<br />
<br />
== MOC ==<br />
<br />
To use MOC with OSS v4.1 you must change section OSSMixerDevice to OSSMixerDevice= /dev/ossmix in your config (located in /home/yourusername/.moc).<br />
And now MOC should work with OSS v4.1.<br />
Or you can compile moc-svn package from AUR (he got support for new vmix).<br />
For issue with interface change OSSMixerChannel = to OSSMixerChannel = Any channel and after start mocp press w (change to sofware mixex) that will help and you can change the volume power.<br />
<br />
== Applications that use Gstreamer ==<br />
<br />
Remove pulseaudio and gstreamer*-pulse programs and libraries.<br />
<br />
To change the gstreamer setting to output the sound to OSS instead of the default ALSA, run:<br />
<br />
gstreamer-properties<br />
<br />
Change the '''Default Output''' plugin to custom and the change the pipeline to:<br />
<br />
oss4sink<br />
<br />
For the input:<br />
<br />
oss4src<br />
<br />
{{Note|It's not certain that the input will sound better with oss4src compared to osssrc, so change this only if it improves your input sound. < confirmation on this please >}}<br />
<br />
If you are using phonon with the gstreamer backend you will need to set the environmental variable. To add to your current user:<br />
<br />
export PHONON_GST_AUDIOSINK=oss4sink<br />
<br />
Add this to your {{Filename|~/.bashrc}} to be loaded on login.<br />
<br />
== Firefox >=3.5 ==<br />
<br />
Firefox 3.5 introduces the <video> and <audio> tag support and can play ogg media out of the box. However, it currently can't be compiled with ALSA and OSS support at the same time. So you need to install the [http://aur.archlinux.org/packages.php?ID=28110 xulrunner-oss] package.<br />
<br />
1. Stop firefox.<br />
2. Remove the xulrunner package without dependency check: sudo pacman -Rd xulrunner<br />
3. Install xulrunner-oss package from AUR using yaourt or [http://wiki.archlinux.org/index.php/ABS ABS].<br />
4. Start firefox.<br />
<br />
== Other applications ==<br />
<br />
* If you can't get sound from an application not listed here, try looking at the [http://www.4front-tech.com/wiki/index.php/Configuring_Applications_for_OSSv4 Configuring Applications for OSSv4] page.<br />
* Search OSS specific packages by using {{Codeline|pacman -Ss -- '-oss'}} and [http://aur.archlinux.org/packages.php?K=-oss&start=0&PP=100| in AUR].<br />
<br />
= Troubleshooting =<br />
<br />
== Troubleshooting HDAudio devices ==<br />
<br />
=== Understanding why problems arise ===<br />
<br />
If you have a HDAudio sound device, it's very likely that you will have to adjust some mixer settings before your sound works.<br />
<br />
HDAudio devices are very powerful in the sense that they can contain a lot of small circuits (called ''widgets'') that can be adjusted by software at any time. These controls are exposed to the mixer, and they can be used, for example, to turn the earphone jack into a sound input jack instead of a sound output jack.<br />
<br />
However, there is a side effect, mainly because the HDAudio standard is more flexible than it perhaps should be, and because the vendors often only care to get their ''official drivers'' working.<br />
<br />
Then, when using HDAudio devices, you often find disorganized mixer controls, that doesn't work at all by default, and you are forced to try every mixer control combination, until it works.<br />
<br />
=== How to solve ===<br />
<br />
Open <tt>ossxmix</tt> and try to change every mixer control in the ''middle area'', that contains the sound card specific controls, as explained in the previous "[[OSS#The_mixer|The mixer]]" section.<br />
<br />
You'll probably want to setup a program to record/play continously in the background (e.g. {{Codeline|ossrecord - | ossplay -}} for recording or {{Codeline|osstest -lV}} for playing), while changing mixer settings in ossxmix in the foreground.<br />
<br />
* Raise every volume control slider.<br />
* In each option box, try to change the selected option, trying all the possible combinations.<br />
* If you get noise, try to lower and/or mute some volume controls, until you find the source of the noise.<br />
<br />
Please note again that you do '''not''' need to change any controls in the ''top area'' nor in the ''bottom area'', as they are virtual <tt>vmix</tt>-related mixer controls.<br />
<br />
* Editing {{Codeline|/usr/lib/oss/conf/oss_hdaudio.conf}} uncommenting and changing ''hdaudio_noskip=0'' to a value from 0-7 can give you more jack options in ossxmix<br />
I had to edit mine to ''hdaudio_noskip=7'' for my sub/rear speaker to work on my laptop, restart oss for the changes to take effect {{Codeline|/etc/rc.d/oss restart}}<br />
<br />
== MMS sound cracking in totem ==<br />
If your stream sounds with cracks or strange noise in totem like it did with me then you could try to play it with another backend like ffmpeg (mplayer). That "fixed" the issue for me. This will not fix the issue that somehow pops up in gstreamer when playing MMS streams but it will give you the option to play it with good sound quality. Playing it in mplayer is simple:<br />
# mplayer mmsh://yourstreamurl<br />
<br />
== Microphone playing through output channels ==<br />
<br />
OSS by default plays back the microphone through the speakers. To disable this in ossxmix find the misc section. Check off every "input-mix-mute" to disable this.<br />
<br />
== Troubleshooting other issues ==<br />
<br />
* If you get distorted sound, try lowering some volume control sliders.<br />
<br />
* If you need to change the default sound card, look at [http://www.opensound.com/wiki/index.php/Tips_And_Tricks#Changing_the_default_sound_output here].<br />
<br />
* If you have another issues, try searching or asking for help at the [http://www.4front-tech.com/forum 4front forums].<br />
<br />
= Tips and Tricks =<br />
<br />
== Using multimedia keys with OSS ==<br />
An easy way to mute/unmute and increase/decrease the volume is to use the [http://www.opensound.com/wiki/index.php/Tips_And_Tricks#ossvol {{Codeline|ossvol}} script] available in [[AUR]].<br />
<br />
Once you installed it try to toggle the sound:<br />
$ ossvol -t<br />
<br />
Type {{Codeline|ossvol -h}} for the other commands.<br />
<br />
If you don't know how to assign commands to your multimedia keys, see [[Extra Keyboard Keys]].<br />
<br />
==={{Codeline|ossvol}} troubleshooting===<br />
If you get an error like:<br />
Bad mixer control name(987) 'vol'<br />
you need to edit the script ({{Filename|/usr/bin/ossvol}}) and change the value of the {{Codeline|CHANNEL}} variable which is at the beginning of the script. For example mine is {{Codeline|CHANNEL<nowiki>=</nowiki>"vmix0-outvol"}}.<br />
<br />
*'''Note''' if you are using xbindkeys for your multimedia keys adding this<br />
"ossmix vmix0-outvol -- +1"<br />
raise volume<br />
"ossmix vmix0-outvol -- -1"<br />
lower volume<br />
<br />
to the raise/lower volume section of your .xbindkeysrc file is an easy way to adjust the volume<br />
<br />
== Changing the Sample Rate ==<br />
<br />
Changing the output sample rate is not obvious at first. Sample rates can only be changed by the superuser and vmix must be unused by any programs when a change is requested. Before you follow any of these steps, ensure you are going through a receiver/amplifier and using quality speakers and not simply computer speakers. If you are only using computer speakers, don't bother changing anything here as you won't notice a difference.<br />
<br />
By default the sample rate is 48000hz. There are several conditions in which you may want to change this. This all depends on your usage patterns. You want the sample rate you are using to match the media you use the most. If your computer has to change the sampling rate of the media to suit the hardware it is likely, though not guaranteed that you will have a loss in audio quality. This is most noticable in downsampling (ie. 96000hz &rarr; 48000hz). There is an article about this issue in [http://www.stereophile.com/news/121707lucky/ "Stereophile"] which was [http://lists.apple.com/archives/coreaudio-api/2008/Jan/msg00272.html discussed] on Apple's "CoreAudio API" mailing list if you wish to learn more about this issue. <br />
<br />
Some example sample rates:<br />
<br />
* 44100hz - Sample rate of standard [http://en.wikipedia.org/wiki/Red_Book_%28audio_CD_standard%29 Red Book] audio cds.<br />
* 88000hz - Sample rate of [http://en.wikipedia.org/wiki/Super_Audio_CD SACD] high definition audio discs/downloads. It is rare that your motherboard will support this sample rate.<br />
* 96000hz - Sample rate of most high definition audio downloads. If your motherboard is an [http://en.wikipedia.org/wiki/AC%2797 AC'97] motherboard, this is likely to be your highest bitrate.<br />
* 192000hz - Sample rate of BluRay, and some (very few) high definition downloads. Support for external audio reciever equipment is limited to high end audio. Not all motherboards support this. An example of a motherboard chipset that would support this includes [http://en.wikipedia.org/wiki/Intel_High_Definition_Audio Intel HDA audio]. <br />
<br />
To check what your sample rate is currently set to:<br />
<br />
# Run <code>"ossmix | grep rate"</code>. <br />
<br />
You are likely to see <code>"vmix0-rate <decimal value> (currently 48000) (Read-only)"</code>.<br />
<br />
If you do not see a "vmix0-rate" (or "vmix1-rate", etc.) being outputted, than it probably means that vmix is disabled. In that case, OSS will use the rate requested by the program which uses the device, so this section doesn't apply. Exception: envy24(ht) cards have a setting envy24.rate which has a similiar function (see "oss_envy24" manpage). You can follow these steps, but at step 2, change with ossmix the value of "envy24.rate" as well.<br />
<br />
Steps to affect the change:<br />
<br />
# First, make sure your card is able to use the new rate. Run "ossinfo -v2" and see if the wanted rate is in the "Native sample rates" output.<br />
# As root, run <code>"/usr/lib/oss/scripts/killprocs.sh"</code>. Be aware, this will close any program that currently has an open sound channel (examples being media players, Firefox as of 3.5 if you have xulrunner-oss installed, and the gnome volume control).<br />
# After all programs occupying vmix are terminated, run as root: <code>"vmixctl rate /dev/dsp 96000"</code> replacing the rate with your desired sample rate.<br />
# Run <code>"ossmix | grep rate"</code> and check for <code>"vmix0-rate <decimal value> (currently 96000) (Read-only)"</code> to see if you were successful.<br />
<br />
== Start ossxmix docked to systray on startup ==<br />
<br />
'''KDE 4'''<br />
<br />
Create an application launcher file named <code>ossxmix.desktop</code> in you local application launchers directory (<code>~/.local/share/applications/</code> then enter:<br />
<br />
<pre>[Desktop Entry]<br />
Name=Open Sound System Mixer<br />
GenericName=Audio Mixer<br />
Exec=ossxmix -b<br />
Icon=audio-card<br />
Categories=Application;GTK;AudioVideo;Player;<br />
Terminal=false<br />
Type=Application<br />
Encoding=UTF-8</pre><br />
<br />
To add it to autostart when loading the desktop environment:<br />
<br />
System Settings > Advanced tab > Autostart. Then click add program and choose it from the 'Multimedia' list.<br />
<br />
'''Gnome''' <br />
<br />
*As Root create a file /usr/local/bin/ossxmix_bg with the following content:<br />
<br />
<pre><br />
#!/bin/bash<br />
exec /usr/bin/ossxmix -b<br />
</pre><br />
<br />
Goto System > Preferences > Start Up Applications<br />
<br />
*Click Add, Type OSSMIX in Name field and <code>/usr/local/bin/ossxmix_bg</code> in Command field then click Add button.<br />
<br />
*Login and Logout to see the changes.<br />
<br />
== Record sound output from a program ==<br />
<br />
* [http://www.opensound.com/wiki/index.php/Tips_And_Tricks#Recording_sound_output_of_a_program Recording sound output of a program].<br />
<br />
== Suspend and Hibernation ==<br />
<br />
OSS does not automatically support suspend meaning that OSS must be manually stopped prior to suspending or hibernating.<br />
<br />
OSS provides <tt>soundon</tt> and <tt>soundoff</tt> to enable and disable OSS, although any processes that use sound must be terminated first.<br />
<br />
The following script is a rather basic method of automatically unloading OSS prior to suspending and reloading afterwards.<br />
<br />
#!/bin/sh<br />
. "${PM_FUNCTIONS}"<br />
<br />
suspend_osssound()<br />
{<br />
/usr/lib/oss/scripts/killprocs.sh<br />
/usr/sbin/soundoff<br />
}<br />
<br />
resume_osssound()<br />
{<br />
/usr/sbin/soundon<br />
}<br />
<br />
case "$1" in<br />
hibernate|suspend)<br />
suspend_osssound<br />
;;<br />
thaw|resume)<br />
resume_osssound<br />
;;<br />
*) exit $NA<br />
;;<br />
esac<br />
<br />
Save the contents of the script (as root) into {{Filename|/etc/pm/sleep.d/50ossound}} and make it executable. {{Filename| chmod a+x /etc/pm/sleep.d/50ossound}}<br />
<br />
{{Note|This script is rather basic and will terminate any application directly accessing OSS, save your work prior to suspending/hibernating.}}<br />
<br />
== ALSA emulation ==<br />
<br />
=== Introduction ===<br />
<br />
You can instruct <tt>alsa-lib</tt> to use OSS as its audio output system. This works as a sort of ALSA emulation.<br />
<br />
Note, however, that this method may introduce additional latency in your sound output, and that the emulation is not complete and doesn't work with all applications. It doesn't work, for example, with programs that try to detect devices using ALSA.<br />
<br />
So, as most applications support OSS directly, use this method only as a last resort.<br />
<br />
In the future, more complete methods may be available for emulating ALSA, such as <tt>libsalsa</tt> and <tt>cuckoo</tt>.<br />
<br />
=== HOW-TO ===<br />
<br />
* Install the <tt>alsa-plugins</tt> package.<br />
<br />
# pacman -S alsa-plugins<br />
<br />
* Edit {{Filename|/etc/asound.conf}} as follows.<br />
<br />
pcm.oss {<br />
type oss<br />
device /dev/dsp<br />
}<br />
<br />
pcm.!default {<br />
type oss<br />
device /dev/dsp<br />
}<br />
<br />
ctl.oss {<br />
type oss<br />
device /dev/mixer<br />
}<br />
<br />
ctl.!default {<br />
type oss<br />
device /dev/mixer<br />
}<br />
<br />
{{Note | If you don't want to use OSS anymore, don't forget to revert changes that you do here in {{Filename|/etc/asound.conf}}.}}<br />
<br />
= Experimental packages =<br />
<br />
== Mercurial repository version ==<br />
<br />
There is a [http://aur.archlinux.org/packages.php?ID=21126 oss-mercurial package] in AUR. This package compiles and installs the latest OSS development version direcly from the Mercurial repository.<br />
<br />
You can try this package if you want to contribute code to OSS or if only a very recent change in OSS code introduced support to your sound device.<br />
<br />
If you want oss to take care of your flash sound you will need to install libflashsupport:<br />
<br />
# pacman -S libflashsupport</div>Blohttps://wiki.archlinux.org/index.php?title=CDemu&diff=76927CDemu2009-10-02T20:24:23Z<p>Blo: </p>
<hr />
<div>[[Category:HOWTOs (English)]]<br />
[[Category:Utilities (English)]]<br />
<br />
'''About'''<br />
<br />
[http://cdemu.sourceforge.net/ CDemu] enables you to use disc images that contain more than a standard ISO-9660 filesystem, like .bin/.cue, .nrg, or .ccd images. It's needed only because <tt>mount</tt> can only directly handle .iso disc images, which can only contain a single filesystem, but many CDs have multiple sessions, mixed data/audio tracks, etc. In short you can mount nearly any kind of image file with ease using cdemu.<br />
<br />
'''Installing CDemu:'''<br />
<br />
$ pacman -S cdemu-client<br />
<br />
This will install the dependencies as well.<br />
<br />
$ modprobe vhba<br />
<br />
edit /etc/conf.d/cdemud<br />
<br />
$ /etc/rc.d/cdemud start<br />
<br />
If you want start cdemu at boot add vhba to the modules and cdemud to the daemons section in /etc/rc.conf.<br />
<br />
'''Using CDemu:'''<br />
[From man]<br />
<br />
Loading a single image to first device:<br />
cdemu load 0 ~/image.mds<br />
<br />
Loading multiple-file image to first device:<br />
cdemu load 0 ~/session1.toc ~/session2.toc ~/session3.toc<br />
<br />
Loading a text-based image in non-ASCII/non-Unicode encoding:<br />
cdemu load 0 ~/image.cue --encoding=windows-1250<br />
<br />
Loading an encrypted image with password provided as an argument:<br />
cdemu load 0 ~/image.daa --password=seeninplain<br />
<br />
Unloading first device:<br />
cdemu unload 0<br />
<br />
Displaying device status:<br />
cdemu status<br />
<br />
Displaying device mapping information:<br />
cdemu device-mapping<br />
<br />
Setting daemon debug mask for the first device:<br />
cdemu daemon-debug-mask 0 0x01<br />
<br />
Obtaining library debug mask for the first device:<br />
cdemu library-debug-mask 0<br />
<br />
Disabling DPM emulation on all devices:<br />
cdemu dpm-emulation all 0<br />
<br />
Enabling transfer rate emulation on first device:<br />
cdemu tr-emulation 0 1<br />
<br />
Changing device ID of first device:<br />
cdemu device-id 0 "MyVendor" "MyProduct" "1.0.0" "Test device ID"<br />
<br />
Enumerating supported parsers:<br />
cdemu enum-supported-parsers<br />
<br />
Enumerating supported fragments:<br />
cdemu enum-supported-fragments<br />
<br />
Enumerating supported daemon debug masks:<br />
cdemu enum-daemon-debug-masks<br />
<br />
Enumerating supported library debug masks:<br />
cdemu enum-library-debug-masks<br />
<br />
Displaying daemon and library version:<br />
cdemu version<br />
--[[User:Blo|Blo]] 16:24, 2 October 2009 (EDT)</div>Blohttps://wiki.archlinux.org/index.php?title=CDemu&diff=76925CDemu2009-10-02T20:22:29Z<p>Blo: </p>
<hr />
<div>[[Category:HOWTOs (English)]]<br />
[[Category:Utilities (English)]]<br />
<br />
'''About'''<br />
<br />
[http://cdemu.sourceforge.net/ CDemu] enables you to use disc images that contain more than a standard ISO-9660 filesystem, like .bin/.cue, .nrg, or .ccd images. It's needed only because <tt>mount</tt> can only directly handle .iso disc images, which can only contain a single filesystem, but many CDs have multiple sessions, mixed data/audio tracks, etc. In short you can mount nearly any kind of image file with ease using cdemu.<br />
<br />
'''Installing CDemu:'''<br />
<br />
$ pacman -S cdemu-client<br />
<br />
This will install the dependencies as well.<br />
<br />
$ modprobe vhba<br />
<br />
edit /etc/conf.d/cdemud<br />
<br />
$ /etc/rc.d/cdemud start<br />
<br />
If you want start cdemu at boot add vhba to the modules and cdemud to the daemons section in /etc/rc.conf.<br />
<br />
'''Using CDemu:'''<br />
[From man]<br />
<br />
Loading a single image to first device:<br />
cdemu load 0 ~/image.mds<br />
<br />
Loading multiple-file image to first device:<br />
cdemu load 0 ~/session1.toc ~/session2.toc ~/session3.toc<br />
<br />
Loading a text-based image in non-ASCII/non-Unicode encoding:<br />
cdemu load 0 ~/image.cue --encoding=windows-1250<br />
<br />
Loading an encrypted image with password provided as an argument:<br />
cdemu load 0 ~/image.daa --password=seeninplain<br />
<br />
Unloading first device:<br />
cdemu unload 0<br />
<br />
Displaying device status:<br />
cdemu status<br />
<br />
Displaying device mapping information:<br />
cdemu device-mapping<br />
<br />
Setting daemon debug mask for the first device:<br />
cdemu daemon-debug-mask 0 0x01<br />
<br />
Obtaining library debug mask for the first device:<br />
cdemu library-debug-mask 0<br />
<br />
Disabling DPM emulation on all devices:<br />
cdemu dpm-emulation all 0<br />
<br />
Enabling transfer rate emulation on first device:<br />
cdemu tr-emulation 0 1<br />
<br />
Changing device ID of first device:<br />
cdemu device-id 0 "MyVendor" "MyProduct" "1.0.0" "Test device ID"<br />
<br />
Enumerating supported parsers:<br />
cdemu enum-supported-parsers<br />
<br />
Enumerating supported fragments:<br />
cdemu enum-supported-fragments<br />
<br />
Enumerating supported daemon debug masks:<br />
cdemu enum-daemon-debug-masks<br />
<br />
Enumerating supported library debug masks:<br />
cdemu enum-library-debug-masks<br />
<br />
Displaying daemon and library version:<br />
cdemu version</div>Blohttps://wiki.archlinux.org/index.php?title=CDemu&diff=76924CDemu2009-10-02T20:22:03Z<p>Blo: </p>
<hr />
<div>[[Category:HOWTOs (English)]]<br />
[[Category:Utilities (English)]]<br />
{{i18n_links_start}}<br />
{{i18n_entry|English|CDemu}}<br />
{{i18n_entry|简体中文|CDemu虚拟光驱}}<br />
{{i18n_links_end}}<br />
<br />
'''About'''<br />
<br />
[http://cdemu.sourceforge.net/ CDemu] enables you to use disc images that contain more than a standard ISO-9660 filesystem, like .bin/.cue, .nrg, or .ccd images. It's needed only because <tt>mount</tt> can only directly handle .iso disc images, which can only contain a single filesystem, but many CDs have multiple sessions, mixed data/audio tracks, etc. In short you can mount nearly any kind of image file with ease using cdemu.<br />
<br />
'''Installing CDemu:'''<br />
<br />
$ pacman -S cdemu-client<br />
<br />
This will install the dependencies as well.<br />
<br />
$ modprobe vhba<br />
<br />
edit /etc/conf.d/cdemud<br />
<br />
$ /etc/rc.d/cdemud start<br />
<br />
If you want start cdemu at boot add vhba to the modules and cdemud to the daemons section in /etc/rc.conf.<br />
<br />
'''Using CDemu:'''<br />
[From man]<br />
<br />
Loading a single image to first device:<br />
cdemu load 0 ~/image.mds<br />
<br />
Loading multiple-file image to first device:<br />
cdemu load 0 ~/session1.toc ~/session2.toc ~/session3.toc<br />
<br />
Loading a text-based image in non-ASCII/non-Unicode encoding:<br />
cdemu load 0 ~/image.cue --encoding=windows-1250<br />
<br />
Loading an encrypted image with password provided as an argument:<br />
cdemu load 0 ~/image.daa --password=seeninplain<br />
<br />
Unloading first device:<br />
cdemu unload 0<br />
<br />
Displaying device status:<br />
cdemu status<br />
<br />
Displaying device mapping information:<br />
cdemu device-mapping<br />
<br />
Setting daemon debug mask for the first device:<br />
cdemu daemon-debug-mask 0 0x01<br />
<br />
Obtaining library debug mask for the first device:<br />
cdemu library-debug-mask 0<br />
<br />
Disabling DPM emulation on all devices:<br />
cdemu dpm-emulation all 0<br />
<br />
Enabling transfer rate emulation on first device:<br />
cdemu tr-emulation 0 1<br />
<br />
Changing device ID of first device:<br />
cdemu device-id 0 "MyVendor" "MyProduct" "1.0.0" "Test device ID"<br />
<br />
Enumerating supported parsers:<br />
cdemu enum-supported-parsers<br />
<br />
Enumerating supported fragments:<br />
cdemu enum-supported-fragments<br />
<br />
Enumerating supported daemon debug masks:<br />
cdemu enum-daemon-debug-masks<br />
<br />
Enumerating supported library debug masks:<br />
cdemu enum-library-debug-masks<br />
<br />
Displaying daemon and library version:<br />
cdemu version</div>Blohttps://wiki.archlinux.org/index.php?title=Nginx&diff=76468Nginx2009-09-25T13:40:45Z<p>Blo: /* Tips */</p>
<hr />
<div>[[Category:Networking (English)]]<br />
[[Category:HOWTOs (English)]]<br />
[[Category:Web Server (English)]]<br />
<br />
==Summary==<br />
Nginx (pronounced "engine X") written by Igor Sysoev (Russia) in 2005, is a free, open-source, high-performance HTTP server and reverse proxy, as well as an IMAP/POP3 proxy server. According to the ''[http://news.netcraft.com/archives/2009/06/17/june_2009_web_server_survey.html June 2009 Web Server Survey from Netcraft]'', nginx now hosts nearly 3.37% of all domains worldwide, while lighttpd hosts about 1.8%. Nginx is now well known for its stability, rich feature set, simple configuration, and low resource consumption.<br />
<br />
==Installation ==<br />
The nginx package is now in the [community] repository, the latest stable version is nginx-0.6.34:<br />
# pacman -S nginx<br />
or you can compile and install the latest development version with ABS.<br />
<br />
==Starting service ==<br />
Run<br />
# /etc/rc.d/nginx start<br />
to start working. The default main page is /srv/www/nginx/html/index.html. Now you can use this URL: <nowiki>http://127.0.0.1</nowiki> to test if nginx is working.<br />
<br />
To enable service by default at startup just add "nginx" to the DAEMONS in the /etc/rc.conf.<br />
<br />
==Configuring ==<br />
You can modify the configurations by editing the files in /etc/nginx. (/etc/nginx/nginx.conf being the main config file) . <br />
<br />
More details can be referred from [http://wiki.codemongers.com/NginxConfiguration Nginx Configuration Examples].<br />
<br />
===Use PHP/Python with nginx ===<br />
FastCGI technology is introduced into nginx to work with many external tools and servers, ie: PHP and Python. So, you cannot use PHP or Python service unless FastCGI server has been started. <br />
<br />
PHP and Python can be run as FastCGI application and can process FastCGI requests from nginx.<br />
<br />
'''Step 1: Start the FastCGI server'''<br><br />
There are two different ways to run FastCGI server: <br />
<br />
1) Directly running PHP’s built-in FastCGI server - this method don’t require any third party tools. <br><br />
Archlinux's '''''php''''' package in the [extra] repository has already enabled FastCGI support.<br><br />
For example:<br />
$ sudo pacman -S php php-cgi<br />
$ php-cgi -b 127.0.0.1:9000 &<br />
This command make the local machine as a FastCGI server using port 9000.<br />
<br />
'''Note:''' Sometimes, you'll need to modify something in the /etc/php/php.ini, and then php-cgi should be restarted. <br />
<br />
2) Running PHP inside some third-party wrapper - it can be more comfortable than first method because of more flexibility. You can install ''fcgi''(which includes ''cgi-fcgi''), ''lighttpd'' (which includes ''spawn-fcgi''), and '''''PHP-FPM ''''' (PHP FastCGI Process Manager, which is now in the AUR. Recommend.)<br><br />
For example:<br />
# cgi-fcgi -start -connect localhost:9000 /usr/bin/php-cgi<br />
<br />
# spawn-fcgi -a 127.0.0.1 -p 9000 -C 9 -f /usr/bin/php-cgi<br />
<br />
# php --fpm -b 127.0.0.1:9000<br />
<br />
'''Note:''' You may need to edit /etc/php-fpm.conf at first. More details about php-fpm can be referred from '''[http://php-fpm.anight.org/ php-fpm website]'''<br />
<br />
'''Note:''' Sometimes, you may encounter some permission issue when running some third party software to start PHP as FastCGI-server. See '''[[Nginx#Tips|Tips]]'''.<br />
<br />
<br />
'''Step 2: Edit /etc/nginx/conf/nginx.conf'''<br><br />
Comment out some lines and edit in the file to be as follows:<br />
location ~ \.php$ {<br />
root html;<br />
fastcgi_pass 127.0.0.1:9000;<br />
fastcgi_index index.php;<br />
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;<br />
include fastcgi_params;<br />
}<br />
where "root html" and "$document_root" means nginx's root file directory (that is /srv/www/nginx/html/, and you can replace $document_root with that path). You can add this path to "open_basedir" line of the /etc/php/php.ini.<br />
<br />
'''Step 3: Restart nginx'''<br><br />
If nginx has been working, run<br />
# /etc/rc.d/nginx restart<br />
<br />
Edit /srv/www/nginx/html/index.php,<br />
<?php<br />
phpinfo();<br />
?> <br />
view the URL: <nowiki>http://localhost/index.php</nowiki> with your browser, and you'll find PHP has worked well with nginx.<br />
<br />
===Security ===<br />
* allow/deny based on IP <br />
[http://wiki.codemongers.com/NginxHttpAccessModule ngx_http_access_module]<br />
* HTTP authentication<br />
[http://wiki.codemongers.com/NginxHttpAuthBasicModule ngx_http_auth_basic_module]<br />
* HTTPS support<br />
[http://wiki.codemongers.com/NginxHttpSslModule ngx_http_ssl_module]<br />
<br />
==Tips==<br />
* Tuning the kernel for better speed<br />
Add the followings to /etc/sysctl.conf<br />
net.ipv4.tcp_fin_timeout = 30<br />
net.ipv4.tcp_keepalive_time = 300<br />
net.ipv4.tcp_syncookies = 1<br />
net.ipv4.tcp_tw_reuse = 1<br />
net.ipv4.tcp_tw_recycle = 1<br />
net.ipv4.ip_local_port_range = 5000 65000 <br />
and make it active:<br />
# /sbin/sysctl -p<br />
<br />
* The browser results in: '''the page you are looking for is temporarily unavailable. Please try again later. '''<br />
This is because the FastCGI server has not been started. <br />
<br />
* The browser results in: '''no input file specified'''<br />
If the configuration of nginx (fastcgi_param SCRIPT_FILENAME) is all right, this kind of error means php fail to load the requestd script. Usually it's simply an permission issue, you can just run php-cgi as root<br />
# spawn-fcgi -a 127.0.0.1 -p 9000 -f /usr/bin/php-cgi<br />
or you should create some group and user to start the php-cgi. For instance :<br />
$ sudo groupadd www<br />
$ sudo useradd -g www www<br />
$ sudo chmod +w /srv/www/nginx/html<br />
$ sudo chown -R www:www /srv/www/nginx/html<br />
$ sudo spawn-fcgi -a 127.0.0.1 -p 9000 -u www -g www -f /usr/bin/php-cgi<br />
<br />
Another occasion is that, wrong "root" argument in the "location ~ \.php$" section in nginx.conf, make sure the "root" points to the same diretory as it in "location /" in the same server. Or you may just set root as globle, don't define it in any location section.<br />
<br />
Also remine that your php script path was defaultly defined to /srv/www/nginx/html by argument "open_basedir" in /etc/php/php.ini, you can change them if you need.<br />
<br />
==References ==<br />
*[http://nginx.net/ Nginx Official site]<br />
*[http://wiki.codemongers.com/Main Nginx Wiki]<br />
*[http://calomel.org/nginx.html Nginx Howto]</div>Blohttps://wiki.archlinux.org/index.php?title=Nginx&diff=76467Nginx2009-09-25T13:40:19Z<p>Blo: /* Use PHP/Python with nginx */</p>
<hr />
<div>[[Category:Networking (English)]]<br />
[[Category:HOWTOs (English)]]<br />
[[Category:Web Server (English)]]<br />
<br />
==Summary==<br />
Nginx (pronounced "engine X") written by Igor Sysoev (Russia) in 2005, is a free, open-source, high-performance HTTP server and reverse proxy, as well as an IMAP/POP3 proxy server. According to the ''[http://news.netcraft.com/archives/2009/06/17/june_2009_web_server_survey.html June 2009 Web Server Survey from Netcraft]'', nginx now hosts nearly 3.37% of all domains worldwide, while lighttpd hosts about 1.8%. Nginx is now well known for its stability, rich feature set, simple configuration, and low resource consumption.<br />
<br />
==Installation ==<br />
The nginx package is now in the [community] repository, the latest stable version is nginx-0.6.34:<br />
# pacman -S nginx<br />
or you can compile and install the latest development version with ABS.<br />
<br />
==Starting service ==<br />
Run<br />
# /etc/rc.d/nginx start<br />
to start working. The default main page is /srv/www/nginx/html/index.html. Now you can use this URL: <nowiki>http://127.0.0.1</nowiki> to test if nginx is working.<br />
<br />
To enable service by default at startup just add "nginx" to the DAEMONS in the /etc/rc.conf.<br />
<br />
==Configuring ==<br />
You can modify the configurations by editing the files in /etc/nginx. (/etc/nginx/nginx.conf being the main config file) . <br />
<br />
More details can be referred from [http://wiki.codemongers.com/NginxConfiguration Nginx Configuration Examples].<br />
<br />
===Use PHP/Python with nginx ===<br />
FastCGI technology is introduced into nginx to work with many external tools and servers, ie: PHP and Python. So, you cannot use PHP or Python service unless FastCGI server has been started. <br />
<br />
PHP and Python can be run as FastCGI application and can process FastCGI requests from nginx.<br />
<br />
'''Step 1: Start the FastCGI server'''<br><br />
There are two different ways to run FastCGI server: <br />
<br />
1) Directly running PHP’s built-in FastCGI server - this method don’t require any third party tools. <br><br />
Archlinux's '''''php''''' package in the [extra] repository has already enabled FastCGI support.<br><br />
For example:<br />
$ sudo pacman -S php php-cgi<br />
$ php-cgi -b 127.0.0.1:9000 &<br />
This command make the local machine as a FastCGI server using port 9000.<br />
<br />
'''Note:''' Sometimes, you'll need to modify something in the /etc/php/php.ini, and then php-cgi should be restarted. <br />
<br />
2) Running PHP inside some third-party wrapper - it can be more comfortable than first method because of more flexibility. You can install ''fcgi''(which includes ''cgi-fcgi''), ''lighttpd'' (which includes ''spawn-fcgi''), and '''''PHP-FPM ''''' (PHP FastCGI Process Manager, which is now in the AUR. Recommend.)<br><br />
For example:<br />
# cgi-fcgi -start -connect localhost:9000 /usr/bin/php-cgi<br />
<br />
# spawn-fcgi -a 127.0.0.1 -p 9000 -C 9 -f /usr/bin/php-cgi<br />
<br />
# php --fpm -b 127.0.0.1:9000<br />
<br />
'''Note:''' You may need to edit /etc/php-fpm.conf at first. More details about php-fpm can be referred from '''[http://php-fpm.anight.org/ php-fpm website]'''<br />
<br />
'''Note:''' Sometimes, you may encounter some permission issue when running some third party software to start PHP as FastCGI-server. See '''[[Nginx#Tips|Tips]]'''.<br />
<br />
<br />
'''Step 2: Edit /etc/nginx/conf/nginx.conf'''<br><br />
Comment out some lines and edit in the file to be as follows:<br />
location ~ \.php$ {<br />
root html;<br />
fastcgi_pass 127.0.0.1:9000;<br />
fastcgi_index index.php;<br />
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;<br />
include fastcgi_params;<br />
}<br />
where "root html" and "$document_root" means nginx's root file directory (that is /srv/www/nginx/html/, and you can replace $document_root with that path). You can add this path to "open_basedir" line of the /etc/php/php.ini.<br />
<br />
'''Step 3: Restart nginx'''<br><br />
If nginx has been working, run<br />
# /etc/rc.d/nginx restart<br />
<br />
Edit /srv/www/nginx/html/index.php,<br />
<?php<br />
phpinfo();<br />
?> <br />
view the URL: <nowiki>http://localhost/index.php</nowiki> with your browser, and you'll find PHP has worked well with nginx.<br />
<br />
===Security ===<br />
* allow/deny based on IP <br />
[http://wiki.codemongers.com/NginxHttpAccessModule ngx_http_access_module]<br />
* HTTP authentication<br />
[http://wiki.codemongers.com/NginxHttpAuthBasicModule ngx_http_auth_basic_module]<br />
* HTTPS support<br />
[http://wiki.codemongers.com/NginxHttpSslModule ngx_http_ssl_module]<br />
<br />
==Tips==<br />
* Tuning the kernel for better speed<br />
Add the followings to /etc/sysctl.conf<br />
net.ipv4.tcp_fin_timeout = 30<br />
net.ipv4.tcp_keepalive_time = 300<br />
net.ipv4.tcp_syncookies = 1<br />
net.ipv4.tcp_tw_reuse = 1<br />
net.ipv4.tcp_tw_recycle = 1<br />
net.ipv4.ip_local_port_range = 5000 65000 <br />
and make it active:<br />
# /sbin/sysctl -p<br />
<br />
* The browser results in: '''the page you are looking for is temporarily unavailable. Please try again later. '''<br />
This is because the FastCGI server has not been started. <br />
<br />
* The browser results in: '''no input file specified'''<br />
If the configuration of nginx (fastcgi_param SCRIPT_FILENAME) is all right, this kind of error means php fail to load the requestd script. Usually it's simply an permission issue, you can just run php-cgi as root<br />
# spawn-fcgi -a 127.0.0.1 -p 9000 -f /usr/bin/php<br />
or you should create some group and user to start the php-cgi. For instance :<br />
$ sudo groupadd www<br />
$ sudo useradd -g www www<br />
$ sudo chmod +w /srv/www/nginx/html<br />
$ sudo chown -R www:www /srv/www/nginx/html<br />
$ sudo spawn-fcgi -a 127.0.0.1 -p 9000 -u www -g www -f /usr/bin/php<br />
<br />
Another occasion is that, wrong "root" argument in the "location ~ \.php$" section in nginx.conf, make sure the "root" points to the same diretory as it in "location /" in the same server. Or you may just set root as globle, don't define it in any location section.<br />
<br />
Also remine that your php script path was defaultly defined to /srv/www/nginx/html by argument "open_basedir" in /etc/php/php.ini, you can change them if you need.<br />
<br />
==References ==<br />
*[http://nginx.net/ Nginx Official site]<br />
*[http://wiki.codemongers.com/Main Nginx Wiki]<br />
*[http://calomel.org/nginx.html Nginx Howto]</div>Blohttps://wiki.archlinux.org/index.php?title=Nginx&diff=76465Nginx2009-09-25T12:59:39Z<p>Blo: /* Tips */</p>
<hr />
<div>[[Category:Networking (English)]]<br />
[[Category:HOWTOs (English)]]<br />
[[Category:Web Server (English)]]<br />
<br />
==Summary==<br />
Nginx (pronounced "engine X") written by Igor Sysoev (Russia) in 2005, is a free, open-source, high-performance HTTP server and reverse proxy, as well as an IMAP/POP3 proxy server. According to the ''[http://news.netcraft.com/archives/2009/06/17/june_2009_web_server_survey.html June 2009 Web Server Survey from Netcraft]'', nginx now hosts nearly 3.37% of all domains worldwide, while lighttpd hosts about 1.8%. Nginx is now well known for its stability, rich feature set, simple configuration, and low resource consumption.<br />
<br />
==Installation ==<br />
The nginx package is now in the [community] repository, the latest stable version is nginx-0.6.34:<br />
# pacman -S nginx<br />
or you can compile and install the latest development version with ABS.<br />
<br />
==Starting service ==<br />
Run<br />
# /etc/rc.d/nginx start<br />
to start working. The default main page is /srv/www/nginx/html/index.html. Now you can use this URL: <nowiki>http://127.0.0.1</nowiki> to test if nginx is working.<br />
<br />
To enable service by default at startup just add "nginx" to the DAEMONS in the /etc/rc.conf.<br />
<br />
==Configuring ==<br />
You can modify the configurations by editing the files in /etc/nginx. (/etc/nginx/nginx.conf being the main config file) . <br />
<br />
More details can be referred from [http://wiki.codemongers.com/NginxConfiguration Nginx Configuration Examples].<br />
<br />
===Use PHP/Python with nginx ===<br />
FastCGI technology is introduced into nginx to work with many external tools and servers, ie: PHP and Python. So, you cannot use PHP or Python service unless FastCGI server has been started. <br />
<br />
PHP and Python can be run as FastCGI application and can process FastCGI requests from nginx.<br />
<br />
'''Step 1: Start the FastCGI server'''<br><br />
There are two different ways to run FastCGI server: <br />
<br />
1) Directly running PHP’s built-in FastCGI server - this method don’t require any third party tools. <br><br />
Archlinux's '''''php''''' package in the [extra] repository has already enabled FastCGI support.<br><br />
For example:<br />
$ sudo pacman -S php<br />
$ php-cgi -b 127.0.0.1:9000 &<br />
This command make the local machine as a FastCGI server using port 9000.<br />
<br />
'''Note:''' Sometimes, you'll need to modify something in the /etc/php/php.ini, and then php-cgi should be restarted. <br />
<br />
2) Running PHP inside some third-party wrapper - it can be more comfortable than first method because of more flexibility. You can install ''fcgi''(which includes ''cgi-fcgi''), ''lighttpd'' (which includes ''spawn-fcgi''), and '''''PHP-FPM ''''' (PHP FastCGI Process Manager, which is now in the AUR. Recommend.)<br><br />
For example:<br />
# cgi-fcgi -start -connect localhost:9000 /usr/bin/php<br />
<br />
# spawn-fcgi -a 127.0.0.1 -p 9000 -C 9 -f /usr/bin/php<br />
<br />
# php --fpm -b 127.0.0.1:9000<br />
<br />
'''Note:''' You may need to edit /etc/php-fpm.conf at first. More details about php-fpm can be referred from '''[http://php-fpm.anight.org/ php-fpm website]'''<br />
<br />
'''Note:''' Sometimes, you may encounter some permission issue when running some third party software to start PHP as FastCGI-server. See '''[[Nginx#Tips|Tips]]'''.<br />
<br />
'''Note:''' With older PHP releases (5.2 > ) you should use /usr/bin/php-cgi instead of /usr/bin/php '''.<br />
<br />
'''Step 2: Edit /etc/nginx/conf/nginx.conf'''<br><br />
Comment out some lines and edit in the file to be as follows:<br />
location ~ \.php$ {<br />
root html;<br />
fastcgi_pass 127.0.0.1:9000;<br />
fastcgi_index index.php;<br />
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;<br />
include fastcgi_params;<br />
}<br />
where "root html" and "$document_root" means nginx's root file directory (that is /srv/www/nginx/html/, and you can replace $document_root with that path). You can add this path to "open_basedir" line of the /etc/php/php.ini.<br />
<br />
'''Step 3: Restart nginx'''<br><br />
If nginx has been working, run<br />
# /etc/rc.d/nginx restart<br />
<br />
Edit /srv/www/nginx/html/index.php,<br />
<?php<br />
phpinfo();<br />
?> <br />
view the URL: <nowiki>http://localhost/index.php</nowiki> with your browser, and you'll find PHP has worked well with nginx.<br />
<br />
===Security ===<br />
* allow/deny based on IP <br />
[http://wiki.codemongers.com/NginxHttpAccessModule ngx_http_access_module]<br />
* HTTP authentication<br />
[http://wiki.codemongers.com/NginxHttpAuthBasicModule ngx_http_auth_basic_module]<br />
* HTTPS support<br />
[http://wiki.codemongers.com/NginxHttpSslModule ngx_http_ssl_module]<br />
<br />
==Tips==<br />
* Tuning the kernel for better speed<br />
Add the followings to /etc/sysctl.conf<br />
net.ipv4.tcp_fin_timeout = 30<br />
net.ipv4.tcp_keepalive_time = 300<br />
net.ipv4.tcp_syncookies = 1<br />
net.ipv4.tcp_tw_reuse = 1<br />
net.ipv4.tcp_tw_recycle = 1<br />
net.ipv4.ip_local_port_range = 5000 65000 <br />
and make it active:<br />
# /sbin/sysctl -p<br />
<br />
* The browser results in: '''the page you are looking for is temporarily unavailable. Please try again later. '''<br />
This is because the FastCGI server has not been started. <br />
<br />
* The browser results in: '''no input file specified'''<br />
If the configuration of nginx (fastcgi_param SCRIPT_FILENAME) is all right, this kind of error means php fail to load the requestd script. Usually it's simply an permission issue, you can just run php-cgi as root<br />
# spawn-fcgi -a 127.0.0.1 -p 9000 -f /usr/bin/php<br />
or you should create some group and user to start the php-cgi. For instance :<br />
$ sudo groupadd www<br />
$ sudo useradd -g www www<br />
$ sudo chmod +w /srv/www/nginx/html<br />
$ sudo chown -R www:www /srv/www/nginx/html<br />
$ sudo spawn-fcgi -a 127.0.0.1 -p 9000 -u www -g www -f /usr/bin/php<br />
<br />
Another occasion is that, wrong "root" argument in the "location ~ \.php$" section in nginx.conf, make sure the "root" points to the same diretory as it in "location /" in the same server. Or you may just set root as globle, don't define it in any location section.<br />
<br />
Also remine that your php script path was defaultly defined to /srv/www/nginx/html by argument "open_basedir" in /etc/php/php.ini, you can change them if you need.<br />
<br />
==References ==<br />
*[http://nginx.net/ Nginx Official site]<br />
*[http://wiki.codemongers.com/Main Nginx Wiki]<br />
*[http://calomel.org/nginx.html Nginx Howto]</div>Blohttps://wiki.archlinux.org/index.php?title=Nginx&diff=76464Nginx2009-09-25T12:59:21Z<p>Blo: /* Tips */</p>
<hr />
<div>[[Category:Networking (English)]]<br />
[[Category:HOWTOs (English)]]<br />
[[Category:Web Server (English)]]<br />
<br />
==Summary==<br />
Nginx (pronounced "engine X") written by Igor Sysoev (Russia) in 2005, is a free, open-source, high-performance HTTP server and reverse proxy, as well as an IMAP/POP3 proxy server. According to the ''[http://news.netcraft.com/archives/2009/06/17/june_2009_web_server_survey.html June 2009 Web Server Survey from Netcraft]'', nginx now hosts nearly 3.37% of all domains worldwide, while lighttpd hosts about 1.8%. Nginx is now well known for its stability, rich feature set, simple configuration, and low resource consumption.<br />
<br />
==Installation ==<br />
The nginx package is now in the [community] repository, the latest stable version is nginx-0.6.34:<br />
# pacman -S nginx<br />
or you can compile and install the latest development version with ABS.<br />
<br />
==Starting service ==<br />
Run<br />
# /etc/rc.d/nginx start<br />
to start working. The default main page is /srv/www/nginx/html/index.html. Now you can use this URL: <nowiki>http://127.0.0.1</nowiki> to test if nginx is working.<br />
<br />
To enable service by default at startup just add "nginx" to the DAEMONS in the /etc/rc.conf.<br />
<br />
==Configuring ==<br />
You can modify the configurations by editing the files in /etc/nginx. (/etc/nginx/nginx.conf being the main config file) . <br />
<br />
More details can be referred from [http://wiki.codemongers.com/NginxConfiguration Nginx Configuration Examples].<br />
<br />
===Use PHP/Python with nginx ===<br />
FastCGI technology is introduced into nginx to work with many external tools and servers, ie: PHP and Python. So, you cannot use PHP or Python service unless FastCGI server has been started. <br />
<br />
PHP and Python can be run as FastCGI application and can process FastCGI requests from nginx.<br />
<br />
'''Step 1: Start the FastCGI server'''<br><br />
There are two different ways to run FastCGI server: <br />
<br />
1) Directly running PHP’s built-in FastCGI server - this method don’t require any third party tools. <br><br />
Archlinux's '''''php''''' package in the [extra] repository has already enabled FastCGI support.<br><br />
For example:<br />
$ sudo pacman -S php<br />
$ php-cgi -b 127.0.0.1:9000 &<br />
This command make the local machine as a FastCGI server using port 9000.<br />
<br />
'''Note:''' Sometimes, you'll need to modify something in the /etc/php/php.ini, and then php-cgi should be restarted. <br />
<br />
2) Running PHP inside some third-party wrapper - it can be more comfortable than first method because of more flexibility. You can install ''fcgi''(which includes ''cgi-fcgi''), ''lighttpd'' (which includes ''spawn-fcgi''), and '''''PHP-FPM ''''' (PHP FastCGI Process Manager, which is now in the AUR. Recommend.)<br><br />
For example:<br />
# cgi-fcgi -start -connect localhost:9000 /usr/bin/php<br />
<br />
# spawn-fcgi -a 127.0.0.1 -p 9000 -C 9 -f /usr/bin/php<br />
<br />
# php --fpm -b 127.0.0.1:9000<br />
<br />
'''Note:''' You may need to edit /etc/php-fpm.conf at first. More details about php-fpm can be referred from '''[http://php-fpm.anight.org/ php-fpm website]'''<br />
<br />
'''Note:''' Sometimes, you may encounter some permission issue when running some third party software to start PHP as FastCGI-server. See '''[[Nginx#Tips|Tips]]'''.<br />
<br />
'''Note:''' With older PHP releases (5.2 > ) you should use /usr/bin/php-cgi instead of /usr/bin/php '''.<br />
<br />
'''Step 2: Edit /etc/nginx/conf/nginx.conf'''<br><br />
Comment out some lines and edit in the file to be as follows:<br />
location ~ \.php$ {<br />
root html;<br />
fastcgi_pass 127.0.0.1:9000;<br />
fastcgi_index index.php;<br />
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;<br />
include fastcgi_params;<br />
}<br />
where "root html" and "$document_root" means nginx's root file directory (that is /srv/www/nginx/html/, and you can replace $document_root with that path). You can add this path to "open_basedir" line of the /etc/php/php.ini.<br />
<br />
'''Step 3: Restart nginx'''<br><br />
If nginx has been working, run<br />
# /etc/rc.d/nginx restart<br />
<br />
Edit /srv/www/nginx/html/index.php,<br />
<?php<br />
phpinfo();<br />
?> <br />
view the URL: <nowiki>http://localhost/index.php</nowiki> with your browser, and you'll find PHP has worked well with nginx.<br />
<br />
===Security ===<br />
* allow/deny based on IP <br />
[http://wiki.codemongers.com/NginxHttpAccessModule ngx_http_access_module]<br />
* HTTP authentication<br />
[http://wiki.codemongers.com/NginxHttpAuthBasicModule ngx_http_auth_basic_module]<br />
* HTTPS support<br />
[http://wiki.codemongers.com/NginxHttpSslModule ngx_http_ssl_module]<br />
<br />
==Tips==<br />
* Tuning the kernel for better speed<br />
Add the followings to /etc/sysctl.conf<br />
net.ipv4.tcp_fin_timeout = 30<br />
net.ipv4.tcp_keepalive_time = 300<br />
net.ipv4.tcp_syncookies = 1<br />
net.ipv4.tcp_tw_reuse = 1<br />
net.ipv4.tcp_tw_recycle = 1<br />
net.ipv4.ip_local_port_range = 5000 65000 <br />
and make it active:<br />
# /sbin/sysctl -p<br />
<br />
* The browser results in: '''the page you are looking for is temporarily unavailable. Please try again later. '''<br />
This is because the FastCGI server has not been started. <br />
<br />
* The browser results in: '''no input file specified'''<br />
If the configuration of nginx (fastcgi_param SCRIPT_FILENAME) is all right, this kind of error means php fail to load the requestd script. Usually it's simply an permission issue, you can just run php-cgi as root<br />
# spawn-fcgi -a 127.0.0.1 -p 9000 -f /usr/bin/php-cgi<br />
or you should create some group and user to start the php-cgi. For instance :<br />
$ sudo groupadd www<br />
$ sudo useradd -g www www<br />
$ sudo chmod +w /srv/www/nginx/html<br />
$ sudo chown -R www:www /srv/www/nginx/html<br />
$ sudo spawn-fcgi -a 127.0.0.1 -p 9000 -u www -g www -f /usr/bin/php<br />
<br />
Another occasion is that, wrong "root" argument in the "location ~ \.php$" section in nginx.conf, make sure the "root" points to the same diretory as it in "location /" in the same server. Or you may just set root as globle, don't define it in any location section.<br />
<br />
Also remine that your php script path was defaultly defined to /srv/www/nginx/html by argument "open_basedir" in /etc/php/php.ini, you can change them if you need.<br />
<br />
==References ==<br />
*[http://nginx.net/ Nginx Official site]<br />
*[http://wiki.codemongers.com/Main Nginx Wiki]<br />
*[http://calomel.org/nginx.html Nginx Howto]</div>Blohttps://wiki.archlinux.org/index.php?title=Nginx&diff=76463Nginx2009-09-25T12:57:04Z<p>Blo: /* Use PHP/Python with nginx */</p>
<hr />
<div>[[Category:Networking (English)]]<br />
[[Category:HOWTOs (English)]]<br />
[[Category:Web Server (English)]]<br />
<br />
==Summary==<br />
Nginx (pronounced "engine X") written by Igor Sysoev (Russia) in 2005, is a free, open-source, high-performance HTTP server and reverse proxy, as well as an IMAP/POP3 proxy server. According to the ''[http://news.netcraft.com/archives/2009/06/17/june_2009_web_server_survey.html June 2009 Web Server Survey from Netcraft]'', nginx now hosts nearly 3.37% of all domains worldwide, while lighttpd hosts about 1.8%. Nginx is now well known for its stability, rich feature set, simple configuration, and low resource consumption.<br />
<br />
==Installation ==<br />
The nginx package is now in the [community] repository, the latest stable version is nginx-0.6.34:<br />
# pacman -S nginx<br />
or you can compile and install the latest development version with ABS.<br />
<br />
==Starting service ==<br />
Run<br />
# /etc/rc.d/nginx start<br />
to start working. The default main page is /srv/www/nginx/html/index.html. Now you can use this URL: <nowiki>http://127.0.0.1</nowiki> to test if nginx is working.<br />
<br />
To enable service by default at startup just add "nginx" to the DAEMONS in the /etc/rc.conf.<br />
<br />
==Configuring ==<br />
You can modify the configurations by editing the files in /etc/nginx. (/etc/nginx/nginx.conf being the main config file) . <br />
<br />
More details can be referred from [http://wiki.codemongers.com/NginxConfiguration Nginx Configuration Examples].<br />
<br />
===Use PHP/Python with nginx ===<br />
FastCGI technology is introduced into nginx to work with many external tools and servers, ie: PHP and Python. So, you cannot use PHP or Python service unless FastCGI server has been started. <br />
<br />
PHP and Python can be run as FastCGI application and can process FastCGI requests from nginx.<br />
<br />
'''Step 1: Start the FastCGI server'''<br><br />
There are two different ways to run FastCGI server: <br />
<br />
1) Directly running PHP’s built-in FastCGI server - this method don’t require any third party tools. <br><br />
Archlinux's '''''php''''' package in the [extra] repository has already enabled FastCGI support.<br><br />
For example:<br />
$ sudo pacman -S php<br />
$ php-cgi -b 127.0.0.1:9000 &<br />
This command make the local machine as a FastCGI server using port 9000.<br />
<br />
'''Note:''' Sometimes, you'll need to modify something in the /etc/php/php.ini, and then php-cgi should be restarted. <br />
<br />
2) Running PHP inside some third-party wrapper - it can be more comfortable than first method because of more flexibility. You can install ''fcgi''(which includes ''cgi-fcgi''), ''lighttpd'' (which includes ''spawn-fcgi''), and '''''PHP-FPM ''''' (PHP FastCGI Process Manager, which is now in the AUR. Recommend.)<br><br />
For example:<br />
# cgi-fcgi -start -connect localhost:9000 /usr/bin/php<br />
<br />
# spawn-fcgi -a 127.0.0.1 -p 9000 -C 9 -f /usr/bin/php<br />
<br />
# php --fpm -b 127.0.0.1:9000<br />
<br />
'''Note:''' You may need to edit /etc/php-fpm.conf at first. More details about php-fpm can be referred from '''[http://php-fpm.anight.org/ php-fpm website]'''<br />
<br />
'''Note:''' Sometimes, you may encounter some permission issue when running some third party software to start PHP as FastCGI-server. See '''[[Nginx#Tips|Tips]]'''.<br />
<br />
'''Note:''' With older PHP releases (5.2 > ) you should use /usr/bin/php-cgi instead of /usr/bin/php '''.<br />
<br />
'''Step 2: Edit /etc/nginx/conf/nginx.conf'''<br><br />
Comment out some lines and edit in the file to be as follows:<br />
location ~ \.php$ {<br />
root html;<br />
fastcgi_pass 127.0.0.1:9000;<br />
fastcgi_index index.php;<br />
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;<br />
include fastcgi_params;<br />
}<br />
where "root html" and "$document_root" means nginx's root file directory (that is /srv/www/nginx/html/, and you can replace $document_root with that path). You can add this path to "open_basedir" line of the /etc/php/php.ini.<br />
<br />
'''Step 3: Restart nginx'''<br><br />
If nginx has been working, run<br />
# /etc/rc.d/nginx restart<br />
<br />
Edit /srv/www/nginx/html/index.php,<br />
<?php<br />
phpinfo();<br />
?> <br />
view the URL: <nowiki>http://localhost/index.php</nowiki> with your browser, and you'll find PHP has worked well with nginx.<br />
<br />
===Security ===<br />
* allow/deny based on IP <br />
[http://wiki.codemongers.com/NginxHttpAccessModule ngx_http_access_module]<br />
* HTTP authentication<br />
[http://wiki.codemongers.com/NginxHttpAuthBasicModule ngx_http_auth_basic_module]<br />
* HTTPS support<br />
[http://wiki.codemongers.com/NginxHttpSslModule ngx_http_ssl_module]<br />
<br />
==Tips==<br />
* Tuning the kernel for better speed<br />
Add the followings to /etc/sysctl.conf<br />
net.ipv4.tcp_fin_timeout = 30<br />
net.ipv4.tcp_keepalive_time = 300<br />
net.ipv4.tcp_syncookies = 1<br />
net.ipv4.tcp_tw_reuse = 1<br />
net.ipv4.tcp_tw_recycle = 1<br />
net.ipv4.ip_local_port_range = 5000 65000 <br />
and make it active:<br />
# /sbin/sysctl -p<br />
<br />
* The browser results in: '''the page you are looking for is temporarily unavailable. Please try again later. '''<br />
This is because the FastCGI server has not been started. <br />
<br />
* The browser results in: '''no input file specified'''<br />
If the configuration of nginx (fastcgi_param SCRIPT_FILENAME) is all right, this kind of error means php fail to load the requestd script. Usually it's simply an permission issue, you can just run php-cgi as root<br />
# spawn-fcgi -a 127.0.0.1 -p 9000 -f /usr/bin/php-cgi<br />
or you should create some group and user to start the php-cgi. For instance :<br />
$ sudo groupadd www<br />
$ sudo useradd -g www www<br />
$ sudo chmod +w /srv/www/nginx/html<br />
$ sudo chown -R www:www /srv/www/nginx/html<br />
$ sudo spawn-fcgi -a 127.0.0.1 -p 9000 -u www -g www -f /usr/bin/php-cgi<br />
<br />
Another occasion is that, wrong "root" argument in the "location ~ \.php$" setion in nginx.conf, make sure the "root" points to the same diretory as it in "location /" in the same server. Or you may just set root as globle, don't defind it in any location setion.<br />
<br />
Also remine that your php script path was defaultly defined to /srv/www/nginx/html by argument "open_basedir" in /etc/php/php.ini, you can change them if you need.<br />
<br />
==References ==<br />
*[http://nginx.net/ Nginx Official site]<br />
*[http://wiki.codemongers.com/Main Nginx Wiki]<br />
*[http://calomel.org/nginx.html Nginx Howto]</div>Blohttps://wiki.archlinux.org/index.php?title=Nginx&diff=76462Nginx2009-09-25T12:55:06Z<p>Blo: /* Use PHP/Python with nginx */</p>
<hr />
<div>[[Category:Networking (English)]]<br />
[[Category:HOWTOs (English)]]<br />
[[Category:Web Server (English)]]<br />
<br />
==Summary==<br />
Nginx (pronounced "engine X") written by Igor Sysoev (Russia) in 2005, is a free, open-source, high-performance HTTP server and reverse proxy, as well as an IMAP/POP3 proxy server. According to the ''[http://news.netcraft.com/archives/2009/06/17/june_2009_web_server_survey.html June 2009 Web Server Survey from Netcraft]'', nginx now hosts nearly 3.37% of all domains worldwide, while lighttpd hosts about 1.8%. Nginx is now well known for its stability, rich feature set, simple configuration, and low resource consumption.<br />
<br />
==Installation ==<br />
The nginx package is now in the [community] repository, the latest stable version is nginx-0.6.34:<br />
# pacman -S nginx<br />
or you can compile and install the latest development version with ABS.<br />
<br />
==Starting service ==<br />
Run<br />
# /etc/rc.d/nginx start<br />
to start working. The default main page is /srv/www/nginx/html/index.html. Now you can use this URL: <nowiki>http://127.0.0.1</nowiki> to test if nginx is working.<br />
<br />
To enable service by default at startup just add "nginx" to the DAEMONS in the /etc/rc.conf.<br />
<br />
==Configuring ==<br />
You can modify the configurations by editing the files in /etc/nginx. (/etc/nginx/nginx.conf being the main config file) . <br />
<br />
More details can be referred from [http://wiki.codemongers.com/NginxConfiguration Nginx Configuration Examples].<br />
<br />
===Use PHP/Python with nginx ===<br />
FastCGI technology is introduced into nginx to work with many external tools and servers, ie: PHP and Python. So, you cannot use PHP or Python service unless FastCGI server has been started. <br />
<br />
PHP and Python can be run as FastCGI application and can process FastCGI requests from nginx.<br />
<br />
'''Step 1: Start the FastCGI server'''<br><br />
There are two different ways to run FastCGI server: <br />
<br />
1) Directly running PHP’s built-in FastCGI server - this method don’t require any third party tools. <br><br />
Archlinux's '''''php''''' package in the [extra] repository has already enabled FastCGI support.<br><br />
For example:<br />
$ sudo pacman -S php<br />
$ php-cgi -b 127.0.0.1:9000 &<br />
This command make the local machine as a FastCGI server using port 9000.<br />
<br />
'''Note:''' Sometimes, you'll need to modify something in the /etc/php/php.ini, and then php-cgi should be restarted. <br />
<br />
2) Running PHP inside some third-party wrapper - it can be more comfortable than first method because of more flexibility. You can install ''fcgi''(which includes ''cgi-fcgi''), ''lighttpd'' (which includes ''spawn-fcgi''), and '''''PHP-FPM ''''' (PHP FastCGI Process Manager, which is now in the AUR. Recommend.)<br><br />
For example:<br />
# cgi-fcgi -start -connect localhost:9000 /usr/bin/php-cgi<br />
<br />
# spawn-fcgi -a 127.0.0.1 -p 9000 -C 9 -f /usr/bin/php-cgi<br />
<br />
# php-cgi --fpm -b 127.0.0.1:9000<br />
<br />
'''Note:''' You may need to edit /etc/php-fpm.conf at first. More details about php-fpm can be referred from '''[http://php-fpm.anight.org/ php-fpm website]'''<br />
<br />
'''Note:''' Sometimes, you may encounter some permission issue when running some third party software to start PHP as FastCGI-server. See '''[[Nginx#Tips|Tips]]'''.<br />
<br />
'''Note:''' With the latest PHP (5.3 and above) you should use /usr/bin/php instead of /usr/bin/php-cgi '''.<br />
<br />
'''Step 2: Edit /etc/nginx/conf/nginx.conf'''<br><br />
Comment out some lines and edit in the file to be as follows:<br />
location ~ \.php$ {<br />
root html;<br />
fastcgi_pass 127.0.0.1:9000;<br />
fastcgi_index index.php;<br />
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;<br />
include fastcgi_params;<br />
}<br />
where "root html" and "$document_root" means nginx's root file directory (that is /srv/www/nginx/html/, and you can replace $document_root with that path). You can add this path to "open_basedir" line of the /etc/php/php.ini.<br />
<br />
'''Step 3: Restart nginx'''<br><br />
If nginx has been working, run<br />
# /etc/rc.d/nginx restart<br />
<br />
Edit /srv/www/nginx/html/index.php,<br />
<?php<br />
phpinfo();<br />
?> <br />
view the URL: <nowiki>http://localhost/index.php</nowiki> with your browser, and you'll find PHP has worked well with nginx.<br />
<br />
===Security ===<br />
* allow/deny based on IP <br />
[http://wiki.codemongers.com/NginxHttpAccessModule ngx_http_access_module]<br />
* HTTP authentication<br />
[http://wiki.codemongers.com/NginxHttpAuthBasicModule ngx_http_auth_basic_module]<br />
* HTTPS support<br />
[http://wiki.codemongers.com/NginxHttpSslModule ngx_http_ssl_module]<br />
<br />
==Tips==<br />
* Tuning the kernel for better speed<br />
Add the followings to /etc/sysctl.conf<br />
net.ipv4.tcp_fin_timeout = 30<br />
net.ipv4.tcp_keepalive_time = 300<br />
net.ipv4.tcp_syncookies = 1<br />
net.ipv4.tcp_tw_reuse = 1<br />
net.ipv4.tcp_tw_recycle = 1<br />
net.ipv4.ip_local_port_range = 5000 65000 <br />
and make it active:<br />
# /sbin/sysctl -p<br />
<br />
* The browser results in: '''the page you are looking for is temporarily unavailable. Please try again later. '''<br />
This is because the FastCGI server has not been started. <br />
<br />
* The browser results in: '''no input file specified'''<br />
If the configuration of nginx (fastcgi_param SCRIPT_FILENAME) is all right, this kind of error means php fail to load the requestd script. Usually it's simply an permission issue, you can just run php-cgi as root<br />
# spawn-fcgi -a 127.0.0.1 -p 9000 -f /usr/bin/php-cgi<br />
or you should create some group and user to start the php-cgi. For instance :<br />
$ sudo groupadd www<br />
$ sudo useradd -g www www<br />
$ sudo chmod +w /srv/www/nginx/html<br />
$ sudo chown -R www:www /srv/www/nginx/html<br />
$ sudo spawn-fcgi -a 127.0.0.1 -p 9000 -u www -g www -f /usr/bin/php-cgi<br />
<br />
Another occasion is that, wrong "root" argument in the "location ~ \.php$" setion in nginx.conf, make sure the "root" points to the same diretory as it in "location /" in the same server. Or you may just set root as globle, don't defind it in any location setion.<br />
<br />
Also remine that your php script path was defaultly defined to /srv/www/nginx/html by argument "open_basedir" in /etc/php/php.ini, you can change them if you need.<br />
<br />
==References ==<br />
*[http://nginx.net/ Nginx Official site]<br />
*[http://wiki.codemongers.com/Main Nginx Wiki]<br />
*[http://calomel.org/nginx.html Nginx Howto]</div>Blohttps://wiki.archlinux.org/index.php?title=TrueCrypt&diff=61354TrueCrypt2009-02-11T15:05:14Z<p>Blo: </p>
<hr />
<div>[[Category:Security (English)]]<br />
[[Category:File systems (English)]]<br />
[[Category:HOWTOs (English)]]<br />
<br />
==Overview==<br />
'''TrueCrypt''' is a free open source on-the-fly encryption (OTFE) program. Some of its features are:<br />
* Virtual encrypted disks within files that can be mounted as real disks.<br />
* Encryption of an entire hard disk partition or a storage device/medium.<br />
* All encryption algorithms use the LRW mode of operation, which is more secure than CBC mode with predictable initialization vectors for storage encryption.<br />
* "Hidden volumes" within a normal "outer" encrypted volume. A hidden volume can not be distinguished from random data without access to a passphrase and/or keyfile.<br />
<br />
== Installation ==<br />
Type as root in a terminal:<br />
# pacman -Sy truecrypt<br />
If you use any other kernel than kernel26 install the corresponding kernel module, e.g. kernel26beyond -> truecrypt-beyond.<br />
<br />
If you are using truecrypt to encrypt a virtual filesystem (e.g. a file), the module will be automatically loaded whenever you run the <code>truecrypt</code> command. You will need the "loop" module though. Add it to the MODULES array in /etc/rc.conf.<br />
<br />
If you are using truecrypt to encrypt a physical device (e.g. a hard disk or usb drive), you will likely want to load the module during the boot sequence:<br />
<br />
Add the module to /etc/rc.conf:<br />
MODULES=('''truecrypt''' ...)<br />
<br />
== Encrypting a file as a virtual volume ==<br />
The following instructions will create a file that will act as a virtual filesystem, allowing you to mount it and store files within the encrypted file. This is a convenient way to store sensitive information, such as financial data or passwords, in a single file that can be accessed from Linux, Windows, or Macs.<br />
<br />
To create a new truecrypt file interactively, type the following in a terminal:<br />
$ truecrypt -c<br />
<br />
{{Box Note | This command won't work in newer version of truecrypt. Type "truecrypt" instead and manage your encrypted volumes from the GUI or specify the necessary options to work in the command line. (truecrypt -h)}}<br />
<br />
Follow the instructions, choosing the default values unless you know what you're doing:<br />
<br />
Volume type:<br />
1) Normal<br />
2) Hidden<br />
Select [1]: 1<br />
<br />
Enter file or device path for new volume: /home/user/myEncryptedFile.tc<br />
<br />
Filesystem:<br />
1) FAT<br />
2) None<br />
Select [1]: 1<br />
<br />
Enter volume size (bytes - size/sizeK/sizeM/sizeG): 32M<br />
<br />
Hash algorithm:<br />
1) RIPEMD-160<br />
2) SHA-1<br />
3) Whirlpool<br />
Select [1]: 1 <br />
<br />
Encryption algorithm:<br />
1) AES<br />
2) Blowfish<br />
3) CAST5<br />
4) Serpent<br />
5) Triple DES<br />
6) Twofish<br />
7) AES-Twofish<br />
8) AES-Twofish-Serpent<br />
9) Serpent-AES<br />
10) Serpent-Twofish-AES<br />
11) Twofish-Serpent<br />
Select [1]: 1<br />
<br />
Enter password for new volume '/home/user/myEncryptedFile.tc': *****************************<br />
Re-enter password: *****************************<br />
<br />
Enter keyfile path [none]: <br />
<br />
TrueCrypt will now collect random data.<br />
Is your mouse connected directly to computer where TrueCrypt is running? [Y/n]: <br />
Please move the mouse randomly until the required amount of data is captured...<br />
Mouse data captured: 100% <br />
<br />
Done: 32.00 MB Speed: 10.76 MB/s Left: 0:00:00 <br />
Volume created.<br />
<br />
[user@host:~] $<br />
<br />
You can now mount the new encrypted file to a previously-created directory:<br />
$ truecrypt /home/user/myEncryptedFile.tc /home/user/myEncryptedFileFolder<br />
<br />
'''''Note:''' Truecrypt requires root privileges and as such, running the above command as a user will attempt to use ''<tt>sudo</tt>'' for authentication. To work with files as a regular user, please see the appropriate section below.<br />
<br />
Once mounted, you can copy or create new files within the encrypted directory as if it was any normal directory. When you are you ready to re-encrypt the contents and unmount the directory, run:<br />
$ truecrypt -d<br />
<br />
Again, this will require administrator privileges through the use of <tt>sudo</tt>.<br />
<br />
For more information about truecrypt in general, run:<br />
$ man truecrypt<br />
<br />
Several options can be passed at the command line, making automated access and creation a simple task. The man page is highly recommended reading.<br />
<br />
== Encrypting a physical volume ==<br />
If you want to use a keyfile, create one with this command:<br />
truecrypt --keyfile-create /etc/disk.key<br />
By default both passphrase and key will be needed to unlock the volume.<br />
<br />
Create a new volume in the device /dev/sda1:<br />
truecrypt --type normal -c /dev/sda1<br />
<br />
Map the volume to /dev/mapper/truecrypt1:<br />
truecrypt -N 1 /dev/sda1<br />
<br />
If you want to use another file system than ext3 simply format the disk like you normally would, except use the path /dev/mapper/truecrypt1.<br />
mkfs.ext3 /dev/mapper/truecrypt1<br />
<br />
Mount the volume:<br />
mount /dev/mapper/truecrypt1 /media/disk<br />
<br />
Map and mount a volume:<br />
truecrypt /dev/sda1 /media/disk<br />
<br />
Unmount and unmap a volume:<br />
truecrypt -d /dev/sda1<br />
<br />
== Creating a hidden volume ==<br />
First, create a normal outer volume as described above.<br />
<br />
Map the outer volume to /dev/mapper/truecrypt1:<br />
truecrypt -N 1 /dev/sda1<br />
<br />
Create a hidden truecrypt volume in the free space of the outer volume:<br />
truecrypt --type hidden -c /dev/sda1<br />
You need to use another passphrase and/or keyfile here than the one you used for the outer volume.<br />
<br />
Unmap the outer truecrypt volume and map the hidden one:<br />
truecrypt -d /dev/sda1<br />
truecrypt -N 1 /dev/sda1<br />
Just use the passphrase you chose for the hidden volume and TrueCrypt will automatically choose it before the outer.<br />
<br />
Create a file system on it (if you have not already) and mount it:<br />
mkfs.ext3 /dev/mapper/truecrypt1<br />
mount /dev/mapper/truecrypt1 /media/disk<br />
<br />
Map and mount the outer volume with the hidden write-protected:<br />
truecrypt -P /dev/sda1 /media/disk<br />
<br />
==Mount a special filesystem==<br />
In my example I want to mount a ntfs-volume, but truecrypt doesn't use ntfs-3g by default (so there is no write access; checked in version 6.1).<br />
The following command works for me:<br />
truecrypt --filesystem=ntfs-3g --mount /file/you/want/to/mount<br />
<br />
==Mount volumes as a normal user==<br />
<br />
TrueCrypt needs root privileges to work: this procedure will allow normal users to use it, also giving writing permissions to mounted volumes.<br />
<br />
Both methods below require [[Sudo]]. Make sure it is configured before proceeding.<br />
<br />
===Method 1 (Add a truecrypt group)===<br />
<br />
Create a new group called truecrypt and give it the necessary permissions. Any users that will belong to that group, will be able to use TrueCrypt.<br />
# groupadd truecrypt<br />
<br />
Edit the sudo configuration:<br />
# visudo<br />
<br />
Append the following lines at the bottom of the sudo configuration file:<br />
# Users in the truecrypt group are allowed to run TrueCrypt as root.<br />
%truecrypt ALL=(root) NOPASSWD:/usr/bin/truecrypt<br />
<br />
Before adding our users to the truecrypt group we still have to do something in order to make mounted volumes writable from normal users. To do this just open the system-wide bashrc file:<br />
# nano /etc/bash/bashrc<br />
<br />
And add these few lines to it:<br />
alias tc='sudo truecrypt'<br />
alias tcm='tc -M uid=$(id -u),gid=$(id -g)'<br />
<br />
You can now add your users to the truecrypt group:<br />
# gpasswd -a USER_1 truecrypt<br />
# gpasswd -a USER_2 truecrypt<br />
...<br />
<br />
'''''Note:''' In order to make these changes active, any user that has been added to the truecrypt group have to logout.''<br />
<br />
===Method 2 (sudo simplified)===<br />
Simply enable desired user to run truecrypt without a password:<br />
# visudo<br />
<br />
Append the following:<br />
USERNAME ALL = (root) NOPASSWD:/usr/bin/truecrypt<br />
<br />
alternatively, if you make use of the wheel group:<br />
%wheel ALL = (root) NOPASSWD:/usr/bin/truecrypt<br />
<br />
If you have any difficulties with permissions as a normal user, just add the '-u' flag to the truecrypt mount command, for example:<br />
$ truecrypt -u /home/user/myEncryptedFile.tc /home/user/myEncryptedFileFolder<br />
<br />
==Related links==<br />
* [http://www.truecrypt.org/ TrueCrypt Homepage]<br />
* [http://www.gentoo-wiki.info/HOWTO_Truecrypt HOWTO: Truecrypt Gentoo wiki (old version from a Backup. New Version not written yet)]<br />
* [http://www.howtoforge.com/truecrypt_data_encryption Truecrypt Tutorial on HowToForge]</div>Blohttps://wiki.archlinux.org/index.php?title=Network_configuration&diff=59491Network configuration2009-01-28T21:42:52Z<p>Blo: </p>
<hr />
<div>[[Category:Networking (English)]]<br />
[[Category:Getting and installing Arch (English)]]<br />
[[Category:HOWTOs (English)]]<br />
<br />
{{i18n_links_start}}<br />
{{i18n_entry|English|Configuring_network}}<br />
{{i18n_entry|Español|Configurando la Red}}<br />
{{i18n_entry|Italiano|Configuring_network_(Italiano)}}<br />
{{i18n_entry|Slovensky|Statická IP a DHCP}}<br />
{{i18n_entry|Türkçe|Ağ Ayarları}}<br />
{{i18n_entry|Русский|Статический IP и DHCP}}<br />
{{i18n_entry|Česky|Statická IP a DHCP czech}}<br />
{{i18n_entry|简体中文|网络配置}}<br />
{{i18n_links_end}}<br />
<br />
== Summary ==<br />
<br />
A simple guide to get your network running.<br />
<br />
<br />
== Load the device module ==<br />
<br />
Udev should detect your network card (NIC) module and load it automatically at startup. Otherwise, you will need to know which module is needed for your particular model:<br />
<br />
hwdetect --show-net<br />
<br />
Now when you know which module to use you can load it:<br />
<br />
# modprobe <modulename><br />
<br />
If udev is not detecting and loading the proper module automatically, you can add it into the '''MODULES=''' array in <code>/etc/rc.conf</code>, so you don't need to modprobe it everytime you boot. For example, if tg3 is the network module:<br />
<br />
MODULES=(!usbserial tg3 snd-cmipci)<br />
<br />
Other common modules are 8139too for cards with the Realtek chipset or sis900 for SiS cards.<br />
<br />
== Configure IP ==<br />
<br />
=== For DHCP IP ===<br />
<br />
For this, you need the dhcpcd package (already available on most installations). Edit <code>/etc/rc.conf</code> like this:<br />
<br />
eth0="dhcp"<br />
INTERFACES=(eth0)<br />
ROUTES=(!gateway)<br />
<br />
If you use DHCP and you do '''not''' want your DNS servers automatically assigned every time you start your network, be sure to use the "-C" option in <code>DHCPCD_ARGS</code> in <code>/etc/conf.d/dhcpcd</code> (used by <code>/etc/rc.d/network</code>). This prevents dhcpcd from rewriting your <code>/etc/resolv.conf</code> every time:<br />
<br />
DHCPCD_ARGS="'''-C resolv.conf''' -q"<br />
<br />
Note: in previous <code>dhcpcd</code> versions, the now depreciated "-R" option was used instead:<br />
<br />
DHCPCD_ARGS="-R -t 30 -h $HOSTNAME"<br />
<br />
Additonally, make sure to add (a) valid nameserver(s) to <code>/etc/resolv.conf</code>. A sample <code>/etc/resolv.conf</code>:<br />
<br />
#DHCP with user-specified DNS <br />
nameserver 4.2.2.2<br />
nameserver 4.2.2.4<br />
<br />
'''NOTE'''<br />
<br />
The new dhcpcd (>= 4.0.2) no longer works with the -R flag since it has been decremented (only works when compiled with compatibility mode). Instead you need place your custom DNS servers in a /etc/resolv.conf.head. dhcpcd will then attach that file to the top of the normal resolv.conf<br />
<br />
Finally, if you do not want to reboot, make sure to test your new settings by stopping and starting the <code>/etc/rc.d/network</code> daemon as opposed to bringing down your interface and starting dhcp manually. To restart the network daemon: <br />
<br />
/etc/rc.d/network restart<br />
<br />
'''NOTE'''<br />
<br />
You may use openresolv package from AUR if several things wants to control resolv.conf (i.e. dhcpcd and VPN client). No additional configuration for dhcpcd is needed to use openresolv.<br />
<br />
=== For Static IP ===<br />
<br />
If you share your internet connection from a Windows box without a router, be sure to use static IPs on both computers. Otherwise you will have LAN issues.<br />
<br />
You need:<br />
<br />
* Your static IP address,<br />
* The netmask,<br />
* The broadcast address,<br />
* Your gateway,<br />
* Your nameservers' IP addresses,<br />
* Your domain name.<br />
<br />
If you are running a private network, it is safe to use IP addresses in 192.168.*.'* for your IPs, with a netmask of 255.255.0.0 and broadcast address of 192.168.255.255. Unless your network has a router, the gateway address does not matter. Edit <code>/etc/rc.conf</code> like this, substituting your own values for the IP, netmask, broadcast, and gateway:<br />
<br />
eth0="eth0 82.137.129.59 netmask 255.255.255.0 broadcast 82.137.129.255"<br />
INTERFACES=(eth0)<br />
gateway="default gw 82.137.129.1"<br />
ROUTES=(gateway)<br />
<br />
and your <code>/etc/resolv.conf</code> like this, substituting your nameservers' IPs and your domain name:<br />
<br />
nameserver 61.23.173.5<br />
nameserver 61.95.849.8<br />
search example.com<br />
<br />
You may include as many nameserver lines as you wish.<br />
<br />
==Other option==<br />
If for some reason dhcpcd eth0 fails, install dhclient (pacman -Sy dhclient)<br />
and use '<code>dhclient eth0</code>' instead.<br />
<br />
== Set computer name ==<br />
<br />
Edit <code>/etc/rc.conf</code> and set HOSTNAME to your desired computer name:<br />
HOSTNAME="banana"<br />
<br />
<br />
== Set host name/IP ==<br />
<br />
Edit <code>/etc/hosts</code> and add the same HOSTNAME you entered in <code>/etc/rc.conf</code> :<br />
127.0.0.1 banana.domain.org localhost.localdomain localhost banana<br />
<br />
This format, including the localhost entries is required for program compatibility.<br />
<br />
== Load configuration ==<br />
To test your settings either reboot the computer, or as root, run <code>/etc/rc.d/network restart</code>.<br />
Try pinging your gateway, DNS server, ISP provider and other Internet sites, in that order, to detect any connection problems along the way.<br />
<br />
<br />
== Some more settings ==<br />
<br />
=== Wireless Setup ===<br />
<br />
See [[Wireless Setup]] for more informations.<br />
<br />
=== Firewall ===<br />
<br />
You can install and configure a [[Firewalls|firewall]] to feel more secure. ;-)<br />
<br />
=== Ifplugd ===<br />
<br />
You can install a daemon which will automatically configure your Ethernet device when a cable is plugged in and automatically unconfigure it if the cable is pulled. This is useful on laptops with onboard network adapters, since it will only configure the interface when a cable is really connected. Another use is when you just need to restart the network but don't want to restart the computer or do it from the shell.<br />
<br />
Installation is very simple since it's in [extra]:<br />
<br />
# pacman -S ifplugd<br />
<br />
By default it is configured to work for eth0 device. This and other settings like delays can be configured in <code>/etc/ifplugd/ifplugd.conf</code>.<br />
<br />
Start it with<br />
<br />
# /etc/rc.d/ifplugd start<br />
<br />
or add it into DAEMONS array in <code>/etc/rc.conf</code>.<br />
<br />
=== bonding ===<br />
You can install 'ifenslave' to bind two real Ethernet cables with one IP address.<br />
/etc/conf.d/bonding<br />
bond_bond0="eth0 eth1"<br />
BOND_INTERFACES=(bond0)<br />
/etc/modprobe.conf:<br />
options bonding miimon=100<br />
/etc/rc.conf<br />
MODULES=(... bonding ...)<br />
bond0="bond0 192.168.1.1 netmask 255.255.255.0 broadcast 192.168.1.255"<br />
INTERFACES=(bond0)<br />
restart network by<br />
/etc/rc.d/network restart<br />
<br />
=== multiple ip on multiple card===<br />
one ip on one card<br />
vi /etc/rc.conf<br />
eth0="eth0 192.168.0.1 netmask 255.255.255.0 broadcast 192.168.0.255"<br />
INTERFACES=(lo eth0)<br />
two ip on one card (BUG:/etc/rc.d/network stop)<br />
vi /etc/rc.conf<br />
eth0="eth0 192.168.0.1 netmask 255.255.255.0 broadcast 192.168.0.255"<br />
eth0_0="eth0:0 192.168.0.2 netmask 255.255.255.0 broadcast 192.168.0.255"<br />
INTERFACES=(lo eth0 eth0_0)<br />
one ip on two card<br />
pacman -S ifenslave<br />
vi /etc/rc.conf<br />
bond0="bond0 192.168.0.1 netmask 255.255.255.0 broadcast 192.168.0.255"<br />
INTERFACES=(lo bond0)<br />
MODULES=(... bonding ...)<br />
two ip on two card (BUG:/etc/rc.d/network stop)<br />
pacman -S ifenslave<br />
vi /etc/rc.conf<br />
bond0="bond0 192.168.0.1 netmask 255.255.255.0 broadcast 192.168.0.255"<br />
bond01="bond0:1 192.168.0.2 netmask 255.255.255.0 broadcast 192.168.0.255"<br />
INTERFACES=(lo bond0 bond01)<br />
MODULES=(... bonding ...)<br />
<br />
{{Box Note| After you set these options (bonding etc.) you have to change your firewall settings or the network won't work properly. }}<br />
<br />
== Troubleshooting ==<br />
<br />
=== Swapping computers on the cable modem ===<br />
<br />
Most domestic cable ISPs (videotron for example) have the cable modem configured to recognise only one client PC, by the MAC address of its network interface. Once the cable modem has learnt the MAC address of the first PC that talks to it, it will not respond to another MAC address in any way. Thus if you swap one PC for another (or for a router), the new PC (or router) will not work with the cable modem, because the new PC (or router) has a different MAC address to the old one. To reset the cable modem so that it will recognise the new PC, you must power the cable modem off and on again. Once the cable modem has rebooted and gone fully online again (indicator lights settled down), reboot the newly connected PC so that it makes a DHCP request, or manually make it request a new DHCP lease.<br />
<br />
=== The TCP Window Scaling Issue ===<br />
<br />
TCP packets contain a "window" value in their headers indicating how much data the other host may send in return. This value is represented with only 16 bits, hence the window size is at most 64Kb. TCP packets are cached for a while (they have to be reordered), and as memory is (or used to be) limited, one host could easily run out of it.<br />
<br />
Back in 1992, as more and more memory became available, [http://www.faqs.org/rfcs/rfc1323.html RFC 1323] was written to improve the situation: Window Scaling. The "window" value, provided in all packets, will be modified by a Scale Factor defined once, at the very beginning of the connection.<br />
<br />
That 8-bit Scale Factor allows the Window to be up to 32 times higher than the initial 64Kb.<br />
<br />
It appears that some broken routers and firewalls on the Internet are rewriting the Scale Factor to 0 which causes misunderstandings between hosts.<br />
<br />
The Linux kernel 2.6.17 introduced a new calculation scheme generating higher Scale Factors, virtually making the aftermaths of the broken routers and firewalls more visible. <br />
<br />
The resulting connection is at best very slow or broken.<br />
<br />
==== How To Diagnose The Problem? ====<br />
<br />
First of all, let's make it clear: this problem is odd. In some cases, you will not be able to use TCP connections (HTTP, FTP, ...) at all and in others, you will be able to communicate with some hosts (very few).<br />
<br />
'''Warning''': <code>dmesg</code>'s output is OK, logs are clean and <code>ifconfig</code> will report normal status &mdash; and actually everything is normal.<br />
<br />
If you can't browse any website, but you can ping some rare hosts, chances are great that you're experiencing this issue: ping uses the ICMP protocol and is not affected by TCP issues.<br />
<br />
You can try to use WireShark. You might see successful UDP and ICMP communications but unsuccessful TCP communications (only to foreign hosts).<br />
<br />
==== How To Fix It? (The bad way) ====<br />
<br />
To fix it the bad way, you can change the tcp_rmem value, on which Scale Factor calculation is based. Although it should work for most hosts, it's not guaranteed, especially for very distant ones.<br />
<br />
echo "4096 87380 174760" > /proc/sys/net/ipv4/tcp_rmem<br />
<br />
Or you can try to remove one of your RAM sticks (yes, sir).<br />
<br />
==== How To Fix It? (The good way) ====<br />
<br />
Simply disable Window Scaling. Even if Window Scaling is a nice TCP feature, it may be uncomfortable especially if you can't fix the broken router. There are several ways to disable Window Scaling, and it seems that the most bulletproof (which will work with most kernels) is to add the following lines to your <code>/etc/rc.local</code>:<br />
<br />
echo 0 > /proc/sys/net/ipv4/tcp_window_scaling<br />
<br />
==== How To Fix It? (The best way) ====<br />
<br />
This issue is caused by broken routers/firewalls, so let's change them. Some users have reported that the broken router was their very own DSL router.<br />
<br />
==== More about it? ====<br />
<br />
This section is based on the LWN article [http://lwn.net/Articles/92727/ TCP window scaling and broken routers] and a Kernel Trap article: [http://kerneltrap.org/node/6723 Window Scaling on the Internet].<br />
<br />
And more recently, some Archers have been hit by this issue:<br />
<br />
* [http://www.archlinux.org/pipermail/arch/2006-June/011250.html Odd network issue]<br />
* [http://www.archlinux.org/pipermail/arch/2006-September/011943.html Kernel 2.6.17 and TCP window scaling] &mdash; the topic which initiated this article<br />
<br />
There are also several relevant threads on the LKML.<br />
<br />
<br />
=== Realtek No Link / WOL issue ===<br />
<br />
Users with Realtek 8168 8169 8101 8111 based NICs (cards / and on board) may notice an issue where the NIC seems to be disabled on boot and has no Link light. This can usually be found on a dual boot system where Windows is also installed. It seems that using the offical realtek drivers (dated anything after May 2007) under windows is the cause. These newer drivers disable the Wake-On-Lan feature by disabling the NIC at Windows shutdown time, where it will remain disabled until the next time Windows boots. You will be able to spot if this is issue is affecting you because the Link light will remain off only until Windows boots, during Windows shutdown it will revert back to the Link light being off. Normal operation should be that the link light is always on as long as the system is on, even during POST. This issue will also affect other OS's without newer drivers (eg. Live CD's). Here's a couple of fixes for this issue.<br />
<br />
==== Method 1 - Rollback/Change Win driver ====<br />
<br />
You can rollback your Windows NIC driver to the Microsoft provided one (if available), or rollback/install to an official Realtek driver pre-dated May 2007 (maybe on the CD that came with your hardware).<br />
<br />
==== Method 2 - Enable WOL in Win driver ====<br />
<br />
Probably the best and fastest fix is to change this setting in the Windows driver. This way it should be fixed system wide and not only under Arch (eg. live CD's, other OSes). In Windows under device manager, find your Realtek Network adapter and double click it. Under the advanced tab change "wake-on-lan after shutdown" to enable.<br />
<br />
In Windows XP (example)<br />
Right click my computer<br />
--> Hardware tab<br />
--> Device Manager<br />
--> Network Adapters<br />
--> "double click" Realtek ...<br />
--> Advanced tab<br />
--> Wake-On-Lan After Shutdown<br />
--> Enable.<br />
<br />
==== Method 3 - Newer Realtek Linux driver ====<br />
<br />
Any newer driver for these Realtek cards can be found for Linux on the realtek site. (untested but believed to also solve the problem).<br />
<br />
=== DLink G604T/DLink G502T DNS issue ===<br />
Users with a DLink G604T/DLink G502T router, using DHCP and have firmware v2.00+ (typically users with AUS firmware) may have issues with certain programs not resolving the DNS. One of these programs are unfortunatley pacman. The problem is basically the router in certain situations is not sending the DNS properly to DHCP, which causes programs to try and connect to servers with an IP of 1.0.0.0 and fail with a connection timed out error<br />
<br />
==== How To Diagnose The Problem? ====<br />
The best way to diagnose the problem is to use a firefox/konqueror/links/seamonkey and to enable wget for pacman. If this is a fresh install of Arch Linux, then you may want to consider installing links through the live CD.<br />
<br />
Firstly enable wget for pacman (since it gives us info about pacman when its downloading packages)<br />
Open /etc/pacman.conf with your favourite editor and uncomment the following line (remove the # if its there)<br />
<br />
XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u<br />
<br />
While your in pacman.conf, check the default mirror that pacman uses to download packages.<br />
<br />
Now open up the default mirror in an internet browser to see if the mirror actually works. If it does work then do pacman -Syy (otherwise pick another working mirror and set it to the pacman default), if you get something similar to the following (notice the 1.0.0.0)<br />
<br />
<nowiki>ftp://mirror.pacific.net.au/linux/archlinux/extra/os/i686/extra.db.tar.gz</nowiki> <br />
<nowiki>=> `/var/lib/pacman/community.db.tar.gz.part'</nowiki> <br />
Resolving mirror.pacific.net.au... 1.0.0.0<br />
<br />
Then you most likely have this problem. The 1.0.0.0 means its unable to resolve the DNS, so we must add it to resolv.conf.<br />
<br />
==== How To Fix It? ====<br />
Basically what we need to do is to manually add the DNS to our /etc/resolv.conf file, The problem is that DHCP automatically deletes and replaces this file on boot, so we need to edit /etc/conf.d/dhcpcd and change the flags to stop DHCP doing this<br />
<br />
When you open up /etc/conf.d/dhcpcd, you should see something close to the following<br />
DHCPCD_ARGS="-t 30 -h $HOSTNAME"<br />
add the -R flag to the arguments, i.e.<br />
DHCPCD_ARGS="-R -t 30 -h $HOSTNAME"<br />
<br />
'''NOTE''': If you are using dhcpcd >= 4.0.2 the -R flag has been depreciated, please look here on ([http://wiki.archlinux.org/index.php/Configuring_network#For_DHCP_IP]) section how to use a custom resolv.conf file<br />
<br />
Save and close, now open /etc/resolv.conf. You should see a single namespace (most likely 10.1.1.1), this is the gateway to your router, which we need to connect to in order to get the DNS of your ISP. Paste the IP into your browser and login to your router. Go to the DNS section and you should see an IP in the Preferred DNS Server, copy it and paste it as a namespace ABOVE the current gateway one.<br />
<br />
i.e. a resolv.conf should look something along the lines of<br />
namespace 10.1.1.1<br />
<br />
If my Primary DNS Server is 211.29.132.12 then chance resolv.conf to<br />
namespace 211.29.132.12<br />
namespace 10.1.1.1<br />
<br />
Now restart the network daemon by doing /etc/rc.d/network restart and do pacman -Syy, if it syncs fine with the server then problem solved<br />
<br />
==== More about it? ====<br />
<br />
This is the whirlpool forum (Australian ISP community) which talks about and gives the same solution to the problem<br />
http://forums.whirlpool.net.au/forum-replies-archive.cfm/461625.html</div>Blo