https://wiki.archlinux.org/api.php?action=feedcontributions&user=Holomorph&feedformat=atomArchWiki - User contributions [en]2024-03-28T08:32:52ZUser contributionsMediaWiki 1.41.0https://wiki.archlinux.org/index.php?title=IMWheel&diff=340373IMWheel2014-10-17T16:22:41Z<p>Holomorph: /* Installation */ don't need to mention aur helper</p>
<hr />
<div>{{Lowercase title}}<br />
[[Category:X Server]]<br />
{{Related articles start}}<br />
{{Related|Xorg}}<br />
{{Related|Mouse_acceleration}}<br />
{{Related articles end}}<br />
<br />
''imwheel'' is a tool for tweaking mouse wheel behavior, on a per-program basis. It can map mousewheel input to keyboard input, increase mousewheel speed, and has support for modifier keys.<br />
<br />
== Installation ==<br />
<br />
imwheel is available from [[AUR]] {{AUR|imwheel}} or directly from [http://imwheel.sourceforge.net/ The sourceforge page].<br />
<br />
== Configuration ==<br />
[http://imwheel.sourceforge.net/imwheel.1.html The official HTML documentation (manpage)] is available in the official website.<br />
<br />
imwheel matches window class strings with regular expressions for deciding which windows to apply tweaks to.<br />
<br />
=== Getting the window class string ===<br />
<br />
Run ''xprop'' to get the class string. The program will exit when a window is clicked.<br />
<br />
xprop WM_CLASS | grep -o '"[^"]*"' | head -n 1<br />
<br />
So for the document viewer ''zathura'', this will return the following:<br />
<br />
"zathura"<br />
<br />
=== Edit your configuration file ===<br />
<br />
Create or edit {{ic|~/.imwheelrc}}. In this configuration file lines can be added for each program you want to tweak mousewheel behavior for. The following example will increase the mousewheel speed for the document viewer ''zathura'':<br />
<br />
# Speed up scrolling for the document viewer<br />
"^zathura$"<br />
None, Up, Button4, 4<br />
None, Down, Button5, 4<br />
<br />
=== Run imwheel ===<br />
<br />
Run imwheel simply like so:<br />
<br />
imwheel<br />
<br />
The program will print its PID and run in the background. You may wish to run imwheel in a startup script.</div>Holomorphhttps://wiki.archlinux.org/index.php?title=Llpp&diff=335601Llpp2014-09-15T00:02:14Z<p>Holomorph: /* Custom key bindings */ make example for mode bindings</p>
<hr />
<div>{{Lowercase title}}<br />
[[Category:Graphics and desktop publishing]]<br />
'''llpp''' is a lightweight, fast and featureful PDF viewer based on MuPDF.<br />
<br />
==Installation==<br />
llpp can be installed from the [[AUR]] using the stable {{AUR|llpp}}, or the latest repo version {{AUR|llpp-git}}.<br />
<br />
==Usage==<br />
llpp uses keyboard shortcuts and the mouse to navigate through a document. By default, pressing {{ic|F1}} or {{ic|h}} will bring up a help page where all other key bindings are described.<br />
<br />
Check out the following page for a complete list of the [http://repo.or.cz/w/llpp.git/blob_plain/master:/KEYS key and mouse bindings].<br />
<br />
==Configuration==<br />
llpp uses a configuration file to store settings: {{ic|$XDG_CONFIG_HOME/llpp.conf}} or {{ic|~/.config/llpp.conf}}. This file stores: 1) application defaults, and 2) file-by-file user preferences (e.g. the last page viewed).<br />
<br />
===UI Font===<br />
One can set the font used by llpp by indicating the size and filename in the config. For example:<br />
<br />
<llppconfig><br />
<ui-font size='16'><![CDATA[/usr/share/fonts/TTF/DejaVuSansMono.ttf]]></ui-font><br />
<defaults ... ><br />
...<br />
</defaults><br />
</llppconfig><br />
<br />
===Custom key bindings===<br />
It is possible to configure key bindings. For example, to disable {{ic|Esc}} exiting llpp, add the {{ic|keymap}} element in between the {{ic|defaults}} tags as follows:<br />
<br />
<llppconfig><br />
<defaults ... ><br />
<keymap mode='view'><br />
<map in='esc' out=''/><br />
</keymap><br />
</defaults><br />
</llppconfig><br />
<br />
More examples can be found in llpp's example file [http://repo.or.cz/w/llpp.git/blob/HEAD:/misc/keys.txt keys.txt]. For vi-like key bindings, see [https://gist.github.com/Earnestly/7608794 this example]. <br />
<br />
{{Tip|Bindings can be set for particular modes, including {{ic|birdseye}}, {{ic|global}}, {{ic|help}}, {{ic|info}}, {{ic|listview}}, {{ic|outline}}, and {{ic|view}}. Example [https://gist.github.com/holomorph/9d8e5f483465d92ee69c here].}}<br />
<br />
==Tips and Tricks==<br />
===Reload File===<br />
A document can be reloaded in three ways:<br />
* Pressing the {{ic|r}} key<br />
* Sending a HUP signal to the llpp process<br />
# killall -SIGHUP llpp<br />
* Using the "remote" interface (see below)<br />
<br />
===Remote Interface===<br />
The following commands will setup the remote interface and use it to reload the file "image.pdf".<br />
# mkfifo /tmp/llpp.remote<br />
# llpp -remote /tmp/llpp.remote image.pdf & disown<br />
# sleep 1<br />
# echo reload >/tmp/llpp.remote<br />
<br />
There are eight remote commands:<br />
* {{ic|reload}} - reload<br />
* {{ic|quit}} - quit<br />
* {{ic|goto <page-number> <x-coordinate> <y-coordinate>}} - goto<br />
* {{ic|goto1 <page-number> <relative-y-coordinate>}} - goto<br />
* {{ic|gotor <file-name> <page-number>}} - goto other document<br />
* {{ic|gotord <file-name> <remote-destination>}} - goto named destination within the other document<br />
* {{ic|rect <pageno> <color> <x0> <y0> <x1> <y1>}} - draw a rectangle<br />
* {{ic|activatewin}} - raise and switch to llpp's window<br />
<br />
===Cleanup history===<br />
Files that no longer exist can be cleaned from llpp's history by using a "garbage collecting" script, such as the upstream python2 script [http://repo.or.cz/w/llpp.git/blob/HEAD:/misc/gc.py here]. Use the {{ic|-gc}} flag:<br />
$ llpp -gc /path/to/script<br />
gc.py done.<br />
<br />
== See also ==<br />
* [http://repo.or.cz/w/llpp.git llpp git repo]</div>Holomorphhttps://wiki.archlinux.org/index.php?title=Llpp&diff=335600Llpp2014-09-14T23:48:27Z<p>Holomorph: /* Tips and Tricks */ explain history garbage collection</p>
<hr />
<div>{{Lowercase title}}<br />
[[Category:Graphics and desktop publishing]]<br />
'''llpp''' is a lightweight, fast and featureful PDF viewer based on MuPDF.<br />
<br />
==Installation==<br />
llpp can be installed from the [[AUR]] using the stable {{AUR|llpp}}, or the latest repo version {{AUR|llpp-git}}.<br />
<br />
==Usage==<br />
llpp uses keyboard shortcuts and the mouse to navigate through a document. By default, pressing {{ic|F1}} or {{ic|h}} will bring up a help page where all other key bindings are described.<br />
<br />
Check out the following page for a complete list of the [http://repo.or.cz/w/llpp.git/blob_plain/master:/KEYS key and mouse bindings].<br />
<br />
==Configuration==<br />
llpp uses a configuration file to store settings: {{ic|$XDG_CONFIG_HOME/llpp.conf}} or {{ic|~/.config/llpp.conf}}. This file stores: 1) application defaults, and 2) file-by-file user preferences (e.g. the last page viewed).<br />
<br />
===UI Font===<br />
One can set the font used by llpp by indicating the size and filename in the config. For example:<br />
<br />
<llppconfig><br />
<ui-font size='16'><![CDATA[/usr/share/fonts/TTF/DejaVuSansMono.ttf]]></ui-font><br />
<defaults ... ><br />
...<br />
</defaults><br />
</llppconfig><br />
<br />
===Custom key bindings===<br />
It is possible to configure key bindings. For example, to disable {{ic|Esc}} exiting llpp, add the {{ic|keymap}} element in between the {{ic|defaults}} tags as follows:<br />
<br />
<llppconfig><br />
<defaults ... ><br />
<keymap mode='view'><br />
<map in='esc' out=''/><br />
</keymap><br />
</defaults><br />
</llppconfig><br />
<br />
More examples can be found in llpp's example file [http://repo.or.cz/w/llpp.git/blob/HEAD:/misc/keys.txt keys.txt]. For vi-like key bindings, see [https://gist.github.com/Earnestly/7608794 this example]. <br />
<br />
{{Tip|Bindings can be set for particular modes, including {{ic|birdseye}}, {{ic|global}}, {{ic|help}}, {{ic|info}}, {{ic|listview}}, {{ic|outline}}, and {{ic|view}}.}}<br />
<br />
==Tips and Tricks==<br />
===Reload File===<br />
A document can be reloaded in three ways:<br />
* Pressing the {{ic|r}} key<br />
* Sending a HUP signal to the llpp process<br />
# killall -SIGHUP llpp<br />
* Using the "remote" interface (see below)<br />
<br />
===Remote Interface===<br />
The following commands will setup the remote interface and use it to reload the file "image.pdf".<br />
# mkfifo /tmp/llpp.remote<br />
# llpp -remote /tmp/llpp.remote image.pdf & disown<br />
# sleep 1<br />
# echo reload >/tmp/llpp.remote<br />
<br />
There are eight remote commands:<br />
* {{ic|reload}} - reload<br />
* {{ic|quit}} - quit<br />
* {{ic|goto <page-number> <x-coordinate> <y-coordinate>}} - goto<br />
* {{ic|goto1 <page-number> <relative-y-coordinate>}} - goto<br />
* {{ic|gotor <file-name> <page-number>}} - goto other document<br />
* {{ic|gotord <file-name> <remote-destination>}} - goto named destination within the other document<br />
* {{ic|rect <pageno> <color> <x0> <y0> <x1> <y1>}} - draw a rectangle<br />
* {{ic|activatewin}} - raise and switch to llpp's window<br />
<br />
===Cleanup history===<br />
Files that no longer exist can be cleaned from llpp's history by using a "garbage collecting" script, such as the upstream python2 script [http://repo.or.cz/w/llpp.git/blob/HEAD:/misc/gc.py here]. Use the {{ic|-gc}} flag:<br />
$ llpp -gc /path/to/script<br />
gc.py done.<br />
<br />
== See also ==<br />
* [http://repo.or.cz/w/llpp.git llpp git repo]</div>Holomorphhttps://wiki.archlinux.org/index.php?title=Llpp&diff=335599Llpp2014-09-14T23:31:50Z<p>Holomorph: /* Custom key bindings */ missing word</p>
<hr />
<div>{{Lowercase title}}<br />
[[Category:Graphics and desktop publishing]]<br />
'''llpp''' is a lightweight, fast and featureful PDF viewer based on MuPDF.<br />
<br />
==Installation==<br />
llpp can be installed from the [[AUR]] using the stable {{AUR|llpp}}, or the latest repo version {{AUR|llpp-git}}.<br />
<br />
==Usage==<br />
llpp uses keyboard shortcuts and the mouse to navigate through a document. By default, pressing {{ic|F1}} or {{ic|h}} will bring up a help page where all other key bindings are described.<br />
<br />
Check out the following page for a complete list of the [http://repo.or.cz/w/llpp.git/blob_plain/master:/KEYS key and mouse bindings].<br />
<br />
==Configuration==<br />
llpp uses a configuration file to store settings: {{ic|$XDG_CONFIG_HOME/llpp.conf}} or {{ic|~/.config/llpp.conf}}. This file stores: 1) application defaults, and 2) file-by-file user preferences (e.g. the last page viewed).<br />
<br />
===UI Font===<br />
One can set the font used by llpp by indicating the size and filename in the config. For example:<br />
<br />
<llppconfig><br />
<ui-font size='16'><![CDATA[/usr/share/fonts/TTF/DejaVuSansMono.ttf]]></ui-font><br />
<defaults ... ><br />
...<br />
</defaults><br />
</llppconfig><br />
<br />
===Custom key bindings===<br />
It is possible to configure key bindings. For example, to disable {{ic|Esc}} exiting llpp, add the {{ic|keymap}} element in between the {{ic|defaults}} tags as follows:<br />
<br />
<llppconfig><br />
<defaults ... ><br />
<keymap mode='view'><br />
<map in='esc' out=''/><br />
</keymap><br />
</defaults><br />
</llppconfig><br />
<br />
More examples can be found in llpp's example file [http://repo.or.cz/w/llpp.git/blob/HEAD:/misc/keys.txt keys.txt]. For vi-like key bindings, see [https://gist.github.com/Earnestly/7608794 this example]. <br />
<br />
{{Tip|Bindings can be set for particular modes, including {{ic|birdseye}}, {{ic|global}}, {{ic|help}}, {{ic|info}}, {{ic|listview}}, {{ic|outline}}, and {{ic|view}}.}}<br />
<br />
==Tips and Tricks==<br />
===Reload File===<br />
A document can be reloaded in three ways:<br />
* Pressing the {{ic|r}} key<br />
* Sending a HUP signal to the llpp process<br />
# killall -SIGHUP llpp<br />
* Using the "remote" interface (see below)<br />
<br />
===Remote Interface===<br />
The following commands will setup the remote interface and use it to reload the file "image.pdf".<br />
# mkfifo /tmp/llpp.remote<br />
# llpp -remote /tmp/llpp.remote image.pdf & disown<br />
# sleep 1<br />
# echo reload >/tmp/llpp.remote<br />
<br />
There are eight remote commands:<br />
* {{ic|reload}} - reload<br />
* {{ic|quit}} - quit<br />
* {{ic|goto <page-number> <x-coordinate> <y-coordinate>}} - goto<br />
* {{ic|goto1 <page-number> <relative-y-coordinate>}} - goto<br />
* {{ic|gotor <file-name> <page-number>}} - goto other document<br />
* {{ic|gotord <file-name> <remote-destination>}} - goto named destination within the other document<br />
* {{ic|rect <pageno> <color> <x0> <y0> <x1> <y1>}} - draw a rectangle<br />
* {{ic|activatewin}} - raise and switch to llpp's window<br />
<br />
== See also ==<br />
* [http://repo.or.cz/w/llpp.git llpp git repo]</div>Holomorphhttps://wiki.archlinux.org/index.php?title=Llpp&diff=335598Llpp2014-09-14T23:04:37Z<p>Holomorph: /* Configuration */ clarify config file location</p>
<hr />
<div>{{Lowercase title}}<br />
[[Category:Graphics and desktop publishing]]<br />
'''llpp''' is a lightweight, fast and featureful PDF viewer based on MuPDF.<br />
<br />
==Installation==<br />
llpp can be installed from the [[AUR]] using the stable {{AUR|llpp}}, or the latest repo version {{AUR|llpp-git}}.<br />
<br />
==Usage==<br />
llpp uses keyboard shortcuts and the mouse to navigate through a document. By default, pressing {{ic|F1}} or {{ic|h}} will bring up a help page where all other key bindings are described.<br />
<br />
Check out the following page for a complete list of the [http://repo.or.cz/w/llpp.git/blob_plain/master:/KEYS key and mouse bindings].<br />
<br />
==Configuration==<br />
llpp uses a configuration file to store settings: {{ic|$XDG_CONFIG_HOME/llpp.conf}} or {{ic|~/.config/llpp.conf}}. This file stores: 1) application defaults, and 2) file-by-file user preferences (e.g. the last page viewed).<br />
<br />
===UI Font===<br />
One can set the font used by llpp by indicating the size and filename in the config. For example:<br />
<br />
<llppconfig><br />
<ui-font size='16'><![CDATA[/usr/share/fonts/TTF/DejaVuSansMono.ttf]]></ui-font><br />
<defaults ... ><br />
...<br />
</defaults><br />
</llppconfig><br />
<br />
===Custom key bindings===<br />
It is possible to configure key bindings. For example, to disable {{ic|Esc}} exiting llpp, add the {{ic|keymap}} element in between the {{ic|defaults}} tags as follows:<br />
<br />
<llppconfig><br />
<defaults ... ><br />
<keymap mode='view'><br />
<map in='esc' out=''/><br />
</keymap><br />
</defaults><br />
</llppconfig><br />
<br />
More examples can be found llpp's example file [http://repo.or.cz/w/llpp.git/blob/HEAD:/misc/keys.txt keys.txt]. For vi-like key bindings, see [https://gist.github.com/Earnestly/7608794 this example]. <br />
<br />
{{Tip|Bindings can be set for particular modes, including {{ic|birdseye}}, {{ic|global}}, {{ic|help}}, {{ic|info}}, {{ic|listview}}, {{ic|outline}}, and {{ic|view}}.}}<br />
<br />
==Tips and Tricks==<br />
===Reload File===<br />
A document can be reloaded in three ways:<br />
* Pressing the {{ic|r}} key<br />
* Sending a HUP signal to the llpp process<br />
# killall -SIGHUP llpp<br />
* Using the "remote" interface (see below)<br />
<br />
===Remote Interface===<br />
The following commands will setup the remote interface and use it to reload the file "image.pdf".<br />
# mkfifo /tmp/llpp.remote<br />
# llpp -remote /tmp/llpp.remote image.pdf & disown<br />
# sleep 1<br />
# echo reload >/tmp/llpp.remote<br />
<br />
There are eight remote commands:<br />
* {{ic|reload}} - reload<br />
* {{ic|quit}} - quit<br />
* {{ic|goto <page-number> <x-coordinate> <y-coordinate>}} - goto<br />
* {{ic|goto1 <page-number> <relative-y-coordinate>}} - goto<br />
* {{ic|gotor <file-name> <page-number>}} - goto other document<br />
* {{ic|gotord <file-name> <remote-destination>}} - goto named destination within the other document<br />
* {{ic|rect <pageno> <color> <x0> <y0> <x1> <y1>}} - draw a rectangle<br />
* {{ic|activatewin}} - raise and switch to llpp's window<br />
<br />
== See also ==<br />
* [http://repo.or.cz/w/llpp.git llpp git repo]</div>Holomorphhttps://wiki.archlinux.org/index.php?title=Llpp&diff=335597Llpp2014-09-14T23:01:06Z<p>Holomorph: /* Configuration */ perhaps using Tip is appropriate here</p>
<hr />
<div>{{Lowercase title}}<br />
[[Category:Graphics and desktop publishing]]<br />
'''llpp''' is a lightweight, fast and featureful PDF viewer based on MuPDF.<br />
<br />
==Installation==<br />
llpp can be installed from the [[AUR]] using the stable {{AUR|llpp}}, or the latest repo version {{AUR|llpp-git}}.<br />
<br />
==Usage==<br />
llpp uses keyboard shortcuts and the mouse to navigate through a document. By default, pressing {{ic|F1}} or {{ic|h}} will bring up a help page where all other key bindings are described.<br />
<br />
Check out the following page for a complete list of the [http://repo.or.cz/w/llpp.git/blob_plain/master:/KEYS key and mouse bindings].<br />
<br />
==Configuration==<br />
llpp uses a configuration file to store settings: {{ic|~/.config/llpp.conf}}. This file stores: 1) application defaults, and 2) file-by-file user preferences (e.g. the last page viewed).<br />
<br />
===UI Font===<br />
One can set the font used by llpp by indicating the size and filename in the config. For example:<br />
<br />
<llppconfig><br />
<ui-font size='16'><![CDATA[/usr/share/fonts/TTF/DejaVuSansMono.ttf]]></ui-font><br />
<defaults ... ><br />
...<br />
</defaults><br />
</llppconfig><br />
<br />
===Custom key bindings===<br />
It is possible to configure key bindings. For example, to disable {{ic|Esc}} exiting llpp, add the {{ic|keymap}} element in between the {{ic|defaults}} tags as follows:<br />
<br />
<llppconfig><br />
<defaults ... ><br />
<keymap mode='view'><br />
<map in='esc' out=''/><br />
</keymap><br />
</defaults><br />
</llppconfig><br />
<br />
More examples can be found llpp's example file [http://repo.or.cz/w/llpp.git/blob/HEAD:/misc/keys.txt keys.txt]. For vi-like key bindings, see [https://gist.github.com/Earnestly/7608794 this example]. <br />
<br />
{{Tip|Bindings can be set for particular modes, including {{ic|birdseye}}, {{ic|global}}, {{ic|help}}, {{ic|info}}, {{ic|listview}}, {{ic|outline}}, and {{ic|view}}.}}<br />
<br />
==Tips and Tricks==<br />
===Reload File===<br />
A document can be reloaded in three ways:<br />
* Pressing the {{ic|r}} key<br />
* Sending a HUP signal to the llpp process<br />
# killall -SIGHUP llpp<br />
* Using the "remote" interface (see below)<br />
<br />
===Remote Interface===<br />
The following commands will setup the remote interface and use it to reload the file "image.pdf".<br />
# mkfifo /tmp/llpp.remote<br />
# llpp -remote /tmp/llpp.remote image.pdf & disown<br />
# sleep 1<br />
# echo reload >/tmp/llpp.remote<br />
<br />
There are eight remote commands:<br />
* {{ic|reload}} - reload<br />
* {{ic|quit}} - quit<br />
* {{ic|goto <page-number> <x-coordinate> <y-coordinate>}} - goto<br />
* {{ic|goto1 <page-number> <relative-y-coordinate>}} - goto<br />
* {{ic|gotor <file-name> <page-number>}} - goto other document<br />
* {{ic|gotord <file-name> <remote-destination>}} - goto named destination within the other document<br />
* {{ic|rect <pageno> <color> <x0> <y0> <x1> <y1>}} - draw a rectangle<br />
* {{ic|activatewin}} - raise and switch to llpp's window<br />
<br />
== See also ==<br />
* [http://repo.or.cz/w/llpp.git llpp git repo]</div>Holomorphhttps://wiki.archlinux.org/index.php?title=Llpp&diff=335596Llpp2014-09-14T22:59:16Z<p>Holomorph: /* Custom key bindings */ add reference to upstream example, mention other modes</p>
<hr />
<div>{{Lowercase title}}<br />
[[Category:Graphics and desktop publishing]]<br />
'''llpp''' is a lightweight, fast and featureful PDF viewer based on MuPDF.<br />
<br />
==Installation==<br />
llpp can be installed from the [[AUR]] using the stable {{AUR|llpp}}, or the latest repo version {{AUR|llpp-git}}.<br />
<br />
==Usage==<br />
llpp uses keyboard shortcuts and the mouse to navigate through a document. By default, pressing {{ic|F1}} or {{ic|h}} will bring up a help page where all other key bindings are described.<br />
<br />
Check out the following page for a complete list of the [http://repo.or.cz/w/llpp.git/blob_plain/master:/KEYS key and mouse bindings].<br />
<br />
==Configuration==<br />
llpp uses a configuration file to store settings: {{ic|~/.config/llpp.conf}}. This file stores: 1) application defaults, and 2) file-by-file user preferences (e.g. the last page viewed).<br />
<br />
===UI Font===<br />
One can set the font used by llpp by indicating the size and filename in the config. For example:<br />
<br />
<llppconfig><br />
<ui-font size='16'><![CDATA[/usr/share/fonts/TTF/DejaVuSansMono.ttf]]></ui-font><br />
<defaults ... ><br />
...<br />
</defaults><br />
</llppconfig><br />
<br />
===Custom key bindings===<br />
It is possible to configure key bindings. For example, to disable {{ic|Esc}} exiting llpp, add the {{ic|keymap}} element in between the {{ic|defaults}} tags as follows:<br />
<br />
<llppconfig><br />
<defaults ... ><br />
<keymap mode='view'><br />
<map in='esc' out=''/><br />
</keymap><br />
</defaults><br />
</llppconfig><br />
<br />
More examples can be found llpp's example file [http://repo.or.cz/w/llpp.git/blob/HEAD:/misc/keys.txt keys.txt]. For vi-like key bindings, see [https://gist.github.com/Earnestly/7608794 this example]. Note that one can set bindings in particular modes, including {{ic|birdseye}}, {{ic|global}}, {{ic|help}}, {{ic|info}}, {{ic|listview}}, {{ic|outline}}, and {{ic|view}}.<br />
<br />
==Tips and Tricks==<br />
===Reload File===<br />
A document can be reloaded in three ways:<br />
* Pressing the {{ic|r}} key<br />
* Sending a HUP signal to the llpp process<br />
# killall -SIGHUP llpp<br />
* Using the "remote" interface (see below)<br />
<br />
===Remote Interface===<br />
The following commands will setup the remote interface and use it to reload the file "image.pdf".<br />
# mkfifo /tmp/llpp.remote<br />
# llpp -remote /tmp/llpp.remote image.pdf & disown<br />
# sleep 1<br />
# echo reload >/tmp/llpp.remote<br />
<br />
There are eight remote commands:<br />
* {{ic|reload}} - reload<br />
* {{ic|quit}} - quit<br />
* {{ic|goto <page-number> <x-coordinate> <y-coordinate>}} - goto<br />
* {{ic|goto1 <page-number> <relative-y-coordinate>}} - goto<br />
* {{ic|gotor <file-name> <page-number>}} - goto other document<br />
* {{ic|gotord <file-name> <remote-destination>}} - goto named destination within the other document<br />
* {{ic|rect <pageno> <color> <x0> <y0> <x1> <y1>}} - draw a rectangle<br />
* {{ic|activatewin}} - raise and switch to llpp's window<br />
<br />
== See also ==<br />
* [http://repo.or.cz/w/llpp.git llpp git repo]</div>Holomorphhttps://wiki.archlinux.org/index.php?title=Llpp&diff=335595Llpp2014-09-14T22:42:14Z<p>Holomorph: /* Configuration */ show how to set the UI font</p>
<hr />
<div>{{Lowercase title}}<br />
[[Category:Graphics and desktop publishing]]<br />
'''llpp''' is a lightweight, fast and featureful PDF viewer based on MuPDF.<br />
<br />
==Installation==<br />
llpp can be installed from the [[AUR]] using the stable {{AUR|llpp}}, or the latest repo version {{AUR|llpp-git}}.<br />
<br />
==Usage==<br />
llpp uses keyboard shortcuts and the mouse to navigate through a document. By default, pressing {{ic|F1}} or {{ic|h}} will bring up a help page where all other key bindings are described.<br />
<br />
Check out the following page for a complete list of the [http://repo.or.cz/w/llpp.git/blob_plain/master:/KEYS key and mouse bindings].<br />
<br />
==Configuration==<br />
llpp uses a configuration file to store settings: {{ic|~/.config/llpp.conf}}. This file stores: 1) application defaults, and 2) file-by-file user preferences (e.g. the last page viewed).<br />
<br />
===UI Font===<br />
One can set the font used by llpp by indicating the size and filename in the config. For example:<br />
<br />
<llppconfig><br />
<ui-font size='16'><![CDATA[/usr/share/fonts/TTF/DejaVuSansMono.ttf]]></ui-font><br />
<defaults ... ><br />
...<br />
</defaults><br />
</llppconfig><br />
<br />
===Custom key bindings===<br />
It is possible to change the key bindings in {{ic|~/.config/llpp.conf}}. For example to disable {{ic|Esc}} exiting llpp, add the {{ic|keymap}} element in between the {{ic|defaults}} tags as follows:<br />
<br />
{{hc|1=~/.config/llpp.conf|2=<nowiki><llppconfig><br />
<defaults ... ><br />
<keymap mode='view'><br />
<map in='esc' out=''/><br />
</keymap><br />
</defaults><br />
</llppconfig></nowiki><br />
}}<br />
For vi-like key bindings see [https://gist.github.com/Earnestly/7608794 this example].<br />
<br />
==Tips and Tricks==<br />
===Reload File===<br />
A document can be reloaded in three ways:<br />
* Pressing the {{ic|r}} key<br />
* Sending a HUP signal to the llpp process<br />
# killall -SIGHUP llpp<br />
* Using the "remote" interface (see below)<br />
<br />
===Remote Interface===<br />
The following commands will setup the remote interface and use it to reload the file "image.pdf".<br />
# mkfifo /tmp/llpp.remote<br />
# llpp -remote /tmp/llpp.remote image.pdf & disown<br />
# sleep 1<br />
# echo reload >/tmp/llpp.remote<br />
<br />
There are eight remote commands:<br />
* {{ic|reload}} - reload<br />
* {{ic|quit}} - quit<br />
* {{ic|goto <page-number> <x-coordinate> <y-coordinate>}} - goto<br />
* {{ic|goto1 <page-number> <relative-y-coordinate>}} - goto<br />
* {{ic|gotor <file-name> <page-number>}} - goto other document<br />
* {{ic|gotord <file-name> <remote-destination>}} - goto named destination within the other document<br />
* {{ic|rect <pageno> <color> <x0> <y0> <x1> <y1>}} - draw a rectangle<br />
* {{ic|activatewin}} - raise and switch to llpp's window<br />
<br />
== See also ==<br />
* [http://repo.or.cz/w/llpp.git llpp git repo]</div>Holomorphhttps://wiki.archlinux.org/index.php?title=Llpp&diff=335590Llpp2014-09-14T22:13:24Z<p>Holomorph: /* Usage */ point out default F1/h</p>
<hr />
<div>{{Lowercase title}}<br />
[[Category:Graphics and desktop publishing]]<br />
'''llpp''' is a lightweight, fast and featureful PDF viewer based on MuPDF.<br />
<br />
==Installation==<br />
llpp can be installed from the [[AUR]] using the stable {{AUR|llpp}}, or the latest repo version {{AUR|llpp-git}}.<br />
<br />
==Usage==<br />
llpp uses keyboard shortcuts and the mouse to navigate through a document. By default, pressing {{ic|F1}} or {{ic|h}} will bring up a help page where all other key bindings are described.<br />
<br />
Check out the following page for a complete list of the [http://repo.or.cz/w/llpp.git/blob_plain/master:/KEYS key and mouse bindings].<br />
<br />
==Configuration==<br />
llpp uses a configuration file to store settings: {{ic|~/.config/llpp.conf}}. This file stores: 1) application defaults, and 2) file-by-file user preferences (e.g. the last page viewed).<br />
<br />
===Custom key bindings===<br />
It is possible to change the key bindings in {{ic|~/.config/llpp.conf}}. For example to disable {{ic|Esc}} exiting llpp, add the {{ic|keymap}} element in between the {{ic|defaults}} tags as follows:<br />
<br />
{{hc|1=~/.config/llpp.conf|2=<nowiki><llppconfig><br />
<defaults ... ><br />
<keymap mode='view'><br />
<map in='esc' out=''/><br />
</keymap><br />
</defaults><br />
</llppconfig></nowiki><br />
}}<br />
For vi-like key bindings see [https://gist.github.com/Earnestly/7608794 this example].<br />
<br />
==Tips and Tricks==<br />
===Reload File===<br />
A document can be reloaded in three ways:<br />
* Pressing the {{ic|r}} key<br />
* Sending a HUP signal to the llpp process<br />
# killall -SIGHUP llpp<br />
* Using the "remote" interface (see below)<br />
<br />
===Remote Interface===<br />
The following commands will setup the remote interface and use it to reload the file "image.pdf".<br />
# mkfifo /tmp/llpp.remote<br />
# llpp -remote /tmp/llpp.remote image.pdf & disown<br />
# sleep 1<br />
# echo reload >/tmp/llpp.remote<br />
<br />
There are eight remote commands:<br />
* {{ic|reload}} - reload<br />
* {{ic|quit}} - quit<br />
* {{ic|goto <page-number> <x-coordinate> <y-coordinate>}} - goto<br />
* {{ic|goto1 <page-number> <relative-y-coordinate>}} - goto<br />
* {{ic|gotor <file-name> <page-number>}} - goto other document<br />
* {{ic|gotord <file-name> <remote-destination>}} - goto named destination within the other document<br />
* {{ic|rect <pageno> <color> <x0> <y0> <x1> <y1>}} - draw a rectangle<br />
* {{ic|activatewin}} - raise and switch to llpp's window<br />
<br />
== See also ==<br />
* [http://repo.or.cz/w/llpp.git llpp git repo]</div>Holomorphhttps://wiki.archlinux.org/index.php?title=User_talk:Holomorph&diff=278843User talk:Holomorph2013-10-16T18:35:49Z<p>Holomorph: </p>
<hr />
<div>== WPA supplicant/wpa_cli ==<br />
<br />
[https://wiki.archlinux.org/index.php?title=WPA_supplicant&diff=next&oldid=278423#Association This] is probably your favourite section, but consider these facts:<br />
<br />
# It is '''not necessary''' to use ''wpa_cli'' at all, so it should not be in front of the ''Configuration'' section, suggesting that it is somewhat superior. It is much better to place it below ''Configuration'' (either as subsection or top-level section, I don't care) and reference to it with common tasks - i.e. don't duplicate things like the command to start ''wpa_supplicant''.<br />
# ''wpa_cli'' can be used for much more things than simple ''associating'', so current section title is rather inappropriate. I think that ''Using wpa_cli'' is the best title. There is [https://wiki.archlinux.org/index.php?title=WPA_supplicant&oldid=256897#Action_script an old lost section] which I plan to re-include to the page, which is why I created separate section for ''Adding new network''.<br />
<br />
Maybe I just don't understand the reasons presented in the edit summary, perhaps you could elaborate?<br />
<br />
-- [[User:Lahwaacz|Lahwaacz]] ([[User talk:Lahwaacz|talk]]) 22:57, 15 October 2013 (UTC)<br />
<br />
:# Supplicant needs no configuration file to run, but needs a couple lines to be useful, persistent, and usable with the cli. I do not suggest ''wpa_cli'''s superiority, rather the priority of associating with a WAP before any further configuration. Simple first, fancy next.<br />
:# My intent is to cover use of Supplicant and CLI to get the necessities done. The help dialogues and command completions in CLI are terse and the tool is not very well documented--virtually everything else is documented exhaustively (including command line options, capabilities, configurations). To include every detail from the docs is not necessary.<br />
:# Yes, ''wpa_cli'' does everything. The title used to be ''Connecting with wpa_cli'', which is exactly what the section documented. I do not know why I changed it this time around.<br />
:# Re: duplicating. I only wrote the invocation needed for the utility I cover.<br />
:[[User:Holomorph|Holomorph]] ([[User talk:Holomorph|talk]]) 00:06, 16 October 2013 (UTC)<br />
<br />
::First of all, {{ic|wpa_passphrase essid passphrase > config_file}} looks much simpler than running wpa_cli (it is at least more straightforward).<br />
::Next, which part seems to you overly verbose? There is not much difference in content of the two revisions, so I don't think this problem is relevant to this discussion.<br />
::That said, I'd suggest the following changes:<br />
::# move the section below ''Configuration'' (top-level), name it ''Using wpa_cli''<br />
::# create separate sub-section for ''Association'' (or ''Adding new network'') supposing new content will be added (e.g. the action script)<br />
::This looks pretty much like the previous revision (sorry), so it might be quicker to just undo the last edit...<br />
::-- [[User:Lahwaacz|Lahwaacz]] ([[User talk:Lahwaacz|talk]]) 06:17, 16 October 2013 (UTC)<br />
<br />
:::- Well, output from ''wpa_passphrase'' ought to be appended, and if Supplicant is running one still has to restart Supplicant or, assuming the ctrl_inferface, ''wpa_cli reconfigure'', which is basically the same. Then you don't know if you've been associated unless you reopen wpa_cli and get the feedback, you're watching the journal, polling wpa_cli status, or something like dhcpcd runs out and gets you an IP.<br />
:::- I agree wpa_passphrase is simpler. Inserting that before scanning would be good, and I should not have omitted it.<br />
:::- It is trivial to move the section and change headers. I can agree to moving at least parts of that section, but to introduce Supplicant without its very useful CLI would be a disservice.<br />
::: [[User:Holomorph|Holomorph]] ([[User talk:Holomorph|talk]]) 18:35, 16 October 2013 (UTC)</div>Holomorphhttps://wiki.archlinux.org/index.php?title=User_talk:Holomorph&diff=278806User talk:Holomorph2013-10-16T00:06:17Z<p>Holomorph: </p>
<hr />
<div>== WPA supplicant/wpa_cli ==<br />
<br />
[https://wiki.archlinux.org/index.php?title=WPA_supplicant&diff=next&oldid=278423#Association This] is probably your favourite section, but consider these facts:<br />
<br />
# It is '''not necessary''' to use ''wpa_cli'' at all, so it should not be in front of the ''Configuration'' section, suggesting that it is somewhat superior. It is much better to place it below ''Configuration'' (either as subsection or top-level section, I don't care) and reference to it with common tasks - i.e. don't duplicate things like the command to start ''wpa_supplicant''.<br />
# ''wpa_cli'' can be used for much more things than simple ''associating'', so current section title is rather inappropriate. I think that ''Using wpa_cli'' is the best title. There is [https://wiki.archlinux.org/index.php?title=WPA_supplicant&oldid=256897#Action_script an old lost section] which I plan to re-include to the page, which is why I created separate section for ''Adding new network''.<br />
<br />
Maybe I just don't understand the reasons presented in the edit summary, perhaps you could elaborate?<br />
<br />
-- [[User:Lahwaacz|Lahwaacz]] ([[User talk:Lahwaacz|talk]]) 22:57, 15 October 2013 (UTC)<br />
<br />
:# Supplicant needs no configuration file to run, but needs a couple lines to be useful, persistent, and usable with the cli. I do not suggest ''wpa_cli'''s superiority, rather the priority of associating with a WAP before any further configuration. Simple first, fancy next.<br />
:# My intent is to cover use of Supplicant and CLI to get the necessities done. The help dialogues and command completions in CLI are terse and the tool is not very well documented--virtually everything else is documented exhaustively (including command line options, capabilities, configurations). To include every detail from the docs is not necessary.<br />
:# Yes, ''wpa_cli'' does everything. The title used to be ''Connecting with wpa_cli'', which is exactly what the section documented. I do not know why I changed it this time around.<br />
:# Re: duplicating. I only wrote the invocation needed for the utility I cover.<br />
:[[User:Holomorph|Holomorph]] ([[User talk:Holomorph|talk]]) 00:06, 16 October 2013 (UTC)</div>Holomorphhttps://wiki.archlinux.org/index.php?title=Wpa_supplicant&diff=278803Wpa supplicant2013-10-15T21:23:09Z<p>Holomorph: /* Enabling with systemd */ because enabling</p>
<hr />
<div>[[Category:Wireless Networking]]<br />
[[es:WPA supplicant]]<br />
[[it:WPA supplicant]]<br />
[[ru:WPA Supplicant]]<br />
[[zh-CN:WPA Supplicant]]<br />
{{Article summary start}}<br />
{{Article summary text|Setup and usage of wpa_supplicant}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|Network Configuration}}<br />
{{Article summary wiki|Wireless Setup}}<br />
{{Article summary end}}<br />
<br />
[http://hostap.epitest.fi/wpa_supplicant/ wpa_supplicant] is a cross-platform WPA [[Wikipedia:Supplicant (computer)|Supplicant]] with support for WEP, WPA and WPA2 ([[wikipedia:IEEE_802.11i|IEEE 802.11i]] / RSN (Robust Secure Network)). It is suitable for both desktop and laptop computers and even embedded systems.<br />
<br />
''wpa_supplicant'' is the IEEE 802.1X/WPA component that is used in the client stations. It implements key negotiation with a WPA Authenticator and it controls the roaming and IEEE 802.11 authentication/association of the wireless driver.<br />
<br />
== Installation ==<br />
<br />
Install {{Pkg|wpa_supplicant}} from the [[official repositories]].<br />
<br />
Optionally {{Pkg|wpa_supplicant_gui}} can be installed which provides ''wpa_gui'', a graphical frontend for ''wpa_supplicant'' using the {{Pkg|qt4}} toolkit.<br />
<br />
== Association ==<br />
<br />
The ''wpa_cli'' utility is the command line interface to the ''wpa_supplicant'' daemon. In order to use ''wpa_cli'', a "control interface" (socket) must be specified for ''wpa_supplicant''. Do this by creating a configuration file containing:<br />
<br />
ctrl_interface=/run/wpa_supplicant<br />
<br />
To enable saving changes to the daemon into the configuration file, such as adding wireless networks, keys, and other information, append {{ic|update_config&#61;1}} to the configuration file. Start ''wpa_supplicant'' by issuing<br />
<br />
# wpa_supplicant -B -i ''interface'' -c ''/path/to/config''<br />
<br />
Invoke {{ic|# wpa_cli}} to get an interactive prompt ({{ic|>}}). The prompt has tab completion and descriptions of completed commands. At the prompt, initiate a scan with {{ic|> scan}}. A notification is shown when the scan is complete. Then:<br />
<br />
> scan_results<br />
bssid / frequency / signal level / flags / ssid<br />
00:00:00:00:00:00 2462 -49 [WPA2-PSK-CCMP][ESS] ''MYSSID''<br />
11:11:11:11:11:11 2437 -64 [WPA2-PSK-CCMP][ESS] ''ANOTHERSSID''<br />
<br />
To associate with {{ic|''MYSSID''}}, tell ''wpa_supplicant'' about it. Each network is indexed numerically, so the first network will have index zero. The [[wikipedia:Pre-shared_key|PSK]] can be provided without quotes as an alternative to providing the passphrase in this example:<br />
<br />
> add_network<br />
0<br />
> set_network 0 ssid "''MYSSID''"<br />
> set_network 0 psk "''passphrase''"<br />
> enable_network 0<br />
<2>CTRL-EVENT-CONNECTED - Connection to 00:00:00:00:00:00 completed (reauth) [id=0 id_str=]<br />
<br />
The notification indicates the supplicant has successfully associated to the access point. Now one can obtain an IP address via {{Pkg|dhcpcd}} or the {{Pkg|iproute2}} tools. See the '''Related''' articles for more information.<br />
<br />
To write the changes to the configuration file:<br />
<br />
> save_config<br />
OK<br />
<br />
== Configuration ==<br />
<br />
{{Pkg|wpa_supplicant}} provides a reference configuration file located at {{ic|/etc/wpa_supplicant/wpa_supplicant.conf}} which contains detailed documentation for all the available options and their utilisation.<br />
<br />
In its simplest form, a configuration file requires only a network block. For example:<br />
<br />
{{hc|/etc/wpa_supplicant/foobar.conf|2=<br />
network={<br />
ssid="..."<br />
}<br />
}}<br />
<br />
This can easily be generated using the ''wpa_passphrase'' tool. For example:<br />
<br />
{{hc|$ wpa_passphrase ''essid'' ''passphrase''|2=<br />
network={<br />
ssid="''essid''"<br />
#psk="''passphrase''"<br />
psk=f5d1c49e15e679bebe385c37648d4141bc5c9297796a8a185d7bc5ac62f954e3<br />
}<br />
}}<br />
<br />
{{Tip|Some unusually complex passphrases may require input from a file:<br />
# wpa_passphrase ''essid'' < ''passphrase.txt'' > /etc/wpa_supplicant/wpa_supplicant-''interface''.conf<br />
}}<br />
<br />
Once you have a configuration file, you can run ''wpa_supplicant'' daemon and connect to the wireless network:<br />
<br />
# wpa_supplicant -B -i ''interface'' -c ''configuration_file''<br />
<br />
You might need to specify a driver to be used. For a list of supported drivers see the output of {{ic|wpa_supplicant -h}}, {{ic|nl80211}} is preferred over the deprecated {{ic|wext}} driver. Use the {{ic|-D}} switch to specify the driver:<br />
<br />
# wpa_supplicant -B -i ''interface'' -c ''configuration_file'' -D ''driver''<br />
<br />
{{Tip|Both ''wpa_supplicant'' and ''wpa_passphrase'' can be combined to associate with almost all WPA2 (Personal) networks:<br />
# wpa_supplicant -B -i ''interface'' -c <(wpa_passphrase ''essid'' ''passphrase'')<br />
}}<br />
<br />
All that remains is to simply connect using a [[Network Configuration#Static IP Address|static IP]] or [[Network Configuration#Dynamic IP Address|DHCP]]. For example:<br />
<br />
# dhcpcd ''interface''<br />
<br />
== Enabling with systemd ==<br />
<br />
A possible setup involves enabling ''wpa_supplicant'' and ''dhcpcd'' on a particular interface (see [[systemd#Using units]] for details):<br />
<br />
# systemctl enable wpa_supplicant@''interface''<br />
# systemctl enable dhcpcd@''interface''<br />
<br />
The {{ic|[Install]}} section of systemd services in the current version of ''wpa_supplicant'' is incorrect ([http://w1.fi/bugz/show_bug.cgi?id=477 bug report]). If your interface name is not {{ic|wlan0}}, it will be necessary to copy the service file to {{ic|/etc/systemd/system/}} and replace the {{ic|[Install]}} section with:<br />
<br />
[Install]<br />
WantedBy=multi-user.target<br />
<br />
See [[systemd#Editing provided unit files]] for help with the editing.<br />
<br />
{{Note|If you use {{ic|dhcpcd@.service}}, you might also want to replace the {{ic|-w}} flag with {{ic|-b}} so that it does not wait until it is assigned an address before forking to the background.}}<br />
<br />
{{Tip|{{Pkg|dhcpcd}} contains a hook (enabled by default) to automatically launch ''wpa_supplicant'' on wireless interfaces. It is started only if a configuration file at {{ic|/etc/wpa_supplicant.conf}} exists and no ''wpa_supplicant'' process is listening on that interface. You do not need to use {{ic|wpa_supplicant@''interface''}} at all and just enable {{ic|dhcpcd@''interface''}}.}}<br />
<br />
== See also ==<br />
<br />
* [http://wireless.kernel.org/en/users/Documentation/wpa_supplicant Kernel.org wpa_supplicant documentation]</div>Holomorphhttps://wiki.archlinux.org/index.php?title=Wpa_supplicant&diff=278802Wpa supplicant2013-10-15T21:19:10Z<p>Holomorph: revert structural change and nix verbosity. it is the manual association that is done first. related articles are structured this way for the same reason. also, single subsections are a no-no</p>
<hr />
<div>[[Category:Wireless Networking]]<br />
[[es:WPA supplicant]]<br />
[[it:WPA supplicant]]<br />
[[ru:WPA Supplicant]]<br />
[[zh-CN:WPA Supplicant]]<br />
{{Article summary start}}<br />
{{Article summary text|Setup and usage of wpa_supplicant}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|Network Configuration}}<br />
{{Article summary wiki|Wireless Setup}}<br />
{{Article summary end}}<br />
<br />
[http://hostap.epitest.fi/wpa_supplicant/ wpa_supplicant] is a cross-platform WPA [[Wikipedia:Supplicant (computer)|Supplicant]] with support for WEP, WPA and WPA2 ([[wikipedia:IEEE_802.11i|IEEE 802.11i]] / RSN (Robust Secure Network)). It is suitable for both desktop and laptop computers and even embedded systems.<br />
<br />
''wpa_supplicant'' is the IEEE 802.1X/WPA component that is used in the client stations. It implements key negotiation with a WPA Authenticator and it controls the roaming and IEEE 802.11 authentication/association of the wireless driver.<br />
<br />
== Installation ==<br />
<br />
Install {{Pkg|wpa_supplicant}} from the [[official repositories]].<br />
<br />
Optionally {{Pkg|wpa_supplicant_gui}} can be installed which provides ''wpa_gui'', a graphical frontend for ''wpa_supplicant'' using the {{Pkg|qt4}} toolkit.<br />
<br />
== Association ==<br />
<br />
The ''wpa_cli'' utility is the command line interface to the ''wpa_supplicant'' daemon. In order to use ''wpa_cli'', a "control interface" (socket) must be specified for ''wpa_supplicant''. Do this by creating a configuration file containing:<br />
<br />
ctrl_interface=/run/wpa_supplicant<br />
<br />
To enable saving changes to the daemon into the configuration file, such as adding wireless networks, keys, and other information, append {{ic|update_config&#61;1}} to the configuration file. Start ''wpa_supplicant'' by issuing<br />
<br />
# wpa_supplicant -B -i ''interface'' -c ''/path/to/config''<br />
<br />
Invoke {{ic|# wpa_cli}} to get an interactive prompt ({{ic|>}}). The prompt has tab completion and descriptions of completed commands. At the prompt, initiate a scan with {{ic|> scan}}. A notification is shown when the scan is complete. Then:<br />
<br />
> scan_results<br />
bssid / frequency / signal level / flags / ssid<br />
00:00:00:00:00:00 2462 -49 [WPA2-PSK-CCMP][ESS] ''MYSSID''<br />
11:11:11:11:11:11 2437 -64 [WPA2-PSK-CCMP][ESS] ''ANOTHERSSID''<br />
<br />
To associate with {{ic|''MYSSID''}}, tell ''wpa_supplicant'' about it. Each network is indexed numerically, so the first network will have index zero. The [[wikipedia:Pre-shared_key|PSK]] can be provided without quotes as an alternative to providing the passphrase in this example:<br />
<br />
> add_network<br />
0<br />
> set_network 0 ssid "''MYSSID''"<br />
> set_network 0 psk "''passphrase''"<br />
> enable_network 0<br />
<2>CTRL-EVENT-CONNECTED - Connection to 00:00:00:00:00:00 completed (reauth) [id=0 id_str=]<br />
<br />
The notification indicates the supplicant has successfully associated to the access point. Now one can obtain an IP address via {{Pkg|dhcpcd}} or the {{Pkg|iproute2}} tools. See the '''Related''' articles for more information.<br />
<br />
To write the changes to the configuration file:<br />
<br />
> save_config<br />
OK<br />
<br />
== Configuration ==<br />
<br />
{{Pkg|wpa_supplicant}} provides a reference configuration file located at {{ic|/etc/wpa_supplicant/wpa_supplicant.conf}} which contains detailed documentation for all the available options and their utilisation.<br />
<br />
In its simplest form, a configuration file requires only a network block. For example:<br />
<br />
{{hc|/etc/wpa_supplicant/foobar.conf|2=<br />
network={<br />
ssid="..."<br />
}<br />
}}<br />
<br />
This can easily be generated using the ''wpa_passphrase'' tool. For example:<br />
<br />
{{hc|$ wpa_passphrase ''essid'' ''passphrase''|2=<br />
network={<br />
ssid="''essid''"<br />
#psk="''passphrase''"<br />
psk=f5d1c49e15e679bebe385c37648d4141bc5c9297796a8a185d7bc5ac62f954e3<br />
}<br />
}}<br />
<br />
{{Tip|Some unusually complex passphrases may require input from a file:<br />
# wpa_passphrase ''essid'' < ''passphrase.txt'' > /etc/wpa_supplicant/wpa_supplicant-''interface''.conf<br />
}}<br />
<br />
Once you have a configuration file, you can run ''wpa_supplicant'' daemon and connect to the wireless network:<br />
<br />
# wpa_supplicant -B -i ''interface'' -c ''configuration_file''<br />
<br />
You might need to specify a driver to be used. For a list of supported drivers see the output of {{ic|wpa_supplicant -h}}, {{ic|nl80211}} is preferred over the deprecated {{ic|wext}} driver. Use the {{ic|-D}} switch to specify the driver:<br />
<br />
# wpa_supplicant -B -i ''interface'' -c ''configuration_file'' -D ''driver''<br />
<br />
{{Tip|Both ''wpa_supplicant'' and ''wpa_passphrase'' can be combined to associate with almost all WPA2 (Personal) networks:<br />
# wpa_supplicant -B -i ''interface'' -c <(wpa_passphrase ''essid'' ''passphrase'')<br />
}}<br />
<br />
All that remains is to simply connect using a [[Network Configuration#Static IP Address|static IP]] or [[Network Configuration#Dynamic IP Address|DHCP]]. For example:<br />
<br />
# dhcpcd ''interface''<br />
<br />
== Starting with systemd ==<br />
<br />
Most common configuration involves enabling ''wpa_supplicant'' and ''dhcpcd'' on a particular interface (see [[systemd#Using units]] for details):<br />
<br />
# systemctl enable wpa_supplicant@''interface''<br />
# systemctl enable dhcpcd@''interface''<br />
<br />
The {{ic|[Install]}} section of systemd services in the current version of ''wpa_supplicant'' is incorrect ([http://w1.fi/bugz/show_bug.cgi?id=477 bug report]). If your interface name is not {{ic|wlan0}}, it will be necessary to copy the service file to {{ic|/etc/systemd/system/}} and replace the {{ic|[Install]}} section with:<br />
<br />
[Install]<br />
WantedBy=multi-user.target<br />
<br />
See [[systemd#Editing provided unit files]] for help with the editing.<br />
<br />
{{Note|If you use {{ic|dhcpcd@.service}}, you might also want to replace the {{ic|-w}} flag with {{ic|-b}} so that it does not wait until it is assigned an address before forking to the background.}}<br />
<br />
{{Tip|{{Pkg|dhcpcd}} contains a hook (enabled by default) to automatically launch ''wpa_supplicant'' on wireless interfaces. It is started only if a configuration file at {{ic|/etc/wpa_supplicant.conf}} exists and no ''wpa_supplicant'' process is listening on that interface. You do not need to use {{ic|wpa_supplicant@''interface''}} at all and just enable {{ic|dhcpcd@''interface''}}.}}<br />
<br />
== See also ==<br />
<br />
* [http://wireless.kernel.org/en/users/Documentation/wpa_supplicant Kernel.org wpa_supplicant documentation]</div>Holomorphhttps://wiki.archlinux.org/index.php?title=Systemd&diff=278694Systemd2013-10-15T05:23:23Z<p>Holomorph: /* Editing provided unit files */ add example for replacing ExecStart directive</p>
<hr />
<div>{{Lowercase title}}<br />
[[Category:Daemons and system services]]<br />
[[Category:Boot process]]<br />
[[ar:Systemd]]<br />
[[es:Systemd]]<br />
[[fr:Systemd]]<br />
[[it:Systemd]]<br />
[[ja:Systemd]]<br />
[[pt:Systemd]]<br />
[[ru:Systemd]]<br />
[[zh-CN:Systemd]]<br />
[[zh-TW:Systemd]]<br />
{{Article summary start}}<br />
{{Article summary text|Covers how to install and configure systemd.}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|systemd/User}}<br />
{{Article summary wiki|systemd/Services}}<br />
{{Article summary wiki|systemd/cron functionality}}<br />
{{Article summary wiki|systemd FAQ}}<br />
{{Article summary wiki|init Rosetta}}<br />
{{Article summary wiki|Daemons List}}<br />
{{Article summary wiki|udev}}<br />
{{Article summary wiki|Improve Boot Performance}}<br />
{{Article summary end}}<br />
From the [http://freedesktop.org/wiki/Software/systemd project web page]:<br />
<br />
:''systemd'' is a system and service manager for Linux, compatible with SysV and LSB init scripts. ''systemd'' provides aggressive parallelization capabilities, uses socket and [[D-Bus]] activation for starting services, offers on-demand starting of daemons, keeps track of processes using Linux [[cgroups|control groups]], supports snapshotting and restoring of the system state, maintains mount and automount points and implements an elaborate transactional dependency-based service control logic.<br />
<br />
{{Note|1=For a detailed explanation as to why Arch has moved to ''systemd'', see [https://bbs.archlinux.org/viewtopic.php?pid=1149530#p1149530 this forum post].}}<br />
<br />
== Migration from SysVinit/initscripts ==<br />
<br />
{{Note|<br />
* {{Pkg|systemd}} and {{Pkg|systemd-sysvcompat}} are both installed by default on installation media newer than [https://www.archlinux.org/news/systemd-is-now-the-default-on-new-installations/ 2012-10-13]. This section is aimed at Arch Linux installations that still rely on ''sysvinit'' and ''initscripts''.<br />
* If you are running Arch Linux inside a VPS, please see [[Virtual Private Server#Moving your VPS from initscripts to systemd]].<br />
}}<br />
<br />
=== Considerations before switching ===<br />
<br />
* Do [http://freedesktop.org/wiki/Software/systemd/ some reading] about ''systemd''.<br />
* Note the fact that systemd has a ''journal'' system that replaces ''syslog'', although the two can co-exist. See [[#Journal]].<br />
* While ''systemd'' can replace some of the functionality of ''cron'', ''acpid'', or ''xinetd'', there is no need to switch away from using the traditional daemons unless you want to.<br />
* Interactive ''initscripts'' are not working with ''systemd''. In particular, ''netcfg-menu'' cannot be used at system start-up ({{Bug|31377}}).<br />
<br />
=== Installation procedure ===<br />
<br />
# [[pacman|Install]] {{Pkg|systemd}} from the [[official repositories]].<br />
# Append the following to your [[kernel parameters]]: {{ic|1=init=/usr/lib/systemd/systemd}}.<br />
# Once completed you may enable any desired services via the use of {{ic|systemctl enable ''service_name''}} (this roughly equates to what you included in the {{ic|DAEMONS}} array. New names can be found in [[Daemons List]]).<br />
# Reboot your system and verify that ''systemd'' is currently active by issuing the following command: {{ic|cat /proc/1/comm}}. This should return the string {{ic|systemd}}.<br />
# Make sure your hostname is set correctly under ''systemd'': {{ic|hostnamectl set-hostname ''myhostname''}} or {{ic|/etc/hostname}}.<br />
# Proceed to remove ''initscripts'' and ''sysvinit'' from your system and install {{Pkg|systemd-sysvcompat}}.<br />
# Optionally, remove the {{ic|1=init=/usr/lib/systemd/systemd}} parameter. It is no longer needed since {{Pkg|systemd-sysvcompat}} provides a symlink to ''systemd'''s init where ''sysvinit'' used to be.<br />
<br />
=== Supplementary information ===<br />
<br />
* If you have {{ic|quiet}} in your kernel parameters, you might want to remove it for your first couple of systemd boots, to assist with identifying any issues during boot.<br />
<br />
* It is not necessary to add your user to [[Users and Groups|groups]] ({{ic|sys}}, {{ic|disk}}, {{ic|lp}}, {{ic|network}}, {{ic|video}}, {{ic|audio}}, {{ic|optical}}, {{ic|storage}}, {{ic|scanner}}, {{ic|power}}, etc.) for most use cases with systemd. The groups can even cause some functionality to break. For example, the {{ic|audio}} group will break fast user switching and allows applications to block software mixing. Every PAM login provides a logind session, which for a local session will give you permissions via [[Wikipedia:Access control list|POSIX ACLs]] on audio/video devices, and allow certain operations like mounting removable storage via [[udisks]].<br />
<br />
* See the [[Network Configuration]] article for how to set up networking targets.<br />
<br />
== Basic systemctl usage ==<br />
<br />
The main command used to introspect and control ''systemd'' is '''systemctl'''. Some of its uses are examining the system state and managing the system and services. See {{ic|man 1 systemctl}} for more details.<br />
<br />
{{Tip|You can use all of the following ''systemctl'' commands with the {{ic|-H ''user''@''host''}} switch to control a ''systemd'' instance on a remote machine. This will use [[SSH]] to connect to the remote ''systemd'' instance.}}<br />
<br />
{{Note|''systemadm'' is the official graphical frontend for ''systemctl''. It is provided by the {{AUR|systemd-ui-git}} package from the [[AUR]].}}<br />
<br />
=== Analyzing the system state ===<br />
<br />
List running units:<br />
<br />
$ systemctl<br />
<br />
or:<br />
<br />
$ systemctl list-units<br />
<br />
List failed units:<br />
<br />
$ systemctl --failed<br />
<br />
The available unit files can be seen in {{ic|/usr/lib/systemd/system/}} and {{ic|/etc/systemd/system/}} (the latter takes precedence). You can see a list of the installed unit files with:<br />
<br />
$ systemctl list-unit-files<br />
<br />
=== Using units ===<br />
<br />
Units can be, for example, services (''.service''), mount points (''.mount''), devices (''.device'') or sockets (''.socket'').<br />
<br />
When using ''systemctl'', you generally have to specify the complete name of the unit file, including its suffix, for example ''sshd.socket''. There are however a few short forms when specifying the unit in the following ''systemctl'' commands:<br />
<br />
* If you do not specify the suffix, systemctl will assume ''.service''. For example, {{ic|netcfg}} and {{ic|netcfg.service}} are equivalent.<br />
* Mount points will automatically be translated into the appropriate ''.mount'' unit. For example, specifying {{ic|/home}} is equivalent to {{ic|home.mount}}.<br />
* Similar to mount points, devices are automatically translated into the appropriate ''.device'' unit, therefore specifying {{ic|/dev/sda2}} is equivalent to {{ic|dev-sda2.device}}.<br />
<br />
See {{ic|man systemd.unit}} for details.<br />
<br />
Activate a unit immediately:<br />
<br />
# systemctl start ''unit''<br />
<br />
Deactivate a unit immediately:<br />
<br />
# systemctl stop ''unit''<br />
<br />
Restart a unit:<br />
<br />
# systemctl restart ''unit''<br />
<br />
Ask a unit to reload its configuration:<br />
<br />
# systemctl reload ''unit''<br />
<br />
Show the status of a unit, including whether it is running or not:<br />
<br />
$ systemctl status ''unit''<br />
<br />
Check whether a unit is already enabled or not:<br />
<br />
$ systemctl is-enabled ''unit''<br />
<br />
Enable a unit to be started on bootup:<br />
<br />
# systemctl enable ''unit''<br />
<br />
{{Note|Services without an {{ic|[Install]}} section are usually called automatically by other services. If you need to install them manually, use the following command, replacing ''foo'' with the name of the service.<br />
# ln -s /usr/lib/systemd/system/''foo''.service /etc/systemd/system/graphical.target.wants/<br />
}}<br />
<br />
Disable a unit to not start during bootup:<br />
<br />
# systemctl disable ''unit''<br />
<br />
Show the manual page associated with a unit (this has to be supported by the unit file):<br />
<br />
$ systemctl help ''unit''<br />
<br />
Reload ''systemd'', scanning for new or changed units:<br />
<br />
# systemctl daemon-reload<br />
<br />
=== Power management ===<br />
<br />
[[polkit]] is necessary for power management. If you are in a local ''systemd-logind'' user session and no other session is active, the following commands will work without root privileges. If not (for example, because another user is logged into a tty), ''systemd'' will automatically ask you for the root password.<br />
<br />
Shut down and reboot the system:<br />
<br />
$ systemctl reboot<br />
<br />
Shut down and power-off the system:<br />
<br />
$ systemctl poweroff<br />
<br />
Suspend the system:<br />
<br />
$ systemctl suspend<br />
<br />
Put the system into hibernation:<br />
<br />
$ systemctl hibernate<br />
<br />
Put the system into hybrid-sleep state (or suspend-to-both):<br />
<br />
$ systemctl hybrid-sleep<br />
<br />
== Running DMs under systemd ==<br />
<br />
{{Merge|Display Manager|We have separate article, this section should be moved there to keep things in one place.}}<br />
<br />
To enable graphical login, run your preferred [[Display Manager]] daemon (e.g. [[KDM]]). At the moment, service files exist for [[GDM]], [[KDM]], [[SLiM]], [[XDM]], [[LXDM]], [[LightDM]], and {{AUR|SDDM}}.<br />
<br />
# systemctl enable kdm<br />
<br />
This should work out of the box. If not, you might have a ''default.target'' set manually or from an older install:<br />
<br />
{{hc|# ls -l /etc/systemd/system/default.target|<br />
/etc/systemd/system/default.target -> /usr/lib/systemd/system/graphical.target}}<br />
<br />
Simply delete the symlink and ''systemd'' will use its stock ''default.target'' (i.e. ''graphical.target'').<br />
<br />
# rm /etc/systemd/system/default.target<br />
<br />
After enabling kdm a symlink "display-manager.service" should be set in /etc/systemd/system/<br />
<br />
{{hc|# ls -l /etc/systemd/system/display-manager.service|<br />
/etc/systemd/system/display-manager.service -> /usr/lib/systemd/system/kdm.service}}<br />
<br />
=== Using systemd-logind ===<br />
<br />
In order to check the status of your user session, you can use {{ic|loginctl}}. All [[PolicyKit]] actions like suspending the system or mounting external drives will work out of the box.<br />
<br />
$ loginctl show-session $XDG_SESSION_ID<br />
<br />
== Native configuration ==<br />
<br />
{{Note|You may need to create these files. All files should have {{ic|644}} permissions and {{ic|root:root}} ownership.}}<br />
<br />
=== Virtual console ===<br />
{{Deletion|Not strictly related, trying to remove the [[#Native configuration]] section entirely.|section=Duplication of content in Native configuration section}}<br />
<br />
The virtual console (keyboard mapping, console font and console map) is configured in {{ic|/etc/vconsole.conf}} or by using the ''localectl'' tool.<br />
<br />
For more information, see [[Fonts#Console fonts|console fonts]] and [[KEYMAP|keymaps]].<br />
<br />
=== Kernel modules ===<br />
{{Deletion|Not strictly related, trying to remove the [[#Native configuration]] section entirely.|section=Duplication of content in Native configuration section}}<br />
<br />
See [[Kernel modules#Configuration]].<br />
<br />
=== Filesystem mounts ===<br />
{{Merge|File Systems|This section was added here before systemd became the default init system. Delete it after merging.|section=Duplication of content in Native configuration section}}<br />
<br />
The default setup will automatically fsck and mount filesystems before starting services that need them to be mounted. For example, systemd automatically makes sure that remote filesystem mounts like [[NFS]] or [[Samba]] are only started after the network has been set up. Therefore, local and remote filesystem mounts specified in {{ic|/etc/fstab}} should work out of the box.<br />
<br />
See {{ic|man 5 systemd.mount}} for details.<br />
<br />
==== Automount ====<br />
{{Merge|fstab|This section was added here before systemd became the default init system. Delete it after merging.|section=Duplication of content in Native configuration section}}<br />
<br />
If you have a large {{ic|/home}} partition, it might be better to allow services that do not depend on {{ic|/home}} to start while {{ic|/home}} is checked by ''fsck''. This can be achieved by adding the following options to the {{ic|/etc/fstab}} entry of your {{ic|/home}} partition:<br />
<br />
noauto,x-systemd.automount<br />
<br />
This will fsck and mount {{ic|/home}} when it is first accessed, and the kernel will buffer all file access to {{ic|/home}} until it is ready.<br />
<br />
{{Note|This will make your {{ic|/home}} filesystem type {{ic|autofs}}, which is ignored by [[mlocate]] by default. The speedup of automounting {{ic|/home}} may not be more than a second or two, depending on your system, so this trick may not be worth it.}}<br />
<br />
The same applies to remote filesystem mounts. If you want them to be mounted only upon access, you will need to use the {{ic|noauto,x-systemd.automount}} parameters. In addition, you can use the {{ic|1=x-systemd.device-timeout=#}} option to specify a timeout in case the network resource is not available.<br />
<br />
If you have encrypted filesystems with keyfiles, you can also add the {{ic|noauto}} parameter to the corresponding entries in {{ic|/etc/crypttab}}. ''systemd'' will then not open the encrypted device on boot, but instead wait until it is actually accessed and then automatically open it with the specified keyfile before mounting it. This might save a few seconds on boot if you are using an encrypted RAID device for example, because systemd does not have to wait for the device to become available. For example:<br />
<br />
{{hc|/etc/crypttab|<br />
data /dev/md0 /root/key noauto}}<br />
<br />
==== LVM ====<br />
{{Merge|LVM|This section was added here before systemd became the default init system. Delete it after merging.|section=Duplication of content in Native configuration section}}<br />
<br />
If you have [[LVM]] volumes not activated via the [[Mkinitcpio|initramfs]], [[#Using units|enable]] the '''lvm-monitoring''' service, which is provided by the {{pkg|lvm2}} package.<br />
<br />
=== ACPI power management ===<br />
{{Deletion|Not strictly related, trying to remove the [[#Native configuration]] section entirely.|section=Duplication of content in Native configuration section}}<br />
<br />
See [[Power Management]].<br />
<br />
=== Temporary files ===<br />
{{Moveto|Systemd#|Trying to remove the [[#Native configuration]] section entirely, this section can easily become a top-level one like [[#Journal]].|section=Duplication of content in Native configuration section}}<br />
<br />
"'''systemd-tmpfiles''' creates, deletes and cleans up volatile and temporary files and directories." It reads configuration files in {{ic|/etc/tmpfiles.d/}} and {{ic|/usr/lib/tmpfiles.d/}} to discover which actions to perform. Configuration files in the former directory take precedence over those in the latter directory.<br />
<br />
Configuration files are usually provided together with service files, and they are named in the style of {{ic|/usr/lib/tmpfiles.d/''program''.conf}}. For example, the [[Samba]] daemon expects the directory {{ic|/run/samba}} to exist and to have the correct permissions. Therefore, the {{Pkg|samba}} package ships with this configuration:<br />
<br />
{{hc|/usr/lib/tmpfiles.d/samba.conf|<br />
D /run/samba 0755 root root}}<br />
<br />
Configuration files may also be used to write values into certain files on boot. For example, if you used {{ic|/etc/rc.local}} to disable wakeup from USB devices with {{ic|echo USBE > /proc/acpi/wakeup}}, you may use the following tmpfile instead:<br />
<br />
{{hc|/etc/tmpfiles.d/disable-usb-wake.conf|<br />
w /proc/acpi/wakeup - - - - USBE}}<br />
<br />
See the {{ic|systemd-tmpfiles}} and {{ic|tmpfiles.d(5)}} man pages for details.<br />
<br />
{{Note|This method may not work to set options in {{ic|/sys}} since the ''systemd-tmpfiles-setup'' service may run before the appropriate device modules is loaded. In this case you could check whether the module has a parameter for the option you want to set with {{ic|modinfo ''module''}} and set this option with a [[Modprobe.d#Configuration|config file in /etc/modprobe.d]]. Otherwise you will have to write a [[Udev#About_udev_rules|udev rule]] to set the appropriate attribute as soon as the device appears.}}<br />
<br />
== Writing custom .service files ==<br />
<br />
The syntax of systemd's [[#Using units|unit files]] is inspired by XDG Desktop Entry Specification .desktop files, which are in turn inspired by Microsoft Windows .ini files.<br />
<br />
See [[systemd/Services]] for more examples.<br />
<br />
=== Handling dependencies ===<br />
<br />
With ''systemd'', dependencies can be resolved by designing the unit files correctly. The most typical case is that the unit ''A'' requires the unit ''B'' to be running before ''A'' is started. In that case add {{ic|1=Requires=''B''}} and {{ic|1=After=''B''}} to the {{ic|[Unit]}} section of ''A''. If the dependency is optional, add {{ic|1=Wants=''B''}} and {{ic|1=After=''B''}} instead. Note that {{ic|1=Wants=}} and {{ic|1=Requires=}} do not imply {{ic|1=After=}}, meaning that if {{ic|1=After=}} is not specified, the two units will be started in parallel.<br />
<br />
Dependencies are typically placed on services and not on targets. For example, ''network.target'' is pulled in by whatever service configures your network interfaces, therefore ordering your custom unit after it is sufficient since ''network.target'' is started anyway.<br />
<br />
=== Type ===<br />
<br />
There are several different start-up types to consider when writing a custom service file. This is set with the {{ic|1=Type=}} parameter in the {{ic|[Service]}} section. See {{ic|man systemd.service}} for a more detailed explanation.<br />
<br />
* {{ic|1=Type=simple}} (default): ''systemd'' considers the service to be started up immediately. The process must not fork. Do not use this type if other services need to be ordered on this service, unless it is socket activated.<br />
* {{ic|1=Type=forking}}: ''systemd'' considers the service started up once the process forks and the parent has exited. For classic daemons use this type unless you know that it is not necessary. You should specify {{ic|1=PIDFile=}} as well so ''systemd'' can keep track of the main process.<br />
* {{ic|1=Type=oneshot}}: this is useful for scripts that do a single job and then exit. You may want to set {{ic|1=RemainAfterExit=yes}} as well so that ''systemd'' still considers the service as active after the process has exited.<br />
* {{ic|1=Type=notify}}: identical to {{ic|1=Type=simple}}, but with the stipulation that the daemon will send a signal to ''systemd'' when it is ready. The reference implementation for this notification is provided by ''libsystemd-daemon.so''.<br />
* {{ic|1=Type=dbus}}: the service is considered ready when the specified {{ic|BusName}} appears on DBus's system bus.<br />
<br />
=== Editing provided unit files ===<br />
<br />
To edit a unit file provided by a package, you can create a directory called {{ic|/etc/systemd/system/''unit''.d/}} for example {{ic|/etc/systemd/system/httpd.service.d/}} and place ''*.conf'' files in there to override or add new options. ''systemd'' will parse these ''*.conf'' files and apply them on top of the original unit. For example, if you simply want to add an additional dependency to a unit, you may create the following file:<br />
<br />
{{hc|/etc/systemd/system/''unit''.d/customdependency.conf|2=<br />
[Unit]<br />
Requires=''new dependency''<br />
After=''new dependency''}}<br />
<br />
As another example, in order to replace the {{ic|ExecStart}} directive for a unit that is not of type {{ic|oneshot}}, create the following file:<br />
<br />
{{hc|/etc/systemd/system/''unit''.d/customexec.conf|2=<br />
[Service]<br />
ExecStart=<br />
ExecStart=''new command''}}<br />
<br />
Then run the following for your changes to take effect:<br />
<br />
# systemctl daemon-reload<br />
# systemctl restart ''unit''<br />
<br />
Alternatively you can copy the old unit file from {{ic|/usr/lib/systemd/system/}} to {{ic|/etc/systemd/system/}} and make your changes there. A unit file in {{ic|/etc/systemd/system/}} always overrides the same unit in {{ic|/usr/lib/systemd/system/}}. Note that when the original unit in {{ic|/usr/lib/}} is changed due to a package upgrade, these changes will not automatically apply to your custom unit file in {{ic|/etc/}}. Additionally you will have to manually reenable the unit with {{ic|systemctl reenable ''unit''}}. It is therefore recommended to use the ''*.conf'' method described before instead.<br />
<br />
{{Tip|You can use '''systemd-delta''' to see which unit files have been overridden and what exactly has been changed.}}<br />
<br />
As the provided unit files will be updated from time to time, use ''systemd-delta'' for system maintenance.<br />
<br />
=== Syntax highlighting for units within Vim ===<br />
<br />
Syntax highlighting for ''systemd'' unit files within [[Vim]] can be enabled by installing {{Pkg|vim-systemd}} from the [[Official Repositories|official repositories]].<br />
<br />
== Targets ==<br />
<br />
''systemd'' uses ''targets'' which serve a similar purpose as runlevels but act a little different. Each ''target'' is named instead of numbered and is intended to serve a specific purpose with the possibility of having multiple ones active at the same time. Some ''target''s are implemented by inheriting all of the services of another ''target'' and adding additional services to it. There are ''systemd'' ''target''s that mimic the common SystemVinit runlevels so you can still switch ''target''s using the familiar {{ic|telinit RUNLEVEL}} command.<br />
<br />
=== Get current targets ===<br />
<br />
The following should be used under ''systemd'' instead of running {{ic|runlevel}}:<br />
<br />
$ systemctl list-units --type=target<br />
<br />
=== Create custom target ===<br />
<br />
The runlevels that are assigned a specific purpose on vanilla Fedora installs; 0, 1, 3, 5, and 6; have a 1:1 mapping with a specific ''systemd'' ''target''. Unfortunately, there is no good way to do the same for the user-defined runlevels like 2 and 4. If you make use of those it is suggested that you make a new named ''systemd'' ''target'' as {{ic|/etc/systemd/system/''your target''}} that takes one of the existing runlevels as a base (you can look at {{ic|/usr/lib/systemd/system/graphical.target}} as an example), make a directory {{ic|/etc/systemd/system/''your target''.wants}}, and then symlink the additional services from {{ic|/usr/lib/systemd/system/}} that you wish to enable.<br />
<br />
=== Targets table ===<br />
<br />
{| border="1"<br />
! SysV Runlevel !! systemd Target !! Notes<br />
|-<br />
| 0 || runlevel0.target, poweroff.target || Halt the system.<br />
|-<br />
| 1, s, single || runlevel1.target, rescue.target || Single user mode.<br />
|-<br />
| 2, 4 || runlevel2.target, runlevel4.target, multi-user.target || User-defined/Site-specific runlevels. By default, identical to 3.<br />
|-<br />
| 3 || runlevel3.target, multi-user.target || Multi-user, non-graphical. Users can usually login via multiple consoles or via the network.<br />
|-<br />
| 5 || runlevel5.target, graphical.target || Multi-user, graphical. Usually has all the services of runlevel 3 plus a graphical login.<br />
|-<br />
| 6 || runlevel6.target, reboot.target || Reboot<br />
|-<br />
| emergency || emergency.target || Emergency shell<br />
|-<br />
|}<br />
<br />
=== Change current target ===<br />
<br />
In ''systemd'' targets are exposed via ''target units''. You can change them like this:<br />
<br />
# systemctl isolate graphical.target<br />
<br />
This will only change the current target, and has no effect on the next boot. This is equivalent to commands such as {{ic|telinit 3}} or {{ic|telinit 5}} in Sysvinit.<br />
<br />
=== Change default target to boot into ===<br />
<br />
The standard target is ''default.target'', which is aliased by default to ''graphical.target'' (which roughly corresponds to the old runlevel 5). To change the default target at boot-time, append one of the following [[kernel parameters]] to your bootloader:<br />
<br />
{{Tip|The ''.target'' extension can be left out.}}<br />
<br />
* {{ic|1=systemd.unit=multi-user.target}} (which roughly corresponds to the old runlevel 3),<br />
* {{ic|1=systemd.unit=rescue.target}} (which roughly corresponds to the old runlevel 1).<br />
<br />
Alternatively, you may leave the bootloader alone and change ''default.target''. This can be done using ''systemctl'':<br />
<br />
# systemctl enable multi-user.target<br />
<br />
The effect of this command is output by ''systemctl''; a symlink to the new default target is made at {{ic|/etc/systemd/system/default.target}}. This works if, and only if:<br />
<br />
[Install]<br />
Alias=default.target<br />
<br />
is in the target's configuration file. Currently, ''multi-user.target'' and ''graphical.target'' both have it.<br />
<br />
== Timers ==<br />
<br />
Systemd can replace cron functionality to a great extent. For further information, please refer to [[systemd/cron functionality]].<br />
<br />
== Journal ==<br />
<br />
''systemd'' has its own logging system called the journal; therefore, running a syslog daemon is no longer required. To read the log, use:<br />
<br />
# journalctl<br />
<br />
As in Arch Linux the directory {{ic|/var/log/journal/}} is part of the ''systemd'' package, the journal (when {{ic|1=Storage=}} is set to {{ic|auto}} in {{ic|/etc/systemd/journald.conf}}) will write to {{ic|/var/log/journal/}}. If you or some program delete that directory, systemd will '''not''' recreate it automatically; however, it will be recreated during the next update of the systemd package. Until then, logs will be written to {{ic|/run/systemd/journal}}, and logs will be lost on reboot.<br />
<br />
{{Tip|If {{ic|/var/log/journal/}} resides in a [[btrfs]] filesystem you should consider disabling [[Btrfs#Copy-On-Write_.28CoW.29|Copy-on-Write]] for the directory:<br />
# chattr +C /var/log/journal<br />
}}<br />
<br />
=== Filtering output ===<br />
<br />
''journalctl'' allows you to filter the output by specific fields.<br />
<br />
Examples:<br />
<br />
Show all messages from this boot:<br />
<br />
# journalctl -b<br />
<br />
However, often one is interested in messages not from the current, but from the previous boot (e.g. if an unrecoverable system crash happened). Currently, this feature is not implemented, though there was a discussion at [http://comments.gmane.org/gmane.comp.sysutils.systemd.devel/6608 systemd-devel@lists.freedesktop.org] (September/October 2012).<br />
<br />
As a workaround you can use at the moment:<br />
<br />
# journalctl --since=today | tac | sed -n '/-- Reboot --/{n;:r;/-- Reboot --/q;p;n;b r}' | tac<br />
<br />
provided, that the previous boot happened today. Be aware that, if there are many messages for the current day, the output of this command can be delayed for quite some time.<br />
{{note|This needs to be corrected once 206 lands. {{ic|journalctl -b}} now takes arguments such as {{ic|-0}} for the last boot or a boot id. E.g. {{ic|journalctl -b -3}} will show all messages from the fourth to last boot.}}<br />
<br />
Follow new messages:<br />
<br />
# journalctl -f<br />
<br />
Show all messages by a specific executable:<br />
<br />
# journalctl /usr/lib/systemd/systemd<br />
<br />
Show all messages by a specific process:<br />
<br />
# journalctl _PID=1<br />
<br />
Show all messages by a specific unit:<br />
<br />
# journalctl -u netcfg<br />
<br />
Show kernel ring buffer:<br />
<br />
# journalctl _TRANSPORT=kernel<br />
<br />
See {{ic|man 1 journalctl}}, {{ic|man 7 systemd.journal-fields}}, or Lennert's [http://0pointer.de/blog/projects/journalctl.html blog post] for details.<br />
<br />
=== Journal size limit ===<br />
<br />
If the journal is persistent (non-volatile), its size limit is set to a default value of 10% of the size of the respective file system. For example, with {{ic|/var/log/journal}} located on a 50 GiB root partition this would lead to 5 GiB of journal data. The maximum size of the persistent journal can be controlled by {{ic|SystemMaxUse}} in {{ic|/etc/systemd/journald.conf}}, so to limit it for example to 50 MiB uncomment and edit the corresponding line to:<br />
<br />
SystemMaxUse=50M<br />
<br />
Refer to {{ic|man journald.conf}} for more info.<br />
<br />
=== Journald in conjunction with syslog ===<br />
<br />
Compatibility with classic syslog implementations is provided via a socket {{ic|/run/systemd/journal/syslog}}, to which all messages are forwarded. To make the syslog daemon work with the journal, it has to bind to this socket instead of {{ic|/dev/log}} ([http://lwn.net/Articles/474968/ official announcement]). The {{Pkg|syslog-ng}} package in the repositories automatically provides the necessary configuration.<br />
<br />
# systemctl enable syslog-ng<br />
<br />
A good ''journalctl'' tutorial is [http://0pointer.de/blog/projects/journalctl.html here].<br />
<br />
== Troubleshooting ==<br />
<br />
=== Investigating systemd errors ===<br />
<br />
As an example, we will investigate an error with {{ic|systemd-modules-load}} service:<br />
<br />
1. Lets find the systemd services which fail to start:<br />
$ systemctl | grep -i failed<br />
systemd-modules-load.service loaded '''failed failed''' Load Kernel Modules<br />
<br />
2. Ok, we found a problem with {{ic|systemd-modules-load}} service. We want to know more:<br />
$ systemctl status systemd-modules-load<br />
systemd-modules-load.service - Load Kernel Modules<br />
Loaded: loaded (/usr/lib/systemd/system/systemd-modules-load.service; static)<br />
Active: '''failed''' (Result: exit-code) since So 2013-08-25 11:48:13 CEST; 32s ago<br />
Docs: man:systemd-modules-load.service(8).<br />
man:modules-load.d(5)<br />
Process: '''15630''' ExecStart=/usr/lib/systemd/systemd-modules-load ('''code=exited, status=1/FAILURE''')<br />
<br />
3. Now we have the process id (PID) to investigate this error in depth. Enter the following command with the current {{ic|Process ID}} (here: 15630):<br />
$ journalctl -b _PID=15630<br />
-- Logs begin at Sa 2013-05-25 10:31:12 CEST, end at So 2013-08-25 11:51:17 CEST. --<br />
Aug 25 11:48:13 mypc systemd-modules-load[15630]: '''Failed to find module 'blacklist usblp''''<br />
Aug 25 11:48:13 mypc systemd-modules-load[15630]: '''Failed to find module 'install usblp /bin/false'''' <br />
<br />
4. We see that some of the kernel module configs have wrong settings. Therefore we have a look at these settings in {{ic|/etc/modules-load.d/}}:<br />
$ ls -al /etc/modules-load.d/<br />
total 44<br />
drwxr-xr-x 2 root root 4096 14. Jul 11:01 .<br />
drwxr-xr-x 114 root root 12288 25. Aug 11:40 ..<br />
-rw-r--r-- 1 root root 79 1. Dez 2012 blacklist.conf<br />
-rw-r--r-- 1 root root 1 2. Mär 14:30 encrypt.conf<br />
-rw-r--r-- 1 root root 3 5. Dez 2012 printing.conf<br />
-rw-r--r-- 1 root root 6 14. Jul 11:01 realtek.conf<br />
-rw-r--r-- 1 root root 65 2. Jun 23:01 virtualbox.conf<br />
<br />
5. The {{ic|Failed to find module 'blacklist usblp'}} error message might be related to a wrong setting inside of {{ic|blacklist.conf}}. Lets deactivate it with inserting a trailing '''#''' before each option we found via step 3:<br />
$ nano /etc/modules-load.d/blacklist.conf<br />
'''#''' blacklist usblp<br />
'''#''' install usblp /bin/false<br />
<br />
6. Now, try to start {{ic|systemd-modules-load}}:<br />
$ systemctl start systemd-modules-load.service<br />
If it was successful, this shouldn't prompt anything. If you see any error, go back to step 3. and use the new PID for solving the errors left.<br />
<br />
If everything is ok, you can verify that the service was started successfully with:<br />
$ systemctl status systemd-modules-load<br />
systemd-modules-load.service - Load Kernel Modules<br />
Loaded: '''loaded''' (/usr/lib/systemd/system/systemd-modules-load.service; static)<br />
Active: '''active (exited)''' since So 2013-08-25 12:22:31 CEST; 34s ago<br />
Docs: man:systemd-modules-load.service(8)<br />
man:modules-load.d(5)<br />
Process: 19005 ExecStart=/usr/lib/systemd/systemd-modules-load (code=exited, status=0/SUCCESS)<br />
Aug 25 12:22:31 mypc systemd[1]: '''Started Load Kernel Modules'''.<br />
<br />
Often you can solve these kind of problems like shown above. For further investigation look at the following caption "'''Diagnosing boot problems'''"<br />
<br />
=== Diagnosing boot problems ===<br />
<br />
Boot with these parameters on the kernel command line:<br />
{{ic|<nowiki>systemd.log_level=debug systemd.log_target=kmsg log_buf_len=1M</nowiki>}}<br />
<br />
[http://freedesktop.org/wiki/Software/systemd/Debugging More Debugging Information]<br />
<br />
=== Shutdown/reboot takes terribly long ===<br />
<br />
If the shutdown process takes a very long time (or seems to freeze) most likely a service not exiting is to blame. ''systemd'' waits some time for each service to exit before trying to kill it. To find out if you are affected, see [http://freedesktop.org/wiki/Software/systemd/Debugging/#shutdowncompleteseventually this article].<br />
<br />
=== Short lived processes do not seem to log any output ===<br />
<br />
If {{ic|journalctl -u foounit}} does not show any output for a short lived service, look at the PID instead. For example, if {{ic|systemd-modules-load.service}} fails, and {{ic|systemctl status systemd-modules-load}} shows that it ran as PID 123, then you might be able to see output in the journal for that PID, i.e. {{ic|journalctl -b _PID&#61;123}}. Metadata fields for the journal such as _SYSTEMD_UNIT and _COMM are collected asynchronously and rely on the {{ic|/proc}} directory for the process existing. Fixing this requires fixing the kernel to provide this data via a socket connection, similar to SCM_CREDENTIALS.<br />
<br />
=== Disabling application crash dumps journaling ===<br />
<br />
Run the following in order to overwrite the settings from {{ic|/lib/sysctl.d/}}:<br />
# ln -s /dev/null /etc/sysctl.d/50-coredump.conf<br />
# sysctl kernel.core_pattern=core<br />
<br />
This will disable logging of coredumps to the journal.<br />
<br />
Note that the default RLIMIT_CORE of 0 means that no core files are written, either.<br />
If you want them, you also need to "unlimit" the core file size in the shell:<br />
$ ulimit -c unlimited<br />
<br />
See [http://www.freedesktop.org/software/systemd/man/sysctl.d.html sysctl.d] and [https://www.kernel.org/doc/Documentation/sysctl/kernel.txt the documentation for /proc/sys/kernel] for more information.<br />
<br />
== See also ==<br />
<br />
*[http://www.freedesktop.org/wiki/Software/systemd Official web site]<br />
*[[Wikipedia:systemd|Wikipedia article]]<br />
*[http://0pointer.de/public/systemd-man/ Manual pages]<br />
*[http://freedesktop.org/wiki/Software/systemd/Optimizations systemd optimizations]<br />
*[http://www.freedesktop.org/wiki/Software/systemd/FrequentlyAskedQuestions FAQ]<br />
*[http://www.freedesktop.org/wiki/Software/systemd/TipsAndTricks Tips and tricks]<br />
*[http://0pointer.de/public/systemd-ebook-psankar.pdf systemd for Administrators (PDF)]<br />
*[http://fedoraproject.org/wiki/Systemd About systemd on Fedora Project]<br />
*[http://fedoraproject.org/wiki/How_to_debug_Systemd_problems How to debug systemd problems]<br />
*[http://www.h-online.com/open/features/Control-Centre-The-systemd-Linux-init-system-1565543.html Two] [http://www.h-online.com/open/features/Booting-up-Tools-and-tips-for-systemd-1570630.html part] introductory article in ''The H Open'' magazine.<br />
*[http://0pointer.de/blog/projects/systemd.html Lennart's blog story]<br />
*[http://0pointer.de/blog/projects/systemd-update.html Status update]<br />
*[http://0pointer.de/blog/projects/systemd-update-2.html Status update2]<br />
*[http://0pointer.de/blog/projects/systemd-update-3.html Status update3]<br />
*[http://0pointer.de/blog/projects/why.html Most recent summary]<br />
*[http://fedoraproject.org/wiki/SysVinit_to_Systemd_Cheatsheet Fedora's SysVinit to systemd cheatsheet]<br />
*[[Allow Users to Shutdown|Configuring systemd to allow normal users to shutdown]]</div>Holomorphhttps://wiki.archlinux.org/index.php?title=Power_saving&diff=276629Power saving2013-09-25T23:25:04Z<p>Holomorph: /* Kernel parameters */ sysctl.conf is deprecated</p>
<hr />
<div>[[Category:Power management]]<br />
{{Article summary start}}<br />
{{Article summary text|Configuration and tools for saving power.}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|Power Management}}<br />
{{Article summary wiki|CPU Frequency Scaling}}<br />
{{Article summary wiki|Hybrid graphics}}<br />
{{Article summary wiki|Kernel modules}}<br />
{{Article summary wiki|sysctl}}<br />
{{Article summary wiki|udev}}<br />
{{Article summary end}}<br />
This article covers the configuration needed to turn on power saving features. Almost all of the features listed here are worth using whether or not the computer is on AC or battery power. Most have negligible performance impact and are just not enabled by default because of commonly broken hardware/drivers. Reducing power usage means reducing heat, which can even lead to higher performance on a modern Intel or AMD CPU, thanks to [[Wikipedia:Intel Turbo Boost|dynamic overclocking]].<br />
<br />
== Configuration ==<br />
<br />
If you would like to create your own scripts and power saving settings such as by udev rules you can take the following settings as a reference.<br />
<br />
=== Audio ===<br />
<br />
By default, audio power saving is turned off by most drivers. It can be enabled by setting the {{ic|power_save}} parameter; a time (in seconds) to go into idle mode. To idle the audio card after one second, create<br />
<br />
{{hc|/etc/modprobe.d/audio_powersave.conf|2=options snd_hda_intel power_save=1}}<br />
<br />
for Intel, or use<br />
<br />
options snd_ac97_codec power_save=1<br />
<br />
for ac97.<br />
<br />
{{Note|Toggling the audio card's power state can cause a popping sound or noticeable latency on some broken hardware.}}<br />
<br />
=== Active state power management ===<br />
<br />
To verify that [[Wikipedia:Active State Power Management|ASPM]] is enabled:<br />
<br />
{{hc|$ cat /sys/module/pcie_aspm/parameters/policy|[default] performance powersave}}<br />
<br />
Either {{ic|[default]}} or {{ic|[powersave]}} means you do not need to force it on. Otherwise, it's either unsupported or broken on your hardware, or has to be forced on with {{ic|1=pcie_aspm=force}} on the [[kernel line]].<br />
<br />
{{Warning|<br />
* Forcing on ASPM can cause a freeze/panic, so make sure you have a way to undo the option if it doesn't work.<br />
* On systems that don't support it forcing on ASPM can even increase power consumption.}}<br />
<br />
=== Backlight ===<br />
<br />
When system starts, screen backlight is set to maximum by default. This can be fixed by specifying backlight level in the following udev rule:<br />
<br />
{{hc|/etc/udev/rules.d/backlight.rules|<nowiki><br />
## SET BACKLIGHT<br />
SUBSYSTEM=="backlight", ACTION=="add", KERNEL=="acpi_video0", ATTR{brightness}="1"<br />
</nowiki>}}<br />
<br />
See [[Backlight]] for more information.<br />
<br />
=== Bluetooth ===<br />
<br />
{{expansion|reason=The device should likely be disabled with hciconfig first.}}<br />
<br />
[[Kernel_modules#Blacklisting|Blacklist]] the {{ic|hci_usb}} module if the driver is loaded automatically.<br />
<br />
Alternatively, [[Kernel_modules#Blacklisting|blacklist]] the {{ic|btusb}} and {{ic|bluetooth}} modules.<br />
<br />
Another variant is to {{pkg|rfkill}} it:<br />
# rfkill block bluetooth<br />
<br />
Or with udev rule:<br />
{{hc|/etc/udev/rules.d/bt.rules|<nowiki><br />
## DISABLE BLUETOOTH<br />
SUBSYSTEM=="rfkill", ATTR{type}=="bluetooth", ATTR{state}="0"<br />
</nowiki>}}<br />
<br />
=== Web-Camera ===<br />
<br />
If you won't use integrated web camera then [[Kernel_modules#Blacklisting|blacklist]] the {{ic|uvcvideo}} module.<br />
<br />
=== Kernel parameters ===<br />
<br />
This section uses configs in {{ic|/etc/sysctl.d/}}, which is ''"a drop-in directory for kernel sysctl parameters."'' See [http://0pointer.de/blog/projects/the-new-configuration-files The New Configuration Files] and more specifically [http://0pointer.de/public/systemd-man/sysctl.d.html systemd's sysctl.d man page] for more information.<br />
<br />
==== Disabling NMI watchdog ====<br />
<br />
The [[Wikipedia:Non-maskable interrupt|NMI]] watchdog is a debugging feature to catch hardware hangs and cause a kernel panic. On some systems it can generate a lot of interrupts, causing a noticeable increase in power usage.<br />
<br />
{{hc|/etc/sysctl.d/disable_watchdog.conf|2=kernel.nmi_watchdog = 0}}<br />
<br />
or add {{ic|1=nmi_watchdog=0}} to the [[kernel parameter|kernel line]] to disable it completely from early boot.<br />
<br />
==== Writeback Time ====<br />
<br />
Increasing the VM dirty writeback time can help to aggregate I/O together - reducing disk writes, and decreasing power usage:<br />
<br />
{{hc|/etc/sysctl.d/dirty.conf|2=vm.dirty_writeback_centisecs = 1500}}<br />
<br />
To do the same for journal commits with ext4 and some other filesystems, use {{ic|1=commit=15}} as a parameter in [[fstab]] or with the {{ic|rootflags}} [[kernel parameter]].<br />
<br />
==== Laptop Mode ====<br />
<br />
See the [https://www.kernel.org/doc/Documentation/laptops/laptop-mode.txt kernel documentation] on the laptop mode 'knob.' ''"A sensible value for the knob is 5 seconds."''<br />
<br />
{{hc|/etc/sysctl.d/laptop.conf|2=vm.laptop_mode = 5}}<br />
<br />
=== Network interfaces ===<br />
<br />
[[Wikipedia:Wake-on-LAN|Wake-on-LAN]] can be a useful feature, but if you're not making use of it then it's simply draining extra power waiting for a magic packet while in suspend. Disabling for all Ethernet interfaces:<br />
<br />
{{hc|/etc/udev/rules.d/70-disable_wol.rules|2=ACTION=="add", SUBSYSTEM=="net", KERNEL=="eth*", RUN+="/usr/bin/ethtool -s %k wol d"}}<br />
<br />
To enable powersaving on all wireless interfaces:<br />
<br />
{{hc|/etc/udev/rules.d/70-wifi-powersave.rules|2=ACTION=="add", SUBSYSTEM=="net", KERNEL=="wlan*", RUN+="/usr/bin/iw dev %k set power_save on"}}<br />
<br />
In these examples, {{ic|%k}} is a specifier for the kernel name of the matched device. For example, if it finds that the rule is applicable to {{ic|wlan0}}, the {{ic|%k}} specifier will be replaced with {{ic|wlan0}}. To apply the rules to only a particular interface, just replace the pattern {{ic|eth*}} and specifier {{ic|%k}} with the desired interface name. For more information, see [http://www.reactivated.net/writing_udev_rules.html Writing udev rules].<br />
<br />
In this case, the name of the configuration file is important. Due to the introduction of [[Network_Configuration#Device_names|persistent device names]] via {{ic|80-net-name-slot.rules}} in systemd v197, it is important that the network powersave rules are named lexicographically before {{ic|80-net-name-slot.rules}}, so that they are applied before the devices are named e.g. {{ic|enp2s0}}.<br />
<br />
=== PCI Runtime Power Management ===<br />
<br />
{{hc|/etc/udev/rules.d/pci_pm.rules|2=ACTION=="add", SUBSYSTEM=="pci", ATTR{power/control}="auto"}}<br />
<br />
=== SATA Active Link Power Management ===<br />
<br />
{{Note|This adds latency when accessing a drive that has been idle, so it's one of the few settings that may be worth toggling based on whether you're on AC power.}}<br />
<br />
{{hc|/etc/udev/rules.d/hd_power_save.rules|2=ACTION=="add", SUBSYSTEM=="scsi_host", KERNEL=="host*", ATTR{link_power_management_policy}="min_power"}}<br />
<br />
=== USB Autosuspend ===<br />
<br />
To enable USB autosuspend after 2 seconds of inactivity:<br />
<br />
{{hc|/etc/udev/rules.d/usb_power_save.rules|<nowiki><br />
ACTION=="add", SUBSYSTEM=="usb", TEST=="power/control", ATTR{power/control}="auto"<br />
ACTION=="add", SUBSYSTEM=="usb", TEST=="power/autosuspend", ATTR{power/autosuspend}="2"<br />
</nowiki>}}<br />
<br />
Other option is to use modprobe:<br />
<br />
{{hc|/etc/modprobe.d/modprobe.conf|<nowiki><br />
options usbcore autosuspend=2<br />
</nowiki>}}<br />
<br />
=== Device Power Management ===<br />
<br />
{{accuracy|reason=Should be done with a udev rule.}}<br />
<br />
# echo auto | tee /sys/bus/i2c/devices/*/power/control > /dev/null<br />
# echo auto | tee /sys/bus/spi/devices/*/power/control > /dev/null<br />
<br />
=== Mount options ===<br />
<br />
You might want to use the {{ic|noatime}} option, see [[Fstab#atime options]] for more information.<br />
<br />
=== CD/DVD spin down ===<br />
<br />
{{Expansion|something similar without using udisks?}}<br />
<br />
To allow the CD/DVD rom to spin down after a while using [[udisks]]:<br />
<br />
# udisks --inhibit-polling /dev/sr0<br />
<br />
== Tools and scripts ==<br />
<br />
=== Packages ===<br />
<br />
There are many scripts and tools which make use of the various settings described in the previous sections. These are notably:<br />
<br />
* [[Powertop]] is a handy utility from Intel that displays which hardware/processes are using the most power on your system, and provides instructions on how to stop or remove power-wasting services. It's report functionality can also be used to identify the relevant parameters for the system. <br />
* [[TLP]]<br />
* [[Powerdown]]<br />
* {{AUR|powerconf}}<br />
* {{AUR|ftw-git}}<br />
* [[Laptop Mode Tools]]<br />
* [[pm-utils]]<br />
<br />
If you do not want to take care of the settings by yourself it is recommended to use these tools. But be aware of running only '''one''' of these tools to avoid possible conflicts as they all work more or less similar.<br />
<br />
{{Tip|Have a look at the [[:Category:Power management|power management category]] to get an overview on what power management options exists in Archlinux.}}<br />
<br />
=== Using a script and an udev rule ===<br />
<br />
Since systemd users can suspend and hibernate through {{ic|systemctl suspend}} or {{ic|systemctl hibernate}} and handle acpi events with {{ic|/etc/systemd/logind.conf}}, it might be interesting to remove [[pm-utils]] and [[acpid]]. There's just one thing systemd can't do (as of systemd-204): power management depending on whether the system is running on AC or battery. To fill this gap, you can create a single [[udev]] rule that runs a script when the AC adapter is plugged and unplugged:<br />
<br />
{{hc|/etc/udev/rules.d/powersave|2=<nowiki><br />
SUBSYSTEM=="power_supply", ATTR{online}=="0", RUN+="/path/to/your/script true"<br />
SUBSYSTEM=="power_supply", ATTR{online}=="1", RUN+="/path/to/your/script false"<br />
</nowiki>}}<br />
<br />
{{Note|You can use the same script that ''pm-powersave'' uses. You just have to make it executable and place it somewhere else (for example {{ic|/usr/local/bin/}}).}}<br />
<br />
Examples of powersave scripts can be found here: {{AUR|powerdown}}, {{AUR|powerconf}}, [https://github.com/Unia/powersave powersave].<br />
<br />
The above udev rule should work as expected, but if your power settings aren't updated after a suspend or hibernate cycle, you should add a script in {{ic|/usr/lib/systemd/system-sleep/}} with the following contents:<br />
<br />
{{hc|/usr/lib/systemd/system-sleep/00powersave|<nowiki><br />
#!/bin/sh<br />
<br />
case $1 in<br />
pre) /path/to/your/script false ;;<br />
post) <br />
if cat /sys/class/power_supply/AC0/online | grep 0 > /dev/null 2>&1<br />
then<br />
/path/to/your/script true <br />
else<br />
/path/to/your/script false<br />
fi<br />
;;<br />
esac<br />
exit 0<br />
</nowiki>}}<br />
<br />
Don't forget to make it executable!<br />
<br />
{{Note|Be aware that AC0 may be different for your laptop, change it if that is the case.}}<br />
<br />
Now you don't need pm-utils anymore. Depending on your configuration, it may be a dependency of some other package. If you wish to remove it anyway, run {{ic|pacman -Rdd pm-utils}}.<br />
<br />
=== Print power settings ===<br />
<br />
This script prints power settings and a variety of other properties for USB and PCI devices. Note that root permissions are needed to see all settings.<br />
<br />
{{bc|<nowiki><br />
#!/bin/bash<br />
<br />
for i in $(find /sys/devices -name "bMaxPower")<br />
do<br />
busdir=${i%/*}<br />
busnum=$(<$busdir/busnum)<br />
devnum=$(<$busdir/devnum)<br />
title=$(lsusb -s $busnum:$devnum)<br />
<br />
printf "\n\n+++ %s\n -%s\n" "$title" "$busdir"<br />
<br />
for ff in $(find $busdir/power -type f ! -empty 2>/dev/null)<br />
do<br />
v=$(cat $ff 2>/dev/null|tr -d "\n")<br />
[[ ${#v} -gt 0 ]] && echo -e " ${ff##*/}=$v";<br />
v=;<br />
done | sort -g;<br />
done;<br />
<br />
printf "\n\n\n+++ %s\n" "Kernel Modules"<br />
for mod in $(lspci -k | sed -n '/in use:/s,^.*: ,,p' | sort -u)<br />
do<br />
echo "+ $mod";<br />
systool -v -m $mod 2> /dev/null | sed -n "/Parameters:/,/^$/p";<br />
done<br />
</nowiki>}}</div>Holomorphhttps://wiki.archlinux.org/index.php?title=Wpa_supplicant&diff=275163Wpa supplicant2013-09-12T15:43:11Z<p>Holomorph: /* Connecting with wpa_cli */ ctrl_interface</p>
<hr />
<div>[[Category:Wireless Networking]] <br />
[[es:WPA supplicant]]<br />
[[it:WPA supplicant]]<br />
[[ru:WPA Supplicant]]<br />
[[zh-CN:WPA Supplicant]]<br />
{{Article summary start}}<br />
{{Article summary text|Setup and usage of wpa_supplicant}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|Network Configuration}}<br />
{{Article summary wiki|Wireless Setup}}<br />
{{Article summary end}}<br />
<br />
[http://hostap.epitest.fi/wpa_supplicant/ wpa_supplicant] is a cross-platform [[Wikipedia:Supplicant (computer)|WPA Supplicant]] with support for WPA and WPA2 ([https://en.wikipedia.org/wiki/IEEE_802.11i IEEE 802.11i] / RSN (Robust Secure Network)). It is suitable for both desktop/laptop computers and embedded systems. {{ic|wpa_supplicant}} is the IEEE 802.1X/WPA component that is used in the client stations. It implements key negotiation with a WPA Authenticator and it controls the roaming and IEEE 802.11 authentication/association of the wlan driver.<br />
<br />
== Installation ==<br />
<br />
Install {{Pkg|wpa_supplicant}} from the [[official repositories]].<br />
<br />
Optionally {{Pkg|wpa_supplicant_gui}} can be installed which provides {{ic|wpa_gui}}; a graphical frontend for {{ic|wpa_supplicant}} using the {{pkg|qt4}} toolkit.<br />
<br />
== Connecting with wpa_cli ==<br />
<br />
To associate with a wireless access point (WAP) using {{ic|wpa_supplicant}}, use the including command line tool {{ic|wpa_cli}}. In order to use {{ic|wpa_cli}}, a ''control interface'' must be specified for {{ic|wpa_supplicant}}. Do this by creating a config file containing {{ic|ctrl_interface&#61;/var/run/wpa_supplicant}}.<br />
<br />
{{Tip|Refer to the provided {{ic|/etc/wpa_supplicant/wpa_supplicant.conf}} for details.}}<br />
<br />
To enable saving changes made using wpa_cli, append the line {{ic|update_config&#61;1}} to the configuration file. Start wpa_supplicant with<br />
<br />
# wpa_supplicant -B -i ''interface'' -c ''/path/to/config''<br />
<br />
Invoke {{ic|wpa_cli}} with no arguments to get an interactive prompt ({{ic|>}}). The prompt has tab completion and descriptions of completed commands. The command {{ic|scan}} initiates a scan; a notification is issued when the scan is complete. Then:<br />
<br />
> scan_results<br />
bssid / frequency / signal level / flags / ssid<br />
00:00:00:00:00:00 2462 -49 [WPA2-PSK-CCMP][ESS] MYSSID<br />
11:11:11:11:11:11 2437 -64 [WPA2-PSK-CCMP][ESS] ANOTHERSSID<br />
<br />
To associate with ''MYSSID'', tell {{ic|wpa_supplicant}} about it. Each network is indexed numerically, so the first network will have index zero. The [http://en.wikipedia.org/wiki/Pre-shared_key PSK] can be provided without quotes as an alternative to providing the passphrase in this example:<br />
<br />
> add_network<br />
0<br />
> set_network 0 ssid "''MYSSID''"<br />
> set_network 0 psk "''passphrase''"<br />
> enable_network 0<br />
<2>CTRL-EVENT-CONNECTED - Connection to 00:00:00:00:00:00 completed (reauth) [id=0 id_str=]<br />
<br />
To save this network in the configuration file,<br />
<br />
> save_config<br />
OK<br />
<br />
Now that association with the WAP is complete, obtain an IP address via {{Pkg|dhcpcd}} or using the {{Pkg|iproute2}} tools.<br />
<br />
== Configuration ==<br />
<br />
{{Pkg|wpa_supplicant}} provides a reference configuration file located at {{ic|/etc/wpa_supplicant/wpa_supplicant.conf}} which contains detailed documentation for the all available options and their utilisation.<br />
<br />
In its simplest form, a configuration file requires only a network block. For example:<br />
<br />
{{hc|/etc/wpa_supplicant/foobar.conf|2=<br />
network={<br />
ssid="..."<br />
}<br />
}}<br />
<br />
This can easily be generated using the {{ic|wpa_passphrase}} tool. For example:<br />
<br />
{{hc|$ wpa_passphrase ''essid'' ''passphrase''|2=<br />
network={<br />
ssid="''essid''"<br />
#psk="''passphrase''"<br />
psk=f5d1c49e15e679bebe385c37648d4141bc5c9297796a8a185d7bc5ac62f954e3<br />
}<br />
}}<br />
<br />
Now both {{ic|wpa_supplicant}} and {{ic|wpa_passphrase}} can be combined to associate with almost all WPA2 (Personal) networks:<br />
<br />
# wpa_supplicant -B -i ''interface'' -c <(wpa_passphrase ''essid'' ''passphrase'')<br />
<br />
All that remains is to simply connect using a [[Network Configuration#Static IP Address|static IP]] or [[Network Configuration#Dynamic IP Address|DHCP]]. For example:<br />
<br />
# dhcpcd -A ''interface''<br />
<br />
== Maintaining a custom configuration ==<br />
<br />
{{Poor writing|This section is planned to be rewritten with a clearer structure and direction and more attention will be given to maintaining networks and controlling them effectively.}}<br />
<br />
{{Note|To discover your network interface name, issue the {{ic|ip link}} command.}}<br />
<br />
As discussed above we can make use of {{ic|wpa_passphrase}} to generate a basic configuration which we can augment with additional networks and options of our choosing. This may be necessary for more advanced networks employing extensive use of [https://en.wikipedia.org/wiki/Extensible_Authentication_Protocol EAP].<br />
<br />
Firstly we will use {{ic|wpa_passphrase}} to create our basic configuration file.<br />
<br />
# wpa_passphrase ''essid'' ''passphrase'' > /etc/wpa_supplicant/foobar.conf<br />
<br />
{{Tip|Some unusually complex passphrases may require input from a file: {{bc|# wpa_passphrase ''essid'' < ''passphrase.txt'' > /etc/wpa_supplicant/foobar.conf}} }}<br />
<br />
Next add a {{ic|ctrl_interface}} so that we may control the {{ic|wpa_supplicant}} daemon. We can allow {{ic|wpa_cli}} to edit this configuration by setting {{ic|1=update_config=1}}.<br />
<br />
{{hc|/etc/wpa_supplicant/foobar.conf|2=<br />
ctrl_interface=DIR=/run/wpa_supplicant GROUP=wheel # allow control for members in the 'wheel' group<br />
update_config=1<br />
<br />
network={<br />
ssid="foobarssid"<br />
psk=f5d1c49e15e679bebe385c37648d4141bc5c9297796a8a185d7bc5ac62f954e3<br />
}<br />
}}<br />
<br />
Multiple network blocks may be appended to this configuration.<br />
<br />
To start your network simply run the following:<br />
<br />
# ip link set ''interface'' up<br />
# wpa_supplicant -B -D nl80211 -i ''interface'' -c /etc/wpa_supplicant/foobar.conf<br />
# dhcpcd -A ''interface''<br />
<br />
{{Note|{{ic|nl80211}} is preferred over the deprecated {{ic|wext}} driver. For a list of supported drivers see the output of {{ic|wpa_supplicant -h}}.}}<br />
<br />
For networks of varying complexity please study the examples provided in the default {{ic|/etc/wpa_supplicant/wpa_supplicant.conf}} file.<br />
<br />
=== Enabling with systemd ===<br />
<br />
In order to enable wireless at boot, enable {{ic|wpa_supplicant}} on your particular wireless interface. To get connectivity with DHCP, enable {{ic|dhcpcd.service}} as well. Finally, to handle possible ethernet connections, install {{ic|ifplugd}} and enable it on your ethernet interface. For instance, the invocations might look like<br />
<br />
# systemctl enable wpa_supplicant@wlp3s1<br />
# systemctl enable dhcpcd<br />
# systemctl enable ifplugd@enp5s2<br />
<br />
WPA Supplicant handles roaming for all the SSIDs in its configuration file, and {{ic|ifplugd}} will configure ethernet and bring down wireless when an ethernet cable is plugged into the machine. {{ic|dhcpcd}} takes care of leasing an IP on all interfaces.<br />
<br />
It is likely that {{ic|wpa_supplicant@.service}} will have to be modified so that it will read the proper configuration file. To override the {{ic|ExecStart&#61;}} line, create the following:<br />
<br />
{{hc|/etc/systemd/system/wpa_supplicant@.service.d/foo.conf|<nowiki><br />
[Service]<br />
ExecStart=<br />
ExecStart=/usr/bin/wpa_supplicant -c/etc/wpa_supplicant/bar.conf -i%i<br />
</nowiki>}}<br />
<br />
The {{ic|1=WantedBy=}} section in the current version is incorrect. If the line in {{ic|wpa_supplicant@.service}} does not match your interface name (wlan0), it will be necessary to copy the service file to {{ic|/etc/systemd/system}} and edit it to reflect<br />
<br />
[Install]<br />
WantedBy=multi-user.target<br />
<br />
The issue is fixed in this [http://hostap.epitest.fi/gitweb/gitweb.cgi?p=hostap.git;a=commitdiff;h=893a0a558cd8fd9a7dc5827f379e0f8a273a4fe5 commit]<br />
<br />
== Related Links ==<br />
<br />
* [http://wireless.kernel.org/en/users/Documentation/wpa_supplicant Kernel.org wpa_supplicant documentation]</div>Holomorphhttps://wiki.archlinux.org/index.php?title=Wpa_supplicant&diff=275161Wpa supplicant2013-09-12T14:57:10Z<p>Holomorph: add wpa_cli info</p>
<hr />
<div>[[Category:Wireless Networking]] <br />
[[es:WPA supplicant]]<br />
[[it:WPA supplicant]]<br />
[[ru:WPA Supplicant]]<br />
[[zh-CN:WPA Supplicant]]<br />
{{Article summary start}}<br />
{{Article summary text|Setup and usage of wpa_supplicant}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|Network Configuration}}<br />
{{Article summary wiki|Wireless Setup}}<br />
{{Article summary end}}<br />
<br />
[http://hostap.epitest.fi/wpa_supplicant/ wpa_supplicant] is a cross-platform [[Wikipedia:Supplicant (computer)|WPA Supplicant]] with support for WPA and WPA2 ([https://en.wikipedia.org/wiki/IEEE_802.11i IEEE 802.11i] / RSN (Robust Secure Network)). It is suitable for both desktop/laptop computers and embedded systems. {{ic|wpa_supplicant}} is the IEEE 802.1X/WPA component that is used in the client stations. It implements key negotiation with a WPA Authenticator and it controls the roaming and IEEE 802.11 authentication/association of the wlan driver.<br />
<br />
== Installation ==<br />
<br />
Install {{Pkg|wpa_supplicant}} from the [[official repositories]].<br />
<br />
Optionally {{Pkg|wpa_supplicant_gui}} can be installed which provides {{ic|wpa_gui}}; a graphical frontend for {{ic|wpa_supplicant}} using the {{pkg|qt4}} toolkit.<br />
<br />
== Connecting with wpa_cli ==<br />
<br />
To associate with a wireless access point (WAP) using {{ic|wpa_supplicant}}, use the including command line tool {{ic|wpa_cli}}. To allow the wheel group to manipulate wpa_supplicant, create a config file containing {{ic|ctrl_interface&#61;GROUP&#61;wheel}}. To enable saving changes made using wpa_cli, append to the configuration {{ic|update_config&#61;1}}. Start wpa_supplicant with<br />
<br />
# wpa_supplicant -B -C /run/wpa_supplicant -i ''interface'' -c ''/path/to/config''<br />
<br />
Invoke {{ic|wpa_cli}} with no arguments to get an interactive prompt ({{ic|>}}). The prompt has tab completion and descriptions of completed commands. The command {{ic|scan}} initiates a scan; a notification is issued when the scan is complete. Then:<br />
<br />
> scan_results<br />
bssid / frequency / signal level / flags / ssid<br />
00:00:00:00:00:00 2462 -49 [WPA2-PSK-CCMP][ESS] MYSSID<br />
11:11:11:11:11:11 2437 -64 [WPA2-PSK-CCMP][ESS] ANOTHERSSID<br />
<br />
To associate with ''MYSSID'', tell {{ic|wpa_supplicant}} about it. Each network is indexed numerically, so the first network will have index zero. The [http://en.wikipedia.org/wiki/Pre-shared_key PSK] can be provided without quotes as an alternative to providing the passphrase in this example:<br />
<br />
> add_network<br />
0<br />
> set_network 0 ssid "''MYSSID''"<br />
> set_network 0 psk "''passphrase''"<br />
> enable_network 0<br />
<2>CTRL-EVENT-CONNECTED - Connection to 00:00:00:00:00:00 completed (reauth) [id=0 id_str=]<br />
<br />
To save this network in the configuration file,<br />
<br />
> save_config<br />
OK<br />
<br />
Now that association with the WAP is complete, obtain an IP address via {{Pkg|dhcpcd}} or using the {{Pkg|iproute2}} tools.<br />
<br />
== Configuration ==<br />
<br />
{{Pkg|wpa_supplicant}} provides a reference configuration file located at {{ic|/etc/wpa_supplicant/wpa_supplicant.conf}} which contains detailed documentation for the all available options and their utilisation.<br />
<br />
In its simplest form, a configuration file requires only a network block. For example:<br />
<br />
{{hc|/etc/wpa_supplicant/foobar.conf|2=<br />
network={<br />
ssid="..."<br />
}<br />
}}<br />
<br />
This can easily be generated using the {{ic|wpa_passphrase}} tool. For example:<br />
<br />
{{hc|$ wpa_passphrase ''essid'' ''passphrase''|2=<br />
network={<br />
ssid="''essid''"<br />
#psk="''passphrase''"<br />
psk=f5d1c49e15e679bebe385c37648d4141bc5c9297796a8a185d7bc5ac62f954e3<br />
}<br />
}}<br />
<br />
Now both {{ic|wpa_supplicant}} and {{ic|wpa_passphrase}} can be combined to associate with almost all WPA2 (Personal) networks:<br />
<br />
# wpa_supplicant -B -i ''interface'' -c <(wpa_passphrase ''essid'' ''passphrase'')<br />
<br />
All that remains is to simply connect using a [[Network Configuration#Static IP Address|static IP]] or [[Network Configuration#Dynamic IP Address|DHCP]]. For example:<br />
<br />
# dhcpcd -A ''interface''<br />
<br />
== Maintaining a custom configuration ==<br />
<br />
{{Poor writing|This section is planned to be rewritten with a clearer structure and direction and more attention will be given to maintaining networks and controlling them effectively.}}<br />
<br />
{{Note|To discover your network interface name, issue the {{ic|ip link}} command.}}<br />
<br />
As discussed above we can make use of {{ic|wpa_passphrase}} to generate a basic configuration which we can augment with additional networks and options of our choosing. This may be necessary for more advanced networks employing extensive use of [https://en.wikipedia.org/wiki/Extensible_Authentication_Protocol EAP].<br />
<br />
Firstly we will use {{ic|wpa_passphrase}} to create our basic configuration file.<br />
<br />
# wpa_passphrase ''essid'' ''passphrase'' > /etc/wpa_supplicant/foobar.conf<br />
<br />
{{Tip|Some unusually complex passphrases may require input from a file: {{bc|# wpa_passphrase ''essid'' < ''passphrase.txt'' > /etc/wpa_supplicant/foobar.conf}} }}<br />
<br />
Next add a {{ic|ctrl_interface}} so that we may control the {{ic|wpa_supplicant}} daemon. We can allow {{ic|wpa_cli}} to edit this configuration by setting {{ic|1=update_config=1}}.<br />
<br />
{{hc|/etc/wpa_supplicant/foobar.conf|2=<br />
ctrl_interface=DIR=/run/wpa_supplicant GROUP=wheel # allow control for members in the 'wheel' group<br />
update_config=1<br />
<br />
network={<br />
ssid="foobarssid"<br />
psk=f5d1c49e15e679bebe385c37648d4141bc5c9297796a8a185d7bc5ac62f954e3<br />
}<br />
}}<br />
<br />
Multiple network blocks may be appended to this configuration.<br />
<br />
To start your network simply run the following:<br />
<br />
# ip link set ''interface'' up<br />
# wpa_supplicant -B -D nl80211 -i ''interface'' -c /etc/wpa_supplicant/foobar.conf<br />
# dhcpcd -A ''interface''<br />
<br />
{{Note|{{ic|nl80211}} is preferred over the deprecated {{ic|wext}} driver. For a list of supported drivers see the output of {{ic|wpa_supplicant -h}}.}}<br />
<br />
For networks of varying complexity please study the examples provided in the default {{ic|/etc/wpa_supplicant/wpa_supplicant.conf}} file.<br />
<br />
=== Enabling with systemd ===<br />
<br />
In order to enable wireless at boot, enable {{ic|wpa_supplicant}} on your particular wireless interface. To get connectivity with DHCP, enable {{ic|dhcpcd.service}} as well. Finally, to handle possible ethernet connections, install {{ic|ifplugd}} and enable it on your ethernet interface. For instance, the invocations might look like<br />
<br />
# systemctl enable wpa_supplicant@wlp3s1<br />
# systemctl enable dhcpcd<br />
# systemctl enable ifplugd@enp5s2<br />
<br />
WPA Supplicant handles roaming for all the SSIDs in its configuration file, and {{ic|ifplugd}} will configure ethernet and bring down wireless when an ethernet cable is plugged into the machine. {{ic|dhcpcd}} takes care of leasing an IP on all interfaces.<br />
<br />
It is likely that {{ic|wpa_supplicant@.service}} will have to be modified so that it will read the proper configuration file. To override the {{ic|ExecStart&#61;}} line, create the following:<br />
<br />
{{hc|/etc/systemd/system/wpa_supplicant@.service.d/foo.conf|<nowiki><br />
[Service]<br />
ExecStart=<br />
ExecStart=/usr/bin/wpa_supplicant -c/etc/wpa_supplicant/bar.conf -i%i<br />
</nowiki>}}<br />
<br />
The {{ic|1=WantedBy=}} section in the current version is incorrect. If the line in {{ic|wpa_supplicant@.service}} does not match your interface name (wlan0), it will be necessary to copy the service file to {{ic|/etc/systemd/system}} and edit it to reflect<br />
<br />
[Install]<br />
WantedBy=multi-user.target<br />
<br />
The issue is fixed in this [http://hostap.epitest.fi/gitweb/gitweb.cgi?p=hostap.git;a=commitdiff;h=893a0a558cd8fd9a7dc5827f379e0f8a273a4fe5 commit]<br />
<br />
== Related Links ==<br />
<br />
* [http://wireless.kernel.org/en/users/Documentation/wpa_supplicant Kernel.org wpa_supplicant documentation]</div>Holomorphhttps://wiki.archlinux.org/index.php?title=Wpa_supplicant&diff=273105Wpa supplicant2013-08-29T16:30:28Z<p>Holomorph: /* Configuration */ WORDS</p>
<hr />
<div>[[Category:Wireless Networking]] <br />
[[es:WPA supplicant]]<br />
[[it:WPA supplicant]]<br />
[[ru:WPA Supplicant]]<br />
[[zh-CN:WPA Supplicant]]<br />
{{Article summary start}}<br />
{{Article summary text|Setup and usage of wpa_supplicant}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|Network Configuration}}<br />
{{Article summary wiki|Wireless Setup}}<br />
{{Article summary end}}<br />
<br />
[http://hostap.epitest.fi/wpa_supplicant/ wpa_supplicant] is a cross-platform [[Wikipedia:Supplicant (computer)|WPA Supplicant]] with support for WPA and WPA2 ([https://en.wikipedia.org/wiki/IEEE_802.11i IEEE 802.11i] / RSN (Robust Secure Network)). It is suitable for both desktop/laptop computers and embedded systems. {{ic|wpa_supplicant}} is the IEEE 802.1X/WPA component that is used in the client stations. It implements key negotiation with a WPA Authenticator and it controls the roaming and IEEE 802.11 authentication/association of the wlan driver.<br />
<br />
== Installation ==<br />
<br />
Install {{Pkg|wpa_supplicant}} from the [[official repositories]].<br />
<br />
Optionally {{Pkg|wpa_supplicant_gui}} can be installed which provides {{ic|wpa_gui}}; a graphical frontend for {{ic|wpa_supplicant}} using the {{pkg|qt4}} toolkit.<br />
<br />
== Configuration ==<br />
<br />
{{Pkg|wpa_supplicant}} provides a reference configuration file located at {{ic|/etc/wpa_supplicant/wpa_supplicant.conf}} which contains detailed documentation for the all available options and their utilisation.<br />
<br />
In its simplest form, a configuration file requires only a network block. For example:<br />
<br />
{{hc|/etc/wpa_supplicant/foobar.conf|2=<br />
network={<br />
ssid="..."<br />
}<br />
}}<br />
<br />
This can easily be generated using the {{ic|wpa_passphrase}} tool. For example:<br />
<br />
{{hc|$ wpa_passphrase ''essid'' ''passphrase''|2=<br />
network={<br />
ssid="''essid''"<br />
#psk="''passphrase''"<br />
psk=f5d1c49e15e679bebe385c37648d4141bc5c9297796a8a185d7bc5ac62f954e3<br />
}<br />
}}<br />
<br />
Now both {{ic|wpa_supplicant}} and {{ic|wpa_passphrase}} can be combined to associate with almost all WPA2 (Personal) networks:<br />
<br />
# wpa_supplicant -B -i ''interface'' -c <(wpa_passphrase ''essid'' ''passphrase'')<br />
<br />
All that remains is to simply connect using a [[Network Configuration#Static IP Address|static IP]] or [[Network Configuration#Dynamic IP Address|DHCP]]. For example:<br />
<br />
# dhcpcd -A ''interface''<br />
<br />
== Maintaining a custom configuration ==<br />
<br />
{{Poor writing|This section is planned to be rewritten with a clearer structure and direction and more attention will be given to maintaining networks and controlling them effectively.}}<br />
<br />
{{Note|To discover your network interface name, issue the {{ic|ip link}} command.}}<br />
<br />
As discussed above we can make use of {{ic|wpa_passphrase}} to generate a basic configuration which we can augment with additional networks and options of our choosing. This may be necessary for more advanced networks employing extensive use of [https://en.wikipedia.org/wiki/Extensible_Authentication_Protocol EAP].<br />
<br />
Firstly we will use {{ic|wpa_passphrase}} to create our basic configuration file.<br />
<br />
# wpa_passphrase ''essid'' ''passphrase'' > /etc/wpa_supplicant/foobar.conf<br />
<br />
{{Tip|Some unusually complex passphrases may require input from a file: {{bc|# wpa_passphrase ''essid'' < ''passphrase.txt'' > /etc/wpa_supplicant/foobar.conf}} }}<br />
<br />
Next add a {{ic|ctrl_interface}} so that we may control the {{ic|wpa_supplicant}} daemon. We can allow {{ic|wpa_cli}} to edit this configuration by setting {{ic|1=update_config=1}}.<br />
<br />
{{hc|/etc/wpa_supplicant/foobar.conf|2=<br />
ctrl_interface=DIR=/run/wpa_supplicant GROUP=wheel # allow control for members in the 'wheel' group<br />
update_config=1<br />
<br />
network={<br />
ssid="foobarssid"<br />
psk=f5d1c49e15e679bebe385c37648d4141bc5c9297796a8a185d7bc5ac62f954e3<br />
}<br />
}}<br />
<br />
Multiple network blocks may be appended to this configuration.<br />
<br />
To start your network simply run the following:<br />
<br />
# ip link set ''interface'' up<br />
# wpa_supplicant -B -D nl80211 -i ''interface'' -c /etc/wpa_supplicant/foobar.conf<br />
# dhcpcd -A ''interface''<br />
<br />
{{Note|{{ic|nl80211}} is preferred over the deprecated {{ic|wext}} driver. For a list of supported drivers see the output of {{ic|wpa_supplicant -h}}.}}<br />
<br />
For networks of varying complexity please study the examples provided in the default {{ic|/etc/wpa_supplicant/wpa_supplicant.conf}} file.<br />
<br />
=== Enabling with systemd ===<br />
<br />
In order to enable wireless at boot, enable {{ic|wpa_supplicant}} on your particular wireless interface. To get connectivity with DHCP, enable {{ic|dhcpcd.service}} as well. Finally, to handle possible ethernet connections, install {{ic|ifplugd}} and enable it on your ethernet interface. For instance, the invocations might look like<br />
<br />
# systemctl enable wpa_supplicant@wlp3s1<br />
# systemctl enable dhcpcd<br />
# systemctl enable ifplugd@enp5s2<br />
<br />
WPA Supplicant handles roaming for all the SSIDs in its configuration file, and {{ic|ifplugd}} will configure ethernet and bring down wireless when an ethernet cable is plugged into the machine. {{ic|dhcpcd}} takes care of leasing an IP on all interfaces.<br />
<br />
It is likely that {{ic|wpa_supplicant@.service}} will have to be modified so that it will read the proper configuration file. To override the {{ic|ExecStart&#61;}} line, create the following:<br />
<br />
{{hc|/etc/systemd/system/wpa_supplicant@.service.d/foo.conf|<nowiki><br />
[Service]<br />
ExecStart=<br />
ExecStart=/usr/bin/wpa_supplicant -c/etc/wpa_supplicant/bar.conf -i%i<br />
</nowiki>}}<br />
<br />
The {{ic|1=WantedBy=}} section in the current version is incorrect. If the line in {{ic|wpa_supplicant@.service}} does not match your interface name (wlan0), it will be necessary to copy the service file to {{ic|/etc/systemd/system}} and edit it to reflect<br />
<br />
[Install]<br />
WantedBy=multi-user.target<br />
<br />
The issue is fixed in this [http://hostap.epitest.fi/gitweb/gitweb.cgi?p=hostap.git;a=commitdiff;h=893a0a558cd8fd9a7dc5827f379e0f8a273a4fe5 commit]<br />
<br />
== Related Links ==<br />
<br />
* [http://wireless.kernel.org/en/users/Documentation/wpa_supplicant Kernel.org wpa_supplicant documentation]</div>Holomorphhttps://wiki.archlinux.org/index.php?title=Wpa_supplicant&diff=273104Wpa supplicant2013-08-29T16:29:39Z<p>Holomorph: /* Configuration */ wording</p>
<hr />
<div>[[Category:Wireless Networking]] <br />
[[es:WPA supplicant]]<br />
[[it:WPA supplicant]]<br />
[[ru:WPA Supplicant]]<br />
[[zh-CN:WPA Supplicant]]<br />
{{Article summary start}}<br />
{{Article summary text|Setup and usage of wpa_supplicant}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|Network Configuration}}<br />
{{Article summary wiki|Wireless Setup}}<br />
{{Article summary end}}<br />
<br />
[http://hostap.epitest.fi/wpa_supplicant/ wpa_supplicant] is a cross-platform [[Wikipedia:Supplicant (computer)|WPA Supplicant]] with support for WPA and WPA2 ([https://en.wikipedia.org/wiki/IEEE_802.11i IEEE 802.11i] / RSN (Robust Secure Network)). It is suitable for both desktop/laptop computers and embedded systems. {{ic|wpa_supplicant}} is the IEEE 802.1X/WPA component that is used in the client stations. It implements key negotiation with a WPA Authenticator and it controls the roaming and IEEE 802.11 authentication/association of the wlan driver.<br />
<br />
== Installation ==<br />
<br />
Install {{Pkg|wpa_supplicant}} from the [[official repositories]].<br />
<br />
Optionally {{Pkg|wpa_supplicant_gui}} can be installed which provides {{ic|wpa_gui}}; a graphical frontend for {{ic|wpa_supplicant}} using the {{pkg|qt4}} toolkit.<br />
<br />
== Configuration ==<br />
<br />
{{Pkg|wpa_supplicant}} provides a reference configuration file located at {{ic|/etc/wpa_supplicant/wpa_supplicant.conf}} which contains detailed documentation for the all available options and their utilisation.<br />
<br />
In its simplest form, the configuration file requires only a network block. For example:<br />
<br />
{{hc|/etc/wpa_supplicant/foobar.conf|2=<br />
network={<br />
ssid="..."<br />
}<br />
}}<br />
<br />
This can easily be generated using the {{ic|wpa_passphrase}} tool. For example:<br />
<br />
{{hc|$ wpa_passphrase ''essid'' ''passphrase''|2=<br />
network={<br />
ssid="''essid''"<br />
#psk="''passphrase''"<br />
psk=f5d1c49e15e679bebe385c37648d4141bc5c9297796a8a185d7bc5ac62f954e3<br />
}<br />
}}<br />
<br />
Now both {{ic|wpa_supplicant}} and {{ic|wpa_passphrase}} can be combined to associate with almost all WPA2 (Personal) networks:<br />
<br />
# wpa_supplicant -B -i ''interface'' -c <(wpa_passphrase ''essid'' ''passphrase'')<br />
<br />
All that remains is to simply connect using a [[Network Configuration#Static IP Address|static IP]] or [[Network Configuration#Dynamic IP Address|DHCP]]. For example:<br />
<br />
# dhcpcd -A ''interface''<br />
<br />
== Maintaining a custom configuration ==<br />
<br />
{{Poor writing|This section is planned to be rewritten with a clearer structure and direction and more attention will be given to maintaining networks and controlling them effectively.}}<br />
<br />
{{Note|To discover your network interface name, issue the {{ic|ip link}} command.}}<br />
<br />
As discussed above we can make use of {{ic|wpa_passphrase}} to generate a basic configuration which we can augment with additional networks and options of our choosing. This may be necessary for more advanced networks employing extensive use of [https://en.wikipedia.org/wiki/Extensible_Authentication_Protocol EAP].<br />
<br />
Firstly we will use {{ic|wpa_passphrase}} to create our basic configuration file.<br />
<br />
# wpa_passphrase ''essid'' ''passphrase'' > /etc/wpa_supplicant/foobar.conf<br />
<br />
{{Tip|Some unusually complex passphrases may require input from a file: {{bc|# wpa_passphrase ''essid'' < ''passphrase.txt'' > /etc/wpa_supplicant/foobar.conf}} }}<br />
<br />
Next add a {{ic|ctrl_interface}} so that we may control the {{ic|wpa_supplicant}} daemon. We can allow {{ic|wpa_cli}} to edit this configuration by setting {{ic|1=update_config=1}}.<br />
<br />
{{hc|/etc/wpa_supplicant/foobar.conf|2=<br />
ctrl_interface=DIR=/run/wpa_supplicant GROUP=wheel # allow control for members in the 'wheel' group<br />
update_config=1<br />
<br />
network={<br />
ssid="foobarssid"<br />
psk=f5d1c49e15e679bebe385c37648d4141bc5c9297796a8a185d7bc5ac62f954e3<br />
}<br />
}}<br />
<br />
Multiple network blocks may be appended to this configuration.<br />
<br />
To start your network simply run the following:<br />
<br />
# ip link set ''interface'' up<br />
# wpa_supplicant -B -D nl80211 -i ''interface'' -c /etc/wpa_supplicant/foobar.conf<br />
# dhcpcd -A ''interface''<br />
<br />
{{Note|{{ic|nl80211}} is preferred over the deprecated {{ic|wext}} driver. For a list of supported drivers see the output of {{ic|wpa_supplicant -h}}.}}<br />
<br />
For networks of varying complexity please study the examples provided in the default {{ic|/etc/wpa_supplicant/wpa_supplicant.conf}} file.<br />
<br />
=== Enabling with systemd ===<br />
<br />
In order to enable wireless at boot, enable {{ic|wpa_supplicant}} on your particular wireless interface. To get connectivity with DHCP, enable {{ic|dhcpcd.service}} as well. Finally, to handle possible ethernet connections, install {{ic|ifplugd}} and enable it on your ethernet interface. For instance, the invocations might look like<br />
<br />
# systemctl enable wpa_supplicant@wlp3s1<br />
# systemctl enable dhcpcd<br />
# systemctl enable ifplugd@enp5s2<br />
<br />
WPA Supplicant handles roaming for all the SSIDs in its configuration file, and {{ic|ifplugd}} will configure ethernet and bring down wireless when an ethernet cable is plugged into the machine. {{ic|dhcpcd}} takes care of leasing an IP on all interfaces.<br />
<br />
It is likely that {{ic|wpa_supplicant@.service}} will have to be modified so that it will read the proper configuration file. To override the {{ic|ExecStart&#61;}} line, create the following:<br />
<br />
{{hc|/etc/systemd/system/wpa_supplicant@.service.d/foo.conf|<nowiki><br />
[Service]<br />
ExecStart=<br />
ExecStart=/usr/bin/wpa_supplicant -c/etc/wpa_supplicant/bar.conf -i%i<br />
</nowiki>}}<br />
<br />
The {{ic|1=WantedBy=}} section in the current version is incorrect. If the line in {{ic|wpa_supplicant@.service}} does not match your interface name (wlan0), it will be necessary to copy the service file to {{ic|/etc/systemd/system}} and edit it to reflect<br />
<br />
[Install]<br />
WantedBy=multi-user.target<br />
<br />
The issue is fixed in this [http://hostap.epitest.fi/gitweb/gitweb.cgi?p=hostap.git;a=commitdiff;h=893a0a558cd8fd9a7dc5827f379e0f8a273a4fe5 commit]<br />
<br />
== Related Links ==<br />
<br />
* [http://wireless.kernel.org/en/users/Documentation/wpa_supplicant Kernel.org wpa_supplicant documentation]</div>Holomorphhttps://wiki.archlinux.org/index.php?title=Quvi&diff=270902Quvi2013-08-12T20:24:12Z<p>Holomorph: start a quvi article</p>
<hr />
<div>{{DISPLAYTITLE:quvi}}<br />
<br />
'''quvi''' parses media stream URLs for Internet applications that would<br />
otherwise have to use adobe flash multimedia platform to access the media<br />
streams. The typical examples of this are the different media hosts, such as<br />
YouTube, for videos that use this "multimedia platform" to deliver their<br />
content.<br />
<br />
Source: [http://quvi.sourceforge.net/ project home]<br />
<br />
== Installation ==<br />
Install {{Pkg|quvi}} from [[official repositories|community]].<br />
<br />
== Usage ==<br />
<br />
The simplest way to play a video from a URL is to issue<br />
<br />
$ quvi "<url>" --exec "mplayer %u"<br />
<br />
This can be configured as a default behavior by creating<br />
{{hc|~/.quvirc|2=<br />
exec = "mplayer %u"<br />
}}<br />
<br />
== Related links ==<br />
* [http://quvi.sourceforge.net/ Quvi homepage]<br />
<br />
<!-- vim: set ft=mediawiki: --></div>Holomorphhttps://wiki.archlinux.org/index.php?title=Notmuch&diff=270891Notmuch2013-08-12T17:04:06Z<p>Holomorph: /* alot */ fix aur/wiki links</p>
<hr />
<div>[[Category:Email Client]]<br />
{{Article summary start}}<br />
{{Article summary text|This article explains how to install and configure notmuch.}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|mutt}}<br />
{{Article summary end}}<br />
<br />
[http://notmuchmail.org/ Notmuch] is a mail indexer. Essentially, is a very thin front end on top of [[xapian]].<br />
Much like [[Sup]], it focuses on one thing: indexing your email messages. Notmuch can be used as an email reader, or simply as an indexer and search tool for other MUAs, like [[mutt]].<br />
<br />
==Overview==<br />
Notmuch is written in C and an order of magnitude faster than sup-mail.<br />
Notmuch can be terminated during the indexing process, on the next run it will continue where it left off.<br />
Also like sup-mail, it does not provide a way to permanently delete unwanted email messages.<br />
It doesn't fetch or send mails, nor does it store your email addresses, you'll need to use programs like [[offlineimap]], [[msmtp]] and [[abook]] for those tasks.<br />
<br />
Notmuch is available in the [[Official Repositories]]: {{Pkg|notmuch}} or {{AUR|notmuch-git}} from the [[AUR]]<br />
<br />
It provides [[python]], [[vim]], and [[emacs]] bindings.<br />
<br />
==First time Usage==<br />
After installation, you enter an interactive setup by running:<br />
notmuch setup<br />
The program prompts you for the location of your maildir and your primary and secondary email addresses. You can also edit the config file directly which is created by default at {{ic|$HOME/.notmuch-config}}.<br />
<br />
Subsequent re-indexing of the mail directories is done with:<br />
notmuch new<br />
<br />
==Frontends==<br />
There are [http://notmuchmail.org/frontends/ a range of ways to use notmuch], including cli, or with one of the Unix $EDITORS:<br />
<br />
===Emacs===<br />
The default frontend for notmuch is Emacs. It is developed by the same people that develop notmuch.<br />
<br />
===Vim===<br />
There's a vim interface available and included in notmuch. To start it, type:<br />
vim -c NotMuch<br />
<br />
===alot===<br />
alot is a standalone CLI interface for notmuch, written in python. It is available from [[AUR]] as {{AUR|alot}} or {{AUR|alot-git}}.<br />
<br />
Alot uses [https://en.wikipedia.org/wiki/Mailcap mailcap] for handling different kinds of files. This currently includes html mails, which means that you need to configure a {{Ic|~/.mailcap}} file in order to view html mails. As minimum, put this line into your {{Ic|~/.mailcap}}:<br />
<br />
text/html; w3m -dump %s; nametemplate=%s.html; copiousoutput<br />
<br />
More file handlers can be configured of course.<br />
<br />
===bower===<br />
bower[https://github.com/wangp/bower] is another CLI interface, this one is written in Mercury[http://www.mercury.csse.unimelb.edu.au/].<br />
<br />
===ner===<br />
ner - notmuch email reader [http://the-ner.org/] is yet another CLI interface, apparently written in C++.<br />
<br />
{{AUR|ner-git}} is avaiable from the [[AUR]].<br />
<br />
==Integrating with mutt==<br />
If you use [[mutt]] as your MUA, then notmuch is an excellent complementary tool to index and search your mail. The {{Pkg|notmuch-mutt}} package provides a script to integrate notmuch with mutt.<br />
<br />
Refer to the {{Pkg|notmuch-mutt}} man page for configuration information. This [http://jasonwryan.com/blog/2012/05/23/notmuch/ blogpost] steps through how to setup notmuch with mutt, but the information is a little outdated.</div>Holomorphhttps://wiki.archlinux.org/index.php?title=Wpa_supplicant&diff=270052Wpa supplicant2013-08-06T01:11:21Z<p>Holomorph: not much of a tip, really</p>
<hr />
<div>[[Category:Wireless Networking]] <br />
[[es:WPA supplicant]]<br />
[[it:WPA supplicant]]<br />
[[ru:WPA Supplicant]]<br />
[[zh-CN:WPA Supplicant]]<br />
{{Article summary start}}<br />
{{Article summary text|Setup and usage of wpa_supplicant}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|Network Configuration}}<br />
{{Article summary wiki|Wireless Setup}}<br />
{{Article summary end}}<br />
<br />
[http://hostap.epitest.fi/wpa_supplicant/ wpa_supplicant] is a cross-platform [[Wikipedia:Supplicant (computer)|WPA Supplicant]] with support for WPA and WPA2 ([https://en.wikipedia.org/wiki/IEEE_802.11i IEEE 802.11i] / RSN (Robust Secure Network)). It is suitable for both desktop/laptop computers and embedded systems. {{ic|wpa_supplicant}} is the IEEE 802.1X/WPA component that is used in the client stations. It implements key negotiation with a WPA Authenticator and it controls the roaming and IEEE 802.11 authentication/association of the wlan driver.<br />
<br />
==Installation==<br />
Install {{Pkg|wpa_supplicant}} from the [[official repositories]].<br />
<br />
Optionally {{Pkg|wpa_supplicant_gui}} can be installed which provides {{ic|wpa_gui}}; a graphical frontend for {{ic|wpa_supplicant}} using the {{pkg|qt4}} toolkit.<br />
<br />
==Configuration==<br />
{{pkg|wpa_supplicant}} provides a reference configuration file located at {{ic|/etc/wpa_supplicant/wpa_supplicant.conf}} which contains detailed documentation<br />
for the all available options and their utilisation.<br />
<br />
In it's simplest form all the configuration file requires is a network block, for example:<br />
{{hc|/etc/wpa_supplicant/foobar.conf|2=<br />
network={<br />
ssid="..."<br />
}<br />
}}<br />
<br />
This can easily be generated using the {{ic|wpa_passphrase}} tool. For example:<br />
$ wpa_passphrase foobarssid foobarspassword<br />
network={<br />
ssid="foobarssid"<br />
#psk="foobarspassword"<br />
psk=f5d1c49e15e679bebe385c37648d4141bc5c9297796a8a185d7bc5ac62f954e3<br />
}<br />
<br />
Now both {{ic|wpa_supplicant}} and {{ic|wpa_passphrase}} can be combined to associate with almost all WPA2 (Personal) networks:<br />
# wpa_supplicant -B -i [interface] -c <(wpa_passphrase [essid] [passphrase])<br />
All that remains is to simply connect using a [[Network Configuration#Static_IP_Address|static IP]] or [[Network Configuration#Dynamic_IP_Address|DHCP]]. For example:<br />
# dhcpcd -A [interface]<br />
<br />
===Maintaining a custom configuration===<br />
{{Note|To discover your network interface name, issue the '''ip link''' command.}}<br />
As discussed above we can make use of {{ic|wpa_passphrase}} to generate a basic configuration which we can augment with additional networks and options of our choosing. This may be necessary for more advanced networks employing extensive use of [https://en.wikipedia.org/wiki/Extensible_Authentication_Protocol EAP].<br />
<br />
Firstly we will use {{ic|wpa_passphrase}} to create our basic configuration file.<br />
# wpa_passphrase foobarssid foobarspassword > /etc/wpa_supplicant/foobar.conf<br />
<br />
{{Tip|Some unusually complex passphrases may require input from a file: {{ic|# wpa_passphrase foobarssid < passphrase.txt > /etc/wpa_supplicant/foobar.conf}} }}<br />
<br />
Next add a {{ic|ctrl_interface}} so that we may control the {{ic|wpa_supplicant}} daemon. We can allow {{ic|wpa_cli}} to edit this configuration by setting {{ic|1=update_config=1}}. We will also allow {{ic|wpa_supplicant}} to initiate AP (Access Point) scanning and selection with {{ic|1=ap_scan=1}}.<br />
{{hc|/etc/wpa_supplicant/foobar.conf|<nowiki><br />
ctrl_interface=DIR=/run/wpa_supplicant GROUP=wheel # allow control for members in the 'wheel' group<br />
update_config=1<br />
ap_scan=1<br />
<br />
network={<br />
ssid="foobarssid"<br />
psk=f5d1c49e15e679bebe385c37648d4141bc5c9297796a8a185d7bc5ac62f954e3<br />
}<br />
</nowiki>}}<br />
<br />
Multiple network blocks may be appended to this configuration.<br />
<br />
To start your network simply run the following:<br />
# ip link set [interface] up<br />
# wpa_supplicant -B -D nl80211 -i [interface] -c /etc/wpa_supplicant/foobar.conf<br />
# dhcpcd -A [interface]<br />
{{note|{{ic|nl80211}} is preferred over the deprecated {{ic|wext}} driver. For a list of supported drivers simply run {{ic|wpa_supplicant}} without an argument.}}<br />
For networks of varying complexity please study the examples provided in the default {{ic|/etc/wpa_supplicant/wpa_supplicant.conf}} file.<br />
<br />
===Enabling with systemd===<br />
<br />
In order to enable wireless at boot, enable {{ic|wpa_supplicant}} on your particular wireless interface. To get connectivity with DHCP, enable {{ic|dhcpcd.service}} as well. Finally, to handle possible ethernet connections, install {{ic|ifplugd}} and enable it on your ethernet interface. For instance, the invocations might look like<br />
# systemctl enable wpa_supplicant@wlp3s1<br />
# systemctl enable dhcpcd<br />
# systemctl enable ifplugd@enp5s2<br />
<br />
WPA Supplicant handles roaming for all the SSIDs in its configuration file, and {{ic|ifplugd}} will configure ethernet and bring down wireless when an ethernet cable is plugged into the machine. {{ic|dhcpcd}} takes care of leasing an IP on all interfaces.<br />
<br />
It is likely that {{ic|wpa_supplicant@.service}} will have to be modified so that it will read the proper configuration file. To override the {{ic|ExecStart&#61;}} line, create the following:<br />
<br />
{{hc|/etc/systemd/system/wpa_supplicant@.service.d/foo.conf|<nowiki><br />
[Service]<br />
ExecStart=<br />
ExecStart=/usr/bin/wpa_supplicant -c/etc/wpa_supplicant/bar.conf -i%i<br />
</nowiki>}}<br />
<br />
The {{ic|WantedBy&#61;}} section in the current version is incorrect. If the line in {{ic|wpa_supplicant@.service}} does not match your interface name (wlan0), it will be necessary to copy the service file to {{ic|/etc/systemd/system}} and edit it to reflect<br />
[Install]<br />
WantedBy=multi-user.target<br />
<br />
The issue is fixed in this [http://hostap.epitest.fi/gitweb/gitweb.cgi?p=hostap.git;a=commitdiff;h=893a0a558cd8fd9a7dc5827f379e0f8a273a4fe5 commit]<br />
<br />
==Related Links==<br />
*[http://wireless.kernel.org/en/users/Documentation/wpa_supplicant Kernel.org wpa_supplicant documentation]</div>Holomorphhttps://wiki.archlinux.org/index.php?title=Wpa_supplicant&diff=270025Wpa supplicant2013-08-05T19:32:46Z<p>Holomorph: /* Enabling with systemd */ reference the issue of wpa_supplicant's service files</p>
<hr />
<div>[[Category:Wireless Networking]] <br />
[[es:WPA supplicant]]<br />
[[it:WPA supplicant]]<br />
[[ru:WPA Supplicant]]<br />
[[zh-CN:WPA Supplicant]]<br />
{{Article summary start}}<br />
{{Article summary text|Setup and usage of wpa_supplicant}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|Network Configuration}}<br />
{{Article summary wiki|Wireless Setup}}<br />
{{Article summary end}}<br />
<br />
[http://hostap.epitest.fi/wpa_supplicant/ wpa_supplicant] is a cross-platform [[Wikipedia:Supplicant (computer)|WPA Supplicant]] with support for WPA and WPA2 ([https://en.wikipedia.org/wiki/IEEE_802.11i IEEE 802.11i] / RSN (Robust Secure Network)). It is suitable for both desktop/laptop computers and embedded systems. {{ic|wpa_supplicant}} is the IEEE 802.1X/WPA component that is used in the client stations. It implements key negotiation with a WPA Authenticator and it controls the roaming and IEEE 802.11 authentication/association of the wlan driver.<br />
<br />
==Installation==<br />
Install {{Pkg|wpa_supplicant}} from the [[official repositories]].<br />
<br />
Optionally {{Pkg|wpa_supplicant_gui}} can be installed which provides {{ic|wpa_gui}}; a graphical frontend for {{ic|wpa_supplicant}} using the {{pkg|qt4}} toolkit.<br />
<br />
==Configuration==<br />
{{pkg|wpa_supplicant}} provides a reference configuration file located at {{ic|/etc/wpa_supplicant/wpa_supplicant.conf}} which contains detailed documentation<br />
for the all available options and their utilisation.<br />
<br />
In it's simplest form all the configuration file requires is a network block, for example:<br />
{{hc|/etc/wpa_supplicant/foobar.conf|2=<br />
network={<br />
ssid="..."<br />
}<br />
}}<br />
<br />
This can easily be generated using the {{ic|wpa_passphrase}} tool. For example:<br />
$ wpa_passphrase foobarssid foobarspassword<br />
network={<br />
ssid="foobarssid"<br />
#psk="foobarspassword"<br />
psk=f5d1c49e15e679bebe385c37648d4141bc5c9297796a8a185d7bc5ac62f954e3<br />
}<br />
<br />
Now both {{ic|wpa_supplicant}} and {{ic|wpa_passphrase}} can be combined to associate with almost all WPA2 (Personal) networks:<br />
# wpa_supplicant -B -i [interface] -c <(wpa_passphrase [essid] [passphrase])<br />
All that remains is to simply connect using a [[Network Configuration#Static_IP_Address|static IP]] or [[Network Configuration#Dynamic_IP_Address|DHCP]]. For example:<br />
# dhcpcd -A [interface]<br />
<br />
===Maintaining a custom configuration===<br />
{{Note|To discover your network interface name, issue the '''ip link''' command.}}<br />
<br />
{{Note|Be advised that the recommended method for connection is using [[Netctl]] and is certainly better in the long term.}}<br />
As discussed above we can make use of {{ic|wpa_passphrase}} to generate a basic configuration which we can augment with additional networks and options of our choosing. This may be necessary for more advanced networks employing extensive use of [https://en.wikipedia.org/wiki/Extensible_Authentication_Protocol EAP].<br />
<br />
Firstly we will use {{ic|wpa_passphrase}} to create our basic configuration file.<br />
# wpa_passphrase foobarssid foobarspassword > /etc/wpa_supplicant/foobar.conf<br />
<br />
{{Tip|Some unusually complex passphrases may require input from a file: {{ic|# wpa_passphrase foobarssid < passphrase.txt > /etc/wpa_supplicant/foobar.conf}} }}<br />
<br />
Next add a {{ic|ctrl_interface}} so that we may control the {{ic|wpa_supplicant}} daemon. We can allow {{ic|wpa_cli}} to edit this configuration by setting {{ic|1=update_config=1}}. We will also allow {{ic|wpa_supplicant}} to initiate AP (Access Point) scanning and selection with {{ic|1=ap_scan=1}}.<br />
{{hc|/etc/wpa_supplicant/foobar.conf|<nowiki><br />
ctrl_interface=DIR=/run/wpa_supplicant GROUP=wheel # allow control for members in the 'wheel' group<br />
update_config=1<br />
ap_scan=1<br />
<br />
network={<br />
ssid="foobarssid"<br />
psk=f5d1c49e15e679bebe385c37648d4141bc5c9297796a8a185d7bc5ac62f954e3<br />
}<br />
</nowiki>}}<br />
<br />
Multiple network blocks may be appended to this configuration.<br />
<br />
To start your network simply run the following:<br />
# ip link set [interface] up<br />
# wpa_supplicant -B -D nl80211 -i [interface] -c /etc/wpa_supplicant/foobar.conf<br />
# dhcpcd -A [interface]<br />
{{note|{{ic|nl80211}} is preferred over the deprecated {{ic|wext}} driver. For a list of supported drivers simply run {{ic|wpa_supplicant}} without an argument.}}<br />
For networks of varying complexity please study the examples provided in the default {{ic|/etc/wpa_supplicant/wpa_supplicant.conf}} file.<br />
<br />
===Enabling with systemd===<br />
<br />
In order to enable wireless at boot, enable {{ic|wpa_supplicant}} on your particular wireless interface. To get connectivity with DHCP, enable {{ic|dhcpcd.service}} as well. Finally, to handle possible ethernet connections, install {{ic|ifplugd}} and enable it on your ethernet interface. For instance, the invocations might look like<br />
# systemctl enable wpa_supplicant@wlp3s1<br />
# systemctl enable dhcpcd<br />
# systemctl enable ifplugd@enp5s2<br />
<br />
WPA Supplicant handles roaming for all the SSIDs in its configuration file, and {{ic|ifplugd}} will configure ethernet and bring down wireless when an ethernet cable is plugged into the machine. {{ic|dhcpcd}} takes care of leasing an IP on all interfaces.<br />
<br />
It is likely that {{ic|wpa_supplicant@.service}} will have to be modified so that it will read the proper configuration file. To override the {{ic|ExecStart&#61;}} line, create the following:<br />
<br />
{{hc|/etc/systemd/system/wpa_supplicant@.service.d/foo.conf|<nowiki><br />
[Service]<br />
ExecStart=<br />
ExecStart=/usr/bin/wpa_supplicant -c/etc/wpa_supplicant/bar.conf -i%i<br />
</nowiki>}}<br />
<br />
The {{ic|WantedBy&#61;}} section in the current version is incorrect. If the line in {{ic|wpa_supplicant@.service}} does not match your interface name (wlan0), it will be necessary to copy the service file to {{ic|/etc/systemd/system}} and edit it to reflect<br />
[Install]<br />
WantedBy=multi-user.target<br />
<br />
The issue is fixed in this [http://hostap.epitest.fi/gitweb/gitweb.cgi?p=hostap.git;a=commitdiff;h=893a0a558cd8fd9a7dc5827f379e0f8a273a4fe5 commit]<br />
<br />
==Related Links==<br />
*[http://wireless.kernel.org/en/users/Documentation/wpa_supplicant Kernel.org wpa_supplicant documentation]</div>Holomorphhttps://wiki.archlinux.org/index.php?title=Wpa_supplicant&diff=267635Wpa supplicant2013-07-23T03:40:32Z<p>Holomorph: unneccessary</p>
<hr />
<div>[[Category:Wireless Networking]] <br />
[[es:WPA supplicant]]<br />
[[it:WPA supplicant]]<br />
[[ru:WPA Supplicant]]<br />
[[zh-CN:WPA Supplicant]]<br />
{{Article summary start}}<br />
{{Article summary text|Setup and usage of wpa_supplicant}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|Network Configuration}}<br />
{{Article summary wiki|Wireless Setup}}<br />
{{Article summary end}}<br />
<br />
[http://hostap.epitest.fi/wpa_supplicant/ wpa_supplicant] is a cross-platform [[Wikipedia:Supplicant (computer)|WPA Supplicant]] with support for WPA and WPA2 ([https://en.wikipedia.org/wiki/IEEE_802.11i IEEE 802.11i] / RSN (Robust Secure Network)). It is suitable for both desktop/laptop computers and embedded systems. {{ic|wpa_supplicant}} is the IEEE 802.1X/WPA component that is used in the client stations. It implements key negotiation with a WPA Authenticator and it controls the roaming and IEEE 802.11 authentication/association of the wlan driver.<br />
<br />
==Installation==<br />
Install {{Pkg|wpa_supplicant}} from the [[official repositories]].<br />
<br />
Optionally {{Pkg|wpa_supplicant_gui}} can be installed which provides {{ic|wpa_gui}}; a graphical frontend for {{ic|wpa_supplicant}} using the {{pkg|qt4}} toolkit.<br />
<br />
==Configuration==<br />
{{pkg|wpa_supplicant}} provides a reference configuration file located at {{ic|/etc/wpa_supplicant/wpa_supplicant.conf}} which contains detailed documentation<br />
for the all available options and their utilisation.<br />
<br />
In it's simplest form all the configuration file requires is a network block, for example:<br />
{{hc|/etc/wpa_supplicant/foobar.conf|2=<br />
network={<br />
ssid="..."<br />
}<br />
}}<br />
<br />
This can easily be generated using the {{ic|wpa_passphrase}} tool. For example:<br />
$ wpa_passphrase foobarssid foobarspassword<br />
network={<br />
ssid="foobarssid"<br />
#psk="foobarspassword"<br />
psk=f5d1c49e15e679bebe385c37648d4141bc5c9297796a8a185d7bc5ac62f954e3<br />
}<br />
<br />
Now both {{ic|wpa_supplicant}} and {{ic|wpa_passphrase}} can be combined to associate with almost all WPA2 (Personal) networks:<br />
# wpa_supplicant -B -i [interface] -c <(wpa_passphrase [essid] [passphrase])<br />
All that remains is to simply connect using a [[Network Configuration#Static_IP_Address|static IP]] or [[Network Configuration#Dynamic_IP_Address|DHCP]]. For example:<br />
# dhcpcd -A [interface]<br />
<br />
===Maintaining a custom configuration===<br />
{{Note|To discover your network interface name, issue the '''ip link''' command.}}<br />
<br />
{{Note|Be advised that the recommended method for connection is using [[Netctl]] and is certainly better in the long term.}}<br />
As discussed above we can make use of {{ic|wpa_passphrase}} to generate a basic configuration which we can augment with additional networks and options of our choosing. This may be necessary for more advanced networks employing extensive use of [https://en.wikipedia.org/wiki/Extensible_Authentication_Protocol EAP].<br />
<br />
Firstly we will use {{ic|wpa_passphrase}} to create our basic configuration file.<br />
# wpa_passphrase foobarssid foobarspassword > /etc/wpa_supplicant/foobar.conf<br />
<br />
{{Tip|Some unusually complex passphrases may require input from a file: {{ic|# wpa_passphrase foobarssid < passphrase.txt > /etc/wpa_supplicant/foobar.conf}} }}<br />
<br />
Next add a {{ic|ctrl_interface}} so that we may control the {{ic|wpa_supplicant}} daemon. We can allow {{ic|wpa_cli}} to edit this configuration by setting {{ic|1=update_config=1}}. We will also allow {{ic|wpa_supplicant}} to initiate AP (Access Point) scanning and selection with {{ic|1=ap_scan=1}}.<br />
{{hc|/etc/wpa_supplicant/foobar.conf|<nowiki><br />
ctrl_interface=DIR=/run/wpa_supplicant GROUP=wheel # allow control for members in the 'wheel' group<br />
update_config=1<br />
ap_scan=1<br />
<br />
network={<br />
ssid="foobarssid"<br />
psk=f5d1c49e15e679bebe385c37648d4141bc5c9297796a8a185d7bc5ac62f954e3<br />
}<br />
</nowiki>}}<br />
<br />
Multiple network blocks may be appended to this configuration.<br />
<br />
To start your network simply run the following:<br />
# ip link set [interface] up<br />
# wpa_supplicant -B -D nl80211 -i [interface] -c /etc/wpa_supplicant/foobar.conf<br />
# dhcpcd -A [interface]<br />
{{note|{{ic|nl80211}} is preferred over the deprecated {{ic|wext}} driver. For a list of supported drivers simply run {{ic|wpa_supplicant}} without an argument.}}<br />
For networks of varying complexity please study the examples provided in the default {{ic|/etc/wpa_supplicant/wpa_supplicant.conf}} file.<br />
<br />
===Enabling with systemd===<br />
<br />
In order to enable wireless at boot, enable {{ic|wpa_supplicant}} on your particular wireless interface. To get connectivity with DHCP, enable {{ic|dhcpcd.service}} as well. Finally, to handle possible ethernet connections, install {{ic|ifplugd}} and enable it on your ethernet interface. For instance, the invocations might look like<br />
# systemctl enable wpa_supplicant@wlp3s1<br />
# systemctl enable dhcpcd<br />
# systemctl enable ifplugd@enp5s2<br />
<br />
WPA Supplicant handles roaming for all the SSIDs in its configuration file, and {{ic|ifplugd}} will configure ethernet and bring down wireless when an ethernet cable is plugged into the machine. {{ic|dhcpcd}} takes care of leasing an IP on all interfaces.<br />
<br />
It is likely that {{ic|wpa_supplicant@.service}} will have to be modified so that it will read the proper configuration file. To override the {{ic|ExecStart&#61;}} line, create the following:<br />
<br />
{{hc|/etc/systemd/system/wpa_supplicant@.service.d/foo.conf|<nowiki><br />
[Service]<br />
ExecStart=<br />
ExecStart=/usr/bin/wpa_supplicant -c/etc/wpa_supplicant/bar.conf -i%i<br />
<br />
[Install]<br />
WantedBy=multi-user.target<br />
</nowiki>}}<br />
<br />
The {{ic|WantedBy&#61;}} override is necessary if the line in {{ic|wpa_supplicant@.service}} does not match your interface name.<br />
<br />
==Related Links==<br />
*[http://wireless.kernel.org/en/users/Documentation/wpa_supplicant Kernel.org wpa_supplicant documentation]</div>Holomorphhttps://wiki.archlinux.org/index.php?title=Wpa_supplicant&diff=267634Wpa supplicant2013-07-23T03:38:50Z<p>Holomorph: /* Enabling with systemd */ wpa_supplicant service override</p>
<hr />
<div>[[Category:Wireless Networking]] <br />
[[es:WPA supplicant]]<br />
[[it:WPA supplicant]]<br />
[[ru:WPA Supplicant]]<br />
[[zh-CN:WPA Supplicant]]<br />
{{Article summary start}}<br />
{{Article summary text|Setup and usage of wpa_supplicant}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|Network Configuration}}<br />
{{Article summary wiki|Wireless Setup}}<br />
{{Article summary end}}<br />
<br />
[http://hostap.epitest.fi/wpa_supplicant/ wpa_supplicant] is a cross-platform [[Wikipedia:Supplicant (computer)|WPA Supplicant]] with support for WPA and WPA2 ([https://en.wikipedia.org/wiki/IEEE_802.11i IEEE 802.11i] / RSN (Robust Secure Network)). It is suitable for both desktop/laptop computers and embedded systems. {{ic|wpa_supplicant}} is the IEEE 802.1X/WPA component that is used in the client stations. It implements key negotiation with a WPA Authenticator and it controls the roaming and IEEE 802.11 authentication/association of the wlan driver.<br />
<br />
==Installation==<br />
Install {{Pkg|wpa_supplicant}} from the [[official repositories]].<br />
<br />
Optionally {{Pkg|wpa_supplicant_gui}} can be installed which provides {{ic|wpa_gui}}; a graphical frontend for {{ic|wpa_supplicant}} using the {{pkg|qt4}} toolkit.<br />
<br />
==Configuration==<br />
{{pkg|wpa_supplicant}} provides a reference configuration file located at {{ic|/etc/wpa_supplicant/wpa_supplicant.conf}} which contains detailed documentation<br />
for the all available options and their utilisation.<br />
<br />
In it's simplest form all the configuration file requires is a network block, for example:<br />
{{hc|/etc/wpa_supplicant/foobar.conf|2=<br />
network={<br />
ssid="..."<br />
}<br />
}}<br />
<br />
This can easily be generated using the {{ic|wpa_passphrase}} tool. For example:<br />
$ wpa_passphrase foobarssid foobarspassword<br />
network={<br />
ssid="foobarssid"<br />
#psk="foobarspassword"<br />
psk=f5d1c49e15e679bebe385c37648d4141bc5c9297796a8a185d7bc5ac62f954e3<br />
}<br />
<br />
Now both {{ic|wpa_supplicant}} and {{ic|wpa_passphrase}} can be combined to associate with almost all WPA2 (Personal) networks:<br />
# wpa_supplicant -B -i [interface] -c <(wpa_passphrase [essid] [passphrase])<br />
All that remains is to simply connect using a [[Network Configuration#Static_IP_Address|static IP]] or [[Network Configuration#Dynamic_IP_Address|DHCP]]. For example:<br />
# dhcpcd -A [interface]<br />
<br />
===Maintaining a custom configuration===<br />
{{Note|To discover your network interface name, issue the '''ip link''' command.}}<br />
<br />
{{Note|Be advised that the recommended method for connection is using [[Netctl]] and is certainly better in the long term.}}<br />
As discussed above we can make use of {{ic|wpa_passphrase}} to generate a basic configuration which we can augment with additional networks and options of our choosing. This may be necessary for more advanced networks employing extensive use of [https://en.wikipedia.org/wiki/Extensible_Authentication_Protocol EAP].<br />
<br />
Firstly we will use {{ic|wpa_passphrase}} to create our basic configuration file.<br />
# wpa_passphrase foobarssid foobarspassword > /etc/wpa_supplicant/foobar.conf<br />
<br />
{{Tip|Some unusually complex passphrases may require input from a file: {{ic|# wpa_passphrase foobarssid < passphrase.txt > /etc/wpa_supplicant/foobar.conf}} }}<br />
<br />
Next add a {{ic|ctrl_interface}} so that we may control the {{ic|wpa_supplicant}} daemon. We can allow {{ic|wpa_cli}} to edit this configuration by setting {{ic|1=update_config=1}}. We will also allow {{ic|wpa_supplicant}} to initiate AP (Access Point) scanning and selection with {{ic|1=ap_scan=1}}.<br />
{{hc|/etc/wpa_supplicant/foobar.conf|<nowiki><br />
ctrl_interface=DIR=/run/wpa_supplicant GROUP=wheel # allow control for members in the 'wheel' group<br />
update_config=1<br />
ap_scan=1<br />
<br />
network={<br />
ssid="foobarssid"<br />
psk=f5d1c49e15e679bebe385c37648d4141bc5c9297796a8a185d7bc5ac62f954e3<br />
}<br />
</nowiki>}}<br />
<br />
Multiple network blocks may be appended to this configuration.<br />
<br />
To start your network simply run the following:<br />
# ip link set [interface] up<br />
# wpa_supplicant -B -D nl80211 -i [interface] -c /etc/wpa_supplicant/foobar.conf<br />
# dhcpcd -A [interface]<br />
{{note|{{ic|nl80211}} is preferred over the deprecated {{ic|wext}} driver. For a list of supported drivers simply run {{ic|wpa_supplicant}} without an argument.}}<br />
For networks of varying complexity please study the examples provided in the default {{ic|/etc/wpa_supplicant/wpa_supplicant.conf}} file.<br />
<br />
===Enabling with systemd===<br />
<br />
In order to enable wireless at boot, enable {{ic|wpa_supplicant}} on your particular wireless interface. To get connectivity with DHCP, enable {{ic|dhcpcd.service}} as well. Finally, to handle possible ethernet connections, install {{ic|ifplugd}} and enable it on your ethernet interface. For instance, the invocations might look like<br />
# systemctl enable wpa_supplicant@wlp3s1<br />
# systemctl enable dhcpcd<br />
# systemctl enable ifplugd@enp5s2<br />
<br />
WPA Supplicant handles roaming for all the SSIDs in its configuration file, and {{ic|ifplugd}} will configure ethernet and bring down wireless when an ethernet cable is plugged into the machine. {{ic|dhcpcd}} takes care of leasing an IP on all interfaces.<br />
<br />
It is likely that {{ic|wpa_supplicant@.service}} will have to be modified so that it will read the proper configuration file. To override the {{ic|ExecStart&#61;}} line, create the following:<br />
<br />
{{hc|/etc/systemd/system/wpa_supplicant@.service.d/foo.conf|<nowiki><br />
[Service]<br />
ExecStart=<br />
ExecStart=/usr/bin/wpa_supplicant -c/etc/wpa_supplicant/bar.conf -i%i<br />
<br />
[Install]<br />
WantedBy=multi-user.target<br />
</nowiki>}}<br />
<br />
The {{ic|WantedBy&#61;}} override is necessary if the line in {{ic|/usr/lib/systemd/system/wpa_supplicant@.service}} does not match your interface name.<br />
<br />
==Related Links==<br />
*[http://wireless.kernel.org/en/users/Documentation/wpa_supplicant Kernel.org wpa_supplicant documentation]</div>Holomorphhttps://wiki.archlinux.org/index.php?title=Wpa_supplicant&diff=267630Wpa supplicant2013-07-23T02:41:10Z<p>Holomorph: /* Enabling with systemd */ redundancy</p>
<hr />
<div>[[Category:Wireless Networking]] <br />
[[es:WPA supplicant]]<br />
[[it:WPA supplicant]]<br />
[[ru:WPA Supplicant]]<br />
[[zh-CN:WPA Supplicant]]<br />
{{Article summary start}}<br />
{{Article summary text|Setup and usage of wpa_supplicant}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|Network Configuration}}<br />
{{Article summary wiki|Wireless Setup}}<br />
{{Article summary end}}<br />
<br />
[http://hostap.epitest.fi/wpa_supplicant/ wpa_supplicant] is a cross-platform [[Wikipedia:Supplicant (computer)|WPA Supplicant]] with support for WPA and WPA2 ([https://en.wikipedia.org/wiki/IEEE_802.11i IEEE 802.11i] / RSN (Robust Secure Network)). It is suitable for both desktop/laptop computers and embedded systems. {{ic|wpa_supplicant}} is the IEEE 802.1X/WPA component that is used in the client stations. It implements key negotiation with a WPA Authenticator and it controls the roaming and IEEE 802.11 authentication/association of the wlan driver.<br />
<br />
==Installation==<br />
Install {{Pkg|wpa_supplicant}} from the [[official repositories]].<br />
<br />
Optionally {{Pkg|wpa_supplicant_gui}} can be installed which provides {{ic|wpa_gui}}; a graphical frontend for {{ic|wpa_supplicant}} using the {{pkg|qt4}} toolkit.<br />
<br />
==Configuration==<br />
{{pkg|wpa_supplicant}} provides a reference configuration file located at {{ic|/etc/wpa_supplicant/wpa_supplicant.conf}} which contains detailed documentation<br />
for the all available options and their utilisation.<br />
<br />
In it's simplest form all the configuration file requires is a network block, for example:<br />
{{hc|/etc/wpa_supplicant/foobar.conf|2=<br />
network={<br />
ssid="..."<br />
}<br />
}}<br />
<br />
This can easily be generated using the {{ic|wpa_passphrase}} tool. For example:<br />
$ wpa_passphrase foobarssid foobarspassword<br />
network={<br />
ssid="foobarssid"<br />
#psk="foobarspassword"<br />
psk=f5d1c49e15e679bebe385c37648d4141bc5c9297796a8a185d7bc5ac62f954e3<br />
}<br />
<br />
Now both {{ic|wpa_supplicant}} and {{ic|wpa_passphrase}} can be combined to associate with almost all WPA2 (Personal) networks:<br />
# wpa_supplicant -B -i [interface] -c <(wpa_passphrase [essid] [passphrase])<br />
All that remains is to simply connect using a [[Network Configuration#Static_IP_Address|static IP]] or [[Network Configuration#Dynamic_IP_Address|DHCP]]. For example:<br />
# dhcpcd -A [interface]<br />
<br />
===Maintaining a custom configuration===<br />
{{Note|To discover your network interface name, issue the '''ip link''' command.}}<br />
<br />
{{Note|Be advised that the recommended method for connection is using [[Netctl]] and is certainly better in the long term.}}<br />
As discussed above we can make use of {{ic|wpa_passphrase}} to generate a basic configuration which we can augment with additional networks and options of our choosing. This may be necessary for more advanced networks employing extensive use of [https://en.wikipedia.org/wiki/Extensible_Authentication_Protocol EAP].<br />
<br />
Firstly we will use {{ic|wpa_passphrase}} to create our basic configuration file.<br />
# wpa_passphrase foobarssid foobarspassword > /etc/wpa_supplicant/foobar.conf<br />
<br />
{{Tip|Some unusually complex passphrases may require input from a file: {{ic|# wpa_passphrase foobarssid < passphrase.txt > /etc/wpa_supplicant/foobar.conf}} }}<br />
<br />
Next add a {{ic|ctrl_interface}} so that we may control the {{ic|wpa_supplicant}} daemon. We can allow {{ic|wpa_cli}} to edit this configuration by setting {{ic|1=update_config=1}}. We will also allow {{ic|wpa_supplicant}} to initiate AP (Access Point) scanning and selection with {{ic|1=ap_scan=1}}.<br />
{{hc|/etc/wpa_supplicant/foobar.conf|<nowiki><br />
ctrl_interface=DIR=/run/wpa_supplicant GROUP=wheel # allow control for members in the 'wheel' group<br />
update_config=1<br />
ap_scan=1<br />
<br />
network={<br />
ssid="foobarssid"<br />
psk=f5d1c49e15e679bebe385c37648d4141bc5c9297796a8a185d7bc5ac62f954e3<br />
}<br />
</nowiki>}}<br />
<br />
Multiple network blocks may be appended to this configuration.<br />
<br />
To start your network simply run the following:<br />
# ip link set [interface] up<br />
# wpa_supplicant -B -D nl80211 -i [interface] -c /etc/wpa_supplicant/foobar.conf<br />
# dhcpcd -A [interface]<br />
{{note|{{ic|nl80211}} is preferred over the deprecated {{ic|wext}} driver. For a list of supported drivers simply run {{ic|wpa_supplicant}} without an argument.}}<br />
For networks of varying complexity please study the examples provided in the default {{ic|/etc/wpa_supplicant/wpa_supplicant.conf}} file.<br />
<br />
===Enabling with systemd===<br />
<br />
In order to take enable wireless at boot, enable {{ic|wpa_supplicant}} on your particular wireless interface. To get connectivity with DHCP, enable {{ic|dhcpcd.service}} as well. Finally, to handle possible ethernet connections, install {{ic|ifplugd}} and enable it on your ethernet interface. For instance, the invocations might look like<br />
# systemctl enable wpa_supplicant@wlp3s1<br />
# systemctl enable dhcpcd<br />
# systemctl enable ifplugd@enp5s2<br />
<br />
WPA Supplicant handles roaming for all the SSIDs in its configuration file, and {{ic|ifplugd}} will configure ethernet and bring down wireless when an ethernet cable is plugged into the machine. {{ic|dhcpcd}} takes care of leasing an IP on all interfaces.<br />
<br />
==Related Links==<br />
*[http://wireless.kernel.org/en/users/Documentation/wpa_supplicant Kernel.org wpa_supplicant documentation]</div>Holomorphhttps://wiki.archlinux.org/index.php?title=Wpa_supplicant&diff=267629Wpa supplicant2013-07-23T02:38:34Z<p>Holomorph: add systemd info</p>
<hr />
<div>[[Category:Wireless Networking]] <br />
[[es:WPA supplicant]]<br />
[[it:WPA supplicant]]<br />
[[ru:WPA Supplicant]]<br />
[[zh-CN:WPA Supplicant]]<br />
{{Article summary start}}<br />
{{Article summary text|Setup and usage of wpa_supplicant}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|Network Configuration}}<br />
{{Article summary wiki|Wireless Setup}}<br />
{{Article summary end}}<br />
<br />
[http://hostap.epitest.fi/wpa_supplicant/ wpa_supplicant] is a cross-platform [[Wikipedia:Supplicant (computer)|WPA Supplicant]] with support for WPA and WPA2 ([https://en.wikipedia.org/wiki/IEEE_802.11i IEEE 802.11i] / RSN (Robust Secure Network)). It is suitable for both desktop/laptop computers and embedded systems. {{ic|wpa_supplicant}} is the IEEE 802.1X/WPA component that is used in the client stations. It implements key negotiation with a WPA Authenticator and it controls the roaming and IEEE 802.11 authentication/association of the wlan driver.<br />
<br />
==Installation==<br />
Install {{Pkg|wpa_supplicant}} from the [[official repositories]].<br />
<br />
Optionally {{Pkg|wpa_supplicant_gui}} can be installed which provides {{ic|wpa_gui}}; a graphical frontend for {{ic|wpa_supplicant}} using the {{pkg|qt4}} toolkit.<br />
<br />
==Configuration==<br />
{{pkg|wpa_supplicant}} provides a reference configuration file located at {{ic|/etc/wpa_supplicant/wpa_supplicant.conf}} which contains detailed documentation<br />
for the all available options and their utilisation.<br />
<br />
In it's simplest form all the configuration file requires is a network block, for example:<br />
{{hc|/etc/wpa_supplicant/foobar.conf|2=<br />
network={<br />
ssid="..."<br />
}<br />
}}<br />
<br />
This can easily be generated using the {{ic|wpa_passphrase}} tool. For example:<br />
$ wpa_passphrase foobarssid foobarspassword<br />
network={<br />
ssid="foobarssid"<br />
#psk="foobarspassword"<br />
psk=f5d1c49e15e679bebe385c37648d4141bc5c9297796a8a185d7bc5ac62f954e3<br />
}<br />
<br />
Now both {{ic|wpa_supplicant}} and {{ic|wpa_passphrase}} can be combined to associate with almost all WPA2 (Personal) networks:<br />
# wpa_supplicant -B -i [interface] -c <(wpa_passphrase [essid] [passphrase])<br />
All that remains is to simply connect using a [[Network Configuration#Static_IP_Address|static IP]] or [[Network Configuration#Dynamic_IP_Address|DHCP]]. For example:<br />
# dhcpcd -A [interface]<br />
<br />
===Maintaining a custom configuration===<br />
{{Note|To discover your network interface name, issue the '''ip link''' command.}}<br />
<br />
{{Note|Be advised that the recommended method for connection is using [[Netctl]] and is certainly better in the long term.}}<br />
As discussed above we can make use of {{ic|wpa_passphrase}} to generate a basic configuration which we can augment with additional networks and options of our choosing. This may be necessary for more advanced networks employing extensive use of [https://en.wikipedia.org/wiki/Extensible_Authentication_Protocol EAP].<br />
<br />
Firstly we will use {{ic|wpa_passphrase}} to create our basic configuration file.<br />
# wpa_passphrase foobarssid foobarspassword > /etc/wpa_supplicant/foobar.conf<br />
<br />
{{Tip|Some unusually complex passphrases may require input from a file: {{ic|# wpa_passphrase foobarssid < passphrase.txt > /etc/wpa_supplicant/foobar.conf}} }}<br />
<br />
Next add a {{ic|ctrl_interface}} so that we may control the {{ic|wpa_supplicant}} daemon. We can allow {{ic|wpa_cli}} to edit this configuration by setting {{ic|1=update_config=1}}. We will also allow {{ic|wpa_supplicant}} to initiate AP (Access Point) scanning and selection with {{ic|1=ap_scan=1}}.<br />
{{hc|/etc/wpa_supplicant/foobar.conf|<nowiki><br />
ctrl_interface=DIR=/run/wpa_supplicant GROUP=wheel # allow control for members in the 'wheel' group<br />
update_config=1<br />
ap_scan=1<br />
<br />
network={<br />
ssid="foobarssid"<br />
psk=f5d1c49e15e679bebe385c37648d4141bc5c9297796a8a185d7bc5ac62f954e3<br />
}<br />
</nowiki>}}<br />
<br />
Multiple network blocks may be appended to this configuration.<br />
<br />
To start your network simply run the following:<br />
# ip link set [interface] up<br />
# wpa_supplicant -B -D nl80211 -i [interface] -c /etc/wpa_supplicant/foobar.conf<br />
# dhcpcd -A [interface]<br />
{{note|{{ic|nl80211}} is preferred over the deprecated {{ic|wext}} driver. For a list of supported drivers simply run {{ic|wpa_supplicant}} without an argument.}}<br />
For networks of varying complexity please study the examples provided in the default {{ic|/etc/wpa_supplicant/wpa_supplicant.conf}} file.<br />
<br />
===Enabling with systemd===<br />
<br />
In order to take enable wireless at boot, enable {{ic|wpa_supplicant}} on your particular wireless interface. To get connectivity with DHCP, enable {{ic|dhcpcd.service}} as well. Finally, to handle possible ethernet connections, install {{ic|ifplugd}} and enable it on your ethernet interface. For instance, the invocations might look like<br />
# systemctl enable wpa_supplicant@wlp3s1<br />
# systemctl enable dhcpcd<br />
# systemctl enable ifplugd@enp5s2<br />
<br />
WPA Supplicant handles roaming for all the SSIDs configured in its configuration file, and {{ic|ifplugd}} will configure ethernet and bring down wireless when an ethernet cable is plugged into the machine. {{ic|dhcpcd}} takes care of leasing an IP on all interfaces.<br />
<br />
==Related Links==<br />
*[http://wireless.kernel.org/en/users/Documentation/wpa_supplicant Kernel.org wpa_supplicant documentation]</div>Holomorphhttps://wiki.archlinux.org/index.php?title=Wpa_supplicant&diff=267628Wpa supplicant2013-07-23T00:55:30Z<p>Holomorph: move related links</p>
<hr />
<div>[[Category:Wireless Networking]] <br />
[[es:WPA supplicant]]<br />
[[it:WPA supplicant]]<br />
[[ru:WPA Supplicant]]<br />
[[zh-CN:WPA Supplicant]]<br />
{{Article summary start}}<br />
{{Article summary text|Setup and usage of wpa_supplicant}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|Network Configuration}}<br />
{{Article summary wiki|Wireless Setup}}<br />
{{Article summary end}}<br />
<br />
[http://hostap.epitest.fi/wpa_supplicant/ wpa_supplicant] is a cross-platform [[Wikipedia:Supplicant (computer)|WPA Supplicant]] with support for WPA and WPA2 ([https://en.wikipedia.org/wiki/IEEE_802.11i IEEE 802.11i] / RSN (Robust Secure Network)). It is suitable for both desktop/laptop computers and embedded systems. {{ic|wpa_supplicant}} is the IEEE 802.1X/WPA component that is used in the client stations. It implements key negotiation with a WPA Authenticator and it controls the roaming and IEEE 802.11 authentication/association of the wlan driver.<br />
<br />
==Installation==<br />
Install {{Pkg|wpa_supplicant}} from the [[official repositories]].<br />
<br />
Optionally {{Pkg|wpa_supplicant_gui}} can be installed which provides {{ic|wpa_gui}}; a graphical frontend for {{ic|wpa_supplicant}} using the {{pkg|qt4}} toolkit.<br />
<br />
==Configuration==<br />
{{pkg|wpa_supplicant}} provides a reference configuration file located at {{ic|/etc/wpa_supplicant/wpa_supplicant.conf}} which contains detailed documentation<br />
for the all available options and their utilisation.<br />
<br />
In it's simplest form all the configuration file requires is a network block, for example:<br />
{{hc|/etc/wpa_supplicant/foobar.conf|2=<br />
network={<br />
ssid="..."<br />
}<br />
}}<br />
<br />
This can easily be generated using the {{ic|wpa_passphrase}} tool. For example:<br />
$ wpa_passphrase foobarssid foobarspassword<br />
network={<br />
ssid="foobarssid"<br />
#psk="foobarspassword"<br />
psk=f5d1c49e15e679bebe385c37648d4141bc5c9297796a8a185d7bc5ac62f954e3<br />
}<br />
<br />
Now both {{ic|wpa_supplicant}} and {{ic|wpa_passphrase}} can be combined to associate with almost all WPA2 (Personal) networks:<br />
# wpa_supplicant -B -i [interface] -c <(wpa_passphrase [essid] [passphrase])<br />
All that remains is to simply connect using a [[Network Configuration#Static_IP_Address|static IP]] or [[Network Configuration#Dynamic_IP_Address|DHCP]]. For example:<br />
# dhcpcd -A [interface]<br />
<br />
===Maintaining a custom configuration===<br />
{{Note|To discover your network interface name, issue the '''ip link''' command.}}<br />
<br />
{{Note|Be advised that the recommended method for connection is using [[Netctl]] and is certainly better in the long term.}}<br />
As discussed above we can make use of {{ic|wpa_passphrase}} to generate a basic configuration which we can augment with additional networks and options of our choosing. This may be necessary for more advanced networks employing extensive use of [https://en.wikipedia.org/wiki/Extensible_Authentication_Protocol EAP].<br />
<br />
Firstly we will use {{ic|wpa_passphrase}} to create our basic configuration file.<br />
# wpa_passphrase foobarssid foobarspassword > /etc/wpa_supplicant/foobar.conf<br />
<br />
{{Tip|Some unusually complex passphrases may require input from a file: {{ic|# wpa_passphrase foobarssid < passphrase.txt > /etc/wpa_supplicant/foobar.conf}} }}<br />
<br />
Next add a {{ic|ctrl_interface}} so that we may control the {{ic|wpa_supplicant}} daemon. We can allow {{ic|wpa_cli}} to edit this configuration by setting {{ic|1=update_config=1}}. We will also allow {{ic|wpa_supplicant}} to initiate AP (Access Point) scanning and selection with {{ic|1=ap_scan=1}}.<br />
{{hc|/etc/wpa_supplicant/foobar.conf|<nowiki><br />
ctrl_interface=DIR=/run/wpa_supplicant GROUP=wheel # allow control for members in the 'wheel' group<br />
update_config=1<br />
ap_scan=1<br />
<br />
network={<br />
ssid="foobarssid"<br />
psk=f5d1c49e15e679bebe385c37648d4141bc5c9297796a8a185d7bc5ac62f954e3<br />
}<br />
</nowiki>}}<br />
<br />
Multiple network blocks may be appended to this configuration.<br />
<br />
To start your network simply run the following:<br />
# ip link set [interface] up<br />
# wpa_supplicant -B -D nl80211 -i [interface] -c /etc/wpa_supplicant/foobar.conf<br />
# dhcpcd -A [interface]<br />
{{note|{{ic|nl80211}} is preferred over the deprecated {{ic|wext}} driver. For a list of supported drivers simply run {{ic|wpa_supplicant}} without an argument.}}<br />
For networks of varying complexity please study the examples provided in the default {{ic|/etc/wpa_supplicant/wpa_supplicant.conf}} file.<br />
<br />
==Related Links==<br />
*[http://wireless.kernel.org/en/users/Documentation/wpa_supplicant Kernel.org wpa_supplicant documentation]</div>Holomorphhttps://wiki.archlinux.org/index.php?title=Convert_FLAC_to_MP3&diff=265500Convert FLAC to MP32013-07-08T21:29:48Z<p>Holomorph: /* Usage */ clarity</p>
<hr />
<div>[[Category:Audio/Video]]<br />
[[Category:Scripts]]<br />
{{Article summary start}}<br />
{{Article summary text|Converting audio formats}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|Convert Any To Mp3}}<br />
{{Article summary wiki|Convert any Movie to DVD Video}}<br />
{{Article summary end}}<br />
<br />
Here are a few scripts and tools that facilitate converting FLAC to MP3.<br />
<br />
==Introduction==<br />
For more information on LAME switches/settings such as V0, visit the [http://wiki.hydrogenaudio.org/index.php?title=LAME Hydrogenaudio LAME Wiki]. V0 is roughly equivalent to ''--preset extreme'' which results in a variable bitrate usually between 220-260. The audio of a V0 is transparent, meaning one cannot tell the difference between the lossy file and the original source (compact disc/lossless), but yet the file size is a quite reasonable. <br />
<br />
More information on FLAC: [http://wiki.hydrogenaudio.org/index.php?title=Flac FLAC]<br />
<br />
==Scripts==<br />
<br />
In these two examples, the FLAC files in a directory are read, decompressed to WAV, and streamed into the MP3 encoder, LAME. Both scripts pass the ID3 tags from the FLAC files to the resulting MP3 files, and encode to MP3 V0.<br />
<br />
The original .flac files are not modified and the resulting .mp3s will be in the same directory. All files with extensions not matching {{Ic|*.flac}} in the working directory (.nfo, images, .sfv, etc.) are ignored.<br />
<br />
===With FFmpeg===<br />
<br />
Chances are, your system already has {{Ic|ffmpeg}} installed, which brings in the {{Ic|flac}} and {{Ic|lame}} packages. FFmpeg has all the encoding and decoding facilities built in to do the job.<br />
<br />
<pre><br />
#!/bin/bash<br />
<br />
for f in *.flac; do<br />
ffmpeg -i "$f" -qscale:a 0 "${f[@]/%flac/mp3}"<br />
done<br />
</pre><br />
<br />
===Without FFmpeg===<br />
<br />
If for some reason you have something against ffmpeg, you still need to have {{Ic|flac}} and {{Ic|lame}} installed. Here, the tagging process is more explicit, using the metadata utility that comes with {{Ic|flac}}, and passing the information to {{Ic|lame}}<br />
<br />
<pre><br />
#!/bin/bash<br />
<br />
for a in *.flac; do<br />
# give output correct extension<br />
OUTF="${a[@]/%flac/mp3}"<br />
<br />
# get the tags<br />
ARTIST=$(metaflac "$a" --show-tag=ARTIST | sed s/.*=//g)<br />
TITLE=$(metaflac "$a" --show-tag=TITLE | sed s/.*=//g)<br />
ALBUM=$(metaflac "$a" --show-tag=ALBUM | sed s/.*=//g)<br />
GENRE=$(metaflac "$a" --show-tag=GENRE | sed s/.*=//g)<br />
TRACKNUMBER=$(metaflac "$a" --show-tag=TRACKNUMBER | sed s/.*=//g)<br />
DATE=$(metaflac "$a" --show-tag=DATE | sed s/.*=//g)<br />
<br />
# stream flac into the lame encoder<br />
flac -c -d "$a" | lame -V0 --add-id3v2 --pad-id3v2 --ignore-tag-errors \<br />
--ta "$ARTIST" --tt "$TITLE" --tl "$ALBUM" --tg "${GENRE:-12}" \<br />
--tn "${TRACKNUMBER:-0}" --ty "$DATE" - "$OUTF"<br />
done<br />
</pre><br />
<br />
===Usage===<br />
<br />
For ease of use, add the script to your {{Ic|PATH}}. Open up a terminal, {{Ic|cd}} to the directory of FLAC files that you wish to convert, and invoke {{Ic|flac2mp3}} (or whatever you named the script). You'll see the verbose decoding/encoding process in the terminal which may take a few moments. Done!!! At this point, it's trivial to {{Ic|mv *.mp3}} all your new MP3s wherever you wish.<br />
<br />
A useful extension of the above scripts is to let it recurse into all subdirectories of the working directory. Replace the first line ({{Ic|for .... do}}) with<br />
<br />
<pre><br />
find -type f -name "*.flac" -print0 | while read -d $'\0' a; do<br />
</pre><br />
<br />
==Packages==<br />
<br />
* {{AUR|whatmp3}} A small Python script that accepts a list of directories containing FLAC files as arguments and converts them to MP3 with the specified options.<br />
* {{AUR|flac2all}} Audio converter of FLAC to either Ogg Vorbis or MP3 retaining all tags and metadata<br />
* {{AUR|flac2mp3-bash}} Bash script to convert Flac to Mp3 easily<br />
<br />
==Related Links==<br />
* https://www.xiph.org/flac/<br />
* https://en.wikipedia.org/wiki/FLAC<br />
* http://lame.sourceforge.net/</div>Holomorphhttps://wiki.archlinux.org/index.php?title=Convert_FLAC_to_MP3&diff=265498Convert FLAC to MP32013-07-08T21:26:52Z<p>Holomorph: remove useless title page things</p>
<hr />
<div>[[Category:Audio/Video]]<br />
[[Category:Scripts]]<br />
{{Article summary start}}<br />
{{Article summary text|Converting audio formats}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|Convert Any To Mp3}}<br />
{{Article summary wiki|Convert any Movie to DVD Video}}<br />
{{Article summary end}}<br />
<br />
Here are a few scripts and tools that facilitate converting FLAC to MP3.<br />
<br />
==Introduction==<br />
For more information on LAME switches/settings such as V0, visit the [http://wiki.hydrogenaudio.org/index.php?title=LAME Hydrogenaudio LAME Wiki]. V0 is roughly equivalent to ''--preset extreme'' which results in a variable bitrate usually between 220-260. The audio of a V0 is transparent, meaning one cannot tell the difference between the lossy file and the original source (compact disc/lossless), but yet the file size is a quite reasonable. <br />
<br />
More information on FLAC: [http://wiki.hydrogenaudio.org/index.php?title=Flac FLAC]<br />
<br />
==Scripts==<br />
<br />
In these two examples, the FLAC files in a directory are read, decompressed to WAV, and streamed into the MP3 encoder, LAME. Both scripts pass the ID3 tags from the FLAC files to the resulting MP3 files, and encode to MP3 V0.<br />
<br />
The original .flac files are not modified and the resulting .mp3s will be in the same directory. All files with extensions not matching {{Ic|*.flac}} in the working directory (.nfo, images, .sfv, etc.) are ignored.<br />
<br />
===With FFmpeg===<br />
<br />
Chances are, your system already has {{Ic|ffmpeg}} installed, which brings in the {{Ic|flac}} and {{Ic|lame}} packages. FFmpeg has all the encoding and decoding facilities built in to do the job.<br />
<br />
<pre><br />
#!/bin/bash<br />
<br />
for f in *.flac; do<br />
ffmpeg -i "$f" -qscale:a 0 "${f[@]/%flac/mp3}"<br />
done<br />
</pre><br />
<br />
===Without FFmpeg===<br />
<br />
If for some reason you have something against ffmpeg, you still need to have {{Ic|flac}} and {{Ic|lame}} installed. Here, the tagging process is more explicit, using the metadata utility that comes with {{Ic|flac}}, and passing the information to {{Ic|lame}}<br />
<br />
<pre><br />
#!/bin/bash<br />
<br />
for a in *.flac; do<br />
# give output correct extension<br />
OUTF="${a[@]/%flac/mp3}"<br />
<br />
# get the tags<br />
ARTIST=$(metaflac "$a" --show-tag=ARTIST | sed s/.*=//g)<br />
TITLE=$(metaflac "$a" --show-tag=TITLE | sed s/.*=//g)<br />
ALBUM=$(metaflac "$a" --show-tag=ALBUM | sed s/.*=//g)<br />
GENRE=$(metaflac "$a" --show-tag=GENRE | sed s/.*=//g)<br />
TRACKNUMBER=$(metaflac "$a" --show-tag=TRACKNUMBER | sed s/.*=//g)<br />
DATE=$(metaflac "$a" --show-tag=DATE | sed s/.*=//g)<br />
<br />
# stream flac into the lame encoder<br />
flac -c -d "$a" | lame -V0 --add-id3v2 --pad-id3v2 --ignore-tag-errors \<br />
--ta "$ARTIST" --tt "$TITLE" --tl "$ALBUM" --tg "${GENRE:-12}" \<br />
--tn "${TRACKNUMBER:-0}" --ty "$DATE" - "$OUTF"<br />
done<br />
</pre><br />
<br />
===Usage===<br />
<br />
For ease of use, add the script to your {{Ic|PATH}}. Open up a terminal, {{Ic|cd}} to the directory of FLAC files that you wish to convert, and invoke {{Ic|flac2mp3}}. You'll see the verbose decoding/encoding process in the terminal which may take a few moments. Done!!! At this point, it's trivial to {{Ic|mv *.mp3}} all your new MP3s wherever you wish.<br />
<br />
A useful extension of the above scripts is to let it recurse into all subdirectories of the working directory. Replace the first line ({{Ic|for .... do}}) with<br />
<br />
<pre><br />
find -type f -name "*.flac" -print0 | while read -d $'\0' a; do<br />
</pre><br />
<br />
==Packages==<br />
<br />
* {{AUR|whatmp3}} A small Python script that accepts a list of directories containing FLAC files as arguments and converts them to MP3 with the specified options.<br />
* {{AUR|flac2all}} Audio converter of FLAC to either Ogg Vorbis or MP3 retaining all tags and metadata<br />
* {{AUR|flac2mp3-bash}} Bash script to convert Flac to Mp3 easily<br />
<br />
==Related Links==<br />
* https://www.xiph.org/flac/<br />
* https://en.wikipedia.org/wiki/FLAC<br />
* http://lame.sourceforge.net/</div>Holomorphhttps://wiki.archlinux.org/index.php?title=Convert_FLAC_to_MP3&diff=265497Convert FLAC to MP32013-07-08T21:25:59Z<p>Holomorph: major clean up</p>
<hr />
<div>[[Category:Audio/Video]]<br />
[[Category:Scripts]]<br />
[[de:Convert FLAC to MP3]]<br />
{{Article summary start}}<br />
{{Article summary text|Converting audio formats}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|Convert Any To Mp3}}<br />
{{Article summary wiki|Convert any Movie to DVD Video}}<br />
{{Article summary end}}<br />
{{DISPLAYTITLE:Convert FLAC to MP3}}<br />
<br />
Here are a few scripts and tools that facilitate converting FLAC to MP3.<br />
<br />
<br />
==Introduction==<br />
For more information on LAME switches/settings such as V0, visit the [http://wiki.hydrogenaudio.org/index.php?title=LAME Hydrogenaudio LAME Wiki]. V0 is roughly equivalent to ''--preset extreme'' which results in a variable bitrate usually between 220-260. The audio of a V0 is transparent, meaning one cannot tell the difference between the lossy file and the original source (compact disc/lossless), but yet the file size is a quite reasonable. <br />
<br />
More information on FLAC: [http://wiki.hydrogenaudio.org/index.php?title=Flac FLAC]<br />
<br />
==Scripts==<br />
<br />
In these two examples, the FLAC files in a directory are read, decompressed to WAV, and streamed into the MP3 encoder, LAME. Both scripts pass the ID3 tags from the FLAC files to the resulting MP3 files, and encode to MP3 V0.<br />
<br />
The original .flac files are not modified and the resulting .mp3s will be in the same directory. All files with extensions not matching {{Ic|*.flac}} in the working directory (.nfo, images, .sfv, etc.) are ignored.<br />
<br />
===With FFmpeg===<br />
<br />
Chances are, your system already has {{Ic|ffmpeg}} installed, which brings in the {{Ic|flac}} and {{Ic|lame}} packages. FFmpeg has all the encoding and decoding facilities built in to do the job.<br />
<br />
<pre><br />
#!/bin/bash<br />
<br />
for f in *.flac; do<br />
ffmpeg -i "$f" -qscale:a 0 "${f[@]/%flac/mp3}"<br />
done<br />
</pre><br />
<br />
===Without FFmpeg===<br />
<br />
If for some reason you have something against ffmpeg, you still need to have {{Ic|flac}} and {{Ic|lame}} installed. Here, the tagging process is more explicit, using the metadata utility that comes with {{Ic|flac}}, and passing the information to {{Ic|lame}}<br />
<br />
<pre><br />
#!/bin/bash<br />
<br />
for a in *.flac; do<br />
# give output correct extension<br />
OUTF="${a[@]/%flac/mp3}"<br />
<br />
# get the tags<br />
ARTIST=$(metaflac "$a" --show-tag=ARTIST | sed s/.*=//g)<br />
TITLE=$(metaflac "$a" --show-tag=TITLE | sed s/.*=//g)<br />
ALBUM=$(metaflac "$a" --show-tag=ALBUM | sed s/.*=//g)<br />
GENRE=$(metaflac "$a" --show-tag=GENRE | sed s/.*=//g)<br />
TRACKNUMBER=$(metaflac "$a" --show-tag=TRACKNUMBER | sed s/.*=//g)<br />
DATE=$(metaflac "$a" --show-tag=DATE | sed s/.*=//g)<br />
<br />
# stream flac into the lame encoder<br />
flac -c -d "$a" | lame -V0 --add-id3v2 --pad-id3v2 --ignore-tag-errors \<br />
--ta "$ARTIST" --tt "$TITLE" --tl "$ALBUM" --tg "${GENRE:-12}" \<br />
--tn "${TRACKNUMBER:-0}" --ty "$DATE" - "$OUTF"<br />
done<br />
</pre><br />
<br />
===Usage===<br />
<br />
For ease of use, add the script to your {{Ic|PATH}}. Open up a terminal, {{Ic|cd}} to the directory of FLAC files that you wish to convert, and invoke {{Ic|flac2mp3}}. You'll see the verbose decoding/encoding process in the terminal which may take a few moments. Done!!! At this point, it's trivial to {{Ic|mv *.mp3}} all your new MP3s wherever you wish.<br />
<br />
A useful extension of the above scripts is to let it recurse into all subdirectories of the working directory. Replace the first line ({{Ic|for .... do}}) with<br />
<br />
<pre><br />
find -type f -name "*.flac" -print0 | while read -d $'\0' a; do<br />
</pre><br />
<br />
==Packages==<br />
<br />
* {{AUR|whatmp3}} A small Python script that accepts a list of directories containing FLAC files as arguments and converts them to MP3 with the specified options.<br />
* {{AUR|flac2all}} Audio converter of FLAC to either Ogg Vorbis or MP3 retaining all tags and metadata<br />
* {{AUR|flac2mp3-bash}} Bash script to convert Flac to Mp3 easily<br />
<br />
==Related Links==<br />
* https://www.xiph.org/flac/<br />
* https://en.wikipedia.org/wiki/FLAC<br />
* http://lame.sourceforge.net/</div>Holomorphhttps://wiki.archlinux.org/index.php?title=Convert_FLAC_to_MP3&diff=265491Convert FLAC to MP32013-07-08T19:00:31Z<p>Holomorph: remove script dump, collect packages</p>
<hr />
<div>[[Category:Audio/Video]]<br />
[[Category:Scripts]]<br />
[[de:Convert FLAC to MP3]]<br />
{{Article summary start}}<br />
{{Article summary text|Converting audio formats}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|Convert Any To Mp3}}<br />
{{Article summary wiki|Convert any Movie to DVD Video}}<br />
{{Article summary end}}<br />
{{DISPLAYTITLE:Convert FLAC to MP3}}<br />
<br />
<br />
==Introduction==<br />
Here is a script that will convert FLAC to MP3 via the commandline. <br />
<br />
Essentially, the .flac files within a directory will be decompressed to .wav and then the resulting .wav files will be encoded to .mp3 using the latest LAME switches for encodings (''-V 0 --vbr-new''). The ID3 tags of the original .flac files will be passed to the resulting .mp3 files.<br />
<br />
The original .flac files will not be harmed and the resulting .mp3s will be in the same directory. All other files in the directory (.nfo, images, .sfv, etc) will be ignored and unharmed. <br />
<br />
For more information on LAME switches/settings such as V0, visit [http://wiki.hydrogenaudio.org/index.php?title=LAME Hydrogenaudio LAME Wiki]. V0 is roughly equivalent to ''--preset extreme'' which results in a variable bitrate usually between 220-260. The audio of a V0 is transparent, meaning one cannot tell the difference between the lossy file and the original source (compact disc/lossless), but yet the file size is a quite reasonable. <br />
<br />
More information on flac: [http://wiki.hydrogenaudio.org/index.php?title=Flac FLAC]<br />
<br />
===Installation===<br />
<br />
First you need to install the following packages: flac, lame, and id3<br />
<br />
<pre><br />
pacman -S flac lame id3<br />
</pre><br />
<br />
Once those are installed, copy the following script into your preferred editor:<br />
<br />
<pre><br />
#! /bin/sh<br />
<br />
for a in *.flac; do<br />
OUTF=${a%.flac}.mp3<br />
<br />
ARTIST=$(metaflac "$a" --show-tag=ARTIST | sed s/.*=//g)<br />
TITLE=$(metaflac "$a" --show-tag=TITLE | sed s/.*=//g)<br />
ALBUM=$(metaflac "$a" --show-tag=ALBUM | sed s/.*=//g)<br />
GENRE=$(metaflac "$a" --show-tag=GENRE | sed s/.*=//g)<br />
TRACKNUMBER=$(metaflac "$a" --show-tag=TRACKNUMBER | sed s/.*=//g)<br />
DATE=$(metaflac "$a" --show-tag=DATE | sed s/.*=//g)<br />
<br />
flac -c -d "$a" | lame -m j -q 0 --vbr-new -V 0 -s 44.1 - "$OUTF"<br />
id3 -t "$TITLE" -T "${TRACKNUMBER:-0}" -a "$ARTIST" -A "$ALBUM" -y "$DATE" -g "${GENRE:-12}" "$OUTF"<br />
done<br />
</pre><br />
<br />
Below is a modified version of the above script which:<br />
* adds an optional parameter (-d), which, if passed on the command line, causes each source FLAC file to be deleted after successful conversion;<br />
* changes the LAME encoding options as follows:<br />
** drops --vbr-new, as it is the default VBR behaviour as of LAME 3.98, and thus is automatically used when "-V 0" is used;<br />
** drops "-m j", as LAME defaults to the specified value (joint stereo) when using --vbr-new (see above);<br />
** drops "-q 0", as LAME defaults to this behaviour when using VBR;<br />
** drops "-s 44.1", as LAME detects the proper sample rate to use;<br />
** adds "--noreplaygain" (personal preference);<br />
* and uses LAME to write tags instead of the id3 package, which has the dual advantage of removing the need for an additional package in the tool chain and allowing the script to write both id3v1 and id3v2 tags (the id3 package does not support id3v2 tags).<br />
<br />
Now for the script:<br />
<br />
<pre><br />
#! /bin/sh<br />
<br />
for a in *.flac; do<br />
OUTF=${a%.flac}.mp3<br />
<br />
ARTIST=`metaflac "$a" --show-tag=ARTIST | sed s/.*=//g`<br />
TITLE=`metaflac "$a" --show-tag=TITLE | sed s/.*=//g`<br />
ALBUM=`metaflac "$a" --show-tag=ALBUM | sed s/.*=//g`<br />
GENRE=`metaflac "$a" --show-tag=GENRE | sed s/.*=//g`<br />
TRACKNUMBER=`metaflac "$a" --show-tag=TRACKNUMBER | sed s/.*=//g`<br />
DATE=`metaflac "$a" --show-tag=DATE | sed s/.*=//g`<br />
<br />
flac -c -d "$a" | lame --noreplaygain -V0 \<br />
--add-id3v2 --pad-id3v2 --ignore-tag-errors --tt "$TITLE" --tn "${TRACKNUMBER:-0}" \<br />
--ta "$ARTIST" --tl "$ALBUM" --ty "$DATE" --tg "${GENRE:-12}" \<br />
- "$OUTF"<br />
RESULT=$?<br />
if [ "$1" ] && [ "$1" = "-d" ] && [ $RESULT -eq 0 ]; then<br />
rm "$a"<br />
fi<br />
done<br />
</pre><br />
<br />
Alternatively, below is a script that will search for all FLAC audio files beyond where the script resides on your filesystem and convert them to MP3; including those pesky filenames with spaces.<br />
<br />
<pre><br />
#! /bin/bash<br />
<br />
find . -type f -name "*.flac" -print0 | while read -d $'\0' a<br />
<br />
do<br />
OUTF=${a%.flac}.mp3<br />
<br />
ARTIST=`metaflac "$a" --show-tag=ARTIST | sed s/.*=//g`<br />
TITLE=`metaflac "$a" --show-tag=TITLE | sed s/.*=//g`<br />
ALBUM=`metaflac "$a" --show-tag=ALBUM | sed s/.*=//g`<br />
GENRE=`metaflac "$a" --show-tag=GENRE | sed s/.*=//g`<br />
TRACKNUMBER=`metaflac "$a" --show-tag=TRACKNUMBER | sed s/.*=//g`<br />
DATE=`metaflac "$a" --show-tag=DATE | sed s/.*=//g`<br />
<br />
flac -c -d "$a" | lame -m j -q 0 --vbr-new -V 0 -s 44.1 - "$OUTF"<br />
id3 -t "$TITLE" -T "${TRACKNUMBER:-0}" -a "$ARTIST" -A "$ALBUM" -y "$DATE" -g "${GENRE:-12}" "$OUTF"<br />
done<br />
</pre><br />
<br />
Save the script as ''flac2mp3'' and make the script executable:<br />
<br />
<pre><br />
chmod a+x flac2mp3<br />
</pre><br />
<br />
As root, copy the script to /usr/local/bin (or anywhere else that is in your $PATH).<br />
<br />
<pre><br />
cp flac2mp3 /usr/local/bin<br />
</pre><br />
<br />
To make /usr/local/bin in your $PATH, do (as normal user):<br />
<br />
<pre><br />
PATH=$PATH:/usr/local/bin/<br />
</pre><br />
<br />
and then (as normal user):<br />
<pre><br />
nano .bashrc<br />
</pre><br />
<br />
and add ''export PATH=$PATH:/usr/local/bin/''<br />
<br />
====Usage====<br />
<br />
Open up a terminal and cd to the directory of .flac files that you wish to convert and enter ''flac2mp3''<br />
<br />
You'll see the verbose decoding/encoding process in the terminal which may take a few moments. <br />
<br />
Done.<br />
<br />
====Addendum====<br />
<br />
With a small modification the command file can be used to transcode the files into a new directory structure:<br />
<pre><br />
#! /bin/bash<br />
find "$1" -name *.flac -print0 | while read -d $'\0' IF<br />
do<br />
OF=$(echo "$IF" | sed -e 's/\.flac$/.mp3/g' -e "s,$1,$2,g")<br />
echo "$IF -> $OF"<br />
mkdir -p "${OF%/*}"<br />
<br />
ARTIST=`metaflac "$IF" --show-tag=ARTIST | sed s/.*=//g`<br />
TITLE=`metaflac "$IF" --show-tag=TITLE | sed s/.*=//g`<br />
ALBUM=`metaflac "$IF" --show-tag=ALBUM | sed s/.*=//g`<br />
GENRE=`metaflac "$IF" --show-tag=GENRE | sed s/.*=//g`<br />
TRACKNUMBER=`metaflac "$IF" --show-tag=TRACKNUMBER | sed s/.*=//g`<br />
DATE=`metaflac "$IF" --show-tag=DATE | sed s/.*=//g`<br />
<br />
flac -c -d "$IF" 2> /dev/null | lame -m j -q 0 --vbr-new -V 0 -s 44.1 - "$OF" 2> /dev/null<br />
id3 -t "$TITLE" -T "${TRACKNUMBER:-0}" -a "$ARTIST" -A "$ALBUM" -y "$DATE" -g "${GENRE:-12}" "$OF"<br />
done<br />
</pre><br />
if saved in flac2mp3 this can be used as follows<br />
<pre>./flac2mp3 /srv/media/music /srv/media/music-lofi</pre><br />
which will take the directory structure under /srv/media/music and transcode its content into /srv/media/music-lofi.<br />
<br />
With some more tweaks the script will support directories that contain '.' (dots) somewhere in the path and<br />
executing the script from folders that contain 'flac' files<br />
<br />
Also made specifying an alternate folder location optional<br />
<pre><br />
#! /bin/bash<br />
find "$1" -name "*.flac" -print0 | while read -d $'\0' IF<br />
do<br />
if [ "$2" != "" ]<br />
then<br />
OF="${IF%.flac}.mp3"<br />
OF="$2/${OF##*/}"<br />
else<br />
OF="${IF%.flac}.mp3"<br />
fi<br />
echo "$IF -> $OF"<br />
mkdir -p "${OF%/*}"<br />
<br />
ARTIST=`metaflac "$IF" --show-tag=ARTIST | sed s/.*=//g`<br />
TITLE=`metaflac "$IF" --show-tag=TITLE | sed s/.*=//g`<br />
ALBUM=`metaflac "$IF" --show-tag=ALBUM | sed s/.*=//g`<br />
GENRE=`metaflac "$IF" --show-tag=GENRE | sed s/.*=//g`<br />
TRACKNUMBER=`metaflac "$IF" --show-tag=TRACKNUMBER | sed s/.*=//g`<br />
DATE=`metaflac "$IF" --show-tag=DATE | sed s/.*=//g`<br />
<br />
flac -c -d "$IF" 2> /dev/null | lame -m j -q 0 --vbr-new -V 0 -s 44.1 - "$OF" 2> /dev/null<br />
id3 -t "$TITLE" -T "${TRACKNUMBER:-0}" -a "$ARTIST" -A "$ALBUM" -y "$DATE" -g "${GENRE:-12}" "$OF"<br />
done<br />
</pre><br />
if saved in flac2mp3 this can be used as follows<br />
<pre>./flac2mp3 /srv/media.store/music /srv/media/music-lofi</pre><br />
or<br />
<pre>./flac2mp3 /srv/media.store/music </pre><br />
<br />
==Packages==<br />
<br />
* {{AUR|whatmp3}} A small Python script that accepts a list of directories containing FLAC files as arguments and converts them to MP3 with the specified options.<br />
* {{AUR|flac2all}} Audio converter of FLAC to either Ogg Vorbis or MP3 retaining all tags and metadata<br />
* {{AUR|flac2mp3-bash}} Bash script to convert Flac to Mp3 easily<br />
<br />
==Related Links==<br />
* https://www.xiph.org/flac/<br />
* https://en.wikipedia.org/wiki/FLAC<br />
* http://lame.sourceforge.net/</div>Holomorphhttps://wiki.archlinux.org/index.php?title=Convert_FLAC_to_MP3&diff=265479Convert FLAC to MP32013-07-08T18:54:03Z<p>Holomorph: add some links</p>
<hr />
<div>[[Category:Audio/Video]]<br />
[[Category:Scripts]]<br />
[[de:Convert FLAC to MP3]]<br />
{{Article summary start}}<br />
{{Article summary text|Converting audio formats}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|Convert Any To Mp3}}<br />
{{Article summary wiki|Convert any Movie to DVD Video}}<br />
{{Article summary end}}<br />
{{DISPLAYTITLE:Convert FLAC to MP3}}<br />
{{Tip|You can use {{AUR|flac2mp3-bash}} script from aur to convert Flac to Mp3 easily.}}<br />
<br />
==Introduction==<br />
Here is a script that will convert FLAC to MP3 via the commandline. <br />
<br />
Essentially, the .flac files within a directory will be decompressed to .wav and then the resulting .wav files will be encoded to .mp3 using the latest LAME switches for encodings (''-V 0 --vbr-new''). The ID3 tags of the original .flac files will be passed to the resulting .mp3 files.<br />
<br />
The original .flac files will not be harmed and the resulting .mp3s will be in the same directory. All other files in the directory (.nfo, images, .sfv, etc) will be ignored and unharmed. <br />
<br />
For more information on LAME switches/settings such as V0, visit [http://wiki.hydrogenaudio.org/index.php?title=LAME Hydrogenaudio LAME Wiki]. V0 is roughly equivalent to ''--preset extreme'' which results in a variable bitrate usually between 220-260. The audio of a V0 is transparent, meaning one cannot tell the difference between the lossy file and the original source (compact disc/lossless), but yet the file size is a quite reasonable. <br />
<br />
More information on flac: [http://wiki.hydrogenaudio.org/index.php?title=Flac FLAC]<br />
<br />
===Installation===<br />
<br />
First you need to install the following packages: flac, lame, and id3<br />
<br />
<pre><br />
pacman -S flac lame id3<br />
</pre><br />
<br />
Once those are installed, copy the following script into your preferred editor:<br />
<br />
<pre><br />
#! /bin/sh<br />
<br />
for a in *.flac; do<br />
OUTF=${a%.flac}.mp3<br />
<br />
ARTIST=$(metaflac "$a" --show-tag=ARTIST | sed s/.*=//g)<br />
TITLE=$(metaflac "$a" --show-tag=TITLE | sed s/.*=//g)<br />
ALBUM=$(metaflac "$a" --show-tag=ALBUM | sed s/.*=//g)<br />
GENRE=$(metaflac "$a" --show-tag=GENRE | sed s/.*=//g)<br />
TRACKNUMBER=$(metaflac "$a" --show-tag=TRACKNUMBER | sed s/.*=//g)<br />
DATE=$(metaflac "$a" --show-tag=DATE | sed s/.*=//g)<br />
<br />
flac -c -d "$a" | lame -m j -q 0 --vbr-new -V 0 -s 44.1 - "$OUTF"<br />
id3 -t "$TITLE" -T "${TRACKNUMBER:-0}" -a "$ARTIST" -A "$ALBUM" -y "$DATE" -g "${GENRE:-12}" "$OUTF"<br />
done<br />
</pre><br />
<br />
Below is a modified version of the above script which:<br />
* adds an optional parameter (-d), which, if passed on the command line, causes each source FLAC file to be deleted after successful conversion;<br />
* changes the LAME encoding options as follows:<br />
** drops --vbr-new, as it is the default VBR behaviour as of LAME 3.98, and thus is automatically used when "-V 0" is used;<br />
** drops "-m j", as LAME defaults to the specified value (joint stereo) when using --vbr-new (see above);<br />
** drops "-q 0", as LAME defaults to this behaviour when using VBR;<br />
** drops "-s 44.1", as LAME detects the proper sample rate to use;<br />
** adds "--noreplaygain" (personal preference);<br />
* and uses LAME to write tags instead of the id3 package, which has the dual advantage of removing the need for an additional package in the tool chain and allowing the script to write both id3v1 and id3v2 tags (the id3 package does not support id3v2 tags).<br />
<br />
Now for the script:<br />
<br />
<pre><br />
#! /bin/sh<br />
<br />
for a in *.flac; do<br />
OUTF=${a%.flac}.mp3<br />
<br />
ARTIST=`metaflac "$a" --show-tag=ARTIST | sed s/.*=//g`<br />
TITLE=`metaflac "$a" --show-tag=TITLE | sed s/.*=//g`<br />
ALBUM=`metaflac "$a" --show-tag=ALBUM | sed s/.*=//g`<br />
GENRE=`metaflac "$a" --show-tag=GENRE | sed s/.*=//g`<br />
TRACKNUMBER=`metaflac "$a" --show-tag=TRACKNUMBER | sed s/.*=//g`<br />
DATE=`metaflac "$a" --show-tag=DATE | sed s/.*=//g`<br />
<br />
flac -c -d "$a" | lame --noreplaygain -V0 \<br />
--add-id3v2 --pad-id3v2 --ignore-tag-errors --tt "$TITLE" --tn "${TRACKNUMBER:-0}" \<br />
--ta "$ARTIST" --tl "$ALBUM" --ty "$DATE" --tg "${GENRE:-12}" \<br />
- "$OUTF"<br />
RESULT=$?<br />
if [ "$1" ] && [ "$1" = "-d" ] && [ $RESULT -eq 0 ]; then<br />
rm "$a"<br />
fi<br />
done<br />
</pre><br />
<br />
Alternatively, below is a script that will search for all FLAC audio files beyond where the script resides on your filesystem and convert them to MP3; including those pesky filenames with spaces.<br />
<br />
<pre><br />
#! /bin/bash<br />
<br />
find . -type f -name "*.flac" -print0 | while read -d $'\0' a<br />
<br />
do<br />
OUTF=${a%.flac}.mp3<br />
<br />
ARTIST=`metaflac "$a" --show-tag=ARTIST | sed s/.*=//g`<br />
TITLE=`metaflac "$a" --show-tag=TITLE | sed s/.*=//g`<br />
ALBUM=`metaflac "$a" --show-tag=ALBUM | sed s/.*=//g`<br />
GENRE=`metaflac "$a" --show-tag=GENRE | sed s/.*=//g`<br />
TRACKNUMBER=`metaflac "$a" --show-tag=TRACKNUMBER | sed s/.*=//g`<br />
DATE=`metaflac "$a" --show-tag=DATE | sed s/.*=//g`<br />
<br />
flac -c -d "$a" | lame -m j -q 0 --vbr-new -V 0 -s 44.1 - "$OUTF"<br />
id3 -t "$TITLE" -T "${TRACKNUMBER:-0}" -a "$ARTIST" -A "$ALBUM" -y "$DATE" -g "${GENRE:-12}" "$OUTF"<br />
done<br />
</pre><br />
<br />
Save the script as ''flac2mp3'' and make the script executable:<br />
<br />
<pre><br />
chmod a+x flac2mp3<br />
</pre><br />
<br />
As root, copy the script to /usr/local/bin (or anywhere else that is in your $PATH).<br />
<br />
<pre><br />
cp flac2mp3 /usr/local/bin<br />
</pre><br />
<br />
To make /usr/local/bin in your $PATH, do (as normal user):<br />
<br />
<pre><br />
PATH=$PATH:/usr/local/bin/<br />
</pre><br />
<br />
and then (as normal user):<br />
<pre><br />
nano .bashrc<br />
</pre><br />
<br />
and add ''export PATH=$PATH:/usr/local/bin/''<br />
<br />
====Usage====<br />
<br />
Open up a terminal and cd to the directory of .flac files that you wish to convert and enter ''flac2mp3''<br />
<br />
You'll see the verbose decoding/encoding process in the terminal which may take a few moments. <br />
<br />
Done.<br />
<br />
====Addendum====<br />
<br />
With a small modification the command file can be used to transcode the files into a new directory structure:<br />
<pre><br />
#! /bin/bash<br />
find "$1" -name *.flac -print0 | while read -d $'\0' IF<br />
do<br />
OF=$(echo "$IF" | sed -e 's/\.flac$/.mp3/g' -e "s,$1,$2,g")<br />
echo "$IF -> $OF"<br />
mkdir -p "${OF%/*}"<br />
<br />
ARTIST=`metaflac "$IF" --show-tag=ARTIST | sed s/.*=//g`<br />
TITLE=`metaflac "$IF" --show-tag=TITLE | sed s/.*=//g`<br />
ALBUM=`metaflac "$IF" --show-tag=ALBUM | sed s/.*=//g`<br />
GENRE=`metaflac "$IF" --show-tag=GENRE | sed s/.*=//g`<br />
TRACKNUMBER=`metaflac "$IF" --show-tag=TRACKNUMBER | sed s/.*=//g`<br />
DATE=`metaflac "$IF" --show-tag=DATE | sed s/.*=//g`<br />
<br />
flac -c -d "$IF" 2> /dev/null | lame -m j -q 0 --vbr-new -V 0 -s 44.1 - "$OF" 2> /dev/null<br />
id3 -t "$TITLE" -T "${TRACKNUMBER:-0}" -a "$ARTIST" -A "$ALBUM" -y "$DATE" -g "${GENRE:-12}" "$OF"<br />
done<br />
</pre><br />
if saved in flac2mp3 this can be used as follows<br />
<pre>./flac2mp3 /srv/media/music /srv/media/music-lofi</pre><br />
which will take the directory structure under /srv/media/music and transcode its content into /srv/media/music-lofi.<br />
<br />
With some more tweaks the script will support directories that contain '.' (dots) somewhere in the path and<br />
executing the script from folders that contain 'flac' files<br />
<br />
Also made specifying an alternate folder location optional<br />
<pre><br />
#! /bin/bash<br />
find "$1" -name "*.flac" -print0 | while read -d $'\0' IF<br />
do<br />
if [ "$2" != "" ]<br />
then<br />
OF="${IF%.flac}.mp3"<br />
OF="$2/${OF##*/}"<br />
else<br />
OF="${IF%.flac}.mp3"<br />
fi<br />
echo "$IF -> $OF"<br />
mkdir -p "${OF%/*}"<br />
<br />
ARTIST=`metaflac "$IF" --show-tag=ARTIST | sed s/.*=//g`<br />
TITLE=`metaflac "$IF" --show-tag=TITLE | sed s/.*=//g`<br />
ALBUM=`metaflac "$IF" --show-tag=ALBUM | sed s/.*=//g`<br />
GENRE=`metaflac "$IF" --show-tag=GENRE | sed s/.*=//g`<br />
TRACKNUMBER=`metaflac "$IF" --show-tag=TRACKNUMBER | sed s/.*=//g`<br />
DATE=`metaflac "$IF" --show-tag=DATE | sed s/.*=//g`<br />
<br />
flac -c -d "$IF" 2> /dev/null | lame -m j -q 0 --vbr-new -V 0 -s 44.1 - "$OF" 2> /dev/null<br />
id3 -t "$TITLE" -T "${TRACKNUMBER:-0}" -a "$ARTIST" -A "$ALBUM" -y "$DATE" -g "${GENRE:-12}" "$OF"<br />
done<br />
</pre><br />
if saved in flac2mp3 this can be used as follows<br />
<pre>./flac2mp3 /srv/media.store/music /srv/media/music-lofi</pre><br />
or<br />
<pre>./flac2mp3 /srv/media.store/music </pre><br />
<br />
=====Nautilus-scripts=====<br />
<br />
Here's a well-written version of "flac2mp3" script which will run either from command line or, if you copy it into <tt>~/.gnome2/nautilus-scripts</tt>, it will appear in the right-click menu in Nautilus:<br />
<pre><br />
#!/bin/bash<br />
#<br />
# Copyright 2008 Octavio Ruiz<br />
# Distributed under the terms of the GNU General Public License v3<br />
# $Header: $<br />
#<br />
# Yet Another FLAC to MP3 script<br />
#<br />
# Author:<br />
# Octavio Ruiz (Ta^3) <tacvbo@tacvbo.net><br />
# Thanks:<br />
# Those comments at:<br />
# http://www.linuxtutorialblog.com/post/solution-converting-flac-to-mp3<br />
# WebPage:<br />
# https://github.com/tacvbo/yaflac2mp3/tree<br />
#<br />
# This program is distributed in the hope that it will be useful,<br />
# but WITHOUT ANY WARRANTY. YOU USE AT YOUR OWN RISK. THE AUTHOR<br />
# WILL NOT BE LIABLE FOR DATA LOSS, DAMAGES, LOSS OF PROFITS OR ANY<br />
# OTHER KIND OF LOSS WHILE USING OR MISUSING THIS SOFTWARE.<br />
# See the GNU General Public License for more details.<br />
#<br />
# Modified by woohoo<br />
#<br />
# you need zenity package for notifications.<br />
# please note that you can put this script in ~/.gnome2/nautilus-scripts<br />
# and it will show up in right-click menu in any folder in gnome.<br />
#<br />
# modify the lame options to your preference example change -b 320 to -b 128 or -b 192 or -b 256<br />
# LAME_OPTS="--vbr-new -V 0 -b 256"<br />
# LAME_OPTS="-V 0 --vbr-new"<br />
<br />
LAME_OPTS="-b 320 -h --cbr"<br />
<br />
old_IFS=${IFS}<br />
IFS='<br />
'<br />
<br />
# when running from nautilus-scripts, it useful to find the current folder<br />
base="`echo $NAUTILUS_SCRIPT_CURRENT_URI | cut -d'/' -f3- | sed 's/%20/ /g'`"<br />
if [ -z "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" ]; then<br />
dir="$base"<br />
else<br />
while [ ! -z "$1" -a ! -d "$base/$1" ]; do shift; done<br />
dir="$base/$1"<br />
fi<br />
<br />
if [ "$dir" != "" ]; then<br />
cd "$dir"<br />
fi<br />
<br />
id3v2=$(which id3v2)<br />
<br />
files=`find . -type f -regex '^.+\.flac$' | sort`<br />
<br />
declare -i nn=0<br />
for file in ${files}<br />
do<br />
fn=$(readlink -f "$file")<br />
vars=( `metaflac --no-utf8-convert --export-tags-to=- "${fn}"` )<br />
<br />
for N_vars in ${!vars[@]}<br />
do<br />
export "$(echo "${vars[${N_vars}]%=*}" | tr [:upper:] [:lower:])=${vars[${N_vars}]#*=}"<br />
done<br />
<br />
dest=`echo "$fn"|sed -e 's/\.flac$/\.mp3/'`<br />
<br />
flac -dc "$fn" |\<br />
lame --ignore-tag-errors --add-id3v2 ${LAME_OPTS} \<br />
${artist:+--ta} ${artist} \<br />
${tracknumber:+--tn} ${tracknumber} \<br />
${title:+--tt} ${title} \<br />
${album:+--tl} ${album} \<br />
${date:+--ty} ${date} \<br />
${genre:+--tg} ${genre} \<br />
${comment:+--tc} ${comment} \<br />
- $dest<br />
<br />
[[ -x ${id3v2} ]] && ${id3v2} \<br />
${artist:+--artist} ${artist} \<br />
${tracknumber:+--track} ${tracknumber} \<br />
${title:+--song} ${title} \<br />
${album:+--album} ${album} \<br />
${date:+--year} ${date} \<br />
${genre:+--genre} ${genre} \<br />
${comment:+--comment} ${comment} \<br />
$dest<br />
<br />
let nn=nn+1<br />
done<br />
<br />
zenity --notification --text "Finished converting flac to mp3.${IFS}Processed ${nn} files."<br />
#zenity --info --text "Done!"<br />
IFS=${old_IFS}<br />
<br />
</pre><br />
<br />
More such conversion scripts on pastebin.com [http://pastebin.com/u/woohoo here].<br />
<br />
==More generic solution==<br />
<br />
See [[Convert_Any_To_Mp3]] for a more generic solution if you want to transform to mp3 all kind of audio formats supported by both mplayer and mutagen.<br />
<br />
==Related Links==<br />
* https://www.xiph.org/flac/<br />
* https://en.wikipedia.org/wiki/FLAC<br />
* http://lame.sourceforge.net/</div>Holomorphhttps://wiki.archlinux.org/index.php?title=Convert_FLAC_to_MP3&diff=265475Convert FLAC to MP32013-07-08T18:47:21Z<p>Holomorph: really fix it?</p>
<hr />
<div>[[Category:Audio/Video]]<br />
[[Category:Scripts]]<br />
[[de:Convert FLAC to MP3]]<br />
{{DISPLAYTITLE:Convert FLAC to MP3}}<br />
{{Tip|You can use {{AUR|flac2mp3-bash}} script from aur to convert Flac to Mp3 easily.}}<br />
<br />
==Introduction==<br />
Here is a script that will convert FLAC to MP3 via the commandline. <br />
<br />
Essentially, the .flac files within a directory will be decompressed to .wav and then the resulting .wav files will be encoded to .mp3 using the latest LAME switches for encodings (''-V 0 --vbr-new''). The ID3 tags of the original .flac files will be passed to the resulting .mp3 files.<br />
<br />
The original .flac files will not be harmed and the resulting .mp3s will be in the same directory. All other files in the directory (.nfo, images, .sfv, etc) will be ignored and unharmed. <br />
<br />
For more information on LAME switches/settings such as V0, visit [http://wiki.hydrogenaudio.org/index.php?title=LAME Hydrogenaudio LAME Wiki]. V0 is roughly equivalent to ''--preset extreme'' which results in a variable bitrate usually between 220-260. The audio of a V0 is transparent, meaning one cannot tell the difference between the lossy file and the original source (compact disc/lossless), but yet the file size is a quite reasonable. <br />
<br />
More information on flac: [http://wiki.hydrogenaudio.org/index.php?title=Flac FLAC]<br />
<br />
===Installation===<br />
<br />
First you need to install the following packages: flac, lame, and id3<br />
<br />
<pre><br />
pacman -S flac lame id3<br />
</pre><br />
<br />
Once those are installed, copy the following script into your preferred editor:<br />
<br />
<pre><br />
#! /bin/sh<br />
<br />
for a in *.flac; do<br />
OUTF=${a%.flac}.mp3<br />
<br />
ARTIST=$(metaflac "$a" --show-tag=ARTIST | sed s/.*=//g)<br />
TITLE=$(metaflac "$a" --show-tag=TITLE | sed s/.*=//g)<br />
ALBUM=$(metaflac "$a" --show-tag=ALBUM | sed s/.*=//g)<br />
GENRE=$(metaflac "$a" --show-tag=GENRE | sed s/.*=//g)<br />
TRACKNUMBER=$(metaflac "$a" --show-tag=TRACKNUMBER | sed s/.*=//g)<br />
DATE=$(metaflac "$a" --show-tag=DATE | sed s/.*=//g)<br />
<br />
flac -c -d "$a" | lame -m j -q 0 --vbr-new -V 0 -s 44.1 - "$OUTF"<br />
id3 -t "$TITLE" -T "${TRACKNUMBER:-0}" -a "$ARTIST" -A "$ALBUM" -y "$DATE" -g "${GENRE:-12}" "$OUTF"<br />
done<br />
</pre><br />
<br />
Below is a modified version of the above script which:<br />
* adds an optional parameter (-d), which, if passed on the command line, causes each source FLAC file to be deleted after successful conversion;<br />
* changes the LAME encoding options as follows:<br />
** drops --vbr-new, as it is the default VBR behaviour as of LAME 3.98, and thus is automatically used when "-V 0" is used;<br />
** drops "-m j", as LAME defaults to the specified value (joint stereo) when using --vbr-new (see above);<br />
** drops "-q 0", as LAME defaults to this behaviour when using VBR;<br />
** drops "-s 44.1", as LAME detects the proper sample rate to use;<br />
** adds "--noreplaygain" (personal preference);<br />
* and uses LAME to write tags instead of the id3 package, which has the dual advantage of removing the need for an additional package in the tool chain and allowing the script to write both id3v1 and id3v2 tags (the id3 package does not support id3v2 tags).<br />
<br />
Now for the script:<br />
<br />
<pre><br />
#! /bin/sh<br />
<br />
for a in *.flac; do<br />
OUTF=${a%.flac}.mp3<br />
<br />
ARTIST=`metaflac "$a" --show-tag=ARTIST | sed s/.*=//g`<br />
TITLE=`metaflac "$a" --show-tag=TITLE | sed s/.*=//g`<br />
ALBUM=`metaflac "$a" --show-tag=ALBUM | sed s/.*=//g`<br />
GENRE=`metaflac "$a" --show-tag=GENRE | sed s/.*=//g`<br />
TRACKNUMBER=`metaflac "$a" --show-tag=TRACKNUMBER | sed s/.*=//g`<br />
DATE=`metaflac "$a" --show-tag=DATE | sed s/.*=//g`<br />
<br />
flac -c -d "$a" | lame --noreplaygain -V0 \<br />
--add-id3v2 --pad-id3v2 --ignore-tag-errors --tt "$TITLE" --tn "${TRACKNUMBER:-0}" \<br />
--ta "$ARTIST" --tl "$ALBUM" --ty "$DATE" --tg "${GENRE:-12}" \<br />
- "$OUTF"<br />
RESULT=$?<br />
if [ "$1" ] && [ "$1" = "-d" ] && [ $RESULT -eq 0 ]; then<br />
rm "$a"<br />
fi<br />
done<br />
</pre><br />
<br />
Alternatively, below is a script that will search for all FLAC audio files beyond where the script resides on your filesystem and convert them to MP3; including those pesky filenames with spaces.<br />
<br />
<pre><br />
#! /bin/bash<br />
<br />
find . -type f -name "*.flac" -print0 | while read -d $'\0' a<br />
<br />
do<br />
OUTF=${a%.flac}.mp3<br />
<br />
ARTIST=`metaflac "$a" --show-tag=ARTIST | sed s/.*=//g`<br />
TITLE=`metaflac "$a" --show-tag=TITLE | sed s/.*=//g`<br />
ALBUM=`metaflac "$a" --show-tag=ALBUM | sed s/.*=//g`<br />
GENRE=`metaflac "$a" --show-tag=GENRE | sed s/.*=//g`<br />
TRACKNUMBER=`metaflac "$a" --show-tag=TRACKNUMBER | sed s/.*=//g`<br />
DATE=`metaflac "$a" --show-tag=DATE | sed s/.*=//g`<br />
<br />
flac -c -d "$a" | lame -m j -q 0 --vbr-new -V 0 -s 44.1 - "$OUTF"<br />
id3 -t "$TITLE" -T "${TRACKNUMBER:-0}" -a "$ARTIST" -A "$ALBUM" -y "$DATE" -g "${GENRE:-12}" "$OUTF"<br />
done<br />
</pre><br />
<br />
Save the script as ''flac2mp3'' and make the script executable:<br />
<br />
<pre><br />
chmod a+x flac2mp3<br />
</pre><br />
<br />
As root, copy the script to /usr/local/bin (or anywhere else that is in your $PATH).<br />
<br />
<pre><br />
cp flac2mp3 /usr/local/bin<br />
</pre><br />
<br />
To make /usr/local/bin in your $PATH, do (as normal user):<br />
<br />
<pre><br />
PATH=$PATH:/usr/local/bin/<br />
</pre><br />
<br />
and then (as normal user):<br />
<pre><br />
nano .bashrc<br />
</pre><br />
<br />
and add ''export PATH=$PATH:/usr/local/bin/''<br />
<br />
====Usage====<br />
<br />
Open up a terminal and cd to the directory of .flac files that you wish to convert and enter ''flac2mp3''<br />
<br />
You'll see the verbose decoding/encoding process in the terminal which may take a few moments. <br />
<br />
Done.<br />
<br />
====Addendum====<br />
<br />
With a small modification the command file can be used to transcode the files into a new directory structure:<br />
<pre><br />
#! /bin/bash<br />
find "$1" -name *.flac -print0 | while read -d $'\0' IF<br />
do<br />
OF=$(echo "$IF" | sed -e 's/\.flac$/.mp3/g' -e "s,$1,$2,g")<br />
echo "$IF -> $OF"<br />
mkdir -p "${OF%/*}"<br />
<br />
ARTIST=`metaflac "$IF" --show-tag=ARTIST | sed s/.*=//g`<br />
TITLE=`metaflac "$IF" --show-tag=TITLE | sed s/.*=//g`<br />
ALBUM=`metaflac "$IF" --show-tag=ALBUM | sed s/.*=//g`<br />
GENRE=`metaflac "$IF" --show-tag=GENRE | sed s/.*=//g`<br />
TRACKNUMBER=`metaflac "$IF" --show-tag=TRACKNUMBER | sed s/.*=//g`<br />
DATE=`metaflac "$IF" --show-tag=DATE | sed s/.*=//g`<br />
<br />
flac -c -d "$IF" 2> /dev/null | lame -m j -q 0 --vbr-new -V 0 -s 44.1 - "$OF" 2> /dev/null<br />
id3 -t "$TITLE" -T "${TRACKNUMBER:-0}" -a "$ARTIST" -A "$ALBUM" -y "$DATE" -g "${GENRE:-12}" "$OF"<br />
done<br />
</pre><br />
if saved in flac2mp3 this can be used as follows<br />
<pre>./flac2mp3 /srv/media/music /srv/media/music-lofi</pre><br />
which will take the directory structure under /srv/media/music and transcode its content into /srv/media/music-lofi.<br />
<br />
With some more tweaks the script will support directories that contain '.' (dots) somewhere in the path and<br />
executing the script from folders that contain 'flac' files<br />
<br />
Also made specifying an alternate folder location optional<br />
<pre><br />
#! /bin/bash<br />
find "$1" -name "*.flac" -print0 | while read -d $'\0' IF<br />
do<br />
if [ "$2" != "" ]<br />
then<br />
OF="${IF%.flac}.mp3"<br />
OF="$2/${OF##*/}"<br />
else<br />
OF="${IF%.flac}.mp3"<br />
fi<br />
echo "$IF -> $OF"<br />
mkdir -p "${OF%/*}"<br />
<br />
ARTIST=`metaflac "$IF" --show-tag=ARTIST | sed s/.*=//g`<br />
TITLE=`metaflac "$IF" --show-tag=TITLE | sed s/.*=//g`<br />
ALBUM=`metaflac "$IF" --show-tag=ALBUM | sed s/.*=//g`<br />
GENRE=`metaflac "$IF" --show-tag=GENRE | sed s/.*=//g`<br />
TRACKNUMBER=`metaflac "$IF" --show-tag=TRACKNUMBER | sed s/.*=//g`<br />
DATE=`metaflac "$IF" --show-tag=DATE | sed s/.*=//g`<br />
<br />
flac -c -d "$IF" 2> /dev/null | lame -m j -q 0 --vbr-new -V 0 -s 44.1 - "$OF" 2> /dev/null<br />
id3 -t "$TITLE" -T "${TRACKNUMBER:-0}" -a "$ARTIST" -A "$ALBUM" -y "$DATE" -g "${GENRE:-12}" "$OF"<br />
done<br />
</pre><br />
if saved in flac2mp3 this can be used as follows<br />
<pre>./flac2mp3 /srv/media.store/music /srv/media/music-lofi</pre><br />
or<br />
<pre>./flac2mp3 /srv/media.store/music </pre><br />
<br />
=====Nautilus-scripts=====<br />
<br />
Here's a well-written version of "flac2mp3" script which will run either from command line or, if you copy it into <tt>~/.gnome2/nautilus-scripts</tt>, it will appear in the right-click menu in Nautilus:<br />
<pre><br />
#!/bin/bash<br />
#<br />
# Copyright 2008 Octavio Ruiz<br />
# Distributed under the terms of the GNU General Public License v3<br />
# $Header: $<br />
#<br />
# Yet Another FLAC to MP3 script<br />
#<br />
# Author:<br />
# Octavio Ruiz (Ta^3) <tacvbo@tacvbo.net><br />
# Thanks:<br />
# Those comments at:<br />
# http://www.linuxtutorialblog.com/post/solution-converting-flac-to-mp3<br />
# WebPage:<br />
# https://github.com/tacvbo/yaflac2mp3/tree<br />
#<br />
# This program is distributed in the hope that it will be useful,<br />
# but WITHOUT ANY WARRANTY. YOU USE AT YOUR OWN RISK. THE AUTHOR<br />
# WILL NOT BE LIABLE FOR DATA LOSS, DAMAGES, LOSS OF PROFITS OR ANY<br />
# OTHER KIND OF LOSS WHILE USING OR MISUSING THIS SOFTWARE.<br />
# See the GNU General Public License for more details.<br />
#<br />
# Modified by woohoo<br />
#<br />
# you need zenity package for notifications.<br />
# please note that you can put this script in ~/.gnome2/nautilus-scripts<br />
# and it will show up in right-click menu in any folder in gnome.<br />
#<br />
# modify the lame options to your preference example change -b 320 to -b 128 or -b 192 or -b 256<br />
# LAME_OPTS="--vbr-new -V 0 -b 256"<br />
# LAME_OPTS="-V 0 --vbr-new"<br />
<br />
LAME_OPTS="-b 320 -h --cbr"<br />
<br />
old_IFS=${IFS}<br />
IFS='<br />
'<br />
<br />
# when running from nautilus-scripts, it useful to find the current folder<br />
base="`echo $NAUTILUS_SCRIPT_CURRENT_URI | cut -d'/' -f3- | sed 's/%20/ /g'`"<br />
if [ -z "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" ]; then<br />
dir="$base"<br />
else<br />
while [ ! -z "$1" -a ! -d "$base/$1" ]; do shift; done<br />
dir="$base/$1"<br />
fi<br />
<br />
if [ "$dir" != "" ]; then<br />
cd "$dir"<br />
fi<br />
<br />
id3v2=$(which id3v2)<br />
<br />
files=`find . -type f -regex '^.+\.flac$' | sort`<br />
<br />
declare -i nn=0<br />
for file in ${files}<br />
do<br />
fn=$(readlink -f "$file")<br />
vars=( `metaflac --no-utf8-convert --export-tags-to=- "${fn}"` )<br />
<br />
for N_vars in ${!vars[@]}<br />
do<br />
export "$(echo "${vars[${N_vars}]%=*}" | tr [:upper:] [:lower:])=${vars[${N_vars}]#*=}"<br />
done<br />
<br />
dest=`echo "$fn"|sed -e 's/\.flac$/\.mp3/'`<br />
<br />
flac -dc "$fn" |\<br />
lame --ignore-tag-errors --add-id3v2 ${LAME_OPTS} \<br />
${artist:+--ta} ${artist} \<br />
${tracknumber:+--tn} ${tracknumber} \<br />
${title:+--tt} ${title} \<br />
${album:+--tl} ${album} \<br />
${date:+--ty} ${date} \<br />
${genre:+--tg} ${genre} \<br />
${comment:+--tc} ${comment} \<br />
- $dest<br />
<br />
[[ -x ${id3v2} ]] && ${id3v2} \<br />
${artist:+--artist} ${artist} \<br />
${tracknumber:+--track} ${tracknumber} \<br />
${title:+--song} ${title} \<br />
${album:+--album} ${album} \<br />
${date:+--year} ${date} \<br />
${genre:+--genre} ${genre} \<br />
${comment:+--comment} ${comment} \<br />
$dest<br />
<br />
let nn=nn+1<br />
done<br />
<br />
zenity --notification --text "Finished converting flac to mp3.${IFS}Processed ${nn} files."<br />
#zenity --info --text "Done!"<br />
IFS=${old_IFS}<br />
<br />
</pre><br />
<br />
More such conversion scripts on pastebin.com [http://pastebin.com/u/woohoo here].<br />
<br />
==More generic solution==<br />
<br />
See [[Convert_Any_To_Mp3]] for a more generic solution if you want to transform to mp3 all kind of audio formats supported by both mplayer and mutagen.</div>Holomorphhttps://wiki.archlinux.org/index.php?title=Convert_FLAC_to_MP3&diff=265474Convert FLAC to MP32013-07-08T18:46:35Z<p>Holomorph: fix display title</p>
<hr />
<div>[[Category:Audio/Video]]<br />
[[Category:Scripts]]<br />
{{DISPLAYTITLE:Convert FLAC to MP3}}<br />
{{Tip|You can use {{AUR|flac2mp3-bash}} script from aur to convert Flac to Mp3 easily.}}<br />
<br />
==Introduction==<br />
Here is a script that will convert FLAC to MP3 via the commandline. <br />
<br />
Essentially, the .flac files within a directory will be decompressed to .wav and then the resulting .wav files will be encoded to .mp3 using the latest LAME switches for encodings (''-V 0 --vbr-new''). The ID3 tags of the original .flac files will be passed to the resulting .mp3 files.<br />
<br />
The original .flac files will not be harmed and the resulting .mp3s will be in the same directory. All other files in the directory (.nfo, images, .sfv, etc) will be ignored and unharmed. <br />
<br />
For more information on LAME switches/settings such as V0, visit [http://wiki.hydrogenaudio.org/index.php?title=LAME Hydrogenaudio LAME Wiki]. V0 is roughly equivalent to ''--preset extreme'' which results in a variable bitrate usually between 220-260. The audio of a V0 is transparent, meaning one cannot tell the difference between the lossy file and the original source (compact disc/lossless), but yet the file size is a quite reasonable. <br />
<br />
More information on flac: [http://wiki.hydrogenaudio.org/index.php?title=Flac FLAC]<br />
<br />
===Installation===<br />
<br />
First you need to install the following packages: flac, lame, and id3<br />
<br />
<pre><br />
pacman -S flac lame id3<br />
</pre><br />
<br />
Once those are installed, copy the following script into your preferred editor:<br />
<br />
<pre><br />
#! /bin/sh<br />
<br />
for a in *.flac; do<br />
OUTF=${a%.flac}.mp3<br />
<br />
ARTIST=$(metaflac "$a" --show-tag=ARTIST | sed s/.*=//g)<br />
TITLE=$(metaflac "$a" --show-tag=TITLE | sed s/.*=//g)<br />
ALBUM=$(metaflac "$a" --show-tag=ALBUM | sed s/.*=//g)<br />
GENRE=$(metaflac "$a" --show-tag=GENRE | sed s/.*=//g)<br />
TRACKNUMBER=$(metaflac "$a" --show-tag=TRACKNUMBER | sed s/.*=//g)<br />
DATE=$(metaflac "$a" --show-tag=DATE | sed s/.*=//g)<br />
<br />
flac -c -d "$a" | lame -m j -q 0 --vbr-new -V 0 -s 44.1 - "$OUTF"<br />
id3 -t "$TITLE" -T "${TRACKNUMBER:-0}" -a "$ARTIST" -A "$ALBUM" -y "$DATE" -g "${GENRE:-12}" "$OUTF"<br />
done<br />
</pre><br />
<br />
Below is a modified version of the above script which:<br />
* adds an optional parameter (-d), which, if passed on the command line, causes each source FLAC file to be deleted after successful conversion;<br />
* changes the LAME encoding options as follows:<br />
** drops --vbr-new, as it is the default VBR behaviour as of LAME 3.98, and thus is automatically used when "-V 0" is used;<br />
** drops "-m j", as LAME defaults to the specified value (joint stereo) when using --vbr-new (see above);<br />
** drops "-q 0", as LAME defaults to this behaviour when using VBR;<br />
** drops "-s 44.1", as LAME detects the proper sample rate to use;<br />
** adds "--noreplaygain" (personal preference);<br />
* and uses LAME to write tags instead of the id3 package, which has the dual advantage of removing the need for an additional package in the tool chain and allowing the script to write both id3v1 and id3v2 tags (the id3 package does not support id3v2 tags).<br />
<br />
Now for the script:<br />
<br />
<pre><br />
#! /bin/sh<br />
<br />
for a in *.flac; do<br />
OUTF=${a%.flac}.mp3<br />
<br />
ARTIST=`metaflac "$a" --show-tag=ARTIST | sed s/.*=//g`<br />
TITLE=`metaflac "$a" --show-tag=TITLE | sed s/.*=//g`<br />
ALBUM=`metaflac "$a" --show-tag=ALBUM | sed s/.*=//g`<br />
GENRE=`metaflac "$a" --show-tag=GENRE | sed s/.*=//g`<br />
TRACKNUMBER=`metaflac "$a" --show-tag=TRACKNUMBER | sed s/.*=//g`<br />
DATE=`metaflac "$a" --show-tag=DATE | sed s/.*=//g`<br />
<br />
flac -c -d "$a" | lame --noreplaygain -V0 \<br />
--add-id3v2 --pad-id3v2 --ignore-tag-errors --tt "$TITLE" --tn "${TRACKNUMBER:-0}" \<br />
--ta "$ARTIST" --tl "$ALBUM" --ty "$DATE" --tg "${GENRE:-12}" \<br />
- "$OUTF"<br />
RESULT=$?<br />
if [ "$1" ] && [ "$1" = "-d" ] && [ $RESULT -eq 0 ]; then<br />
rm "$a"<br />
fi<br />
done<br />
</pre><br />
<br />
Alternatively, below is a script that will search for all FLAC audio files beyond where the script resides on your filesystem and convert them to MP3; including those pesky filenames with spaces.<br />
<br />
<pre><br />
#! /bin/bash<br />
<br />
find . -type f -name "*.flac" -print0 | while read -d $'\0' a<br />
<br />
do<br />
OUTF=${a%.flac}.mp3<br />
<br />
ARTIST=`metaflac "$a" --show-tag=ARTIST | sed s/.*=//g`<br />
TITLE=`metaflac "$a" --show-tag=TITLE | sed s/.*=//g`<br />
ALBUM=`metaflac "$a" --show-tag=ALBUM | sed s/.*=//g`<br />
GENRE=`metaflac "$a" --show-tag=GENRE | sed s/.*=//g`<br />
TRACKNUMBER=`metaflac "$a" --show-tag=TRACKNUMBER | sed s/.*=//g`<br />
DATE=`metaflac "$a" --show-tag=DATE | sed s/.*=//g`<br />
<br />
flac -c -d "$a" | lame -m j -q 0 --vbr-new -V 0 -s 44.1 - "$OUTF"<br />
id3 -t "$TITLE" -T "${TRACKNUMBER:-0}" -a "$ARTIST" -A "$ALBUM" -y "$DATE" -g "${GENRE:-12}" "$OUTF"<br />
done<br />
</pre><br />
<br />
Save the script as ''flac2mp3'' and make the script executable:<br />
<br />
<pre><br />
chmod a+x flac2mp3<br />
</pre><br />
<br />
As root, copy the script to /usr/local/bin (or anywhere else that is in your $PATH).<br />
<br />
<pre><br />
cp flac2mp3 /usr/local/bin<br />
</pre><br />
<br />
To make /usr/local/bin in your $PATH, do (as normal user):<br />
<br />
<pre><br />
PATH=$PATH:/usr/local/bin/<br />
</pre><br />
<br />
and then (as normal user):<br />
<pre><br />
nano .bashrc<br />
</pre><br />
<br />
and add ''export PATH=$PATH:/usr/local/bin/''<br />
<br />
====Usage====<br />
<br />
Open up a terminal and cd to the directory of .flac files that you wish to convert and enter ''flac2mp3''<br />
<br />
You'll see the verbose decoding/encoding process in the terminal which may take a few moments. <br />
<br />
Done.<br />
<br />
====Addendum====<br />
<br />
With a small modification the command file can be used to transcode the files into a new directory structure:<br />
<pre><br />
#! /bin/bash<br />
find "$1" -name *.flac -print0 | while read -d $'\0' IF<br />
do<br />
OF=$(echo "$IF" | sed -e 's/\.flac$/.mp3/g' -e "s,$1,$2,g")<br />
echo "$IF -> $OF"<br />
mkdir -p "${OF%/*}"<br />
<br />
ARTIST=`metaflac "$IF" --show-tag=ARTIST | sed s/.*=//g`<br />
TITLE=`metaflac "$IF" --show-tag=TITLE | sed s/.*=//g`<br />
ALBUM=`metaflac "$IF" --show-tag=ALBUM | sed s/.*=//g`<br />
GENRE=`metaflac "$IF" --show-tag=GENRE | sed s/.*=//g`<br />
TRACKNUMBER=`metaflac "$IF" --show-tag=TRACKNUMBER | sed s/.*=//g`<br />
DATE=`metaflac "$IF" --show-tag=DATE | sed s/.*=//g`<br />
<br />
flac -c -d "$IF" 2> /dev/null | lame -m j -q 0 --vbr-new -V 0 -s 44.1 - "$OF" 2> /dev/null<br />
id3 -t "$TITLE" -T "${TRACKNUMBER:-0}" -a "$ARTIST" -A "$ALBUM" -y "$DATE" -g "${GENRE:-12}" "$OF"<br />
done<br />
</pre><br />
if saved in flac2mp3 this can be used as follows<br />
<pre>./flac2mp3 /srv/media/music /srv/media/music-lofi</pre><br />
which will take the directory structure under /srv/media/music and transcode its content into /srv/media/music-lofi.<br />
<br />
With some more tweaks the script will support directories that contain '.' (dots) somewhere in the path and<br />
executing the script from folders that contain 'flac' files<br />
<br />
Also made specifying an alternate folder location optional<br />
<pre><br />
#! /bin/bash<br />
find "$1" -name "*.flac" -print0 | while read -d $'\0' IF<br />
do<br />
if [ "$2" != "" ]<br />
then<br />
OF="${IF%.flac}.mp3"<br />
OF="$2/${OF##*/}"<br />
else<br />
OF="${IF%.flac}.mp3"<br />
fi<br />
echo "$IF -> $OF"<br />
mkdir -p "${OF%/*}"<br />
<br />
ARTIST=`metaflac "$IF" --show-tag=ARTIST | sed s/.*=//g`<br />
TITLE=`metaflac "$IF" --show-tag=TITLE | sed s/.*=//g`<br />
ALBUM=`metaflac "$IF" --show-tag=ALBUM | sed s/.*=//g`<br />
GENRE=`metaflac "$IF" --show-tag=GENRE | sed s/.*=//g`<br />
TRACKNUMBER=`metaflac "$IF" --show-tag=TRACKNUMBER | sed s/.*=//g`<br />
DATE=`metaflac "$IF" --show-tag=DATE | sed s/.*=//g`<br />
<br />
flac -c -d "$IF" 2> /dev/null | lame -m j -q 0 --vbr-new -V 0 -s 44.1 - "$OF" 2> /dev/null<br />
id3 -t "$TITLE" -T "${TRACKNUMBER:-0}" -a "$ARTIST" -A "$ALBUM" -y "$DATE" -g "${GENRE:-12}" "$OF"<br />
done<br />
</pre><br />
if saved in flac2mp3 this can be used as follows<br />
<pre>./flac2mp3 /srv/media.store/music /srv/media/music-lofi</pre><br />
or<br />
<pre>./flac2mp3 /srv/media.store/music </pre><br />
<br />
=====Nautilus-scripts=====<br />
<br />
Here's a well-written version of "flac2mp3" script which will run either from command line or, if you copy it into <tt>~/.gnome2/nautilus-scripts</tt>, it will appear in the right-click menu in Nautilus:<br />
<pre><br />
#!/bin/bash<br />
#<br />
# Copyright 2008 Octavio Ruiz<br />
# Distributed under the terms of the GNU General Public License v3<br />
# $Header: $<br />
#<br />
# Yet Another FLAC to MP3 script<br />
#<br />
# Author:<br />
# Octavio Ruiz (Ta^3) <tacvbo@tacvbo.net><br />
# Thanks:<br />
# Those comments at:<br />
# http://www.linuxtutorialblog.com/post/solution-converting-flac-to-mp3<br />
# WebPage:<br />
# https://github.com/tacvbo/yaflac2mp3/tree<br />
#<br />
# This program is distributed in the hope that it will be useful,<br />
# but WITHOUT ANY WARRANTY. YOU USE AT YOUR OWN RISK. THE AUTHOR<br />
# WILL NOT BE LIABLE FOR DATA LOSS, DAMAGES, LOSS OF PROFITS OR ANY<br />
# OTHER KIND OF LOSS WHILE USING OR MISUSING THIS SOFTWARE.<br />
# See the GNU General Public License for more details.<br />
#<br />
# Modified by woohoo<br />
#<br />
# you need zenity package for notifications.<br />
# please note that you can put this script in ~/.gnome2/nautilus-scripts<br />
# and it will show up in right-click menu in any folder in gnome.<br />
#<br />
# modify the lame options to your preference example change -b 320 to -b 128 or -b 192 or -b 256<br />
# LAME_OPTS="--vbr-new -V 0 -b 256"<br />
# LAME_OPTS="-V 0 --vbr-new"<br />
<br />
LAME_OPTS="-b 320 -h --cbr"<br />
<br />
old_IFS=${IFS}<br />
IFS='<br />
'<br />
<br />
# when running from nautilus-scripts, it useful to find the current folder<br />
base="`echo $NAUTILUS_SCRIPT_CURRENT_URI | cut -d'/' -f3- | sed 's/%20/ /g'`"<br />
if [ -z "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" ]; then<br />
dir="$base"<br />
else<br />
while [ ! -z "$1" -a ! -d "$base/$1" ]; do shift; done<br />
dir="$base/$1"<br />
fi<br />
<br />
if [ "$dir" != "" ]; then<br />
cd "$dir"<br />
fi<br />
<br />
id3v2=$(which id3v2)<br />
<br />
files=`find . -type f -regex '^.+\.flac$' | sort`<br />
<br />
declare -i nn=0<br />
for file in ${files}<br />
do<br />
fn=$(readlink -f "$file")<br />
vars=( `metaflac --no-utf8-convert --export-tags-to=- "${fn}"` )<br />
<br />
for N_vars in ${!vars[@]}<br />
do<br />
export "$(echo "${vars[${N_vars}]%=*}" | tr [:upper:] [:lower:])=${vars[${N_vars}]#*=}"<br />
done<br />
<br />
dest=`echo "$fn"|sed -e 's/\.flac$/\.mp3/'`<br />
<br />
flac -dc "$fn" |\<br />
lame --ignore-tag-errors --add-id3v2 ${LAME_OPTS} \<br />
${artist:+--ta} ${artist} \<br />
${tracknumber:+--tn} ${tracknumber} \<br />
${title:+--tt} ${title} \<br />
${album:+--tl} ${album} \<br />
${date:+--ty} ${date} \<br />
${genre:+--tg} ${genre} \<br />
${comment:+--tc} ${comment} \<br />
- $dest<br />
<br />
[[ -x ${id3v2} ]] && ${id3v2} \<br />
${artist:+--artist} ${artist} \<br />
${tracknumber:+--track} ${tracknumber} \<br />
${title:+--song} ${title} \<br />
${album:+--album} ${album} \<br />
${date:+--year} ${date} \<br />
${genre:+--genre} ${genre} \<br />
${comment:+--comment} ${comment} \<br />
$dest<br />
<br />
let nn=nn+1<br />
done<br />
<br />
zenity --notification --text "Finished converting flac to mp3.${IFS}Processed ${nn} files."<br />
#zenity --info --text "Done!"<br />
IFS=${old_IFS}<br />
<br />
</pre><br />
<br />
More such conversion scripts on pastebin.com [http://pastebin.com/u/woohoo here].<br />
<br />
==More generic solution==<br />
<br />
See [[Convert_Any_To_Mp3]] for a more generic solution if you want to transform to mp3 all kind of audio formats supported by both mplayer and mutagen.</div>Holomorphhttps://wiki.archlinux.org/index.php?title=Tcplay&diff=265473Tcplay2013-07-08T18:44:54Z<p>Holomorph: </p>
<hr />
<div>[[Category:Security]]<br />
[[Category:File systems]]<br />
[[de:tcplay]]<br />
{{Article summary start}}<br />
{{Article summary text|Setup and usage of tcplay.}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|Disk Encryption}}<br />
{{Article summary wiki|TrueCrypt}}<br />
{{Article summary end}}<br />
{{DISPLAYTITLE:tcplay}}<br />
'''tcplay''' is a free (BSD-licensed), pretty much fully featured (including<br />
multiple keyfiles, cipher cascades, etc.) and stable TrueCrypt implementation.<br />
<br />
Source: [https://github.com/bwalex/tc-play github project home]<br />
<br />
== Installation ==<br />
Install {{AUR|tcplay}} or {{AUR|tcplay-git}} from the AUR.<br />
<br />
== Encrypting a file as a virtual volume ==<br />
<br />
Invoke <br />
<br />
$ losetup -f<br />
<br />
to find the first unused loopback device; in this example, {{Ic|/dev/loop0}}.<br />
<br />
{{Note|As of udev 181-5, the {{Ic|loop}} device module is no longer auto-loaded.}}<br />
<br />
Create a new container {{Ic|foo.tc}}, 20M in size for instance, in the working<br />
directory:<br />
<br />
# dd if=/dev/zero of=foo.tc bs=1 count=0 seek=20M<br />
# losetup /dev/loop0 foo.tc<br />
# tcplay -c -d /dev/loop0 -a whirlpool -b AES-256-XTS<br />
<br />
Enter a secure password for the volume, and confirm the query to overwrite<br />
{{Ic|foo.tc}} with the new volume. tcplay will then write random data into the<br />
volume. Map the volume and create a filesystem on it in order to mount<br />
<br />
# tcplay -m foo.tc -d /dev/loop0<br />
# mkfs.ext4 /dev/mapper/foo.tc<br />
# mount /dev/mapper/foo.tc /mnt/truecrypt/<br />
<br />
To unset the container,<br />
<br />
# umount /mnt/truecrypt<br />
# dmsetup remove foo.tc<br />
# losetup -d /dev/loop0<br />
<br />
==Mounting an existing container for a user==<br />
<br />
Consider {{Ic|/dev/loop0}} the first unused loop device, {{Ic|foo.tc}} the<br />
TrueCrypt container, {{Ic|/home/you/truecrypt/}} the desired mount point. The<br />
user {{Ic|you}} in this example has {{Ic|uid&#61;1000}} and {{Ic|gid&#61;100}}. The<br />
steps for mounting the container as a virtual volume are:<br />
<br />
# Associate loop device with the container<br />
# Map the container to the loop device<br />
# Mount the container in the filesystem<br />
<br />
The following commands perform the above actions.<br />
<br />
# losetup /dev/loop0 foo.tc<br />
# tcplay -m foo.tc -d /dev/loop0<br />
# mount -o nosuid,uid=1000,gid=100 /dev/mapper/foo.tc /home/you/truecrypt/<br />
<br />
To reverse them:<br />
<br />
# umount /home/you/truecrypt/<br />
# dmsetup remove foo.tc<br />
# losetup -d /dev/loop0<br />
<br />
==Related links==<br />
* [http://leaf.dragonflybsd.org/cgi/web-man?command=tcplay&section=8 Manual page for tcplay]<br />
* [http://jasonwryan.com/blog/2013/01/10/truecrypt/ Jason Ryan: Replacing TrueCrypt]<br />
* [http://www.truecrypt.org/ TrueCrypt Homepage]<br />
* [http://en.gentoo-wiki.com/wiki/TrueCrypt HOWTO: Truecrypt Gentoo wiki]<br />
* [http://www.howtoforge.com/truecrypt_data_encryption Truecrypt Tutorial on HowToForge]<br />
* [http://www.privacylover.com/encryption/analysis-is-there-a-backdoor-in-truecrypt-is-truecrypt-a-cia-honeypot/ There is a good chance the CIA has a backdoor?] (via [https://secure.wikimedia.org/wikipedia/en/wiki/Truecrypt wp])</div>Holomorphhttps://wiki.archlinux.org/index.php?title=Power_saving&diff=261780Power saving2013-06-08T07:06:31Z<p>Holomorph: merge kernel parms</p>
<hr />
<div>{{Article summary start}}<br />
{{Article summary text|Configuration and tools for saving power.}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|CPU Frequency Scaling}}<br />
{{Article summary wiki|Kernel modules}}<br />
{{Article summary wiki|Hybrid graphics}}<br />
{{Article summary wiki|Sysctl}}<br />
{{Article summary wiki|udev}}<br />
{{Article summary end}}<br />
<br />
[[Category:Power management]]<br />
This article covers the configuration needed to turn on power saving features. Almost all of the features listed here are worth using whether or not the computer is on AC or battery power. Most have negligible performance impact and are just not enabled by default because of commonly broken hardware/drivers. Reducing power usage means reducing heat, which can even lead to higher performance on a modern Intel or AMD CPU, thanks to [[Wikipedia:Intel Turbo Boost|dynamic overclocking]].<br />
<br />
== Configuration ==<br />
<br />
If you would like to create your own scripts and power saving settings such as by udev rules you can take the following settings as a reference.<br />
<br />
=== Audio ===<br />
<br />
By default, audio power saving is turned off by most drivers. It can be enabled by setting the {{ic|power_save}} parameter; a time (in seconds) to go into idle mode. To idle the audio card after one second, create<br />
<br />
{{hc|/etc/modprobe.d/audio_powersave.conf|2=options snd_hda_intel power_save=1}}<br />
<br />
for Intel, or use<br />
<br />
options snd_ac97_codec power_save=1<br />
<br />
for ac97.<br />
<br />
{{Note|Toggling the audio card's power state can cause a popping sound or noticeable latency on some broken hardware.}}<br />
<br />
=== Active state power management ===<br />
<br />
To verify that [[Wikipedia:Active State Power Management|ASPM]] is enabled:<br />
<br />
{{hc|$ cat /sys/module/pcie_aspm/parameters/policy|[default] performance powersave}}<br />
<br />
Either {{ic|[default]}} or {{ic|[powersave]}} means you do not need to force it on. Otherwise, it's either unsupported or broken on your hardware, or has to be forced on with {{ic|1=pcie_aspm=force}} on the [[kernel line]].<br />
<br />
{{Warning|<br />
* Forcing on ASPM can cause a freeze/panic, so make sure you have a way to undo the option if it doesn't work.<br />
* On systems that don't support it forcing on ASPM can even increase power consumption.}}<br />
<br />
=== Backlight ===<br />
<br />
When system starts, screen backlight is set to maximum by default. This can be fixed by specifying backlight level in the following udev rule:<br />
<br />
{{hc|/etc/udev/rules.d/backlight.rules|<nowiki><br />
## SET BACKLIGHT<br />
SUBSYSTEM=="backlight", ACTION=="add", KERNEL=="acpi_video0", ATTR{brightness}="1"<br />
</nowiki>}}<br />
<br />
=== Bluetooth ===<br />
<br />
{{expansion|reason=The device should likely be disabled with hciconfig first.}}<br />
[[Kernel_modules#Blacklisting|Blacklist]] the {{ic|hci_usb}} module if the driver is loaded automatically.<br />
<br />
Alternatively, [[Kernel_modules#Blacklisting|blacklist]] the {{ic|btusb}} and {{ic|bluetooth}} modules.<br />
<br />
Another variant is to {{pkg|rfkill}} it:<br />
# rfkill block bluetooth<br />
<br />
Or with udev rule:<br />
{{hc|/etc/udev/rules.d/bt.rules|<nowiki><br />
## DISABLE BLUETOOTH<br />
SUBSYSTEM=="rfkill", ATTR{type}=="bluetooth", ATTR{state}="0"<br />
</nowiki>}}<br />
<br />
=== Web-Camera ===<br />
<br />
If you won't use integrated web camera then [[Kernel_modules#Blacklisting|blacklist]] the {{ic|uvcvideo}} module.<br />
<br />
=== Kernel parameters ===<br />
<br />
This section uses configs in {{ic|/etc/sysctl.d/}}, which is ''"a drop-in directory for kernel sysctl parameters, extending what you can already do with /etc/sysctl.conf."'' See [http://0pointer.de/blog/projects/the-new-configuration-files The New Configuration Files] and more specifically [http://0pointer.de/public/systemd-man/sysctl.d.html systemd's sysctl.d man page] for more information.<br />
<br />
==== Disabling NMI watchdog ====<br />
<br />
The [[Wikipedia:Non-maskable interrupt|NMI]] watchdog is a debugging feature to catch hardware hangs and cause a kernel panic. On some systems it can generate a lot of interrupts, causing a noticeable increase in power usage.<br />
<br />
{{hc|/etc/sysctl.d/disable_watchdog.conf|2=kernel.nmi_watchdog = 0}}<br />
<br />
or add {{ic|1=nmi_watchdog=0}} to the [[kernel parameter|kernel line]] to disable it completely from early boot.<br />
<br />
==== Writeback Time ====<br />
Increasing the VM dirty writeback time can help to aggregate I/O together - reducing disk writes, and decreasing power usage:<br />
<br />
vm.dirty_writeback_centisecs = 1500<br />
<br />
To do the same for journal commits with ext4 and some other filesystems, use {{ic|1=commit=15}} as a parameter in [[fstab]] or with the {{ic|rootflags}} [[kernel parameter]].<br />
<br />
==== Laptop Mode ====<br />
<br />
See the [https://www.kernel.org/doc/Documentation/laptops/laptop-mode.txt kernel documentation] on the laptop mode 'knob.' ''"A sensible value for the knob is 5 seconds."''<br />
<br />
vm.laptop_mode = 5<br />
<br />
=== Network interfaces ===<br />
<br />
[[Wikipedia:Wake-on-LAN|Wake-on-LAN]] can be a useful feature, but if you're not making use of it then it's simply draining extra power waiting for a magic packet while in suspend. Disabling for all Ethernet interfaces:<br />
<br />
{{hc|/etc/udev/rules.d/70-disable_wol.rules|2=ACTION=="add", SUBSYSTEM=="net", KERNEL=="eth*" RUN+="/usr/bin/ethtool -s %k wol d"}}<br />
<br />
To enable powersaving on all wireless interfaces:<br />
<br />
{{hc|/etc/udev/rules.d/70-wifi-powersave.rules|2=ACTION=="add", SUBSYSTEM=="net", KERNEL=="wlan*" RUN+="/usr/sbin/iw dev %k set power_save on"}}<br />
<br />
In these examples, {{ic|%k}} is a specifier for the kernel name of the matched device. For example, if it finds that the rule is applicable to {{ic|wlan0}}, the {{ic|%k}} specifier will be replaced ith {{ic|wlan0}}. To apply the rules to only a particular interface, just replace the pattern {{ic|eth*}} and specifier {{ic|%k}} with the desired interface name. For more information, see [http://www.reactivated.net/writing_udev_rules.html Writing udev rules].<br />
<br />
In this case, the name of the configuration file is important. Due to the introduction of [[Network_Configuration#Device_names|persistent device names]] via {{ic|80-net-name-slot.rules}} in systemd v197, it is important that the network powersave rules are named lexicographically before {{ic|80-net-name-slot.rules}}, so that they are applied before the devices are named e.g. {{ic|enp2s0}}.<br />
<br />
=== PCI Runtime Power Management ===<br />
<br />
{{hc|/etc/udev/rules.d/pci_pm.rules|2=ACTION=="add", SUBSYSTEM=="pci", ATTR{power/control}="auto"}}<br />
<br />
=== SATA Active Link Power Management ===<br />
<br />
{{Note|This adds latency when accessing a drive that has been idle, so it's one of the few settings that may be worth toggling based on whether you're on AC power.}}<br />
{{hc|/etc/udev/rules.d/hd_power_save.rules|2=SUBSYSTEM=="scsi_host", KERNEL=="host*", ATTR{link_power_management_policy}="min_power"}}<br />
<br />
=== USB Autosuspend ===<br />
<br />
To enable USB autosuspend after 2 seconds of inactivity:<br />
{{hc|/etc/udev/rules.d/usb_power_save.rules|2=ACTION=="add", SUBSYSTEM=="usb", TEST=="power/control" ATTR{power/control}="auto"<br />
ACTION=="add", SUBSYSTEM=="usb", TEST=="power/autosuspend" ATTR{power/autosuspend}="2"}}<br />
<br />
=== Device Power Management ===<br />
<br />
{{accuracy|reason=Should be done with a udev rule.}}<br />
<br />
echo auto | tee /sys/bus/i2c/devices/*/power/control > /dev/null<br />
echo auto | tee /sys/bus/spi/devices/*/power/control > /dev/null<br />
<br />
== Tools and scripts ==<br />
<br />
=== Packages ===<br />
<br />
There are many scripts and tools which make use of the various settings described in the previous sections. These are notably:<br />
<br />
* [[TLP]]<br />
* [[Powerdown]]<br />
* {{AUR|powerconf}}<br />
* {{AUR|ftw-git}}<br />
* [[Laptop Mode Tools]]<br />
* [[pm-utils]]<br />
<br />
If you do not want to take care of the settings by yourself it is recommended to use these tools. But be aware of running only '''one''' of these tools to avoid possible conflicts as they all work more or less similar.<br />
<br />
=== Print power settings ===<br />
<br />
This script prints power settings and a variety of other properties for USB and PCI devices. Note that root permissions are needed to see all settings.<br />
<br />
{{bc|<nowiki>#!/bin/bash<br />
<br />
for i in $(find /sys/devices -name "bMaxPower")<br />
do<br />
busdir=${i%/*}<br />
busnum=$(<$busdir/busnum)<br />
devnum=$(<$busdir/devnum)<br />
title=$(lsusb -s $busnum:$devnum)<br />
<br />
printf "\n\n+++ %s\n -%s\n" "$title" "$busdir"<br />
<br />
for ff in $(find $busdir/power -type f ! -empty 2>/dev/null)<br />
do<br />
v=$(cat $ff 2>/dev/null|tr -d "\n")<br />
[[ ${#v} -gt 0 ]] && echo -e " ${ff##*/}=$v";<br />
v=;<br />
done | sort -g;<br />
done;<br />
<br />
printf "\n\n\n+++ %s\n" "Kernel Modules"<br />
for mod in $(lspci -k | sed -n '/in use:/s,^.*: ,,p' | sort -u)<br />
do<br />
echo "+ $mod";<br />
systool -v -m $mod 2> /dev/null | sed -n "/Parameters:/,/^$/p";<br />
done</nowiki>}}</div>Holomorphhttps://wiki.archlinux.org/index.php?title=Power_saving&diff=261776Power saving2013-06-08T06:46:19Z<p>Holomorph: /* Network interfaces */</p>
<hr />
<div>{{Article summary start}}<br />
{{Article summary text|Configuration and tools for saving power.}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|CPU Frequency Scaling}}<br />
{{Article summary wiki|Kernel modules}}<br />
{{Article summary wiki|Hybrid graphics}}<br />
{{Article summary wiki|Sysctl}}<br />
{{Article summary wiki|udev}}<br />
{{Article summary end}}<br />
<br />
[[Category:Power management]]<br />
This article covers the configuration needed to turn on power saving features. Almost all of the features listed here are worth using whether or not the computer is on AC or battery power. Most have negligible performance impact and are just not enabled by default because of commonly broken hardware/drivers. Reducing power usage means reducing heat, which can even lead to higher performance on a modern Intel or AMD CPU, thanks to [[Wikipedia:Intel Turbo Boost|dynamic overclocking]].<br />
<br />
== Configuration ==<br />
<br />
If you would like to create your own scripts and power saving settings such as by udev rules you can take the following settings as a reference.<br />
<br />
=== Audio ===<br />
<br />
By default, audio power saving is turned off by most drivers. It can be enabled by setting the {{ic|power_save}} parameter; a time (in seconds) to go into idle mode. To idle the audio card after one second, create<br />
<br />
{{hc|/etc/modprobe.d/audio_powersave.conf|2=options snd_hda_intel power_save=1}}<br />
<br />
for Intel, or use<br />
<br />
options snd_ac97_codec power_save=1<br />
<br />
for ac97.<br />
<br />
{{Note|Toggling the audio card's power state can cause a popping sound or noticeable latency on some broken hardware.}}<br />
<br />
=== Active state power management ===<br />
<br />
To verify that [[Wikipedia:Active State Power Management|ASPM]] is enabled:<br />
<br />
{{hc|$ cat /sys/module/pcie_aspm/parameters/policy|[default] performance powersave}}<br />
<br />
Either {{ic|[default]}} or {{ic|[powersave]}} means you do not need to force it on. Otherwise, it's either unsupported or broken on your hardware, or has to be forced on with {{ic|1=pcie_aspm=force}} on the [[kernel line]].<br />
<br />
{{Warning|<br />
* Forcing on ASPM can cause a freeze/panic, so make sure you have a way to undo the option if it doesn't work.<br />
* On systems that don't support it forcing on ASPM can even increase power consumption.}}<br />
<br />
=== Backlight ===<br />
<br />
When system starts, screen backlight is set to maximum by default. This can be fixed by specifying backlight level in the following udev rule:<br />
<br />
{{hc|/etc/udev/rules.d/backlight.rules|<nowiki><br />
## SET BACKLIGHT<br />
SUBSYSTEM=="backlight", ACTION=="add", KERNEL=="acpi_video0", ATTR{brightness}="1"<br />
</nowiki>}}<br />
<br />
=== Bluetooth ===<br />
<br />
{{expansion|reason=The device should likely be disabled with hciconfig first.}}<br />
[[Kernel_modules#Blacklisting|Blacklist]] the {{ic|hci_usb}} module if the driver is loaded automatically.<br />
<br />
Alternatively, [[Kernel_modules#Blacklisting|blacklist]] the {{ic|btusb}} and {{ic|bluetooth}} modules.<br />
<br />
Another variant is to {{pkg|rfkill}} it:<br />
# rfkill block bluetooth<br />
<br />
Or with udev rule:<br />
{{hc|/etc/udev/rules.d/bt.rules|<nowiki><br />
## DISABLE BLUETOOTH<br />
SUBSYSTEM=="rfkill", ATTR{type}=="bluetooth", ATTR{state}="0"<br />
</nowiki>}}<br />
<br />
=== Web-Camera ===<br />
<br />
If you won't use integrated web camera then [[Kernel_modules#Blacklisting|blacklist]] the {{ic|uvcvideo}} module.<br />
<br />
=== Disabling NMI watchdog ===<br />
<br />
The [[Wikipedia:Non-maskable interrupt|NMI]] watchdog is a debugging feature to catch hardware hangs and cause a kernel panic. On some systems it can generate a lot of interrupts, causing a noticeable increase in power usage.<br />
<br />
{{hc|/etc/sysctl.d/disable_watchdog.conf|2=kernel.nmi_watchdog = 0}}<br />
<br />
or add {{ic|1=nmi_watchdog=0}} as a [[kernel parameter]] to disable it completely from early boot.<br />
<br />
=== Network interfaces ===<br />
<br />
[[Wikipedia:Wake-on-LAN|Wake-on-LAN]] can be a useful feature, but if you're not making use of it then it's simply draining extra power waiting for a magic packet while in suspend. Disabling for all Ethernet interfaces:<br />
<br />
{{hc|/etc/udev/rules.d/70-disable_wol.rules|2=ACTION=="add", SUBSYSTEM=="net", KERNEL=="eth*" RUN+="/usr/bin/ethtool -s %k wol d"}}<br />
<br />
To enable powersaving on all wireless interfaces:<br />
<br />
{{hc|/etc/udev/rules.d/70-wifi-powersave.rules|2=ACTION=="add", SUBSYSTEM=="net", KERNEL=="wlan*" RUN+="/usr/sbin/iw dev %k set power_save on"}}<br />
<br />
In these examples, {{ic|%k}} is a specifier for the kernel name of the matched device. For example, if it finds that the rule is applicable to {{ic|wlan0}}, the {{ic|%k}} specifier will be replaced ith {{ic|wlan0}}. To apply the rules to only a particular interface, just replace the pattern {{ic|eth*}} and specifier {{ic|%k}} with the desired interface name. For more information, see [http://www.reactivated.net/writing_udev_rules.html Writing udev rules].<br />
<br />
In this case, the name of the configuration file is important. Due to the introduction of [[Network_Configuration#Device_names|persistent device names]] via {{ic|80-net-name-slot.rules}} in systemd v197, it is important that the network powersave rules are named lexicographically before {{ic|80-net-name-slot.rules}}, so that they are applied before the devices are named e.g. {{ic|enp2s0}}.<br />
<br />
=== PCI Runtime Power Management ===<br />
<br />
{{hc|/etc/udev/rules.d/pci_pm.rules|2=ACTION=="add", SUBSYSTEM=="pci", ATTR{power/control}="auto"}}<br />
<br />
=== Writeback Time ===<br />
Increasing the VM dirty writeback time can help to aggregate I/O together - reducing disk writes, and decreasing power usage:<br />
<br />
{{hc|/etc/sysctl.d/dirty_writeback.conf|2=vm.dirty_writeback_centisecs = 1500}}<br />
<br />
To do the same for journal commits with ext4 and some other filesystems, use {{ic|1=commit=15}} as a parameter in [[fstab]] or with the {{ic|rootflags}} [[kernel parameter]].<br />
<br />
=== Laptop Mode ===<br />
<br />
{{hc|/etc/sysctl.d/laptop_mode.conf|2=vm.laptop_mode = 5}}<br />
<br />
=== SATA Active Link Power Management ===<br />
<br />
{{Note|This adds latency when accessing a drive that has been idle, so it's one of the few settings that may be worth toggling based on whether you're on AC power.}}<br />
{{hc|/etc/udev/rules.d/hd_power_save.rules|2=SUBSYSTEM=="scsi_host", KERNEL=="host*", ATTR{link_power_management_policy}="min_power"}}<br />
<br />
=== USB Autosuspend ===<br />
<br />
To enable USB autosuspend after 2 seconds of inactivity:<br />
{{hc|/etc/udev/rules.d/usb_power_save.rules|2=ACTION=="add", SUBSYSTEM=="usb", TEST=="power/control" ATTR{power/control}="auto"<br />
ACTION=="add", SUBSYSTEM=="usb", TEST=="power/autosuspend" ATTR{power/autosuspend}="2"}}<br />
<br />
=== Device Power Management ===<br />
<br />
{{accuracy|reason=Should be done with a udev rule.}}<br />
<br />
echo auto | tee /sys/bus/i2c/devices/*/power/control > /dev/null<br />
echo auto | tee /sys/bus/spi/devices/*/power/control > /dev/null<br />
<br />
== Tools and scripts ==<br />
<br />
=== Packages ===<br />
<br />
There are many scripts and tools which make use of the various settings described in the previous sections. These are notably:<br />
<br />
* [[TLP]]<br />
* [[Powerdown]]<br />
* {{AUR|powerconf}}<br />
* {{AUR|ftw-git}}<br />
* [[Laptop Mode Tools]]<br />
* [[pm-utils]]<br />
<br />
If you do not want to take care of the settings by yourself it is recommended to use these tools. But be aware of running only '''one''' of these tools to avoid possible conflicts as they all work more or less similar.<br />
<br />
=== Print power settings ===<br />
<br />
This script prints power settings and a variety of other properties for USB and PCI devices. Note that root permissions are needed to see all settings.<br />
<br />
{{bc|<nowiki>#!/bin/bash<br />
<br />
for i in $(find /sys/devices -name "bMaxPower")<br />
do<br />
busdir=${i%/*}<br />
busnum=$(<$busdir/busnum)<br />
devnum=$(<$busdir/devnum)<br />
title=$(lsusb -s $busnum:$devnum)<br />
<br />
printf "\n\n+++ %s\n -%s\n" "$title" "$busdir"<br />
<br />
for ff in $(find $busdir/power -type f ! -empty 2>/dev/null)<br />
do<br />
v=$(cat $ff 2>/dev/null|tr -d "\n")<br />
[[ ${#v} -gt 0 ]] && echo -e " ${ff##*/}=$v";<br />
v=;<br />
done | sort -g;<br />
done;<br />
<br />
printf "\n\n\n+++ %s\n" "Kernel Modules"<br />
for mod in $(lspci -k | sed -n '/in use:/s,^.*: ,,p' | sort -u)<br />
do<br />
echo "+ $mod";<br />
systool -v -m $mod 2> /dev/null | sed -n "/Parameters:/,/^$/p";<br />
done</nowiki>}}</div>Holomorphhttps://wiki.archlinux.org/index.php?title=Power_saving&diff=261774Power saving2013-06-08T06:31:03Z<p>Holomorph: clean up network section</p>
<hr />
<div>{{Article summary start}}<br />
{{Article summary text|Configuration and tools for saving power.}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|CPU Frequency Scaling}}<br />
{{Article summary wiki|Kernel modules}}<br />
{{Article summary wiki|Hybrid graphics}}<br />
{{Article summary wiki|Sysctl}}<br />
{{Article summary wiki|udev}}<br />
{{Article summary end}}<br />
<br />
[[Category:Power management]]<br />
This article covers the configuration needed to turn on power saving features. Almost all of the features listed here are worth using whether or not the computer is on AC or battery power. Most have negligible performance impact and are just not enabled by default because of commonly broken hardware/drivers. Reducing power usage means reducing heat, which can even lead to higher performance on a modern Intel or AMD CPU, thanks to [[Wikipedia:Intel Turbo Boost|dynamic overclocking]].<br />
<br />
== Configuration ==<br />
<br />
If you would like to create your own scripts and power saving settings such as by udev rules you can take the following settings as a reference.<br />
<br />
=== Audio ===<br />
<br />
By default, audio power saving is turned off by most drivers. It can be enabled by setting the {{ic|power_save}} parameter; a time (in seconds) to go into idle mode. To idle the audio card after one second, create<br />
<br />
{{hc|/etc/modprobe.d/audio_powersave.conf|2=options snd_hda_intel power_save=1}}<br />
<br />
for Intel, or use<br />
<br />
options snd_ac97_codec power_save=1<br />
<br />
for ac97.<br />
<br />
{{Note|Toggling the audio card's power state can cause a popping sound or noticeable latency on some broken hardware.}}<br />
<br />
=== Active state power management ===<br />
<br />
To verify that [[Wikipedia:Active State Power Management|ASPM]] is enabled:<br />
<br />
{{hc|$ cat /sys/module/pcie_aspm/parameters/policy|[default] performance powersave}}<br />
<br />
Either {{ic|[default]}} or {{ic|[powersave]}} means you do not need to force it on. Otherwise, it's either unsupported or broken on your hardware, or has to be forced on with {{ic|1=pcie_aspm=force}} on the [[kernel line]].<br />
<br />
{{Warning|<br />
* Forcing on ASPM can cause a freeze/panic, so make sure you have a way to undo the option if it doesn't work.<br />
* On systems that don't support it forcing on ASPM can even increase power consumption.}}<br />
<br />
=== Backlight ===<br />
<br />
When system starts, screen backlight is set to maximum by default. This can be fixed by specifying backlight level in the following udev rule:<br />
<br />
{{hc|/etc/udev/rules.d/backlight.rules|<nowiki><br />
## SET BACKLIGHT<br />
SUBSYSTEM=="backlight", ACTION=="add", KERNEL=="acpi_video0", ATTR{brightness}="1"<br />
</nowiki>}}<br />
<br />
=== Bluetooth ===<br />
<br />
{{expansion|reason=The device should likely be disabled with hciconfig first.}}<br />
[[Kernel_modules#Blacklisting|Blacklist]] the {{ic|hci_usb}} module if the driver is loaded automatically.<br />
<br />
Alternatively, [[Kernel_modules#Blacklisting|blacklist]] the {{ic|btusb}} and {{ic|bluetooth}} modules.<br />
<br />
Another variant is to {{pkg|rfkill}} it:<br />
# rfkill block bluetooth<br />
<br />
Or with udev rule:<br />
{{hc|/etc/udev/rules.d/bt.rules|<nowiki><br />
## DISABLE BLUETOOTH<br />
SUBSYSTEM=="rfkill", ATTR{type}=="bluetooth", ATTR{state}="0"<br />
</nowiki>}}<br />
<br />
=== Web-Camera ===<br />
<br />
If you won't use integrated web camera then [[Kernel_modules#Blacklisting|blacklist]] the {{ic|uvcvideo}} module.<br />
<br />
=== Disabling NMI watchdog ===<br />
<br />
The [[Wikipedia:Non-maskable interrupt|NMI]] watchdog is a debugging feature to catch hardware hangs and cause a kernel panic. On some systems it can generate a lot of interrupts, causing a noticeable increase in power usage.<br />
<br />
{{hc|/etc/sysctl.d/disable_watchdog.conf|2=kernel.nmi_watchdog = 0}}<br />
<br />
or add {{ic|1=nmi_watchdog=0}} as a [[kernel parameter]] to disable it completely from early boot.<br />
<br />
=== Network interfaces ===<br />
<br />
[[Wikipedia:Wake-on-LAN|Wake-on-LAN]] can be a useful feature, but if you're not making use of it then it's simply draining extra power waiting for a magic packet while in suspend. Disabling for all Ethernet interfaces:<br />
<br />
{{hc|/etc/udev/rules.d/70-disable_wol.rules|2=ACTION=="add", SUBSYSTEM=="net", KERNEL=="eth*" RUN+="/usr/bin/ethtool -s %k wol d"}}<br />
<br />
To enable powersaving on all wireless interfaces:<br />
<br />
{{hc|/etc/udev/rules.d/70-wifi-powersave.rules|2=ACTION=="add", SUBSYSTEM=="net", KERNEL=="wlan*" RUN+="/usr/sbin/iw dev %k set power_save on"}}<br />
<br />
In these examples, {{ic|%k}} is a specifier for the kernel name of the matched device. For example, if it finds that the rule is applicable to {{ic|wlan0}}, the {{ic|%k}} specifier will be replaced ith {{ic|wlan0}}. To apply the rules to only a particular interface, just replace the pattern {{ic|eth*}} and specifier {{ic|%k}} with the desired interface name. For more information, see [http://www.reactivated.net/writing_udev_rules.html Writing udev rules].<br />
<br />
In this case, the name of the configuration file is important. Due to the introduction of [[Network_Configuration#Device_names|persistent device names]] via {{ic|80-net-name-slot.rules}} in systemd v197, it is important that the network powersave rules are named lexicographically before {{ic|80-net-name-slot.rules}}.<br />
<br />
=== PCI Runtime Power Management ===<br />
<br />
{{hc|/etc/udev/rules.d/pci_pm.rules|2=ACTION=="add", SUBSYSTEM=="pci", ATTR{power/control}="auto"}}<br />
<br />
=== Writeback Time ===<br />
Increasing the VM dirty writeback time can help to aggregate I/O together - reducing disk writes, and decreasing power usage:<br />
<br />
{{hc|/etc/sysctl.d/dirty_writeback.conf|2=vm.dirty_writeback_centisecs = 1500}}<br />
<br />
To do the same for journal commits with ext4 and some other filesystems, use {{ic|1=commit=15}} as a parameter in [[fstab]] or with the {{ic|rootflags}} [[kernel parameter]].<br />
<br />
=== Laptop Mode ===<br />
<br />
{{hc|/etc/sysctl.d/laptop_mode.conf|2=vm.laptop_mode = 5}}<br />
<br />
=== SATA Active Link Power Management ===<br />
<br />
{{Note|This adds latency when accessing a drive that has been idle, so it's one of the few settings that may be worth toggling based on whether you're on AC power.}}<br />
{{hc|/etc/udev/rules.d/hd_power_save.rules|2=SUBSYSTEM=="scsi_host", KERNEL=="host*", ATTR{link_power_management_policy}="min_power"}}<br />
<br />
=== USB Autosuspend ===<br />
<br />
To enable USB autosuspend after 2 seconds of inactivity:<br />
{{hc|/etc/udev/rules.d/usb_power_save.rules|2=ACTION=="add", SUBSYSTEM=="usb", TEST=="power/control" ATTR{power/control}="auto"<br />
ACTION=="add", SUBSYSTEM=="usb", TEST=="power/autosuspend" ATTR{power/autosuspend}="2"}}<br />
<br />
=== Device Power Management ===<br />
<br />
{{accuracy|reason=Should be done with a udev rule.}}<br />
<br />
echo auto | tee /sys/bus/i2c/devices/*/power/control > /dev/null<br />
echo auto | tee /sys/bus/spi/devices/*/power/control > /dev/null<br />
<br />
== Tools and scripts ==<br />
<br />
=== Packages ===<br />
<br />
There are many scripts and tools which make use of the various settings described in the previous sections. These are notably:<br />
<br />
* [[TLP]]<br />
* [[Powerdown]]<br />
* {{AUR|powerconf}}<br />
* {{AUR|ftw-git}}<br />
* [[Laptop Mode Tools]]<br />
* [[pm-utils]]<br />
<br />
If you do not want to take care of the settings by yourself it is recommended to use these tools. But be aware of running only '''one''' of these tools to avoid possible conflicts as they all work more or less similar.<br />
<br />
=== Print power settings ===<br />
<br />
This script prints power settings and a variety of other properties for USB and PCI devices. Note that root permissions are needed to see all settings.<br />
<br />
{{bc|<nowiki>#!/bin/bash<br />
<br />
for i in $(find /sys/devices -name "bMaxPower")<br />
do<br />
busdir=${i%/*}<br />
busnum=$(<$busdir/busnum)<br />
devnum=$(<$busdir/devnum)<br />
title=$(lsusb -s $busnum:$devnum)<br />
<br />
printf "\n\n+++ %s\n -%s\n" "$title" "$busdir"<br />
<br />
for ff in $(find $busdir/power -type f ! -empty 2>/dev/null)<br />
do<br />
v=$(cat $ff 2>/dev/null|tr -d "\n")<br />
[[ ${#v} -gt 0 ]] && echo -e " ${ff##*/}=$v";<br />
v=;<br />
done | sort -g;<br />
done;<br />
<br />
printf "\n\n\n+++ %s\n" "Kernel Modules"<br />
for mod in $(lspci -k | sed -n '/in use:/s,^.*: ,,p' | sort -u)<br />
do<br />
echo "+ $mod";<br />
systool -v -m $mod 2> /dev/null | sed -n "/Parameters:/,/^$/p";<br />
done</nowiki>}}</div>Holomorphhttps://wiki.archlinux.org/index.php?title=Power_saving&diff=261766Power saving2013-06-08T05:57:31Z<p>Holomorph: /* Audio */</p>
<hr />
<div>{{Article summary start}}<br />
{{Article summary text|Configuration and tools for saving power.}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|CPU Frequency Scaling}}<br />
{{Article summary wiki|Kernel modules}}<br />
{{Article summary wiki|Hybrid graphics}}<br />
{{Article summary wiki|Sysctl}}<br />
{{Article summary wiki|udev}}<br />
{{Article summary end}}<br />
<br />
[[Category:Power management]]<br />
This article covers the configuration needed to turn on power saving features. Almost all of the features listed here are worth using whether or not the computer is on AC or battery power. Most have negligible performance impact and are just not enabled by default because of commonly broken hardware/drivers. Reducing power usage means reducing heat, which can even lead to higher performance on a modern Intel or AMD CPU, thanks to [[Wikipedia:Intel Turbo Boost|dynamic overclocking]].<br />
<br />
== Configuration ==<br />
<br />
If you would like to create your own scripts and power saving settings such as by udev rules you can take the following settings as a reference.<br />
<br />
=== Audio ===<br />
<br />
By default, audio power saving is turned off by most drivers. It can be enabled by setting the {{ic|power_save}} parameter; a time (in seconds) to go into idle mode. To idle the audio card after one second, create<br />
<br />
{{hc|/etc/modprobe.d/audio_powersave.conf|2=options snd_hda_intel power_save=1}}<br />
<br />
for Intel, or use<br />
<br />
options snd_ac97_codec power_save=1<br />
<br />
for ac97.<br />
<br />
{{Note|Toggling the audio card's power state can cause a popping sound or noticeable latency on some broken hardware.}}<br />
<br />
=== Active state power management ===<br />
<br />
To verify that [[Wikipedia:Active State Power Management|ASPM]] is enabled:<br />
<br />
{{hc|$ cat /sys/module/pcie_aspm/parameters/policy|[default] performance powersave}}<br />
<br />
Either {{ic|[default]}} or {{ic|[powersave]}} means you do not need to force it on. Otherwise, it's either unsupported or broken on your hardware, or has to be forced on with {{ic|1=pcie_aspm=force}} on the [[kernel line]].<br />
<br />
{{Warning|<br />
* Forcing on ASPM can cause a freeze/panic, so make sure you have a way to undo the option if it doesn't work.<br />
* On systems that don't support it forcing on ASPM can even increase power consumption.}}<br />
<br />
=== Backlight ===<br />
<br />
When system starts, screen backlight is set to maximum by default. This can be fixed by specifying backlight level in the following udev rule:<br />
<br />
{{hc|/etc/udev/rules.d/backlight.rules|<nowiki><br />
## SET BACKLIGHT<br />
SUBSYSTEM=="backlight", ACTION=="add", KERNEL=="acpi_video0", ATTR{brightness}="1"<br />
</nowiki>}}<br />
<br />
=== Bluetooth ===<br />
<br />
{{expansion|reason=The device should likely be disabled with hciconfig first.}}<br />
[[Kernel_modules#Blacklisting|Blacklist]] the {{ic|hci_usb}} module if the driver is loaded automatically.<br />
<br />
Alternatively, [[Kernel_modules#Blacklisting|blacklist]] the {{ic|btusb}} and {{ic|bluetooth}} modules.<br />
<br />
Another variant is to {{pkg|rfkill}} it:<br />
# rfkill block bluetooth<br />
<br />
Or with udev rule:<br />
{{hc|/etc/udev/rules.d/bt.rules|<nowiki><br />
## DISABLE BLUETOOTH<br />
SUBSYSTEM=="rfkill", ATTR{type}=="bluetooth", ATTR{state}="0"<br />
</nowiki>}}<br />
<br />
=== Web-Camera ===<br />
<br />
If you won't use integrated web camera then [[Kernel_modules#Blacklisting|blacklist]] the {{ic|uvcvideo}} module.<br />
<br />
=== Disabling NMI watchdog ===<br />
<br />
The [[Wikipedia:Non-maskable interrupt|NMI]] watchdog is a debugging feature to catch hardware hangs and cause a kernel panic. On some systems it can generate a lot of interrupts, causing a noticeable increase in power usage.<br />
<br />
{{hc|/etc/sysctl.d/disable_watchdog.conf|2=kernel.nmi_watchdog = 0}}<br />
<br />
or add {{ic|1=nmi_watchdog=0}} as a [[kernel parameter]] to disable it completely from early boot.<br />
<br />
=== Disabling Wake-on-LAN ===<br />
<br />
[[Wikipedia:Wake-on-LAN|Wake-on-LAN]] can be a useful feature, but if you're not making use of it then it's simply draining extra power waiting for a magic packet while in suspend.<br />
<br />
Disabling for all Ethernet interfaces:<br />
<br />
{{hc|/etc/udev/rules.d/disable_wol.rules|2=ACTION=="add", SUBSYSTEM=="net", KERNEL=="eth*" RUN+="/usr/bin/ethtool -s %k wol d"}}<br />
<br />
You can use multiple names in the matches; for example, {{ic|1=KERNEL=="lan0&#124;eth*"}}<br />
<br />
{{Note|This should be combined with [[udev#Network device|static naming]] of devices, the {{ic|eth*}} names are not static.}}<br />
<br />
=== PCI Runtime Power Management ===<br />
<br />
{{hc|/etc/udev/rules.d/pci_pm.rules|2=ACTION=="add", SUBSYSTEM=="pci", ATTR{power/control}="auto"}}<br />
<br />
=== Wireless power saving ===<br />
<br />
{{Accuracy|This method does not seem to work at the moment.}}<br />
<br />
Enabling for a specific interface:<br />
<br />
{{Note|This should be combined with [[udev#Network device|static naming]] of devices, the eth* names are not static. In the below examples there are some assumptions about how your devices are named. The first assumes that your wireless has the kernel name of "wifi0" and the second that any wireless interface will begin with "wlan". Of course, with persistent naming included now in systemd, this is probably no longer the case. "%k" in the second example is a variable for the kernel name for the matched device. For example if it finds that the rule is applicable to wlan1, the "%k" variable will be replaced ith "wlan1".}}<br />
<br />
{{hc|/etc/udev/rules.d/wlan0_power_save.rules|2=ACTION=="add", SUBSYSTEM=="net", KERNEL=="wifi0" RUN+="/usr/sbin/iw dev wifi0 set power_save on"}}<br />
<br />
Enabling for all interfaces:<br />
<br />
{{hc|/etc/udev/rules.d/wifi_power_save.rules|2=ACTION=="add", SUBSYSTEM=="net", KERNEL=="wlan*" RUN+="/usr/sbin/iw dev %k set power_save on"}}<br />
<br />
=== Writeback Time ===<br />
Increasing the VM dirty writeback time can help to aggregate I/O together - reducing disk writes, and decreasing power usage:<br />
<br />
{{hc|/etc/sysctl.d/dirty_writeback.conf|2=vm.dirty_writeback_centisecs = 1500}}<br />
<br />
To do the same for journal commits with ext4 and some other filesystems, use {{ic|1=commit=15}} as a parameter in [[fstab]] or with the {{ic|rootflags}} [[kernel parameter]].<br />
<br />
=== Laptop Mode ===<br />
<br />
{{hc|/etc/sysctl.d/laptop_mode.conf|2=vm.laptop_mode = 5}}<br />
<br />
=== SATA Active Link Power Management ===<br />
<br />
{{Note|This adds latency when accessing a drive that has been idle, so it's one of the few settings that may be worth toggling based on whether you're on AC power.}}<br />
{{hc|/etc/udev/rules.d/hd_power_save.rules|2=SUBSYSTEM=="scsi_host", KERNEL=="host*", ATTR{link_power_management_policy}="min_power"}}<br />
<br />
=== USB Autosuspend ===<br />
<br />
To enable USB autosuspend after 2 seconds of inactivity:<br />
{{hc|/etc/udev/rules.d/usb_power_save.rules|2=ACTION=="add", SUBSYSTEM=="usb", TEST=="power/control" ATTR{power/control}="auto"<br />
ACTION=="add", SUBSYSTEM=="usb", TEST=="power/autosuspend" ATTR{power/autosuspend}="2"}}<br />
<br />
=== Device Power Management ===<br />
<br />
{{accuracy|reason=Should be done with a udev rule.}}<br />
<br />
echo auto | tee /sys/bus/i2c/devices/*/power/control > /dev/null<br />
echo auto | tee /sys/bus/spi/devices/*/power/control > /dev/null<br />
<br />
== Tools and scripts ==<br />
<br />
=== Packages ===<br />
<br />
There are many scripts and tools which make use of the various settings described in the previous sections. These are notably:<br />
<br />
* [[TLP]]<br />
* [[Powerdown]]<br />
* {{AUR|powerconf}}<br />
* {{AUR|ftw-git}}<br />
* [[Laptop Mode Tools]]<br />
* [[pm-utils]]<br />
<br />
If you do not want to take care of the settings by yourself it is recommended to use these tools. But be aware of running only '''one''' of these tools to avoid possible conflicts as they all work more or less similar.<br />
<br />
=== Print power settings ===<br />
<br />
This script prints power settings and a variety of other properties for USB and PCI devices. Note that root permissions are needed to see all settings.<br />
<br />
{{bc|<nowiki>#!/bin/bash<br />
<br />
for i in $(find /sys/devices -name "bMaxPower")<br />
do<br />
busdir=${i%/*}<br />
busnum=$(<$busdir/busnum)<br />
devnum=$(<$busdir/devnum)<br />
title=$(lsusb -s $busnum:$devnum)<br />
<br />
printf "\n\n+++ %s\n -%s\n" "$title" "$busdir"<br />
<br />
for ff in $(find $busdir/power -type f ! -empty 2>/dev/null)<br />
do<br />
v=$(cat $ff 2>/dev/null|tr -d "\n")<br />
[[ ${#v} -gt 0 ]] && echo -e " ${ff##*/}=$v";<br />
v=;<br />
done | sort -g;<br />
done;<br />
<br />
printf "\n\n\n+++ %s\n" "Kernel Modules"<br />
for mod in $(lspci -k | sed -n '/in use:/s,^.*: ,,p' | sort -u)<br />
do<br />
echo "+ $mod";<br />
systool -v -m $mod 2> /dev/null | sed -n "/Parameters:/,/^$/p";<br />
done</nowiki>}}</div>Holomorphhttps://wiki.archlinux.org/index.php?title=Power_saving&diff=261764Power saving2013-06-08T05:39:34Z<p>Holomorph: ugh</p>
<hr />
<div>{{Article summary start}}<br />
{{Article summary text|Configuration and tools for saving power.}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|CPU Frequency Scaling}}<br />
{{Article summary wiki|Kernel modules}}<br />
{{Article summary wiki|Hybrid graphics}}<br />
{{Article summary wiki|Sysctl}}<br />
{{Article summary wiki|udev}}<br />
{{Article summary end}}<br />
<br />
[[Category:Power management]]<br />
This article covers the configuration needed to turn on power saving features. Almost all of the features listed here are worth using whether or not the computer is on AC or battery power. Most have negligible performance impact and are just not enabled by default because of commonly broken hardware/drivers. Reducing power usage means reducing heat, which can even lead to higher performance on a modern Intel or AMD CPU, thanks to [[Wikipedia:Intel Turbo Boost|dynamic overclocking]].<br />
<br />
== Configuration ==<br />
<br />
If you would like to create your own scripts and power saving settings such as by udev rules you can take the following settings as a reference.<br />
<br />
=== Audio ===<br />
<br />
By default, audio power saving is turned off by most drivers. It can be enabled by setting the power_save parameter to a time (in seconds) to go in idle.<br />
<br />
{{Note|Toggling the audio card's power state can cause a popping sound or noticeable latency on some broken hardware.}}<br />
<br />
;Intel<br />
<br />
{{hc|/etc/modprobe.d/audio_power_save.conf|2=options snd_hda_intel power_save=1}}<br />
<br />
;ac97<br />
<br />
{{hc|/etc/modprobe.d/audio_power_save.conf|2=options snd_ac97_codec power_save=1}}<br />
<br />
=== Active state power management ===<br />
<br />
To verify that [[Wikipedia:Active State Power Management|ASPM]] is enabled:<br />
<br />
{{hc|$ cat /sys/module/pcie_aspm/parameters/policy|[default] performance powersave}}<br />
<br />
Either {{ic|[default]}} or {{ic|[powersave]}} means you do not need to force it on. Otherwise, it's either unsupported or broken on your hardware, or has to be forced on with {{ic|1=pcie_aspm=force}} on the [[kernel line]].<br />
<br />
{{Warning|<br />
* Forcing on ASPM can cause a freeze/panic, so make sure you have a way to undo the option if it doesn't work.<br />
* On systems that don't support it forcing on ASPM can even increase power consumption.}}<br />
<br />
=== Backlight ===<br />
<br />
When system starts, screen backlight is set to maximum by default. This can be fixed by specifying backlight level in the following udev rule:<br />
<br />
{{hc|/etc/udev/rules.d/backlight.rules|<nowiki><br />
## SET BACKLIGHT<br />
SUBSYSTEM=="backlight", ACTION=="add", KERNEL=="acpi_video0", ATTR{brightness}="1"<br />
</nowiki>}}<br />
<br />
=== Bluetooth ===<br />
<br />
{{expansion|reason=The device should likely be disabled with hciconfig first.}}<br />
[[Kernel_modules#Blacklisting|Blacklist]] the {{ic|hci_usb}} module if the driver is loaded automatically.<br />
<br />
Alternatively, [[Kernel_modules#Blacklisting|blacklist]] the {{ic|btusb}} and {{ic|bluetooth}} modules.<br />
<br />
Another variant is to {{pkg|rfkill}} it:<br />
# rfkill block bluetooth<br />
<br />
Or with udev rule:<br />
{{hc|/etc/udev/rules.d/bt.rules|<nowiki><br />
## DISABLE BLUETOOTH<br />
SUBSYSTEM=="rfkill", ATTR{type}=="bluetooth", ATTR{state}="0"<br />
</nowiki>}}<br />
<br />
=== Web-Camera ===<br />
<br />
If you won't use integrated web camera then [[Kernel_modules#Blacklisting|blacklist]] the {{ic|uvcvideo}} module.<br />
<br />
=== Disabling NMI watchdog ===<br />
<br />
The [[Wikipedia:Non-maskable interrupt|NMI]] watchdog is a debugging feature to catch hardware hangs and cause a kernel panic. On some systems it can generate a lot of interrupts, causing a noticeable increase in power usage.<br />
<br />
{{hc|/etc/sysctl.d/disable_watchdog.conf|2=kernel.nmi_watchdog = 0}}<br />
<br />
or add {{ic|1=nmi_watchdog=0}} as a [[kernel parameter]] to disable it completely from early boot.<br />
<br />
=== Disabling Wake-on-LAN ===<br />
<br />
[[Wikipedia:Wake-on-LAN|Wake-on-LAN]] can be a useful feature, but if you're not making use of it then it's simply draining extra power waiting for a magic packet while in suspend.<br />
<br />
Disabling for all Ethernet interfaces:<br />
<br />
{{hc|/etc/udev/rules.d/disable_wol.rules|2=ACTION=="add", SUBSYSTEM=="net", KERNEL=="eth*" RUN+="/usr/bin/ethtool -s %k wol d"}}<br />
<br />
You can use multiple names in the matches; for example, {{ic|1=KERNEL=="lan0&#124;eth*"}}<br />
<br />
{{Note|This should be combined with [[udev#Network device|static naming]] of devices, the {{ic|eth*}} names are not static.}}<br />
<br />
=== PCI Runtime Power Management ===<br />
<br />
{{hc|/etc/udev/rules.d/pci_pm.rules|2=ACTION=="add", SUBSYSTEM=="pci", ATTR{power/control}="auto"}}<br />
<br />
=== Wireless power saving ===<br />
<br />
{{Accuracy|This method does not seem to work at the moment.}}<br />
<br />
Enabling for a specific interface:<br />
<br />
{{Note|This should be combined with [[udev#Network device|static naming]] of devices, the eth* names are not static. In the below examples there are some assumptions about how your devices are named. The first assumes that your wireless has the kernel name of "wifi0" and the second that any wireless interface will begin with "wlan". Of course, with persistent naming included now in systemd, this is probably no longer the case. "%k" in the second example is a variable for the kernel name for the matched device. For example if it finds that the rule is applicable to wlan1, the "%k" variable will be replaced ith "wlan1".}}<br />
<br />
{{hc|/etc/udev/rules.d/wlan0_power_save.rules|2=ACTION=="add", SUBSYSTEM=="net", KERNEL=="wifi0" RUN+="/usr/sbin/iw dev wifi0 set power_save on"}}<br />
<br />
Enabling for all interfaces:<br />
<br />
{{hc|/etc/udev/rules.d/wifi_power_save.rules|2=ACTION=="add", SUBSYSTEM=="net", KERNEL=="wlan*" RUN+="/usr/sbin/iw dev %k set power_save on"}}<br />
<br />
=== Writeback Time ===<br />
Increasing the VM dirty writeback time can help to aggregate I/O together - reducing disk writes, and decreasing power usage:<br />
<br />
{{hc|/etc/sysctl.d/dirty_writeback.conf|2=vm.dirty_writeback_centisecs = 1500}}<br />
<br />
To do the same for journal commits with ext4 and some other filesystems, use {{ic|1=commit=15}} as a parameter in [[fstab]] or with the {{ic|rootflags}} [[kernel parameter]].<br />
<br />
=== Laptop Mode ===<br />
<br />
{{hc|/etc/sysctl.d/laptop_mode.conf|2=vm.laptop_mode = 5}}<br />
<br />
=== SATA Active Link Power Management ===<br />
<br />
{{Note|This adds latency when accessing a drive that has been idle, so it's one of the few settings that may be worth toggling based on whether you're on AC power.}}<br />
{{hc|/etc/udev/rules.d/hd_power_save.rules|2=SUBSYSTEM=="scsi_host", KERNEL=="host*", ATTR{link_power_management_policy}="min_power"}}<br />
<br />
=== USB Autosuspend ===<br />
<br />
To enable USB autosuspend after 2 seconds of inactivity:<br />
{{hc|/etc/udev/rules.d/usb_power_save.rules|2=ACTION=="add", SUBSYSTEM=="usb", TEST=="power/control" ATTR{power/control}="auto"<br />
ACTION=="add", SUBSYSTEM=="usb", TEST=="power/autosuspend" ATTR{power/autosuspend}="2"}}<br />
<br />
=== Device Power Management ===<br />
<br />
{{accuracy|reason=Should be done with a udev rule.}}<br />
<br />
echo auto | tee /sys/bus/i2c/devices/*/power/control > /dev/null<br />
echo auto | tee /sys/bus/spi/devices/*/power/control > /dev/null<br />
<br />
== Tools and scripts ==<br />
<br />
=== Packages ===<br />
<br />
There are many scripts and tools which make use of the various settings described in the previous sections. These are notably:<br />
<br />
* [[TLP]]<br />
* [[Powerdown]]<br />
* {{AUR|powerconf}}<br />
* {{AUR|ftw-git}}<br />
* [[Laptop Mode Tools]]<br />
* [[pm-utils]]<br />
<br />
If you do not want to take care of the settings by yourself it is recommended to use these tools. But be aware of running only '''one''' of these tools to avoid possible conflicts as they all work more or less similar.<br />
<br />
=== Print power settings ===<br />
<br />
This script prints power settings and a variety of other properties for USB and PCI devices. Note that root permissions are needed to see all settings.<br />
<br />
{{bc|<nowiki>#!/bin/bash<br />
<br />
for i in $(find /sys/devices -name "bMaxPower")<br />
do<br />
busdir=${i%/*}<br />
busnum=$(<$busdir/busnum)<br />
devnum=$(<$busdir/devnum)<br />
title=$(lsusb -s $busnum:$devnum)<br />
<br />
printf "\n\n+++ %s\n -%s\n" "$title" "$busdir"<br />
<br />
for ff in $(find $busdir/power -type f ! -empty 2>/dev/null)<br />
do<br />
v=$(cat $ff 2>/dev/null|tr -d "\n")<br />
[[ ${#v} -gt 0 ]] && echo -e " ${ff##*/}=$v";<br />
v=;<br />
done | sort -g;<br />
done;<br />
<br />
printf "\n\n\n+++ %s\n" "Kernel Modules"<br />
for mod in $(lspci -k | sed -n '/in use:/s,^.*: ,,p' | sort -u)<br />
do<br />
echo "+ $mod";<br />
systool -v -m $mod 2> /dev/null | sed -n "/Parameters:/,/^$/p";<br />
done</nowiki>}}</div>Holomorphhttps://wiki.archlinux.org/index.php?title=Power_saving&diff=261762Power saving2013-06-08T05:38:23Z<p>Holomorph: merge to paragraph</p>
<hr />
<div>{{Article summary start}}<br />
{{Article summary text|Configuration and tools for saving power.}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|CPU Frequency Scaling}}<br />
{{Article summary wiki|Kernel modules}}<br />
{{Article summary wiki|Hybrid graphics}}<br />
{{Article summary wiki|Sysctl}}<br />
{{Article summary wiki|udev}}<br />
{{Article summary end}}<br />
<br />
[[Category:Power management]]<br />
This article covers the configuration needed to turn on power saving features. Almost all of the features listed here are worth using whether or not the computer is on AC or battery power. Most have negligible performance impact and are just not enabled by default because of commonly broken hardware/drivers. Reducing power usage means reducing heat, which can even lead to higher performance on a modern Intel or AMD CPU, thanks to [[Wikipedia:Intel Turbo Boost|dynamic overclocking]].<br />
<br />
== Configuration ==<br />
<br />
If you would like to create your own scripts and power saving settings such as by udev rules you can take the following settings as a reference.<br />
<br />
=== Audio ===<br />
<br />
By default, audio power saving is turned off by most drivers. It can be enabled by setting the power_save parameter to a time (in seconds) to go in idle.<br />
<br />
{{Note|Toggling the audio card's power state can cause a popping sound or noticeable latency on some broken hardware.}}<br />
<br />
;Intel<br />
<br />
{{hc|/etc/modprobe.d/audio_power_save.conf|2=options snd_hda_intel power_save=1}}<br />
<br />
;ac97<br />
<br />
{{hc|/etc/modprobe.d/audio_power_save.conf|2=options snd_ac97_codec power_save=1}}<br />
<br />
=== Active state power management ===<br />
<br />
To verify that [[Wikipedia:Active State Power Management|ASPM]] is enabled:<br />
<br />
{{hc|$ cat /sys/module/pcie_aspm/parameters/policy|[default] performance powersave}}<br />
<br />
Either {{ic|[default]}} or {{ic|[powersave]}} means you do not need to force it on. Otherwise, it's either unsupported/broken on your hardware, or has to be forced on with {{ic|1=pcie_aspm=force}} on the [[kernel line]].<br />
<br />
{{Warning|<br />
* Forcing on ASPM can cause a freeze/panic, so make sure you have a way to undo the option if it doesn't work.<br />
* On systems that don't support it forcing on ASPM can even increase power consumption.}}<br />
<br />
=== Backlight ===<br />
<br />
When system starts, screen backlight is set to maximum by default. This can be fixed by specifying backlight level in the following udev rule:<br />
<br />
{{hc|/etc/udev/rules.d/backlight.rules|<nowiki><br />
## SET BACKLIGHT<br />
SUBSYSTEM=="backlight", ACTION=="add", KERNEL=="acpi_video0", ATTR{brightness}="1"<br />
</nowiki>}}<br />
<br />
=== Bluetooth ===<br />
<br />
{{expansion|reason=The device should likely be disabled with hciconfig first.}}<br />
[[Kernel_modules#Blacklisting|Blacklist]] the {{ic|hci_usb}} module if the driver is loaded automatically.<br />
<br />
Alternatively, [[Kernel_modules#Blacklisting|blacklist]] the {{ic|btusb}} and {{ic|bluetooth}} modules.<br />
<br />
Another variant is to {{pkg|rfkill}} it:<br />
# rfkill block bluetooth<br />
<br />
Or with udev rule:<br />
{{hc|/etc/udev/rules.d/bt.rules|<nowiki><br />
## DISABLE BLUETOOTH<br />
SUBSYSTEM=="rfkill", ATTR{type}=="bluetooth", ATTR{state}="0"<br />
</nowiki>}}<br />
<br />
=== Web-Camera ===<br />
<br />
If you won't use integrated web camera then [[Kernel_modules#Blacklisting|blacklist]] the {{ic|uvcvideo}} module.<br />
<br />
=== Disabling NMI watchdog ===<br />
<br />
The [[Wikipedia:Non-maskable interrupt|NMI]] watchdog is a debugging feature to catch hardware hangs and cause a kernel panic. On some systems it can generate a lot of interrupts, causing a noticeable increase in power usage.<br />
<br />
{{hc|/etc/sysctl.d/disable_watchdog.conf|2=kernel.nmi_watchdog = 0}}<br />
<br />
or add {{ic|1=nmi_watchdog=0}} as a [[kernel parameter]] to disable it completely from early boot.<br />
<br />
=== Disabling Wake-on-LAN ===<br />
<br />
[[Wikipedia:Wake-on-LAN|Wake-on-LAN]] can be a useful feature, but if you're not making use of it then it's simply draining extra power waiting for a magic packet while in suspend.<br />
<br />
Disabling for all Ethernet interfaces:<br />
<br />
{{hc|/etc/udev/rules.d/disable_wol.rules|2=ACTION=="add", SUBSYSTEM=="net", KERNEL=="eth*" RUN+="/usr/bin/ethtool -s %k wol d"}}<br />
<br />
You can use multiple names in the matches; for example, {{ic|1=KERNEL=="lan0&#124;eth*"}}<br />
<br />
{{Note|This should be combined with [[udev#Network device|static naming]] of devices, the {{ic|eth*}} names are not static.}}<br />
<br />
=== PCI Runtime Power Management ===<br />
<br />
{{hc|/etc/udev/rules.d/pci_pm.rules|2=ACTION=="add", SUBSYSTEM=="pci", ATTR{power/control}="auto"}}<br />
<br />
=== Wireless power saving ===<br />
<br />
{{Accuracy|This method does not seem to work at the moment.}}<br />
<br />
Enabling for a specific interface:<br />
<br />
{{Note|This should be combined with [[udev#Network device|static naming]] of devices, the eth* names are not static. In the below examples there are some assumptions about how your devices are named. The first assumes that your wireless has the kernel name of "wifi0" and the second that any wireless interface will begin with "wlan". Of course, with persistent naming included now in systemd, this is probably no longer the case. "%k" in the second example is a variable for the kernel name for the matched device. For example if it finds that the rule is applicable to wlan1, the "%k" variable will be replaced ith "wlan1".}}<br />
<br />
{{hc|/etc/udev/rules.d/wlan0_power_save.rules|2=ACTION=="add", SUBSYSTEM=="net", KERNEL=="wifi0" RUN+="/usr/sbin/iw dev wifi0 set power_save on"}}<br />
<br />
Enabling for all interfaces:<br />
<br />
{{hc|/etc/udev/rules.d/wifi_power_save.rules|2=ACTION=="add", SUBSYSTEM=="net", KERNEL=="wlan*" RUN+="/usr/sbin/iw dev %k set power_save on"}}<br />
<br />
=== Writeback Time ===<br />
Increasing the VM dirty writeback time can help to aggregate I/O together - reducing disk writes, and decreasing power usage:<br />
<br />
{{hc|/etc/sysctl.d/dirty_writeback.conf|2=vm.dirty_writeback_centisecs = 1500}}<br />
<br />
To do the same for journal commits with ext4 and some other filesystems, use {{ic|1=commit=15}} as a parameter in [[fstab]] or with the {{ic|rootflags}} [[kernel parameter]].<br />
<br />
=== Laptop Mode ===<br />
<br />
{{hc|/etc/sysctl.d/laptop_mode.conf|2=vm.laptop_mode = 5}}<br />
<br />
=== SATA Active Link Power Management ===<br />
<br />
{{Note|This adds latency when accessing a drive that has been idle, so it's one of the few settings that may be worth toggling based on whether you're on AC power.}}<br />
{{hc|/etc/udev/rules.d/hd_power_save.rules|2=SUBSYSTEM=="scsi_host", KERNEL=="host*", ATTR{link_power_management_policy}="min_power"}}<br />
<br />
=== USB Autosuspend ===<br />
<br />
To enable USB autosuspend after 2 seconds of inactivity:<br />
{{hc|/etc/udev/rules.d/usb_power_save.rules|2=ACTION=="add", SUBSYSTEM=="usb", TEST=="power/control" ATTR{power/control}="auto"<br />
ACTION=="add", SUBSYSTEM=="usb", TEST=="power/autosuspend" ATTR{power/autosuspend}="2"}}<br />
<br />
=== Device Power Management ===<br />
<br />
{{accuracy|reason=Should be done with a udev rule.}}<br />
<br />
echo auto | tee /sys/bus/i2c/devices/*/power/control > /dev/null<br />
echo auto | tee /sys/bus/spi/devices/*/power/control > /dev/null<br />
<br />
== Tools and scripts ==<br />
<br />
=== Packages ===<br />
<br />
There are many scripts and tools which make use of the various settings described in the previous sections. These are notably:<br />
<br />
* [[TLP]]<br />
* [[Powerdown]]<br />
* {{AUR|powerconf}}<br />
* {{AUR|ftw-git}}<br />
* [[Laptop Mode Tools]]<br />
* [[pm-utils]]<br />
<br />
If you do not want to take care of the settings by yourself it is recommended to use these tools. But be aware of running only '''one''' of these tools to avoid possible conflicts as they all work more or less similar.<br />
<br />
=== Print power settings ===<br />
<br />
This script prints power settings and a variety of other properties for USB and PCI devices. Note that root permissions are needed to see all settings.<br />
<br />
{{bc|<nowiki>#!/bin/bash<br />
<br />
for i in $(find /sys/devices -name "bMaxPower")<br />
do<br />
busdir=${i%/*}<br />
busnum=$(<$busdir/busnum)<br />
devnum=$(<$busdir/devnum)<br />
title=$(lsusb -s $busnum:$devnum)<br />
<br />
printf "\n\n+++ %s\n -%s\n" "$title" "$busdir"<br />
<br />
for ff in $(find $busdir/power -type f ! -empty 2>/dev/null)<br />
do<br />
v=$(cat $ff 2>/dev/null|tr -d "\n")<br />
[[ ${#v} -gt 0 ]] && echo -e " ${ff##*/}=$v";<br />
v=;<br />
done | sort -g;<br />
done;<br />
<br />
printf "\n\n\n+++ %s\n" "Kernel Modules"<br />
for mod in $(lspci -k | sed -n '/in use:/s,^.*: ,,p' | sort -u)<br />
do<br />
echo "+ $mod";<br />
systool -v -m $mod 2> /dev/null | sed -n "/Parameters:/,/^$/p";<br />
done</nowiki>}}</div>Holomorphhttps://wiki.archlinux.org/index.php?title=Power_saving&diff=261761Power saving2013-06-08T05:35:58Z<p>Holomorph: </p>
<hr />
<div>{{Article summary start}}<br />
{{Article summary text|Configuration and tools for saving power.}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|CPU Frequency Scaling}}<br />
{{Article summary wiki|Kernel modules}}<br />
{{Article summary wiki|Hybrid graphics}}<br />
{{Article summary wiki|Sysctl}}<br />
{{Article summary wiki|udev}}<br />
{{Article summary end}}<br />
<br />
[[Category:Power management]]<br />
This article covers the configuration needed to turn on power saving features. Almost all of the features listed here are worth using whether or not the computer is on AC or battery power. Most have negligible performance impact and are just not enabled by default because of commonly broken hardware/drivers. Reducing power usage means reducing heat, which can even lead to higher performance on a modern Intel or AMD CPU, thanks to [[Wikipedia:Intel Turbo Boost|dynamic overclocking]].<br />
<br />
== Configuration ==<br />
<br />
If you would like to create your own scripts and power saving settings such as by udev rules you can take the following settings as a reference.<br />
<br />
=== Audio ===<br />
<br />
By default, audio power saving is turned off by most drivers. It can be enabled by setting the power_save parameter to a time (in seconds) to go in idle.<br />
<br />
{{Note|Toggling the audio card's power state can cause a popping sound or noticeable latency on some broken hardware.}}<br />
<br />
;Intel<br />
<br />
{{hc|/etc/modprobe.d/audio_power_save.conf|2=options snd_hda_intel power_save=1}}<br />
<br />
;ac97<br />
<br />
{{hc|/etc/modprobe.d/audio_power_save.conf|2=options snd_ac97_codec power_save=1}}<br />
<br />
=== Active state power management ===<br />
<br />
To verify that [[Wikipedia:Active State Power Management|ASPM]] is enabled:<br />
<br />
{{hc|$ cat /sys/module/pcie_aspm/parameters/policy|[default] performance powersave}}<br />
<br />
Either {{ic|[default]}} or {{ic|[powersave]}} means you do not need to force it on.<br />
<br />
Otherwise, it's either unsupported/broken on your hardware, or has to be forced on with {{ic|1=pcie_aspm=force}} on the [[kernel line]].<br />
<br />
{{Warning|<br />
* Forcing on ASPM can cause a freeze/panic, so make sure you have a way to undo the option if it doesn't work.<br />
* On systems that don't support it forcing on ASPM can even increase power consumption.}}<br />
<br />
=== Backlight ===<br />
<br />
When system starts, screen backlight is set to maximum by default. This can be fixed by specifying backlight level in the following udev rule:<br />
<br />
{{hc|/etc/udev/rules.d/backlight.rules|<nowiki><br />
## SET BACKLIGHT<br />
SUBSYSTEM=="backlight", ACTION=="add", KERNEL=="acpi_video0", ATTR{brightness}="1"<br />
</nowiki>}}<br />
<br />
=== Bluetooth ===<br />
<br />
{{expansion|reason=The device should likely be disabled with hciconfig first.}}<br />
[[Kernel_modules#Blacklisting|Blacklist]] the {{ic|hci_usb}} module if the driver is loaded automatically.<br />
<br />
Alternatively, [[Kernel_modules#Blacklisting|blacklist]] the {{ic|btusb}} and {{ic|bluetooth}} modules.<br />
<br />
Another variant is to {{pkg|rfkill}} it:<br />
# rfkill block bluetooth<br />
<br />
Or with udev rule:<br />
{{hc|/etc/udev/rules.d/bt.rules|<nowiki><br />
## DISABLE BLUETOOTH<br />
SUBSYSTEM=="rfkill", ATTR{type}=="bluetooth", ATTR{state}="0"<br />
</nowiki>}}<br />
<br />
=== Web-Camera ===<br />
<br />
If you won't use integrated web camera then [[Kernel_modules#Blacklisting|blacklist]] the {{ic|uvcvideo}} module.<br />
<br />
=== Disabling NMI watchdog ===<br />
<br />
The [[Wikipedia:Non-maskable interrupt|NMI]] watchdog is a debugging feature to catch hardware hangs and cause a kernel panic. On some systems it can generate a lot of interrupts, causing a noticeable increase in power usage.<br />
<br />
{{hc|/etc/sysctl.d/disable_watchdog.conf|2=kernel.nmi_watchdog = 0}}<br />
<br />
or add {{ic|1=nmi_watchdog=0}} as a [[kernel parameter]] to disable it completely from early boot.<br />
<br />
=== Disabling Wake-on-LAN ===<br />
<br />
[[Wikipedia:Wake-on-LAN|Wake-on-LAN]] can be a useful feature, but if you're not making use of it then it's simply draining extra power waiting for a magic packet while in suspend.<br />
<br />
Disabling for all Ethernet interfaces:<br />
<br />
{{hc|/etc/udev/rules.d/disable_wol.rules|2=ACTION=="add", SUBSYSTEM=="net", KERNEL=="eth*" RUN+="/usr/bin/ethtool -s %k wol d"}}<br />
<br />
You can use multiple names in the matches; for example, {{ic|1=KERNEL=="lan0&#124;eth*"}}<br />
<br />
{{Note|This should be combined with [[udev#Network device|static naming]] of devices, the {{ic|eth*}} names are not static.}}<br />
<br />
=== PCI Runtime Power Management ===<br />
<br />
{{hc|/etc/udev/rules.d/pci_pm.rules|2=ACTION=="add", SUBSYSTEM=="pci", ATTR{power/control}="auto"}}<br />
<br />
=== Wireless power saving ===<br />
<br />
{{Accuracy|This method does not seem to work at the moment.}}<br />
<br />
Enabling for a specific interface:<br />
<br />
{{Note|This should be combined with [[udev#Network device|static naming]] of devices, the eth* names are not static. In the below examples there are some assumptions about how your devices are named. The first assumes that your wireless has the kernel name of "wifi0" and the second that any wireless interface will begin with "wlan". Of course, with persistent naming included now in systemd, this is probably no longer the case. "%k" in the second example is a variable for the kernel name for the matched device. For example if it finds that the rule is applicable to wlan1, the "%k" variable will be replaced ith "wlan1".}}<br />
<br />
{{hc|/etc/udev/rules.d/wlan0_power_save.rules|2=ACTION=="add", SUBSYSTEM=="net", KERNEL=="wifi0" RUN+="/usr/sbin/iw dev wifi0 set power_save on"}}<br />
<br />
Enabling for all interfaces:<br />
<br />
{{hc|/etc/udev/rules.d/wifi_power_save.rules|2=ACTION=="add", SUBSYSTEM=="net", KERNEL=="wlan*" RUN+="/usr/sbin/iw dev %k set power_save on"}}<br />
<br />
=== Writeback Time ===<br />
Increasing the VM dirty writeback time can help to aggregate I/O together - reducing disk writes, and decreasing power usage:<br />
<br />
{{hc|/etc/sysctl.d/dirty_writeback.conf|2=vm.dirty_writeback_centisecs = 1500}}<br />
<br />
To do the same for journal commits with ext4 and some other filesystems, use {{ic|1=commit=15}} as a parameter in [[fstab]] or with the {{ic|rootflags}} [[kernel parameter]].<br />
<br />
=== Laptop Mode ===<br />
<br />
{{hc|/etc/sysctl.d/laptop_mode.conf|2=vm.laptop_mode = 5}}<br />
<br />
=== SATA Active Link Power Management ===<br />
<br />
{{Note|This adds latency when accessing a drive that has been idle, so it's one of the few settings that may be worth toggling based on whether you're on AC power.}}<br />
{{hc|/etc/udev/rules.d/hd_power_save.rules|2=SUBSYSTEM=="scsi_host", KERNEL=="host*", ATTR{link_power_management_policy}="min_power"}}<br />
<br />
=== USB Autosuspend ===<br />
<br />
To enable USB autosuspend after 2 seconds of inactivity:<br />
{{hc|/etc/udev/rules.d/usb_power_save.rules|2=ACTION=="add", SUBSYSTEM=="usb", TEST=="power/control" ATTR{power/control}="auto"<br />
ACTION=="add", SUBSYSTEM=="usb", TEST=="power/autosuspend" ATTR{power/autosuspend}="2"}}<br />
<br />
=== Device Power Management ===<br />
<br />
{{accuracy|reason=Should be done with a udev rule.}}<br />
<br />
echo auto | tee /sys/bus/i2c/devices/*/power/control > /dev/null<br />
echo auto | tee /sys/bus/spi/devices/*/power/control > /dev/null<br />
<br />
== Tools and scripts ==<br />
<br />
=== Packages ===<br />
<br />
There are many scripts and tools which make use of the various settings described in the previous sections. These are notably:<br />
<br />
* [[TLP]]<br />
* [[Powerdown]]<br />
* {{AUR|powerconf}}<br />
* {{AUR|ftw-git}}<br />
* [[Laptop Mode Tools]]<br />
* [[pm-utils]]<br />
<br />
If you do not want to take care of the settings by yourself it is recommended to use these tools. But be aware of running only '''one''' of these tools to avoid possible conflicts as they all work more or less similar.<br />
<br />
=== Print power settings ===<br />
<br />
This script prints power settings and a variety of other properties for USB and PCI devices. Note that root permissions are needed to see all settings.<br />
<br />
{{bc|<nowiki>#!/bin/bash<br />
<br />
for i in $(find /sys/devices -name "bMaxPower")<br />
do<br />
busdir=${i%/*}<br />
busnum=$(<$busdir/busnum)<br />
devnum=$(<$busdir/devnum)<br />
title=$(lsusb -s $busnum:$devnum)<br />
<br />
printf "\n\n+++ %s\n -%s\n" "$title" "$busdir"<br />
<br />
for ff in $(find $busdir/power -type f ! -empty 2>/dev/null)<br />
do<br />
v=$(cat $ff 2>/dev/null|tr -d "\n")<br />
[[ ${#v} -gt 0 ]] && echo -e " ${ff##*/}=$v";<br />
v=;<br />
done | sort -g;<br />
done;<br />
<br />
printf "\n\n\n+++ %s\n" "Kernel Modules"<br />
for mod in $(lspci -k | sed -n '/in use:/s,^.*: ,,p' | sort -u)<br />
do<br />
echo "+ $mod";<br />
systool -v -m $mod 2> /dev/null | sed -n "/Parameters:/,/^$/p";<br />
done</nowiki>}}</div>Holomorphhttps://wiki.archlinux.org/index.php?title=Power_saving&diff=261728Power saving2013-06-07T23:48:56Z<p>Holomorph: summary and related articles</p>
<hr />
<div>{{Article summary start}}<br />
{{Article summary text|Configuration and tools for saving power.}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|CPU Frequency Scaling}}<br />
{{Article summary wiki|Hybrid graphics}}<br />
{{Article summary wiki|udev}}<br />
{{Article summary end}}<br />
<br />
[[Category:Power management]]<br />
This article covers the configuration needed to turn on power saving features. Almost all of the features listed here are worth using whether or not the computer is on AC or battery power. Most have negligible performance impact and are just not enabled by default because of commonly broken hardware/drivers. Reducing power usage means reducing heat, which can even lead to higher performance on a modern Intel or AMD CPU, thanks to [[Wikipedia:Intel Turbo Boost|dynamic overclocking]].<br />
<br />
== Ready to run scripts ==<br />
<br />
There are already a couple of scripts and tools which make use of the various settings described in the next section. These are notably:<br />
<br />
* [[TLP]]<br />
* [[Powerdown]]<br />
* {{AUR|powerconf}}<br />
*{{AUR|ftw-git}}<br />
* [[Laptop Mode Tools]]<br />
* [[pm-utils]]<br />
<br />
If you do not want to take care of the settings by yourself it is recommended to use these tools. But be aware of running only '''one''' of these tools to avoid possible conflicts as they all work more or less similar.<br />
<br />
== Custom settings ==<br />
<br />
If you would like to create your own scripts and power saving settings such as by udev rules you can take the following settings as a reference.<br />
<br />
=== Audio ===<br />
<br />
By default, audio power saving is turned off by most drivers. It can be enabled by setting the power_save parameter to a time (in seconds) to go in idle.<br />
<br />
{{Note|Toggling the audio card's power state can cause a popping sound or noticeable latency on some broken hardware.}}<br />
<br />
;Intel<br />
<br />
{{hc|/etc/modprobe.d/audio_power_save.conf|2=options snd_hda_intel power_save=1}}<br />
<br />
;ac97<br />
<br />
{{hc|/etc/modprobe.d/audio_power_save.conf|2=options snd_ac97_codec power_save=1}}<br />
<br />
=== Active state power management ===<br />
<br />
To verify that [[Wikipedia:Active State Power Management|ASPM]] is enabled:<br />
<br />
{{hc|$ cat /sys/module/pcie_aspm/parameters/policy|[default] performance powersave}}<br />
<br />
Either {{ic|[default]}} or {{ic|[powersave]}} means you do not need to force it on.<br />
<br />
Otherwise, it's either unsupported/broken on your hardware, or has to be forced on with {{ic|1=pcie_aspm=force}} on the [[kernel line]].<br />
<br />
{{Warning|<br />
* Forcing on ASPM can cause a freeze/panic, so make sure you have a way to undo the option if it doesn't work.<br />
* On systems that don't support it forcing on ASPM can even increase power consumption.}}<br />
<br />
=== Backlight ===<br />
<br />
When system starts, screen backlight is set to maximum by default. This can be fixed by specifying backlight level in the following udev rule:<br />
<br />
{{hc|/etc/udev/rules.d/backlight.rules|<nowiki><br />
## SET BACKLIGHT<br />
SUBSYSTEM=="backlight", ACTION=="add", KERNEL=="acpi_video0", ATTR{brightness}="1"<br />
</nowiki>}}<br />
<br />
=== Bluetooth ===<br />
<br />
{{expansion|reason=The device should likely be disabled with hciconfig first.}}<br />
[[Kernel_modules#Blacklisting|Blacklist]] the {{ic|hci_usb}} module if the driver is loaded automatically.<br />
<br />
Alternatively, [[Kernel_modules#Blacklisting|blacklist]] the {{ic|btusb}} and {{ic|bluetooth}} modules.<br />
<br />
Another variant is to {{pkg|rfkill}} it:<br />
# rfkill block bluetooth<br />
<br />
Or with udev rule:<br />
{{hc|/etc/udev/rules.d/bt.rules|<nowiki><br />
## DISABLE BLUETOOTH<br />
SUBSYSTEM=="rfkill", ATTR{type}=="bluetooth", ATTR{state}="0"<br />
</nowiki>}}<br />
<br />
=== Web-Camera ===<br />
<br />
If you won't use integrated web camera then [[Kernel_modules#Blacklisting|blacklist]] the {{ic|uvcvideo}} module.<br />
<br />
=== Disabling NMI watchdog ===<br />
<br />
The [[Wikipedia:Non-maskable interrupt|NMI]] watchdog is a debugging feature to catch hardware hangs and cause a kernel panic. On some systems it can generate a lot of interrupts, causing a noticeable increase in power usage.<br />
<br />
{{hc|/etc/sysctl.d/disable_watchdog.conf|2=kernel.nmi_watchdog = 0}}<br />
<br />
or add {{ic|1=nmi_watchdog=0}} as a [[kernel parameter]] to disable it completely from early boot.<br />
<br />
=== Disabling Wake-on-LAN ===<br />
<br />
[[Wikipedia:Wake-on-LAN|Wake-on-LAN]] can be a useful feature, but if you're not making use of it then it's simply draining extra power waiting for a magic packet while in suspend.<br />
<br />
Disabling for all Ethernet interfaces:<br />
<br />
{{hc|/etc/udev/rules.d/disable_wol.rules|2=ACTION=="add", SUBSYSTEM=="net", KERNEL=="eth*" RUN+="/usr/bin/ethtool -s %k wol d"}}<br />
<br />
You can use multiple names in the matches; for example, {{ic|1=KERNEL=="lan0&#124;eth*"}}<br />
<br />
{{Note|This should be combined with [[udev#Network device|static naming]] of devices, the {{ic|eth*}} names are not static.}}<br />
<br />
=== PCI Runtime Power Management ===<br />
<br />
{{hc|/etc/udev/rules.d/pci_pm.rules|2=ACTION=="add", SUBSYSTEM=="pci", ATTR{power/control}="auto"}}<br />
<br />
=== Wireless power saving ===<br />
<br />
{{Accuracy|This method does not seem to work at the moment.}}<br />
<br />
Enabling for a specific interface:<br />
<br />
{{Note|This should be combined with [[udev#Network device|static naming]] of devices, the eth* names are not static. In the below examples there are some assumptions about how your devices are named. The first assumes that your wireless has the kernel name of "wifi0" and the second that any wireless interface will begin with "wlan". Of course, with persistent naming included now in systemd, this is probably no longer the case. "%k" in the second example is a variable for the kernel name for the matched device. For example if it finds that the rule is applicable to wlan1, the "%k" variable will be replaced ith "wlan1".}}<br />
<br />
{{hc|/etc/udev/rules.d/wlan0_power_save.rules|2=ACTION=="add", SUBSYSTEM=="net", KERNEL=="wifi0" RUN+="/usr/sbin/iw dev wifi0 set power_save on"}}<br />
<br />
Enabling for all interfaces:<br />
<br />
{{hc|/etc/udev/rules.d/wifi_power_save.rules|2=ACTION=="add", SUBSYSTEM=="net", KERNEL=="wlan*" RUN+="/usr/sbin/iw dev %k set power_save on"}}<br />
<br />
=== Writeback Time ===<br />
Increasing the VM dirty writeback time can help to aggregate I/O together - reducing disk writes, and decreasing power usage:<br />
<br />
{{hc|/etc/sysctl.d/dirty_writeback.conf|2=vm.dirty_writeback_centisecs = 1500}}<br />
<br />
To do the same for journal commits with ext4 and some other filesystems, use {{ic|1=commit=15}} as a parameter in [[fstab]] or with the {{ic|rootflags}} [[kernel parameter]].<br />
<br />
=== Laptop Mode ===<br />
<br />
{{hc|/etc/sysctl.d/laptop_mode.conf|2=vm.laptop_mode = 5}}<br />
<br />
=== SATA Active Link Power Management ===<br />
<br />
{{Note|This adds latency when accessing a drive that has been idle, so it's one of the few settings that may be worth toggling based on whether you're on AC power.}}<br />
{{hc|/etc/udev/rules.d/hd_power_save.rules|2=SUBSYSTEM=="scsi_host", KERNEL=="host*", ATTR{link_power_management_policy}="min_power"}}<br />
<br />
=== USB Autosuspend ===<br />
<br />
To enable USB autosuspend after 2 seconds of inactivity:<br />
{{hc|/etc/udev/rules.d/usb_power_save.rules|2=ACTION=="add", SUBSYSTEM=="usb", TEST=="power/control" ATTR{power/control}="auto"<br />
ACTION=="add", SUBSYSTEM=="usb", TEST=="power/autosuspend" ATTR{power/autosuspend}="2"}}<br />
<br />
=== Device Power Management ===<br />
<br />
{{accuracy|reason=Should be done with a udev rule.}}<br />
<br />
echo auto | tee /sys/bus/i2c/devices/*/power/control > /dev/null<br />
echo auto | tee /sys/bus/spi/devices/*/power/control > /dev/null<br />
<br />
== View Power Setings ==<br />
<br />
This function shows various power settings. Note you either must be root or you must have sudo.<br />
<br />
{{bc|<nowiki>function aa_power_settings ()<br />
{ <br />
sudo bash -c '<br />
for i in `find /sys/devices -name "bMaxPower"`;<br />
do<br />
for ii in `find $i -type f`;<br />
do<br />
bd=`dirname $ii`;<br />
busnum=`cat $bd/busnum`;<br />
devnum=`cat $bd/devnum`;<br />
title=`lsusb -s $busnum:$devnum`;<br />
echo -e "\n\n+++ $title\n -$bd\n -$ii";<br />
for ff in `find $bd/power -type f ! -empty 2>/dev/null`;<br />
do<br />
v=`cat $ff 2>/dev/null|tr -d "\n"`;<br />
[[ ${#v} -gt 0 ]] && echo -e " `basename $ff`=$v";<br />
v=;<br />
done | sort -g;<br />
done;<br />
done;<br />
echo -e "\n\n\n+++ Kernel Modules\n";<br />
for m in `command lspci -k|sed -n "/in use:/s,^.*: ,,p"|sort -u`;<br />
do<br />
echo "+ $m";<br />
systool -v -m $m 2> /dev/null | sed -n "/Parameters:/,/^$/p";<br />
done<br />
';<br />
}</nowiki>}}</div>Holomorphhttps://wiki.archlinux.org/index.php?title=Power_saving&diff=258063Power saving2013-05-20T20:58:12Z<p>Holomorph: /* Disabling Wake-on-LAN */</p>
<hr />
<div>[[Category:Power management]]<br />
This article covers the configuration needed to turn on power saving features. Almost all of the features listed here are worth using whether or not the computer is on AC or battery power. Most have negligible performance impact and are just not enabled by default because of commonly broken hardware/drivers. Reducing power usage means reducing heat, which can even lead to higher performance on a modern Intel or AMD CPU, thanks to [[Wikipedia:Intel Turbo Boost|dynamic overclocking]].<br />
<br />
==Ready to run scripts==<br />
There are already a couple of scripts and tools which make use of the various settings described in the next section. These are notably:<br />
<br />
* [[TLP]]<br />
* [[Powerdown]]<br />
* {{AUR|powerconf}}<br />
*{{AUR|ftw-git}}<br />
* [[Laptop Mode Tools]]<br />
* [[pm-utils]]<br />
<br />
If you do not want to take care of the settings by yourself it is recommended to use these tools. But be aware of running only '''one''' of these tools to avoid possible conflicts as they all work more or less similar.<br />
<br />
=Custom settings=<br />
If you would like to create your own scripts and power saving settings such as by udev rules you can take the following settings as a reference.<br />
<br />
==Audio==<br />
<br />
By default, audio power saving is turned off by most drivers. It can be enabled by setting the power_save parameter to a time (in seconds) to go in idle.<br />
<br />
{{Note|Toggling the audio card's power state can cause a popping sound or noticeable latency on some broken hardware.}}<br />
<br />
;Intel<br />
<br />
{{hc|/etc/modprobe.d/audio_power_save.conf|2=options snd_hda_intel power_save=1}}<br />
<br />
;ac97<br />
<br />
{{hc|/etc/modprobe.d/audio_power_save.conf|2=options snd_ac97_codec power_save=1}}<br />
<br />
==Active State Power Management==<br />
<br />
To verify that [[Wikipedia:Active State Power Management|ASPM]] is enabled:<br />
<br />
{{hc|$ cat /sys/module/pcie_aspm/parameters/policy|[default] performance powersave}}<br />
<br />
Either {{ic|[default]}} or {{ic|[powersave]}} means you do not need to force it on.<br />
<br />
Otherwise, it's either unsupported/broken on your hardware, or has to be forced on with {{ic|1=pcie_aspm=force}} on the [[kernel line]].<br />
<br />
{{Warning|Forcing on ASPM can cause a freeze/panic, so make sure you have a way to undo the option if it doesn't work.}}<br />
{{Warning|On systems that don't support it forcing on ASPM can even increase power consumption.}}<br />
<br />
== Backlight ==<br />
<br />
When system starts, screen backlight is set to maximum by default. This can be fixed by specifying backlight level in the following udev rule:<br />
<br />
{{hc|/etc/udev/rules.d/backlight.rules|<nowiki><br />
## SET BACKLIGHT<br />
SUBSYSTEM=="backlight", ACTION=="add", KERNEL=="acpi_video0", ATTR{brightness}="1"<br />
</nowiki>}}<br />
<br />
== Bluetooth ==<br />
{{expansion|reason=The device should likely be disabled with hciconfig first.}}<br />
[[Kernel_modules#Blacklisting|Blacklist]] the {{ic|hci_usb}} module if the driver is loaded automatically.<br />
<br />
Alternatively, [[Kernel_modules#Blacklisting|blacklist]] the {{ic|btusb}} and {{ic|bluetooth}} modules.<br />
<br />
Another variant is to {{pkg|rfkill}} it:<br />
# rfkill block bluetooth<br />
<br />
Or with udev rule:<br />
{{hc|/etc/udev/rules.d/bt.rules|<nowiki><br />
## DISABLE BLUETOOTH<br />
SUBSYSTEM=="rfkill", ATTR{type}=="bluetooth", ATTR{state}="0"<br />
</nowiki>}}<br />
<br />
== Web-Camera ==<br />
If you won't use integrated web camera then [[Kernel_modules#Blacklisting|blacklist]] the {{ic|uvcvideo}} module.<br />
<br />
==Disabling NMI watchdog==<br />
The [[Wikipedia:Non-maskable interrupt|NMI]] watchdog is a debugging feature to catch hardware hangs and cause a kernel panic. On some systems it can generate a lot of interrupts, causing a noticeable increase in power usage.<br />
<br />
{{hc|/etc/sysctl.d/disable_watchdog.conf|2=kernel.nmi_watchdog = 0}}<br />
<br />
or add {{ic|1=nmi_watchdog=0}} as a [[kernel parameter]] to disable it completely from early boot.<br />
<br />
==Disabling Wake-on-LAN==<br />
<br />
[[Wikipedia:Wake-on-LAN|Wake-on-LAN]] can be a useful feature, but if you're not making use of it then it's simply draining extra power waiting for a magic packet while in suspend.<br />
<br />
Disabling for all Ethernet interfaces:<br />
<br />
{{hc|/etc/udev/rules.d/disable_wol.rules|2=ACTION=="add", SUBSYSTEM=="net", KERNEL=="eth*" RUN+="/usr/bin/ethtool -s %k wol d"}}<br />
<br />
You can use multiple names in the matches; for example, {{ic|1=KERNEL=="lan0&#124;eth*"}}<br />
<br />
{{Note|This should be combined with [[udev#Network device|static naming]] of devices, the {{ic|eth*}} names are not static.}}<br />
<br />
== PCI Runtime Power Management ==<br />
<br />
{{hc|/etc/udev/rules.d/pci_pm.rules|2=ACTION=="add", SUBSYSTEM=="pci", ATTR{power/control}="auto"}}<br />
<br />
==Wireless power saving==<br />
{{Accuracy|This method does not seem to work at the moment.}}<br />
<br />
Enabling for a specific interface:<br />
<br />
{{Note|This should be combined with [[udev#Network device|static naming]] of devices, the eth* names are not static. In the below examples there are some assumptions about how your devices are named. The first assumes that your wireless has the kernel name of "wifi0" and the second that any wireless interface will begin with "wlan". Of course, with persistent naming included now in systemd, this is probably no longer the case. "%k" in the second example is a variable for the kernel name for the matched device. For example if it finds that the rule is applicable to wlan1, the "%k" variable will be replaced ith "wlan1".}}<br />
<br />
{{hc|/etc/udev/rules.d/wlan0_power_save.rules|2=ACTION=="add", SUBSYSTEM=="net", KERNEL=="wifi0" RUN+="/usr/sbin/iw dev wifi0 set power_save on"}}<br />
<br />
Enabling for all interfaces:<br />
<br />
{{hc|/etc/udev/rules.d/wifi_power_save.rules|2=ACTION=="add", SUBSYSTEM=="net", KERNEL=="wlan*" RUN+="/usr/sbin/iw dev %k set power_save on"}}<br />
<br />
== Writeback Time ==<br />
Increasing the VM dirty writeback time can help to aggregate I/O together - reducing disk writes, and decreasing power usage:<br />
<br />
{{hc|/etc/sysctl.d/dirty_writeback.conf|2=vm.dirty_writeback_centisecs = 1500}}<br />
<br />
To do the same for journal commits with ext4 and some other filesystems, use {{ic|1=commit=15}} as a parameter in [[fstab]] or with the {{ic|rootflags}} [[kernel parameter]].<br />
<br />
== Laptop Mode ==<br />
<br />
{{hc|/etc/sysctl.d/laptop_mode.conf|2=vm.laptop_mode = 5}}<br />
<br />
== SATA Active Link Power Management ==<br />
{{Note|This adds latency when accessing a drive that has been idle, so it's one of the few settings that may be worth toggling based on whether you're on AC power.}}<br />
{{hc|/etc/udev/rules.d/hd_power_save.rules|2=SUBSYSTEM=="scsi_host", KERNEL=="host*", ATTR{link_power_management_policy}="min_power"}}<br />
<br />
== USB Autosuspend ==<br />
To enable USB autosuspend after 2 seconds of inactivity:<br />
{{hc|/etc/udev/rules.d/usb_power_save.rules|2=ACTION=="add", SUBSYSTEM=="usb", TEST=="power/control" ATTR{power/control}="auto"<br />
ACTION=="add", SUBSYSTEM=="usb", TEST=="power/autosuspend" ATTR{power/autosuspend}="2"}}<br />
<br />
== Device Power Management ==<br />
{{accuracy|reason=Should be done with a udev rule.}}<br />
<br />
echo auto | tee /sys/bus/i2c/devices/*/power/control > /dev/null<br />
echo auto | tee /sys/bus/spi/devices/*/power/control > /dev/null<br />
<br />
== View Power Setings ==<br />
This function shows various power settings. Note you either must be root or you must have sudo.<br />
<br />
{{bc|<nowiki>function aa_power_settings ()<br />
{ <br />
sudo bash -c '<br />
for i in `find /sys/devices -name "bMaxPower"`;<br />
do<br />
for ii in `find $i -type f`;<br />
do<br />
bd=`dirname $ii`;<br />
busnum=`cat $bd/busnum`;<br />
devnum=`cat $bd/devnum`;<br />
title=`lsusb -s $busnum:$devnum`;<br />
echo -e "\n\n+++ $title\n -$bd\n -$ii";<br />
for ff in `find $bd/power -type f ! -empty 2>/dev/null`;<br />
do<br />
v=`cat $ff 2>/dev/null|tr -d "\n"`;<br />
[[ ${#v} -gt 0 ]] && echo -e " `basename $ff`=$v";<br />
v=;<br />
done | sort -g;<br />
done;<br />
done;<br />
echo -e "\n\n\n+++ Kernel Modules\n";<br />
for m in `command lspci -k|sed -n "/in use:/s,^.*: ,,p"|sort -u`;<br />
do<br />
echo "+ $m";<br />
systool -v -m $m 2> /dev/null | sed -n "/Parameters:/,/^$/p";<br />
done<br />
';<br />
}</nowiki>}}<br />
<br />
== See also ==<br />
<br />
* [[CPU Frequency Scaling]]</div>Holomorphhttps://wiki.archlinux.org/index.php?title=Tcplay&diff=253535Tcplay2013-04-09T21:51:25Z<p>Holomorph: /* Mounting an existing container for a user */</p>
<hr />
<div>[[Category:Security]]<br />
[[Category:File systems]]<br />
[[de:tcplay]]<br />
{{Article summary start}}<br />
{{Article summary text|Setup and usage of tcplay.}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|Disk Encryption}}<br />
{{Article summary wiki|TrueCrypt}}<br />
{{Article summary end}}<br />
{{DISPLAYTITLE:tcplay}}<br />
'''tcplay''' is a free (BSD-licensed), pretty much fully featured (including<br />
multiple keyfiles, cipher cascades, etc.) and stable TrueCrypt implementation.<br />
<br />
Source: [https://github.com/bwalex/tc-play github project home]<br />
<br />
== Installation ==<br />
Install {{Ic|tcplay-git}} from the AUR.<br />
<br />
== Encrypting a file as a virtual volume ==<br />
<br />
Invoke <br />
<br />
$ losetup -f<br />
<br />
to find the first unused loopback device; in this example, {{Ic|/dev/loop0}}.<br />
<br />
{{Note|As of udev 181-5, the {{Ic|loop}} device module is no longer auto-loaded.}}<br />
<br />
Create a new container {{Ic|foo.tc}}, 20M in size for instance, in the working<br />
directory:<br />
<br />
# dd if=/dev/zero of=foo.tc bs=1 count=0 seek=20M<br />
# losetup /dev/loop0 foo.tc<br />
# tcplay -c -d /dev/loop0 -a whirlpool -b AES-256-XTS<br />
<br />
Enter a secure password for the volume, and confirm the query to overwrite<br />
{{Ic|foo.tc}} with the new volume. tcplay will then write random data into the<br />
volume. Map the volume and create a filesystem on it in order to mount<br />
<br />
# tcplay -m foo.tc -d /dev/loop0<br />
# mkfs.ext4 /dev/mapper/foo.tc<br />
# mount /dev/mapper/foo.tc /mnt/truecrypt/<br />
<br />
To unset the container,<br />
<br />
# umount /mnt/truecrypt<br />
# dmsetup remove foo.tc<br />
# losetup -d /dev/loop0<br />
<br />
==Mounting an existing container for a user==<br />
<br />
Consider {{Ic|/dev/loop0}} the first unused loop device, {{Ic|foo.tc}} the<br />
TrueCrypt container, {{Ic|/home/you/truecrypt/}} the desired mount point. The<br />
user {{Ic|you}} in this example has {{Ic|uid&#61;1000}} and {{Ic|gid&#61;100}}. The<br />
steps for mounting the container as a virtual volume are:<br />
<br />
# Associate loop device with the container<br />
# Map the container to the loop device<br />
# Mount the container in the filesystem<br />
<br />
The following commands perform the above actions.<br />
<br />
# losetup /dev/loop0 foo.tc<br />
# tcplay -m foo.tc -d /dev/loop0<br />
# mount -o nosuid,uid=1000,gid=100 /dev/mapper/foo.tc /home/you/truecrypt/<br />
<br />
To reverse them:<br />
<br />
# umount /home/you/truecrypt/<br />
# dmsetup remove foo.tc<br />
# losetup -d /dev/loop0<br />
<br />
==Related links==<br />
* [http://leaf.dragonflybsd.org/cgi/web-man?command=tcplay&section=8 Manual page for tcplay]<br />
* [http://jasonwryan.com/blog/2013/01/10/truecrypt/ Jason Ryan: Replacing TrueCrypt]<br />
* [http://www.truecrypt.org/ TrueCrypt Homepage]<br />
* [http://en.gentoo-wiki.com/wiki/TrueCrypt HOWTO: Truecrypt Gentoo wiki]<br />
* [http://www.howtoforge.com/truecrypt_data_encryption Truecrypt Tutorial on HowToForge]<br />
* [http://www.privacylover.com/encryption/analysis-is-there-a-backdoor-in-truecrypt-is-truecrypt-a-cia-honeypot/ There is a good chance the CIA has a backdoor?] (via [https://secure.wikimedia.org/wikipedia/en/wiki/Truecrypt wp])</div>Holomorphhttps://wiki.archlinux.org/index.php?title=User:Holomorph&diff=248256User:Holomorph2013-02-24T03:06:38Z<p>Holomorph: Created page with "holomorph"</p>
<hr />
<div>holomorph</div>Holomorphhttps://wiki.archlinux.org/index.php?title=TrueCrypt&diff=248196TrueCrypt2013-02-23T02:22:18Z<p>Holomorph: </p>
<hr />
<div>[[Category:Security]]<br />
[[Category:File systems]]<br />
[[de:TrueCrypt]]<br />
{{Article summary start}}<br />
{{Article summary text|Setup and usage of TrueCrypt.}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|Disk Encryption}}<br />
{{Article summary wiki|Tcplay}}<br />
{{Article summary end}}<br />
<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 />
For more details on how TrueCrypt compares to other disk encryption solution, see [[Disk Encryption#Comparison table]].<br />
<br />
== Installation ==<br />
Type as root in a terminal:<br />
# pacman -S truecrypt<br />
If you use any kernel other than {{Pkg|linux}} install the corresponding kernel module.<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 {{ic|truecrypt}} command. 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/modules-load.d/:<br />
# tee /etc/modules-load.d/truecrypt.conf <<< "truecrypt"<br />
<br />
{{Note | It does not appear that loading a module applies with TrueCrypt 7.0a, the current version in Arch as of 4/19/2011. The above advice may be outdated with respect to the module, however it is still important to enable {{ic|fuse}}, {{ic|loop}} and your encryption algorithm (e.g. {{ic|AES}}, {{ic|XTS}}, {{ic|SHA512}}) in custom kernels.}}<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 will not 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 are 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 />
Enter volume size (bytes - size/sizeK/sizeM/sizeG): 32M<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 />
Hash algorithm:<br />
1) RIPEMD-160<br />
2) SHA-1<br />
3) Whirlpool<br />
Select [1]: 1 <br />
<br />
Filesystem:<br />
1) FAT<br />
2) None<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 ''{{Ic|sudo}}'' 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 {{Ic|sudo}}. After running it check if the files that are to be encrypted are indeed no longer in the directory. (might want to try unimportant data first) If they are still there, note that {{ic|rm}} doesn't make the data unrecoverable.<br />
<br />
For more information about truecrypt in general, run:<br />
$ man truecrypt #Note: as of 1:7.1a-1 dont see a man or info page<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 --create-keyfile /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 --volume-type normal -c /dev/sda1<br />
<br />
Map the volume to /dev/mapper/truecrypt1:<br />
truecrypt -N 1 /dev/sda1<br />
<br />
If this command does not for you try this to map the volume:<br />
truecrypt --filesystem=none --slot=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 />
{{Box Note | Current Versions of truecrypt seem to support ntfs write support by default so the {{ic|--filesystem}} flag no longer seems to be necessary.}}<br />
<br />
In my example I want to mount a ntfs-volume, but truecrypt does not 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 />
You may also want to mount ntfs volume without execute flag on all files<br />
truecrypt --filesystem=ntfs-3g --fs-options=users,uid=$(id -u),gid=$(id -g),fmask=0113,dmask=0002<br />
<br />
== Mount volumes via fstab ==<br />
First of all, we need to write a script which will handle the way mounting via fstab is done. Place the following in {{ic|/sbin/mount.truecrypt}}:<br />
<br />
#!/usr/bin/env sh <br />
DEV="$1"<br />
MNTPT="$2"<br />
OPTIONS=""<br />
TCOPTIONS=""<br />
shift 3<br />
IFS=','<br />
for arg in $*; do<br />
if [ "${arg}" == "system" ]; then<br />
TCOPTIONS="${TCOPTIONS}-m=system "<br />
elif [[ "${arg}" == fs=* ]]; then<br />
FS=${arg#*=}<br />
TCOPTIONS="${TCOPTIONS}--filesystem=${FS} "<br />
else<br />
OPTIONS="${OPTIONS}${arg},"<br />
fi<br />
done<br />
truecrypt ${DEV} ${MNTPT} ${TCOPTIONS% *} --fs-options="${OPTIONS%,*}"<br />
<br />
Also do not forget to make the file executable:<br />
<br />
chmod +x /sbin/mount.truecrypt<br />
<br />
Finally, add the device to fstab somewhat like this:<br />
<br />
/dev/sdb3 /mnt truecrypt fs=vfat,defaults 0 0<br />
<br />
==Mount volumes using a systemd service==<br />
To use Truecrypt with systemd, it is advised to use truecrypt as decryptor and mapper and fstab to do the mounting of encrypted volumes.<br />
<br />
First, create this service [[Systemd/Services#truecrypt_volume_setup]] in {{ic|/usr/lib/systemd/system}}. Enable it with (assuming your encrypted volume is {{ic|/dev/sda2}}):<br />
# systemctl enable truecrypt@dev-sda2.service<br />
<br />
Secondly, create a line similar to that one in your fstab (the {{ic|2}} means your fs will be fscked regularly):<br />
{{hc|/etc/fstab|<nowiki><br />
/dev/mapper/truecrypt1 /home/ ext4 defaults 0 2</nowiki>}}<br />
<br />
And you should be set.<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 belongs 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 />
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 />
After that, you can mount your device by<br />
<br />
# truecrypt --mount /PATH/TO/DEVICE /PATH/TO/MOUNTPOINT<br />
<br />
Default mountpoint is ''/media/truecrypt1''. Normally, it is not necessary to explicitly specify the filesystem of your device using the ''--filesystem'' flag.<br />
<br />
It is definitely reasonable to give truecrypt some permission masks. Otherwise, every file on your mounted device will be executable. So instead of the above, you can use<br />
<br />
# truecrypt --fs-options=users,uid=$(id -u),gid=$(id -g),fmask=0113,dmask=0002 --mount /PATH/TO/DEVICE /PATH/TO/MOUNTPOINT<br />
<br />
and add this line to your bash configuration file, ''~/.bashrc'' as an alias:<br />
<br />
alias tc1='truecrypt --fs-options=users,uid=$(id -u),gid=$(id -g),fmask=0113,dmask=0002 --mount /PATH/TO/DEVICE /PATH/TO/MOUNTPOINT'<br />
<br />
To mount this specific device, use<br />
<br />
# tc1<br />
<br />
as a normal user.<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 />
===Automatic mount on login===<br />
Simply add <br />
$ truecrypt /home/user/myEncryptedFile.tc /home/user/myEncryptedFileFolder <<EOF<br />
password<br />
EOF<br />
to your startup procedure. Do not use the -p switch, this method is more secure. Otherwise everyone can just look up the password via [[ps]] and similar tools, as it is in the process name! [http://thoughtyblog.wordpress.com/2009/07/05/truecrypt-linux-hide-password-from-ps/ source]<br />
<br />
==Safely unmount and unmap volumes (on shutdown)==<br />
You can unmount a specific device by<br />
<br />
# truecrypt -d /PATH/TO/MOUNTPOINT<br />
<br />
or leave away the path to unmount all truecrypt volumes.<br />
<br />
If you want your truecrypt device to be unmounted automatically at shutdown, add the following to the file ''/etc/rc.local.shutdown'':<br />
<br />
if (/usr/bin/truecrypt --text --list)<br />
then {<br />
/usr/bin/truecrypt -d<br />
sleep 3<br />
}<br />
fi<br />
You can also leave away the ''sleep'' command, it is just to give the unmounting some time to complete before the actual shutdown.<br />
<br />
If you're using [[systemd]], there is a service trying to unmount truecrypt-encrypted filesystems at shutdown automatically on the [[Systemd/Services]] page.<br />
<br />
==Errors==<br />
===TrueCrypt is already running===<br />
If a messagebox ''TrueCrypt is already running'' appears when starting TrueCrypt, check for a hidden file in the home directory of the concerned user called ''.TrueCrypt-lock-username''. Substitute ''username'' with the individual username. Delete the file and start TrueCrypt again.<br />
<br />
===Deleted stale lockfile===<br />
If you always get a message "Delete stale lockfile [....]" after starting Truecrypt, the Truecrypt process with the lowest ID has to be killed during Gnome log out. A user in the Ubuntuforum provided the following solution: edit<br />
/etc/gdm/PostSession/Default <br />
and add the following line before exit 0:<br />
kill `ps -ef | grep truecrypt | tr -s ' ' | cut -d ' ' -f 2`<br />
<br />
===Issues with Unicode file / folder names ===<br />
====NTFS====<br />
Should files resp. folders containing Unicode characters in their names be incorrectly or not at all displayed on TrueCrypt NTFS volumes (while e. g. being correctly handled on non-encrypted NTFS partitions), first verify that you have the [[NTFS-3G]] driver installed and then create the following symlink as root:<br />
ln -s /sbin/mount.ntfs-3g /sbin/mount.ntfs<br />
That will cause TrueCrypt to automatically use this driver for NTFS volumes, having the same effect as the explicit use of<br />
truecrypt --filesystem=ntfs-3g /path/to/volume<br />
via the console.<br />
<br />
One may also consider setting e. g.<br />
rw,noatime<br />
amongst other options in the TrueCrypt GUI (Settings → Preferences → Mount Options).<br />
<br />
====FAT====<br />
Similarly, FAT32 volumes created using Windows may use Unicode rather than ISO 8859-1. In order to use UTF-8, set the mount option<br />
iocharset=utf8<br />
when mounting such volumes, or globally as described above.<br />
<br />
===Unmount error (device mapper)===<br />
If you always get a message "device-mapper: remove ioctl failed: Device or resource busy" when attempting to dismount your truecrypt volume, the solution is to goto: Setting > Preferences > System Integration > Kernel Service and check the box<br />
Do not use kernel cryptographic services<br />
{{Note|I have only seen this with a truecrypt partition. Not with a truecrypt file.}}<br />
<br />
===Failed to set up a loop device===<br />
If you get a message "Failed to set up a loop device" when trying to create/mount a TrueCrypt volume, it may be because you updated your kernel recently without rebooting.<br />
Rebooting should fix this error.<br />
<br />
Otherwise, check if {{ic|loop}} has been loaded as kernel module:<br />
<br />
lsmod | grep loop<br />
<br />
If not listed, retry the TrueCrypt command after {{ic|modprobe loop}}. Should it work, consider to add {{ic|loop}} to the MODULES array in {{ic|/etc/modules-load.d}}:<br />
<br />
# tee /etc/modules-load.d/truecrypt.conf <<< "loop"<br />
<br />
{{Note|As of udev 181-5, the loop device module is no longer auto-loaded, and the procedure described here is necessary.}}<br />
<br />
==Related links==<br />
* [http://www.truecrypt.org/ TrueCrypt Homepage]<br />
* [http://en.gentoo-wiki.com/wiki/TrueCrypt HOWTO: Truecrypt Gentoo wiki]<br />
* [http://www.howtoforge.com/truecrypt_data_encryption Truecrypt Tutorial on HowToForge]<br />
* [http://www.privacylover.com/encryption/analysis-is-there-a-backdoor-in-truecrypt-is-truecrypt-a-cia-honeypot/ There is a good chance the CIA has a backdoor?] (via [https://secure.wikimedia.org/wikipedia/en/wiki/Truecrypt wp])</div>Holomorphhttps://wiki.archlinux.org/index.php?title=Tcplay&diff=248194Tcplay2013-02-23T01:06:15Z<p>Holomorph: </p>
<hr />
<div>[[Category:Security]]<br />
[[Category:File systems]]<br />
[[de:tcplay]]<br />
{{Article summary start}}<br />
{{Article summary text|Setup and usage of tcplay.}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|Disk Encryption}}<br />
{{Article summary wiki|TrueCrypt}}<br />
{{Article summary end}}<br />
{{DISPLAYTITLE:tcplay}}<br />
'''tcplay''' is a free (BSD-licensed), pretty much fully featured (including<br />
multiple keyfiles, cipher cascades, etc.) and stable TrueCrypt implementation.<br />
<br />
Source: [https://github.com/bwalex/tc-play github project home]<br />
<br />
== Installation ==<br />
Install {{Ic|tcplay-git}} from the AUR.<br />
<br />
== Encrypting a file as a virtual volume ==<br />
<br />
Invoke <br />
<br />
$ losetup -f<br />
<br />
to find the first unused loopback device; in this example, {{Ic|/dev/loop0}}.<br />
<br />
{{Note|As of udev 181-5, the {{Ic|loop}} device module is no longer auto-loaded.}}<br />
<br />
Create a new container {{Ic|foo.tc}}, 20M in size for instance, in the working<br />
directory:<br />
<br />
# dd if=/dev/zero of=foo.tc bs=1 count=0 seek=20M<br />
# losetup /dev/loop0 foo.tc<br />
# tcplay -c -d /dev/loop0 -a whirlpool -b AES-256-XTS<br />
<br />
Enter a secure password for the volume, and confirm the query to overwrite<br />
{{Ic|foo.tc}} with the new volume. tcplay will then write random data into the<br />
volume. Map the volume and create a filesystem on it in order to mount<br />
<br />
# tcplay -m foo.tc -d /dev/loop0<br />
# mkfs.ext4 /dev/mapper/foo.tc<br />
# mount /dev/mapper/foo.tc /mnt/truecrypt/<br />
<br />
To unset the container,<br />
<br />
# umount /mnt/truecrypt<br />
# dmsetup remove foo.tc<br />
# losetup -d /dev/loop0<br />
<br />
==Mounting an existing container for a user==<br />
<br />
Consider {{Ic|/dev/loop0}} the first unused loop device, {{Ic|foo.tc}} the<br />
TrueCrypt container, {{Ic|/home/you/truecrypt/}} the desired mount point. The<br />
user {{Ic|you}} in this example has {{Ic|uid&#61;1000}} and {{Ic|gid&#61;100}}. The<br />
steps for mounting the container as a virtual volume are:<br />
<br />
# Associate loop device with the container<br />
# Map the container to the loop device<br />
# Mount the container in the filesystem<br />
<br />
The following commands perform the given actions and reverse them.<br />
<br />
# losetup /dev/loop0 foo.tc<br />
# tcplay -m foo.tc -d /dev/loop0<br />
# mount -o nosuid,uid=1000,gid=100 /dev/mapper/foo.tc /home/you/truecrypt/<br />
<br />
# umount /home/you/truecrypt/<br />
# dmsetup remove foo.tc<br />
# losetup -d /dev/loop0<br />
<br />
==Related links==<br />
* [http://leaf.dragonflybsd.org/cgi/web-man?command=tcplay&section=8 Manual page for tcplay]<br />
* [http://jasonwryan.com/blog/2013/01/10/truecrypt/ Jason Ryan: Replacing TrueCrypt]<br />
* [http://www.truecrypt.org/ TrueCrypt Homepage]<br />
* [http://en.gentoo-wiki.com/wiki/TrueCrypt HOWTO: Truecrypt Gentoo wiki]<br />
* [http://www.howtoforge.com/truecrypt_data_encryption Truecrypt Tutorial on HowToForge]<br />
* [http://www.privacylover.com/encryption/analysis-is-there-a-backdoor-in-truecrypt-is-truecrypt-a-cia-honeypot/ There is a good chance the CIA has a backdoor?] (via [https://secure.wikimedia.org/wikipedia/en/wiki/Truecrypt wp])</div>Holomorphhttps://wiki.archlinux.org/index.php?title=Tcplay&diff=248193Tcplay2013-02-23T00:58:17Z<p>Holomorph: </p>
<hr />
<div>[[Category:Security]]<br />
[[Category:File systems]]<br />
[[de:tcplay]]<br />
{{Article summary start}}<br />
{{Article summary text|Setup and usage of tcplay.}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|Disk Encryption}}<br />
{{Article summary wiki|TrueCrypt}}<br />
{{Article summary end}}<br />
{{DISPLAYTITLE:tcplay}}<br />
'''tcplay''' is a free (BSD-licensed), pretty much fully featured (including<br />
multiple keyfiles, cipher cascades, etc.) and stable TrueCrypt implementation.<br />
<br />
Source: [https://github.com/bwalex/tc-play github project home]<br />
<br />
== Installation ==<br />
Install {{Ic|tcplay-git}} from the AUR.<br />
<br />
== Encrypting a file as a virtual volume ==<br />
<br />
Invoke <br />
<br />
$ losetup -f<br />
<br />
to find the first unused loopback device; in this example, {{Ic|/dev/loop0}}.<br />
Create a new container {{Ic|foo.tc}}, 20M in size for instance, in the working<br />
directory:<br />
<br />
# dd if=/dev/zero of=foo.tc bs=1 count=0 seek=20M<br />
# losetup /dev/loop0 foo.tc<br />
# tcplay -c -d /dev/loop0 -a whirlpool -b AES-256-XTS<br />
<br />
Enter a secure password for the volume, and confirm the query to overwrite<br />
{{Ic|foo.tc}} with the new volume. tcplay will then write random data into the<br />
volume. Map the volume and create a filesystem on it in order to mount<br />
<br />
# tcplay -m foo.tc -d /dev/loop0<br />
# mkfs.ext4 /dev/mapper/foo.tc<br />
# mount /dev/mapper/foo.tc /mnt/truecrypt/<br />
<br />
To unset the container,<br />
<br />
# umount /mnt/truecrypt<br />
# dmsetup remove foo.tc<br />
# losetup -d /dev/loop0<br />
<br />
==Mounting an existing container for a user==<br />
<br />
Consider {{Ic|/dev/loop0}} the first unused loop device, {{Ic|foo.tc}} the<br />
TrueCrypt container, {{Ic|/home/you/truecrypt/}} the desired mount point. The<br />
user {{Ic|you}} in this example has {{Ic|uid&#61;1000}} and {{Ic|gid&#61;100}}. The<br />
steps for mounting the container as a virtual volume are:<br />
<br />
# Associate loop device with the container<br />
# Map the container to the loop device<br />
# Mount the container in the filesystem<br />
<br />
The following commands perform the given actions and reverse them.<br />
<br />
# losetup /dev/loop0 foo.tc<br />
# tcplay -m foo.tc -d /dev/loop0<br />
# mount -o nosuid,uid=1000,gid=100 /dev/mapper/foo.tc /home/you/truecrypt/<br />
<br />
# umount /home/you/truecrypt/<br />
# dmsetup remove foo.tc<br />
# losetup -d /dev/loop0<br />
<br />
==Related links==<br />
* [http://leaf.dragonflybsd.org/cgi/web-man?command=tcplay&section=8 Manual page for tcplay]<br />
* [http://jasonwryan.com/blog/2013/01/10/truecrypt/ Jason Ryan: Replacing TrueCrypt]<br />
* [http://www.truecrypt.org/ TrueCrypt Homepage]<br />
* [http://en.gentoo-wiki.com/wiki/TrueCrypt HOWTO: Truecrypt Gentoo wiki]<br />
* [http://www.howtoforge.com/truecrypt_data_encryption Truecrypt Tutorial on HowToForge]<br />
* [http://www.privacylover.com/encryption/analysis-is-there-a-backdoor-in-truecrypt-is-truecrypt-a-cia-honeypot/ There is a good chance the CIA has a backdoor?] (via [https://secure.wikimedia.org/wikipedia/en/wiki/Truecrypt wp])</div>Holomorph