https://wiki.archlinux.org/api.php?action=feedcontributions&user=Daoo&feedformat=atomArchWiki - User contributions [en]2024-03-28T15:38:26ZUser contributionsMediaWiki 1.41.0https://wiki.archlinux.org/index.php?title=JACK_Audio_Connection_Kit&diff=454011JACK Audio Connection Kit2016-10-15T14:40:31Z<p>Daoo: Add accuracy note about pulseaudio not being needed to use QjackCtl</p>
<hr />
<div>[[Category:Sound]]<br />
[[fr:Jack]]<br />
[[ja:JACK Audio Connection Kit]]<br />
{{Related articles start}}<br />
{{Related|Professional audio}}<br />
{{Related articles end}}<br />
<br />
==Installation==<br />
In order for JACK to work properly, your user needs to be [[Users and groups#Group management|added]] to the {{ic|audio}} group for access to higher ulimits defined in {{ic|/etc/security/limits.d/99-audio.conf}}, which is needed for realtime audio processing.<br />
{{Note|You need to manually add your user to the {{ic|audio}} group even if you're using logind, since logind just handles access to direct hardware.}}<br />
<br />
There are two JACK implementations, see [https://github.com/jackaudio/jackaudio.github.com/wiki/Q_difference_jack1_jack2 this comparison] for the difference between the two. In short, Jack 1 and Jack 2 are equivalent implementations of the same protocol. Programs compiled against Jack 1 will work with Jack 2 without recompile (and vice versa). <br />
<br />
===JACK2===<br />
'''JACK2''' is a C++ implementation with SMP support. [[Install]] it with the {{Pkg|jack2}} package. If you are on a 64-bit installation and need to run 32-bit applications that require JACK, also install the {{Pkg|lib32-jack2}} package from the [[multilib]] repository.<br />
<br />
====JACK2 D-Bus====<br />
JACK2 with [[D-Bus]] can be installed via {{Pkg|jack2-dbus}}. It is the same as the {{Pkg|jack2}} package but does not provide the legacy "jackd" server.<br />
<br />
It is controlled by the {{ic|jack_control}} utility. The important commands are listed below:<br />
jack_control start - starts the jack server<br />
jack_control stop - stops the jack server<br />
jack_control ds alsa - selects alsa as the driver (backend)<br />
jack_control eps realtime True - set engine parameters, such as realtime<br />
jack_control dps period 256 - set the driver parameter period to 256<br />
<br />
===JACK===<br />
'''JACK''' uses a C API and supports more than one soundcard on Linux (plus MIDI). [[Install]] it with the {{pkg|jack}} package. If you are on a 64-bit installation and need to run 32-bit applications that require JACK, also install the {{Pkg|lib32-jack}} package from the [[multilib]] repository.<br />
<br />
===GUI===<br />
If you want a GUI control application, the most widely used one is {{Pkg|qjackctl}}.<br />
<br />
Also, [http://kxstudio.linuxaudio.org/Applications:Cadence cadence] offers a set of applications and eases some advanced jack configurations. It is available on [https://aur.archlinux.org/packages/cadence/ aur].<br />
<br />
==Basic Configuration==<br />
<br />
===Overview===<br />
<br />
[http://www.linux-magazine.com/content/download/63041/486886/version/1/file/JACK_Audio_Server.pdf This Linux Magazine article] is a very good general overview, although do not worry about manual compilations, quite a few JACK tools work right off the wire now, ''after'' JACK is configured correctly.<br />
<br />
Most tutorials are advising a realtime kernel, which is quite helpful for live synthesis and FX; but for purposes of recording and editing it is not necessary, as long as you set up for non-realtime latencies -- 10-40+ ms (100-500+ ms for older hardware).<br />
<br />
The right configuration for your hardware and application needs, depends on several factors.<br />
<br />
===A shell-based example setup===<br />
<br />
<br />
<br />
{{Accuracy|The JACK FAQ points to this specific section as an example of a myth that needs debunking. [https://github.com/jackaudio/jackaudio.github.com/wiki/FAQ_and_Myths It says], "No you do not [have to set up realtime scheduling of each audio application]. There are countless examples e.g. archwiki which demonstrate elaborate scripts to raise the priority of audio-processing applications. In fact they all achieve the opposite."}}<br />
<br />
The D-Bus edition of JACK2 can make startup much easier. Formerly, we had to have QjackCtl start it for us, or use a daemonizer, or some other method. But using {{Pkg|jack2-dbus}}, we can easily start and configure it via a shell script.<br />
<br />
Create a shell script that can be executed at X login:<br />
<br />
{{hc|start_jack.sh|<br />
#!/bin/bash<br />
<br />
jack_control start<br />
sudo schedtool -R -p 20 `pidof jackdbus`<br />
jack_control eps realtime true<br />
jack_control ds alsa<br />
jack_control dps device hw:HD2<br />
jack_control dps rate 48000<br />
jack_control dps nperiods 2<br />
jack_control dps period 64<br />
sleep 10<br />
/usr/bin/a2jmidid -e &<br />
sleep 10<br />
qjackctl &<br />
sleep 10<br />
qmidiroute ~/All2MIDI1.qmr &<br />
sleep 10<br />
yoshimi -S &<br />
sleep 10<br />
}}<br />
<br />
The above will start a complete realtime JACK live-synthesis setup, integrating several tools. Details of each line follow. When discovering your own best configuration, it is helpful to do trial and error using QjackCtl's GUI with a non-D-Bus JACK2 version.<br />
<br />
====Details of the shell-based example setup====<br />
<br />
jack_control start<br />
Starts JACK if it is not already started.<br />
sudo schedtool -R -p 20 `pidof jackdbus`<br />
Set JACK to realtime mode in the Linux kernel, priority 20 (options range 1-99).<br />
jack_control eps realtime true<br />
Sets JACK to realtime mode in its own internal setup.<br />
jack_control ds alsa<br />
Sets JACK to use the ALSA driver set.<br />
jack_control dps device hw:HD2<br />
Sets JACK to use ALSA-compatible sound card named HD2. One can find the names with {{ic|cat /proc/asound/cards}}. Most ALSA tutorials and default configurations use card numbers, but this can get confusing when external MIDI devices are in use; names make it easier.<br />
jack_control dps rate 48000<br />
Sets JACK to use 48000 khz sampling. Happens to work very well with this card. Some cards only do 44100, many will go much higher. The higher you go, the lower your latency, but the better your card and your CPU has to be, and software has to support this as well.<br />
jack_control dps nperiods 2<br />
Sets JACK to use 2 periods. 2 is right for motherboard, PCI, PCI-X, etc.; 3 for USB.<br />
jack_control dps period 64<br />
Sets JACK to use 64 periods per frame. Lower is less latency, but the setting in this script gives 2.67 ms latency, which is nicely low without putting too much stress on the particular hardware this example was built for. If a USB sound system were in use it might be good to try 32. Anything less than 3-4 ms should be fine for realtime synthesis and/or FX, 5 ms is the smallest a human being can detect. There are many cases of perfect-storm-gorgeous hardware which can handle 1 ms latency without stressing the CPU, but definitely this is not always the case! QjackCtl will tell you how you are doing; at no-load, which means no clients attached, you will want a max of 3-5% CPU usage, and if you cannot get that without xruns (the red numbers which mean the system cannot keep up with the demands), you will have to improve your hardware. There are many inexpensive USB sound systems which produce very good quality at very low latency if the USB is good on the motherboard, but not all. <br />
sleep 10<br />
Wait for the above to settle.<br />
/usr/bin/a2jmidid -e &<br />
Start the ALSA-to-JACK MIDI bridge. Good for mixing in applications which take MIDI input through ALSA but not JACK.<br />
sleep 10<br />
Wait for the above to settle.<br />
qjackctl &<br />
Load QjackCtl. GUI configuration tells it to run in the system tray. It will pick up the JACK session started by D-Bus just fine, and very smoothly too. It maintains the patchbay, the connections between these applications and any other JACK-enabled apps to be started manually. The patchbay is set up using manual GUI, but connections pre-configured in the patchbay are automatically created by QjackCtl itself when apps are started.<br />
sleep 10<br />
Wait for the above to settle.<br />
<br />
qmidiroute ~/All2MIDI1.qmr &<br />
Load qmidiroute, loading a custom-created configuration file which will rewrite all MIDI events on all channels to channel 1. This is useful when plugging the PC into any keyboard anywhere -- no matter what the keyboard's channel defaults to, qmidiroute will send the signal to the synth on channel 1, where it needs it. qmidiroute is capable of very complex and useful configurations of many sorts, including multiple simultaneous translations, transpositions, signal type rewrites, etcetera.<br />
sleep 10<br />
Wait for the above to settle.<br />
yoshimi -S &<br />
Load the Yoshimi synthesizer, using the pre-saved default state.<br />
sleep 10<br />
Wait for the above to settle.<br />
<br />
With all of the above in a script run at logon, and with the QjackCtl patchbay set correctly, all we have to do is plug the PC/laptop into a MIDI keyboard using a USB-to-MIDI adapter, or simply the USB-in MIDI capability of many modern keyboards, and you are ready to play!<br />
<br />
The essence of QJackCtl is described fairly well in [http://www.linuxjournal.com/article/8354?page=full this article.]<br />
<br />
===A GUI-based example setup===<br />
<br />
{{Accuracy|You don't need to install pulseaudio to use QjackCtl, this section is confusing.}}<br />
<br />
The shell-based example above, lays out in detail lots of things you may well need to know, and it does work well. If you want something much more GUI, however, do this:<br />
<br />
* Install {{Pkg|jack2-dbus}}.<br />
* Install {{Pkg|pulseaudio}}.<br />
* Install {{Pkg|pulseaudio-alsa}}.<br />
* Install {{Pkg|qjackctl}}, and tell your GUI window/desktop system to run it at startup.<br />
* Make sure QjackCtl is told to:<br />
** use the D-Bus interface,<br />
** run at startup,<br />
** save its configuration to the default location,<br />
** start the JACK audio server on application startup,<br />
** enable the system tray icon, and<br />
** start minimized to sytem tray.<br />
* Reboot.<br />
* After logging in, you will see QjackCtl in your system tray. Left-click on it.<br />
* Start tweaking in the QjackCtl GUI. The info embedded in the shell-script setup above may be of some help :-) As may be the info in [http://www.linuxjournal.com/article/8354 this article]. Just remember that you have to get your latency down to less than 5ms for live tone production or filtration of any sort, or the delay will be obvious to player and listener alike.<br />
* From the [[AUR]], install {{AUR|non-sessionmanager-git}}; it has the function of setting up "sessions": sets of other audio software items which Jack (through the QjackCtl patchbay or not!) will wire together. NSM can handle as many different sessions as you wish to set up; and as a result, it's all GUI, apart from the one rc.local edit in the beginning.<br />
<br />
===Playing nice with ALSA===<br />
To allow Alsa programs to play while jack is running you must install the jack plugin for alsa with {{Pkg|alsa-plugins}}.<br />
<br />
And enable it by editing (or creating) /etc/asound.conf (system wide settings) to have these lines:<br />
{{bc|<nowiki><br />
# convert alsa API over jack API<br />
# use it with<br />
# % aplay foo.wav<br />
<br />
# use this as default<br />
pcm.!default {<br />
type plug<br />
slave { pcm "jack" }<br />
}<br />
<br />
ctl.mixer0 {<br />
type hw<br />
card 1<br />
}<br />
<br />
# pcm type jack<br />
pcm.jack {<br />
type jack<br />
playback_ports {<br />
0 system:playback_1<br />
1 system:playback_2<br />
}<br />
capture_ports {<br />
0 system:capture_1<br />
1 system:capture_2<br />
}<br />
}</nowiki>}}<br />
<br />
You need not restart your computer or anything. Just edit the alsa config files, start up jack, and there you go...<br />
<br />
Remember to start it as a '''user'''. If you start it with {{ic|jackd}} -d alsa" as user X, it will not work for user Y.<br />
<br />
Another approach, using ALSA loopback device (more complex but probably more robust), is described in [http://alsa.opensrc.org/Jack_and_Loopback_device_as_Alsa-to-Jack_bridge this article].<br />
<br />
=== gstreamer ===<br />
Example: watching a live stream without gconf<br />
{{bc|<nowiki>gst-launch-0.10 playbin2 uri=http://streamer.stackingdwarves.net/bewerungeroom.ogv audio-sink="jackaudiosink"</nowiki>}}<br />
<br />
Setting gstreamer to use jack using gconftool-2<br />
gconftool-2 --type string --set /system/gstreamer/0.10/audio/default/audiosink "jackaudiosink buffer-time=2000000"<br />
gconftool-2 --type string --set /system/gstreamer/0.10/audio/default/musicaudiosink "jackaudiosink buffer-time=2000000"<br />
gconftool-2 --type string --set /system/gstreamer/0.10/audio/default/chataudiosink "jackaudiosink buffer-time=2000000"<br />
<br />
Further information: http://jackaudio.org/gstreamer_via_jack<br />
<br />
=== PulseAudio ===<br />
If you need to keep {{Pkg|pulseaudio}} installed (in the event it is required by other packages, like {{Pkg|gnome-settings-daemon}}), you may want to prevent it from spawning automatically with X and taking over from JACK.<br />
<br />
Edit {{ic|/etc/pulse/client.conf}}, uncomment "autospawn" and set it to "no":<br />
;autospawn = yes<br />
autospawn = no<br />
<br />
''If you want both to play along, see: [[PulseAudio/Examples#PulseAudio through JACK]]''<br />
<br />
=== Firewire ===<br />
In order to prevent ALSA from messing around with your firewire devices you have to blacklist all firewire related kernel modules. This also prevents PulseAudio from using firewire. Create the following file:<br />
<br />
{{hc|/etc/modprobe.d/alsa-no-jack.conf|<br />
blacklist snd-fireworks<br />
blacklist snd-bebob<br />
blacklist snd-oxfw<br />
blacklist snd-dice<br />
blacklist snd-firewire-digi00x<br />
blacklist snd-firewire-tascam<br />
blacklist snd-firewire-lib<br />
blacklist snd-firewire-transceiver<br />
blacklist snd-fireface<br />
blacklist snd-firewire-motu<br />
}}<br />
<br />
''The list of modules is the most recent available at the time of writing at [https://github.com/takaswie/snd-firewire-improve Alsa Firewire Improve Repository].''<br />
<br />
Now you can unload your loaded firewire modules or reboot.<br />
<br />
==MIDI==<br />
<br />
JACK can handle one soundcard very well, and an arbitrary number of MIDI devices (connected e.g. via USB).<br />
If you start JACK and want to use a MIDI keyboard or a synthesizer or some other pure MIDI device, you have to start JACK with a proper soundcard (one that actually outputs or inputs PCM sound).<br />
As soon you have done that, you can connect the MIDI device. E.g. with QjackCtl ({{pkg|qjackctl}}), you click on the connect button and you will find your device listed under JACK-MIDI or ALSA-MIDI, depending on the driver.<br />
<br />
For JACK-MIDI, you may want to set the '''MIDI Driver''' to '''seq''' or '''raw''' in QjackCtl ''Setup > Settings''. This should make your MIDI device appear under the ''MIDI'' tab. You can also change the name of the client (from a generic "midi_capture_1" to something more descriptive), if you enable ''Setup > Display > Enable client/port aliases'' and then ''Enable client/port aliases editing (rename)''.<br />
<br />
For ALSA-MIDI, make sure to turn on '''Enable ALSA Sequencer support''' in QjackCtl ''Setup > Misc''. This will add the ''ALSA'' tab in QjackCtl ''Connect'' window where your MIDI controller will show up.<br />
<br />
For bridging ALSA-MIDI to JACK-MIDI, you may consider using a2jmidid ({{Pkg|a2jmidid}}). The following command will export all available ALSA MIDI ports to JACK MIDI ports:<br />
$ a2jmidid -e<br />
They will be visible in QjackCtl under the ''MIDI'' tab labelled "a2j" client.<br />
You can automate starting of a2jmidid by adding to QjackCtl ''Setup > Options > Execute script after Startup'': {{ic|/usr/bin/a2jmidid -e &}}<br />
{{note|When connecting MIDI keyboard controllers in QjackCtl, make sure to ''Expand All'' first and connect the desired ''Output Ports'' (below the ''Readable Clients'') to the ''Input Ports'' (below the ''Writable Clients''). As a shortcut, if you select a writable client instead of individual ports as your destination, it should connect all its currently displayed output ports underneath.}}<br />
<br />
*'''Q:''' What is the difference between JACK-MIDI and ALSA-MIDI?<br />
*'''A:''' The former has improved timing and sample accurate MIDI event alignment. It extends or may even replace the latter but at this point they both co-exist.<br />
<br />
To install some M-Audio MIDI keyboards, you will need the firmware package {{AUR|midisport-firmware}} in the [[AUR]]. Also, the snd_usb_audio module has to be available.<br />
For more information about specific USB MIDI devices, see http://alsa.opensrc.org/USBMidiDevices.<br />
<br />
==Troubleshooting==<br />
==="Cannot lock down memory area (Cannot allocate memory)" message on startup===<br />
<br />
See [[Realtime process management#Configuring PAM]] and ensure that the user is in the {{ic|audio}} [[group]].<br />
<br />
===jack2-dbus and qjackctl errors===<br />
Still having the "Cannot allocate memory" and/or "Cannot connect to server socket err = No such file or directory" error(s) when pressing qjackctl's start button (assuming that you have package jack2-dbus installed) ?<br />
<br />
Please delete {{ic|~/.jackdrc}}, {{ic|~/.config/jack/conf.xml}}, {{ic|~/.config/rncbc.org/QjackCtl.conf}}. Kill ''jackdbus'' and restart from scratch :)<br />
(Thanks to nedko)<br />
<br />
Also try running <br />
$ fuser /dev/snd/*<br />
and check the resulting PID's with<br />
$ ps ax | grep [PID here]<br />
This will hopefully show the conflicting programs.<br />
<br />
===Problems with specific applications===<br />
====VLC - no audio after starting JACK====<br />
Run VLC and change the following menu options:<br />
* Tools > Preferences<br />
* Show settings: All<br />
* Audio > Output modules > Audio output module: JACK audio output<br />
* Audio > Output modules > JACK: Automatically connect to writable clients (enable)</div>Daoohttps://wiki.archlinux.org/index.php?title=JACK_Audio_Connection_Kit&diff=454010JACK Audio Connection Kit2016-10-15T14:26:57Z<p>Daoo: pulseaudio-alsa ships a correct /etc/asound.conf file</p>
<hr />
<div>[[Category:Sound]]<br />
[[fr:Jack]]<br />
[[ja:JACK Audio Connection Kit]]<br />
{{Related articles start}}<br />
{{Related|Professional audio}}<br />
{{Related articles end}}<br />
<br />
==Installation==<br />
In order for JACK to work properly, your user needs to be [[Users and groups#Group management|added]] to the {{ic|audio}} group for access to higher ulimits defined in {{ic|/etc/security/limits.d/99-audio.conf}}, which is needed for realtime audio processing.<br />
{{Note|You need to manually add your user to the {{ic|audio}} group even if you're using logind, since logind just handles access to direct hardware.}}<br />
<br />
There are two JACK implementations, see [https://github.com/jackaudio/jackaudio.github.com/wiki/Q_difference_jack1_jack2 this comparison] for the difference between the two. In short, Jack 1 and Jack 2 are equivalent implementations of the same protocol. Programs compiled against Jack 1 will work with Jack 2 without recompile (and vice versa). <br />
<br />
===JACK2===<br />
'''JACK2''' is a C++ implementation with SMP support. [[Install]] it with the {{Pkg|jack2}} package. If you are on a 64-bit installation and need to run 32-bit applications that require JACK, also install the {{Pkg|lib32-jack2}} package from the [[multilib]] repository.<br />
<br />
====JACK2 D-Bus====<br />
JACK2 with [[D-Bus]] can be installed via {{Pkg|jack2-dbus}}. It is the same as the {{Pkg|jack2}} package but does not provide the legacy "jackd" server.<br />
<br />
It is controlled by the {{ic|jack_control}} utility. The important commands are listed below:<br />
jack_control start - starts the jack server<br />
jack_control stop - stops the jack server<br />
jack_control ds alsa - selects alsa as the driver (backend)<br />
jack_control eps realtime True - set engine parameters, such as realtime<br />
jack_control dps period 256 - set the driver parameter period to 256<br />
<br />
===JACK===<br />
'''JACK''' uses a C API and supports more than one soundcard on Linux (plus MIDI). [[Install]] it with the {{pkg|jack}} package. If you are on a 64-bit installation and need to run 32-bit applications that require JACK, also install the {{Pkg|lib32-jack}} package from the [[multilib]] repository.<br />
<br />
===GUI===<br />
If you want a GUI control application, the most widely used one is {{Pkg|qjackctl}}.<br />
<br />
Also, [http://kxstudio.linuxaudio.org/Applications:Cadence cadence] offers a set of applications and eases some advanced jack configurations. It is available on [https://aur.archlinux.org/packages/cadence/ aur].<br />
<br />
==Basic Configuration==<br />
<br />
===Overview===<br />
<br />
[http://www.linux-magazine.com/content/download/63041/486886/version/1/file/JACK_Audio_Server.pdf This Linux Magazine article] is a very good general overview, although do not worry about manual compilations, quite a few JACK tools work right off the wire now, ''after'' JACK is configured correctly.<br />
<br />
Most tutorials are advising a realtime kernel, which is quite helpful for live synthesis and FX; but for purposes of recording and editing it is not necessary, as long as you set up for non-realtime latencies -- 10-40+ ms (100-500+ ms for older hardware).<br />
<br />
The right configuration for your hardware and application needs, depends on several factors.<br />
<br />
===A shell-based example setup===<br />
<br />
<br />
<br />
{{Accuracy|The JACK FAQ points to this specific section as an example of a myth that needs debunking. [https://github.com/jackaudio/jackaudio.github.com/wiki/FAQ_and_Myths It says], "No you do not [have to set up realtime scheduling of each audio application]. There are countless examples e.g. archwiki which demonstrate elaborate scripts to raise the priority of audio-processing applications. In fact they all achieve the opposite."}}<br />
<br />
The D-Bus edition of JACK2 can make startup much easier. Formerly, we had to have QjackCtl start it for us, or use a daemonizer, or some other method. But using {{Pkg|jack2-dbus}}, we can easily start and configure it via a shell script.<br />
<br />
Create a shell script that can be executed at X login:<br />
<br />
{{hc|start_jack.sh|<br />
#!/bin/bash<br />
<br />
jack_control start<br />
sudo schedtool -R -p 20 `pidof jackdbus`<br />
jack_control eps realtime true<br />
jack_control ds alsa<br />
jack_control dps device hw:HD2<br />
jack_control dps rate 48000<br />
jack_control dps nperiods 2<br />
jack_control dps period 64<br />
sleep 10<br />
/usr/bin/a2jmidid -e &<br />
sleep 10<br />
qjackctl &<br />
sleep 10<br />
qmidiroute ~/All2MIDI1.qmr &<br />
sleep 10<br />
yoshimi -S &<br />
sleep 10<br />
}}<br />
<br />
The above will start a complete realtime JACK live-synthesis setup, integrating several tools. Details of each line follow. When discovering your own best configuration, it is helpful to do trial and error using QjackCtl's GUI with a non-D-Bus JACK2 version.<br />
<br />
====Details of the shell-based example setup====<br />
<br />
jack_control start<br />
Starts JACK if it is not already started.<br />
sudo schedtool -R -p 20 `pidof jackdbus`<br />
Set JACK to realtime mode in the Linux kernel, priority 20 (options range 1-99).<br />
jack_control eps realtime true<br />
Sets JACK to realtime mode in its own internal setup.<br />
jack_control ds alsa<br />
Sets JACK to use the ALSA driver set.<br />
jack_control dps device hw:HD2<br />
Sets JACK to use ALSA-compatible sound card named HD2. One can find the names with {{ic|cat /proc/asound/cards}}. Most ALSA tutorials and default configurations use card numbers, but this can get confusing when external MIDI devices are in use; names make it easier.<br />
jack_control dps rate 48000<br />
Sets JACK to use 48000 khz sampling. Happens to work very well with this card. Some cards only do 44100, many will go much higher. The higher you go, the lower your latency, but the better your card and your CPU has to be, and software has to support this as well.<br />
jack_control dps nperiods 2<br />
Sets JACK to use 2 periods. 2 is right for motherboard, PCI, PCI-X, etc.; 3 for USB.<br />
jack_control dps period 64<br />
Sets JACK to use 64 periods per frame. Lower is less latency, but the setting in this script gives 2.67 ms latency, which is nicely low without putting too much stress on the particular hardware this example was built for. If a USB sound system were in use it might be good to try 32. Anything less than 3-4 ms should be fine for realtime synthesis and/or FX, 5 ms is the smallest a human being can detect. There are many cases of perfect-storm-gorgeous hardware which can handle 1 ms latency without stressing the CPU, but definitely this is not always the case! QjackCtl will tell you how you are doing; at no-load, which means no clients attached, you will want a max of 3-5% CPU usage, and if you cannot get that without xruns (the red numbers which mean the system cannot keep up with the demands), you will have to improve your hardware. There are many inexpensive USB sound systems which produce very good quality at very low latency if the USB is good on the motherboard, but not all. <br />
sleep 10<br />
Wait for the above to settle.<br />
/usr/bin/a2jmidid -e &<br />
Start the ALSA-to-JACK MIDI bridge. Good for mixing in applications which take MIDI input through ALSA but not JACK.<br />
sleep 10<br />
Wait for the above to settle.<br />
qjackctl &<br />
Load QjackCtl. GUI configuration tells it to run in the system tray. It will pick up the JACK session started by D-Bus just fine, and very smoothly too. It maintains the patchbay, the connections between these applications and any other JACK-enabled apps to be started manually. The patchbay is set up using manual GUI, but connections pre-configured in the patchbay are automatically created by QjackCtl itself when apps are started.<br />
sleep 10<br />
Wait for the above to settle.<br />
<br />
qmidiroute ~/All2MIDI1.qmr &<br />
Load qmidiroute, loading a custom-created configuration file which will rewrite all MIDI events on all channels to channel 1. This is useful when plugging the PC into any keyboard anywhere -- no matter what the keyboard's channel defaults to, qmidiroute will send the signal to the synth on channel 1, where it needs it. qmidiroute is capable of very complex and useful configurations of many sorts, including multiple simultaneous translations, transpositions, signal type rewrites, etcetera.<br />
sleep 10<br />
Wait for the above to settle.<br />
yoshimi -S &<br />
Load the Yoshimi synthesizer, using the pre-saved default state.<br />
sleep 10<br />
Wait for the above to settle.<br />
<br />
With all of the above in a script run at logon, and with the QjackCtl patchbay set correctly, all we have to do is plug the PC/laptop into a MIDI keyboard using a USB-to-MIDI adapter, or simply the USB-in MIDI capability of many modern keyboards, and you are ready to play!<br />
<br />
The essence of QJackCtl is described fairly well in [http://www.linuxjournal.com/article/8354?page=full this article.]<br />
<br />
===A GUI-based example setup===<br />
<br />
The shell-based example above, lays out in detail lots of things you may well need to know, and it does work well. If you want something much more GUI, however, do this:<br />
<br />
* Install {{Pkg|jack2-dbus}}.<br />
* Install {{Pkg|pulseaudio}}.<br />
* Install {{Pkg|pulseaudio-alsa}}.<br />
* Install {{Pkg|qjackctl}}, and tell your GUI window/desktop system to run it at startup.<br />
* Make sure QjackCtl is told to:<br />
** use the D-Bus interface,<br />
** run at startup,<br />
** save its configuration to the default location,<br />
** start the JACK audio server on application startup,<br />
** enable the system tray icon, and<br />
** start minimized to sytem tray.<br />
* Reboot.<br />
* After logging in, you will see QjackCtl in your system tray. Left-click on it.<br />
* Start tweaking in the QjackCtl GUI. The info embedded in the shell-script setup above may be of some help :-) As may be the info in [http://www.linuxjournal.com/article/8354 this article]. Just remember that you have to get your latency down to less than 5ms for live tone production or filtration of any sort, or the delay will be obvious to player and listener alike.<br />
* From the [[AUR]], install {{AUR|non-sessionmanager-git}}; it has the function of setting up "sessions": sets of other audio software items which Jack (through the QjackCtl patchbay or not!) will wire together. NSM can handle as many different sessions as you wish to set up; and as a result, it's all GUI, apart from the one rc.local edit in the beginning.<br />
<br />
===Playing nice with ALSA===<br />
To allow Alsa programs to play while jack is running you must install the jack plugin for alsa with {{Pkg|alsa-plugins}}.<br />
<br />
And enable it by editing (or creating) /etc/asound.conf (system wide settings) to have these lines:<br />
{{bc|<nowiki><br />
# convert alsa API over jack API<br />
# use it with<br />
# % aplay foo.wav<br />
<br />
# use this as default<br />
pcm.!default {<br />
type plug<br />
slave { pcm "jack" }<br />
}<br />
<br />
ctl.mixer0 {<br />
type hw<br />
card 1<br />
}<br />
<br />
# pcm type jack<br />
pcm.jack {<br />
type jack<br />
playback_ports {<br />
0 system:playback_1<br />
1 system:playback_2<br />
}<br />
capture_ports {<br />
0 system:capture_1<br />
1 system:capture_2<br />
}<br />
}</nowiki>}}<br />
<br />
You need not restart your computer or anything. Just edit the alsa config files, start up jack, and there you go...<br />
<br />
Remember to start it as a '''user'''. If you start it with {{ic|jackd}} -d alsa" as user X, it will not work for user Y.<br />
<br />
Another approach, using ALSA loopback device (more complex but probably more robust), is described in [http://alsa.opensrc.org/Jack_and_Loopback_device_as_Alsa-to-Jack_bridge this article].<br />
<br />
=== gstreamer ===<br />
Example: watching a live stream without gconf<br />
{{bc|<nowiki>gst-launch-0.10 playbin2 uri=http://streamer.stackingdwarves.net/bewerungeroom.ogv audio-sink="jackaudiosink"</nowiki>}}<br />
<br />
Setting gstreamer to use jack using gconftool-2<br />
gconftool-2 --type string --set /system/gstreamer/0.10/audio/default/audiosink "jackaudiosink buffer-time=2000000"<br />
gconftool-2 --type string --set /system/gstreamer/0.10/audio/default/musicaudiosink "jackaudiosink buffer-time=2000000"<br />
gconftool-2 --type string --set /system/gstreamer/0.10/audio/default/chataudiosink "jackaudiosink buffer-time=2000000"<br />
<br />
Further information: http://jackaudio.org/gstreamer_via_jack<br />
<br />
=== PulseAudio ===<br />
If you need to keep {{Pkg|pulseaudio}} installed (in the event it is required by other packages, like {{Pkg|gnome-settings-daemon}}), you may want to prevent it from spawning automatically with X and taking over from JACK.<br />
<br />
Edit {{ic|/etc/pulse/client.conf}}, uncomment "autospawn" and set it to "no":<br />
;autospawn = yes<br />
autospawn = no<br />
<br />
''If you want both to play along, see: [[PulseAudio/Examples#PulseAudio through JACK]]''<br />
<br />
=== Firewire ===<br />
In order to prevent ALSA from messing around with your firewire devices you have to blacklist all firewire related kernel modules. This also prevents PulseAudio from using firewire. Create the following file:<br />
<br />
{{hc|/etc/modprobe.d/alsa-no-jack.conf|<br />
blacklist snd-fireworks<br />
blacklist snd-bebob<br />
blacklist snd-oxfw<br />
blacklist snd-dice<br />
blacklist snd-firewire-digi00x<br />
blacklist snd-firewire-tascam<br />
blacklist snd-firewire-lib<br />
blacklist snd-firewire-transceiver<br />
blacklist snd-fireface<br />
blacklist snd-firewire-motu<br />
}}<br />
<br />
''The list of modules is the most recent available at the time of writing at [https://github.com/takaswie/snd-firewire-improve Alsa Firewire Improve Repository].''<br />
<br />
Now you can unload your loaded firewire modules or reboot.<br />
<br />
==MIDI==<br />
<br />
JACK can handle one soundcard very well, and an arbitrary number of MIDI devices (connected e.g. via USB).<br />
If you start JACK and want to use a MIDI keyboard or a synthesizer or some other pure MIDI device, you have to start JACK with a proper soundcard (one that actually outputs or inputs PCM sound).<br />
As soon you have done that, you can connect the MIDI device. E.g. with QjackCtl ({{pkg|qjackctl}}), you click on the connect button and you will find your device listed under JACK-MIDI or ALSA-MIDI, depending on the driver.<br />
<br />
For JACK-MIDI, you may want to set the '''MIDI Driver''' to '''seq''' or '''raw''' in QjackCtl ''Setup > Settings''. This should make your MIDI device appear under the ''MIDI'' tab. You can also change the name of the client (from a generic "midi_capture_1" to something more descriptive), if you enable ''Setup > Display > Enable client/port aliases'' and then ''Enable client/port aliases editing (rename)''.<br />
<br />
For ALSA-MIDI, make sure to turn on '''Enable ALSA Sequencer support''' in QjackCtl ''Setup > Misc''. This will add the ''ALSA'' tab in QjackCtl ''Connect'' window where your MIDI controller will show up.<br />
<br />
For bridging ALSA-MIDI to JACK-MIDI, you may consider using a2jmidid ({{Pkg|a2jmidid}}). The following command will export all available ALSA MIDI ports to JACK MIDI ports:<br />
$ a2jmidid -e<br />
They will be visible in QjackCtl under the ''MIDI'' tab labelled "a2j" client.<br />
You can automate starting of a2jmidid by adding to QjackCtl ''Setup > Options > Execute script after Startup'': {{ic|/usr/bin/a2jmidid -e &}}<br />
{{note|When connecting MIDI keyboard controllers in QjackCtl, make sure to ''Expand All'' first and connect the desired ''Output Ports'' (below the ''Readable Clients'') to the ''Input Ports'' (below the ''Writable Clients''). As a shortcut, if you select a writable client instead of individual ports as your destination, it should connect all its currently displayed output ports underneath.}}<br />
<br />
*'''Q:''' What is the difference between JACK-MIDI and ALSA-MIDI?<br />
*'''A:''' The former has improved timing and sample accurate MIDI event alignment. It extends or may even replace the latter but at this point they both co-exist.<br />
<br />
To install some M-Audio MIDI keyboards, you will need the firmware package {{AUR|midisport-firmware}} in the [[AUR]]. Also, the snd_usb_audio module has to be available.<br />
For more information about specific USB MIDI devices, see http://alsa.opensrc.org/USBMidiDevices.<br />
<br />
==Troubleshooting==<br />
==="Cannot lock down memory area (Cannot allocate memory)" message on startup===<br />
<br />
See [[Realtime process management#Configuring PAM]] and ensure that the user is in the {{ic|audio}} [[group]].<br />
<br />
===jack2-dbus and qjackctl errors===<br />
Still having the "Cannot allocate memory" and/or "Cannot connect to server socket err = No such file or directory" error(s) when pressing qjackctl's start button (assuming that you have package jack2-dbus installed) ?<br />
<br />
Please delete {{ic|~/.jackdrc}}, {{ic|~/.config/jack/conf.xml}}, {{ic|~/.config/rncbc.org/QjackCtl.conf}}. Kill ''jackdbus'' and restart from scratch :)<br />
(Thanks to nedko)<br />
<br />
Also try running <br />
$ fuser /dev/snd/*<br />
and check the resulting PID's with<br />
$ ps ax | grep [PID here]<br />
This will hopefully show the conflicting programs.<br />
<br />
===Problems with specific applications===<br />
====VLC - no audio after starting JACK====<br />
Run VLC and change the following menu options:<br />
* Tools > Preferences<br />
* Show settings: All<br />
* Audio > Output modules > Audio output module: JACK audio output<br />
* Audio > Output modules > JACK: Automatically connect to writable clients (enable)</div>Daoohttps://wiki.archlinux.org/index.php?title=LightDM&diff=454009LightDM2016-10-15T14:15:41Z<p>Daoo: Fix session configuration link.</p>
<hr />
<div>[[Category:Display managers]]<br />
[[es:LightDM]]<br />
[[fr:LightDM]]<br />
[[ja:LightDM]]<br />
[[ru:LightDM]]<br />
[[zh-CN:LightDM]]<br />
{{Related articles start}}<br />
{{Related|Display manager}}<br />
{{Related|GDM}}<br />
{{Related|KDM}}<br />
{{Related|LXDM}}<br />
{{Related articles end}}<br />
<br />
[http://www.freedesktop.org/wiki/Software/LightDM LightDM] is a cross-desktop [[display manager]]. Its key features are:<br />
* Cross-desktop - supports different desktop technologies.<br />
* Supports different display technologies (X, Mir, ...).<br />
* Lightweight - low memory usage and high performance.<br />
* Supports guest sessions.<br />
* Supports remote login (incoming - XDMCP, VNC, outgoing - XDMCP, pluggable).<br />
* Comprehensive test suite.<br />
* Low code complexity.<br />
<br />
More details about LightDM's design can be found [http://www.freedesktop.org/wiki/Software/LightDM/Design here].<br />
<br />
== Installation ==<br />
<br />
[[Install]] {{Pkg|lightdm}}. Note that stable releases are even-numbered (1.8, 1.10) while development releases are odd-numbered (1.9, 1.11). These development releases are available with {{AUR|lightdm-devel}}. Also available is {{AUR|lightdm-bzr}}.<br />
<br />
=== Greeter===<br />
<br />
You will probably want to install a greeter. A greeter is a GUI that prompts the user for credentials, lets the user select a session, and so on. It's possible to use LightDM without a greeter, but only if an automatic login is configured. The reference greeter is {{Pkg|lightdm-gtk-greeter}}. LightDM attempts to use this greeter when started unless configured to do otherwise.<br />
<br />
The official repositories contain the following alternative greeters.<br />
* {{Pkg|lightdm-kde-greeter}}: A greeter used with KDE4.<br />
* lightdm-deepin-greeter ({{Pkg|deepin-session-ui}}): A greeter from the [[Deepin]] project.<br />
<br />
Other alternative greeters are available in the [[AUR]].<br />
* {{AUR|lightdm-webkit2-greeter}}: A greeter that uses Webkit2 for theming. It supersedes {{AUR|lightdm-webkit-greeter}}.<br />
* {{AUR|lightdm-unity-greeter}}: The greeter used by Ubuntu's [[Unity]].<br />
* {{AUR|lightdm-pantheon-greeter}}: A greeter from the elementary OS project.<br />
<br />
You can set the default greeter by changing the {{ic|[Seat:*]}} section of the LightDM configuration file, like so:<br />
<br />
{{hc|/etc/lightdm/lightdm.conf|2=<br />
[Seat:*]<br />
...<br />
greeter-session=lightdm-yourgreeter-greeter<br />
}}<br />
<br />
Which greeters are available? What values may be assigned to the {{ic|greeter-session}} option? Each {{ic|.desktop}} file in the {{ic|/usr/share/xgreeters}} directory denotes an available greeter. In this example, the {{ic|lightdm-gtk-greeter}} and {{ic|lightdm-kde-greeter}} greeters are available:<br />
$ ls -1 /usr/share/xgreeters/<br />
lightdm-gtk-greeter.desktop<br />
lightdm-kde-greeter.desktop<br />
<br />
== Enabling LightDM ==<br />
<br />
Make sure to [[enable]] {{ic|lightdm.service}} so LightDM will be started at boot, see also [[Display manager#Loading the display manager]].<br />
<br />
== Command line tool ==<br />
<br />
LightDM offers a command line tool, {{ic|dm-tool}}, which can be used to lock the current seat, switch sessions, etc, which is useful with 'minimalist' window managers and for testing. To see a list of available commands, execute:<br />
$ dm-tool --help<br />
<br />
== Testing ==<br />
<br />
First, [[install]] {{Pkg|xorg-server-xephyr}} from the [[official repositories]].<br />
<br />
Then, run LightDM as an X application:<br />
$ lightdm --test-mode --debug<br />
<br />
== Optional configuration and tweaks ==<br />
<br />
LightDM can be configured by modifying its config file, {{ic|/etc/lightdm/lightdm.conf}}.<br />
<br />
Some greeters have their own configuration files. For example:<br />
<br />
{{Pkg|lightdm-gtk-greeter}}: {{ic|/etc/lightdm/lightdm-gtk-greeter.conf}}<br />
<br />
{{AUR|lightdm-webkit2-greeter}}: {{ic|/etc/lightdm/lightdm-webkit2-greeter.conf}}<br />
<br />
{{Pkg|lightdm-kde-greeter}}: {{ic|/etc/lightdm/lightdm-kde-greeter.conf}}<br />
<br />
=== Changing background images/colors ===<br />
<br />
You can set the background to a hex color or an image. Some greeters offer more robust background options like background selection from the login screen, random backgrounds, etc.<br />
<br />
==== GTK+ greeter ====<br />
<br />
You can use the {{Pkg|lightdm-gtk-greeter-settings}} gui.<br />
<br />
Users wishing to customize the wallpaper on the greeter screen need to edit {{ic|/etc/lightdm/lightdm-gtk-greeter.conf}} and define the {{ic|background}} variable under the {{ic|[greeter]}} section. For example:<br />
{{hc|/etc/lightdm/lightdm-gtk-greeter.conf|2=<br />
[greeter]<br />
background=/usr/share/pixmaps/black_and_white_photography-wallpaper-1920x1080.jpg<br />
}}<br />
<br />
{{Note|It is recommended to place the PNG or JPG file in {{ic|/usr/share/pixmaps}} since the LightDM user needs read access to the wallpaper file.}}<br />
<br />
===== GTK3 Dark Theme =====<br />
GTK3 introduced "dark" alternate color palettes for themes, but lightdm-gtk-greeter does not yet support specifing one natively. A workaround is to override the theme with an evironment variable in {{ic|/usr/share/xgreeters/lightdm-gtk-greeter.desktop}} For example:<br />
{{hc|/usr/share/xgreeters/lightdm-gtk-greeter.desktop|2=<br />
[Desktop Entry]<br />
Name=LightDM GTK+ Greeter<br />
Comment=This runs the GTK+ greeter, it should only be run from LightDM<br />
Exec=env GTK_THEME=Adwaita:dark lightdm-gtk-greeter<br />
Type=Application<br />
X-Ubuntu-Gettext-Domain=lightdm<br />
}}<br />
<br />
==== Webkit2 greeter ====<br />
<br />
The {{AUR|lightdm-webkit2-greeter}} allows you to choose a background image directly on the login screen. It also offers an option to display a random image each time it starts. By default, images are sourced from {{ic|/usr/share/backgrounds}}. You can change the background images directory by editing {{ic|lightdm-webkit2-greeter.conf}}. For example:<br />
{{hc|/etc/lightdm/lightdm-webkit2-greeter.conf|2=<br />
[branding]<br />
background_images = /usr/share/backgrounds<br />
}}<br />
<br />
{{Note|The background images directory must be accessible to the LightDM user so it should not be located anywhere under {{ic|/home}}. }}<br />
<br />
==== Unity greeter ====<br />
<br />
Users using the {{AUR|lightdm-unity-greeter}} must edit the {{ic|/usr/share/glib-2.0/schemas/com.canonical.unity-greeter.gschema.xml}} file and then execute:<br />
# glib-compile-schemas /usr/share/glib-2.0/schemas/<br />
<br />
According to [https://bbs.archlinux.org/viewtopic.php?id=149945 this] page.<br />
<br />
==== KDE greeter ====<br />
<br />
Go to ''System Settings > Login Screen (LightDM)'' and change the background image for your theme.<br />
<br />
Alternatively, you can edit the {{ic|Background}} variable in {{ic|lightdm-kde-greeter.conf}} :<br />
<br />
{{hc|/etc/lightdm/lightdm-kde-greeter.conf|2=<br />
[greeter]<br />
theme-name=classic<br />
<br />
[greeter-settings]<br />
Background=/usr/share/archlinux/wallpaper/archlinux-underground.jpg<br />
BackgroundKeepAspectRatio=true<br />
GreetMessage=Welcome to %hostname%<br />
}}<br />
<br />
=== Changing your avatar ===<br />
<br />
{{Tip|If you are using KDE, you can change your avatar in KDE System Settings.}}<br />
<br />
First, make sure the {{pkg|accountsservice}} package from the [[official repositories]] is installed, then set it up as follows, replacing {{ic|''username''}} with the desired user's login name. The ''.png'' file extension should not be included in the filename.<br />
<br />
* Edit or create the file {{ic|/var/lib/AccountsService/users/''username''}}, and add the lines<br />
<br />
[User]<br />
Icon=/var/lib/AccountsService/icons/''username''<br />
<br />
* Create the file {{ic|/var/lib/AccountsService/icons/''username''}} using a 96x96 PNG image file.<br />
<br />
{{Note|Make sure that both created files have 644 permissions, use [[chmod]] to correct them.}}<br />
<br />
=== Sources of Arch-centric 64x64 icons ===<br />
<br />
The {{AUR|archlinux-artwork}} package from the [[AUR]] contains some nice examples that install to {{ic|/usr/share/archlinux/icons}} and that can be copied to {{ic|/usr/share/icons/hicolor/64x64/devices}} as follows:<br />
<br />
# find /usr/share/archlinux/icons -name "*64*" -exec cp {} /usr/share/icons/hicolor/64x64/devices \;<br />
<br />
After copying, the {{AUR|archlinux-artwork}} package can be removed.<br />
<br />
=== Enabling autologin ===<br />
<br />
Edit the LightDM configuration file and ensure these lines are uncommented and correctly configured:<br />
<br />
{{hc|/etc/lightdm/lightdm.conf|2=<br />
[Seat:*]<br />
pam-service=lightdm<br />
pam-autologin-service=lightdm-autologin<br />
autologin-user=''username''<br />
autologin-user-timeout=0<br />
session-wrapper=/etc/lightdm/Xsession<br />
}}<br />
<br />
LightDM goes through [[PAM]] even when {{ic|autologin}} is enabled. You must be part of the {{ic|autologin}} group to be able to login automatically without entering your password:<br />
<br />
# groupadd -r autologin<br />
# gpasswd -a ''username'' autologin<br />
<br />
{{Note|GNOME users, and by extension any gnome-keyring user will have to set up a blank password to their keyring for it to be unlocked automatically.}}<br />
<br />
=== Enabling interactive passwordless login ===<br />
<br />
LightDM goes through PAM so you must configure the lightdm configuration of PAM:<br />
<br />
{{hc|/etc/pam.d/lightdm|2=<br />
#%PAM-1.0<br />
'''auth sufficient pam_succeed_if.so user ingroup nopasswdlogin'''<br />
auth include system-login<br />
...<br />
}}<br />
<br />
You must then also be part of the {{ic|nopasswdlogin}} group to be able to login interactively without entering your password:<br />
<br />
# groupadd -r nopasswdlogin<br />
# gpasswd -a ''username'' nopasswdlogin<br />
<br />
{{Note|GNOME users, and by extension any gnome-keyring user may have to follow the instructions at the end of the previous section on enabling autologin.}}<br />
<br />
To create a new user account that logs in automatically and additionally able to login again without a password the user can be created with supplementary membership of both groups, e.g.:<br />
<br />
# useradd -mG autologin,nopasswdlogin -s /bin/bash ''username''<br />
<br />
=== Hiding system and services users ===<br />
To prevent system users from showing-up in the login, install the optional dependency {{Pkg|accountsservice}}, or add the user names to {{ic|/etc/lightdm/users.conf}} under {{ic|hidden-users}}. The first option has the advantage of not needing to update the list when more users are added or removed.<br />
<br />
=== Migrating from SLiM ===<br />
<br />
Move the contents of [[xinitrc]] to [[xprofile]], removing the call to start the [[window manager]] or [[desktop environment]].<br />
<br />
=== NumLock on by default ===<br />
<br />
Install the {{Pkg|numlockx}} package and then edit {{ic|/etc/lightdm/lightdm.conf}}:<br />
{{hc|/etc/lightdm/lightdm.conf|2=<br />
[Seat:*]<br />
greeter-setup-script=/usr/bin/numlockx on<br />
}}<br />
<br />
=== User switching under Xfce4 ===<br />
<br />
If you use the [[Xfce]] desktop, the Switch User functionality of the Action Button found in your Application Launcher specifically looks for the ''gdmflexiserver'' executable in order to enable itself. If you provide it with an executable shell script {{ic|/usr/bin/gdmflexiserver}} consisting of<br />
<br />
#!/bin/sh<br />
/usr/bin/dm-tool switch-to-greeter<br />
<br />
then user switching in Xfce should work with Lightdm.<br />
<br />
Alternatively, if you use the Whisker Menu, you can go to Properties -> Commands and change the "Switch Users" command directly to:<br />
<br />
dm-tool switch-to-greeter<br />
<br />
You can also switch users from the [[XScreenSaver]] lock screen - see [[XScreenSaver#LightDM]].<br />
<br />
=== Default session === <br />
<br />
Lightdm, like other DMs, stores the last-selected xsession in {{ic|~/.dmrc}}. See [[Display manager#Session configuration]] for more info.<br />
<br />
=== Adjusting the login window's position ===<br />
<br />
==== GTK+ greeter ====<br />
<br />
Users need to edit {{ic|/etc/lightdm/lightdm-gtk-greeter.conf}} and enter a value for the {{ic|position}} variable. It accepts {{ic|x}} and {{ic|y}} values, either absolute (in pixels) or relative (in percent). Each value can also have an additional anchor location for the window, {{ic|start}}, {{ic|center}} and {{ic|end}} separated from the value by a comma.<br />
<br />
Example:<br />
<br />
position=200,start 50%,center<br />
<br />
=== VNC Server ===<br />
Lightdm can also be used to connec to via vnc. Make sure to install {{pkg|tigervnc}} on the server side and optional as your vncclient on the client PC.<br />
<br />
Setup an authentification password on the server as root:<br />
<br />
# vncpasswd /etc/vncpasswd<br />
<br />
Edit the lightdm configuration file as shown below. Note that {{ic|listen-address}} configures the vnc to only listen to connections from localhost. This is used to only allow connections via [https://wiki.archlinux.org/index.php/TigerVNC#On_the_client ssh and port forwarding]. If you want to allow insecure connections you can disable this setting.<br />
<br />
{{hc|/etc/lightdm/lightdm.conf|2=<br />
[VNCServer]<br />
enabled=true<br />
command=Xvnc -rfbauth /etc/vncpasswd<br />
port=5900<br />
listen-address=localhost<br />
width=1024<br />
height=768<br />
depth=24<br />
}}<br />
<br />
Now open an ssh tunnel and connect to localhost as described in [[TigerVNC#On_the_client]].<br />
<br />
{{Note|If you get a blank screen upon opening the VNC connection, try a different lightdm greeter.}}<br />
<br />
== Troubleshooting ==<br />
If you encounter consistent screen flashing and ultimately no LightDM on boot, ensure that you have defined the greeter correctly in LightDM's config file. And if you have correctly defined the GTK greeter, make sure the {{ic|xsessions-directory}} (default: {{ic|/usr/share/xsessions}}) exists and contains at least one .desktop file.<br />
<br />
The same error can happen on lightdm startup if the last used session is not available anymore (eg. you last used gnome and then removed the gnome-session package): the easiest workaround is to temporarily restore the removed package. Another solution might be:<br />
<br />
# dbus-send --system --type=method_call --print-reply --dest=org.freedesktop.Accounts /org/freedesktop/Accounts/User1000 org.freedesktop.Accounts.User.SetXSession string:xfce<br />
<br />
This example sets the session "xfce" as default for the user 1000.<br />
<br />
=== Wrong locale displayed ===<br />
<br />
In case of your locale not being displayed correctly in Lightdm add your locale to {{ic|/etc/environment}}<br />
LANG=pt_PT.utf8<br />
<br />
=== Missing icons with GTK greeter ===<br />
<br />
If you're using {{Pkg|lightdm-gtk-greeter}} as a greeter and it shows placeholder images as icons, make sure valid icon themes and themes are installed and configured. Check the following file:<br />
<br />
{{hc|/etc/lightdm/lightdm-gtk-greeter.conf|2=<br />
[greeter]<br />
theme-name=mate # this should be the name of a directory under /usr/share/themes/<br />
icon-theme-name=mate # this should be the name of a fully featured icons set directory under /usr/share/icons/<br />
}}<br />
<br />
=== LightDM freezes on login attempt ===<br />
<br />
You may find that after entering the correct username and password and attempting to log in, LightDM freezes and you are unable to continue to the desktop. To fix the issue, reinstall the {{Pkg|gdk-pixbuf2}} package. See [https://bbs.archlinux.org/viewtopic.php?id=179031 this forum thread].<br />
<br />
=== LightDM displaying in wrong monitor ===<br />
<br />
If you are using multiple monitors, LightDM may display in the wrong one (e.g. if your primary monitor is on the right). To force the LightDM login screen to display on a specific monitor, edit {{ic|/etc/lightdm/lightdm.conf}} and change the ''display-setup-script'' parameter like this:<br />
{{hc|/etc/lightdm/lightdm.conf|2=<br />
display-setup-script=xrandr --output ''HDMI1'' --primary<br />
}}<br />
<br />
Replace ''HDMI1'' with your real monitor ID, which you can find from '''xrandr''' command output.<br />
<br />
=== LightDM doesn't appear ===<br />
<br />
It may happen that your system boots so fast that LightDM service is started before your graphics drivers are properly loaded. If this is your case, you'll want to add the following config to your lightdm.conf file:<br />
<br />
[LightDM]<br />
logind-check-graphical=true<br />
<br />
This setting will tell LightDM to wait until graphics devices are ready before spawning greeters/autostarting sessions on them.<br />
<br />
=== Pulseaudio not starting automatically ===<br />
<br />
See [[PulseAudio#Running]].<br />
<br />
== See also ==<br />
<br />
* {{Pkg|light-locker}}, a screen locker using LightDM.<br />
* [https://wiki.ubuntu.com/LightDM Ubuntu Wiki article]<br />
* [http://wiki.gentoo.org/wiki/LightDM Gentoo Wiki article]<br />
* [https://launchpad.net/lightdm Launchpad Page]<br />
* [http://www.mattfischer.com/blog/?tag=lightdm LightDM blog]</div>Daoohttps://wiki.archlinux.org/index.php?title=Netcfg&diff=201198Netcfg2012-05-12T21:13:09Z<p>Daoo: Add note about rfkill and net-auto-wireless</p>
<hr />
<div>[[Category:Networking]]<br />
[[fr:Netcfg]]<br />
[[ro:Netcfg]]<br />
[[tr:netcfg]]<br />
{{i18n|Netcfg}}<br />
{{Article summary start}}<br />
{{Article summary text|A guide to installing and configuring netcfg &ndash; network configuration and profile scripts.}}<br />
{{Article summary heading|Overview}}<br />
{{Article summary text|{{Networking overview}}}}<br />
{{Article summary heading|Resources}}<br />
{{Article summary link|netcfg network scripts repository|https://projects.archlinux.org/netcfg.git/}}<br />
{{Article summary end}}<br />
{{Lowercase title}}<br />
<br />
From the [https://projects.archlinux.org/netcfg.git/tree/docs/netcfg.txt netcfg man page]:<br />
<br />
:'''''netcfg''' is used to configure and manage network connections via profiles. It has pluggable support for a range of connection types, such as wireless, ethernet, ppp. It is also capable of starting/stopping many to one connections, that is, multiple connections within the same profile, optionally with bonding.''<br />
<br />
netcfg is useful for users seeking a simple and robust means of managing multiple network configurations (e.g. laptop users). For systems connecting to a single network, the [[network]] daemon may be more appropriate.<br />
<br />
==Preparation==<br />
In the simplest cases, users must at least know the name of their network interface(s) (e.g. {{ic|eth0}}, {{ic|wlan0}}). If configuring a static IP address, the IP addresses of the default gateway and name server(s) must also be known.<br />
<br />
If connecting to a wireless network, have some basic information ready. For a wireless network this includes what type of security is used, the network name (ESSID), and any password or encryption keys. Additionally, ensure the proper drivers and firmware are installed for the wireless device, as described in [[Wireless Setup]].<br />
<br />
==Installation==<br />
Ensure you have the latest version of {{Pkg|netcfg}} installed. Older versions have more bugs and may not work well with the latest drivers. The {{Pkg|netcfg}} package is available in the [[Official Repositories|official repositories]].<br />
<br />
As of {{Pkg|netcfg}} version 2.5.x, optional dependencies include {{Pkg|wpa_actiond}} &ndash; required for automatic/roaming wireless connections &ndash; and {{Pkg|ifplugd}} &ndash; required for automatic Ethernet configuration. ([https://www.archlinux.org/news/487/ More information].)<br />
<br />
If you want to have [[Bash]] completion support for netcfg, install the {{Pkg|bash-completion}} package from the official repositories.<br />
<br />
==Configuration==<br />
Network profiles are stored in the {{ic|/etc/network.d}} directory. To minimize the potential for errors, copy an example configuration from {{ic|/etc/network.d/examples/}} to {{ic|/etc/network.d/mynetwork}}. The file name is the name of the network profile ("mynetwork" is used as an example throughout this article). The name is not a network setting and does not need to match the wireless network name (SSID).<br />
<br />
Depending on the connection type and security, use one of the following examples from {{ic|/etc/network.d/examples}} as a base. Be wary of examples found on the Internet as they often contain deprecated options that may cause problems.<br />
<br />
{| border="1"<br />
! Connection type/security !! Example profile<br />
|-<br />
| Wireless; WEP hex key || {{ic|wireless-wep}}<br />
|-<br />
| Wireless; WEP string key || {{ic|wireless-wep-string-key}}<br />
|-<br />
| Wireless; WPA-Personal (passphrase/pre-shared key) || {{ic|wireless-wpa}}<br />
|-<br />
| Wireless; WPA-Enterprise || {{ic|wireless-wpa-config}} (wpa_supplicant configuration is external) <br /> {{ic|wireless-wpa-configsection}} (wpa_supplicant configuration stored as string)<br />
|-<br />
| Wired; DHCP || {{ic|ethernet-dhcp}}<br />
|-<br />
| Wired; static IP || {{ic|ethernet-static}}<br />
|-<br />
| Wired; iproute configuration || {{ic|ethernet-iproute}}<br />
|}<br />
<br />
Next, modify the new configuration file, {{ic|/etc/network.d/mynetwork}}:<br />
<br />
* Set {{ic|INTERFACE}} to the correct wireless or Ethernet interface. This can be checked with {{ic|ip link}} and {{ic|iwconfig}}.<br />
* Ensure the {{ic|ESSID}} and {{ic|KEY}} (passphrase) are set correctly for wireless connections. Typos in these fields are common errors.<br />
** Note that WEP ''string'' keys (not ''hex'' keys) must be specified with a leading {{ic|s:}} (e.g. {{ic|<nowiki>KEY="s:somepasskey"</nowiki>}}).<br />
<br />
{{Note|netcfg configurations are valid Bash scripts. Any configuration involving special characters such as {{ic|$}} or {{ic|\}} needs to be quoted correctly otherwise it will be interpreted by Bash. To avoid interpretation, use single quotes or backslash escape characters where appropriate.}}<br />
<br />
{{Note|Network information (e.g. wireless passkey) will be stored in plain text format, so users may want to change the permissions on the newly created profile (e.g. {{ic|chmod 0600 /etc/network.d/mynetwork}} to make it readable by root only).}}<br />
<br />
{{Note|For WPA-Personal, it is also possible to use WPA passkey encoded into a hexadecimal string, instead of as a plain text passkey.<br />
Follow the procedure on the [[Wpa_supplicant#Classic_method:_.2Fetc.2Fwpa_supplicant.conf|WPA supplicant page's first example exercise]] to generate a hexadecimal string from you WPA passkey.<br /><br />
Save the new hexadecimal string into your wireless WPA profile in {{ic|/etc/network.d/mynetwork}} as the value of the {{ic|KEY}} variable (make sure this will be the only {{ic|KEY}} variable enabled), to look similar to this (replace the string with your one):<br />
KEY<nowiki>=</nowiki>'7b271c9a7c8a6ac07d12403a1f0792d7d92b5957ff8dfd56481ced43ec6a6515'<br />
That should do it, without the need to reveal the passkey.<br /><br />
}}<br />
<br />
==Usage==<br />
To connect a profile:<br />
# netcfg mynetwork<br />
<br />
To disconnect a profile:<br />
# netcfg down <profile-name><br />
<br />
If successful, users can configure netcfg to connect automatically or during boot. If the connection fails, see [[#Troubleshooting]] for solutions and how to get help.<br />
<br />
For other functions, see:<br />
$ netcfg help<br />
<br />
==Connecting automatically==<br />
Several methods are available to users wanting to automatically connect network profiles (e.g. during boot or whilst roaming). Note that a network profile must be properly configured within the {{ic|/etc/network.d}} directory ''first'' (see [[#Configuration]]).<br />
<br />
{{Tip|If enabling one of the following daemons and nothing is configured within the {{ic|INTERFACES}} array in {{ic|/etc/rc.conf}}, you may remove the {{ic|network}} daemon from the {{ic|DAEMONS}} array. If you mount [[NFS]] shares during boot, ensure the {{ic|netfs}} daemon remains listed, though (otherwise the network will be dropped before unmounting shares during shutdown).}}<br />
<br />
===net-profiles===<br />
'''{{ic|net-profiles}} allows users to connect profiles during boot.'''<br />
<br />
To enable this feature, users must add {{ic|net-profiles}} to the {{ic|DAEMONS}} array in {{ic|/etc/[[rc.conf]]}} and specify profiles to try in the {{ic|NETWORKS}} array:<br />
<br />
{{hc|/etc/rc.conf|<nowiki><br />
NETWORKS=(mynetwork yournetwork)<br />
<br />
...<br />
<br />
DAEMONS=(... net-profiles ...)<br />
</nowiki>}}<br />
<br />
Alternatively, {{ic|net-profiles}} can be configured to display a menu &ndash; allowing users to choose a desired profile &ndash; by setting the contents of the {{ic|NETWORKS}} array to {{ic|menu}}:<br />
<br />
{{hc|/etc/rc.conf|<nowiki><br />
NETWORKS=(menu)<br />
<br />
...<br />
<br />
DAEMONS=(... net-profiles ...)<br />
</nowiki>}}<br />
<br />
Additionally, the {{Pkg|dialog}} package is required.<br />
<br />
{{Tip|Access the menu at any time by running {{ic|netcfg-menu}} in a terminal.}}<br />
<br />
===net-auto-wireless===<br />
'''{{ic|net-auto-wireless}} allows users to automatically connect to wireless networks with proper roaming support.'''<br />
<br />
To enable this feature, users must add {{ic|net-auto-wireless}} to the {{ic|DAEMONS}} array in {{ic|/etc/rc.conf}}:<br />
{{hc|/etc/rc.conf|<nowiki><br />
DAEMONS=(... net-auto-wireless ...)<br />
</nowiki>}}<br />
<br />
And specify the desired wireless interface with the {{ic|WIRELESS_INTERFACE}} variable:<br />
<br />
{{hc|/etc/conf.d/netcfg|<nowiki><br />
WIRELESS_INTERFACE="wlan0"<br />
</nowiki>}}<br />
<br />
In {{ic|/etc/conf.d/netcfg}} it is also possible to define a list of wireless networks that should be automatically connected, if no such list is used, all wireless networks will be tried.<br />
<br />
Additionally, the {{Pkg|wpa_actiond}} package is required. Note that {{ic|wireless-wpa-config}} profiles do not work with {{ic|net-auto-wireless}}. Convert them to {{ic|wireless-wpa-configsection}} instead.<br />
<br />
===net-auto-wired===<br />
'''{{ic|net-auto-wired}} allows users to automatically connect to wired networks.'''<br />
<br />
To enable this feature, users must [[pacman|install]] {{Pkg|ifplugd}}, then add {{ic|net-auto-wired}} to the {{ic|DAEMONS}} array in {{ic|/etc/rc.conf}} and specify the desired wired interface with the {{ic|WIRED_INTERFACE}} variable:<br />
<br />
{{hc|/etc/rc.conf|<nowiki><br />
WIRED_INTERFACE="eth0"<br />
<br />
...<br />
<br />
DAEMONS=(... net-auto-wired ...)<br />
</nowiki>}}<br />
<br />
The daemon starts an {{ic|ifplugd}} process which runs {{ic|/etc/ifplugd/netcfg.action}} when the status of the wired interface changes (e.g. a cable is plugged in or unplugged). On plugging in a cable, attempts are made to start any profiles with {{ic|CONNECTION <nowiki>=</nowiki> "ethernet"}} or {{ic|"ethernet-iproute"}} and {{ic|INTERFACE <nowiki>=</nowiki> WIRED_INTERFACE}} until one of them succeeds.<br />
<br />
{{Note|DHCP profiles are tried before static ones, which could lead to undesired results in some cases. However, one can tell netcfg to prefer a particular interface by adding {{ic|1=AUTO_WIRED=1}} to the desired profile.}}<br />
<br />
{{Note|The {{ic|net-auto-wired}} daemon cannot start multiple ifplugd processes for multiple interfaces (unlike ifplugd's own {{ic|/etc/rc.d/ifplugd}} which can).}}<br />
<br />
==Tips and tricks==<br />
<br />
===Passing arguments to iwconfig before connecting===<br />
Simply add the following to a profile:<br />
<br />
IWCONFIG="<arguments>"<br />
<br />
Where {{ic|<arguments>}} can be any valid {{ic|iwconfig}} argument. The script then runs {{ic|iwconfig $INTERFACE $IWCONFIG}}.<br />
<br />
For example, force the card to register to a specific access point given by MAC address:<br />
IWCONFIG="ap 12:34:56:78:90:12"<br />
<br />
This supersedes the {{ic|IWOPTS}} and {{ic|WEP_OPTS}} options which were incompletely implemented.<br />
<br />
===rfkill (enable/disable radio power)===<br />
netcfg can enable/disable radio for wireless cards equipped with software control of radio. For wireless cards with hardware switches, netcfg can detect disabled hardware switches and fail accordingly.<br />
<br />
To enable rfkill support, you need to specify what sort of switch the wireless interface has; hardware or software. This can be set within a profile or at the interface level ({{ic|/etc/network.d/interfaces/$INTERFACE}}; see [[#Per-interface configuration]]). <br />
<br />
RFKILL=soft # can be either 'hard' or 'soft'<br />
<br />
For some kill switches the rfkill entry in {{ic|/sys}} is not linked to the interface and the {{ic|RFKILL_NAME}} variable needs to be set to the contents of the matching {{ic|/sys/class/rfkill/rfkill#/name}}.<br />
<br />
For example, on an Eee PC:<br />
<br />
RFKILL=soft<br />
RFKILL_NAME='eeepc-wlan'<br />
<br />
On a mid-2011 Thinkpad:<br />
<br />
RFKILL=hard<br />
RFKILL_NAME='phy0'<br />
<br />
<br />
{{Note|The {{ic|net-auto-wireless}} daemon requires an interface level configuration of rfkill or it will not start.}}<br />
<br />
{{Warning|Some devices (at least few SiS cards) can create {{Ic|/sys/class/rfkill/rfkill#}} entries with different names on every switch. Something like this will work in such cases (wifi-only solution!):<br />
{{hc|/etc/network.d/interfaces/wlan0|<nowiki><br />
RFKILL=hard<br />
RFKILL_NAME=`cat /sys/class/rfkill/rfkill*/name 2> /dev/null || echo ""`</nowiki>}}}}<br />
<br />
===Execute commands before/after interface up/down===<br />
If your interface requires special actions prior/after the establishment/closure of a connection, you may use the {{ic|PRE_UP}}, {{ic|POST_UP}}, {{ic|PRE_DOWN}}, and {{ic|POST_DOWN}} variables.<br />
<br />
For example, if you want to configure your wireless card to operate in ad-hoc mode but you can only change modes when the interface is down, you could use something like this:<br />
<br />
PRE_UP="ip link set wlan0 down; iwconfig wlan0 mode ad-hoc"<br />
<br />
Or if you want to mount your network shares after a successful connection, you could use:<br />
<br />
POST_UP="sleep 5; mount /mnt/shares/nexus/utorrent 2>/dev/null"<br />
<br />
Sometimes you may want to run something from netcfg with another user:<br />
<br />
POST_UP="su -c '/you/own/command' username"<br />
<br />
{{Note|If the commands specified in these properties return anything other than 0 (success), netcfg aborts the current operation. So if you want to mount a certain network share that might not be available at the time of connection (thus returning an error), you could create a separate [[Bash]] script with the mount commands and a {{ic|exit 0}} at the end. Alternatively you can add {{ic|<nowiki>|| true</nowiki>}} to the end of the command that may fail.}}<br />
<br />
===Intermittent Connection Failure===<br />
Some driver+hardware combinations drop associations sometimes. Use the pre and post commands to add/remove the driver and use a script like the following to fix the current connection:<br />
<br />
{{hc|/usr/local/bin/netcfgd|<nowiki><br />
#!/bin/bash<br />
log() { logger -t "$( basename $0 )" "$*" ; }<br />
<br />
main() {<br />
local host<br />
while sleep 1; do<br />
[[ "$( netcfg current )" = "" ]] && continue<br />
<br />
host=$( route -n | awk '/^0.0.0.0/ { print $2 }' )<br />
ping -c 1 $host && continue<br />
<br />
log "trying to reassociate"<br />
wpa_cli reassociate<br />
ping -c 1 $host && continue<br />
<br />
log "reassociate failed, reconfiguring network"<br />
netcfg -r $( netcfg current )<br />
done<br />
}<br />
<br />
exec 1>/dev/null<br />
[[ $EUID != 0 ]] && { log "must be root"; exit 1; }<br />
<br />
for cmd in wpa_cli ping netcfg; do<br />
! which $cmd && {<br />
log "can't find command ${cmd}, exiting..."<br />
exit 1<br />
}<br />
done<br />
<br />
log 'starting...'<br />
main <br />
<br />
</nowiki>}}<br />
<br />
===Per-interface configuration===<br />
Configuration options that apply to all profiles using an interface can be set using {{ic|/etc/network.d/interfaces/$INTERFACE}}. For example:<br />
<br />
/etc/network.d/interfaces/wlan0<br />
<br />
This is useful for {{ic|wpa_supplicant}} options, rfkill switch support, pre/post up/down scripts and {{ic|net-auto-wireless}}. These options are loaded ''before'' profiles so that any profile-based options will take priority.<br />
<br />
{{ic|/etc/network.d/interfaces/$INTERFACE}} may contain any valid profile option, though you are likely to use {{ic|PRE_UP}}/{{ic|DOWN}} and {{ic|POST_UP}}/{{ic|DOWN}} (described in the previous section) or one of the options listed below. Remember that these options are set for ''all'' profiles using the interface; you probably do not want to connect to your work VPN here, for instance, as it will try to connect on ''every'' wireless network!<br />
<br />
WPA_GROUP - Setting the group of the wpa_ctrl interface<br />
WPA_COUNTRY - Enforces local regulatory limitations and allows use of more channels<br />
WPA_DRIVER - Defaults to wext, may want nl80211 for mac80211 devices<br />
<br />
{{Note|{{ic|POST_UP}}/{{ic|POST_DOWN}} require the {{Pkg|wpa_actiond}} package.}}<br />
<br />
===Output hooks===<br />
netcfg has limited support to load hooks that handle output. By default it loads the {{ic|arch}} hook which provides the familiar output that you see. A syslog logging hook is also included. These can be found at {{ic|/usr/lib/network/hooks}}.<br />
<br />
===ArchAssistant (GUI)===<br />
<br />
A Qt-based netcfg front-end called ArchAssistant exists. It proposes to manage and connect/disconnect profiles from a system tray icon. Automatic wireless detection is also available. This tool is particularly useful for laptop users.<br />
<br />
Links:<br />
<br />
* {{AUR|archassistant}} in the [[Arch User Repository|AUR]]<br />
* [http://www.kde-apps.org/content/show.php/ArchAssistant?content=76760 archassistant on kde-apps.org] <br />
<br />
There is also a relatively new GUI for netcfg on qt-apps.org that does only network configuration. You can find it [http://www.qt-apps.org/content/show.php/netcfgGUI?content=99523 here].<br />
<br />
===wifi-select===<br />
<br />
There is a console tool for selecting wireless networks in "real-time" (in [[NetworkManager]] fashion) called {{Pkg|wifi-select}}. The tool is convenient for use in Internet cafés or other places you are visiting for the first (and maybe the last) time. With this tool, you do not need to create a profile for a new network, just run {{ic|wifi-select wlan0}} as root and choose the desired network. <br />
<br />
The tool is currently packaged as {{Pkg|wifi-select}} and is available in the [[Official Repositories|official repositories]].<br />
<br />
{{Pkg|wifi-select}} does the following:<br />
* parses {{ic|iwlist scan}} results and presents a list of networks along with their security settings (WPA/WEP/none) using {{Pkg|dialog}}<br />
* if user selects network with existing profile -- just use this profile to connect with {{Pkg|netcfg}}<br />
* if user selects a new network (for example, a Wi-Fi hotspot), {{Pkg|wifi-select}} automatically generates a new profile with corresponding {{ic|$SECURITY}} and asks for the key (if needed). It uses DHCP as {{ic|$IP}} by default<br />
* then, if the connection succeeds, the profile is saved for later usage<br />
* if the connection fails, the user is asked if he or she wants to keep generated profile for further usage (for example to change {{ic|$IP}} to static or adjust some additional options)<br />
<br />
Links: <br />
<br />
* [https://bbs.archlinux.org/viewtopic.php?id=63973 Forum thread] related to development of {{Pkg|wifi-select}}<br />
* [http://hg.horna.org.ua/wifi-select/ wifi-select Mercurial repository]<br />
* [https://github.com/sphynx/wifi-select wifi-select on GitHub]<br />
<br />
{{Note|Latest version of netcfg will provide '''wifi-menu''' with functionality equal to that of wifi-select.}}<br />
<br />
===Passing arguments to dhcpcd===<br />
<br />
For example, add<br />
DHCP_OPTIONS='-C resolv.conf -G'<br />
to the desired profile. The above example prevents {{Pkg|dhcpcd}} from writing to {{ic|/etc/resolv.conf}} and setting any default routes.<br />
<br />
===Using dhclient instead of dhcpcd===<br />
<br />
To use {{Pkg|dhclient}} instead of {{Pkg|dhcpcd}}, simply add {{ic|DHCLIENT<nowiki>=</nowiki>yes}} to the desired profile.<br />
<br />
===Configuring a bridge for use with virtual machines (VMs)===<br />
To configure a bridge named br0 with a static IP:<br />
{{hc|/etc/network.d/br0|<nowiki><br />
INTERFACE="br0"<br />
CONNECTION="bridge"<br />
DESCRIPTION="bridge br0 static"<br />
BRIDGE_INTERFACES="eth0"<br />
IP='static'<br />
ADDR='10.0.0.10'<br />
GATEWAY='10.0.0.1'<br />
DNS='10.0.0.1'<br />
</nowiki>}}<br />
<br />
To configure a bridge named br0 with a dhcp IP:<br />
{{hc|/etc/network.d/br0|<nowiki><br />
INTERFACE="br0"<br />
CONNECTION="bridge"<br />
DESCRIPTION="bridge br0 dhcp"<br />
BRIDGE_INTERFACES="eth0"<br />
IP='dhcp'<br />
</nowiki>}}<br />
<br />
Then add the corresponding bridge name to your {{ic|NETWORKS&#61;(...)}} in {{ic|/etc/[[rc.conf]]}}.<br />
<br />
It can be brought up by calling it directly, or by restarting net-profiles.<br />
<br />
netcfg br0<br />
<br />
rc.d restart net-profiles<br />
<br />
===Adding multiple IP addresses to one interface===<br />
If you want to assign multiple IP addresses to 1 specific interface, this can be done by issuing the relevant {{ic|ip}} command in a {{ic|POST_UP}} statement (which as the name suggests will be executed after the interface has been brought up). Multiple statements can be separated with a {{ic|;}}. So if you for example would want to assign both 10.0.0.1 and 10.0.0.2 to interface eth0; the config would look something among the lines of:<br />
<br />
{{hc|/etc/network.d/multiple_ip|<nowiki><br />
INTERFACE="eth0"<br />
CONNECTION="ethernet"<br />
IP='static'<br />
ADDR='10.0.0.1'<br />
POST_UP='ip addr add 10.0.0.2/24 dev eth0'<br />
</nowiki>}}<br />
<br />
===Adding static routes===<br />
When wanting to configure static routes, this can be done by issuing the relevant {{ic|ip}} command in a {{ic|POSTUP}} statement (which as the name suggests will be executed after the interface has been brought up). Optionally, a {{ic|PRE_DOWN}} statement can be added to remove said routes when the interface is brought down. Multiple statements can be separated with a {{ic|;}}. In the below example we'll route 10.0.1.0/24 over interface eth1 and then remove the route when the interface is brought down.<br />
<br />
{{hc|/etc/network.d/static_routes|<nowiki><br />
INTERFACE="eth1"<br />
CONNECTION="ethernet"<br />
IP='static'<br />
POST_UP='ip route add 10.0.1.0/24 dev eth1'<br />
PRE_DOWN='ip route del 10.0.1.0/24 dev eth1'<br />
</nowiki>}}<br />
<br />
==Troubleshooting==<br />
<br />
===Debugging===<br />
To run netcfg with debugging output, set the {{ic|NETCFG_DEBUG}} environment variable to {{ic|"yes"}}, for example:<br />
<br />
# NETCFG_DEBUG="yes" netcfg <arguments><br />
<br />
Debugging information for wpa_supplicant can be logged using {{ic|WPA_OPTS}} within a profile, for example:<br />
<br />
WPA_OPTS="-f/path/to/log"<br />
<br />
Whatever is entered here will be added to the command when {{ic|wpa_supplicant}} is called.<br />
<br />
===Network unavailable===<br />
This error is typically due to:<br />
* Out of range; or<br />
* Driver issue.<br />
<br />
===Wireless association failed===<br />
This error is typically due to:<br />
* Out of range/reception;<br />
* Incorrect configuration;<br />
* Invalid key;<br />
* Driver problem; or<br />
* Trying to connect to a hidden network.<br />
<br />
If the connection problem is due to poor reception, increase the {{ic|TIMEOUT}} variable in {{ic|/etc/network.d/mynetwork}}, such as:<br />
TIMEOUT=60<br />
<br />
If an AP with a hidden SSID is used, try:<br />
PRE_UP='iwconfig $INTERFACE essid $ESSID'<br />
<br />
===Unable to get IP address with DHCP===<br />
This error is typically due to:<br />
* Out of range/reception<br />
<br />
Try increasing {{ic|DHCP_TIMEOUT}} variable in your network {{ic|/etc/network.d/profile}}.<br />
<br />
===Not a valid connection, check spelling or look at examples===<br />
You must set {{ic|CONNECTION}} to one of the connection types listed in the {{ic|/usr/lib/network/connections}} directory. Alternatively, use one of the provided configuration examples in {{ic|/etc/network.d/examples}}.<br />
<br />
===No Connection===<br />
If you get a set of debug messages similar to the following (remembering that profile names and interface names may be different), it could be that the process of bringing up the interface is taking too long. <br />
<br />
DEBUG: Loading profile eth0-dhcp<br />
DEBUG: Configuring interface eth0<br />
:: eth0-dhcp up<br />
DEBUG: status reported to profile_up as:<br />
DEBUG: Loading profile eth0-dhcp<br />
DEBUG: Configuring interface eth0<br />
DEBUG: ethernet_iproute_up ifup<br />
> No connection<br />
DEBUG: profile_up connect failed<br />
[FAIL]<br />
<br />
The default is 2 seconds.<br />
To lengthen the timeout, set the CARRIER_TIMEOUT variable before calling netcfg.<br />
<br />
This thread shows one example of this issue:<br />
https://bbs.archlinux.org/viewtopic.php?id=138615<br />
<br />
===Driver quirks===<br />
{{Note|You most likely do '''not''' need quirks; ensure your configuration is correct before considering them. Quirks are intended for a small range of drivers with unusual issues, many of them older versions. These are workarounds, not solutions.}}<br />
<br />
Some drivers behave oddly and need workarounds to connect. Quirks must be enabled manually. They are best determined by reading the forums, seeing what others have used, and, if that fails, trial and error. Quirks can be combined.<br />
<br />
; {{ic|prescan}}: Run {{ic|iwlist $INTERFACE scan}} before attempting to connect (Broadcom)<br />
; {{ic|preessid}}: Run {{ic|iwconfig $INTERFACE essid $ESSID}} before attempting to connect (ipw3945, Broadcom and Intel PRO/Wireless 4965AGN)<br />
; {{ic|wpaessid}}: Same as previous, run before starting {{ic|wpa_supplicant}}. Not supported anymore - use {{ic|1=IWCONFIG="essid $ESSID"}} instead. (ath9k)<br />
; {{ic|predown}}: Take interface down before association and then restore it after (madwifi)<br />
; {{ic|postsleep}}: Sleep one second before checking if the association was successful<br />
; {{ic|postscan}}: Run {{ic|iwlist scan}} after associating <br />
<br />
Add the required quirks to the netcfg configuration file {{ic|/etc/network.d/mynetwork}}, for example:<br />
QUIRKS=(prescan preessid)<br />
<br />
If you receive "Wireless network not found", "Association failed" errors and have tried the above, or if an AP with a hidden SSID is used, see the above section [[#Wireless association failed]].<br />
<br />
===Ralink legacy drivers rt2500, rt2400 that use iwpriv===<br />
There is no plans to add WPA support to these drivers. rt2x00 is supported, however, and will replace these.<br />
<br />
If you must use them, create a shell script that runs the needed {{ic|iwpriv}} commands and put its path in {{ic|PRE_UP}}.<br />
<br />
===find: "/var/run/network//suspend/": No such file or directory===<br />
If you get this error message, then do not bother because it is a known bug. Create the directory by hand.<br />
<br />
===It still does not work, what do I do?===<br />
If this article did not help solve your problem, the next best places to ask for help are the forums, the mailing list, and the #archlinux IRC channel.<br />
<br />
To be able to determine the problem, we need information. When you ask, provide the following output:<br />
* '''ALL OUTPUT FROM netcfg'''<br />
** This is absolutely crucial to be able determine what went wrong. The message might be short or non-existent, but it can mean a great deal. <br />
* '''{{ic|/etc/network.d}} network profiles'''<br />
** This is also crucial as many problems are simple configuration issues. Feel free to censor your wireless key.<br />
* '''netcfg version'''<br />
* {{ic|lsmod}}<br />
* {{ic|iwconfig}}<br />
<br />
==FAQ==<br />
{{FAQ<br />
|question=Why doesn't netcfg do ''(some feature)''?<br />
|answer=netcfg does not need to; it connects to networks. netcfg is modular and re-usable; see {{ic|/usr/lib/network}} for re-usable functions for custom scripts.}}<br />
<br />
{{FAQ<br />
|question=Why doesn't netcfg behave in ''this'' way?<br />
|answer=netcfg does not enforce any rules; it connects to networks. netcfg does not impose any heuristics, like "disconnect from wireless if Ethernet is connected". If you want behavior like that, it should be simple to write a separate tool on top of netcfg. See the question above.}}<br />
<br />
{{FAQ<br />
|question=Do I still need ''(some thing)'' if I am using netcfg?<br />
|answer=This question usually references {{ic|/etc/hosts}} and the {{ic|HOSTNAME}} variable in {{ic|/etc/rc.conf}}, which are both still required. You may remove {{ic|network}} from the {{ic|DAEMONS}} array if you have configured all of your networks with netcfg, though.}}</div>Daoo