https://wiki.archlinux.org/api.php?action=feedcontributions&user=Ownaginatious&feedformat=atomArchWiki - User contributions [en]2024-03-29T10:05:39ZUser contributionsMediaWiki 1.41.0https://wiki.archlinux.org/index.php?title=Syncthing&diff=458660Syncthing2016-12-06T19:25:22Z<p>Ownaginatious: Fixed typo</p>
<hr />
<div>[[Category:Internet applications]]<br />
[[ja:Syncthing]]<br />
{{Related articles start}}<br />
{{Related|Resilio Sync}}<br />
{{Related|Synchronization and backup programs}}<br />
{{Related articles end}}<br />
<br />
[https://syncthing.net Syncthing] is an open-source file synchronization client/server application, written in Go, implementing its own, equally free [https://docs.syncthing.net/specs/bep-v1.html Block Exchange Protocol]. All transit communications between syncthing nodes are encrypted, and all nodes are uniquely identified with cryptographic certificates.<br />
<br />
== Installation ==<br />
<br />
Syncthing can be [[install]]ed with the {{Pkg|syncthing}} or the {{Pkg|syncthing-gtk}} package, which depends on the former. This latter includes additional features such as synchronization by inotify, desktop notifications and integration with Nautilus, Nemo and Caja.<br />
<br />
After installing, you can [[#Starting Syncthing|start Syncthing]].<br />
<br />
== Starting Syncthing ==<br />
{{Tip|You can run multiple copies of syncthing, but only one instance per user as syncthing locks the database to it. Check logs for errors related to locked database.}}<br />
<br />
=== Run binary ===<br />
Run the {{ic|syncthing}} binary manually from a terminal.<br />
<br />
=== System service ===<br />
Running Syncthing as a system service ensures that it is running at startup even if the user has no active session, it is intended to be used on a server.<br />
<br />
Enable and start the service. Replace ''myuser'' with the actual Syncthing user after the @:<br />
# systemctl enable syncthing@myuser.service<br />
# systemctl start syncthing@myuser.service <br />
<br />
=== User service ===<br />
Running Syncthing as a [[systemd/User|user service]] ensures that Syncthing only starts after the user has logged into the system (e.g., via the graphical login screen, or ssh). Thus, the user service is intended to be used on a (multiuser) desktop computer. It avoids unnecessarily running Syncthing instances. Run this provided {{ic|syncthing.service}}:<br />
$ systemctl --user enable syncthing.service<br />
$ systemctl --user start syncthing.service<br />
<br />
The systemd services need to be started for a specific user in any case, see [http://docs.syncthing.net/users/autostart.html#using-systemd Autostart-syncthing with systemd] for detailed information on the services. <br />
<br />
== Accessing the web-interface ==<br />
{{Tip|Syncthing can only be accessed on the running computer. Change {{ic|1=<address>127.0.0.1:8384</address>}} in {{ic|~/.config/syncthing/config.xml}} to {{ic|1=<address>0.0.0.0:8384</address>}} and restart the [[systemd]] service to allow access from another computer.}}<br />
When Syncthing is started, a web interface will be provided by default on [http://localhost:8384 localhost port 8384]. If you started syncthing manually, it should open the admin page in your browser.<br />
<br />
{{Note|In syncthing releases before 0.11 (or when you have updated from 0.10) the web interface is available at port 8080. Since port 8080 often conflicts with web development utilities [https://github.com/syncthing/syncthing/commit/960c0cbddf8802ae440f2f9ae33bced4e2d72e44 the default port has been changed to port 8384] ('ST' in ASCII). Custom port number can be configured under "GUI Listen Addresses" in the settings, configuration from versions prior to 0.11 were '''not''' adjusted automatically.}}<br />
<br />
== Configuration ==<br />
<br />
After installation Syncthing already has a proper start-up configuration. You may now add new servers and/or folders by visiting the web interface. For detailed instructions on how to set up a simple network, read [http://docs.syncthing.net/intro/getting-started.html Syncthing's getting started]. <br />
<br />
After a successful first start, it will create the default repository at {{ic|~/Sync}}. You can see this in the web admin interface. On the right is the list of nodes you have added. On the left is the list of repositories, which are folders you can choose to share with other nodes.<br />
<br />
To add another node, click "Add Node" underneath the list of nodes. You will be prompted for their Node ID (which can be found on the other machine by clicking {{ic|Edit > Show ID}}) as well as a short name and the address.<br />
If you specify "dynamic" for the address, the syncthing announce server will be used to automatically exchange addresses between nodes. If you want to know more about Node IDs, including the cryptographic implications, you can read the appropriate [http://docs.syncthing.net/dev/device-ids.html Syncthing documentation page].<br />
<br />
After saving the configuration, you will be prompted to restart the syncthing server, and once restarted, the changes will be applied.<br />
<br />
Next, you can either change the configuration of the default node (click its name and then {{ic|Edit}}), or create a new one to share data with. Simply tick the node you wish to share the data with, and they will have permission to access it.<br />
<br />
== Use Inotify ==<br />
<br />
Inotify (inode notify) is a Linux kernel subsystem that acts to extend filesystems to notice changes to the filesystem, and report those changes to applications. Syncthing does not support Inotify yet but there is an official extension module which talks to the Syncthing REST API. The usage of Inotify avoids expensive rescans every minute. The rescan interval of each folder is automatically increased to avoid expensive, regular rescans. Syncthing-inotify can be installed with the {{Pkg|syncthing-inotify}} package. If Syncthing is managed through systemd, it is ensured by systemd dependencies that {{ic|syncthing-inotify.service}} is started and stopped automatically.<br />
<br />
=== Custom Settings ===<br />
Run {{ic|$ syncthing-inotify -help}} for available options, such as setting the API key.<br />
<br />
To set options for syncthing-inotify service, create a {{ic|.conf}} file in {{ic|/etc/systemd/user/syncthing-inotify.service.d/}} (When running as [[#User service]]) and/or {{ic|/etc/systemd/system/syncthing-inotify@'''user'''.service.d/}} ([[#System service]]), e.g.:<br />
{{hc|/etc/systemd/user/syncthing-inotify.service.d/start.conf|2=<br />
[Unit]<br />
ExecStart=<br />
ExecStart=/usr/bin/syncthing-inotify -logflags=0 -api="0M6ubcgtcy7KBLucu0jeXrgqB8U7YKp9"<br />
RuntimeDirectory=syncthing-inotify<br />
}}<br />
<br />
== Run a Relay ==<br />
<br />
{{Style|}}<br />
Since version 0.12 Syncthing has the ability to connect two devices via a relay when there exists no direct path between them. There is a default set of relays that is used out of the box. Relayed connections are encrypted in the usual manner, end to end, so the relay has no more insight into the connection than any other random eavesdropper on the internet [https://forum.syncthing.net/t/syncthing-v0-12-beryllium-bedbug-release-notes-v0-12-0-beta1/5480?u=rumpelsepp]. To run a relay install {{Pkg|syncthing-relaysrv}}, then [[start]] and [[enable]] the {{ic|syncthing-relaysrv.service}} service.<br />
<br />
There is also a git version in the [[AUR]]. More information about the {{aur|syncthing-relaysrv-git}} package are available in the [https://forum.syncthing.net/t/syncthing-relaysrv-for-arch-linux/5862 Syncthing forum].<br />
<br />
Per default the relay joins the [https://relays.syncthing.net/ Syncthing relay pool] and is publicy available. Rate limiting and other options can be configured via command line flags (check {{ic|syncthing-relaysrv -help}}). To edit the command line flags just create a [[Systemd#Drop-in_files|drop-in snippet]] for {{ic|syncthing-relaysrv.service}} and replace the {{ic|ExecStart}} directive:<br />
<br />
{{hc|/etc/systemd/system/syncthing-relaysrv.service.d/override.conf|<nowiki><br />
[Service]<br />
ExecStart=<br />
ExecStart=/usr/bin/syncthing-relaysrv FLAGS</nowiki>}}<br />
<br />
A traffic statistics page is available at port 22070, e.g. http://78.47.248.86:22070/status.<br />
<br />
== Stop journal spam ==<br />
<br />
Syncthing can be quite noisy even while it isn't doing anything. The service ExecStart can be overridden like this to filter output directly without an extra script (adjust "grep" as needed):<br />
{{hc|/etc/systemd/system/syncthing@.service.d/nospam.conf|<nowiki><br />
[Service]<br />
ExecStart=<br />
ExecStart=/bin/bash -c 'set -o pipefail; /usr/bin/syncthing -no-browser -no-restart -logflags=0 | grep -v "INFO: "'</nowiki>}}<br />
<br />
== Discovery Server ==<br />
<br />
The Syncthing Discovery Server is available in the AUR under {{aur|syncthing-discosrv}}. Documentation is provided [https://docs.syncthing.net/users/discosrv.html here]. <br />
<br />
Note, that the discovery server requires certificates to run, which should ideally be placed in {{ic|/var/discosrv}}, and the user/group {{ic|syncthing}} needs permissions to able to read the certificate files. Currently, you will need to edit the systemd unit file to correctly point to the certificates (as well as any other configuration changes you want to undertake, see [https://docs.syncthing.net/users/discosrv.html#configuring list]).<br />
<br />
{{hc|/usr/lib/systemd/system/syncthing-discosrv.service|<nowiki><br />
[Unit]<br />
Description=Syncthing discovery server<br />
After=network.target<br />
<br />
[Service]<br />
User=syncthing<br />
Group=syncthing<br />
ExecStart=/bin/sh -c "/usr/bin/syncthing-discosrv -db-dsn='file:///var/discosrv/discosrv.db' -cert /var/discosrv/chain.pem -key /var/discosrv/key.pem"<br />
Restart=on-failure<br />
SuccessExitStatus=2<br />
<br />
PrivateDevices=true<br />
ProtectSystem=full<br />
ProtectHome=true<br />
NoNewPrivileges=true<br />
<br />
[Install]<br />
WantedBy=multi-user.target</nowiki>}}<br />
<br />
To point the client at your discovery server, change the {{ic|Global Discovery Servers}} variable under Settings, to point to {{ic|<nowiki>https://yourserver:8443/</nowiki>}} (default port) or whatever port you have reconfigured to. The variable takes a comma-seperated list of discovery servers, it is possible to include multiple ones, including the default one. <br />
<br />
If you are using self-signed certificates, the client will refuse to connect unless you append the discovery server ID to its domain. The ID is printed to stdout upon launching the discovery server. Amend the Global Discovery Servers entry to add the ID: {{ic|<nowiki>https://yourserver.com:8443/?id=AAAAAAA-BBBBBBB-CCCCCCC-DDDDDDD-EEEEEEE-FFFFFFF-GGGGGGG-HHHHHHH</nowiki>}}.<br />
<br />
== Troubleshooting ==<br />
<br />
See [http://docs.syncthing.net/dev/debugging.html Debugging syncthing].</div>Ownaginatioushttps://wiki.archlinux.org/index.php?title=Nginx&diff=311913Nginx2014-04-26T16:41:41Z<p>Ownaginatious: /* Step 2: Nginx configuration */</p>
<hr />
<div>[[Category:Web Server]]<br />
[[de:Nginx]]<br />
[[ja:Nginx]]<br />
[[ru:Nginx]]<br />
[[zh-CN:Nginx]]<br />
'''Nginx''' (pronounced "engine X"), is a free, open-source, high-performance HTTP server and reverse proxy, as well as an IMAP/POP3 proxy server, written by Igor Sysoev in 2005. According to Netcraft's [http://news.netcraft.com/archives/2014/01/03/january-2014-web-server-survey.html January 2014 Web Server Survey], Nginx now hosts 14.4% of all domains worldwide, while [[Apache]] hosts about 41.64%. Nginx is now well known for its stability, rich feature set, simple configuration, and low resource consumption.<br />
<br />
== Installation ==<br />
<br />
[[Pacman|Install]] package {{Pkg|nginx}} in the [[official repositories]].<br />
<br />
For a ''Ruby on Rails'' oriented installation, see [[Ruby on Rails#The Perfect Rails Setup]].<br />
<br />
For a chroot-based installation for additional security, see [[#Installation_in_a_chroot]]<br />
<br />
== Running ==<br />
<br />
To enable the Nginx service by default at start-up, run:<br />
# systemctl enable nginx<br />
<br />
To start the Nginx service, run:<br />
# systemctl start nginx<br />
<br />
The default served page at http://127.0.0.1 is: <br />
/usr/share/nginx/html/index.html<br />
<br />
== Configuring ==<br />
<br />
You can modify the configuration by editing the files in {{ic|/etc/nginx/}}. The main configuration file is located at {{ic|/etc/nginx/nginx.conf}}. <br />
<br />
More details can be found here: [http://wiki.nginx.org/Configuration Nginx Configuration Examples].<br />
<br />
The examples below cover the most common use cases. It is assumed that you use the default location for documents ({{ic|/usr/share/nginx/html}}). If that is not the case, substitute your path instead.<br />
<br />
=== General Configuration ===<br />
<br />
You should choose a fitting value for {{ic|worker_processes}}. This settings ultimately defines how many connection nginx will accept and how many processors it will be able to make use of. Generally, making it the number of hardware threads in your system is a good start. As such, with modern servers, set something like<br />
<br />
worker_processes 8;<br />
<br />
The maximum connections nginx will accept is given by {{ic|1=max_clients = worker_processes * worker_connections}}.<br />
<br />
=== FastCGI ===<br />
<br />
FastCGI, also FCGI, is a protocol for interfacing interactive programs with a web server. FastCGI is a variation on the earlier Common Gateway Interface (CGI); FastCGI's main aim is to reduce the overhead associated with interfacing the web server and CGI programs, allowing a server to handle more web page requests at once.<br />
<br />
FastCGI technology is introduced into Nginx to work with many external tools, i.e.: Perl, [[PHP]] and [[Python]].<br />
<br />
==== PHP implementation ====<br />
<br />
There are different ways to run a FastCGI server for PHP. We cover '''php-fpm''', a recommended solution.<br />
<br />
===== Step 1: PHP configuration =====<br />
<br />
The {{Ic|open_basedir}} in {{ic|/etc/php/php.ini}} has to list base directories which contain PHP files, like {{ic|/usr/share/nginx/html/}} and {{ic|/usr/share/webapps/}}:<br />
open_basedir = /usr/share/webapps/:/srv/http/:/usr/share/nginx/html/:/home/:/tmp/:/usr/share/pear/<br />
<br />
After that let's configure modules you need. For example to use sqlite3 you should install {{ic|php-sqlite}}. Then enable it in {{ic|/etc/php/php.ini}} by uncommenting following line:<br />
extension=sqlite3.so<br />
<br />
If you run nginx in chrooted environment (chroot is {{ic|/srv/nginx-jail}}, web pages are served at {{ic|/srv/nginx-jail/www}}), the directive refers to the chroot only (i.e. {{ic|1=open_basedir = /www}}) only.<br />
<br />
===== Step 2: php-fpm =====<br />
<br />
* http://php-fpm.org<br />
<br />
Install {{Pkg|php-fpm}}.<br />
The configuration file is {{ic|/etc/php/php-fpm.conf}}.<br />
Enable and start the [[systemd]] ''php-fpm.service''.<br />
<br />
If you run nginx in chrooted environment (chroot is {{ic|/srv/nginx-jail}}, web pages are served at {{ic|/srv/nginx-jail/www}}), you must modify the file {{ic|/etc/php/php-fpm.conf}} to include the {{ic|chroot /srv/nginx-jail}} and {{ic|1=listen = /srv/nginx-jail/run/php-fpm/php-fpm.sock}} directives within the pool name section (a default one is {{ic|[www]}}). (Create the directory for the socket file, if missing.)<br />
<br />
===== Step 3: Nginx configuration =====<br />
<br />
Inside each {{Ic|server}} block serving a PHP web application should appear a {{Ic|location}} block similar to:<br />
location ~ \.php$ {<br />
try_files $uri = 404; <br />
fastcgi_pass unix:/run/php-fpm/php-fpm.sock;<br />
fastcgi_index index.php;<br />
include fastcgi.conf;<br />
}<br />
<br />
If the {{Ic|root}} path in specified only inside a {{Ic|location}} (as it is in the default config), then either add<br />
root /srv/http<br />
to the {{Ic|location ~ \.php$}}, or move it directly somewhere under {{Ic|server}}.<br />
<br />
A complete working configuration could look like this:<br />
<br />
server {<br />
listen 80;<br />
server_name localhost;<br />
root /usr/share/nginx/html;<br />
location / {<br />
index index.html index.htm index.php;<br />
}<br />
<br />
location ~ \.php$ {<br />
#fastcgi_pass 127.0.0.1:9000; (depending on your php-fpm socket configuration)<br />
fastcgi_pass unix:/run/php-fpm/php-fpm.sock;<br />
fastcgi_index index.php;<br />
include fastcgi.conf;<br />
}<br />
}<br />
<br />
You could create {{Ic|/etc/nginx/php.conf}} and save the php bit of the configuration there, then when needed just include this file into the {{Ic|server}} block.<br />
server = {<br />
...<br />
include php.conf;<br />
...<br />
}<br />
<br />
If you are going to process .html and .htm files with PHP, you should have something like this:<br />
location ~ \.(php|html|htm)$ {<br />
fastcgi_pass unix:/run/php-fpm/php-fpm.sock;<br />
fastcgi_index index.php;<br />
include fastcgi_params;<br />
}<br />
<br />
Non .php files processing in php-fpm should be explicitly enabled in<br />
{{Ic|/etc/php/php-fpm.conf}}:<br />
security.limit_extensions = .php .html .htm<br />
<br />
You need to restart the php-fpm daemon if you changed the configuration.<br />
# systemctl restart php-fpm<br />
<br />
'''Pay attention''' to the {{Ic|fastcgi_pass}} argument, as it must be the TCP or Unix socket defined by the chosen FastCGI server in its config file. The '''default''' (Unix) socket for {{Ic|php-fpm}} is<br />
fastcgi_pass unix:/run/php-fpm/php-fpm.sock;<br />
You might use the common TCP socket, '''not default''',<br />
fastcgi_pass 127.0.0.1:9000;<br />
Unix domain sockets are however faster.<br />
<br />
{{Ic|fastcgi.conf}} or {{Ic|fastcgi_params}} are usually included because they hold FastCGI settings for Nginx; the use of the latter is deprecated, though. They come within the Nginx installation.<br />
<br />
Finally, if Nginx has been working, run:<br />
# systemctl restart nginx<br />
<br />
If you would like to test the FastCGI implementation, create {{ic|/usr/share/nginx/html/index.php}} with content<br />
<?php<br />
phpinfo();<br />
?> <br />
and visit the URL http://127.0.0.1/index.php with your browser after checking that {{ic|/usr/share/nginx/html}} is included in {{ic|open_basedir}}.<br />
<br />
==== CGI implementation ====<br />
<br />
This implementation is needed for CGI applications.<br />
<br />
===== Step 1: fcgiwrap =====<br />
<br />
Install {{Pkg|fcgiwrap}}.<br />
The configuration file is {{ic|/usr/lib/systemd/system/fcgiwrap.socket}}.<br />
Enable and start the [[systemd]] ''fcgiwrap.socket''.<br />
<br />
The systemd unit file is currently being discussed on [https://bugs.archlinux.org/task/31696 this ArchLinux task page]. You may want to examine the unit file yourself to ensure it will work the way you want.<br />
<br />
====== Multiple worker threads ======<br />
<br />
If you want to spawn multiple worker threads, it's recommended that you use {{AUR|multiwatch}}, which will take care of restarting crashed children. You will need to use {{ic|spawn-fcgi}} to create the unix socket, as multiwatch seems unable to handle the systemd-created socket, even though fcgiwrap itself does not have any trouble if invoked directly in the unit file.<br />
<br />
Copy the unit file from {{ic|/usr/lib/systemd/system/fcgiwrap.service}} to {{ic|/etc/systemd/system/fcgiwrap.service}} (and the {{ic|fcgiwrap.socket}} unit, if present), and modify the {{ic|ExecStart}} line to suit your needs. Here is a unit file that uses {{AUR|multiwatch}}. Make sure {{ic|fcgiwrap.socket}} is not started or enabled, because it will conflict with this unit:<br />
<br />
{{hc|/etc/systemd/system/fcgiwrap.service|2=<br />
[Unit]<br />
Description=Simple CGI Server<br />
After=nss-user-lookup.target<br />
<br />
[Service]<br />
ExecStartPre=/bin/rm /run/fcgiwrap.socket<br />
ExecStart=/usr/bin/spawn-fcgi -u http -g http -s /run/fcgiwrap.sock -n -- /usr/bin/multiwatch -f 10 -- /usr/sbin/fcgiwrap<br />
ExecStartPost=/usr/bin/chmod 660 /run/fcgiwrap.sock<br />
PrivateTmp=true<br />
Restart=on-failure<br />
<br />
[Install]<br />
WantedBy=multi-user.target<br />
}}<br />
<br />
Tweak {{ic|-f 10}} to change the number of children that are spawned.<br />
<br />
{{Warning|The ExecStartPost line is required because of strange behaviour I'm seeing when I use the {{ic|-M 660}} option for {{ic|spawn-fcgi}}. The wrong mode is set. This may be a bug?}}<br />
<br />
===== Step 2: Nginx configuration =====<br />
<br />
Inside each {{Ic|server}} block serving a CGI web application should appear a {{Ic|location}} block similar to:<br />
<br />
location ~ \.cgi$ {<br />
root /path/to/server/cgi-bin;<br />
fastcgi_pass unix:/run/fcgiwrap.sock;<br />
include fastcgi.conf;<br />
}<br />
<br />
The '''default''' (Unix) socket for {{Ic|fcgiwrap}} is ''/run/fcgiwrap.sock''.<br />
<br />
== Installation in a chroot ==<br />
<br />
Installing Nginx in a chroot adds an additional layer of security. For<br />
maximum security the chroot should include only the files needed to run<br />
the Nginx server and all files should have the most restrictive<br />
permissions possible, e.g., as much as possible should be owned by root,<br />
directories such as {{ic|/usr/bin}} should be unreadable and unwriteable,<br />
etc. <br />
<br />
Arch comes with an {{ic|http}} user and group by default which will run the<br />
server. The chroot will be in {{ic|/srv/http}}.<br />
<br />
A perl script to create this jail is available at<br />
[https://gist.github.com/4365696 jail.pl gist]. You can either use that or follow the instructions in this article. It expects to be run<br />
as root. You will need to uncomment a line before it makes any changes.<br />
<br />
=== Create Necessary Devices ===<br />
<br />
Nginx needs {{ic|/dev/null}}, {{ic|/dev/random}}, and<br />
{{ic|/dev/urandom}}. To install these in the chroot we create the<br />
{{ic|/dev/}} folder and add the devices with mknod. We avoid mounting<br />
all of {{ic|/dev/}} to ensure that, even if the chroot is compromised, an<br />
attacker must break out of the chroot to access important devices like<br />
{{ic|/dev/sda1}}.<br />
<br />
{{Tip|See {{ic|man mknod}} and {{ic|<nowiki>ls -l<br />
/dev/{null,random,urandom}</nowiki>}} to better<br />
understand the argument to mknod.}}<br />
<br />
# export JAIL=/srv/http<br />
# mkdir $JAIL/dev<br />
# mknod -m 0666 $JAIL/dev/null c 1 3<br />
# mknod -m 0666 $JAIL/dev/random c 1 8<br />
# mknod -m 0444 $JAIL/dev/urandom c 1 9<br />
<br />
=== Create Necessary Folders ===<br />
<br />
Nginx requires a bunch of files to run properly. Before copying them<br />
over, create the folders to store them. This assumes your Nginx document<br />
root will be {{ic|/srv/http/www}}.<br />
<br />
# mkdir -p $JAIL/etc/nginx/logs<br />
# mkdir -p $JAIL/usr/{lib,bin}<br />
# mkdir -p $JAIL/usr/share/nginx<br />
# mkdir -p $JAIL/var/{log,lib}/nginx<br />
# mkdir -p $JAIL/www/cgi-bin<br />
# mkdir -p $JAIL/{run,tmp}<br />
# cd $JAIL; ln -s usr/lib lib <br />
<br />
{{Note| If using a 64 bit kernel you will need to create symbolic links {{ic|lib64}} and {{ic|usr/lib64}} to {{ic|usr/lib}}: {{ic|cd $JAIL; ln -s usr/lib lib64}} and {{ic|cd $JAIL/usr; ln -s lib lib64}}<br />
}}<br />
Then mount {{ic|$JAIL/tmp}} and {{ic|$JAIL/run}} as tmpfs's. The size<br />
should be limited to ensure an attacker cannot eat all the RAM.<br />
<br />
# mount -t tmpfs none $JAIL/run -o 'noexec,size=1M'<br />
# mount -t tmpfs none $JAIL/tmp -o 'noexec,size=100M'<br />
<br />
In order to preserve the mounts across reboots, the following entries should be added to /etc/fstab:<br />
<br />
{{hc|/etc/fstab|<nowiki><br />
tmpfs /srv/http/run tmpfs rw,noexec,relatime,size=1024k 0 0<br />
tmpfs /srv/http/tmp tmpfs rw,noexec,relatime,size=102400k 0 0<br />
</nowiki>}}<br />
<br />
=== Populate the chroot ===<br />
<br />
First copy over the easy files.<br />
<br />
# cp -r /usr/share/nginx/* $JAIL/usr/share/nginx<br />
# cp -r /usr/share/nginx/html/* $JAIL/www<br />
# cp /usr/bin/nginx $JAIL/usr/bin/<br />
# cp -r /var/lib/nginx $JAIL/var/lib/nginx<br />
<br />
Now copy over required libraries. Use ldd to list them and then copy<br />
them all to the correct location. Copying is preferred over hardlinks to<br />
ensure that even if an attacker gains write access to the files they<br />
cannot destroy or alter the true system files.<br />
<br />
{{hc|$ ldd /usr/bin/nginx|<nowiki><br />
linux-vdso.so.1 (0x00007fffc41fe000)<br />
libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007f57ec3e8000)<br />
libcrypt.so.1 => /usr/lib/libcrypt.so.1 (0x00007f57ec1b1000)<br />
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007f57ebead000)<br />
libm.so.6 => /usr/lib/libm.so.6 (0x00007f57ebbaf000)<br />
libpcre.so.1 => /usr/lib/libpcre.so.1 (0x00007f57eb94c000)<br />
libssl.so.1.0.0 => /usr/lib/libssl.so.1.0.0 (0x00007f57eb6e0000)<br />
libcrypto.so.1.0.0 => /usr/lib/libcrypto.so.1.0.0 (0x00007f57eb2d6000)<br />
libdl.so.2 => /usr/lib/libdl.so.2 (0x00007f57eb0d2000)<br />
libz.so.1 => /usr/lib/libz.so.1 (0x00007f57eaebc000)<br />
libGeoIP.so.1 => /usr/lib/libGeoIP.so.1 (0x00007f57eac8d000)<br />
libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x00007f57eaa77000)<br />
libc.so.6 => /usr/lib/libc.so.6 (0x00007f57ea6ca000)<br />
/lib64/ld-linux-x86-64.so.2 (0x00007f57ec604000)</nowiki>}}<br />
<br />
# cp /lib64/ld-linux-x86-64.so.2 $JAIL/lib<br />
<br />
For files residing in {{ic|/usr/lib}} you may try the following one-liner:<br />
{{bc|<nowiki># cp $(ldd /usr/bin/nginx | grep /usr/lib | sed -sre 's/(.+)(\/usr\/lib\/\S+).+/\2/g') $JAIL/usr/lib</nowiki>}}<br />
<br />
{{Note|Do not try to copy linux-vdso.so – it is not a real library and does not exist in /usr/lib. Also ld-linux-x86-64.so will likely be listed in /lib64 for a 64 bit system.}}<br />
<br />
Copy over some misc. but necessary libraries and system files.<br />
<br />
{{bc|# cp /usr/lib/libnss_* $JAIL/usr/lib<br />
# cp -rfvL /etc/{services,localtime,nsswitch.conf,nscd.conf,protocols,hosts,ld.so.cache,ld.so.conf,resolv.conf,host.conf,nginx} $JAIL/etc}}<br />
<br />
Create restricted user/group files for the chroot. This way only the<br />
users needed for the chroot to function exist as far as the chroot<br />
knows, and none of the system users/groups are leaked to attackers<br />
should they gain access to the chroot.<br />
<br />
{{hc|$JAIL/etc/group|<br />
http:x:33:<br />
nobody:x:99:<br />
}}<br />
<br />
{{hc|$JAIL/etc/passwd|<br />
http:x:33:33:http:/:/bin/false<br />
nobody:x:99:99:nobody:/:/bin/false<br />
}}<br />
<br />
{{hc|$JAIL/etc/shadow|<br />
http:x:14871::::::<br />
nobody:x:14871::::::<br />
}}<br />
<br />
{{hc|$JAIL/etc/gshadow|<br />
http:::<br />
nobody:::<br />
}}<br />
<br />
# touch $JAIL/etc/shells<br />
# touch $JAIL/run/nginx.pid<br />
<br />
Finally make set very restrictive permissions. As much as possible<br />
should be owned by root and set unwritable.<br />
<br />
# chown -R root:root $JAIL/<br />
<br />
# chown -R http:http $JAIL/www<br />
# chown -R http:http $JAIL/etc/nginx<br />
# chown -R http:http $JAIL/var/{log,lib}/nginx<br />
# chown http:http $JAIL/run/nginx.pid<br />
<br />
# find $JAIL/ -gid 0 -uid 0 -type d -print | xargs sudo chmod -rw<br />
# find $JAIL/ -gid 0 -uid 0 -type d -print | xargs sudo chmod +x<br />
# find $JAIL/etc -gid 0 -uid 0 -type f -print | xargs sudo chmod -x<br />
# find $JAIL/usr/bin -type f -print | xargs sudo chmod ug+rx<br />
# find $JAIL/ -group http -user http -print | xargs sudo chmod o-rwx<br />
# chmod +rw $JAIL/tmp<br />
# chmod +rw $JAIL/run<br />
<br />
If your server will bind port 80 (or any port 0-1024), give the<br />
chrooted executable permission to bind these ports without root.<br />
<br />
# setcap 'cap_net_bind_service=+ep' $JAIL/usr/bin/nginx<br />
<br />
=== Modify nginx.service to start chroot ===<br />
<br />
Before modifying the nginx.service unit file, it may be a good idea to copy it to<br />
{{ic|/etc/systemd/system/}} since the unit files there take priority over those in {{ic|/usr/lib/systemd/system/}}. <br />
This means upgrading nginx would not modify your custom .service file. <br />
# cp /usr/lib/systemd/system/nginx.service /etc/systemd/system/nginx.service<br />
<br />
The systemd unit must be changed to start up Nginx in the chroot, as<br />
the http user, and store the pid file in the chroot <br />
{{Note|I'm not sure if the pid file needs to be stored in the chroot jail.}}<br />
<br />
{{hc|/etc/systemd/system/nginx.service|<nowiki><br />
[Unit]<br />
Description=A high performance web server and a reverse proxy server<br />
After=syslog.target network.target<br />
<br />
[Service]<br />
Type=forking<br />
PIDFile=/srv/http/run/nginx.pid<br />
ExecStartPre=/usr/bin/chroot --userspec=http:http /srv/http /usr/bin/nginx -t -q -g 'pid /run/nginx.pid; daemon on; master_process on;'<br />
ExecStart=/usr/bin/chroot --userspec=http:http /srv/http /usr/bin/nginx -g 'pid /run/nginx.pid; daemon on; master_process on;'<br />
ExecReload=/usr/bin/chroot --userspec=http:http /srv/http /usr/bin/nginx -g 'pid /run/nginx.pid; daemon on; master_process on;' -s reload<br />
ExecStop=/usr/bin/chroot --userspec=http:http /srv/http /usr/bin/nginx -g 'pid /run/nginx.pid;' -s quit<br />
<br />
[Install]<br />
WantedBy=multi-user.target</nowiki>}}<br />
<br />
{{Note|Upgrading nginx with pacman will not upgrade the chrooted nginx installation. You have to take care of the updates manually by repeating some of the steps above. Do not forget to also update the libraries it links against. }}<br />
<br />
You can now safely get rid of the non-chrooted nginx installation. <br />
# pacman -Rsc nginx<br />
<br />
If you do not remove the non-chrooted nginx installation, you may want to make sure that the running nginx process is in fact the chrooted one. You can do so by checking where {{ic|/proc/{PID}/root}} symmlinks to. If should link to {{ic|/srv/http}} instead of {{ic|/}}. <br />
# ps -C nginx | awk '{print $1}' | sed 1d | while read -r PID; do ls -l /proc/$PID/root; done<br />
<br />
== Troubleshooting ==<br />
<br />
=== Accessing local IP redirects to localhost ===<br />
<br />
Solution from the Arch Linux [https://bbs.archlinux.org/viewtopic.php?pid=780561#p780561 forum].<br />
<br />
Edit {{ic|/etc/nginx/nginx.conf}} and locate the "server_name localhost" line without a # infront of it, and add below:<br />
server_name_in_redirect off;<br />
<br />
Default behavior is that nginx redirects any requests to the value given as server_name in the config.<br />
<br />
=== Error: 403 (Permission error) ===<br />
<br />
This is most likely a permission error. Are you sure whatever user configured in the Nginx configuration is able to read the correct files?<br />
<br />
If the files are located within a home directory, (e.g. {{ic|/home/arch/public/webapp}}) and you are sure the user running Nginx has the right permissions (you can temporarily chmod all the files to 777 in order to determine this), {{ic|/home/arch}} might be '''chmod 750''', simply {{Ic|chmod}} it to ''751'', and it should work.<br />
<br />
'''If you have changed your document root'''<br />
<br />
If you are sure that permissions are as they should be, make sure that your document root directory is not empty. Try creating index.html in there.<br />
<br />
=== Error: 404 (Pathinfo error) ===<br />
<br />
In some framework (like thinkphp, cakephp) or CMS, they need the pathinfo function. <br />
<br />
1. Edit the file {{ic|/etc/php/php.ini}}, make sure<br />
cgi.fix_pathinfo=1<br />
2. Edit {{ic|/etc/nginx/conf/nginx.conf}}, comment<br />
<br />
location ~ \.php$ {<br />
...<br />
}<br />
<br />
to <br />
<br />
#location ~ \.php$ {<br />
#...<br />
#}<br />
<br />
Then add the follows,<br />
location ~ ^(.+\.php)(.*)$ {<br />
root /srv/http/nginx;<br />
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock; <br />
#fastcgi_pass 127.0.0.1:9000; #Un-comment this and comment "fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;" if you are not using php-fpm.<br />
fastcgi_index index.php;<br />
set $document_root2 $document_root;<br />
if ($document_root2 ~ "^(.*\\\\).*?[\\\\|\/]\.\.\/(.*)$") { set $document_root2 $1$2; }<br />
if ($document_root2 ~ "^(.*\\\\).*?[\\\\|\/]\.\.\/(.*)$") { set $document_root2 $1$2; }<br />
if ($document_root2 ~ "^(.*\\\\).*?[\\\\|\/]\.\.\/(.*)$") { set $document_root2 $1$2; }<br />
if ($document_root2 ~ "^(.*\\\\).*?[\\\\|\/]\.\.\/(.*)$") { set $document_root2 $1$2; }<br />
if ($document_root2 ~ "^(.*\\\\).*?[\\\\|\/]\.\.\/(.*)$") { set $document_root2 $1$2; }<br />
fastcgi_split_path_info ^(.+\.php)(.*)$;<br />
fastcgi_param SCRIPT_FILENAME $document_root2$fastcgi_script_name;<br />
fastcgi_param PATH_INFO $fastcgi_path_info;<br />
fastcgi_param PATH_TRANSLATED $document_root2$fastcgi_path_info;<br />
include fastcgi_params;<br />
fastcgi_param DOCUMENT_ROOT $document_root2;<br />
}<br />
<br />
=== Error: The page you are looking for is temporarily unavailable. Please try again later. ===<br />
<br />
This is because the FastCGI server has not been started, or the socket used has wrong permissions.<br />
<br />
=== Error: No input file specified ===<br />
<br />
1. Most Likely you do not have the SCRIPT_FILENAME containing the full path to your scripts.<br />
If the configuration of nginx (fastcgi_param SCRIPT_FILENAME) is correct, this kind of error means php failed to load the requested script. Usually it is simply a permissions issue, you can just run php-cgi as root<br />
# spawn-fcgi -a 127.0.0.1 -p 9000 -f /usr/bin/php-cgi<br />
or you should create a group and user to start the php-cgi. For example:<br />
# groupadd www<br />
# useradd -g www www<br />
# chmod +w /srv/www/nginx/html<br />
# chown -R www:www /srv/www/nginx/html<br />
# spawn-fcgi -a 127.0.0.1 -p 9000 -u www -g www -f /usr/bin/php-cgi<br />
<br />
2. Another occasion is that, wrong "root" argument in the "location ~ \.php$" section in {{ic|nginx.conf}}, make sure the "root" points to the same directory as it in "location /" in the same server. Or you may just set root as global, do not define it in any location section.<br />
<br />
3. Verify that variable "open_basedir" in {{ic|/etc/php/php.ini}} also contains path you specified in "root" argument in {{ic|nginx.conf}}<br />
<br />
4. Also notice that not only php script should have read permission, but also the entire directory structure should have execute permission so that PHP user can traverse the path.<br />
<br />
=== Error: "File not found" in browser or "Primary script unknown" in log file ===<br />
<br />
Ensure you've specified a '''root''' and '''index''' in your '''server''' or '''location''' directive:<br />
location ~ \.php$ {<br />
root /srv/http/root_dir;<br />
index index.php;<br />
fastcgi_pass unix:/run/php-fpm/php-fpm.sock;<br />
include fastcgi.conf;<br />
}<br />
<br />
=== Error: chroot: '/usr/sbin/nginx' No such file or directory ===<br />
<br />
If you encounter this error when running the daemon of nginx using chroot, this is likely due to missing 64 bit libraries in the jailed environment.<br />
<br />
If you are running chroot in {{ic|/srv/http}} you need to add the required 64 bit libraries. <br />
<br />
First, set up the directories (these commands will need to be run as root)<br />
<br />
# mkdir /srv/http/usr/lib64 <br />
# cd /srv/http; ln -s usr/lib64 lib64<br />
<br />
Then copy the required 64 bit libraries found using {{ic|ldd /usr/sbin/nginx}} to {{ic|/srv/http/usr/lib64}}<br />
<br />
if run as root, permissions for the libraries should be read and executable for all users, so no modification is required.<br />
<br />
=== Error: Blank page through FastCGI ===<br />
<br />
No error trace, code 200 in access.log but blank page:<br />
<br />
<html><br />
<head></head><br />
<body></body><br />
</html><br />
<br />
Solution from [http://beutelevision.com/blog2/2013/08/26/nginx-with-php-fpm-generating-blank-page/ Thomas Beutel's blog]:<br />
<br />
Edit {{ic|/etc/nginx/nginx.conf}} and add a {{ic|fastcgi_param}} line in php {{ic|location}} section:<br />
<br />
location ~ \.php$ {<br />
...<br />
include fastcgi_params;<br />
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;<br />
...<br />
}<br />
<br />
php_fpm needs this so that it knows the path to the PHP file.<br />
<br />
=== Alternative Script for Systemd ===<br />
<br />
On pure Systemd you can get advantages of chroot + Systemd -> [http://0pointer.de/blog/projects/changing-roots.html Systemd for Administrators, Part VI ]<br />
Based on set [http://wiki.nginx.org/CoreModule#user user group] an pid on:<br />
{{hc|/etc/nginx/nginx.conf|2=<br />
user http;<br />
pid /run/nginx.pid;<br />
}}<br />
the absolute path of file is {{ic|/srv/http/etc/nginx/nginx.conf}}<br />
{{hc|/etc/systemd/system/nginx.service|2=<br />
[Unit]<br />
Description=Nginx (Chroot)<br />
After=syslog.target network.target<br />
<br />
[Service]<br />
Type=forking<br />
PIDFile=/srv/http/run/nginx.pid<br />
RootDirectory=/srv/http<br />
ExecStartPre=/usr/sbin/nginx -t -c /etc/nginx/nginx.conf<br />
ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf<br />
ExecReload=/usr/sbin/nginx -c /etc/nginx/nginx.conf -s reload<br />
ExecStop=/usr/sbin/nginx -c /etc/nginx/nginx.conf -s stop<br />
<br />
[Install]<br />
WantedBy=multi-user.target<br />
}}<br />
Is not necesary set the default location, nginx loads at default {{ic| -c /etc/nginx/nginx.conf}}, but is a good idea set it. <br />
<br />
Alternatively can run '''only''' ExecStart as chroot whit parameter {{ic|RootDirectoryStartOnly}} set as yes [[http://www.freedesktop.org/software/systemd/man/systemd.service.html man systemd service]] or start it before mount point as efective or a [http://www.freedesktop.org/software/systemd/man/systemd.path.html systemd path] is available.<br />
<br />
{{hc|/etc/systemd/system/nginx.path|2=<br />
[Unit]<br />
Description=Nginx (Chroot) path<br />
[Path]<br />
PathExists=/srv/http/site/Public_html<br />
[Install]<br />
WantedBy=default.target<br />
}}<br />
to activate it<br />
{{ic|systemctl enable nginx.path }} <br />
and change on {{ic|/etc/systemd/system/nginx.service}} '''WantedBy=default.target''' to '''WantedBy=nginx.path'''<br />
Practicality may be that the mount point delay unless the folder to be accessible, each time the point is accessible, systemd start the server. In my case, I prefer to mount, and before Bind to existing Dir. <br />
<br />
The {{ic| PIDFile}} on .service file allows Systemd to monitor process(absolute Path), If not the desired behavior, you can change to default one-shoot Type, and delete the reference on .service file.<br />
<br />
<br />
== See Also ==<br />
* [https://calomel.org/nginx.html Very good in-depth 2014 look at Nginx security and Reverse Proxying]<br />
* [[Nginx/Init_script|Init script for Nginx]]<br />
* [http://nginx.org/ Nginx Official Site]<br />
* [http://calomel.org/nginx.html Nginx HowTo]<br />
* [http://blog.gotux.net/tutorial/custom-nginx-indexer/ Custom Nginx Indexer]</div>Ownaginatioushttps://wiki.archlinux.org/index.php?title=Nginx&diff=311912Nginx2014-04-26T16:30:21Z<p>Ownaginatious: /* Step 1: fcgiwrap */</p>
<hr />
<div>[[Category:Web Server]]<br />
[[de:Nginx]]<br />
[[ja:Nginx]]<br />
[[ru:Nginx]]<br />
[[zh-CN:Nginx]]<br />
'''Nginx''' (pronounced "engine X"), is a free, open-source, high-performance HTTP server and reverse proxy, as well as an IMAP/POP3 proxy server, written by Igor Sysoev in 2005. According to Netcraft's [http://news.netcraft.com/archives/2014/01/03/january-2014-web-server-survey.html January 2014 Web Server Survey], Nginx now hosts 14.4% of all domains worldwide, while [[Apache]] hosts about 41.64%. Nginx is now well known for its stability, rich feature set, simple configuration, and low resource consumption.<br />
<br />
== Installation ==<br />
<br />
[[Pacman|Install]] package {{Pkg|nginx}} in the [[official repositories]].<br />
<br />
For a ''Ruby on Rails'' oriented installation, see [[Ruby on Rails#The Perfect Rails Setup]].<br />
<br />
For a chroot-based installation for additional security, see [[#Installation_in_a_chroot]]<br />
<br />
== Running ==<br />
<br />
To enable the Nginx service by default at start-up, run:<br />
# systemctl enable nginx<br />
<br />
To start the Nginx service, run:<br />
# systemctl start nginx<br />
<br />
The default served page at http://127.0.0.1 is: <br />
/usr/share/nginx/html/index.html<br />
<br />
== Configuring ==<br />
<br />
You can modify the configuration by editing the files in {{ic|/etc/nginx/}}. The main configuration file is located at {{ic|/etc/nginx/nginx.conf}}. <br />
<br />
More details can be found here: [http://wiki.nginx.org/Configuration Nginx Configuration Examples].<br />
<br />
The examples below cover the most common use cases. It is assumed that you use the default location for documents ({{ic|/usr/share/nginx/html}}). If that is not the case, substitute your path instead.<br />
<br />
=== General Configuration ===<br />
<br />
You should choose a fitting value for {{ic|worker_processes}}. This settings ultimately defines how many connection nginx will accept and how many processors it will be able to make use of. Generally, making it the number of hardware threads in your system is a good start. As such, with modern servers, set something like<br />
<br />
worker_processes 8;<br />
<br />
The maximum connections nginx will accept is given by {{ic|1=max_clients = worker_processes * worker_connections}}.<br />
<br />
=== FastCGI ===<br />
<br />
FastCGI, also FCGI, is a protocol for interfacing interactive programs with a web server. FastCGI is a variation on the earlier Common Gateway Interface (CGI); FastCGI's main aim is to reduce the overhead associated with interfacing the web server and CGI programs, allowing a server to handle more web page requests at once.<br />
<br />
FastCGI technology is introduced into Nginx to work with many external tools, i.e.: Perl, [[PHP]] and [[Python]].<br />
<br />
==== PHP implementation ====<br />
<br />
There are different ways to run a FastCGI server for PHP. We cover '''php-fpm''', a recommended solution.<br />
<br />
===== Step 1: PHP configuration =====<br />
<br />
The {{Ic|open_basedir}} in {{ic|/etc/php/php.ini}} has to list base directories which contain PHP files, like {{ic|/usr/share/nginx/html/}} and {{ic|/usr/share/webapps/}}:<br />
open_basedir = /usr/share/webapps/:/srv/http/:/usr/share/nginx/html/:/home/:/tmp/:/usr/share/pear/<br />
<br />
After that let's configure modules you need. For example to use sqlite3 you should install {{ic|php-sqlite}}. Then enable it in {{ic|/etc/php/php.ini}} by uncommenting following line:<br />
extension=sqlite3.so<br />
<br />
If you run nginx in chrooted environment (chroot is {{ic|/srv/nginx-jail}}, web pages are served at {{ic|/srv/nginx-jail/www}}), the directive refers to the chroot only (i.e. {{ic|1=open_basedir = /www}}) only.<br />
<br />
===== Step 2: php-fpm =====<br />
<br />
* http://php-fpm.org<br />
<br />
Install {{Pkg|php-fpm}}.<br />
The configuration file is {{ic|/etc/php/php-fpm.conf}}.<br />
Enable and start the [[systemd]] ''php-fpm.service''.<br />
<br />
If you run nginx in chrooted environment (chroot is {{ic|/srv/nginx-jail}}, web pages are served at {{ic|/srv/nginx-jail/www}}), you must modify the file {{ic|/etc/php/php-fpm.conf}} to include the {{ic|chroot /srv/nginx-jail}} and {{ic|1=listen = /srv/nginx-jail/run/php-fpm/php-fpm.sock}} directives within the pool name section (a default one is {{ic|[www]}}). (Create the directory for the socket file, if missing.)<br />
<br />
===== Step 3: Nginx configuration =====<br />
<br />
Inside each {{Ic|server}} block serving a PHP web application should appear a {{Ic|location}} block similar to:<br />
location ~ \.php$ {<br />
try_files $uri = 404; <br />
fastcgi_pass unix:/run/php-fpm/php-fpm.sock;<br />
fastcgi_index index.php;<br />
include fastcgi.conf;<br />
}<br />
<br />
If the {{Ic|root}} path in specified only inside a {{Ic|location}} (as it is in the default config), then either add<br />
root /srv/http<br />
to the {{Ic|location ~ \.php$}}, or move it directly somewhere under {{Ic|server}}.<br />
<br />
A complete working configuration could look like this:<br />
<br />
server {<br />
listen 80;<br />
server_name localhost;<br />
root /usr/share/nginx/html;<br />
location / {<br />
index index.html index.htm index.php;<br />
}<br />
<br />
location ~ \.php$ {<br />
#fastcgi_pass 127.0.0.1:9000; (depending on your php-fpm socket configuration)<br />
fastcgi_pass unix:/run/php-fpm/php-fpm.sock;<br />
fastcgi_index index.php;<br />
include fastcgi.conf;<br />
}<br />
}<br />
<br />
You could create {{Ic|/etc/nginx/php.conf}} and save the php bit of the configuration there, then when needed just include this file into the {{Ic|server}} block.<br />
server = {<br />
...<br />
include php.conf;<br />
...<br />
}<br />
<br />
If you are going to process .html and .htm files with PHP, you should have something like this:<br />
location ~ \.(php|html|htm)$ {<br />
fastcgi_pass unix:/run/php-fpm/php-fpm.sock;<br />
fastcgi_index index.php;<br />
include fastcgi_params;<br />
}<br />
<br />
Non .php files processing in php-fpm should be explicitly enabled in<br />
{{Ic|/etc/php/php-fpm.conf}}:<br />
security.limit_extensions = .php .html .htm<br />
<br />
You need to restart the php-fpm daemon if you changed the configuration.<br />
# systemctl restart php-fpm<br />
<br />
'''Pay attention''' to the {{Ic|fastcgi_pass}} argument, as it must be the TCP or Unix socket defined by the chosen FastCGI server in its config file. The '''default''' (Unix) socket for {{Ic|php-fpm}} is<br />
fastcgi_pass unix:/run/php-fpm/php-fpm.sock;<br />
You might use the common TCP socket, '''not default''',<br />
fastcgi_pass 127.0.0.1:9000;<br />
Unix domain sockets are however faster.<br />
<br />
{{Ic|fastcgi.conf}} or {{Ic|fastcgi_params}} are usually included because they hold FastCGI settings for Nginx; the use of the latter is deprecated, though. They come within the Nginx installation.<br />
<br />
Finally, if Nginx has been working, run:<br />
# systemctl restart nginx<br />
<br />
If you would like to test the FastCGI implementation, create {{ic|/usr/share/nginx/html/index.php}} with content<br />
<?php<br />
phpinfo();<br />
?> <br />
and visit the URL http://127.0.0.1/index.php with your browser after checking that {{ic|/usr/share/nginx/html}} is included in {{ic|open_basedir}}.<br />
<br />
==== CGI implementation ====<br />
<br />
This implementation is needed for CGI applications.<br />
<br />
===== Step 1: fcgiwrap =====<br />
<br />
Install {{Pkg|fcgiwrap}}.<br />
The configuration file is {{ic|/usr/lib/systemd/system/fcgiwrap.socket}}.<br />
Enable and start the [[systemd]] ''fcgiwrap.socket''.<br />
<br />
The systemd unit file is currently being discussed on [https://bugs.archlinux.org/task/31696 this ArchLinux task page]. You may want to examine the unit file yourself to ensure it will work the way you want.<br />
<br />
====== Multiple worker threads ======<br />
<br />
If you want to spawn multiple worker threads, it's recommended that you use {{AUR|multiwatch}}, which will take care of restarting crashed children. You will need to use {{ic|spawn-fcgi}} to create the unix socket, as multiwatch seems unable to handle the systemd-created socket, even though fcgiwrap itself does not have any trouble if invoked directly in the unit file.<br />
<br />
Copy the unit file from {{ic|/usr/lib/systemd/system/fcgiwrap.service}} to {{ic|/etc/systemd/system/fcgiwrap.service}} (and the {{ic|fcgiwrap.socket}} unit, if present), and modify the {{ic|ExecStart}} line to suit your needs. Here is a unit file that uses {{AUR|multiwatch}}. Make sure {{ic|fcgiwrap.socket}} is not started or enabled, because it will conflict with this unit:<br />
<br />
{{hc|/etc/systemd/system/fcgiwrap.service|2=<br />
[Unit]<br />
Description=Simple CGI Server<br />
After=nss-user-lookup.target<br />
<br />
[Service]<br />
ExecStartPre=/bin/rm /run/fcgiwrap.socket<br />
ExecStart=/usr/bin/spawn-fcgi -u http -g http -s /run/fcgiwrap.sock -n -- /usr/bin/multiwatch -f 10 -- /usr/sbin/fcgiwrap<br />
ExecStartPost=/usr/bin/chmod 660 /run/fcgiwrap.sock<br />
PrivateTmp=true<br />
Restart=on-failure<br />
<br />
[Install]<br />
WantedBy=multi-user.target<br />
}}<br />
<br />
Tweak {{ic|-f 10}} to change the number of children that are spawned.<br />
<br />
{{Warning|The ExecStartPost line is required because of strange behaviour I'm seeing when I use the {{ic|-M 660}} option for {{ic|spawn-fcgi}}. The wrong mode is set. This may be a bug?}}<br />
<br />
===== Step 2: Nginx configuration =====<br />
<br />
Inside each {{Ic|server}} block serving a CGI web application should appear a {{Ic|location}} block similar to:<br />
<br />
location ~ \.cgi$ {<br />
root /path/to/server/cgi-bin/<br />
fastcgi_pass unix:/run/fcgiwrap.sock;<br />
include fastcgi.conf;<br />
}<br />
<br />
The '''default''' (Unix) socket for {{Ic|fcgiwrap}} is ''/run/fcgiwrap.sock''.<br />
<br />
== Installation in a chroot ==<br />
<br />
Installing Nginx in a chroot adds an additional layer of security. For<br />
maximum security the chroot should include only the files needed to run<br />
the Nginx server and all files should have the most restrictive<br />
permissions possible, e.g., as much as possible should be owned by root,<br />
directories such as {{ic|/usr/bin}} should be unreadable and unwriteable,<br />
etc. <br />
<br />
Arch comes with an {{ic|http}} user and group by default which will run the<br />
server. The chroot will be in {{ic|/srv/http}}.<br />
<br />
A perl script to create this jail is available at<br />
[https://gist.github.com/4365696 jail.pl gist]. You can either use that or follow the instructions in this article. It expects to be run<br />
as root. You will need to uncomment a line before it makes any changes.<br />
<br />
=== Create Necessary Devices ===<br />
<br />
Nginx needs {{ic|/dev/null}}, {{ic|/dev/random}}, and<br />
{{ic|/dev/urandom}}. To install these in the chroot we create the<br />
{{ic|/dev/}} folder and add the devices with mknod. We avoid mounting<br />
all of {{ic|/dev/}} to ensure that, even if the chroot is compromised, an<br />
attacker must break out of the chroot to access important devices like<br />
{{ic|/dev/sda1}}.<br />
<br />
{{Tip|See {{ic|man mknod}} and {{ic|<nowiki>ls -l<br />
/dev/{null,random,urandom}</nowiki>}} to better<br />
understand the argument to mknod.}}<br />
<br />
# export JAIL=/srv/http<br />
# mkdir $JAIL/dev<br />
# mknod -m 0666 $JAIL/dev/null c 1 3<br />
# mknod -m 0666 $JAIL/dev/random c 1 8<br />
# mknod -m 0444 $JAIL/dev/urandom c 1 9<br />
<br />
=== Create Necessary Folders ===<br />
<br />
Nginx requires a bunch of files to run properly. Before copying them<br />
over, create the folders to store them. This assumes your Nginx document<br />
root will be {{ic|/srv/http/www}}.<br />
<br />
# mkdir -p $JAIL/etc/nginx/logs<br />
# mkdir -p $JAIL/usr/{lib,bin}<br />
# mkdir -p $JAIL/usr/share/nginx<br />
# mkdir -p $JAIL/var/{log,lib}/nginx<br />
# mkdir -p $JAIL/www/cgi-bin<br />
# mkdir -p $JAIL/{run,tmp}<br />
# cd $JAIL; ln -s usr/lib lib <br />
<br />
{{Note| If using a 64 bit kernel you will need to create symbolic links {{ic|lib64}} and {{ic|usr/lib64}} to {{ic|usr/lib}}: {{ic|cd $JAIL; ln -s usr/lib lib64}} and {{ic|cd $JAIL/usr; ln -s lib lib64}}<br />
}}<br />
Then mount {{ic|$JAIL/tmp}} and {{ic|$JAIL/run}} as tmpfs's. The size<br />
should be limited to ensure an attacker cannot eat all the RAM.<br />
<br />
# mount -t tmpfs none $JAIL/run -o 'noexec,size=1M'<br />
# mount -t tmpfs none $JAIL/tmp -o 'noexec,size=100M'<br />
<br />
In order to preserve the mounts across reboots, the following entries should be added to /etc/fstab:<br />
<br />
{{hc|/etc/fstab|<nowiki><br />
tmpfs /srv/http/run tmpfs rw,noexec,relatime,size=1024k 0 0<br />
tmpfs /srv/http/tmp tmpfs rw,noexec,relatime,size=102400k 0 0<br />
</nowiki>}}<br />
<br />
=== Populate the chroot ===<br />
<br />
First copy over the easy files.<br />
<br />
# cp -r /usr/share/nginx/* $JAIL/usr/share/nginx<br />
# cp -r /usr/share/nginx/html/* $JAIL/www<br />
# cp /usr/bin/nginx $JAIL/usr/bin/<br />
# cp -r /var/lib/nginx $JAIL/var/lib/nginx<br />
<br />
Now copy over required libraries. Use ldd to list them and then copy<br />
them all to the correct location. Copying is preferred over hardlinks to<br />
ensure that even if an attacker gains write access to the files they<br />
cannot destroy or alter the true system files.<br />
<br />
{{hc|$ ldd /usr/bin/nginx|<nowiki><br />
linux-vdso.so.1 (0x00007fffc41fe000)<br />
libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007f57ec3e8000)<br />
libcrypt.so.1 => /usr/lib/libcrypt.so.1 (0x00007f57ec1b1000)<br />
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007f57ebead000)<br />
libm.so.6 => /usr/lib/libm.so.6 (0x00007f57ebbaf000)<br />
libpcre.so.1 => /usr/lib/libpcre.so.1 (0x00007f57eb94c000)<br />
libssl.so.1.0.0 => /usr/lib/libssl.so.1.0.0 (0x00007f57eb6e0000)<br />
libcrypto.so.1.0.0 => /usr/lib/libcrypto.so.1.0.0 (0x00007f57eb2d6000)<br />
libdl.so.2 => /usr/lib/libdl.so.2 (0x00007f57eb0d2000)<br />
libz.so.1 => /usr/lib/libz.so.1 (0x00007f57eaebc000)<br />
libGeoIP.so.1 => /usr/lib/libGeoIP.so.1 (0x00007f57eac8d000)<br />
libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x00007f57eaa77000)<br />
libc.so.6 => /usr/lib/libc.so.6 (0x00007f57ea6ca000)<br />
/lib64/ld-linux-x86-64.so.2 (0x00007f57ec604000)</nowiki>}}<br />
<br />
# cp /lib64/ld-linux-x86-64.so.2 $JAIL/lib<br />
<br />
For files residing in {{ic|/usr/lib}} you may try the following one-liner:<br />
{{bc|<nowiki># cp $(ldd /usr/bin/nginx | grep /usr/lib | sed -sre 's/(.+)(\/usr\/lib\/\S+).+/\2/g') $JAIL/usr/lib</nowiki>}}<br />
<br />
{{Note|Do not try to copy linux-vdso.so – it is not a real library and does not exist in /usr/lib. Also ld-linux-x86-64.so will likely be listed in /lib64 for a 64 bit system.}}<br />
<br />
Copy over some misc. but necessary libraries and system files.<br />
<br />
{{bc|# cp /usr/lib/libnss_* $JAIL/usr/lib<br />
# cp -rfvL /etc/{services,localtime,nsswitch.conf,nscd.conf,protocols,hosts,ld.so.cache,ld.so.conf,resolv.conf,host.conf,nginx} $JAIL/etc}}<br />
<br />
Create restricted user/group files for the chroot. This way only the<br />
users needed for the chroot to function exist as far as the chroot<br />
knows, and none of the system users/groups are leaked to attackers<br />
should they gain access to the chroot.<br />
<br />
{{hc|$JAIL/etc/group|<br />
http:x:33:<br />
nobody:x:99:<br />
}}<br />
<br />
{{hc|$JAIL/etc/passwd|<br />
http:x:33:33:http:/:/bin/false<br />
nobody:x:99:99:nobody:/:/bin/false<br />
}}<br />
<br />
{{hc|$JAIL/etc/shadow|<br />
http:x:14871::::::<br />
nobody:x:14871::::::<br />
}}<br />
<br />
{{hc|$JAIL/etc/gshadow|<br />
http:::<br />
nobody:::<br />
}}<br />
<br />
# touch $JAIL/etc/shells<br />
# touch $JAIL/run/nginx.pid<br />
<br />
Finally make set very restrictive permissions. As much as possible<br />
should be owned by root and set unwritable.<br />
<br />
# chown -R root:root $JAIL/<br />
<br />
# chown -R http:http $JAIL/www<br />
# chown -R http:http $JAIL/etc/nginx<br />
# chown -R http:http $JAIL/var/{log,lib}/nginx<br />
# chown http:http $JAIL/run/nginx.pid<br />
<br />
# find $JAIL/ -gid 0 -uid 0 -type d -print | xargs sudo chmod -rw<br />
# find $JAIL/ -gid 0 -uid 0 -type d -print | xargs sudo chmod +x<br />
# find $JAIL/etc -gid 0 -uid 0 -type f -print | xargs sudo chmod -x<br />
# find $JAIL/usr/bin -type f -print | xargs sudo chmod ug+rx<br />
# find $JAIL/ -group http -user http -print | xargs sudo chmod o-rwx<br />
# chmod +rw $JAIL/tmp<br />
# chmod +rw $JAIL/run<br />
<br />
If your server will bind port 80 (or any port 0-1024), give the<br />
chrooted executable permission to bind these ports without root.<br />
<br />
# setcap 'cap_net_bind_service=+ep' $JAIL/usr/bin/nginx<br />
<br />
=== Modify nginx.service to start chroot ===<br />
<br />
Before modifying the nginx.service unit file, it may be a good idea to copy it to<br />
{{ic|/etc/systemd/system/}} since the unit files there take priority over those in {{ic|/usr/lib/systemd/system/}}. <br />
This means upgrading nginx would not modify your custom .service file. <br />
# cp /usr/lib/systemd/system/nginx.service /etc/systemd/system/nginx.service<br />
<br />
The systemd unit must be changed to start up Nginx in the chroot, as<br />
the http user, and store the pid file in the chroot <br />
{{Note|I'm not sure if the pid file needs to be stored in the chroot jail.}}<br />
<br />
{{hc|/etc/systemd/system/nginx.service|<nowiki><br />
[Unit]<br />
Description=A high performance web server and a reverse proxy server<br />
After=syslog.target network.target<br />
<br />
[Service]<br />
Type=forking<br />
PIDFile=/srv/http/run/nginx.pid<br />
ExecStartPre=/usr/bin/chroot --userspec=http:http /srv/http /usr/bin/nginx -t -q -g 'pid /run/nginx.pid; daemon on; master_process on;'<br />
ExecStart=/usr/bin/chroot --userspec=http:http /srv/http /usr/bin/nginx -g 'pid /run/nginx.pid; daemon on; master_process on;'<br />
ExecReload=/usr/bin/chroot --userspec=http:http /srv/http /usr/bin/nginx -g 'pid /run/nginx.pid; daemon on; master_process on;' -s reload<br />
ExecStop=/usr/bin/chroot --userspec=http:http /srv/http /usr/bin/nginx -g 'pid /run/nginx.pid;' -s quit<br />
<br />
[Install]<br />
WantedBy=multi-user.target</nowiki>}}<br />
<br />
{{Note|Upgrading nginx with pacman will not upgrade the chrooted nginx installation. You have to take care of the updates manually by repeating some of the steps above. Do not forget to also update the libraries it links against. }}<br />
<br />
You can now safely get rid of the non-chrooted nginx installation. <br />
# pacman -Rsc nginx<br />
<br />
If you do not remove the non-chrooted nginx installation, you may want to make sure that the running nginx process is in fact the chrooted one. You can do so by checking where {{ic|/proc/{PID}/root}} symmlinks to. If should link to {{ic|/srv/http}} instead of {{ic|/}}. <br />
# ps -C nginx | awk '{print $1}' | sed 1d | while read -r PID; do ls -l /proc/$PID/root; done<br />
<br />
== Troubleshooting ==<br />
<br />
=== Accessing local IP redirects to localhost ===<br />
<br />
Solution from the Arch Linux [https://bbs.archlinux.org/viewtopic.php?pid=780561#p780561 forum].<br />
<br />
Edit {{ic|/etc/nginx/nginx.conf}} and locate the "server_name localhost" line without a # infront of it, and add below:<br />
server_name_in_redirect off;<br />
<br />
Default behavior is that nginx redirects any requests to the value given as server_name in the config.<br />
<br />
=== Error: 403 (Permission error) ===<br />
<br />
This is most likely a permission error. Are you sure whatever user configured in the Nginx configuration is able to read the correct files?<br />
<br />
If the files are located within a home directory, (e.g. {{ic|/home/arch/public/webapp}}) and you are sure the user running Nginx has the right permissions (you can temporarily chmod all the files to 777 in order to determine this), {{ic|/home/arch}} might be '''chmod 750''', simply {{Ic|chmod}} it to ''751'', and it should work.<br />
<br />
'''If you have changed your document root'''<br />
<br />
If you are sure that permissions are as they should be, make sure that your document root directory is not empty. Try creating index.html in there.<br />
<br />
=== Error: 404 (Pathinfo error) ===<br />
<br />
In some framework (like thinkphp, cakephp) or CMS, they need the pathinfo function. <br />
<br />
1. Edit the file {{ic|/etc/php/php.ini}}, make sure<br />
cgi.fix_pathinfo=1<br />
2. Edit {{ic|/etc/nginx/conf/nginx.conf}}, comment<br />
<br />
location ~ \.php$ {<br />
...<br />
}<br />
<br />
to <br />
<br />
#location ~ \.php$ {<br />
#...<br />
#}<br />
<br />
Then add the follows,<br />
location ~ ^(.+\.php)(.*)$ {<br />
root /srv/http/nginx;<br />
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock; <br />
#fastcgi_pass 127.0.0.1:9000; #Un-comment this and comment "fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;" if you are not using php-fpm.<br />
fastcgi_index index.php;<br />
set $document_root2 $document_root;<br />
if ($document_root2 ~ "^(.*\\\\).*?[\\\\|\/]\.\.\/(.*)$") { set $document_root2 $1$2; }<br />
if ($document_root2 ~ "^(.*\\\\).*?[\\\\|\/]\.\.\/(.*)$") { set $document_root2 $1$2; }<br />
if ($document_root2 ~ "^(.*\\\\).*?[\\\\|\/]\.\.\/(.*)$") { set $document_root2 $1$2; }<br />
if ($document_root2 ~ "^(.*\\\\).*?[\\\\|\/]\.\.\/(.*)$") { set $document_root2 $1$2; }<br />
if ($document_root2 ~ "^(.*\\\\).*?[\\\\|\/]\.\.\/(.*)$") { set $document_root2 $1$2; }<br />
fastcgi_split_path_info ^(.+\.php)(.*)$;<br />
fastcgi_param SCRIPT_FILENAME $document_root2$fastcgi_script_name;<br />
fastcgi_param PATH_INFO $fastcgi_path_info;<br />
fastcgi_param PATH_TRANSLATED $document_root2$fastcgi_path_info;<br />
include fastcgi_params;<br />
fastcgi_param DOCUMENT_ROOT $document_root2;<br />
}<br />
<br />
=== Error: The page you are looking for is temporarily unavailable. Please try again later. ===<br />
<br />
This is because the FastCGI server has not been started, or the socket used has wrong permissions.<br />
<br />
=== Error: No input file specified ===<br />
<br />
1. Most Likely you do not have the SCRIPT_FILENAME containing the full path to your scripts.<br />
If the configuration of nginx (fastcgi_param SCRIPT_FILENAME) is correct, this kind of error means php failed to load the requested script. Usually it is simply a permissions issue, you can just run php-cgi as root<br />
# spawn-fcgi -a 127.0.0.1 -p 9000 -f /usr/bin/php-cgi<br />
or you should create a group and user to start the php-cgi. For example:<br />
# groupadd www<br />
# useradd -g www www<br />
# chmod +w /srv/www/nginx/html<br />
# chown -R www:www /srv/www/nginx/html<br />
# spawn-fcgi -a 127.0.0.1 -p 9000 -u www -g www -f /usr/bin/php-cgi<br />
<br />
2. Another occasion is that, wrong "root" argument in the "location ~ \.php$" section in {{ic|nginx.conf}}, make sure the "root" points to the same directory as it in "location /" in the same server. Or you may just set root as global, do not define it in any location section.<br />
<br />
3. Verify that variable "open_basedir" in {{ic|/etc/php/php.ini}} also contains path you specified in "root" argument in {{ic|nginx.conf}}<br />
<br />
4. Also notice that not only php script should have read permission, but also the entire directory structure should have execute permission so that PHP user can traverse the path.<br />
<br />
=== Error: "File not found" in browser or "Primary script unknown" in log file ===<br />
<br />
Ensure you've specified a '''root''' and '''index''' in your '''server''' or '''location''' directive:<br />
location ~ \.php$ {<br />
root /srv/http/root_dir;<br />
index index.php;<br />
fastcgi_pass unix:/run/php-fpm/php-fpm.sock;<br />
include fastcgi.conf;<br />
}<br />
<br />
=== Error: chroot: '/usr/sbin/nginx' No such file or directory ===<br />
<br />
If you encounter this error when running the daemon of nginx using chroot, this is likely due to missing 64 bit libraries in the jailed environment.<br />
<br />
If you are running chroot in {{ic|/srv/http}} you need to add the required 64 bit libraries. <br />
<br />
First, set up the directories (these commands will need to be run as root)<br />
<br />
# mkdir /srv/http/usr/lib64 <br />
# cd /srv/http; ln -s usr/lib64 lib64<br />
<br />
Then copy the required 64 bit libraries found using {{ic|ldd /usr/sbin/nginx}} to {{ic|/srv/http/usr/lib64}}<br />
<br />
if run as root, permissions for the libraries should be read and executable for all users, so no modification is required.<br />
<br />
=== Error: Blank page through FastCGI ===<br />
<br />
No error trace, code 200 in access.log but blank page:<br />
<br />
<html><br />
<head></head><br />
<body></body><br />
</html><br />
<br />
Solution from [http://beutelevision.com/blog2/2013/08/26/nginx-with-php-fpm-generating-blank-page/ Thomas Beutel's blog]:<br />
<br />
Edit {{ic|/etc/nginx/nginx.conf}} and add a {{ic|fastcgi_param}} line in php {{ic|location}} section:<br />
<br />
location ~ \.php$ {<br />
...<br />
include fastcgi_params;<br />
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;<br />
...<br />
}<br />
<br />
php_fpm needs this so that it knows the path to the PHP file.<br />
<br />
=== Alternative Script for Systemd ===<br />
<br />
On pure Systemd you can get advantages of chroot + Systemd -> [http://0pointer.de/blog/projects/changing-roots.html Systemd for Administrators, Part VI ]<br />
Based on set [http://wiki.nginx.org/CoreModule#user user group] an pid on:<br />
{{hc|/etc/nginx/nginx.conf|2=<br />
user http;<br />
pid /run/nginx.pid;<br />
}}<br />
the absolute path of file is {{ic|/srv/http/etc/nginx/nginx.conf}}<br />
{{hc|/etc/systemd/system/nginx.service|2=<br />
[Unit]<br />
Description=Nginx (Chroot)<br />
After=syslog.target network.target<br />
<br />
[Service]<br />
Type=forking<br />
PIDFile=/srv/http/run/nginx.pid<br />
RootDirectory=/srv/http<br />
ExecStartPre=/usr/sbin/nginx -t -c /etc/nginx/nginx.conf<br />
ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf<br />
ExecReload=/usr/sbin/nginx -c /etc/nginx/nginx.conf -s reload<br />
ExecStop=/usr/sbin/nginx -c /etc/nginx/nginx.conf -s stop<br />
<br />
[Install]<br />
WantedBy=multi-user.target<br />
}}<br />
Is not necesary set the default location, nginx loads at default {{ic| -c /etc/nginx/nginx.conf}}, but is a good idea set it. <br />
<br />
Alternatively can run '''only''' ExecStart as chroot whit parameter {{ic|RootDirectoryStartOnly}} set as yes [[http://www.freedesktop.org/software/systemd/man/systemd.service.html man systemd service]] or start it before mount point as efective or a [http://www.freedesktop.org/software/systemd/man/systemd.path.html systemd path] is available.<br />
<br />
{{hc|/etc/systemd/system/nginx.path|2=<br />
[Unit]<br />
Description=Nginx (Chroot) path<br />
[Path]<br />
PathExists=/srv/http/site/Public_html<br />
[Install]<br />
WantedBy=default.target<br />
}}<br />
to activate it<br />
{{ic|systemctl enable nginx.path }} <br />
and change on {{ic|/etc/systemd/system/nginx.service}} '''WantedBy=default.target''' to '''WantedBy=nginx.path'''<br />
Practicality may be that the mount point delay unless the folder to be accessible, each time the point is accessible, systemd start the server. In my case, I prefer to mount, and before Bind to existing Dir. <br />
<br />
The {{ic| PIDFile}} on .service file allows Systemd to monitor process(absolute Path), If not the desired behavior, you can change to default one-shoot Type, and delete the reference on .service file.<br />
<br />
<br />
== See Also ==<br />
* [https://calomel.org/nginx.html Very good in-depth 2014 look at Nginx security and Reverse Proxying]<br />
* [[Nginx/Init_script|Init script for Nginx]]<br />
* [http://nginx.org/ Nginx Official Site]<br />
* [http://calomel.org/nginx.html Nginx HowTo]<br />
* [http://blog.gotux.net/tutorial/custom-nginx-indexer/ Custom Nginx Indexer]</div>Ownaginatioushttps://wiki.archlinux.org/index.php?title=Nginx&diff=311911Nginx2014-04-26T16:29:45Z<p>Ownaginatious: /* Step 1: fcgiwrap */</p>
<hr />
<div>[[Category:Web Server]]<br />
[[de:Nginx]]<br />
[[ja:Nginx]]<br />
[[ru:Nginx]]<br />
[[zh-CN:Nginx]]<br />
'''Nginx''' (pronounced "engine X"), is a free, open-source, high-performance HTTP server and reverse proxy, as well as an IMAP/POP3 proxy server, written by Igor Sysoev in 2005. According to Netcraft's [http://news.netcraft.com/archives/2014/01/03/january-2014-web-server-survey.html January 2014 Web Server Survey], Nginx now hosts 14.4% of all domains worldwide, while [[Apache]] hosts about 41.64%. Nginx is now well known for its stability, rich feature set, simple configuration, and low resource consumption.<br />
<br />
== Installation ==<br />
<br />
[[Pacman|Install]] package {{Pkg|nginx}} in the [[official repositories]].<br />
<br />
For a ''Ruby on Rails'' oriented installation, see [[Ruby on Rails#The Perfect Rails Setup]].<br />
<br />
For a chroot-based installation for additional security, see [[#Installation_in_a_chroot]]<br />
<br />
== Running ==<br />
<br />
To enable the Nginx service by default at start-up, run:<br />
# systemctl enable nginx<br />
<br />
To start the Nginx service, run:<br />
# systemctl start nginx<br />
<br />
The default served page at http://127.0.0.1 is: <br />
/usr/share/nginx/html/index.html<br />
<br />
== Configuring ==<br />
<br />
You can modify the configuration by editing the files in {{ic|/etc/nginx/}}. The main configuration file is located at {{ic|/etc/nginx/nginx.conf}}. <br />
<br />
More details can be found here: [http://wiki.nginx.org/Configuration Nginx Configuration Examples].<br />
<br />
The examples below cover the most common use cases. It is assumed that you use the default location for documents ({{ic|/usr/share/nginx/html}}). If that is not the case, substitute your path instead.<br />
<br />
=== General Configuration ===<br />
<br />
You should choose a fitting value for {{ic|worker_processes}}. This settings ultimately defines how many connection nginx will accept and how many processors it will be able to make use of. Generally, making it the number of hardware threads in your system is a good start. As such, with modern servers, set something like<br />
<br />
worker_processes 8;<br />
<br />
The maximum connections nginx will accept is given by {{ic|1=max_clients = worker_processes * worker_connections}}.<br />
<br />
=== FastCGI ===<br />
<br />
FastCGI, also FCGI, is a protocol for interfacing interactive programs with a web server. FastCGI is a variation on the earlier Common Gateway Interface (CGI); FastCGI's main aim is to reduce the overhead associated with interfacing the web server and CGI programs, allowing a server to handle more web page requests at once.<br />
<br />
FastCGI technology is introduced into Nginx to work with many external tools, i.e.: Perl, [[PHP]] and [[Python]].<br />
<br />
==== PHP implementation ====<br />
<br />
There are different ways to run a FastCGI server for PHP. We cover '''php-fpm''', a recommended solution.<br />
<br />
===== Step 1: PHP configuration =====<br />
<br />
The {{Ic|open_basedir}} in {{ic|/etc/php/php.ini}} has to list base directories which contain PHP files, like {{ic|/usr/share/nginx/html/}} and {{ic|/usr/share/webapps/}}:<br />
open_basedir = /usr/share/webapps/:/srv/http/:/usr/share/nginx/html/:/home/:/tmp/:/usr/share/pear/<br />
<br />
After that let's configure modules you need. For example to use sqlite3 you should install {{ic|php-sqlite}}. Then enable it in {{ic|/etc/php/php.ini}} by uncommenting following line:<br />
extension=sqlite3.so<br />
<br />
If you run nginx in chrooted environment (chroot is {{ic|/srv/nginx-jail}}, web pages are served at {{ic|/srv/nginx-jail/www}}), the directive refers to the chroot only (i.e. {{ic|1=open_basedir = /www}}) only.<br />
<br />
===== Step 2: php-fpm =====<br />
<br />
* http://php-fpm.org<br />
<br />
Install {{Pkg|php-fpm}}.<br />
The configuration file is {{ic|/etc/php/php-fpm.conf}}.<br />
Enable and start the [[systemd]] ''php-fpm.service''.<br />
<br />
If you run nginx in chrooted environment (chroot is {{ic|/srv/nginx-jail}}, web pages are served at {{ic|/srv/nginx-jail/www}}), you must modify the file {{ic|/etc/php/php-fpm.conf}} to include the {{ic|chroot /srv/nginx-jail}} and {{ic|1=listen = /srv/nginx-jail/run/php-fpm/php-fpm.sock}} directives within the pool name section (a default one is {{ic|[www]}}). (Create the directory for the socket file, if missing.)<br />
<br />
===== Step 3: Nginx configuration =====<br />
<br />
Inside each {{Ic|server}} block serving a PHP web application should appear a {{Ic|location}} block similar to:<br />
location ~ \.php$ {<br />
try_files $uri = 404; <br />
fastcgi_pass unix:/run/php-fpm/php-fpm.sock;<br />
fastcgi_index index.php;<br />
include fastcgi.conf;<br />
}<br />
<br />
If the {{Ic|root}} path in specified only inside a {{Ic|location}} (as it is in the default config), then either add<br />
root /srv/http<br />
to the {{Ic|location ~ \.php$}}, or move it directly somewhere under {{Ic|server}}.<br />
<br />
A complete working configuration could look like this:<br />
<br />
server {<br />
listen 80;<br />
server_name localhost;<br />
root /usr/share/nginx/html;<br />
location / {<br />
index index.html index.htm index.php;<br />
}<br />
<br />
location ~ \.php$ {<br />
#fastcgi_pass 127.0.0.1:9000; (depending on your php-fpm socket configuration)<br />
fastcgi_pass unix:/run/php-fpm/php-fpm.sock;<br />
fastcgi_index index.php;<br />
include fastcgi.conf;<br />
}<br />
}<br />
<br />
You could create {{Ic|/etc/nginx/php.conf}} and save the php bit of the configuration there, then when needed just include this file into the {{Ic|server}} block.<br />
server = {<br />
...<br />
include php.conf;<br />
...<br />
}<br />
<br />
If you are going to process .html and .htm files with PHP, you should have something like this:<br />
location ~ \.(php|html|htm)$ {<br />
fastcgi_pass unix:/run/php-fpm/php-fpm.sock;<br />
fastcgi_index index.php;<br />
include fastcgi_params;<br />
}<br />
<br />
Non .php files processing in php-fpm should be explicitly enabled in<br />
{{Ic|/etc/php/php-fpm.conf}}:<br />
security.limit_extensions = .php .html .htm<br />
<br />
You need to restart the php-fpm daemon if you changed the configuration.<br />
# systemctl restart php-fpm<br />
<br />
'''Pay attention''' to the {{Ic|fastcgi_pass}} argument, as it must be the TCP or Unix socket defined by the chosen FastCGI server in its config file. The '''default''' (Unix) socket for {{Ic|php-fpm}} is<br />
fastcgi_pass unix:/run/php-fpm/php-fpm.sock;<br />
You might use the common TCP socket, '''not default''',<br />
fastcgi_pass 127.0.0.1:9000;<br />
Unix domain sockets are however faster.<br />
<br />
{{Ic|fastcgi.conf}} or {{Ic|fastcgi_params}} are usually included because they hold FastCGI settings for Nginx; the use of the latter is deprecated, though. They come within the Nginx installation.<br />
<br />
Finally, if Nginx has been working, run:<br />
# systemctl restart nginx<br />
<br />
If you would like to test the FastCGI implementation, create {{ic|/usr/share/nginx/html/index.php}} with content<br />
<?php<br />
phpinfo();<br />
?> <br />
and visit the URL http://127.0.0.1/index.php with your browser after checking that {{ic|/usr/share/nginx/html}} is included in {{ic|open_basedir}}.<br />
<br />
==== CGI implementation ====<br />
<br />
This implementation is needed for CGI applications.<br />
<br />
===== Step 1: fcgiwrap =====<br />
<br />
Install {{Pkg|fcgiwrap}}.<br />
The configuration file is {{ic|/usr/lib/systemd/system/fcgiwrap.service}}.<br />
Enable and start the [[systemd]] ''fcgiwrap.service''.<br />
<br />
The systemd unit file is currently being discussed on [https://bugs.archlinux.org/task/31696 this ArchLinux task page]. You may want to examine the unit file yourself to ensure it will work the way you want.<br />
<br />
====== Multiple worker threads ======<br />
<br />
If you want to spawn multiple worker threads, it's recommended that you use {{AUR|multiwatch}}, which will take care of restarting crashed children. You will need to use {{ic|spawn-fcgi}} to create the unix socket, as multiwatch seems unable to handle the systemd-created socket, even though fcgiwrap itself does not have any trouble if invoked directly in the unit file.<br />
<br />
Copy the unit file from {{ic|/usr/lib/systemd/system/fcgiwrap.service}} to {{ic|/etc/systemd/system/fcgiwrap.service}} (and the {{ic|fcgiwrap.socket}} unit, if present), and modify the {{ic|ExecStart}} line to suit your needs. Here is a unit file that uses {{AUR|multiwatch}}. Make sure {{ic|fcgiwrap.socket}} is not started or enabled, because it will conflict with this unit:<br />
<br />
{{hc|/etc/systemd/system/fcgiwrap.service|2=<br />
[Unit]<br />
Description=Simple CGI Server<br />
After=nss-user-lookup.target<br />
<br />
[Service]<br />
ExecStartPre=/bin/rm /run/fcgiwrap.socket<br />
ExecStart=/usr/bin/spawn-fcgi -u http -g http -s /run/fcgiwrap.sock -n -- /usr/bin/multiwatch -f 10 -- /usr/sbin/fcgiwrap<br />
ExecStartPost=/usr/bin/chmod 660 /run/fcgiwrap.sock<br />
PrivateTmp=true<br />
Restart=on-failure<br />
<br />
[Install]<br />
WantedBy=multi-user.target<br />
}}<br />
<br />
Tweak {{ic|-f 10}} to change the number of children that are spawned.<br />
<br />
{{Warning|The ExecStartPost line is required because of strange behaviour I'm seeing when I use the {{ic|-M 660}} option for {{ic|spawn-fcgi}}. The wrong mode is set. This may be a bug?}}<br />
<br />
===== Step 2: Nginx configuration =====<br />
<br />
Inside each {{Ic|server}} block serving a CGI web application should appear a {{Ic|location}} block similar to:<br />
<br />
location ~ \.cgi$ {<br />
root /path/to/server/cgi-bin/<br />
fastcgi_pass unix:/run/fcgiwrap.sock;<br />
include fastcgi.conf;<br />
}<br />
<br />
The '''default''' (Unix) socket for {{Ic|fcgiwrap}} is ''/run/fcgiwrap.sock''.<br />
<br />
== Installation in a chroot ==<br />
<br />
Installing Nginx in a chroot adds an additional layer of security. For<br />
maximum security the chroot should include only the files needed to run<br />
the Nginx server and all files should have the most restrictive<br />
permissions possible, e.g., as much as possible should be owned by root,<br />
directories such as {{ic|/usr/bin}} should be unreadable and unwriteable,<br />
etc. <br />
<br />
Arch comes with an {{ic|http}} user and group by default which will run the<br />
server. The chroot will be in {{ic|/srv/http}}.<br />
<br />
A perl script to create this jail is available at<br />
[https://gist.github.com/4365696 jail.pl gist]. You can either use that or follow the instructions in this article. It expects to be run<br />
as root. You will need to uncomment a line before it makes any changes.<br />
<br />
=== Create Necessary Devices ===<br />
<br />
Nginx needs {{ic|/dev/null}}, {{ic|/dev/random}}, and<br />
{{ic|/dev/urandom}}. To install these in the chroot we create the<br />
{{ic|/dev/}} folder and add the devices with mknod. We avoid mounting<br />
all of {{ic|/dev/}} to ensure that, even if the chroot is compromised, an<br />
attacker must break out of the chroot to access important devices like<br />
{{ic|/dev/sda1}}.<br />
<br />
{{Tip|See {{ic|man mknod}} and {{ic|<nowiki>ls -l<br />
/dev/{null,random,urandom}</nowiki>}} to better<br />
understand the argument to mknod.}}<br />
<br />
# export JAIL=/srv/http<br />
# mkdir $JAIL/dev<br />
# mknod -m 0666 $JAIL/dev/null c 1 3<br />
# mknod -m 0666 $JAIL/dev/random c 1 8<br />
# mknod -m 0444 $JAIL/dev/urandom c 1 9<br />
<br />
=== Create Necessary Folders ===<br />
<br />
Nginx requires a bunch of files to run properly. Before copying them<br />
over, create the folders to store them. This assumes your Nginx document<br />
root will be {{ic|/srv/http/www}}.<br />
<br />
# mkdir -p $JAIL/etc/nginx/logs<br />
# mkdir -p $JAIL/usr/{lib,bin}<br />
# mkdir -p $JAIL/usr/share/nginx<br />
# mkdir -p $JAIL/var/{log,lib}/nginx<br />
# mkdir -p $JAIL/www/cgi-bin<br />
# mkdir -p $JAIL/{run,tmp}<br />
# cd $JAIL; ln -s usr/lib lib <br />
<br />
{{Note| If using a 64 bit kernel you will need to create symbolic links {{ic|lib64}} and {{ic|usr/lib64}} to {{ic|usr/lib}}: {{ic|cd $JAIL; ln -s usr/lib lib64}} and {{ic|cd $JAIL/usr; ln -s lib lib64}}<br />
}}<br />
Then mount {{ic|$JAIL/tmp}} and {{ic|$JAIL/run}} as tmpfs's. The size<br />
should be limited to ensure an attacker cannot eat all the RAM.<br />
<br />
# mount -t tmpfs none $JAIL/run -o 'noexec,size=1M'<br />
# mount -t tmpfs none $JAIL/tmp -o 'noexec,size=100M'<br />
<br />
In order to preserve the mounts across reboots, the following entries should be added to /etc/fstab:<br />
<br />
{{hc|/etc/fstab|<nowiki><br />
tmpfs /srv/http/run tmpfs rw,noexec,relatime,size=1024k 0 0<br />
tmpfs /srv/http/tmp tmpfs rw,noexec,relatime,size=102400k 0 0<br />
</nowiki>}}<br />
<br />
=== Populate the chroot ===<br />
<br />
First copy over the easy files.<br />
<br />
# cp -r /usr/share/nginx/* $JAIL/usr/share/nginx<br />
# cp -r /usr/share/nginx/html/* $JAIL/www<br />
# cp /usr/bin/nginx $JAIL/usr/bin/<br />
# cp -r /var/lib/nginx $JAIL/var/lib/nginx<br />
<br />
Now copy over required libraries. Use ldd to list them and then copy<br />
them all to the correct location. Copying is preferred over hardlinks to<br />
ensure that even if an attacker gains write access to the files they<br />
cannot destroy or alter the true system files.<br />
<br />
{{hc|$ ldd /usr/bin/nginx|<nowiki><br />
linux-vdso.so.1 (0x00007fffc41fe000)<br />
libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007f57ec3e8000)<br />
libcrypt.so.1 => /usr/lib/libcrypt.so.1 (0x00007f57ec1b1000)<br />
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007f57ebead000)<br />
libm.so.6 => /usr/lib/libm.so.6 (0x00007f57ebbaf000)<br />
libpcre.so.1 => /usr/lib/libpcre.so.1 (0x00007f57eb94c000)<br />
libssl.so.1.0.0 => /usr/lib/libssl.so.1.0.0 (0x00007f57eb6e0000)<br />
libcrypto.so.1.0.0 => /usr/lib/libcrypto.so.1.0.0 (0x00007f57eb2d6000)<br />
libdl.so.2 => /usr/lib/libdl.so.2 (0x00007f57eb0d2000)<br />
libz.so.1 => /usr/lib/libz.so.1 (0x00007f57eaebc000)<br />
libGeoIP.so.1 => /usr/lib/libGeoIP.so.1 (0x00007f57eac8d000)<br />
libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x00007f57eaa77000)<br />
libc.so.6 => /usr/lib/libc.so.6 (0x00007f57ea6ca000)<br />
/lib64/ld-linux-x86-64.so.2 (0x00007f57ec604000)</nowiki>}}<br />
<br />
# cp /lib64/ld-linux-x86-64.so.2 $JAIL/lib<br />
<br />
For files residing in {{ic|/usr/lib}} you may try the following one-liner:<br />
{{bc|<nowiki># cp $(ldd /usr/bin/nginx | grep /usr/lib | sed -sre 's/(.+)(\/usr\/lib\/\S+).+/\2/g') $JAIL/usr/lib</nowiki>}}<br />
<br />
{{Note|Do not try to copy linux-vdso.so – it is not a real library and does not exist in /usr/lib. Also ld-linux-x86-64.so will likely be listed in /lib64 for a 64 bit system.}}<br />
<br />
Copy over some misc. but necessary libraries and system files.<br />
<br />
{{bc|# cp /usr/lib/libnss_* $JAIL/usr/lib<br />
# cp -rfvL /etc/{services,localtime,nsswitch.conf,nscd.conf,protocols,hosts,ld.so.cache,ld.so.conf,resolv.conf,host.conf,nginx} $JAIL/etc}}<br />
<br />
Create restricted user/group files for the chroot. This way only the<br />
users needed for the chroot to function exist as far as the chroot<br />
knows, and none of the system users/groups are leaked to attackers<br />
should they gain access to the chroot.<br />
<br />
{{hc|$JAIL/etc/group|<br />
http:x:33:<br />
nobody:x:99:<br />
}}<br />
<br />
{{hc|$JAIL/etc/passwd|<br />
http:x:33:33:http:/:/bin/false<br />
nobody:x:99:99:nobody:/:/bin/false<br />
}}<br />
<br />
{{hc|$JAIL/etc/shadow|<br />
http:x:14871::::::<br />
nobody:x:14871::::::<br />
}}<br />
<br />
{{hc|$JAIL/etc/gshadow|<br />
http:::<br />
nobody:::<br />
}}<br />
<br />
# touch $JAIL/etc/shells<br />
# touch $JAIL/run/nginx.pid<br />
<br />
Finally make set very restrictive permissions. As much as possible<br />
should be owned by root and set unwritable.<br />
<br />
# chown -R root:root $JAIL/<br />
<br />
# chown -R http:http $JAIL/www<br />
# chown -R http:http $JAIL/etc/nginx<br />
# chown -R http:http $JAIL/var/{log,lib}/nginx<br />
# chown http:http $JAIL/run/nginx.pid<br />
<br />
# find $JAIL/ -gid 0 -uid 0 -type d -print | xargs sudo chmod -rw<br />
# find $JAIL/ -gid 0 -uid 0 -type d -print | xargs sudo chmod +x<br />
# find $JAIL/etc -gid 0 -uid 0 -type f -print | xargs sudo chmod -x<br />
# find $JAIL/usr/bin -type f -print | xargs sudo chmod ug+rx<br />
# find $JAIL/ -group http -user http -print | xargs sudo chmod o-rwx<br />
# chmod +rw $JAIL/tmp<br />
# chmod +rw $JAIL/run<br />
<br />
If your server will bind port 80 (or any port 0-1024), give the<br />
chrooted executable permission to bind these ports without root.<br />
<br />
# setcap 'cap_net_bind_service=+ep' $JAIL/usr/bin/nginx<br />
<br />
=== Modify nginx.service to start chroot ===<br />
<br />
Before modifying the nginx.service unit file, it may be a good idea to copy it to<br />
{{ic|/etc/systemd/system/}} since the unit files there take priority over those in {{ic|/usr/lib/systemd/system/}}. <br />
This means upgrading nginx would not modify your custom .service file. <br />
# cp /usr/lib/systemd/system/nginx.service /etc/systemd/system/nginx.service<br />
<br />
The systemd unit must be changed to start up Nginx in the chroot, as<br />
the http user, and store the pid file in the chroot <br />
{{Note|I'm not sure if the pid file needs to be stored in the chroot jail.}}<br />
<br />
{{hc|/etc/systemd/system/nginx.service|<nowiki><br />
[Unit]<br />
Description=A high performance web server and a reverse proxy server<br />
After=syslog.target network.target<br />
<br />
[Service]<br />
Type=forking<br />
PIDFile=/srv/http/run/nginx.pid<br />
ExecStartPre=/usr/bin/chroot --userspec=http:http /srv/http /usr/bin/nginx -t -q -g 'pid /run/nginx.pid; daemon on; master_process on;'<br />
ExecStart=/usr/bin/chroot --userspec=http:http /srv/http /usr/bin/nginx -g 'pid /run/nginx.pid; daemon on; master_process on;'<br />
ExecReload=/usr/bin/chroot --userspec=http:http /srv/http /usr/bin/nginx -g 'pid /run/nginx.pid; daemon on; master_process on;' -s reload<br />
ExecStop=/usr/bin/chroot --userspec=http:http /srv/http /usr/bin/nginx -g 'pid /run/nginx.pid;' -s quit<br />
<br />
[Install]<br />
WantedBy=multi-user.target</nowiki>}}<br />
<br />
{{Note|Upgrading nginx with pacman will not upgrade the chrooted nginx installation. You have to take care of the updates manually by repeating some of the steps above. Do not forget to also update the libraries it links against. }}<br />
<br />
You can now safely get rid of the non-chrooted nginx installation. <br />
# pacman -Rsc nginx<br />
<br />
If you do not remove the non-chrooted nginx installation, you may want to make sure that the running nginx process is in fact the chrooted one. You can do so by checking where {{ic|/proc/{PID}/root}} symmlinks to. If should link to {{ic|/srv/http}} instead of {{ic|/}}. <br />
# ps -C nginx | awk '{print $1}' | sed 1d | while read -r PID; do ls -l /proc/$PID/root; done<br />
<br />
== Troubleshooting ==<br />
<br />
=== Accessing local IP redirects to localhost ===<br />
<br />
Solution from the Arch Linux [https://bbs.archlinux.org/viewtopic.php?pid=780561#p780561 forum].<br />
<br />
Edit {{ic|/etc/nginx/nginx.conf}} and locate the "server_name localhost" line without a # infront of it, and add below:<br />
server_name_in_redirect off;<br />
<br />
Default behavior is that nginx redirects any requests to the value given as server_name in the config.<br />
<br />
=== Error: 403 (Permission error) ===<br />
<br />
This is most likely a permission error. Are you sure whatever user configured in the Nginx configuration is able to read the correct files?<br />
<br />
If the files are located within a home directory, (e.g. {{ic|/home/arch/public/webapp}}) and you are sure the user running Nginx has the right permissions (you can temporarily chmod all the files to 777 in order to determine this), {{ic|/home/arch}} might be '''chmod 750''', simply {{Ic|chmod}} it to ''751'', and it should work.<br />
<br />
'''If you have changed your document root'''<br />
<br />
If you are sure that permissions are as they should be, make sure that your document root directory is not empty. Try creating index.html in there.<br />
<br />
=== Error: 404 (Pathinfo error) ===<br />
<br />
In some framework (like thinkphp, cakephp) or CMS, they need the pathinfo function. <br />
<br />
1. Edit the file {{ic|/etc/php/php.ini}}, make sure<br />
cgi.fix_pathinfo=1<br />
2. Edit {{ic|/etc/nginx/conf/nginx.conf}}, comment<br />
<br />
location ~ \.php$ {<br />
...<br />
}<br />
<br />
to <br />
<br />
#location ~ \.php$ {<br />
#...<br />
#}<br />
<br />
Then add the follows,<br />
location ~ ^(.+\.php)(.*)$ {<br />
root /srv/http/nginx;<br />
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock; <br />
#fastcgi_pass 127.0.0.1:9000; #Un-comment this and comment "fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;" if you are not using php-fpm.<br />
fastcgi_index index.php;<br />
set $document_root2 $document_root;<br />
if ($document_root2 ~ "^(.*\\\\).*?[\\\\|\/]\.\.\/(.*)$") { set $document_root2 $1$2; }<br />
if ($document_root2 ~ "^(.*\\\\).*?[\\\\|\/]\.\.\/(.*)$") { set $document_root2 $1$2; }<br />
if ($document_root2 ~ "^(.*\\\\).*?[\\\\|\/]\.\.\/(.*)$") { set $document_root2 $1$2; }<br />
if ($document_root2 ~ "^(.*\\\\).*?[\\\\|\/]\.\.\/(.*)$") { set $document_root2 $1$2; }<br />
if ($document_root2 ~ "^(.*\\\\).*?[\\\\|\/]\.\.\/(.*)$") { set $document_root2 $1$2; }<br />
fastcgi_split_path_info ^(.+\.php)(.*)$;<br />
fastcgi_param SCRIPT_FILENAME $document_root2$fastcgi_script_name;<br />
fastcgi_param PATH_INFO $fastcgi_path_info;<br />
fastcgi_param PATH_TRANSLATED $document_root2$fastcgi_path_info;<br />
include fastcgi_params;<br />
fastcgi_param DOCUMENT_ROOT $document_root2;<br />
}<br />
<br />
=== Error: The page you are looking for is temporarily unavailable. Please try again later. ===<br />
<br />
This is because the FastCGI server has not been started, or the socket used has wrong permissions.<br />
<br />
=== Error: No input file specified ===<br />
<br />
1. Most Likely you do not have the SCRIPT_FILENAME containing the full path to your scripts.<br />
If the configuration of nginx (fastcgi_param SCRIPT_FILENAME) is correct, this kind of error means php failed to load the requested script. Usually it is simply a permissions issue, you can just run php-cgi as root<br />
# spawn-fcgi -a 127.0.0.1 -p 9000 -f /usr/bin/php-cgi<br />
or you should create a group and user to start the php-cgi. For example:<br />
# groupadd www<br />
# useradd -g www www<br />
# chmod +w /srv/www/nginx/html<br />
# chown -R www:www /srv/www/nginx/html<br />
# spawn-fcgi -a 127.0.0.1 -p 9000 -u www -g www -f /usr/bin/php-cgi<br />
<br />
2. Another occasion is that, wrong "root" argument in the "location ~ \.php$" section in {{ic|nginx.conf}}, make sure the "root" points to the same directory as it in "location /" in the same server. Or you may just set root as global, do not define it in any location section.<br />
<br />
3. Verify that variable "open_basedir" in {{ic|/etc/php/php.ini}} also contains path you specified in "root" argument in {{ic|nginx.conf}}<br />
<br />
4. Also notice that not only php script should have read permission, but also the entire directory structure should have execute permission so that PHP user can traverse the path.<br />
<br />
=== Error: "File not found" in browser or "Primary script unknown" in log file ===<br />
<br />
Ensure you've specified a '''root''' and '''index''' in your '''server''' or '''location''' directive:<br />
location ~ \.php$ {<br />
root /srv/http/root_dir;<br />
index index.php;<br />
fastcgi_pass unix:/run/php-fpm/php-fpm.sock;<br />
include fastcgi.conf;<br />
}<br />
<br />
=== Error: chroot: '/usr/sbin/nginx' No such file or directory ===<br />
<br />
If you encounter this error when running the daemon of nginx using chroot, this is likely due to missing 64 bit libraries in the jailed environment.<br />
<br />
If you are running chroot in {{ic|/srv/http}} you need to add the required 64 bit libraries. <br />
<br />
First, set up the directories (these commands will need to be run as root)<br />
<br />
# mkdir /srv/http/usr/lib64 <br />
# cd /srv/http; ln -s usr/lib64 lib64<br />
<br />
Then copy the required 64 bit libraries found using {{ic|ldd /usr/sbin/nginx}} to {{ic|/srv/http/usr/lib64}}<br />
<br />
if run as root, permissions for the libraries should be read and executable for all users, so no modification is required.<br />
<br />
=== Error: Blank page through FastCGI ===<br />
<br />
No error trace, code 200 in access.log but blank page:<br />
<br />
<html><br />
<head></head><br />
<body></body><br />
</html><br />
<br />
Solution from [http://beutelevision.com/blog2/2013/08/26/nginx-with-php-fpm-generating-blank-page/ Thomas Beutel's blog]:<br />
<br />
Edit {{ic|/etc/nginx/nginx.conf}} and add a {{ic|fastcgi_param}} line in php {{ic|location}} section:<br />
<br />
location ~ \.php$ {<br />
...<br />
include fastcgi_params;<br />
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;<br />
...<br />
}<br />
<br />
php_fpm needs this so that it knows the path to the PHP file.<br />
<br />
=== Alternative Script for Systemd ===<br />
<br />
On pure Systemd you can get advantages of chroot + Systemd -> [http://0pointer.de/blog/projects/changing-roots.html Systemd for Administrators, Part VI ]<br />
Based on set [http://wiki.nginx.org/CoreModule#user user group] an pid on:<br />
{{hc|/etc/nginx/nginx.conf|2=<br />
user http;<br />
pid /run/nginx.pid;<br />
}}<br />
the absolute path of file is {{ic|/srv/http/etc/nginx/nginx.conf}}<br />
{{hc|/etc/systemd/system/nginx.service|2=<br />
[Unit]<br />
Description=Nginx (Chroot)<br />
After=syslog.target network.target<br />
<br />
[Service]<br />
Type=forking<br />
PIDFile=/srv/http/run/nginx.pid<br />
RootDirectory=/srv/http<br />
ExecStartPre=/usr/sbin/nginx -t -c /etc/nginx/nginx.conf<br />
ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf<br />
ExecReload=/usr/sbin/nginx -c /etc/nginx/nginx.conf -s reload<br />
ExecStop=/usr/sbin/nginx -c /etc/nginx/nginx.conf -s stop<br />
<br />
[Install]<br />
WantedBy=multi-user.target<br />
}}<br />
Is not necesary set the default location, nginx loads at default {{ic| -c /etc/nginx/nginx.conf}}, but is a good idea set it. <br />
<br />
Alternatively can run '''only''' ExecStart as chroot whit parameter {{ic|RootDirectoryStartOnly}} set as yes [[http://www.freedesktop.org/software/systemd/man/systemd.service.html man systemd service]] or start it before mount point as efective or a [http://www.freedesktop.org/software/systemd/man/systemd.path.html systemd path] is available.<br />
<br />
{{hc|/etc/systemd/system/nginx.path|2=<br />
[Unit]<br />
Description=Nginx (Chroot) path<br />
[Path]<br />
PathExists=/srv/http/site/Public_html<br />
[Install]<br />
WantedBy=default.target<br />
}}<br />
to activate it<br />
{{ic|systemctl enable nginx.path }} <br />
and change on {{ic|/etc/systemd/system/nginx.service}} '''WantedBy=default.target''' to '''WantedBy=nginx.path'''<br />
Practicality may be that the mount point delay unless the folder to be accessible, each time the point is accessible, systemd start the server. In my case, I prefer to mount, and before Bind to existing Dir. <br />
<br />
The {{ic| PIDFile}} on .service file allows Systemd to monitor process(absolute Path), If not the desired behavior, you can change to default one-shoot Type, and delete the reference on .service file.<br />
<br />
<br />
== See Also ==<br />
* [https://calomel.org/nginx.html Very good in-depth 2014 look at Nginx security and Reverse Proxying]<br />
* [[Nginx/Init_script|Init script for Nginx]]<br />
* [http://nginx.org/ Nginx Official Site]<br />
* [http://calomel.org/nginx.html Nginx HowTo]<br />
* [http://blog.gotux.net/tutorial/custom-nginx-indexer/ Custom Nginx Indexer]</div>Ownaginatioushttps://wiki.archlinux.org/index.php?title=PulseAudio/Examples&diff=267089PulseAudio/Examples2013-07-19T18:43:59Z<p>Ownaginatious: /* PulseAudio over network */</p>
<hr />
<div>[[Category:Audio/Video]]<br />
[[it:PulseAudio/Examples]]<br />
<br />
=== Defaulting an Analog Output Source ===<br />
{{Note| To list devices aplay is used. This program is part of the alsa-utils package and is NOT required to output to multiple sources. It is required to list playback devices therefore users can remove this package when finished with it.}}<br />
<br />
To select an alternative source as the default output (for example analog), first list all sources:<br />
{{bc|$ aplay -l<br />
**** List of PLAYBACK Hardware Devices ****<br />
card 0: Intel [HDA Intel], device 0: ALC889A Analog [ALC889A Analog]<br />
Subdevices: 0/1<br />
Subdevice #0: subdevice #0<br />
card 0: Intel [HDA Intel], device 1: ALC889A Digital [ALC889A Digital]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 0: Intel [HDA Intel], device 3: HDMI 0 [HDMI 0]<br />
Subdevices: 0/1<br />
Subdevice #0: subdevice #0}}<br />
<br />
On this machine, the analog source is card 0, device 0. Edit {{ic|/etc/pulse/default.pa}} and append the following to add the analog source:<br />
load-module module-alsa-sink device=hw:0,0<br />
<br />
Determine the correct index of the new source:<br />
$ pacmd list-sinks | less<br />
<br />
Note the index number that corresponds to the 'alsa_output.hw_0_0' sink.<br />
<br />
Finally, add a 2nd line to {{ic|/etc/pulse/default.pa}} defining the analog output to be used by default:<br />
set-default-sink 2<br />
<br />
Either logout/login or restart pulseaudio manually for these changes to take effect.<br />
<br />
=== Simultaneous HDMI and Analog Output ===<br />
PulseAudio allows for simultaneous output to multiple sources. In this example, some applications are configured to use HDMI while others are configured to use analog. Multiple applications are able to receive audio at the same time.<br />
{{bc|$ aplay -l<br />
**** List of PLAYBACK Hardware Devices ****<br />
card 0: Intel [HDA Intel], device 0: ALC889A Analog [ALC889A Analog]<br />
Subdevices: 0/1<br />
Subdevice #0: subdevice #0<br />
card 0: Intel [HDA Intel], device 1: ALC889A Digital [ALC889A Digital]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 0: Intel [HDA Intel], device 3: HDMI 0 [HDMI 0]<br />
Subdevices: 0/1<br />
Subdevice #0: subdevice #0}}<br />
<br />
The key to a configuration like this is to understand that whatever is selected in pavucontrol under Configuration>Internal AUdio is the default device. Load pavucontrol>Configuration and select HDMI as the profile. <br />
<br />
Add the following to {{ic|/etc/pulse/default.pa}} to setup the analog as a secondary source:<br />
### Load analog device<br />
load-module module-alsa-sink device=hw:0,0<br />
load-module module-combine-sink sink_name=combined<br />
set-default-sink combined<br />
<br />
Restart PulseAudio, run pavucontrol and select the "Output Devices" tab. Three settings should be displayed:<br />
# Internal Audio Digital Stereo (HDMI)<br />
# Internal Audio<br />
# Simultaneous output to Internal Audio Digital Stereo (HDMI), Internal Audio<br />
<br />
Now start a program that will use pulseaudio such as mplayer, vlc, mpd, etc. and switch to the "Playback" tab. A pulldown should be available for the running program to select one of the three sources.<br />
<br />
Also see [https://bbs.archlinux.org/viewtopic.php?id=118026 this thread] for a variation on this theme and [http://www.freedesktop.org/wiki/Software/PulseAudio/FAQ#Can_I_use_PulseAudio_to_playback_music_on_two_sound_cards_simultaneously.3F PulseAudio FAQ].<br />
<br />
=== Using MPD with PulseAudio running as the mpd user ===<br />
This scenario is described in the [[https://wiki.archlinux.org/index.php/Music_Player_Daemon/Tips_and_Tricks#Local_.28with_separate_mpd_user.29 MPD Tips and Tricks]] article.<br />
<br />
===Surround sound systems===<br />
Many people have a surround card, but have speakers for just two channels, so PulseAudio cannot really default to a surround setup. To enable all the channels, edit {{ic|/etc/pulse/daemon.conf}}: uncomment the default-sample-channels line (i.e. remove the semicolon from the beginning of the line) and set the value to '''6''' For a ''5.1'' setup, or '''8''' for a ''7.1'' setup etc.<br />
# Default<br />
default-sample-channels=2<br />
# For 5.1<br />
default-sample-channels=6<br />
# For 7.1<br />
default-sample-channels=8<br />
<br />
After doing the edit, restart Pulseaudio.<br />
<br />
====Splitting front/rear====<br />
Connect speakers to front analog output and headphones to rear output. It would be usefull to split front/rear to separate sinks. Add to {{ic|/etc/pulse/default.pa}}:<br />
<br />
load-module module-remap-sink sink_name=speakers remix=no master=alsa_output.pci-0000_05_00.0.analog-surround-40 channels=2 master_channel_map=front-left,front-right channel_map=front-left,front-right<br />
load-module module-remap-sink sink_name=headphones remix=no master=alsa_output.pci-0000_05_00.0.analog-surround-40 channels=2 master_channel_map=rear-left,rear-right channel_map=front-left,front-right<br />
<br />
(replace alsa_output.pci-0000_05_00.0.analog-surround-40 in the sound card name shown from 'pacmd list-sinks')<br />
<br />
Switch player between speakers and headphones.<br />
<br />
====LFE remixing====<br />
By default Pulseaudio remixes the number of channels to the default-sample-channels, however it dose not do this for the LFE channel. To enable LFE remixing uncomment the line:<br />
<br />
; enable-lfe-remixing = no<br />
<br />
and replace no with yes:<br />
<br />
enable-lfe-remixing = yes<br />
<br />
then restart Pulseaudio.<br />
<br />
===Advanced ALSA Configuration===<br />
In order for ALSA to use PulseAudio it needs a special {{ic|/etc/asound.conf}} (system wide settings) (recommended) or {{ic|~/.asoundrc}} (settings on a per user basis):<br />
{{hc|/etc/asound.conf|<nowiki><br />
pcm.pulse {<br />
type pulse<br />
}<br />
ctl.pulse {<br />
type pulse<br />
}<br />
pcm.!default {<br />
type pulse<br />
}<br />
ctl.!default {<br />
type pulse<br />
}<br />
</nowiki>}}<br />
<br />
Omission of the last two groups will cause Pulseaudio not to be used by default. Change the ALSA device to "pulse" in the applications to make it work.<br />
<br />
{{Note|The above configuration is provided by the package {{Pkg|pulseaudio-alsa}}.}}<br />
<br />
====ALSA Monitor source====<br />
To be able to record from a monitor source (a.k.a. "What-U-Hear", "Stereo Mix"), use {{ic|pactl list}} to find out the name of the source in Pulseaudio (e.g. {{ic|alsa_output.pci-0000_00_1b.0.analog-stereo.monitor}}). Then add lines like the following to {{ic|/etc/asound.conf}} or {{ic|~/.asoundrc}}:<br />
pcm.pulse_monitor {<br />
type pulse<br />
device alsa_output.pci-0000_00_1b.0.analog-stereo.monitor<br />
}<br />
<br />
ctl.pulse_monitor {<br />
type pulse<br />
device alsa_output.pci-0000_00_1b.0.analog-stereo.monitor<br />
}<br />
<br />
Now you can select {{ic|pulse_monitor}} as a recording source.<br />
<br />
Alternatively, you can use pavucontrol to do this : make sure you've set up the display to "All input Devices", then select "Monitor of [your soundcard]" as the recording source.<br />
<br />
===HDMI output configuration===<br />
As outlined in ftp://download.nvidia.com/XFree86/gpu-hdmi-audio-document/gpu-hdmi-audio.html#_issues_in_pulseaudio unless the hdmi port is the first<br />
output, PulseAudio will not be able to have any audio when using certain graphics cards with hdmi audio support. This is because of a bug in pulseaudio where it will only select the first HDMI output on a device. A work around posted further down is to first find which hdmi output is working by using the aplay utility from alsa.<br />
<br />
The original title for this section indicated the problem is specific to nVidia cards. As seen in [https://bbs.archlinux.org/viewtopic.php?id=133222 this forum thread] other cards are affected as well. The rest of the section will use an nVidia card as a case-study but the solution should carry over for people using other affected cards.<br />
<br />
====Finding HDMI output====<br />
Then find the working output by listing the available cards<br />
# aplay -l<br />
<br />
sample output:<br />
**** List of PLAYBACK Hardware Devices ****<br />
card 0: NVidia [HDA NVidia], device 0: ALC1200 Analog [ALC1200 Analog]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 0: NVidia [HDA NVidia], device 3: ALC1200 Digital [ALC1200 Digital]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 1: NVidia_1 [HDA NVidia], device 3: HDMI 0 [HDMI 0]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 1: NVidia_1 [HDA NVidia], device 7: HDMI 0 [HDMI 0]<br />
Subdevices: 0/1<br />
Subdevice #0: subdevice #0<br />
card 1: NVidia_1 [HDA NVidia], device 8: HDMI 0 [HDMI 0]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 1: NVidia_1 [HDA NVidia], device 9: HDMI 0 [HDMI 0]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
<br />
====Testing for the correct card====<br />
Now a list of the detected cards is known, users will need to test for which one is outputing to the tv/monitor<br />
# aplay -D plughw:1,3 /usr/share/sounds/alsa/Front_Right.wav<br />
<br />
where 1 is the card and 3 is the device substitute in the values listed from the previous section. If there is no audio then try substituting a different device (on my card I had to use card 1 device 7)<br />
<br />
====Manually configuring pulseaudio to detect the Nvidia HDMI====<br />
Having identified which HDMI device is working, PulseAudio can be fored to use it via an edit to {{bc|/etc/pulse/default.pa}}:<br />
# load-module module-alsa-sink device=hw:1,7<br />
<br />
where the 1 is the card and the 7 is the deivce found to work in the previous section<br />
<br />
restart pulse audio<br />
# killall pulseaudio<br />
<br />
open the sound settings manager, make sure that under the hardware tab the graphics cards HDMI audio is set to "Digital Stereo (HDMI) Output" ( My graphics card audio is called "GF100 High Definition Audio Controller"<br />
<br />
Then open the output tab there should now be two HDMI outputs for the graphics card test which one works by selecting one of them and then using a program to play audio i.e use vlc to play a movie if it doesn't work the select the other.<br />
<br />
===PulseAudio over network===<br />
One of PulseAudio's unique features is its ability to stream audio from clients over TCP to a server running the PulseAudio daemon reliably within a LAN.<br />
<br />
To accomplish this, one needs to enable module-native-protocol-tcp. <br />
<br />
====TCP support (networked sound)====<br />
To enable the TCP module, add this to (or uncomment, if already there) {{ic|/etc/pulse/default.pa}} on both the client and server:<br />
load-module module-native-protocol-tcp<br />
<br />
For this to work, it is a requirement that both the client and server share the same cookie. Ensure that the clients and server share the same cookie file found under {{ic|~/.config/pulse/cookie}}. It does not matter whose cookie file you use (the server or a client's), just that the server and client(s) share the same one.<br />
<br />
Note: If experiencing trouble connecting, use (on server)<br />
pacmd list-modules<br />
<br />
====TCP support with anonymous clients====<br />
<br />
If it is undesirable to copy the cookie file from clients, anonymous clients can access the server by giving these parameters to module-native-protocol-tcp on the server (again in {{ic|/etc/pulse/default.pa}}):<br />
<br />
load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1;192.168.0.0/24 auth-anonymous=1<br />
<br />
Change the LAN IP subnet to match that of the those clients you wish to have access to the server.<br />
<br />
====Zeroconf (Avahi) publishing====<br />
For the remote Pulseaudio server to appear in the PulseAudio Device Chooser ({{ic|pasystray}}), load the appropriate zeroconf modules, and enable the [[Avahi]] [[daemon]].<br />
<br />
On both machines run:<br />
$ systemctl start avahi-daemon.service<br />
$ systemctl enable avahi-daemon.service<br />
On the server, add {{ic|load-module module-zeroconf-publish}} to /etc/pulse/default.pa, on the client, add {{ic|load-module module-zeroconf-discover}} to {{ic|/etc/pulse/default.pa}}. Now redirect any stream or complete audio output to the remote pulseaudio server by selecting the appropriate sink.<br />
<br />
If you have issues with the remote syncs appearing on the client, try restarting the avahi daemon on the server to rebroadcast the available interfaces.<br />
<br />
====Switching the PulseAudio server used by local X clients====<br />
To switch between servers on the client from within X, the {{ic|pax11publish}} command can be used. For example, to switch from the default server to the server at hostname foo:<br />
$ pax11publish -e -S foo<br />
<br />
Or to switch back to the default:<br />
$ pax11publish -e -r<br />
<br />
Note that for the switch to become apparent, the programs using Pulse must be restarted.<br />
<br />
====When everything else seems to fail====<br />
The following is a quickfix and NOT a permanent solution<br />
<br />
On the Server: <br />
$ paprefs <br />
Go to Network Access -> Enable access to local sound devices (Also check both 'Allow discover' and 'Don't require authentication').<br />
<br />
On the Client: <br />
$ export PULSE_SERVER=server.ip && mplayer test.mp3<br />
<br />
===PulseAudio through JACK the new new way===<br />
This configuration only works with jackdbus (JACK2 compiled with D-Bus support). Add to {{ic|/etc/pulse/default.pa}}:<br />
load-module module-jackdbus-detect<br />
As described on the [http://trac.jackaudio.org/wiki/JackDbusPackaging Jack-DBUS Packaging] page:<br />
<br />
''Server auto-launching is implemented as D-Bus call that auto-activates JACK D-Bus service, in case it is not already started, and starts the JACK server. Correct interaction with PulseAudio is done using a D-Bus based audio card "acquire/release" mechanism. When JACK server starts, it asks this D-Bus service to acquire the audio card and PulseAudio will unconditionally release it. When JACK server stops, it releases the audio card that can be grabbed again by PulseAudio.''<br />
<br />
{{ic|module-jackdbus-detect.so}} dynamically loads and unloads module-jack-sink and module-jack-source when jackdbus is started and stopped.<br />
<br />
If PulseAudio sound does not work, check with {{ic|pavucontrol}} to see if the relevant programs appear in the playback tab. If not, add the following to {{ic|~/.asound.conf}} or {{ic|/etc/asound.conf}} to redirect ALSA to PulseAudio:<br />
<br />
pcm.pulse {<br />
type pulse<br />
}<br />
<br />
ctl.pulse {<br />
type pulse<br />
}<br />
<br />
pcm.!default {<br />
type pulse<br />
}<br />
ctl.!default {<br />
type pulse<br />
}<br />
<br />
If it still doesn't work, check with {{ic|pavucontrol}} in the playback tab and make sure the relevant programs are outputting to PulseAudio JACK Sink instead of your audio card (which JACK has control of, so it won't work).<br />
<br />
===PulseAudio through JACK the new way===<br />
The basic idea is that killing PulseAudio is bad idea, it may crash any apps using PulseAudio, and disrupt any audio playing<br />
<br />
the flow of how this setup works:<br />
<br />
# PulseAudio releases the sound card<br />
# JACK grabs sound card and starts up<br />
# script redirects PulseAudio to JACK<br />
# manually send PulseAudio apps to JACK output (pavucontrol may come in helpful for this)<br />
# use JACK programs etc<br />
# via script, stop redirecting PulseAudio to JACK<br />
# stop JACK and release soundcard<br />
# PulseAudio grabs sound card and reroutes audio to it directly<br />
<br />
with QJackCTL setup these scripts:<br />
<br />
{{ic|pulse-jack-pre-start.sh}} set it up as the execute script on startup script<br />
#!/bin/bash<br />
pacmd suspend true<br />
<br />
{{ic|pulse-jack-post-start.sh}} set this one up as execute script after startup<br />
#!/bin/bash<br />
pactl load-module module-jack-sink channels=2<br />
pactl load-module module-jack-source channels=2<br />
pacmd set-default-sink jack_out<br />
pacmd set-default-source jack_in<br />
<br />
{{ic|pulse-jack-pre-stop.sh}} "execute script on shutdown"<br />
#!/bin/bash<br />
SINKID=$(pactl list | grep -B 1 "Name: module-jack-sink" | grep Module | sed 's/[^0-9]//g')<br />
SOURCEID=$(pactl list | grep -B 1 "Name: module-jack-source" | grep Module | sed 's/[^0-9]//g')<br />
pactl unload-module $SINKID<br />
pactl unload-module $SOURCEID<br />
sleep 5<br />
<br />
{{ic|pulse-jack-post-stop.sh}} "execute script after shutdown"<br />
#!/bin/bash<br />
pacmd suspend false<br />
<br />
===Pulseaudio through JACK the old way===<br />
The JACK-Audio-Connection-Kit is popular for audio work, and is widely supported by Linux audio applications. It fills a similar niche as Pulseaudio, but with more of an emphasis on professional audio work. In particular, audio applications such as Ardour and Audacity (recently) work well with Jack.<br />
<br />
Pulseaudio provides module-jack-source and module-jack-sink which allow Pulseaudio to be run as a sound server above the JACK daemon. This allows the usage of per-volume adjustments and the like for the apps which need it, play-back apps for movies and audio, while allowing low-latency and inter-app connectivity for sound-processing apps which connect to JACK. However, this will prevent Pulseaudio from directly writing to the sound card buffers, which will increase overall CPU usage.<br />
<br />
To just try PA on top of jack, have PA load the necessary modules on start:<br />
pulseaudio -L module-jack-sink -L module-jack-source<br />
<br />
To use pulseaudio with JACK, JACK must be started up before Pulseaudio, using whichever method one prefers. sPulseaudio then needs to be started loading the 2 relevant modules. Edit {{ic|/etc/pulse/default.pa}}, and change the following region:<br />
### Load audio drivers statically (it is probably better to not load<br />
### these drivers manually, but instead use module-hal-detect --<br />
### see below -- for doing this automatically)<br />
#load-module module-alsa-sink<br />
#load-module module-alsa-source device=hw:1,0<br />
#load-module module-oss device="/dev/dsp" sink_name=output source_name=input<br />
#load-module module-oss-mmap device="/dev/dsp" sink_name=output source_name=input<br />
#load-module module-null-sink<br />
#load-module module-pipe-sink<br />
<br />
### Automatically load driver modules depending on the hardware available<br />
.ifexists module-udev-detect.so<br />
load-module module-udev-detect<br />
.else<br />
### Alternatively use the static hardware detection module (for systems that<br />
### lack udev support)<br />
load-module module-detect<br />
.endif<br />
<br />
to the following:<br />
### Load audio drivers statically (it is probably better to not load<br />
### these drivers manually, but instead use module-hal-detect --<br />
### see below -- for doing this automatically)<br />
#load-module module-alsa-sink<br />
#load-module module-alsa-source device=hw:1,0<br />
#load-module module-oss device="/dev/dsp" sink_name=output source_name=input<br />
#load-module module-oss-mmap device="/dev/dsp" sink_name=output source_name=input<br />
#load-module module-null-sink<br />
#load-module module-pipe-sink<br />
load-module module-jack-source<br />
load-module module-jack-sink<br />
<br />
### Automatically load driver modules depending on the hardware available<br />
#.ifexists module-udev-detect.so<br />
#load-module module-udev-detect<br />
#.else<br />
### Alternatively use the static hardware detection module (for systems that<br />
### lack udev support)<br />
#load-module module-detect<br />
#.endif<br />
<br />
Basically, this prevents module-udev-detect from loading. module-udev-detect will always try to grab the sound-card (JACK has already done that, so this will cause an error). Also, the jack source and sink must be explicitly loaded.<br />
<br />
====QjackCtl with Startup/Shutdown Scripts====<br />
Using the settings listed above, use QjackCtl to execute a script upon startup and shutdown to load/unload PulseAudio. Part of the reason users may wish to do this is that the above changes disable PulseAudio's automatic hardware detection modules. This particular setup is for using PulseAudio in an exclusive fashion with JACK, though the scripts could be modified to unload and load an alternate non-JACK setup, but killing and starting PulseAudio while programs might be using it would become problematic.<br />
<br />
The following example could be used and modified as necessary as a startup script that daemonizes PulseAudio and loads the ''padevchooser'' program (optional, needs to be built from AUR) called {{ic|jack_startup}}:<br />
#!/bin/bash<br />
#Load PulseAudio and PulseAudio Device Chooser<br />
<br />
pulseaudio -D<br />
padevchooser&<br />
<br />
as well as a shutdown script to kill PulseAudio and the Pulse Audio Device Chooser, as another example called {{ic|jack_shutdown}} also in the home directory:<br />
#!/bin/bash<br />
#Kill PulseAudio and PulseAudio Device Chooser<br />
<br />
pulseaudio --kill<br />
killall padevchooser<br />
<br />
Both scripts need to be made executable:<br />
chmod +x jack_startup jack_shutdown<br />
<br />
then with QjackCtl loaded, click on the ''Setup'' button and then the ''Options'' tab and tick both "Execute Script after Startup:" And "Execute Script on Shutdown:" and put either use the ... button or type the path to the scripts (assuming the scripts are in the home directory) {{ic|~/jack_startup}} and {{ic|~/jack_shutdown}} making sure to save the changes.<br />
<br />
===Pulseaudio through OSS===<br />
Add the following to {{ic|/etc/pulse/default.pa}}:<br />
load-module module-oss<br />
<br />
Then start Pulseaudio as usual making sure that sinks and sources are defined forOSS devices.<br />
<br />
===Pulseaudio from within a chroot (ex. 32-bit chroot in 64-bit install)===<br />
Since a chroot sets up an alternative root for the running/jailing of applications, pulseaudio must be installed within the chroot itself ({{ic|pacman -S pulseaudio}} within the chroot environment).<br />
<br />
Pulseaudio, if not set up to connect to any specific server (this can be done in {{ic|/etc/pulse/client.conf}}, through the PULSE_SERVER environment variable, or through publishing to the local X11 properties using module-x11-publish), will attempt to connect to the local pulse server, failing which it will spawn a new pulse server. Each pulse server has a unique ID based on the machine-id value in {{ic|/var/lib/dbus}}. To allow for chrooted apps to access the pulse server, the following directories must be mounted within the chroot:-<br />
/var/run<br />
/var/lib/dbus<br />
/tmp<br />
~/.pulse<br />
<br />
{{ic|/dev/shm}} should also be mounted for efficiency and good performance. Note that mounting /home would normally also allow sharing of the {{ic|~/.pulse}} folder.<br />
<br />
For specific direction on accomplishing the appropriate mounts, please refer to the wiki on installing a bundled 32-bit system, especially the [https://wiki.archlinux.org/index.php?title=Arch64_Install_bundled_32bit_system#Additional_mount_option_to_allow_32-bit_apps_to_access_the_64-bit_Pulseaudio_server additional section] specific to Pulseaudio.<br />
<br />
===System-wide Equalizer===<br />
Pulseaudio can be configured to sound much better through the use of a system-wide equalizer. There are a few tools to do this. Extra information on the cons of each [http://ubuntuforums.org/showthread.php?t=1378087 here] . Individual apps can be excluded via {{Ic|pavucontrol}} .<br />
<br />
====pulseaudio-equalizer====<br />
A simple, user-friendly gtk tool in the AUR: [https://aur.archlinux.org/packages.php?ID=48316 here]. <br />
<br />
{{Note| If users remove pulseaudio-equalizer, be sure should comment out the respective generated section in {{Ic| $HOME/.pulse/default.pa}} or risk strange issues.}}<br />
{{Note|If users have trouble with the volume resetting to the maximum level or making harsh noise upon switching sound sources, do [https://wiki.archlinux.org/index.php/Pulseaudio#Volume_gets_louder_every_time_a_new_application_is_started this] and then find the "Equalized audio configuration" section in {{Ic| $HOME/.pulse/default.pa}} and comment out only the "set-sink-volume" line there.}}<br />
<br />
====qpaeq====<br />
A simple qt tool that comes with pulseaudio and includes support for more bands than pulseaudio-equalizer (just resize the window horizontally), but presently lacks easily accessible presets and may need to be set as the default manually. Located at {{Ic|/usr/bin/qpaeq}} and requires {{Ic|python2-pyqt}} to run. <br />
<br />
{{Note| If qpaeq crashes at startup, be sure that {{Ic|load-module module-equalizer-sink}} is in {{Ic|/etc/pulse/default.pa}} or {{Ic|$HOME/.pulse/default.pa}} }}<br />
<br />
{{Note| If the equalizer has no effect (e.g., setting the ''qpaeq'' preamp bar to zero doesn't mute all sound), check that a link to applications' audio sinks to the equalizer. Do this by adding the line {{Ic|set-default-sink equalized}} to {{Ic|/etc/pulse/default.pa}} or {{Ic|$HOME/.pulse/default.pa}}.}}<br />
<br />
===Disabling Auto Spawning of PulseAudio Server===<br />
Some users may prefer to manually start the pulseaudio server before running certain programs and then stop the pulseaudio server when they are finished. A simple way to accomplish this is to edit {{ic|/etc/pulse/client.conf}} and change autospawn = yes to autospawn = no, and set daemon-binary to /bin/true. Make sure the two lines are uncommented as well.<br />
{{hc|/etc/pulse/client.conf|<nowiki><br />
autospawn = no<br />
daemon-binary = /bin/true <br />
</nowiki>}}<br />
Now you can manually start the pulseaudio server with<br />
$ pulseaudio --start<br />
and stop it with<br />
$ pulseaudio --kill<br />
You may also have to move or delete a .desktop file in /etc/xdg/autostart if it exists.</div>Ownaginatioushttps://wiki.archlinux.org/index.php?title=APC_UPS&diff=264984APC UPS2013-07-03T01:38:23Z<p>Ownaginatious: /* Make apcupsd kill UPS power once the hibernate is done */</p>
<hr />
<div>[[Category:Power management]]<br />
This document describes how to install the APC UPS daemon. The main advantage of using an APC UPS (for me) is that it can communicate with your Linux box through either a RS-232 or USB serial connection. In the event of a prolonged power outage, should the APC UPS lose most of its battery capacity, it can tell the Linux box to perform a safe shutdown.<br />
<br />
== Install the package ==<br />
<br />
[[pacman|Install]] {{Pkg|apcupsd}} from the [[official repositories]].<br />
<br />
== Configure APC UPS ==<br />
<br />
The main configuration file for the APC UPS daemon can be found here: {{ic|/etc/apcupsd/apcupsd.conf}}<br />
<br />
In the following example, the lines of text are changed to support a USB style cable:<br />
<br />
Before:<br />
UPSCABLE smart<br />
<br />
UPSTYPE smartups<br />
<br />
DEVICE /dev/ttyS0<br />
<br />
After:<br />
UPSCABLE usb<br />
<br />
UPSTYPE usb<br />
<br />
DEVICE /dev/usb/hiddev&#91;&#91;0-15&#93;&#93;<br />
<br />
== Test ==<br />
<br />
First, enable and start the [[systemd]] service.<br />
<br />
{{bc|<br />
systemctl enable apcupsd.service<br />
systemctl start apcupsd.service<br />
}}<br />
<br />
Next, wait about a minute and confirm the daemon is running and properly monitoring the battery:<br />
{{bc|<br />
# apcaccess status<br />
APC : 001,033,0819<br />
DATE : Sat Mar 05 SOMETIME 2005<br />
HOSTNAME : somehostname<br />
RELEASE : 3.10.16<br />
VERSION : 3.10.16 (04 November 2004) unknown<br />
UPSNAME : somehostname<br />
CABLE : USB Cable<br />
MODEL : Back-UPS ES 725<br />
UPSMODE : Stand Alone<br />
STARTTIME: Sat Mar SOMETIME 2005<br />
STATUS : ONLINE<br />
LINEV : 119.0 Volts<br />
LOADPCT : 23.0 Percent Load Capacity<br />
BCHARGE : 100.0 Percent<br />
TIMELEFT : 30.5 Minutes<br />
MBATTCHG : 5 Percent<br />
MINTIMEL : 3 Minutes<br />
MAXTIME : 0 Seconds<br />
LOTRANS : 088.0 Volts<br />
HITRANS : 138.0 Volts<br />
ALARMDEL : Always<br />
BATTV : 13.5 Volts<br />
NUMXFERS : 0<br />
TONBATT : 0 seconds<br />
CUMONBATT: 0 seconds<br />
XOFFBATT : N/A<br />
STATFLAG : 0x02000008 Status Flag<br />
MANDATE : 2002-12-02<br />
SERIALNO : QB0249360043<br />
BATTDATE : 2000-00-00<br />
NOMBATTV : 12.0<br />
FIRMWARE : 02.n2.D USB FW:n2<br />
APCMODEL : Back-UPS ES 725<br />
END APC : Sat SOMETIME 2005<br />
}}<br />
<br />
To fully test your setup:<br />
# Change {{ic|TIMEOUT}} form {{ic|0}} to {{ic|1}} in the {{ic|/etc/apcupsd/apcupsd.conf}} file.<br />
# Remove wall power from the UPS.<br />
# Observe that your Linux box powers down, in short order.<br />
# Plug the UPS back into the wall.<br />
# Power on your Linux box.<br />
# Change {{ic|TIMEOUT}} from {{ic|1}} back to {{ic|0}} in the {{ic|/etc/apcupsd/apcupsd.conf}} file.<br />
<br />
When everything is ok, all that's left to do is enable the {{ic|apcupsd}} service.<br />
<br />
== Hibernating instead of shutting down ==<br />
<br />
You can make your system hibernate instead of shutting down. First, make sure the system hibernates cleanly. To set up hibernation, look [[Pm-utils|here]].<br />
<br />
=== Create the hibernate script ===<br />
<br />
Create this in {{ic|/usr/local/bin/hibernate}} as root:<br />
<br />
{{bc|<br />
#!/bin/bash<br />
# Hibernate the system - designed to be called via symlink from /etc/apcupsd<br />
# directory in case of apcupsd initiating a shutdown/reboot. Can also be used<br />
# interactively or from any script to cause a hibernate.<br />
<br />
# Do the hibernate<br />
/usr/bin/systemctl hibernate<br />
<br />
# At this point system should be hibernated - when it comes back, we resume this script here<br />
<br />
# On resume, tell controlling script (/etc/apcupsd/apccontrol) NOT to continue with default action (i.e. shutdown).<br />
exit 99<br />
}}<br />
<br />
Make it executable by running:<br />
# chmod +x /usr/local/bin/hibernate<br />
<br />
=== Link the hibernate script for apcupsd to use it ===<br />
<br />
Create a symbolic link from the {{ic|/etc/apcupsd}} directory to the script. The result is the apcupd's apccontrol script, in this directory, will call the hibernate script instead of doing the default shutdown action for these operations.<br />
<br />
# ln -s /usr/local/bin/hibernate /etc/apcupsd/doshutdown<br />
<br />
If you are running apcupsd as a client to another machine running apcupsd as a server and want your machine to hibernate if the sever is shutdown or if communication to the server is lost then you may also wish to add:<br />
<br />
# ln -s /usr/local/bin/hibernate /etc/apcupsd/remotedown<br />
<br />
=== Make apcupsd kill UPS power once the hibernate is done ===<br />
<br />
Once the PC has hibernated successfully, it is common practice to switch off the UPS in order to conserve battery charge and prevent full battery drain. This can be achieved through a power suspend event in systemd.<br />
<br />
Create the following file:<br />
{{bc|<br />
/usr/lib/systemd/systemd-sleep/ups-kill<br />
}}<br />
<br />
/usr/lib/systemd/systemd-sleep/ups-kill and put the following contents in it:<br />
<br />
{{bc|<br />
#!/bin/bash<br />
<br />
case $2 in<br />
<br />
# In the event the computer is hibernating.<br />
hibernate)<br />
case $1 in<br />
<br />
# Going into a hibernate state.<br />
pre)<br />
<br />
# See if this is a powerfail situation.<br />
if [ -f /etc/apcupsd/powerfail ]; then<br />
echo<br />
echo "ACPUPSD will now power off the UPS"<br />
echo<br />
/etc/apcupsd/apccontrol killpower<br />
echo<br />
echo "Please ensure that the UPS has powered off before rebooting"<br />
echo "Otherwise, the UPS may cut the power during the reboot!!!"<br />
echo<br />
fi<br />
;;<br />
<br />
# Coming out of a hibernate state.<br />
post)<br />
<br />
# If there are remnants from a powerfail situation, remove them.<br />
if [ -f /etc/apcupsd/powerfail ]; then<br />
rm /etc/apcupsd/powerfail<br />
fi<br />
<br />
# Restart the daemon; otherwise it may be unresponsive in a<br />
# second powerfailure situation.<br />
systemctl restart apcupsd<br />
;;<br />
esac<br />
;;<br />
esac<br />
}}<br />
<br />
Make the script executable by doing:<br />
<br />
# chmod +x /usr/lib/systemd/systemd-sleep/ups-kill<br />
<br />
Now you can [[#Test|test your setup]].<br />
<br />
== The desktop environment will also sense the UPS if connected by USB cable ==<br />
<br />
For example, the default KDE setting is to put the computer in sleep if it has been on UPS battery for more than 10 minutes and the mouse has not moved. On many computers this causes a crash. This can be changed from KDE System Settings->Power Management->On battery.<br />
<br />
== See also ==<br />
<br />
* [http://www.apcupsd.org/ Apcupsd home page]<br />
* [http://ubuntuforums.org/showthread.php?p=4302102 Forcing hibernate]<br />
* [http://www.apcupsd.com/manual/manual.html#the-shutdown-sequence-and-its-discontents apcupsd manual]</div>Ownaginatioushttps://wiki.archlinux.org/index.php?title=APC_UPS&diff=264983APC UPS2013-07-03T01:37:57Z<p>Ownaginatious: /* Make apcupsd kill UPS power once the hibernate is done */</p>
<hr />
<div>[[Category:Power management]]<br />
This document describes how to install the APC UPS daemon. The main advantage of using an APC UPS (for me) is that it can communicate with your Linux box through either a RS-232 or USB serial connection. In the event of a prolonged power outage, should the APC UPS lose most of its battery capacity, it can tell the Linux box to perform a safe shutdown.<br />
<br />
== Install the package ==<br />
<br />
[[pacman|Install]] {{Pkg|apcupsd}} from the [[official repositories]].<br />
<br />
== Configure APC UPS ==<br />
<br />
The main configuration file for the APC UPS daemon can be found here: {{ic|/etc/apcupsd/apcupsd.conf}}<br />
<br />
In the following example, the lines of text are changed to support a USB style cable:<br />
<br />
Before:<br />
UPSCABLE smart<br />
<br />
UPSTYPE smartups<br />
<br />
DEVICE /dev/ttyS0<br />
<br />
After:<br />
UPSCABLE usb<br />
<br />
UPSTYPE usb<br />
<br />
DEVICE /dev/usb/hiddev&#91;&#91;0-15&#93;&#93;<br />
<br />
== Test ==<br />
<br />
First, enable and start the [[systemd]] service.<br />
<br />
{{bc|<br />
systemctl enable apcupsd.service<br />
systemctl start apcupsd.service<br />
}}<br />
<br />
Next, wait about a minute and confirm the daemon is running and properly monitoring the battery:<br />
{{bc|<br />
# apcaccess status<br />
APC : 001,033,0819<br />
DATE : Sat Mar 05 SOMETIME 2005<br />
HOSTNAME : somehostname<br />
RELEASE : 3.10.16<br />
VERSION : 3.10.16 (04 November 2004) unknown<br />
UPSNAME : somehostname<br />
CABLE : USB Cable<br />
MODEL : Back-UPS ES 725<br />
UPSMODE : Stand Alone<br />
STARTTIME: Sat Mar SOMETIME 2005<br />
STATUS : ONLINE<br />
LINEV : 119.0 Volts<br />
LOADPCT : 23.0 Percent Load Capacity<br />
BCHARGE : 100.0 Percent<br />
TIMELEFT : 30.5 Minutes<br />
MBATTCHG : 5 Percent<br />
MINTIMEL : 3 Minutes<br />
MAXTIME : 0 Seconds<br />
LOTRANS : 088.0 Volts<br />
HITRANS : 138.0 Volts<br />
ALARMDEL : Always<br />
BATTV : 13.5 Volts<br />
NUMXFERS : 0<br />
TONBATT : 0 seconds<br />
CUMONBATT: 0 seconds<br />
XOFFBATT : N/A<br />
STATFLAG : 0x02000008 Status Flag<br />
MANDATE : 2002-12-02<br />
SERIALNO : QB0249360043<br />
BATTDATE : 2000-00-00<br />
NOMBATTV : 12.0<br />
FIRMWARE : 02.n2.D USB FW:n2<br />
APCMODEL : Back-UPS ES 725<br />
END APC : Sat SOMETIME 2005<br />
}}<br />
<br />
To fully test your setup:<br />
# Change {{ic|TIMEOUT}} form {{ic|0}} to {{ic|1}} in the {{ic|/etc/apcupsd/apcupsd.conf}} file.<br />
# Remove wall power from the UPS.<br />
# Observe that your Linux box powers down, in short order.<br />
# Plug the UPS back into the wall.<br />
# Power on your Linux box.<br />
# Change {{ic|TIMEOUT}} from {{ic|1}} back to {{ic|0}} in the {{ic|/etc/apcupsd/apcupsd.conf}} file.<br />
<br />
When everything is ok, all that's left to do is enable the {{ic|apcupsd}} service.<br />
<br />
== Hibernating instead of shutting down ==<br />
<br />
You can make your system hibernate instead of shutting down. First, make sure the system hibernates cleanly. To set up hibernation, look [[Pm-utils|here]].<br />
<br />
=== Create the hibernate script ===<br />
<br />
Create this in {{ic|/usr/local/bin/hibernate}} as root:<br />
<br />
{{bc|<br />
#!/bin/bash<br />
# Hibernate the system - designed to be called via symlink from /etc/apcupsd<br />
# directory in case of apcupsd initiating a shutdown/reboot. Can also be used<br />
# interactively or from any script to cause a hibernate.<br />
<br />
# Do the hibernate<br />
/usr/bin/systemctl hibernate<br />
<br />
# At this point system should be hibernated - when it comes back, we resume this script here<br />
<br />
# On resume, tell controlling script (/etc/apcupsd/apccontrol) NOT to continue with default action (i.e. shutdown).<br />
exit 99<br />
}}<br />
<br />
Make it executable by running:<br />
# chmod +x /usr/local/bin/hibernate<br />
<br />
=== Link the hibernate script for apcupsd to use it ===<br />
<br />
Create a symbolic link from the {{ic|/etc/apcupsd}} directory to the script. The result is the apcupd's apccontrol script, in this directory, will call the hibernate script instead of doing the default shutdown action for these operations.<br />
<br />
# ln -s /usr/local/bin/hibernate /etc/apcupsd/doshutdown<br />
<br />
If you are running apcupsd as a client to another machine running apcupsd as a server and want your machine to hibernate if the sever is shutdown or if communication to the server is lost then you may also wish to add:<br />
<br />
# ln -s /usr/local/bin/hibernate /etc/apcupsd/remotedown<br />
<br />
=== Make apcupsd kill UPS power once the hibernate is done ===<br />
<br />
Once the PC has hibernated successfully, it is common practice to switch off the UPS in order to conserve battery charge and prevent full battery drain. This can be achieved through a power suspend event in systemd.<br />
<br />
Create the following file:<br />
{{bc|<br />
/usr/lib/systemd/systemd-sleep/ups-kill<br />
}}<br />
<br />
/usr/lib/systemd/systemd-sleep/ups-kill and put the following contents in it:<br />
<br />
{{bc|<br />
#!/bin/bash<br />
<br />
case $2 in<br />
<br />
# In the event the computer is hibernating.<br />
hibernate)<br />
case $1 in<br />
<br />
# Going into a hibernate state.<br />
pre)<br />
<br />
# See if this is a powerfail situation.<br />
if [ -f /etc/apcupsd/powerfail ]; then<br />
echo<br />
echo "ACPUPSD will now power off the UPS"<br />
echo<br />
/etc/apcupsd/apccontrol killpower<br />
echo<br />
echo "Please ensure that the UPS has powered off before rebooting"<br />
echo "Otherwise, the UPS may cut the power during the reboot!!!"<br />
echo<br />
fi<br />
;;<br />
<br />
# Coming out of a hibernate state.<br />
post)<br />
<br />
# If there are remnants from a powerfail situation, remove them.<br />
if [ -f /etc/apcupsd/powerfail ]; then<br />
rm /etc/apcupsd/powerfail<br />
fi<br />
<br />
# Restart the daemon; otherwise it may be unresponsive in a<br />
# second powerfailure situation.<br />
systemctl restart apcupsd<br />
;;<br />
esac<br />
;;<br />
esac<br />
}}<br />
<br />
Make the script executable by doing:<br />
<br />
# chmod +x /usr/lib/systemd/systemd-sleep/ups-kill.sh<br />
<br />
Now you can [[#Test|test your setup]].<br />
<br />
== The desktop environment will also sense the UPS if connected by USB cable ==<br />
<br />
For example, the default KDE setting is to put the computer in sleep if it has been on UPS battery for more than 10 minutes and the mouse has not moved. On many computers this causes a crash. This can be changed from KDE System Settings->Power Management->On battery.<br />
<br />
== See also ==<br />
<br />
* [http://www.apcupsd.org/ Apcupsd home page]<br />
* [http://ubuntuforums.org/showthread.php?p=4302102 Forcing hibernate]<br />
* [http://www.apcupsd.com/manual/manual.html#the-shutdown-sequence-and-its-discontents apcupsd manual]</div>Ownaginatioushttps://wiki.archlinux.org/index.php?title=APC_UPS&diff=264982APC UPS2013-07-03T01:13:39Z<p>Ownaginatious: /* Create the hibernate script */</p>
<hr />
<div>[[Category:Power management]]<br />
This document describes how to install the APC UPS daemon. The main advantage of using an APC UPS (for me) is that it can communicate with your Linux box through either a RS-232 or USB serial connection. In the event of a prolonged power outage, should the APC UPS lose most of its battery capacity, it can tell the Linux box to perform a safe shutdown.<br />
<br />
== Install the package ==<br />
<br />
[[pacman|Install]] {{Pkg|apcupsd}} from the [[official repositories]].<br />
<br />
== Configure APC UPS ==<br />
<br />
The main configuration file for the APC UPS daemon can be found here: {{ic|/etc/apcupsd/apcupsd.conf}}<br />
<br />
In the following example, the lines of text are changed to support a USB style cable:<br />
<br />
Before:<br />
UPSCABLE smart<br />
<br />
UPSTYPE smartups<br />
<br />
DEVICE /dev/ttyS0<br />
<br />
After:<br />
UPSCABLE usb<br />
<br />
UPSTYPE usb<br />
<br />
DEVICE /dev/usb/hiddev&#91;&#91;0-15&#93;&#93;<br />
<br />
== Test ==<br />
<br />
First, enable and start the [[systemd]] service.<br />
<br />
{{bc|<br />
systemctl enable apcupsd.service<br />
systemctl start apcupsd.service<br />
}}<br />
<br />
Next, wait about a minute and confirm the daemon is running and properly monitoring the battery:<br />
{{bc|<br />
# apcaccess status<br />
APC : 001,033,0819<br />
DATE : Sat Mar 05 SOMETIME 2005<br />
HOSTNAME : somehostname<br />
RELEASE : 3.10.16<br />
VERSION : 3.10.16 (04 November 2004) unknown<br />
UPSNAME : somehostname<br />
CABLE : USB Cable<br />
MODEL : Back-UPS ES 725<br />
UPSMODE : Stand Alone<br />
STARTTIME: Sat Mar SOMETIME 2005<br />
STATUS : ONLINE<br />
LINEV : 119.0 Volts<br />
LOADPCT : 23.0 Percent Load Capacity<br />
BCHARGE : 100.0 Percent<br />
TIMELEFT : 30.5 Minutes<br />
MBATTCHG : 5 Percent<br />
MINTIMEL : 3 Minutes<br />
MAXTIME : 0 Seconds<br />
LOTRANS : 088.0 Volts<br />
HITRANS : 138.0 Volts<br />
ALARMDEL : Always<br />
BATTV : 13.5 Volts<br />
NUMXFERS : 0<br />
TONBATT : 0 seconds<br />
CUMONBATT: 0 seconds<br />
XOFFBATT : N/A<br />
STATFLAG : 0x02000008 Status Flag<br />
MANDATE : 2002-12-02<br />
SERIALNO : QB0249360043<br />
BATTDATE : 2000-00-00<br />
NOMBATTV : 12.0<br />
FIRMWARE : 02.n2.D USB FW:n2<br />
APCMODEL : Back-UPS ES 725<br />
END APC : Sat SOMETIME 2005<br />
}}<br />
<br />
To fully test your setup:<br />
# Change {{ic|TIMEOUT}} form {{ic|0}} to {{ic|1}} in the {{ic|/etc/apcupsd/apcupsd.conf}} file.<br />
# Remove wall power from the UPS.<br />
# Observe that your Linux box powers down, in short order.<br />
# Plug the UPS back into the wall.<br />
# Power on your Linux box.<br />
# Change {{ic|TIMEOUT}} from {{ic|1}} back to {{ic|0}} in the {{ic|/etc/apcupsd/apcupsd.conf}} file.<br />
<br />
When everything is ok, all that's left to do is enable the {{ic|apcupsd}} service.<br />
<br />
== Hibernating instead of shutting down ==<br />
<br />
You can make your system hibernate instead of shutting down. First, make sure the system hibernates cleanly. To set up hibernation, look [[Pm-utils|here]].<br />
<br />
=== Create the hibernate script ===<br />
<br />
Create this in {{ic|/usr/local/bin/hibernate}} as root:<br />
<br />
{{bc|<br />
#!/bin/bash<br />
# Hibernate the system - designed to be called via symlink from /etc/apcupsd<br />
# directory in case of apcupsd initiating a shutdown/reboot. Can also be used<br />
# interactively or from any script to cause a hibernate.<br />
<br />
# Do the hibernate<br />
/usr/bin/systemctl hibernate<br />
<br />
# At this point system should be hibernated - when it comes back, we resume this script here<br />
<br />
# On resume, tell controlling script (/etc/apcupsd/apccontrol) NOT to continue with default action (i.e. shutdown).<br />
exit 99<br />
}}<br />
<br />
Make it executable by running:<br />
# chmod +x /usr/local/bin/hibernate<br />
<br />
=== Link the hibernate script for apcupsd to use it ===<br />
<br />
Create a symbolic link from the {{ic|/etc/apcupsd}} directory to the script. The result is the apcupd's apccontrol script, in this directory, will call the hibernate script instead of doing the default shutdown action for these operations.<br />
<br />
# ln -s /usr/local/bin/hibernate /etc/apcupsd/doshutdown<br />
<br />
If you are running apcupsd as a client to another machine running apcupsd as a server and want your machine to hibernate if the sever is shutdown or if communication to the server is lost then you may also wish to add:<br />
<br />
# ln -s /usr/local/bin/hibernate /etc/apcupsd/remotedown<br />
<br />
=== Make apcupsd kill UPS power once the hibernate is done ===<br />
<br />
Once the PC has hibernated successfully, it's better for the UPS to be switched off in order to conserver battery charge, and prevent full battery drain. This can be achieved very easily! Create a file /etc/pm/sleep.d/99apc and put the following contents in it<br />
<br />
{{bc|<br />
#!/bin/bash<br />
case $1 in<br />
hibernate)<br />
# See if this is a powerfail situation. # ***apcupsd***<br />
if [ -f /etc/apcupsd/powerfail ]; then # ***apcupsd***<br />
echo # ***apcupsd***<br />
echo "APCUPSD will now power off the UPS" # ***apcupsd***<br />
echo # ***apcupsd***<br />
/etc/apcupsd/apccontrol killpower # ***apcupsd***<br />
echo # ***apcupsd***<br />
echo "Please ensure that the UPS has powered off before rebooting" # ***apcupsd***<br />
echo "Otherwise, the UPS may cut the power during the reboot!!!" # ***apcupsd***<br />
echo # ***apcupsd***<br />
fi # ***apcupsd***<br />
;;<br />
esac<br />
}}<br />
<br />
Make the script executable by doing:<br />
<br />
# chmod +x /etc/pm/sleep.d/99apc<br />
<br />
Now you can [[#Test|test your setup]].<br />
<br />
== The desktop environment will also sense the UPS if connected by USB cable ==<br />
<br />
For example, the default KDE setting is to put the computer in sleep if it has been on UPS battery for more than 10 minutes and the mouse has not moved. On many computers this causes a crash. This can be changed from KDE System Settings->Power Management->On battery.<br />
<br />
== See also ==<br />
<br />
* [http://www.apcupsd.org/ Apcupsd home page]<br />
* [http://ubuntuforums.org/showthread.php?p=4302102 Forcing hibernate]<br />
* [http://www.apcupsd.com/manual/manual.html#the-shutdown-sequence-and-its-discontents apcupsd manual]</div>Ownaginatioushttps://wiki.archlinux.org/index.php?title=APC_UPS&diff=264980APC UPS2013-07-03T00:36:13Z<p>Ownaginatious: /* Test */</p>
<hr />
<div>[[Category:Power management]]<br />
This document describes how to install the APC UPS daemon. The main advantage of using an APC UPS (for me) is that it can communicate with your Linux box through either a RS-232 or USB serial connection. In the event of a prolonged power outage, should the APC UPS lose most of its battery capacity, it can tell the Linux box to perform a safe shutdown.<br />
<br />
== Install the package ==<br />
<br />
[[pacman|Install]] {{Pkg|apcupsd}} from the [[official repositories]].<br />
<br />
== Configure APC UPS ==<br />
<br />
The main configuration file for the APC UPS daemon can be found here: {{ic|/etc/apcupsd/apcupsd.conf}}<br />
<br />
In the following example, the lines of text are changed to support a USB style cable:<br />
<br />
Before:<br />
UPSCABLE smart<br />
<br />
UPSTYPE smartups<br />
<br />
DEVICE /dev/ttyS0<br />
<br />
After:<br />
UPSCABLE usb<br />
<br />
UPSTYPE usb<br />
<br />
DEVICE /dev/usb/hiddev&#91;&#91;0-15&#93;&#93;<br />
<br />
== Test ==<br />
<br />
First, enable and start the [[systemd]] service.<br />
<br />
{{bc|<br />
systemctl enable apcupsd.service<br />
systemctl start apcupsd.service<br />
}}<br />
<br />
Next, wait about a minute and confirm the daemon is running and properly monitoring the battery:<br />
{{bc|<br />
# apcaccess status<br />
APC : 001,033,0819<br />
DATE : Sat Mar 05 SOMETIME 2005<br />
HOSTNAME : somehostname<br />
RELEASE : 3.10.16<br />
VERSION : 3.10.16 (04 November 2004) unknown<br />
UPSNAME : somehostname<br />
CABLE : USB Cable<br />
MODEL : Back-UPS ES 725<br />
UPSMODE : Stand Alone<br />
STARTTIME: Sat Mar SOMETIME 2005<br />
STATUS : ONLINE<br />
LINEV : 119.0 Volts<br />
LOADPCT : 23.0 Percent Load Capacity<br />
BCHARGE : 100.0 Percent<br />
TIMELEFT : 30.5 Minutes<br />
MBATTCHG : 5 Percent<br />
MINTIMEL : 3 Minutes<br />
MAXTIME : 0 Seconds<br />
LOTRANS : 088.0 Volts<br />
HITRANS : 138.0 Volts<br />
ALARMDEL : Always<br />
BATTV : 13.5 Volts<br />
NUMXFERS : 0<br />
TONBATT : 0 seconds<br />
CUMONBATT: 0 seconds<br />
XOFFBATT : N/A<br />
STATFLAG : 0x02000008 Status Flag<br />
MANDATE : 2002-12-02<br />
SERIALNO : QB0249360043<br />
BATTDATE : 2000-00-00<br />
NOMBATTV : 12.0<br />
FIRMWARE : 02.n2.D USB FW:n2<br />
APCMODEL : Back-UPS ES 725<br />
END APC : Sat SOMETIME 2005<br />
}}<br />
<br />
To fully test your setup:<br />
# Change {{ic|TIMEOUT}} form {{ic|0}} to {{ic|1}} in the {{ic|/etc/apcupsd/apcupsd.conf}} file.<br />
# Remove wall power from the UPS.<br />
# Observe that your Linux box powers down, in short order.<br />
# Plug the UPS back into the wall.<br />
# Power on your Linux box.<br />
# Change {{ic|TIMEOUT}} from {{ic|1}} back to {{ic|0}} in the {{ic|/etc/apcupsd/apcupsd.conf}} file.<br />
<br />
When everything is ok, all that's left to do is enable the {{ic|apcupsd}} service.<br />
<br />
== Hibernating instead of shutting down ==<br />
<br />
You can make your system hibernate instead of shutting down. First, make sure the system hibernates cleanly. To set up hibernation, look [[Pm-utils|here]].<br />
<br />
=== Create the hibernate script ===<br />
<br />
Create this in {{ic|/usr/local/bin/hibernate}} as root:<br />
<br />
{{bc|<br />
#!/bin/bash<br />
# Hibernate the system - designed to be called via symlink from /etc/apcupsd<br />
# directory in case of apcupsd initiating a shutdown/reboot. Can also be used<br />
# interactively or from any script to cause a hibernate.<br />
<br />
# Do the hibernate<br />
/usr/bin/pm-hibernate<br />
# At this point system should be hibernated - when it comes back, we resume this script here<br />
<br />
# On resume, tell controlling script (/etc/apcupsd/apccontrol) NOT to continue with default action (i.e. shutdown).<br />
exit 99<br />
}}<br />
<br />
Make it executable by running:<br />
# chmod +x /usr/local/bin/hibernate<br />
<br />
=== Link the hibernate script for apcupsd to use it ===<br />
<br />
Create a symbolic link from the {{ic|/etc/apcupsd}} directory to the script. The result is the apcupd's apccontrol script, in this directory, will call the hibernate script instead of doing the default shutdown action for these operations.<br />
<br />
# ln -s /usr/local/bin/hibernate /etc/apcupsd/doshutdown<br />
<br />
If you are running apcupsd as a client to another machine running apcupsd as a server and want your machine to hibernate if the sever is shutdown or if communication to the server is lost then you may also wish to add:<br />
<br />
# ln -s /usr/local/bin/hibernate /etc/apcupsd/remotedown<br />
<br />
=== Make apcupsd kill UPS power once the hibernate is done ===<br />
<br />
Once the PC has hibernated successfully, it's better for the UPS to be switched off in order to conserver battery charge, and prevent full battery drain. This can be achieved very easily! Create a file /etc/pm/sleep.d/99apc and put the following contents in it<br />
<br />
{{bc|<br />
#!/bin/bash<br />
case $1 in<br />
hibernate)<br />
# See if this is a powerfail situation. # ***apcupsd***<br />
if [ -f /etc/apcupsd/powerfail ]; then # ***apcupsd***<br />
echo # ***apcupsd***<br />
echo "APCUPSD will now power off the UPS" # ***apcupsd***<br />
echo # ***apcupsd***<br />
/etc/apcupsd/apccontrol killpower # ***apcupsd***<br />
echo # ***apcupsd***<br />
echo "Please ensure that the UPS has powered off before rebooting" # ***apcupsd***<br />
echo "Otherwise, the UPS may cut the power during the reboot!!!" # ***apcupsd***<br />
echo # ***apcupsd***<br />
fi # ***apcupsd***<br />
;;<br />
esac<br />
}}<br />
<br />
Make the script executable by doing:<br />
<br />
# chmod +x /etc/pm/sleep.d/99apc<br />
<br />
Now you can [[#Test|test your setup]].<br />
<br />
== The desktop environment will also sense the UPS if connected by USB cable ==<br />
<br />
For example, the default KDE setting is to put the computer in sleep if it has been on UPS battery for more than 10 minutes and the mouse has not moved. On many computers this causes a crash. This can be changed from KDE System Settings->Power Management->On battery.<br />
<br />
== See also ==<br />
<br />
* [http://www.apcupsd.org/ Apcupsd home page]<br />
* [http://ubuntuforums.org/showthread.php?p=4302102 Forcing hibernate]<br />
* [http://www.apcupsd.com/manual/manual.html#the-shutdown-sequence-and-its-discontents apcupsd manual]</div>Ownaginatioushttps://wiki.archlinux.org/index.php?title=APC_UPS&diff=264979APC UPS2013-07-03T00:35:47Z<p>Ownaginatious: /* Test */</p>
<hr />
<div>[[Category:Power management]]<br />
This document describes how to install the APC UPS daemon. The main advantage of using an APC UPS (for me) is that it can communicate with your Linux box through either a RS-232 or USB serial connection. In the event of a prolonged power outage, should the APC UPS lose most of its battery capacity, it can tell the Linux box to perform a safe shutdown.<br />
<br />
== Install the package ==<br />
<br />
[[pacman|Install]] {{Pkg|apcupsd}} from the [[official repositories]].<br />
<br />
== Configure APC UPS ==<br />
<br />
The main configuration file for the APC UPS daemon can be found here: {{ic|/etc/apcupsd/apcupsd.conf}}<br />
<br />
In the following example, the lines of text are changed to support a USB style cable:<br />
<br />
Before:<br />
UPSCABLE smart<br />
<br />
UPSTYPE smartups<br />
<br />
DEVICE /dev/ttyS0<br />
<br />
After:<br />
UPSCABLE usb<br />
<br />
UPSTYPE usb<br />
<br />
DEVICE /dev/usb/hiddev&#91;&#91;0-15&#93;&#93;<br />
<br />
== Test ==<br />
<br />
First, enable and start the [[systemd]] service.<br />
<br />
{{<br />
systemctl enable apcupsd.service<br />
systemctl start apcupsd.service<br />
}}<br />
<br />
Next, wait about a minute and confirm the daemon is running and properly monitoring the battery:<br />
{{bc|<br />
# apcaccess status<br />
APC : 001,033,0819<br />
DATE : Sat Mar 05 SOMETIME 2005<br />
HOSTNAME : somehostname<br />
RELEASE : 3.10.16<br />
VERSION : 3.10.16 (04 November 2004) unknown<br />
UPSNAME : somehostname<br />
CABLE : USB Cable<br />
MODEL : Back-UPS ES 725<br />
UPSMODE : Stand Alone<br />
STARTTIME: Sat Mar SOMETIME 2005<br />
STATUS : ONLINE<br />
LINEV : 119.0 Volts<br />
LOADPCT : 23.0 Percent Load Capacity<br />
BCHARGE : 100.0 Percent<br />
TIMELEFT : 30.5 Minutes<br />
MBATTCHG : 5 Percent<br />
MINTIMEL : 3 Minutes<br />
MAXTIME : 0 Seconds<br />
LOTRANS : 088.0 Volts<br />
HITRANS : 138.0 Volts<br />
ALARMDEL : Always<br />
BATTV : 13.5 Volts<br />
NUMXFERS : 0<br />
TONBATT : 0 seconds<br />
CUMONBATT: 0 seconds<br />
XOFFBATT : N/A<br />
STATFLAG : 0x02000008 Status Flag<br />
MANDATE : 2002-12-02<br />
SERIALNO : QB0249360043<br />
BATTDATE : 2000-00-00<br />
NOMBATTV : 12.0<br />
FIRMWARE : 02.n2.D USB FW:n2<br />
APCMODEL : Back-UPS ES 725<br />
END APC : Sat SOMETIME 2005<br />
}}<br />
<br />
To fully test your setup:<br />
# Change {{ic|TIMEOUT}} form {{ic|0}} to {{ic|1}} in the {{ic|/etc/apcupsd/apcupsd.conf}} file.<br />
# Remove wall power from the UPS.<br />
# Observe that your Linux box powers down, in short order.<br />
# Plug the UPS back into the wall.<br />
# Power on your Linux box.<br />
# Change {{ic|TIMEOUT}} from {{ic|1}} back to {{ic|0}} in the {{ic|/etc/apcupsd/apcupsd.conf}} file.<br />
<br />
When everything is ok, all that's left to do is enable the {{ic|apcupsd}} service.<br />
<br />
== Hibernating instead of shutting down ==<br />
<br />
You can make your system hibernate instead of shutting down. First, make sure the system hibernates cleanly. To set up hibernation, look [[Pm-utils|here]].<br />
<br />
=== Create the hibernate script ===<br />
<br />
Create this in {{ic|/usr/local/bin/hibernate}} as root:<br />
<br />
{{bc|<br />
#!/bin/bash<br />
# Hibernate the system - designed to be called via symlink from /etc/apcupsd<br />
# directory in case of apcupsd initiating a shutdown/reboot. Can also be used<br />
# interactively or from any script to cause a hibernate.<br />
<br />
# Do the hibernate<br />
/usr/bin/pm-hibernate<br />
# At this point system should be hibernated - when it comes back, we resume this script here<br />
<br />
# On resume, tell controlling script (/etc/apcupsd/apccontrol) NOT to continue with default action (i.e. shutdown).<br />
exit 99<br />
}}<br />
<br />
Make it executable by running:<br />
# chmod +x /usr/local/bin/hibernate<br />
<br />
=== Link the hibernate script for apcupsd to use it ===<br />
<br />
Create a symbolic link from the {{ic|/etc/apcupsd}} directory to the script. The result is the apcupd's apccontrol script, in this directory, will call the hibernate script instead of doing the default shutdown action for these operations.<br />
<br />
# ln -s /usr/local/bin/hibernate /etc/apcupsd/doshutdown<br />
<br />
If you are running apcupsd as a client to another machine running apcupsd as a server and want your machine to hibernate if the sever is shutdown or if communication to the server is lost then you may also wish to add:<br />
<br />
# ln -s /usr/local/bin/hibernate /etc/apcupsd/remotedown<br />
<br />
=== Make apcupsd kill UPS power once the hibernate is done ===<br />
<br />
Once the PC has hibernated successfully, it's better for the UPS to be switched off in order to conserver battery charge, and prevent full battery drain. This can be achieved very easily! Create a file /etc/pm/sleep.d/99apc and put the following contents in it<br />
<br />
{{bc|<br />
#!/bin/bash<br />
case $1 in<br />
hibernate)<br />
# See if this is a powerfail situation. # ***apcupsd***<br />
if [ -f /etc/apcupsd/powerfail ]; then # ***apcupsd***<br />
echo # ***apcupsd***<br />
echo "APCUPSD will now power off the UPS" # ***apcupsd***<br />
echo # ***apcupsd***<br />
/etc/apcupsd/apccontrol killpower # ***apcupsd***<br />
echo # ***apcupsd***<br />
echo "Please ensure that the UPS has powered off before rebooting" # ***apcupsd***<br />
echo "Otherwise, the UPS may cut the power during the reboot!!!" # ***apcupsd***<br />
echo # ***apcupsd***<br />
fi # ***apcupsd***<br />
;;<br />
esac<br />
}}<br />
<br />
Make the script executable by doing:<br />
<br />
# chmod +x /etc/pm/sleep.d/99apc<br />
<br />
Now you can [[#Test|test your setup]].<br />
<br />
== The desktop environment will also sense the UPS if connected by USB cable ==<br />
<br />
For example, the default KDE setting is to put the computer in sleep if it has been on UPS battery for more than 10 minutes and the mouse has not moved. On many computers this causes a crash. This can be changed from KDE System Settings->Power Management->On battery.<br />
<br />
== See also ==<br />
<br />
* [http://www.apcupsd.org/ Apcupsd home page]<br />
* [http://ubuntuforums.org/showthread.php?p=4302102 Forcing hibernate]<br />
* [http://www.apcupsd.com/manual/manual.html#the-shutdown-sequence-and-its-discontents apcupsd manual]</div>Ownaginatioushttps://wiki.archlinux.org/index.php?title=Lenovo_ThinkPad_X120e&diff=229391Lenovo ThinkPad X120e2012-10-18T08:02:43Z<p>Ownaginatious: /* Wireless */</p>
<hr />
<div>[[Category:Lenovo]]<br />
{{Article summary start}}<br />
{{Article summary text|Installation instructions for the Lenovo ThinkPad X120e <br />
<br />
Should work for X121e too}}<br />
{{Article summary heading|Related articles}}<br />
{{Article summary wiki|IBM ThinkPad X100e}}<br />
{{Article summary end}}<br />
<br />
==CPU==<br />
<br />
The AMD CPU used on the X120e is microcode-upgradeable. To enable this functionality install the ''amd-ucode'' packages (available on extra) and add ''microcode'' to the MODULE list on /etc/rc.conf.<br />
<br />
==Video Drivers==<br />
{{Merge|ATI|Duplicates information from ATI article}}<br />
{{Accuracy|There is no such thing as "kernel 3.2.6.2"}}<br />
Users have the choice between the open source [[ATI]] video driver or the closed source [[Catalyst]] video driver.<br />
<br />
In order to use the open source driver you must have at least kernel 2.6.38.<br />
<br />
The open source ATI driver has flawless performance (including suspend). [[Gnome 3]] works well with the open source ATI driver. <br />
<br />
The Catalyst drivers do offer better 3D performance but usually have various minor issues (such as suspend support). As of kernel 3.2.6.2, suspend appears to work fine with this computer while using the catalyst drivers.<br />
<br />
==Wireless==<br />
The Thinkpad x120e is available with one of two wireless cards.<br />
*The Realtek BGN Wifi card is currently supported out of the box by the rtl8192ce driver, which was integrated into the Linux kernel as of version 3.2. This card, however, suffers from access point association and connection stability problems, especially in meshed wireless networks due to poor wireless radius detection. Since driver development by Realtek effectively stopped as of January 2012, the general consensus among many owners online has been to swap out this wireless card for a different better supported half-mini PCI card such as the Intel 6230. This however requires a BIOS patch to remove Lenovo's hardware restriction on which wireless cards can be used in the computer. More information in regards to that can be found in [http://forums.mydigitallife.info/threads/20223-Remove-whitelist-check-add-ID-s-to-break-hardware-restrictions-mod-requests/page175 this] thread.<br />
<br />
*The Broadcom ABGN Wifi card is currently supported by the b43 driver. This driver is recommended over the broadcom-wl.<br />
<br />
==Audio==<br />
The kernel modules work, but the HDMI audio is the primary device (not the speaker). You can swap that:<br />
<br />
{{hc|$ vim ~/.asoundrc|<br />
defaults.pcm.card 1<br />
defaults.pcm.device 0<br />
defaults.ctl.card 1<br />
}}<br />
<br />
Note: Alternatively, you can accomplish the same thing by configuring the snd-hda-intel module:<br />
<br />
{{hc|$ grep snd-hda-intel /etc/modprobe.d/snd-hda-intel.conf|2=options snd-hda-intel index=1}}<br />
<br />
By specifying index you should no longer specify the default in {{ic|~/.asoundrc}}.<br />
<br />
==Input==<br />
===TrackPoint Scrolling (wheel emulation)===<br />
To enable scrolling with the TrackPoint while holding down the middle mouse button, create a new file /etc/X11/xorg.conf.d/20-thinkpad.conf with the following content:<br />
<br />
Section "InputClass"<br />
Identifier "Trackpoint Wheel Emulation"<br />
MatchProduct "TPPS/2 IBM TrackPoint|DualPoint Stick|Synaptics Inc. Composite TouchPad / TrackPoint|ThinkPad USB Keyboard with TrackPoint|USB Trackpoint pointing device"<br />
MatchDevicePath "/dev/input/event*"<br />
Option "EmulateWheel" "true"<br />
Option "EmulateWheelButton" "2"<br />
Option "Emulate3Buttons" "false"<br />
Option "XAxisMapping" "6 7"<br />
Option "YAxisMapping" "4 5"<br />
EndSection<br />
<br />
There are more details about how this works on the [[Xorg#InputClasses|Xorg]] page.<br />
===Disabling the TrackPad===<br />
If you try to use your x120e lying down you will notice its very easy to hit the TrackPad buttons and invert the functionality of the other inputs(fun).<br />
<br />
To disable the buttons and pad add the following to /etc/X11/xorg.conf.d/10-synaptic.conf:<br />
Section "InputClass"<br />
Identifier "Synaptics Touchpad"<br />
Driver "synaptics"<br />
Option "SendCoreEvents" "true"<br />
Option "Device" "/dev/psaux"<br />
Option "Protocol" "auto-dev"<br />
Option "HorizScrollDelta" "0"<br />
Option "SHMConfig" "on"<br />
EndSection<br />
<br />
And install the synaptics driver from extra:<br />
# pacman -S xf86-input-synaptics<br />
<br />
You can now toggle the TrackPads functionality using the synclient utility:<br />
$ synclient TouchpadOff=0 ; enables<br />
$ synclient TouchpadOff=1 ; disables<br />
<br />
If you want this to be permanent add the option to your Xorg config:<br />
Option "TouchpadOff" "1"<br />
<br />
==Power Management==<br />
===Enable Thinkpad ACPI===<br />
To have the thinkpad_acpi module load everytime at bootup add it to MODULES=() in /etc/rc.conf<br />
<br />
This module allows you to see and control various aspects of your Thinkpad from /proc/acpi/ibm<br />
<br />
===Disable Bluetooth===<br />
{{Accuracy|Using rfkill is the correct way to do this}}<br />
{{Note| You must first have the thinkpad_acpi kernel module loaded}}<br />
<br />
To save some power you can disable Bluetooth:<br />
<br />
{{bc|# tee <<< disable /proc/acpi/ibm/bluetooth}}<br />
<br />
If you want to disable Bluetooth at every boot just add that line to /etc/rc.local<br />
<br />
===CPU Scaling===<br />
{{Accuracy|rc.local is the wrong place to do this; ondemand is the default scheduler}}<br />
{{Merge|CPU Frequency Scaling|this isn't really hardware specific and is just duplicating the real article}}<br />
To enable [[CPU Frequency Scaling]] first add powernow-k8 to the {{ic|MODULES}} array in {{ic|/etc/rc.conf}}.<br />
<br />
Next modify {{ic|/etc/rc.local}}:<br />
<br />
{{hc|# vim /etc/rc.local|2=<br />
tee <<< ondemand /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor<br />
tee <<< ondemand /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor}}<br />
<br />
If you wish to have the ondemand governor ignore niced (background) processes when deciding whether to increase CPU speed:<br />
<br />
{{hc|# vim /etc/rc.local|2=<br />
tee <<< 1 /sys/devices/system/cpu/cpufreq/ondemand/ignore_nice_load}}<br />
<br />
===ATI Video card Powersaving===<br />
Under the opensource ATI video card driver you can control the clockspeed of the GPU.<br />
The recommended setting is:<br />
echo dynpm > /sys/class/drm/card0/device/power_method<br />
This enables dynamic frequency switching based off of GPU load.<br />
Further information on this topic can be found in [[ATI#Powersaving]].<br />
<br />
===SATA Power Policy===<br />
echo min_power > /sys/class/scsi_host/host0/link_power_management_policy<br />
Will tell hard drive to minimize power use.<br />
<br />
===Sound card Powersaving===<br />
Because the sound card in the X120e isn't actually an Intel card (even though it uses the Intel HDA driver) I'm not sure if this actually does anything. Doesn't seem to cause any problems though.<br />
echo 1 > /sys/module/snd_hda_intel/parameters/power_save<br />
<br />
===CPU Undervolting===<br />
{{Warning|Undervolting can lead to instability and consequently data loss, only you are responsible if you break something}} <br />
<br />
==== Using PHC ====<br />
<br />
The Fusion Processor can be undervolted with the PHC-K8 tool. See [[PHC]] for usage information. For the AMD Fusion you'll want to download [https://aur.archlinux.org/packages.php?ID=22953 phc-k8] from AUR.<br />
{{Note|In order to lower CPU power usage you must actually raise the PHC values. (somewhat counter-intuitive)}}<br />
"24 26 52" is what I have my E-350 set to. The three numbers represent 1600mhz, 1200mhz and 800mhz.<br />
{{Warning|The three values listed above are stable on MY processor. Due to variables during production, you're chip may be able to be undervolted more or LESS. Feel free to post the stable values that you reach to this wiki.}}<br />
<br />
==== Using tpc ====<br />
<br />
Another method for undervolting is {{AUR|tpc}}. It is more intuitive then PHC tool and needs Kernelmodule ''cpuid'' and ''msr''.<br />
<br />
Information output available cores and current frequencies and voltage:<br />
<br />
sudo tpc -l<br />
<br />
Example how to use<br />
{{Warning|DO THIS AT YOUR OWN RISK!!!! DON'T USE THIS VALUES!!! Approach yourself to values whitch are working for you! This is just an example how to use tpc}}<br />
tpc -set core all pstate 2 frequency 825 vcore 0.825 <br />
tpc -set core all pstate 1 frequency 1320 vcore 1.2250<br />
tpc -set core all pstate 0 frequency 1650 vcore 1.3000<br />
<br />
===Fan Control===<br />
The X120e's fan spins constantly but luckily can be controlled by the user.<br />
{{Warning|Modify fan settings at your own risk, only you are responsible if you toast your laptop or your lap.}}<br />
{{Note|Even with undervolting the APU produces enough heat to have to occasionally run the fan even at idle.}}<br />
<br />
To enable manual fan control place the following into /etc/modprobe.d/modprobe.conf<br />
options thinkpad_acpi fan_control=1<br />
Now you have to reload thinkpad_acpi module or reboot your Netbook.<br />
# rmmod thinkpad_acpi && modprobe thinkpad_acpi<br />
Now it should look like that:<br />
# cat /proc/acpi/ibm/fan <br />
status: disabled<br />
speed: 0<br />
level: 0<br />
commands: level <level> (<level> is 0-7, auto, disengaged, full-speed)<br />
commands: enable, disable<br />
commands: watchdog <timeout> (<timeout> is 0 (off), 1-120 (seconds))<br />
<br />
<br />
At this point the fan will still be safely under the system's control. You can either directly modify the values in /proc/acpi/ibm (NOT RECOMMENDED. e.g. 'echo level 1 > /proc/acpi/ibm/fan') or install a fan control daemon such as [[https://aur.archlinux.org/packages.php?ID=24359 thinkfan]].<br />
<br />
==Suspend and hibernation==<br />
Suspend works out of the box, but hibernate may fail - the system usually hangs with a black screen and a blinking power button led. To fix this we need to modify the hibernation mode; using pm-utils is just a matter of creaing a file /etc/pm/config.d/hibernate_mode containing a single line:<br />
<br />
HIBERNATE_MODE="shutdown"<br />
<br />
==External Resources==<br />
[http://www.thinkwiki.org/wiki/Category:X120e X120e on ThinkWiki]<br />
<br />
[http://www.linux-phc.org/forum/viewtopic.php?f=7&t=269 Undervolting the AMD Fusion with PHC-tool]</div>Ownaginatioushttps://wiki.archlinux.org/index.php?title=Lenovo_ThinkPad_X120e&diff=229390Lenovo ThinkPad X120e2012-10-18T08:01:34Z<p>Ownaginatious: </p>
<hr />
<div>[[Category:Lenovo]]<br />
{{Article summary start}}<br />
{{Article summary text|Installation instructions for the Lenovo ThinkPad X120e <br />
<br />
Should work for X121e too}}<br />
{{Article summary heading|Related articles}}<br />
{{Article summary wiki|IBM ThinkPad X100e}}<br />
{{Article summary end}}<br />
<br />
==CPU==<br />
<br />
The AMD CPU used on the X120e is microcode-upgradeable. To enable this functionality install the ''amd-ucode'' packages (available on extra) and add ''microcode'' to the MODULE list on /etc/rc.conf.<br />
<br />
==Video Drivers==<br />
{{Merge|ATI|Duplicates information from ATI article}}<br />
{{Accuracy|There is no such thing as "kernel 3.2.6.2"}}<br />
Users have the choice between the open source [[ATI]] video driver or the closed source [[Catalyst]] video driver.<br />
<br />
In order to use the open source driver you must have at least kernel 2.6.38.<br />
<br />
The open source ATI driver has flawless performance (including suspend). [[Gnome 3]] works well with the open source ATI driver. <br />
<br />
The Catalyst drivers do offer better 3D performance but usually have various minor issues (such as suspend support). As of kernel 3.2.6.2, suspend appears to work fine with this computer while using the catalyst drivers.<br />
<br />
==Wireless==<br />
The Thinkpad x120e is available with one of two wireless cards.<br />
*The Realtek BGN Wifi card is currently supported out of the box by the rtl8192ce driver, which was integrated into the Linux kernel as of version 3.2. This card, however, suffers from access point association and connection stability problems, especially in meshed wireless networks due to poor wireless radius detection. Since driver development by Realtek effectively stopped as of January 2012, the general consensus among many owners online has been to swap out this wireless card for a different better supported half-mini PCI card such as the Intel 6230. This however requires a BIOS patch to remove Lenovo's hardware restriction on which wireless cards can be used in the computer. More information can be found in [http://forums.mydigitallife.info/threads/20223-Remove-whitelist-check-add-ID-s-to-break-hardware-restrictions-mod-requests/page175 this] thread.<br />
<br />
*The Broadcom ABGN Wifi card is currently supported by the b43 driver. This driver is recommended over the broadcom-wl.<br />
<br />
==Audio==<br />
The kernel modules work, but the HDMI audio is the primary device (not the speaker). You can swap that:<br />
<br />
{{hc|$ vim ~/.asoundrc|<br />
defaults.pcm.card 1<br />
defaults.pcm.device 0<br />
defaults.ctl.card 1<br />
}}<br />
<br />
Note: Alternatively, you can accomplish the same thing by configuring the snd-hda-intel module:<br />
<br />
{{hc|$ grep snd-hda-intel /etc/modprobe.d/snd-hda-intel.conf|2=options snd-hda-intel index=1}}<br />
<br />
By specifying index you should no longer specify the default in {{ic|~/.asoundrc}}.<br />
<br />
==Input==<br />
===TrackPoint Scrolling (wheel emulation)===<br />
To enable scrolling with the TrackPoint while holding down the middle mouse button, create a new file /etc/X11/xorg.conf.d/20-thinkpad.conf with the following content:<br />
<br />
Section "InputClass"<br />
Identifier "Trackpoint Wheel Emulation"<br />
MatchProduct "TPPS/2 IBM TrackPoint|DualPoint Stick|Synaptics Inc. Composite TouchPad / TrackPoint|ThinkPad USB Keyboard with TrackPoint|USB Trackpoint pointing device"<br />
MatchDevicePath "/dev/input/event*"<br />
Option "EmulateWheel" "true"<br />
Option "EmulateWheelButton" "2"<br />
Option "Emulate3Buttons" "false"<br />
Option "XAxisMapping" "6 7"<br />
Option "YAxisMapping" "4 5"<br />
EndSection<br />
<br />
There are more details about how this works on the [[Xorg#InputClasses|Xorg]] page.<br />
===Disabling the TrackPad===<br />
If you try to use your x120e lying down you will notice its very easy to hit the TrackPad buttons and invert the functionality of the other inputs(fun).<br />
<br />
To disable the buttons and pad add the following to /etc/X11/xorg.conf.d/10-synaptic.conf:<br />
Section "InputClass"<br />
Identifier "Synaptics Touchpad"<br />
Driver "synaptics"<br />
Option "SendCoreEvents" "true"<br />
Option "Device" "/dev/psaux"<br />
Option "Protocol" "auto-dev"<br />
Option "HorizScrollDelta" "0"<br />
Option "SHMConfig" "on"<br />
EndSection<br />
<br />
And install the synaptics driver from extra:<br />
# pacman -S xf86-input-synaptics<br />
<br />
You can now toggle the TrackPads functionality using the synclient utility:<br />
$ synclient TouchpadOff=0 ; enables<br />
$ synclient TouchpadOff=1 ; disables<br />
<br />
If you want this to be permanent add the option to your Xorg config:<br />
Option "TouchpadOff" "1"<br />
<br />
==Power Management==<br />
===Enable Thinkpad ACPI===<br />
To have the thinkpad_acpi module load everytime at bootup add it to MODULES=() in /etc/rc.conf<br />
<br />
This module allows you to see and control various aspects of your Thinkpad from /proc/acpi/ibm<br />
<br />
===Disable Bluetooth===<br />
{{Accuracy|Using rfkill is the correct way to do this}}<br />
{{Note| You must first have the thinkpad_acpi kernel module loaded}}<br />
<br />
To save some power you can disable Bluetooth:<br />
<br />
{{bc|# tee <<< disable /proc/acpi/ibm/bluetooth}}<br />
<br />
If you want to disable Bluetooth at every boot just add that line to /etc/rc.local<br />
<br />
===CPU Scaling===<br />
{{Accuracy|rc.local is the wrong place to do this; ondemand is the default scheduler}}<br />
{{Merge|CPU Frequency Scaling|this isn't really hardware specific and is just duplicating the real article}}<br />
To enable [[CPU Frequency Scaling]] first add powernow-k8 to the {{ic|MODULES}} array in {{ic|/etc/rc.conf}}.<br />
<br />
Next modify {{ic|/etc/rc.local}}:<br />
<br />
{{hc|# vim /etc/rc.local|2=<br />
tee <<< ondemand /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor<br />
tee <<< ondemand /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor}}<br />
<br />
If you wish to have the ondemand governor ignore niced (background) processes when deciding whether to increase CPU speed:<br />
<br />
{{hc|# vim /etc/rc.local|2=<br />
tee <<< 1 /sys/devices/system/cpu/cpufreq/ondemand/ignore_nice_load}}<br />
<br />
===ATI Video card Powersaving===<br />
Under the opensource ATI video card driver you can control the clockspeed of the GPU.<br />
The recommended setting is:<br />
echo dynpm > /sys/class/drm/card0/device/power_method<br />
This enables dynamic frequency switching based off of GPU load.<br />
Further information on this topic can be found in [[ATI#Powersaving]].<br />
<br />
===SATA Power Policy===<br />
echo min_power > /sys/class/scsi_host/host0/link_power_management_policy<br />
Will tell hard drive to minimize power use.<br />
<br />
===Sound card Powersaving===<br />
Because the sound card in the X120e isn't actually an Intel card (even though it uses the Intel HDA driver) I'm not sure if this actually does anything. Doesn't seem to cause any problems though.<br />
echo 1 > /sys/module/snd_hda_intel/parameters/power_save<br />
<br />
===CPU Undervolting===<br />
{{Warning|Undervolting can lead to instability and consequently data loss, only you are responsible if you break something}} <br />
<br />
==== Using PHC ====<br />
<br />
The Fusion Processor can be undervolted with the PHC-K8 tool. See [[PHC]] for usage information. For the AMD Fusion you'll want to download [https://aur.archlinux.org/packages.php?ID=22953 phc-k8] from AUR.<br />
{{Note|In order to lower CPU power usage you must actually raise the PHC values. (somewhat counter-intuitive)}}<br />
"24 26 52" is what I have my E-350 set to. The three numbers represent 1600mhz, 1200mhz and 800mhz.<br />
{{Warning|The three values listed above are stable on MY processor. Due to variables during production, you're chip may be able to be undervolted more or LESS. Feel free to post the stable values that you reach to this wiki.}}<br />
<br />
==== Using tpc ====<br />
<br />
Another method for undervolting is {{AUR|tpc}}. It is more intuitive then PHC tool and needs Kernelmodule ''cpuid'' and ''msr''.<br />
<br />
Information output available cores and current frequencies and voltage:<br />
<br />
sudo tpc -l<br />
<br />
Example how to use<br />
{{Warning|DO THIS AT YOUR OWN RISK!!!! DON'T USE THIS VALUES!!! Approach yourself to values whitch are working for you! This is just an example how to use tpc}}<br />
tpc -set core all pstate 2 frequency 825 vcore 0.825 <br />
tpc -set core all pstate 1 frequency 1320 vcore 1.2250<br />
tpc -set core all pstate 0 frequency 1650 vcore 1.3000<br />
<br />
===Fan Control===<br />
The X120e's fan spins constantly but luckily can be controlled by the user.<br />
{{Warning|Modify fan settings at your own risk, only you are responsible if you toast your laptop or your lap.}}<br />
{{Note|Even with undervolting the APU produces enough heat to have to occasionally run the fan even at idle.}}<br />
<br />
To enable manual fan control place the following into /etc/modprobe.d/modprobe.conf<br />
options thinkpad_acpi fan_control=1<br />
Now you have to reload thinkpad_acpi module or reboot your Netbook.<br />
# rmmod thinkpad_acpi && modprobe thinkpad_acpi<br />
Now it should look like that:<br />
# cat /proc/acpi/ibm/fan <br />
status: disabled<br />
speed: 0<br />
level: 0<br />
commands: level <level> (<level> is 0-7, auto, disengaged, full-speed)<br />
commands: enable, disable<br />
commands: watchdog <timeout> (<timeout> is 0 (off), 1-120 (seconds))<br />
<br />
<br />
At this point the fan will still be safely under the system's control. You can either directly modify the values in /proc/acpi/ibm (NOT RECOMMENDED. e.g. 'echo level 1 > /proc/acpi/ibm/fan') or install a fan control daemon such as [[https://aur.archlinux.org/packages.php?ID=24359 thinkfan]].<br />
<br />
==Suspend and hibernation==<br />
Suspend works out of the box, but hibernate may fail - the system usually hangs with a black screen and a blinking power button led. To fix this we need to modify the hibernation mode; using pm-utils is just a matter of creaing a file /etc/pm/config.d/hibernate_mode containing a single line:<br />
<br />
HIBERNATE_MODE="shutdown"<br />
<br />
==External Resources==<br />
[http://www.thinkwiki.org/wiki/Category:X120e X120e on ThinkWiki]<br />
<br />
[http://www.linux-phc.org/forum/viewtopic.php?f=7&t=269 Undervolting the AMD Fusion with PHC-tool]</div>Ownaginatioushttps://wiki.archlinux.org/index.php?title=Lotus_Notes_in_32bit_Chroot&diff=201932Lotus Notes in 32bit Chroot2012-05-17T13:34:15Z<p>Ownaginatious: /* Troubleshooting */</p>
<hr />
<div>[[Category:Arch64]]<br />
[[Category:Email Client]]<br />
[[Category:Internet Applications]]<br />
<br />
IBM Lotus Notes does not have a native 64bit package to date. This article will discuss the installation of Lotus Notes on 64 bit Arch Linux inside a 32bit chroot environment. This method will use the rpm versions of the Notes packages; .deb files are available but the author has not tried them.<br />
<br />
<br />
==Introduction==<br />
Lotus Notes is an email, calendaring, todo, notetaking, and collaboration application developed by IBM. It is used most commonly in corporate settings as it contains fairly powerful features that surpass those offered by more traditional email/calendar applications like Outlook or Thunderbird. Specifically, Lotus Notes features database functionality that allows for the storage of user input from various forms (e.g. surveys). While the email and scheduling functionality is quite similar to that of other applications in this family, the database functionality is difficult to understand without firsthand use.<br />
<br />
For those who use Linux in a corporate setting in which Lotus Notes is the default client, installation of this application is a necessity. While this is trivial on 32bit systems (such as Arch 686), Lotus Notes has not yet been released for 64bit Linux. As this is the case, those using Arch64 will need to install Notes inside a 32bit chroot. It may be possible to use a multi-lib setup, but the author of this article has no experience with that method and from his reading considers the chroot environment to be cleaner and simpler (easier to start over or remove altogether if functionality is no longer needed).<br />
<br />
<br />
==Obtaining Lotus Notes and FixPacks==<br />
You will at least need a Lotus Notes rpm package. The FixPacks that IBM releases are also recommended. The main author of this entry has experience with Notes 8.0 and 8.5[.1 and .2] on 64bit Arch.<br />
<br />
{{Note| The IBM site can be confusing. For almost all downloads, multiple languages, versions, and OS choices are available. Make sure you download files with the following characteristics:<br />
* For Lotus Notes ''Client'' and ''not'' for Domino. Notes is the email/calendar client; Domino is the server application<br />
* For Linux (obvious) for rpm install (not deb)}}<br />
<br />
<br />
===Obtaining Lotus Notes===<br />
* If you have a corporate ID with IBM, you may use the [http://www-01.ibm.com/software/lotus/products/notes/ IBM Lotus Notes site] for official download<br />
* Optionally, visit the [http://www14.software.ibm.com/webapp/download/search.jsp?pn=Lotus+Notes IBM Lotus Notes Trials site] for free trial versions that expire after 90 days<br />
* You may also contact your company administrator for a copy of Lotus Notes for Linux<br />
<br />
The trials provided change frequently. For example, as of 10-21-2010, trials of both 8.5 and 8.5.2 were available. As of 03-07-2011, only 8.5.2 is available. Check the [http://www14.software.ibm.com/webapp/download/search.jsp?pn=Lotus+Notes Lotus Notes trials page] frequently:<br />
<br />
===Downloading FixPacks===<br />
* Visit the [http://www-933.ibm.com/support/fixcentral/ IBM Fix Central site] to find FixPacks<br />
* Input Product Group=Lotus, Product=Lotus Notes, the version you have, and Platform=Linux for the four fields<br />
* At the next page click Continue at the bottom of the page to see all possible FixPacks<br />
* Download the correct one<br />
<br />
If you are using Lotus Notes 8.5.1, there is a [http://www-01.ibm.com/support/docview.wss?uid=swg24025721 dedicated page] for incremental FixPack installers. There are currently 5 FixPacks released (as of 03-07-20110. Just download Notes_851FP5_Standard_RPMInstall_Linux (5th FixPack, rpm format for Linux) since each FixPack encompasses the previous versions. The page for the 8.5.2 fixpack is [https://www-304.ibm.com/support/docview.wss?uid=swg24028680 here].<br />
<br />
<br />
==Create 32bit Chroot (x86_64)==<br />
''If using i686, skip to [[#Installing Dependencies]]''<br />
<br />
The Arch Wiki already has a fantastic article on creating a 32bit chroot environment on a 64bit system: [[Install_bundled_32-bit_system_in_Arch64]]. Use the instructions there to do the following:<br />
* Create /opt/arch32, setup pacamn, and sync<br />
* Install base and base-devel<br />
* Create the arch32 daemon script<br />
* Link/copy the necessary files in /etc from the 64bit system to the chroot<br />
* Start the daemon<br />
<br />
===Important steps to remember===<br />
Having been through this process many, many times, there are some steps that are quite common to forget. Please remember to:<br />
* run the xhost command after starting the daemon:<br />
xhost +SI:localuser:usernametogiveaccesstogoeshere<br />
* chroot into /opt/arch32 with:<br />
# linux32 chroot /opt/arch32<br />
* edit your /etc/pacman.conf (from the chroot; the actual location is /opt/arch32/etc/pacman.conf)<br />
** uncomment at least one mirror<br />
** also, edit the line at the top of /etc/pacman.conf from:<br />
Architecture = auto<br />
to:<br />
Architecture = i686<br />
* Be sure to uncomment a mirror in /etc/pacman.d/mirrorlist as well<br />
* sync pacman to ensure that everything is working properly:<br />
# pacman -Syy<br />
* lastly, run this to generate your locale files:<br />
# locale-gen<br />
<br />
<br />
==Installing Dependencies==<br />
IBM has published a list of [http://www-01.ibm.com/support/docview.wss?uid=swg27013074 System Requirements] as well as a list of [http://www-01.ibm.com/support/docview.wss?&uid=swg27013076 Linux Packages] that are required to run Lotus Notes. When attempting to install an rpm on a non-rpm based distro, rpm will also complain about missing packages if the --nodeps option is not provided. IBM's list and the errors from an rpm attempt were used by the author of this article (by repeatedly running 'pacman -Qo filename') to painstakingly generate a minimum list of packages that would pull in all of the Lotus Notes dependencies. The list below are the "top level" packages, and will pull all the rest along with them. Run this ''from the chroot'':<br />
<br />
# pacman -S gdb tcsh libart-lgpl alsa-lib atk libbonobo libbonoboui gconf gtk2 libgnome libgnomecanvas libgnomeprint \<br />
libgnomeprintui libgnomeui gvfs libice libjpeg orbit2 pango libpng libsm libx11 libxcursor libxext libxft libxi libxkbfile libxml2 \<br />
libxrender libxss libxt libxtst font-bh-ttf audiofile esound gnome-menus libgail-gnome startup-notification gnome-desktop \<br />
gtk-xfce-engine xterm<br />
<br />
{{Note|xterm is only required to get through the license agreement. When you run Notes for the first time, an xterm window will ask you to accept the license agreement. Once you do this and setup your Lotus Notes account, you can remove xterm if you wish.}}<br />
<br />
<br />
==Installing Lotus Notes==<br />
While still in the chroot environment, do the following:<br />
* unpack the tar file you downloaded (fictional file name, use whatever you have):<br />
$ tar -xvf /path/to/ibm_lotus_notes-8.5.2.tar<br />
This should unpack the following:<br />
* ibm_lotus_activities-8.5.2.i586.rpm<br />
* ibm_lotus_cae-8.5.2.i586.rpm<br />
* ibm_lotus_feedreader-8.5.2.i586.rpm<br />
* ibm_lotus_notes-8.5.2.i586.rpm<br />
* ibm_lotus_sametime-8.5.2.i586.rpm<br />
* ibm_lotus_symphony-8.5.2.i586.rpm<br />
* license.tar<br />
* pub_ibm_lotus_notes.gpg<br />
* smartupgrade.sh<br />
<br />
Ensure that your archive package is accessible from within your 32-bit chrooted environment. If you followed all the instructions in the previous document about creating a 32-bit environment within arch, particularly up to linking file/folders, a link to your home folder will exist in the /opt/arch32 folder. If you downloaded lotus notes off of a website in the 64-bit environment, there is a good chance it will exist in your download folder within your home folder in the 32-bit environment as well.<br />
<br />
Now install the lotus notes RPM using the following command (Note: You may need to have [https://aur.archlinux.org/packages.php?ID=30317 rpm-org] installed from the AUR):<br />
# rpm -ivh --nodeps ibm_lotus_notes-8.5.2.i586.rpm<br />
<br />
When that completes, you may install any fixpacks with:<br />
# rpm --ivh --nodeps ibm_lotus_notes_fixpack-8.5.2.i586.rpm<br />
<br />
Now run Lotus Notes for the first time with:<br />
$ /opt/ibm/lotus/notes/notes<br />
<br />
Note: To run the above command, you must not be root. If you installed as root, switch back to your user account with:<br />
# su username<br />
<br />
A splash screen should appear, shortly followed by an xterm window asking you to accept the license agreement. Type "1" (the digit, one) and then press enter. Lotus Notes should prompt its configuration screen and ask you for your name, server, user.id file, etc. When this completes, it will bring you to the Lotus Notes interface and you can revel in your accomplishment!<br />
<br />
You can repeat the above process with any of the other RPM files included in the bundle if you would like as well (sametime, symphony, cae, activities, etc.). Perhaps archive the original tar file somewhere in case you need it again, and then delete the unpacked files you do not need/want.<br />
<br />
===Creating a shortcut===<br />
Now it is not unlikely that you will quickly get tired of monotonously using chroot and entering a long path every time you want to start notes. Fortunately, creating a seamless shortcut in your 64-bit environment is easy.<br />
<br />
If you installed schroot, as mentioned in the article about creating a 32-bit environment within arch, you can place an extensionless shell script titled 'notes' into /usr/bin containing the following:<br />
<br />
schroot -- /opt/ibm/lotus/notes/notes<br />
<br />
Ensure that you are listed as one of the users who can use schroot at the bottom of the /etc/schroot/schroot.conf file by uncommenting and adding your username to the 'Users' segment.<br />
<br />
You should now be able to start notes by typing 'notes' and hitting enter in the terminal.<br />
<br />
===Installing on a 32bit System===<br />
I'm not sure why this is even covered because it's so simple, but just to have a mention of this somewhere in the Arch Wiki, just follow the procedure above for installation of the rpms. The additional reference this should provide is a list of required packages above, which I have not seen elsewhere. Hopefully this helps. The next section on troubleshooting should help as well.<br />
<br />
===Additional Steps on 8.5[.1]===<br />
If you are running 8.5 or 8.5.1, you may need to replace some libraries. This was mentioned several times in the IBM Developer forums in Ubuntu how-tos. One site that references it, along with two sources for these libraries is [http://metkhoo.blogspot.com/2010/03/notes-851-on-ubuntu-910-karmic-x64.html here]<br />
<br />
===Troubleshooting===<br />
* '''Notes on Gnome 3 Compatibility:''' Recently, gtk and Gnome related libraries underwent a transition to version 3. This caused a severe breakage in Lotus Notes. Reverting to gtk2/Gnome 2 libraries fixed things temporarily. A [http://www-10.lotus.com/ldd/nd85forum.nsf/dba3ca7e515d55ff85256a0700727b35/73442d4c703d8eb885257886006acb41?OpenDocument post was made to the IBM Notes community] which suggested the [http://usablesoftware.wordpress.com/2011/04/27/getting-lotus-notes-8-5-2-working-in-ubuntu-natty-narwhal-64-bit/ fix presented on this blog]. In summary, the fix suggests the following:<br />
** Download tar.gz from https://github.com/sgh/lotus-notes_gtk2.23.3 and extract<br />
** Edit the Makefile, inserting -m32 so that it reads: "gcc -Wall -Wextra -m32 `pkg-config..."<br />
** Compile by running "make"<br />
** Copy both libnotesgtkfix.so and notes-wrapper to /opt/ibm/lotus/notes/<br />
** From now on, to start Lotus Notes, run /opt/ibm/lotus/notes/notes-wrapper (instead of /opt/ibm/lotus/notes/notes, as before)<br />
<br />
* Recently on a fresh install of Arch and a fresh chroot, I could not get Lotus Notes even put up the xterm window for license acceptance, and in looking at the logs in ~/lotus/notes/data/workspace/logs noticed the error-log was complaining about the file in /opt/ibm/lotus/notes/framework/rcp/plugin_customization.ini. The error was about proper permissions. I chmodded did the following:<br />
<br />
# chmod 755 /opt/ibm/lotus/notes/framework/rcp/plugin_customization.ini<br />
# chown username:users /opt/ibm/lotus/notes/framework/rcp/plugin_customization.ini<br />
<br />
* Typically, after the license agreement step, Lotus Notes immediately brings up the configuration setup process. The last time I installed 8.5.2 from a scratch system/chroot, however, this was not happening. I got a license agreement page but nothing else. In looking at the output of top, the notes2 process would just vanish. In a fluke attempt, I just ran /opt/ibm/lotues/notes again... and it went right to the configuration process. I had several additional packages installed, but wiped out ~/lotus, removed them all, and re-tried and can reproduce the behavior. If you got a license agreement but nothing more, perhaps try to run Notes again.<br />
<br />
* In my last fresh install, I had issues using rpm on the 8.5.2 fixpack as well as with trying to remove Lotus Notes 8.5.2 (not that you'd want to, but I wanted to know why the fixpack was not working). I received errors like this for the fixpack:<br />
%pre scriptlet failed error status: 85<br />
and when trying to remove Lotus Notes with 'rpm -ev --nodeps pkd' I got:<br />
glibc detected **Double Linked List**<br />
For some reason, using the aur package [https://aur.archlinux.org/packages.php?ID=30317 rpm-org] worked perfectly for both installation and trial removal of Lotus Notes 8.5.2, and installation of the 8.5.2 fixpack. While perhaps not the "best" method, to clean up everything after uninstalling rpm and installing rpm-org, I ran (from the chroot):<br />
# pacman -Rsc rpm<br />
# rm -r /var/lib/rpm<br />
# rm -r /opt/ibm<br />
Then I proceeded to install rpm-org with yaourt and repeated the steps above to install Lotus Notes and the fixpack.<br />
<br />
==Post Install==<br />
* '''Fonts:''' As included above in the dependencies list, make sure you have the font-bh-ttf package installed. One user has reported that this was still producing ugly fonts. He has since confirmed that installing the [https://aur.archlinux.org/packages.php?ID=13030 ttf-ms-fonts] package fixed this issue.<br />
* '''Theme/Icons:''' Your default icons and theme may not look right. Copy over your applicable folders from /usr/share/themes and /usr/share/icons and configure your chroot environment with those same themes/icons. I have noticed that even if Notes uses my proper cursor icon, it changes to an ugly basic one on certain links/buttons and am not sure how to fix this.<br />
* '''Mail Preview Pane Glitch:''' In either 8.5 or 8.5.1, I had issues with the mail preview pane locking up or creating multiple adjustment bars. I believe setting the option "Disable embedded browser for MIME email" was what fixed this issue.</div>Ownaginatioushttps://wiki.archlinux.org/index.php?title=Lotus_Notes_in_32bit_Chroot&diff=187097Lotus Notes in 32bit Chroot2012-03-01T19:56:52Z<p>Ownaginatious: /* Troubleshooting */</p>
<hr />
<div>[[Category:Arch64 (English)]]<br />
[[Category:Email Client (English)]]<br />
[[Category:Internet Applications (English)]]<br />
<br />
IBM Lotus Notes does not have a native 64bit package to date. This article will discuss the installation of Lotus Notes on 64 bit Arch Linux inside a 32bit chroot environment. This method will use the rpm versions of the Notes packages; .deb files are available but the author has not tried them.<br />
<br />
<br />
==Introduction==<br />
Lotus Notes is an email, calendaring, todo, notetaking, and collaboration application developed by IBM. It is used most commonly in corporate settings as it contains fairly powerful features that surpass those offered by more traditional email/calendar applications like Outlook or Thunderbird. Specifically, Lotus Notes features database functionality that allows for the storage of user input from various forms (e.g. surveys). While the email and scheduling functionality is quite similar to that of other applications in this family, the database functionality is difficult to understand without firsthand use.<br />
<br />
For those who use Linux in a corporate setting in which Lotus Notes is the default client, installation of this application is a necessity. While this is trivial on 32bit systems (such as Arch 686), Lotus Notes has not yet been released for 64bit Linux. As this is the case, those using Arch64 will need to install Notes inside a 32bit chroot. It may be possible to use a multi-lib setup, but the author of this article has no experience with that method and from his reading considers the chroot environment to be cleaner and simpler (easier to start over or remove altogether if functionality is no longer needed).<br />
<br />
<br />
==Obtaining Lotus Notes and FixPacks==<br />
You will at least need a Lotus Notes rpm package. The FixPacks that IBM releases are also recommended. The main author of this entry has experience with Notes 8.0 and 8.5[.1 and .2] on 64bit Arch.<br />
<br />
{{Note| The IBM site can be confusing. For almost all downloads, multiple languages, versions, and OS choices are available. Make sure you download files with the following characteristics:<br />
* For Lotus Notes ''Client'' and ''not'' for Domino. Notes is the email/calendar client; Domino is the server application<br />
* For Linux (obvious) for rpm install (not deb)}}<br />
<br />
<br />
===Obtaining Lotus Notes===<br />
* If you have a corporate ID with IBM, you may use the [http://www-01.ibm.com/software/lotus/products/notes/ IBM Lotus Notes site] for official download<br />
* Optionally, visit the [http://www14.software.ibm.com/webapp/download/search.jsp?pn=Lotus+Notes IBM Lotus Notes Trials site] for free trial versions that expire after 90 days<br />
* You may also contact your company administrator for a copy of Lotus Notes for Linux<br />
<br />
The trials provided change frequently. For example, as of 10-21-2010, trials of both 8.5 and 8.5.2 were available. As of 03-07-2011, only 8.5.2 is available. Check the [http://www14.software.ibm.com/webapp/download/search.jsp?pn=Lotus+Notes Lotus Notes trials page] frequently:<br />
<br />
===Downloading FixPacks===<br />
* Visit the [http://www-933.ibm.com/support/fixcentral/ IBM Fix Central site] to find FixPacks<br />
* Input Product Group=Lotus, Product=Lotus Notes, the version you have, and Platform=Linux for the four fields<br />
* At the next page click Continue at the bottom of the page to see all possible FixPacks<br />
* Download the correct one<br />
<br />
If you are using Lotus Notes 8.5.1, there is a [http://www-01.ibm.com/support/docview.wss?uid=swg24025721 dedicated page] for incremental FixPack installers. There are currently 5 FixPacks released (as of 03-07-20110. Just download Notes_851FP5_Standard_RPMInstall_Linux (5th FixPack, rpm format for Linux) since each FixPack encompasses the previous versions. The page for the 8.5.2 fixpack is [https://www-304.ibm.com/support/docview.wss?uid=swg24028680 here].<br />
<br />
<br />
==Create 32bit Chroot (x86_64)==<br />
''If using i686, skip to [[#Installing Dependencies]]''<br />
<br />
The Arch Wiki already has a fantastic article on creating a 32bit chroot environment on a 64bit system: [[Install_bundled_32-bit_system_in_Arch64]]. Use the instructions there to do the following:<br />
* Create /opt/arch32, setup pacamn, and sync<br />
* Install base and base-devel<br />
* Create the arch32 daemon script<br />
* Link/copy the necessary files in /etc from the 64bit system to the chroot<br />
* Start the daemon<br />
<br />
===Important steps to remember===<br />
Having been through this process many, many times, there are some steps that are quite common to forget. Please remember to:<br />
* run the xhost command after starting the daemon:<br />
xhost +SI:localuser:usernametogiveaccesstogoeshere<br />
* chroot into /opt/arch32 with:<br />
# linux32 chroot /opt/arch32<br />
* edit your /etc/pacman.conf (from the chroot; the actual location is /opt/arch32/etc/pacman.conf)<br />
** uncomment at least one mirror<br />
** also, edit the line at the top of /etc/pacman.conf from:<br />
Architecture = auto<br />
to:<br />
Architecture = i686<br />
* Be sure to uncomment a mirror in /etc/pacman.d/mirrorlist as well<br />
* sync pacman to ensure that everything is working properly:<br />
# pacman -Syy<br />
* lastly, run this to generate your locale files:<br />
# locale-gen<br />
<br />
<br />
==Installing Dependencies==<br />
IBM has published a list of [http://www-01.ibm.com/support/docview.wss?uid=swg27013074 System Requirements] as well as a list of [http://www-01.ibm.com/support/docview.wss?&uid=swg27013076 Linux Packages] that are required to run Lotus Notes. When attempting to install an rpm on a non-rpm based distro, rpm will also complain about missing packages if the --nodeps option is not provided. IBM's list and the errors from an rpm attempt were used by the author of this article (by repeatedly running 'pacman -Qo filename') to painstakingly generate a minimum list of packages that would pull in all of the Lotus Notes dependencies. The list below are the "top level" packages, and will pull all the rest along with them. Run this ''from the chroot'':<br />
<br />
# pacman -S gdb tcsh libart-lgpl alsa-lib atk libbonobo libbonoboui gconf gtk2 libgnome libgnomecanvas libgnomeprint \<br />
libgnomeprintui libgnomeui gvfs libice libjpeg orbit2 pango libpng libsm libx11 libxcursor libxext libxft libxi libxkbfile libxml2 \<br />
libxrender libxss libxt libxtst font-bh-ttf audiofile esound gnome-menus libgail-gnome startup-notification gnome-desktop \<br />
gtk-xfce-engine xterm<br />
<br />
{{Note|xterm is only required to get through the license agreement. When you run Notes for the first time, an xterm window will ask you to accept the license agreement. Once you do this and setup your Lotus Notes account, you can remove xterm if you wish.}}<br />
<br />
<br />
==Installing Lotus Notes==<br />
While still in the chroot environment, do the following:<br />
* unpack the tar file you downloaded (fictional file name, use whatever you have):<br />
$ tar -xvf /path/to/ibm_lotus_notes-8.5.2.tar<br />
This should unpack the following:<br />
* ibm_lotus_activities-8.5.2.i586.rpm<br />
* ibm_lotus_cae-8.5.2.i586.rpm<br />
* ibm_lotus_feedreader-8.5.2.i586.rpm<br />
* ibm_lotus_notes-8.5.2.i586.rpm<br />
* ibm_lotus_sametime-8.5.2.i586.rpm<br />
* ibm_lotus_symphony-8.5.2.i586.rpm<br />
* license.tar<br />
* pub_ibm_lotus_notes.gpg<br />
* smartupgrade.sh<br />
<br />
Ensure that your archive package is accessible from within your 32-bit chrooted environment. If you followed all the instructions in the previous document about creating a 32-bit environment within arch, particularly up to linking file/folders, a link to your home folder will exist in the /opt/arch32 folder. If you downloaded lotus notes off of a website in the 64-bit environment, there is a good chance it will exist in your download folder within your home folder in the 32-bit environment as well.<br />
<br />
Now install the lotus notes RPM using the following command (Note: You may need to have [http://aur.archlinux.org/packages.php?ID=30317 rpm-org] installed from the AUR):<br />
# rpm -ivh --nodeps ibm_lotus_notes-8.5.2.i586.rpm<br />
<br />
When that completes, you may install any fixpacks with:<br />
# rpm --ivh --nodeps ibm_lotus_notes_fixpack-8.5.2.i586.rpm<br />
<br />
Now run Lotus Notes for the first time with:<br />
$ /opt/ibm/lotus/notes/notes<br />
<br />
Note: To run the above command, you must not be root. If you installed as root, switch back to your user account with:<br />
# su username<br />
<br />
A splash screen should appear, shortly followed by an xterm window asking you to accept the license agreement. Type "1" (the digit, one) and then press enter. Lotus Notes should prompt its configuration screen and ask you for your name, server, user.id file, etc. When this completes, it will bring you to the Lotus Notes interface and you can revel in your accomplishment!<br />
<br />
You can repeat the above process with any of the other RPM files included in the bundle if you would like as well (sametime, symphony, cae, activities, etc.). Perhaps archive the original tar file somewhere in case you need it again, and then delete the unpacked files you do not need/want.<br />
<br />
===Creating a shortcut===<br />
Now it is not unlikely that you will quickly get tired of monotonously using chroot and entering a long path every time you want to start notes. Fortunately, creating a seamless shortcut in your 64-bit environment is easy.<br />
<br />
If you installed schroot, as mentioned in the article about creating a 32-bit environment within arch, you can place an extensionless shell script titled 'notes' into /usr/bin containing the following:<br />
<br />
schroot -- /opt/ibm/lotus/notes/notes<br />
<br />
Ensure that you are listed as one of the users who can use schroot at the bottom of the /etc/schroot/schroot.conf file by uncommenting and adding your username to the 'Users' segment.<br />
<br />
You should now be able to start notes by typing 'notes' and hitting enter in the terminal.<br />
<br />
===Installing on a 32bit System===<br />
I'm not sure why this is even covered because it's so simple, but just to have a mention of this somewhere in the Arch Wiki, just follow the procedure above for installation of the rpms. The additional reference this should provide is a list of required packages above, which I have not seen elsewhere. Hopefully this helps. The next section on troubleshooting should help as well.<br />
<br />
===Additional Steps on 8.5[.1]===<br />
If you are running 8.5 or 8.5.1, you may need to replace some libraries. This was mentioned several times in the IBM Developer forums in Ubuntu how-tos. One site that references it, along with two sources for these libraries is [http://metkhoo.blogspot.com/2010/03/notes-851-on-ubuntu-910-karmic-x64.html here]<br />
<br />
===Troubleshooting===<br />
* '''Errors from schroot:''' A recent upgrade to schroot and related packages has caused this setup in its current configuration to fail upon launching lotus notes. At the moment it is unknown how to properly configure the newer version of schroot, so it's recommended you use a program like [http://aur.archlinux.org/packages.php?ID=31937 downgrade] to downgrade the following packages to the specified versions:<br />
<br />
boost (1.47.0-3)<br />
boost-libs (1.47.0-3)<br />
schroot (1.4.23-1)<br />
<br />
If you do not have these packages cached, then you should look around online in a mirror archive for these particular versions.<br />
<br />
To prevent pacman from automatically updating them again, add the following to your /etc/pacman.conf:<br />
<br />
IgnorePkg = boost-libs boost schroot<br />
<br />
* '''Notes on Gnome 3 Compatibility:''' Recently, gtk and Gnome related libraries underwent a transition to version 3. This caused a severe breakage in Lotus Notes. Reverting to gtk2/Gnome 2 libraries fixed things temporarily. A [http://www-10.lotus.com/ldd/nd85forum.nsf/dba3ca7e515d55ff85256a0700727b35/73442d4c703d8eb885257886006acb41?OpenDocument post was made to the IBM Notes community] which suggested the [http://usablesoftware.wordpress.com/2011/04/27/getting-lotus-notes-8-5-2-working-in-ubuntu-natty-narwhal-64-bit/ fix presented on this blog]. In summary, the fix suggests the following:<br />
** Download tar.gz from https://github.com/sgh/lotus-notes_gtk2.23.3 and extract<br />
** Edit the Makefile, inserting -m32 so that it reads: "gcc -Wall -Wextra -m32 `pkg-config..."<br />
** Compile by running "make"<br />
** Copy both libnotesgtkfix.so and notes-wrapper to /opt/ibm/lotus/notes/<br />
** From now on, to start Lotus Notes, run /opt/ibm/lotus/notes/notes-wrapper (instead of /opt/ibm/lotus/notes/notes, as before)<br />
<br />
* Recently on a fresh install of Arch and a fresh chroot, I could not get Lotus Notes even put up the xterm window for license acceptance, and in looking at the logs in ~/lotus/notes/data/workspace/logs noticed the error-log was complaining about the file in /opt/ibm/lotus/notes/framework/rcp/plugin_customization.ini. The error was about proper permissions. I chmodded did the following:<br />
<br />
# chmod 755 /opt/ibm/lotus/notes/framework/rcp/plugin_customization.ini<br />
# chown username:users /opt/ibm/lotus/notes/framework/rcp/plugin_customization.ini<br />
<br />
* Typically, after the license agreement step, Lotus Notes immediately brings up the configuration setup process. The last time I installed 8.5.2 from a scratch system/chroot, however, this was not happening. I got a license agreement page but nothing else. In looking at the output of top, the notes2 process would just vanish. In a fluke attempt, I just ran /opt/ibm/lotues/notes again... and it went right to the configuration process. I had several additional packages installed, but wiped out ~/lotus, removed them all, and re-tried and can reproduce the behavior. If you got a license agreement but nothing more, perhaps try to run Notes again.<br />
<br />
* In my last fresh install, I had issues using rpm on the 8.5.2 fixpack as well as with trying to remove Lotus Notes 8.5.2 (not that you'd want to, but I wanted to know why the fixpack was not working). I received errors like this for the fixpack:<br />
%pre scriptlet failed error status: 85<br />
and when trying to remove Lotus Notes with 'rpm -ev --nodeps pkd' I got:<br />
glibc detected **Double Linked List**<br />
For some reason, using the aur package [http://aur.archlinux.org/packages.php?ID=30317 rpm-org] worked perfectly for both installation and trial removal of Lotus Notes 8.5.2, and installation of the 8.5.2 fixpack. While perhaps not the "best" method, to clean up everything after uninstalling rpm and installing rpm-org, I ran (from the chroot):<br />
# pacman -Rsc rpm<br />
# rm -r /var/lib/rpm<br />
# rm -r /opt/ibm<br />
Then I proceeded to install rpm-org with yaourt and repeated the steps above to install Lotus Notes and the fixpack.<br />
<br />
==Post Install==<br />
* '''Fonts:''' As included above in the dependencies list, make sure you have the font-bh-ttf package installed. One user has reported that this was still producing ugly fonts. He has since confirmed that installing the [http://aur.archlinux.org/packages.php?ID=13030 ttf-ms-fonts] package fixed this issue.<br />
* '''Theme/Icons:''' Your default icons and theme may not look right. Copy over your applicable folders from /usr/share/themes and /usr/share/icons and configure your chroot environment with those same themes/icons. I have noticed that even if Notes uses my proper cursor icon, it changes to an ugly basic one on certain links/buttons and am not sure how to fix this.<br />
* '''Mail Preview Pane Glitch:''' In either 8.5 or 8.5.1, I had issues with the mail preview pane locking up or creating multiple adjustment bars. I believe setting the option "Disable embedded browser for MIME email" was what fixed this issue.</div>Ownaginatioushttps://wiki.archlinux.org/index.php?title=Gerbera&diff=186216Gerbera2012-02-25T07:29:40Z<p>Ownaginatious: /* Hiding full paths from media players */</p>
<hr />
<div>[[Category:Daemons and system services (English)]] <!-- MediaTomb provides a daemon mode --><br />
[[Category:Audio/Video (English)]] <!-- stream your digital media; UPnP compatible devices --><br />
[[Category:Networking (English)]] <!-- stream through your home network --><br />
{{i18n|MediaTomb}}<br />
{{Article summary start}}<br />
{{Article summary text|An introduction to [http://mediatomb.cc/ MediaTomb], covering installation and basic configuration of the open source UPnP MediaServer.}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|Streaming media}}<br />
{{Article summary end}}<br />
<br />
From [http://mediatomb.cc/ MediaTomb - Free UPnP MediaServer]:<br />
<br />
:''MediaTomb is an open source (GPL) UPnP MediaServer with a nice web user interface, it allows you to stream your digital media through your home network and listen to/watch it on a variety of UPnP compatible devices.''<br />
<br />
MediaTomb enables users to stream digital media to UPnP compatible devices like the PlayStation 3 (the Xbox 360 is not yet supported). Several alternatives exist, such as [http://fuppes.ulrich-voelkel.de/ FUPPES], [http://code.google.com/p/ps3mediaserver/ ps3mediaserver], and [[uShare]]. One of MediaTomb's distinguishing features is the ability to customize the server layout based on extracted metadata (scriptable virtual containers); MediaTomb is highly flexible.<br />
<br />
== Installation ==<br />
<br />
MediaTomb is available in the [[AUR]] via {{AUR|mediatomb}}.<br />
<br />
The latest development version is also available in the [[AUR]] via {{AUR|mediatomb-svn}}.<br />
<br />
== Configuration ==<br />
<br />
The default settings may be sufficient for many users, though changes are required for PlayStation 3 support. MediaTomb may be configured and run per-user or as a system-wide daemon. Following installation, either run<br />
<br />
$ mediatomb<br />
<br />
to start MediaTomb as the current user and generate a default configuration in {{ic|~/.mediatomb/config.xml}}, or<br />
<br />
# rc.d start mediatomb<br />
<br />
to start the MediaTomb daemon and generate a default configuration in {{ic|/var/lib/mediatomb/.mediatomb/config.xml}}. The following notes assume MediaTomb is running as a system-wide daemon.<br />
<br />
For PlayStation 3 support, users must set {{Ic|<nowiki><protocolInfo extend="yes"/></nowiki>}}. An "avi" mimetype mapping should also be uncommented for DivX support.<br />
<br />
{{hc|/var/lib/mediatomb/.mediatomb/config.xml<br />
|2=<nowiki><br />
...<br />
<br />
<protocolInfo extend="yes"/><br />
<br />
...<br />
<br />
<map from="avi" to="video/divx"/><br />
<br />
...<br />
</nowiki>}}<br />
<br />
When importing media to the database, MediaTomb will create a virtual container layout as defined by the {{Ic|<nowiki><virtual-layout type="..."></nowiki>}} option. That is, media will be organized according to metadata (album, artist, etc.) through creation of virtual database objects. If your media is already organized on the file system, you may disable this feature to significantly improve import performance:<br />
<br />
{{hc|/var/lib/mediatomb/.mediatomb/config.xml<br />
|2=<nowiki><br />
...<br />
<br />
<virtual-layout type="disabled"><br />
<br />
...<br />
</nowiki>}}<br />
<br />
Users may customize the import script to fine-tune the virtual layout. The [http://mediatomb.cc/dokuwiki/scripting:scripting Scripting] section of the MediaTomb wiki provides several examples. Starting with the built-in script available at {{ic|/usr/share/mediatomb/js/import.js}}:<br />
<br />
$ cp /usr/share/mediatomb/js/import.js /var/lib/mediatomb/.mediatomb/<br />
<br />
... and edit {{ic|/var/lib/mediatomb/.mediatomb/import.js}} as desired. To utilize the customized script, users must set {{Ic|<nowiki><virtual-layout type="js"></nowiki>}} and specify the script's location.<br />
<br />
{{hc|/var/lib/mediatomb/.mediatomb/config.xml<br />
|2=<nowiki><br />
...<br />
<br />
<virtual-layout type="js"><br />
<import-script>/var/lib/mediatomb/.mediatomb/import.js</import-script><br />
</virtual-layout><br />
<br />
...<br />
</nowiki>}}<br />
<br />
You may have to specify an interface before MediaTomb will be recognized:<br />
<br />
{{hc|/var/lib/mediatomb/.mediatomb/config.xml<br />
|<nowiki><br />
<server><br />
...<br />
<interface>eth0</interface><br />
...<br />
</server><br />
</nowiki>}}<br />
<br />
... replacing eth0 with the interface you connect on.<br />
<br />
== Usage ==<br />
<br />
After configuring MediaTomb to your liking, restart the server by running<br />
<br />
# rc.d restart mediatomb<br />
<br />
The daemon listens on port 50500 by default. To access the web interface and begin importing media, navigate to http://127.0.0.1:50500/ in your favorite browser (JavaScript required).<br />
<br />
If running per-user instances of MediaTomb, the default port is 49152. However, it is possible that the port will change upon server restart. The URL for the web interface is output during startup. Users may also specify the port manually:<br />
<br />
$ mediatomb -p 50500<br />
<br />
== Hiding full paths from media players ==<br />
<br />
By default, full directory paths will be shown on devices when they are browsing through folders.<br />
<br />
For example, if you add the directory /media/my_media/video_data/videos/movies, anyone connecting will have to navigate to the 'movies' directory from the root.<br />
<br />
To hide all of that and only show the directory added, you can change the import script.<br />
<br />
For example, this script will automatically truncate the whole directory structure specified in the variable video_root. Any directories added directly under the video root path will show up on UPnP devices starting from the that folder rather than /.<br />
<br />
function addVideo(obj)<br />
{<br />
var video_root = "/media/main_core/Server_Core_Folder/FTP_Services/Media/";<br />
<br />
var absolute_path = obj.location;<br />
<br />
var relative_path = absolute_path;<br />
<br />
if(absolute_path.indexOf(video_root) == 0)<br />
relative_path = absolute_path.replace(video_root, "")<br />
<br />
var chain = new Array();<br />
<br />
var pathSplit = relative_path.split("/");<br />
<br />
for(var i = 0; i < pathSplit.length - 1; i++) <br />
chain.push(pathSplit[i]);<br />
<br />
addCdsObject(obj, createContainerChain(chain));<br />
}<br />
<br />
To also hide the default PC Directory folder from UPnP device directory listings, add the following directly under the server node of your config.xml file.<br />
<br />
<pc-directory upnp-hide="yes"/></div>Ownaginatioushttps://wiki.archlinux.org/index.php?title=Lenovo_ThinkPad_X120e&diff=185244Lenovo ThinkPad X120e2012-02-18T21:40:51Z<p>Ownaginatious: /* Video Drivers */</p>
<hr />
<div>[[Category:Lenovo (English)]]<br />
{{Article summary start}}<br />
{{Article summary text|Installation instructions for the Lenovo ThinkPad X120e}}<br />
{{Article summary heading|Related articles}}<br />
{{Article summary wiki|IBM ThinkPad X100e}}<br />
{{Article summary end}}<br />
<br />
=Install Notes=<br />
<br />
==Video Drivers==<br />
Users have the choice between the open source [[ATI]] video driver or the closed source [[Catalyst]] video driver.<br />
<br />
In order to use the open source driver you must have at least kernel 2.6.38.<br />
<br />
The open source ATI driver has flawless performance (including suspend). [[Gnome 3]] works well with the open source ATI driver. <br />
<br />
The Catalyst drivers do offer better 3D performance but usually have various minor issues (such as suspend support). As of kernel 3.2.6.2, suspend appears to work fine with this computer while using the catalyst drivers.<br />
<br />
==Wireless==<br />
The Thinkpad X120e can come with one of two wireless cards.<br />
*The Realtek BGN Wifi card currently is supported by [http://aur.archlinux.org/packages.php?ID=46797 rtl8192ce] from AUR.<br />
**The 2.6.38 kernel includes support for this card, but suffers from intermittent hard locks when associating with an access point. The AUR driver linked here does not suffer from this problem. (The Ubuntu folks seem to have the [https://bugs.launchpad.net/ubuntu/+source/linux/+bug/769812 same issue] with the x120e and the module included in the kernel.)<br />
*The Broadcom ABGN Wifi card is currently supported by [http://aur.archlinux.org/packages.php?ID=19514 broadcom-wl] from AUR. See the [https://wiki.archlinux.org/index.php/Broadcom_wireless Broadcom wireless] wiki page for more info.<br />
<br />
==Audio==<br />
The kernel modules work, but the HDMI audio is the primary device (not the speaker). You can swap that:<br />
<br />
{{hc|$ cat ~/.asoundrc|<br />
pcm.!default {<br />
type hw<br />
card 1<br />
}<br />
<br />
ctl.!default {<br />
type hw <br />
card 1<br />
}<br />
}}<br />
<br />
Note: Alternatively, you can accomplish the same thing by configuring the snd-hda-intel module:<br />
<br />
{{hc|$ grep snd-hda-intel /etc/modprobe.d/modprobe.conf|2=options snd-hda-intel index=1}}<br />
<br />
By specifying index you no longer have to specify the default in .asoundrc<br />
<br />
==Input==<br />
===TrackPoint Scrolling (wheel emulation)===<br />
To enable scrolling with the TrackPoint while holding down the middle mouse button, create a new file /etc/X11/xorg.conf.d/20-thinkpad.conf with the following content:<br />
<br />
Section "InputClass"<br />
Identifier "Trackpoint Wheel Emulation"<br />
MatchProduct "TPPS/2 IBM TrackPoint|DualPoint Stick|Synaptics Inc. Composite TouchPad / TrackPoint|ThinkPad USB Keyboard with TrackPoint|USB Trackpoint pointing device"<br />
MatchDevicePath "/dev/input/event*"<br />
Option "EmulateWheel" "true"<br />
Option "EmulateWheelButton" "2"<br />
Option "Emulate3Buttons" "false"<br />
Option "XAxisMapping" "6 7"<br />
Option "YAxisMapping" "4 5"<br />
EndSection<br />
<br />
There are more details about how this works on the [[Xorg#InputClasses|Xorg]] page.<br />
===Disabling the TrackPad===<br />
If you try to use your x120e lying down you will notice its very easy to hit the TrackPad buttons and invert the functionality of the other inputs(fun).<br />
<br />
To disable the buttons and pad add the following to /etc/X11/xorg.conf.d/10-synaptic.conf:<br />
Section "InputClass"<br />
Identifier "Synaptics Touchpad"<br />
Driver "synaptics"<br />
Option "SendCoreEvents" "true"<br />
Option "Device" "/dev/psaux"<br />
Option "Protocol" "auto-dev"<br />
Option "HorizScrollDelta" "0"<br />
Option "SHMConfig" "on"<br />
EndSection<br />
<br />
And install the synaptics driver from extra:<br />
# pacman -S xf86-input-synaptics<br />
<br />
You can now toggle the TrackPads functionality using the synclient utility:<br />
$ synclient TouchpadOff=0 ; enables<br />
$ synclient TouchpadOff=1 ; disables<br />
<br />
If you want this to be permanent add the option to your Xorg config:<br />
Option "TouchpadOff" "1"<br />
<br />
==Power Management==<br />
===Enable Thinkpad ACPI===<br />
To have the thinkpad_acpi module load everytime at bootup add it to MODULES=() in /etc/rc.conf<br />
<br />
This module allows you to see and control various aspects of your Thinkpad from /proc/acpi/ibm<br />
<br />
===Disable Bluetooth===<br />
{{Note| You must first have the thinkpad_acpi kernel module loaded}}<br />
To save some power you can disable Bluetooth:<br />
echo "disable" > /proc/acpi/ibm/bluetooth<br />
If you want to disable Bluetooth at every boot just add that line to /etc/rc.local<br />
<br />
===CPU Scaling===<br />
To enable dynamic [[CPU Frequency Scaling]] first add powernow-k8 to MODULES=() in /etc/rc.conf<br />
Next add the following to /etc/rc.local:<br />
echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor<br />
echo ondemand > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor<br />
If you wish to have the ondemand governor ignore niced (background) processes when deciding whether to increase CPU speed:<br />
echo 1 > /sys/devices/system/cpu/cpufreq/ondemand/ignore_nice_load<br />
<br />
===ATI Video card Powersaving===<br />
Under the opensource ATI video card driver you can control the clockspeed of the GPU.<br />
The recommended setting is:<br />
echo dynpm > /sys/class/drm/card0/device/power_method<br />
This enables dynamic frequency switching based off of GPU load.<br />
Further information on this topic can be found in [[ATI#Powersaving]].<br />
<br />
===SATA Power Policy===<br />
echo min_power > /sys/class/scsi_host/host0/link_power_management_policy<br />
Will tell hard drive to minimize power use.<br />
<br />
===Sound card Powersaving===<br />
Because the sound card in the X120e isn't actually an Intel card (even though it uses the Intel HDA driver) I'm not sure if this actually does anything. Doesn't seem to cause any problems though.<br />
echo 1 > /sys/module/snd_hda_intel/parameters/power_save<br />
<br />
===CPU Undervolting===<br />
{{Warning|Undervolting can lead to instability and consequently data loss, only you are responsible if you break something}} <br />
The Fusion Processor can be undervolted with the PHC-K8 tool. See [[PHC]] for usage information. For the AMD Fusion you'll want to download [http://aur.archlinux.org/packages.php?ID=22953 phc-k8] from AUR.<br />
{{Note|In order to lower CPU power usage you must actually raise the PHC values. (somewhat counter-intuitive)}}<br />
"24 26 52" is what I have my E-350 set to. The three numbers represent 1600mhz, 1200mhz and 800mhz.<br />
{{Warning|The three values listed above are stable on MY processor. Due to variables during production, you're chip may be able to be undervolted more or LESS. Feel free to post the stable values that you reach to this wiki.}}<br />
<br />
===Fan Control===<br />
The X120e's fan spins constantly but luckily can be controlled by the user.<br />
{{Warning|Modify fan settings at your own risk, only you are responsible if you toast your laptop or your lap.}}<br />
{{Note|Even with undervolting the APU produces enough heat to have to occasionally run the fan even at idle.}}<br />
<br />
To enable manual fan control place the following into /etc/modprobe.d/modprobe.conf<br />
options thinkpad_acpi fan_control=1<br />
<br />
At this point the fan will still be safely under the system's control. You can either directly modify the values in /proc/acpi/ibm (NOT RECOMMENDED) or install a fan control daemon such as [[http://aur.archlinux.org/packages.php?ID=24359 thinkfan]].<br />
<br />
==External Resources==<br />
[http://www.thinkwiki.org/wiki/Category:X120e X120e on ThinkWiki]<br />
<br />
[http://www.linux-phc.org/forum/viewtopic.php?f=7&t=269 Undervolting the AMD Fusion with PHC-tool]</div>Ownaginatioushttps://wiki.archlinux.org/index.php?title=Gerbera&diff=183060Gerbera2012-02-11T01:12:14Z<p>Ownaginatious: </p>
<hr />
<div>[[Category:Daemons and system services (English)]] <!-- MediaTomb provides a daemon mode --><br />
[[Category:Audio/Video (English)]] <!-- stream your digital media; UPnP compatible devices --><br />
[[Category:Networking (English)]] <!-- stream through your home network --><br />
{{i18n|MediaTomb}}<br />
{{Article summary start}}<br />
{{Article summary text|An introduction to [http://mediatomb.cc/ MediaTomb], covering installation and basic configuration of the open source UPnP MediaServer.}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|Streaming media}}<br />
{{Article summary end}}<br />
<br />
From [http://mediatomb.cc/ MediaTomb - Free UPnP MediaServer]:<br />
<br />
:''MediaTomb is an open source (GPL) UPnP MediaServer with a nice web user interface, it allows you to stream your digital media through your home network and listen to/watch it on a variety of UPnP compatible devices.''<br />
<br />
MediaTomb enables users to stream digital media to UPnP compatible devices like the PlayStation 3 (the Xbox 360 is not yet supported). Several alternatives exist, such as [http://fuppes.ulrich-voelkel.de/ FUPPES], [http://code.google.com/p/ps3mediaserver/ ps3mediaserver], and [[uShare]]. One of MediaTomb's distinguishing features is the ability to customize the server layout based on extracted metadata (scriptable virtual containers); MediaTomb is highly flexible.<br />
<br />
== Installation ==<br />
<br />
MediaTomb is available in the [[AUR]] via {{AUR|mediatomb}}.<br />
<br />
The latest development version is also available in the [[AUR]] via {{AUR|mediatomb-svn}}.<br />
<br />
== Configuration ==<br />
<br />
The default settings may be sufficient for many users, though changes are required for PlayStation 3 support. MediaTomb may be configured and run per-user or as a system-wide daemon. Following installation, either run<br />
<br />
$ mediatomb<br />
<br />
to start MediaTomb as the current user and generate a default configuration in {{ic|~/.mediatomb/config.xml}}, or<br />
<br />
# rc.d start mediatomb<br />
<br />
to start the MediaTomb daemon and generate a default configuration in {{ic|/var/lib/mediatomb/.mediatomb/config.xml}}. The following notes assume MediaTomb is running as a system-wide daemon.<br />
<br />
For PlayStation 3 support, users must set {{Ic|<nowiki><protocolInfo extend="yes"/></nowiki>}}. An "avi" mimetype mapping should also be uncommented for DivX support.<br />
<br />
{{hc|/var/lib/mediatomb/.mediatomb/config.xml<br />
|2=<nowiki><br />
...<br />
<br />
<protocolInfo extend="yes"/><br />
<br />
...<br />
<br />
<map from="avi" to="video/divx"/><br />
<br />
...<br />
</nowiki>}}<br />
<br />
When importing media to the database, MediaTomb will create a virtual container layout as defined by the {{Ic|<nowiki><virtual-layout type="..."></nowiki>}} option. That is, media will be organized according to metadata (album, artist, etc.) through creation of virtual database objects. If your media is already organized on the file system, you may disable this feature to significantly improve import performance:<br />
<br />
{{hc|/var/lib/mediatomb/.mediatomb/config.xml<br />
|2=<nowiki><br />
...<br />
<br />
<virtual-layout type="disabled"><br />
<br />
...<br />
</nowiki>}}<br />
<br />
Users may customize the import script to fine-tune the virtual layout. The [http://mediatomb.cc/dokuwiki/scripting:scripting Scripting] section of the MediaTomb wiki provides several examples. Starting with the built-in script available at {{ic|/usr/share/mediatomb/js/import.js}}:<br />
<br />
$ cp /usr/share/mediatomb/js/import.js /var/lib/mediatomb/.mediatomb/<br />
<br />
... and edit {{ic|/var/lib/mediatomb/.mediatomb/import.js}} as desired. To utilize the customized script, users must set {{Ic|<nowiki><virtual-layout type="js"></nowiki>}} and specify the script's location.<br />
<br />
{{hc|/var/lib/mediatomb/.mediatomb/config.xml<br />
|2=<nowiki><br />
...<br />
<br />
<virtual-layout type="js"><br />
<import-script>/var/lib/mediatomb/.mediatomb/import.js</import-script><br />
</virtual-layout><br />
<br />
...<br />
</nowiki>}}<br />
<br />
You may have to specify an interface before MediaTomb will be recognized:<br />
<br />
{{hc|/var/lib/mediatomb/.mediatomb/config.xml<br />
|<nowiki><br />
<server><br />
...<br />
<interface>eth0</interface><br />
...<br />
</server><br />
</nowiki>}}<br />
<br />
... replacing eth0 with the interface you connect on.<br />
<br />
== Usage ==<br />
<br />
After configuring MediaTomb to your liking, restart the server by running<br />
<br />
# rc.d restart mediatomb<br />
<br />
The daemon listens on port 50500 by default. To access the web interface and begin importing media, navigate to http://127.0.0.1:50500/ in your favorite browser (JavaScript required).<br />
<br />
If running per-user instances of MediaTomb, the default port is 49152. However, it is possible that the port will change upon server restart. The URL for the web interface is output during startup. Users may also specify the port manually:<br />
<br />
$ mediatomb -p 50500<br />
<br />
== Hiding full paths from media players ==<br />
<br />
By default, full directory paths will be shown on devices when they are browsing through folders.<br />
<br />
For example, if you add the directory /media/my_media/video_data/videos/movies, anyone connecting will have to navigate to the 'movies' directory from the root.<br />
<br />
To hide all of that and only show the directory added, add the following to your config.xml file as a child of the server node.<br />
<br />
<pc-directory upnp-hide="yes"/></div>Ownaginatioushttps://wiki.archlinux.org/index.php?title=Gerbera&diff=183059Gerbera2012-02-11T00:57:00Z<p>Ownaginatious: /* Configuration */</p>
<hr />
<div>[[Category:Daemons and system services (English)]] <!-- MediaTomb provides a daemon mode --><br />
[[Category:Audio/Video (English)]] <!-- stream your digital media; UPnP compatible devices --><br />
[[Category:Networking (English)]] <!-- stream through your home network --><br />
{{i18n|MediaTomb}}<br />
{{Article summary start}}<br />
{{Article summary text|An introduction to [http://mediatomb.cc/ MediaTomb], covering installation and basic configuration of the open source UPnP MediaServer.}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|Streaming media}}<br />
{{Article summary end}}<br />
<br />
From [http://mediatomb.cc/ MediaTomb - Free UPnP MediaServer]:<br />
<br />
:''MediaTomb is an open source (GPL) UPnP MediaServer with a nice web user interface, it allows you to stream your digital media through your home network and listen to/watch it on a variety of UPnP compatible devices.''<br />
<br />
MediaTomb enables users to stream digital media to UPnP compatible devices like the PlayStation 3 (the Xbox 360 is not yet supported). Several alternatives exist, such as [http://fuppes.ulrich-voelkel.de/ FUPPES], [http://code.google.com/p/ps3mediaserver/ ps3mediaserver], and [[uShare]]. One of MediaTomb's distinguishing features is the ability to customize the server layout based on extracted metadata (scriptable virtual containers); MediaTomb is highly flexible.<br />
<br />
== Installation ==<br />
<br />
MediaTomb is available in the [[AUR]] via {{AUR|mediatomb}}.<br />
<br />
The latest development version is also available in the [[AUR]] via {{AUR|mediatomb-svn}}.<br />
<br />
== Configuration ==<br />
<br />
The default settings may be sufficient for many users, though changes are required for PlayStation 3 support. MediaTomb may be configured and run per-user or as a system-wide daemon. Following installation, either run<br />
<br />
$ mediatomb<br />
<br />
to start MediaTomb as the current user and generate a default configuration in {{ic|~/.mediatomb/config.xml}}, or<br />
<br />
# rc.d start mediatomb<br />
<br />
to start the MediaTomb daemon and generate a default configuration in {{ic|/var/lib/mediatomb/.mediatomb/config.xml}}. The following notes assume MediaTomb is running as a system-wide daemon.<br />
<br />
For PlayStation 3 support, users must set {{Ic|<nowiki><protocolInfo extend="yes"/></nowiki>}}. An "avi" mimetype mapping should also be uncommented for DivX support.<br />
<br />
{{hc|/var/lib/mediatomb/.mediatomb/config.xml<br />
|2=<nowiki><br />
...<br />
<br />
<protocolInfo extend="yes"/><br />
<br />
...<br />
<br />
<map from="avi" to="video/divx"/><br />
<br />
...<br />
</nowiki>}}<br />
<br />
When importing media to the database, MediaTomb will create a virtual container layout as defined by the {{Ic|<nowiki><virtual-layout type="..."></nowiki>}} option. That is, media will be organized according to metadata (album, artist, etc.) through creation of virtual database objects. If your media is already organized on the file system, you may disable this feature to significantly improve import performance:<br />
<br />
{{hc|/var/lib/mediatomb/.mediatomb/config.xml<br />
|2=<nowiki><br />
...<br />
<br />
<virtual-layout type="disabled"><br />
<br />
...<br />
</nowiki>}}<br />
<br />
Users may customize the import script to fine-tune the virtual layout. The [http://mediatomb.cc/dokuwiki/scripting:scripting Scripting] section of the MediaTomb wiki provides several examples. Starting with the built-in script available at {{ic|/usr/share/mediatomb/js/import.js}}:<br />
<br />
$ cp /usr/share/mediatomb/js/import.js /var/lib/mediatomb/.mediatomb/<br />
<br />
... and edit {{ic|/var/lib/mediatomb/.mediatomb/import.js}} as desired. To utilize the customized script, users must set {{Ic|<nowiki><virtual-layout type="js"></nowiki>}} and specify the script's location.<br />
<br />
{{hc|/var/lib/mediatomb/.mediatomb/config.xml<br />
|2=<nowiki><br />
...<br />
<br />
<virtual-layout type="js"><br />
<import-script>/var/lib/mediatomb/.mediatomb/import.js</import-script><br />
</virtual-layout><br />
<br />
...<br />
</nowiki>}}<br />
<br />
You may have to specify an interface before MediaTomb will be recognized:<br />
<br />
{{hc|/var/lib/mediatomb/.mediatomb/config.xml<br />
|<nowiki><br />
<server><br />
...<br />
<interface>eth0</interface><br />
...<br />
</server><br />
</nowiki>}}<br />
<br />
... replacing eth0 with the interface you connect on.<br />
<br />
== Usage ==<br />
<br />
After configuring MediaTomb to your liking, restart the server by running<br />
<br />
# rc.d restart mediatomb<br />
<br />
The daemon listens on port 50500 by default. To access the web interface and begin importing media, navigate to http://127.0.0.1:50500/ in your favorite browser (JavaScript required).<br />
<br />
If running per-user instances of MediaTomb, the default port is 49152. However, it is possible that the port will change upon server restart. The URL for the web interface is output during startup. Users may also specify the port manually:<br />
<br />
$ mediatomb -p 50500</div>Ownaginatioushttps://wiki.archlinux.org/index.php?title=Lotus_Notes_in_32bit_Chroot&diff=167366Lotus Notes in 32bit Chroot2011-10-25T04:05:00Z<p>Ownaginatious: /* Installing Lotus Notes */</p>
<hr />
<div>[[Category:Arch64 (English)]]<br />
[[Category:Email Client (English)]]<br />
[[Category:Internet Applications (English)]]<br />
<br />
IBM Lotus Notes does not have a native 64bit package to date. This article will discuss the installation of Lotus Notes on 64 bit Arch Linux inside a 32bit chroot environment. This method will use the rpm versions of the Notes packages; .deb files are available but the author has not tried them.<br />
<br />
<br />
==Introduction==<br />
Lotus Notes is an email, calendaring, todo, notetaking, and collaboration application developed by IBM. It is used most commonly in corporate settings as it contains fairly powerful features that surpass those offered by more traditional email/calendar applications like Outlook or Thunderbird. Specifically, Lotus Notes features database functionality that allows for the storage of user input from various forms (e.g. surveys). While the email and scheduling functionality is quite similar to that of other applications in this family, the database functionality is difficult to understand without firsthand use.<br />
<br />
For those who use Linux in a corporate setting in which Lotus Notes is the default client, installation of this application is a necessity. While this is trivial on 32bit systems (such as Arch 686), Lotus Notes has not yet been released for 64bit Linux. As this is the case, those using Arch64 will need to install Notes inside a 32bit chroot. It may be possible to use a multi-lib setup, but the author of this article has no experience with that method and from his reading considers the chroot environment to be cleaner and simpler (easier to start over or remove altogether if functionality is no longer needed).<br />
<br />
<br />
==Obtaining Lotus Notes and FixPacks==<br />
You will at least need a Lotus Notes rpm package. The FixPacks that IBM releases are also recommended. The main author of this entry has experience with Notes 8.0 and 8.5[.1 and .2] on 64bit Arch.<br />
<br />
{{Note| The IBM site can be confusing. For almost all downloads, multiple languages, versions, and OS choices are available. Make sure you download files with the following characteristics:<br />
* For Lotus Notes ''Client'' and ''not'' for Domino. Notes is the email/calendar client; Domino is the server application<br />
* For Linux (obvious) for rpm install (not deb)}}<br />
<br />
<br />
===Obtaining Lotus Notes===<br />
* If you have a corporate ID with IBM, you may use the [http://www-01.ibm.com/software/lotus/products/notes/ IBM Lotus Notes site] for official download<br />
* Optionally, visit the [http://www14.software.ibm.com/webapp/download/search.jsp?pn=Lotus+Notes IBM Lotus Notes Trials site] for free trial versions that expire after 90 days<br />
* You may also contact your company administrator for a copy of Lotus Notes for Linux<br />
<br />
The trials provided change frequently. For example, as of 10-21-2010, trials of both 8.5 and 8.5.2 were available. As of 03-07-2011, only 8.5.2 is available. Check the [http://www14.software.ibm.com/webapp/download/search.jsp?pn=Lotus+Notes Lotus Notes trials page] frequently:<br />
<br />
===Downloading FixPacks===<br />
* Visit the [http://www-933.ibm.com/support/fixcentral/ IBM Fix Central site] to find FixPacks<br />
* Input Product Group=Lotus, Product=Lotus Notes, the version you have, and Platform=Linux for the four fields<br />
* At the next page click Continue at the bottom of the page to see all possible FixPacks<br />
* Download the correct one<br />
<br />
If you are using Lotus Notes 8.5.1, there is a [http://www-01.ibm.com/support/docview.wss?uid=swg24025721 dedicated page] for incremental FixPack installers. There are currently 5 FixPacks released (as of 03-07-20110. Just download Notes_851FP5_Standard_RPMInstall_Linux (5th FixPack, rpm format for Linux) since each FixPack encompasses the previous versions. The page for the 8.5.2 fixpack is [https://www-304.ibm.com/support/docview.wss?uid=swg24028680 here].<br />
<br />
<br />
==Create 32bit Chroot (x86_64)==<br />
''If using i686, skip to [[#Installing Dependencies]]''<br />
<br />
The Arch Wiki already has a fantastic article on creating a 32bit chroot environment on a 64bit system: [[Install_bundled_32-bit_system_in_Arch64]]. Use the instructions there to do the following:<br />
* Create /opt/arch32, setup pacamn, and sync<br />
* Install base and base-devel<br />
* Create the arch32 daemon script<br />
* Link/copy the necessary files in /etc from the 64bit system to the chroot<br />
* Start the daemon<br />
<br />
===Important steps to remember===<br />
Having been through this process many, many times, there are some steps that are quite common to forget. Please remember to:<br />
* run the xhost command after starting the daemon:<br />
xhost +SI:localuser:usernametogiveaccesstogoeshere<br />
* chroot into /opt/arch32 with:<br />
# linux32 chroot /opt/arch32<br />
* edit your /etc/pacman.conf (from the chroot; the actual location is /opt/arch32/etc/pacman.conf)<br />
** uncomment at least one mirror<br />
** also, edit the line at the top of /etc/pacman.conf from:<br />
Architecture = auto<br />
to:<br />
Architecture = i686<br />
* Be sure to uncomment a mirror in /etc/pacman.d/mirrorlist as well<br />
* sync pacman to ensure that everything is working properly:<br />
# pacman -Syy<br />
* lastly, run this to generate your locale files:<br />
# locale-gen<br />
<br />
<br />
==Installing Dependencies==<br />
IBM has published a list of [http://www-01.ibm.com/support/docview.wss?uid=swg27013074 System Requirements] as well as a list of [http://www-01.ibm.com/support/docview.wss?&uid=swg27013076 Linux Packages] that are required to run Lotus Notes. When attempting to install an rpm on a non-rpm based distro, rpm will also complain about missing packages if the --nodeps option is not provided. IBM's list and the errors from an rpm attempt were used by the author of this article (by repeatedly running 'pacman -Qo filename') to painstakingly generate a minimum list of packages that would pull in all of the Lotus Notes dependencies. The list below are the "top level" packages, and will pull all the rest along with them. Run this ''from the chroot'':<br />
<br />
# pacman -S gdb tcsh libart-lgpl alsa-lib atk libbonobo libbonoboui gconf gtk2 libgnome libgnomecanvas libgnomeprint \<br />
libgnomeprintui libgnomeui gvfs libice libjpeg orbit2 pango libpng libsm libx11 libxcursor libxext libxft libxi libxkbfile libxml2 \<br />
libxrender libxss libxt libxtst font-bh-ttf audiofile esound gnome-menus libgail-gnome startup-notification gnome-desktop \<br />
gtk-xfce-engine xterm<br />
<br />
{{Note|xterm is only required to get through the license agreement. When you run Notes for the first time, an xterm window will ask you to accept the license agreement. Once you do this and setup your Lotus Notes account, you can remove xterm if you wish.}}<br />
<br />
<br />
==Installing Lotus Notes==<br />
While still in the chroot environment, do the following:<br />
* unpack the tar file you downloaded (fictional file name, use whatever you have):<br />
$ tar -xvf /path/to/ibm_lotus_notes-8.5.2.tar<br />
This should unpack the following:<br />
* ibm_lotus_activities-8.5.2.i586.rpm<br />
* ibm_lotus_cae-8.5.2.i586.rpm<br />
* ibm_lotus_feedreader-8.5.2.i586.rpm<br />
* ibm_lotus_notes-8.5.2.i586.rpm<br />
* ibm_lotus_sametime-8.5.2.i586.rpm<br />
* ibm_lotus_symphony-8.5.2.i586.rpm<br />
* license.tar<br />
* pub_ibm_lotus_notes.gpg<br />
* smartupgrade.sh<br />
<br />
Ensure that your archive package is accessible from within your 32-bit chrooted environment. If you followed all the instructions in the previous document about creating a 32-bit environment within arch, particularly up to linking file/folders, a link to your home folder will exist in the /opt/arch32 folder. If you downloaded lotus notes off of a website in the 64-bit environment, there is a good chance it will exist in your download folder within your home folder in the 32-bit environment as well.<br />
<br />
Now install the lotus notes RPM using the following command (Note: You may need to have [http://aur.archlinux.org/packages.php?ID=30317 rpm-org] installed from the AUR):<br />
# rpm -ivh --nodeps ibm_lotus_notes-8.5.2.i586.rpm<br />
<br />
When that completes, you may install any fixpacks with:<br />
# rpm --ivh --nodeps ibm_lotus_notes_fixpack-8.5.2.i586.rpm<br />
<br />
Now run Lotus Notes for the first time with:<br />
$ /opt/ibm/lotus/notes/notes<br />
<br />
Note: To run the above command, you must not be root. If you installed as root, switch back to your user account with:<br />
# su username<br />
<br />
A splash screen should appear, shortly followed by an xterm window asking you to accept the license agreement. Type "1" (the digit, one) and then press enter. Lotus Notes should prompt its configuration screen and ask you for your name, server, user.id file, etc. When this completes, it will bring you to the Lotus Notes interface and you can revel in your accomplishment!<br />
<br />
You can repeat the above process with any of the other RPM files included in the bundle if you would like as well (sametime, symphony, cae, activities, etc.). Perhaps archive the original tar file somewhere in case you need it again, and then delete the unpacked files you do not need/want.<br />
<br />
===Creating a shortcut===<br />
Now it is not unlikely that you will quickly get tired of monotonously using chroot and entering a long path every time you want to start notes. Fortunately, creating a seamless shortcut in your 64-bit environment is easy.<br />
<br />
If you installed schroot, as mentioned in the article about creating a 32-bit environment within arch, you can place an extensionless shell script titled 'notes' into /usr/bin containing the following:<br />
<br />
schroot -- /opt/ibm/lotus/notes/notes<br />
<br />
Ensure that you are listed as one of the users who can use schroot at the bottom of the /etc/schroot/schroot.conf file by uncommenting and adding your username to the 'Users' segment.<br />
<br />
You should now be able to start notes by typing 'notes' and hitting enter in the terminal.<br />
<br />
===Installing on a 32bit System===<br />
I'm not sure why this is even covered because it's so simple, but just to have a mention of this somewhere in the Arch Wiki, just follow the procedure above for installation of the rpms. The additional reference this should provide is a list of required packages above, which I have not seen elsewhere. Hopefully this helps. The next section on troubleshooting should help as well.<br />
<br />
===Additional Steps on 8.5[.1]===<br />
If you are running 8.5 or 8.5.1, you may need to replace some libraries. This was mentioned several times in the IBM Developer forums in Ubuntu how-tos. One site that references it, along with two sources for these libraries is [http://metkhoo.blogspot.com/2010/03/notes-851-on-ubuntu-910-karmic-x64.html here]<br />
<br />
===Troubleshooting===<br />
* '''Notes on Gnome 3 Compatibility:''' Recently, gtk and Gnome related libraries underwent a transition to version 3. This caused a severe breakage in Lotus Notes. Reverting to gtk2/Gnome 2 libraries fixed things temporarily. A [http://www-10.lotus.com/ldd/nd85forum.nsf/dba3ca7e515d55ff85256a0700727b35/73442d4c703d8eb885257886006acb41?OpenDocument post was made to the IBM Notes community] which suggested the [http://usablesoftware.wordpress.com/2011/04/27/getting-lotus-notes-8-5-2-working-in-ubuntu-natty-narwhal-64-bit/ fix presented on this blog]. In summary, the fix suggests the following:<br />
** Download tar.gz from https://github.com/sgh/lotus-notes_gtk2.23.3 and extract<br />
** Edit the Makefile, inserting -m32 so that it reads: "gcc -Wall -Wextra -m32 `pkg-config..."<br />
** Compile by running "make"<br />
** Copy both libnotesgtkfix.so and notes-wrapper to /opt/ibm/lotus/notes/<br />
** From now on, to start Lotus Notes, run /opt/ibm/lotus/notes/notes-wrapper (instead of /opt/ibm/lotus/notes/notes, as before)<br />
<br />
* Recently on a fresh install of Arch and a fresh chroot, I could not get Lotus Notes even put up the xterm window for license acceptance, and in looking at the logs in ~/lotus/notes/data/workspace/logs noticed the error-log was complaining about the file in /opt/ibm/lotus/notes/framework/rcp/plugin_customization.ini. The error was about proper permissions. I chmodded did the following:<br />
<br />
# chmod 755 /opt/ibm/lotus/notes/framework/rcp/plugin_customization.ini<br />
# chown username:users /opt/ibm/lotus/notes/framework/rcp/plugin_customization.ini<br />
<br />
* Typically, after the license agreement step, Lotus Notes immediately brings up the configuration setup process. The last time I installed 8.5.2 from a scratch system/chroot, however, this was not happening. I got a license agreement page but nothing else. In looking at the output of top, the notes2 process would just vanish. In a fluke attempt, I just ran /opt/ibm/lotues/notes again... and it went right to the configuration process. I had several additional packages installed, but wiped out ~/lotus, removed them all, and re-tried and can reproduce the behavior. If you got a license agreement but nothing more, perhaps try to run Notes again.<br />
<br />
* In my last fresh install, I had issues using rpm on the 8.5.2 fixpack as well as with trying to remove Lotus Notes 8.5.2 (not that you'd want to, but I wanted to know why the fixpack was not working). I received errors like this for the fixpack:<br />
%pre scriptlet failed error status: 85<br />
and when trying to remove Lotus Notes with 'rpm -ev --nodeps pkd' I got:<br />
glibc detected **Double Linked List**<br />
For some reason, using the aur package [http://aur.archlinux.org/packages.php?ID=30317 rpm-org] worked perfectly for both installation and trial removal of Lotus Notes 8.5.2, and installation of the 8.5.2 fixpack. While perhaps not the "best" method, to clean up everything after uninstalling rpm and installing rpm-org, I ran (from the chroot):<br />
# pacman -Rsc rpm<br />
# rm -r /var/lib/rpm<br />
# rm -r /opt/ibm<br />
Then I proceeded to install rpm-org with yaourt and repeated the steps above to install Lotus Notes and the fixpack.<br />
<br />
==Post Install==<br />
* '''Fonts:''' As included above in the dependencies list, make sure you have the font-bh-ttf package installed. One user has reported that this was still producing ugly fonts. He has since confirmed that installing the [http://aur.archlinux.org/packages.php?ID=13030 ttf-ms-fonts] package fixed this issue.<br />
* '''Theme/Icons:''' Your default icons and theme may not look right. Copy over your applicable folders from /usr/share/themes and /usr/share/icons and configure your chroot environment with those same themes/icons. I have noticed that even if Notes uses my proper cursor icon, it changes to an ugly basic one on certain links/buttons and am not sure how to fix this.<br />
* '''Mail Preview Pane Glitch:''' In either 8.5 or 8.5.1, I had issues with the mail preview pane locking up or creating multiple adjustment bars. I believe setting the option "Disable embedded browser for MIME email" was what fixed this issue.</div>Ownaginatioushttps://wiki.archlinux.org/index.php?title=Lotus_Notes_in_32bit_Chroot&diff=167365Lotus Notes in 32bit Chroot2011-10-25T04:03:36Z<p>Ownaginatious: /* Creating a shortcut */</p>
<hr />
<div>[[Category:Arch64 (English)]]<br />
[[Category:Email Client (English)]]<br />
[[Category:Internet Applications (English)]]<br />
<br />
IBM Lotus Notes does not have a native 64bit package to date. This article will discuss the installation of Lotus Notes on 64 bit Arch Linux inside a 32bit chroot environment. This method will use the rpm versions of the Notes packages; .deb files are available but the author has not tried them.<br />
<br />
<br />
==Introduction==<br />
Lotus Notes is an email, calendaring, todo, notetaking, and collaboration application developed by IBM. It is used most commonly in corporate settings as it contains fairly powerful features that surpass those offered by more traditional email/calendar applications like Outlook or Thunderbird. Specifically, Lotus Notes features database functionality that allows for the storage of user input from various forms (e.g. surveys). While the email and scheduling functionality is quite similar to that of other applications in this family, the database functionality is difficult to understand without firsthand use.<br />
<br />
For those who use Linux in a corporate setting in which Lotus Notes is the default client, installation of this application is a necessity. While this is trivial on 32bit systems (such as Arch 686), Lotus Notes has not yet been released for 64bit Linux. As this is the case, those using Arch64 will need to install Notes inside a 32bit chroot. It may be possible to use a multi-lib setup, but the author of this article has no experience with that method and from his reading considers the chroot environment to be cleaner and simpler (easier to start over or remove altogether if functionality is no longer needed).<br />
<br />
<br />
==Obtaining Lotus Notes and FixPacks==<br />
You will at least need a Lotus Notes rpm package. The FixPacks that IBM releases are also recommended. The main author of this entry has experience with Notes 8.0 and 8.5[.1 and .2] on 64bit Arch.<br />
<br />
{{Note| The IBM site can be confusing. For almost all downloads, multiple languages, versions, and OS choices are available. Make sure you download files with the following characteristics:<br />
* For Lotus Notes ''Client'' and ''not'' for Domino. Notes is the email/calendar client; Domino is the server application<br />
* For Linux (obvious) for rpm install (not deb)}}<br />
<br />
<br />
===Obtaining Lotus Notes===<br />
* If you have a corporate ID with IBM, you may use the [http://www-01.ibm.com/software/lotus/products/notes/ IBM Lotus Notes site] for official download<br />
* Optionally, visit the [http://www14.software.ibm.com/webapp/download/search.jsp?pn=Lotus+Notes IBM Lotus Notes Trials site] for free trial versions that expire after 90 days<br />
* You may also contact your company administrator for a copy of Lotus Notes for Linux<br />
<br />
The trials provided change frequently. For example, as of 10-21-2010, trials of both 8.5 and 8.5.2 were available. As of 03-07-2011, only 8.5.2 is available. Check the [http://www14.software.ibm.com/webapp/download/search.jsp?pn=Lotus+Notes Lotus Notes trials page] frequently:<br />
<br />
===Downloading FixPacks===<br />
* Visit the [http://www-933.ibm.com/support/fixcentral/ IBM Fix Central site] to find FixPacks<br />
* Input Product Group=Lotus, Product=Lotus Notes, the version you have, and Platform=Linux for the four fields<br />
* At the next page click Continue at the bottom of the page to see all possible FixPacks<br />
* Download the correct one<br />
<br />
If you are using Lotus Notes 8.5.1, there is a [http://www-01.ibm.com/support/docview.wss?uid=swg24025721 dedicated page] for incremental FixPack installers. There are currently 5 FixPacks released (as of 03-07-20110. Just download Notes_851FP5_Standard_RPMInstall_Linux (5th FixPack, rpm format for Linux) since each FixPack encompasses the previous versions. The page for the 8.5.2 fixpack is [https://www-304.ibm.com/support/docview.wss?uid=swg24028680 here].<br />
<br />
<br />
==Create 32bit Chroot (x86_64)==<br />
''If using i686, skip to [[#Installing Dependencies]]''<br />
<br />
The Arch Wiki already has a fantastic article on creating a 32bit chroot environment on a 64bit system: [[Install_bundled_32-bit_system_in_Arch64]]. Use the instructions there to do the following:<br />
* Create /opt/arch32, setup pacamn, and sync<br />
* Install base and base-devel<br />
* Create the arch32 daemon script<br />
* Link/copy the necessary files in /etc from the 64bit system to the chroot<br />
* Start the daemon<br />
<br />
===Important steps to remember===<br />
Having been through this process many, many times, there are some steps that are quite common to forget. Please remember to:<br />
* run the xhost command after starting the daemon:<br />
xhost +SI:localuser:usernametogiveaccesstogoeshere<br />
* chroot into /opt/arch32 with:<br />
# linux32 chroot /opt/arch32<br />
* edit your /etc/pacman.conf (from the chroot; the actual location is /opt/arch32/etc/pacman.conf)<br />
** uncomment at least one mirror<br />
** also, edit the line at the top of /etc/pacman.conf from:<br />
Architecture = auto<br />
to:<br />
Architecture = i686<br />
* Be sure to uncomment a mirror in /etc/pacman.d/mirrorlist as well<br />
* sync pacman to ensure that everything is working properly:<br />
# pacman -Syy<br />
* lastly, run this to generate your locale files:<br />
# locale-gen<br />
<br />
<br />
==Installing Dependencies==<br />
IBM has published a list of [http://www-01.ibm.com/support/docview.wss?uid=swg27013074 System Requirements] as well as a list of [http://www-01.ibm.com/support/docview.wss?&uid=swg27013076 Linux Packages] that are required to run Lotus Notes. When attempting to install an rpm on a non-rpm based distro, rpm will also complain about missing packages if the --nodeps option is not provided. IBM's list and the errors from an rpm attempt were used by the author of this article (by repeatedly running 'pacman -Qo filename') to painstakingly generate a minimum list of packages that would pull in all of the Lotus Notes dependencies. The list below are the "top level" packages, and will pull all the rest along with them. Run this ''from the chroot'':<br />
<br />
# pacman -S gdb tcsh libart-lgpl alsa-lib atk libbonobo libbonoboui gconf gtk2 libgnome libgnomecanvas libgnomeprint \<br />
libgnomeprintui libgnomeui gvfs libice libjpeg orbit2 pango libpng libsm libx11 libxcursor libxext libxft libxi libxkbfile libxml2 \<br />
libxrender libxss libxt libxtst font-bh-ttf audiofile esound gnome-menus libgail-gnome startup-notification gnome-desktop \<br />
gtk-xfce-engine xterm<br />
<br />
{{Note|xterm is only required to get through the license agreement. When you run Notes for the first time, an xterm window will ask you to accept the license agreement. Once you do this and setup your Lotus Notes account, you can remove xterm if you wish.}}<br />
<br />
<br />
==Installing Lotus Notes==<br />
While still in the chroot environment, do the following:<br />
* unpack the tar file you downloaded (fictional file name, use whatever you have):<br />
$ tar -xvf /path/to/ibm_lotus_notes-8.5.2.tar<br />
This should unpack the following:<br />
* ibm_lotus_activities-8.5.2.i586.rpm<br />
* ibm_lotus_cae-8.5.2.i586.rpm<br />
* ibm_lotus_feedreader-8.5.2.i586.rpm<br />
* ibm_lotus_notes-8.5.2.i586.rpm<br />
* ibm_lotus_sametime-8.5.2.i586.rpm<br />
* ibm_lotus_symphony-8.5.2.i586.rpm<br />
* license.tar<br />
* pub_ibm_lotus_notes.gpg<br />
* smartupgrade.sh<br />
<br />
Ensure that your archive package is accessible from within your 32-bit chrooted environment. If you followed all the instructions in the previous document about creating a 32-bit environment within arch, particularly up to linking file/folders, a link to your home folder will exist in the /opt/arch32 folder. If you downloaded lotus notes off of a website in the 64-bit environment, there is a good chance it will exist in your download folder within your home folder in the 32-bit environment as well.<br />
<br />
Now install the lotus notes RPM using the following command (Note: You may need to have [http://aur.archlinux.org/packages.php?ID=30317 rpm-org] installed from the AUR):<br />
# rpm -ivh --nodeps ibm_lotus_notes-8.5.2.i586.rpm<br />
<br />
When that completes, you may install any fixpacks with:<br />
# rpm --ivh --nodeps ibm_lotus_notes_fixpack-8.5.2.i586.rpm<br />
<br />
Now run Lotus Notes for the first time with:<br />
$ /opt/ibm/lotus/notes/notes<br />
<br />
Note: To run the above command, you must not be root. Switch back to your user with:<br />
# su username<br />
<br />
A splash screen should appear, shortly followed by an xterm window asking you to accept the license agreement. Type "1" (the digit, one) and then press enter. Lotus Notes should prompt its configuration screen and ask you for your name, server, user.id file, etc. When this completes, it will bring you to the Lotus Notes interface and you can revel in your accomplishment!<br />
<br />
You can repeat the above process with any of the other RPM files included in the bundle if you would like as well (sametime, symphony, cae, activities, etc.). Perhaps archive the original tar file somewhere in case you need it again, and then delete the unpacked files you do not need/want.<br />
<br />
===Creating a shortcut===<br />
Now it is not unlikely that you will quickly get tired of monotonously using chroot and entering a long path every time you want to start notes. Fortunately, creating a seamless shortcut in your 64-bit environment is easy.<br />
<br />
If you installed schroot, as mentioned in the article about creating a 32-bit environment within arch, you can place an extensionless shell script titled 'notes' into /usr/bin containing the following:<br />
<br />
schroot -- /opt/ibm/lotus/notes/notes<br />
<br />
Ensure that you are listed as one of the users who can use schroot at the bottom of the /etc/schroot/schroot.conf file by uncommenting and adding your username to the 'Users' segment.<br />
<br />
You should now be able to start notes by typing 'notes' and hitting enter in the terminal.<br />
<br />
===Installing on a 32bit System===<br />
I'm not sure why this is even covered because it's so simple, but just to have a mention of this somewhere in the Arch Wiki, just follow the procedure above for installation of the rpms. The additional reference this should provide is a list of required packages above, which I have not seen elsewhere. Hopefully this helps. The next section on troubleshooting should help as well.<br />
<br />
===Additional Steps on 8.5[.1]===<br />
If you are running 8.5 or 8.5.1, you may need to replace some libraries. This was mentioned several times in the IBM Developer forums in Ubuntu how-tos. One site that references it, along with two sources for these libraries is [http://metkhoo.blogspot.com/2010/03/notes-851-on-ubuntu-910-karmic-x64.html here]<br />
<br />
===Troubleshooting===<br />
* '''Notes on Gnome 3 Compatibility:''' Recently, gtk and Gnome related libraries underwent a transition to version 3. This caused a severe breakage in Lotus Notes. Reverting to gtk2/Gnome 2 libraries fixed things temporarily. A [http://www-10.lotus.com/ldd/nd85forum.nsf/dba3ca7e515d55ff85256a0700727b35/73442d4c703d8eb885257886006acb41?OpenDocument post was made to the IBM Notes community] which suggested the [http://usablesoftware.wordpress.com/2011/04/27/getting-lotus-notes-8-5-2-working-in-ubuntu-natty-narwhal-64-bit/ fix presented on this blog]. In summary, the fix suggests the following:<br />
** Download tar.gz from https://github.com/sgh/lotus-notes_gtk2.23.3 and extract<br />
** Edit the Makefile, inserting -m32 so that it reads: "gcc -Wall -Wextra -m32 `pkg-config..."<br />
** Compile by running "make"<br />
** Copy both libnotesgtkfix.so and notes-wrapper to /opt/ibm/lotus/notes/<br />
** From now on, to start Lotus Notes, run /opt/ibm/lotus/notes/notes-wrapper (instead of /opt/ibm/lotus/notes/notes, as before)<br />
<br />
* Recently on a fresh install of Arch and a fresh chroot, I could not get Lotus Notes even put up the xterm window for license acceptance, and in looking at the logs in ~/lotus/notes/data/workspace/logs noticed the error-log was complaining about the file in /opt/ibm/lotus/notes/framework/rcp/plugin_customization.ini. The error was about proper permissions. I chmodded did the following:<br />
<br />
# chmod 755 /opt/ibm/lotus/notes/framework/rcp/plugin_customization.ini<br />
# chown username:users /opt/ibm/lotus/notes/framework/rcp/plugin_customization.ini<br />
<br />
* Typically, after the license agreement step, Lotus Notes immediately brings up the configuration setup process. The last time I installed 8.5.2 from a scratch system/chroot, however, this was not happening. I got a license agreement page but nothing else. In looking at the output of top, the notes2 process would just vanish. In a fluke attempt, I just ran /opt/ibm/lotues/notes again... and it went right to the configuration process. I had several additional packages installed, but wiped out ~/lotus, removed them all, and re-tried and can reproduce the behavior. If you got a license agreement but nothing more, perhaps try to run Notes again.<br />
<br />
* In my last fresh install, I had issues using rpm on the 8.5.2 fixpack as well as with trying to remove Lotus Notes 8.5.2 (not that you'd want to, but I wanted to know why the fixpack was not working). I received errors like this for the fixpack:<br />
%pre scriptlet failed error status: 85<br />
and when trying to remove Lotus Notes with 'rpm -ev --nodeps pkd' I got:<br />
glibc detected **Double Linked List**<br />
For some reason, using the aur package [http://aur.archlinux.org/packages.php?ID=30317 rpm-org] worked perfectly for both installation and trial removal of Lotus Notes 8.5.2, and installation of the 8.5.2 fixpack. While perhaps not the "best" method, to clean up everything after uninstalling rpm and installing rpm-org, I ran (from the chroot):<br />
# pacman -Rsc rpm<br />
# rm -r /var/lib/rpm<br />
# rm -r /opt/ibm<br />
Then I proceeded to install rpm-org with yaourt and repeated the steps above to install Lotus Notes and the fixpack.<br />
<br />
==Post Install==<br />
* '''Fonts:''' As included above in the dependencies list, make sure you have the font-bh-ttf package installed. One user has reported that this was still producing ugly fonts. He has since confirmed that installing the [http://aur.archlinux.org/packages.php?ID=13030 ttf-ms-fonts] package fixed this issue.<br />
* '''Theme/Icons:''' Your default icons and theme may not look right. Copy over your applicable folders from /usr/share/themes and /usr/share/icons and configure your chroot environment with those same themes/icons. I have noticed that even if Notes uses my proper cursor icon, it changes to an ugly basic one on certain links/buttons and am not sure how to fix this.<br />
* '''Mail Preview Pane Glitch:''' In either 8.5 or 8.5.1, I had issues with the mail preview pane locking up or creating multiple adjustment bars. I believe setting the option "Disable embedded browser for MIME email" was what fixed this issue.</div>Ownaginatioushttps://wiki.archlinux.org/index.php?title=Lotus_Notes_in_32bit_Chroot&diff=167364Lotus Notes in 32bit Chroot2011-10-25T04:02:56Z<p>Ownaginatious: /* Installing Lotus Notes */</p>
<hr />
<div>[[Category:Arch64 (English)]]<br />
[[Category:Email Client (English)]]<br />
[[Category:Internet Applications (English)]]<br />
<br />
IBM Lotus Notes does not have a native 64bit package to date. This article will discuss the installation of Lotus Notes on 64 bit Arch Linux inside a 32bit chroot environment. This method will use the rpm versions of the Notes packages; .deb files are available but the author has not tried them.<br />
<br />
<br />
==Introduction==<br />
Lotus Notes is an email, calendaring, todo, notetaking, and collaboration application developed by IBM. It is used most commonly in corporate settings as it contains fairly powerful features that surpass those offered by more traditional email/calendar applications like Outlook or Thunderbird. Specifically, Lotus Notes features database functionality that allows for the storage of user input from various forms (e.g. surveys). While the email and scheduling functionality is quite similar to that of other applications in this family, the database functionality is difficult to understand without firsthand use.<br />
<br />
For those who use Linux in a corporate setting in which Lotus Notes is the default client, installation of this application is a necessity. While this is trivial on 32bit systems (such as Arch 686), Lotus Notes has not yet been released for 64bit Linux. As this is the case, those using Arch64 will need to install Notes inside a 32bit chroot. It may be possible to use a multi-lib setup, but the author of this article has no experience with that method and from his reading considers the chroot environment to be cleaner and simpler (easier to start over or remove altogether if functionality is no longer needed).<br />
<br />
<br />
==Obtaining Lotus Notes and FixPacks==<br />
You will at least need a Lotus Notes rpm package. The FixPacks that IBM releases are also recommended. The main author of this entry has experience with Notes 8.0 and 8.5[.1 and .2] on 64bit Arch.<br />
<br />
{{Note| The IBM site can be confusing. For almost all downloads, multiple languages, versions, and OS choices are available. Make sure you download files with the following characteristics:<br />
* For Lotus Notes ''Client'' and ''not'' for Domino. Notes is the email/calendar client; Domino is the server application<br />
* For Linux (obvious) for rpm install (not deb)}}<br />
<br />
<br />
===Obtaining Lotus Notes===<br />
* If you have a corporate ID with IBM, you may use the [http://www-01.ibm.com/software/lotus/products/notes/ IBM Lotus Notes site] for official download<br />
* Optionally, visit the [http://www14.software.ibm.com/webapp/download/search.jsp?pn=Lotus+Notes IBM Lotus Notes Trials site] for free trial versions that expire after 90 days<br />
* You may also contact your company administrator for a copy of Lotus Notes for Linux<br />
<br />
The trials provided change frequently. For example, as of 10-21-2010, trials of both 8.5 and 8.5.2 were available. As of 03-07-2011, only 8.5.2 is available. Check the [http://www14.software.ibm.com/webapp/download/search.jsp?pn=Lotus+Notes Lotus Notes trials page] frequently:<br />
<br />
===Downloading FixPacks===<br />
* Visit the [http://www-933.ibm.com/support/fixcentral/ IBM Fix Central site] to find FixPacks<br />
* Input Product Group=Lotus, Product=Lotus Notes, the version you have, and Platform=Linux for the four fields<br />
* At the next page click Continue at the bottom of the page to see all possible FixPacks<br />
* Download the correct one<br />
<br />
If you are using Lotus Notes 8.5.1, there is a [http://www-01.ibm.com/support/docview.wss?uid=swg24025721 dedicated page] for incremental FixPack installers. There are currently 5 FixPacks released (as of 03-07-20110. Just download Notes_851FP5_Standard_RPMInstall_Linux (5th FixPack, rpm format for Linux) since each FixPack encompasses the previous versions. The page for the 8.5.2 fixpack is [https://www-304.ibm.com/support/docview.wss?uid=swg24028680 here].<br />
<br />
<br />
==Create 32bit Chroot (x86_64)==<br />
''If using i686, skip to [[#Installing Dependencies]]''<br />
<br />
The Arch Wiki already has a fantastic article on creating a 32bit chroot environment on a 64bit system: [[Install_bundled_32-bit_system_in_Arch64]]. Use the instructions there to do the following:<br />
* Create /opt/arch32, setup pacamn, and sync<br />
* Install base and base-devel<br />
* Create the arch32 daemon script<br />
* Link/copy the necessary files in /etc from the 64bit system to the chroot<br />
* Start the daemon<br />
<br />
===Important steps to remember===<br />
Having been through this process many, many times, there are some steps that are quite common to forget. Please remember to:<br />
* run the xhost command after starting the daemon:<br />
xhost +SI:localuser:usernametogiveaccesstogoeshere<br />
* chroot into /opt/arch32 with:<br />
# linux32 chroot /opt/arch32<br />
* edit your /etc/pacman.conf (from the chroot; the actual location is /opt/arch32/etc/pacman.conf)<br />
** uncomment at least one mirror<br />
** also, edit the line at the top of /etc/pacman.conf from:<br />
Architecture = auto<br />
to:<br />
Architecture = i686<br />
* Be sure to uncomment a mirror in /etc/pacman.d/mirrorlist as well<br />
* sync pacman to ensure that everything is working properly:<br />
# pacman -Syy<br />
* lastly, run this to generate your locale files:<br />
# locale-gen<br />
<br />
<br />
==Installing Dependencies==<br />
IBM has published a list of [http://www-01.ibm.com/support/docview.wss?uid=swg27013074 System Requirements] as well as a list of [http://www-01.ibm.com/support/docview.wss?&uid=swg27013076 Linux Packages] that are required to run Lotus Notes. When attempting to install an rpm on a non-rpm based distro, rpm will also complain about missing packages if the --nodeps option is not provided. IBM's list and the errors from an rpm attempt were used by the author of this article (by repeatedly running 'pacman -Qo filename') to painstakingly generate a minimum list of packages that would pull in all of the Lotus Notes dependencies. The list below are the "top level" packages, and will pull all the rest along with them. Run this ''from the chroot'':<br />
<br />
# pacman -S gdb tcsh libart-lgpl alsa-lib atk libbonobo libbonoboui gconf gtk2 libgnome libgnomecanvas libgnomeprint \<br />
libgnomeprintui libgnomeui gvfs libice libjpeg orbit2 pango libpng libsm libx11 libxcursor libxext libxft libxi libxkbfile libxml2 \<br />
libxrender libxss libxt libxtst font-bh-ttf audiofile esound gnome-menus libgail-gnome startup-notification gnome-desktop \<br />
gtk-xfce-engine xterm<br />
<br />
{{Note|xterm is only required to get through the license agreement. When you run Notes for the first time, an xterm window will ask you to accept the license agreement. Once you do this and setup your Lotus Notes account, you can remove xterm if you wish.}}<br />
<br />
<br />
==Installing Lotus Notes==<br />
While still in the chroot environment, do the following:<br />
* unpack the tar file you downloaded (fictional file name, use whatever you have):<br />
$ tar -xvf /path/to/ibm_lotus_notes-8.5.2.tar<br />
This should unpack the following:<br />
* ibm_lotus_activities-8.5.2.i586.rpm<br />
* ibm_lotus_cae-8.5.2.i586.rpm<br />
* ibm_lotus_feedreader-8.5.2.i586.rpm<br />
* ibm_lotus_notes-8.5.2.i586.rpm<br />
* ibm_lotus_sametime-8.5.2.i586.rpm<br />
* ibm_lotus_symphony-8.5.2.i586.rpm<br />
* license.tar<br />
* pub_ibm_lotus_notes.gpg<br />
* smartupgrade.sh<br />
<br />
Ensure that your archive package is accessible from within your 32-bit chrooted environment. If you followed all the instructions in the previous document about creating a 32-bit environment within arch, particularly up to linking file/folders, a link to your home folder will exist in the /opt/arch32 folder. If you downloaded lotus notes off of a website in the 64-bit environment, there is a good chance it will exist in your download folder within your home folder in the 32-bit environment as well.<br />
<br />
Now install the lotus notes RPM using the following command (Note: You may need to have [http://aur.archlinux.org/packages.php?ID=30317 rpm-org] installed from the AUR):<br />
# rpm -ivh --nodeps ibm_lotus_notes-8.5.2.i586.rpm<br />
<br />
When that completes, you may install any fixpacks with:<br />
# rpm --ivh --nodeps ibm_lotus_notes_fixpack-8.5.2.i586.rpm<br />
<br />
Now run Lotus Notes for the first time with:<br />
$ /opt/ibm/lotus/notes/notes<br />
<br />
Note: To run the above command, you must not be root. Switch back to your user with:<br />
# su username<br />
<br />
A splash screen should appear, shortly followed by an xterm window asking you to accept the license agreement. Type "1" (the digit, one) and then press enter. Lotus Notes should prompt its configuration screen and ask you for your name, server, user.id file, etc. When this completes, it will bring you to the Lotus Notes interface and you can revel in your accomplishment!<br />
<br />
You can repeat the above process with any of the other RPM files included in the bundle if you would like as well (sametime, symphony, cae, activities, etc.). Perhaps archive the original tar file somewhere in case you need it again, and then delete the unpacked files you do not need/want.<br />
<br />
===Creating a shortcut===<br />
Now it is not unlikely that you will quickly get tired of monotonously using chroot and entering a long path every time you want to start notes. Fortunately, creating a seamless shortcut in your 64-bit environment is easy.<br />
<br />
If you installed schroot, as mentioned in the article about creating a 32-bit environment within arch, you can place an extensionless shell script titled 'notes' into /usr/bin containing the following:<br />
<br />
# schroot -- /opt/ibm/lotus/notes/notes<br />
<br />
Ensure that you are listed as one of the users who can use schroot at the bottom of the /etc/schroot/schroot.conf file by uncommenting and adding your username to the 'Users' segment.<br />
<br />
You should now be able to start notes by typing 'notes' and hitting enter in the terminal.<br />
<br />
===Installing on a 32bit System===<br />
I'm not sure why this is even covered because it's so simple, but just to have a mention of this somewhere in the Arch Wiki, just follow the procedure above for installation of the rpms. The additional reference this should provide is a list of required packages above, which I have not seen elsewhere. Hopefully this helps. The next section on troubleshooting should help as well.<br />
<br />
===Additional Steps on 8.5[.1]===<br />
If you are running 8.5 or 8.5.1, you may need to replace some libraries. This was mentioned several times in the IBM Developer forums in Ubuntu how-tos. One site that references it, along with two sources for these libraries is [http://metkhoo.blogspot.com/2010/03/notes-851-on-ubuntu-910-karmic-x64.html here]<br />
<br />
===Troubleshooting===<br />
* '''Notes on Gnome 3 Compatibility:''' Recently, gtk and Gnome related libraries underwent a transition to version 3. This caused a severe breakage in Lotus Notes. Reverting to gtk2/Gnome 2 libraries fixed things temporarily. A [http://www-10.lotus.com/ldd/nd85forum.nsf/dba3ca7e515d55ff85256a0700727b35/73442d4c703d8eb885257886006acb41?OpenDocument post was made to the IBM Notes community] which suggested the [http://usablesoftware.wordpress.com/2011/04/27/getting-lotus-notes-8-5-2-working-in-ubuntu-natty-narwhal-64-bit/ fix presented on this blog]. In summary, the fix suggests the following:<br />
** Download tar.gz from https://github.com/sgh/lotus-notes_gtk2.23.3 and extract<br />
** Edit the Makefile, inserting -m32 so that it reads: "gcc -Wall -Wextra -m32 `pkg-config..."<br />
** Compile by running "make"<br />
** Copy both libnotesgtkfix.so and notes-wrapper to /opt/ibm/lotus/notes/<br />
** From now on, to start Lotus Notes, run /opt/ibm/lotus/notes/notes-wrapper (instead of /opt/ibm/lotus/notes/notes, as before)<br />
<br />
* Recently on a fresh install of Arch and a fresh chroot, I could not get Lotus Notes even put up the xterm window for license acceptance, and in looking at the logs in ~/lotus/notes/data/workspace/logs noticed the error-log was complaining about the file in /opt/ibm/lotus/notes/framework/rcp/plugin_customization.ini. The error was about proper permissions. I chmodded did the following:<br />
<br />
# chmod 755 /opt/ibm/lotus/notes/framework/rcp/plugin_customization.ini<br />
# chown username:users /opt/ibm/lotus/notes/framework/rcp/plugin_customization.ini<br />
<br />
* Typically, after the license agreement step, Lotus Notes immediately brings up the configuration setup process. The last time I installed 8.5.2 from a scratch system/chroot, however, this was not happening. I got a license agreement page but nothing else. In looking at the output of top, the notes2 process would just vanish. In a fluke attempt, I just ran /opt/ibm/lotues/notes again... and it went right to the configuration process. I had several additional packages installed, but wiped out ~/lotus, removed them all, and re-tried and can reproduce the behavior. If you got a license agreement but nothing more, perhaps try to run Notes again.<br />
<br />
* In my last fresh install, I had issues using rpm on the 8.5.2 fixpack as well as with trying to remove Lotus Notes 8.5.2 (not that you'd want to, but I wanted to know why the fixpack was not working). I received errors like this for the fixpack:<br />
%pre scriptlet failed error status: 85<br />
and when trying to remove Lotus Notes with 'rpm -ev --nodeps pkd' I got:<br />
glibc detected **Double Linked List**<br />
For some reason, using the aur package [http://aur.archlinux.org/packages.php?ID=30317 rpm-org] worked perfectly for both installation and trial removal of Lotus Notes 8.5.2, and installation of the 8.5.2 fixpack. While perhaps not the "best" method, to clean up everything after uninstalling rpm and installing rpm-org, I ran (from the chroot):<br />
# pacman -Rsc rpm<br />
# rm -r /var/lib/rpm<br />
# rm -r /opt/ibm<br />
Then I proceeded to install rpm-org with yaourt and repeated the steps above to install Lotus Notes and the fixpack.<br />
<br />
==Post Install==<br />
* '''Fonts:''' As included above in the dependencies list, make sure you have the font-bh-ttf package installed. One user has reported that this was still producing ugly fonts. He has since confirmed that installing the [http://aur.archlinux.org/packages.php?ID=13030 ttf-ms-fonts] package fixed this issue.<br />
* '''Theme/Icons:''' Your default icons and theme may not look right. Copy over your applicable folders from /usr/share/themes and /usr/share/icons and configure your chroot environment with those same themes/icons. I have noticed that even if Notes uses my proper cursor icon, it changes to an ugly basic one on certain links/buttons and am not sure how to fix this.<br />
* '''Mail Preview Pane Glitch:''' In either 8.5 or 8.5.1, I had issues with the mail preview pane locking up or creating multiple adjustment bars. I believe setting the option "Disable embedded browser for MIME email" was what fixed this issue.</div>Ownaginatioushttps://wiki.archlinux.org/index.php?title=PulseAudio&diff=115842PulseAudio2010-08-29T04:57:06Z<p>Ownaginatious: /* ALSA */</p>
<hr />
<div>[[Category:HOWTOs (English)]]<br />
[[Category:Audio/Video (English)]]<br />
{{i18n|PulseAudio}}<br />
<br />
'''PulseAudio''' is a sound server for POSIX and Win32 systems. It allows to have multiple programs playing sound at one machine, among even more advanced features. PulseAudio is a drop-in replacement for the enlightened sound daemon (ESD). This article focuses on the more basic PulseAudio features.<br />
<br />
Please note, PulseAudio is ''not'' a drop-in replacement for aRts. If you use KDE 3, it is not currently possible to use PulseAudio.<br />
<br />
==Installation==<br />
All packages are from the community repository so you need to have it enabled. Then, to install PulseAudio:<br />
# pacman -S pulseaudio<br />
<br />
Optionally you can install some GTK front-ends for PulseAudio:<br />
# pacman -S paprefs pavucontrol pavumeter<br />
<br />
===Realtime scheduling===<br />
It is a good idea to allow PulseAudio to run with realtime scheduling, which can help performance. To do this, add the following lines to {{Filename|/etc/security/limits.conf}}:<br />
@pulse-rt - rtprio 9<br />
@pulse-rt - nice -11<br />
<br />
Afterwards, you need to add your user to the {{Codeline|pulse-rt}} group:<br />
# gpasswd -a <user> pulse-rt<br />
<br />
==Running==<br />
PulseAudio can be started with:<br />
$ pulseaudio --start<br />
<br />
Or if you use X11:<br />
$ start-pulseaudio-x11<br />
<br />
PulseAudio can be stopped with:<br />
$ pulseaudio --kill<br />
<br />
Note that in the case of certain X11 environments, PulseAudio will be started on login. See the section on Desktop Environments for details.<br />
<br />
==Backend Configuration==<br />
<br />
===ALSA===<br />
For the applications that do not support PulseAudio and support ALSA it is '''recommended''' to install the PulseAudio plugin for alsalibs. This plugin is available in the alsa-plugins package.<br />
<br />
# pacman -S alsa-plugins<br />
<br />
If you are on Arch x86_64 and want to have sound for 32 bit programs (like Wine), make sure to install lib32-pulseaudio and lib32-alsa-plugins as well.<br />
<br />
In order for ALSA to use PulseAudio you need to edit (or create) {{Filename|/etc/asound.conf}} (system wide settings) (recommended) or {{Filename|~/.asoundrc}} (settings on a per user basis) to have these lines:<br />
{{File|name=/etc/asound.conf|content=<br />
pcm.pulse {<br />
type pulse<br />
}<br />
ctl.pulse {<br />
type pulse<br />
}<br />
pcm.!default {<br />
type pulse<br />
}<br />
ctl.!default {<br />
type pulse<br />
}<br />
}}<br />
<br />
The package '''pulseaudio-alsa''' contains a suitable asound.conf file.<br />
<br />
If you omit the last two groups, Pulseaudio will not be used by default. You will then need to change the ALSA device to "pulse" in the applications that you use to make it work.<br />
<br />
To prevent applications from using ALSA's OSS emulation and bypassing Pulseaudio (thereby preventing other applications from playing sound), remove the {{Codeline|snd-pcm-oss}} module by executing:<br />
# rmmod snd-pcm-oss<br />
<br />
Afterwards, blacklist the module by adding {{Codeline|!snd-pcm-oss}} to MODULES in {{Filename|/etc/rc.conf}}.<br />
<br />
===OSS===<br />
There are multiple ways of making OSS-only programs play to PulseAudio:<br />
<br />
====padsp wrapper====<br />
If you have a program that uses OSS you can make it work with PulseAudio by starting it with padsp:<br />
$ padsp OSSprogram<br />
A few examples:<br />
$ padsp aumix<br />
$ padsp sox foo.wav -t ossdsp /dev/dsp<br />
<br />
If you prefer you can rename the program OSSprogram-real and replace it with a script like this: <br />
{{File|name=/usr/bin/OSSProgram|content=<br />
#!/bin/sh<br />
if test -x /usr/bin/padsp; then<br />
exec /usr/bin/padsp /usr/bin/OSSprogram-real "$@"<br />
else<br />
exec /usr/bin/OSSprogram "$@"<br />
fi<br />
}}<br />
<br />
====osspd====<br />
This method is more elaborate, but will allow you to avoid having to use a wrapper script.<br />
<br />
You will need to add {{Codeline|1=soundcore.preclaim_oss=0}} to the kernel parameters (/boot/grub/menu.lst) and also blacklist {{Codeline|snd-pcm-oss}} and {{Codeline|snd-mixer-oss}} in {{Filename|rc.conf}}.<br />
<br />
Install osspd (e.g. [http://aur.archlinux.org/packages.php?ID=31020 ossp] or [http://aur.archlinux.org/packages.php?ID=33455 ossp-git] from the AUR) and start it using:<br />
/etc/rc.d/osspd start<br />
<br />
Afterwards, add it to DAEMONS in rc.conf.<br />
<br />
===GStreamer===<br />
To make [[GStreamer]] use PulseAudio, you will need to install the gstreamer0.10-pulse package:<br />
# pacman -S gstreamer0.10-pulse<br />
<br />
Then, execute {{Filename|gstreamer-properties}} (part of ''gnome-media'' package) and select ''PulseAudio Sound Server'' in both Audio Input and Output. Alternatively, this can be done by setting the gconf variables {{Codeline|/system/gstreamer/0.10/default/audiosink}} to ''pulsesink'' and {{Codeline|/system/gstreamer/0.10/default/audiosrc}} to ''pulsesrc'':<br />
$ gconftool-2 -t string --set /system/gstreamer/0.10/default/audiosink pulsesink<br />
$ gconftool-2 -t string --set /system/gstreamer/0.10/default/audiosrc pulsesrc<br />
<br />
Some applications (like Rhythmbox) ignore the ''audiosink'' property, but rely instead on ''musicaudiosink'', which can't be configured using {{Filename|gstreamer-properties}} but needs to be manually set using {{Filename|gconf-editor}} or the {{Filename|gconftool-2}}:<br />
$ gconftool-2 -t string --set /system/gstreamer/0.10/default/musicaudiosink pulsesink<br />
<br />
===SDL===<br />
SDL in the extra repository does not provide Pulseaudio support. You will need to rebuild it from the [[ABS]]. No change to the PKGBUILD is neccessary.<br />
<br />
===OpenAL===<br />
OpenAL in the extra repository does not provide Pulseaudio support. You will need to rebuild it from the [[ABS]]. No change to the PKGBUILD is neccessary.<br />
<br />
OpenAL Soft should be configured to use PulseAudio: {{File|name=/etc/openal/alsoft.conf|content=drivers=pulse,alsa}}<br />
<br />
===libao===<br />
# pacman -Su libao-pulse<br />
<br />
Edit the libao configuration file:<br />
{{File|name=/etc/libao.conf|content=default_driver=pulse}}<br />
<br />
===PortAudio===<br />
The current binary of PortAudio in the community repository does not support PulseAudio and non-mmap audio devices. This can be remedied by building PortAudio from ABS and applying [http://svn.mandriva.com/cgi-bin/viewvc.cgi/packages/cooker/portaudio/current/SOURCES/portaudio-19-alsa_pulse.patch?revision=313993 a patch] to the sources.<br />
<br />
===xine===<br />
Install [http://aur.archlinux.org/packages.php?ID=25978 xine-lib-pulse] from AUR - tested with Amarok 1.x<br />
<br />
==Desktop Environments==<br />
<br />
===General X11===<br />
Start Pulseaudio after X using:<br />
$ start-pulseaudio-x11<br />
<br />
This will start Pulseaudio and load the X11 plugins.<br />
<br />
If you use GNOME or KDE, Pulseaudio may already launch on login automatically.<br />
<br />
====X11 bell====<br />
To make Pulseaudio play a sample when an X11 bell event happens (e.g. to make your terminal go 'Ping!' instead of 'Beep!'), add the following to<br />
{{Filename|/etc/pulse/default.pa}}:<br />
load-sample-lazy x11-bell /usr/share/sounds/freedesktop/stereo/dialog-error.ogg<br />
load-module module-x11-bell sample=x11-bell <br />
<br />
You can also use another sample. {{Filename|dialog-error.ogg}} is provided by ''sound-theme-freedesktop''.<br />
<br />
===GNOME===<br />
Proper integration of PulseAudio into GNOME requires some special packages:<br />
* libcanberra-pulse<br />
* gnome-media-pulse<br />
* gnome-settings-daemon-pulse<br />
<br />
They are part of the ''pulseaudio-gnome'' group.<br />
<br />
===KDE 4===<br />
Add the following lines to your {{Filename|/etc/asound.conf}}:<br />
pcm.phononpulse {<br />
type plug<br />
slave.pcm {<br />
type pulse<br />
}<br />
hint {<br />
show on<br />
description "PulseAudio"<br />
}<br />
}<br />
<br />
Now you can change the output device in "System Settings -> Multimedia -> Device Preference" to ''PulseAudio''.<br />
<br />
Remember, if you have added the {{Codeline|pcm.!default}} lines to your {{filename|asound.conf}} you cannot switch between the ALSA and the PulseAudio playback.<br />
<br />
====Phonon====<br />
Due to compatibilty concerns there is no PulseAudio support for Phonon by default. There are two ways of making phonon work with PulseAudio. Either you have to make use of the xine backend by installing "phonon-xine". As xine has ESD support and PulseAudio is compatible with ESD it will work.<br />
<br />
If you want to stay with gstreamer as backend, you'll have to recompile the package with PulseAudio support. Therefore you'll have to get the PKGBUILD (e.g. with abs), and remove the line saying:<br />
-DWITH_PulseAudio=OFF<br />
<br />
Rebuild the package(s) and install them. Remember to setup gstreamer as mentioned above.<br />
<br />
An alternative way is to build phonon-git with pulseaudio support from AUR. Phonon 4.4.1 PulseAudio support don't work.<br />
<br />
==Applications==<br />
===VLC===<br />
If you are having audio problems with the audio playback of DVDs in VLC, uninstall VLC and install the vlc-nightly package from the AUR, and set the audio output method to ''Pulseaudio''.<br />
<br />
Alternative: [http://aur.archlinux.org/packages.php?ID=25257 vlc-pulse] from AUR.<br />
<br />
===mpd===<br />
There is a pulseaudio enabled version of mpd called [http://aur.archlinux.org/packages.php?ID=18722 mpd-pulse] in the AUR.Or you can rebuild the original updated package from ABS modifying the PKGBUILD. You can use yaourt either way.<br />
<br />
# from AUR<br />
yaourt -S mpd-pulse<br />
# also change to --disable-pulse --enable-pulse in the PKGBUILD from ABS<br />
yaourt -Sb mpd <br />
<br />
You will need to [http://mpd.wikia.com/wiki/PulseAudio configure] mpd to use Pulseaudio.<br />
<br />
<br />
If you run a system-wide daemon, you will need to add the ''mpd'' user to the ''pulse-access'' group in order for mpd to connect to the daemon.<br />
<br />
On a desktop, running mpd as yourself and not using the ''mpd'' user is preferred.<br />
<br />
===mplayer===<br />
The PulseAudio enabled version of mplayer is called [http://aur.archlinux.org/packages.php?ID=24344 mplayer-pulse] and is located in AUR. Alternatively, use SDL output: {{Codeline|1=ao=sdl:pulse}} or make use of abs and rebuild the package with "--enable-pulse".<br />
<br />
==Alternative configurations==<br />
===Surround sound systems===<br />
Many people have a surround card, but have speakers for just two channels, so PulseAudio cannot really default to a surround setup. To enable all the channels, edit {{Filename|/etc/pulse/daemon.conf}}: uncomment the default-sample-channels line (i.e. remove the semicolon from the beginning of the line) and set the value to '''6''' if you have a ''5.1'' setup, or '''8''' if you have ''7.1'' setup etc.<br />
# Default<br />
default-sample-channels=2<br />
# For 5.1<br />
default-sample-channels=6<br />
# For 7.1<br />
default-sample-channels=8<br />
<br />
After doing the edit, you will need to restart Pulseaudio.<br />
<br />
===ALSA Monitor source===<br />
To be able to record from a monitor source (a.k.a. "What-U-Hear", "Stereo Mix"), use {{Codeline|pactl list}} to find out the name of the source in Pulseaudio (e.g. {{Codeline|alsa_output.pci-0000_00_1b.0.analog-stereo.monitor}}). Then add lines like the following to {{Filename|/etc/asound.conf}} or {{Filename|~/.asoundrc}}:<br />
pcm.pulse_monitor {<br />
type pulse<br />
device alsa_output.pci-0000_00_1b.0.analog-stereo.monitor<br />
}<br />
<br />
ctl.pulse_monitor {<br />
type pulse<br />
device alsa_output.pci-0000_00_1b.0.analog-stereo.monitor<br />
}<br />
<br />
Now you can select {{Codeline|pulse_monitor}} as a recording source.<br />
<br />
===PulseAudio over network===<br />
One of PulseAudio's magnificent features is the possibility to stream audio from clients over TCP to the server running the PulseAudio daemon, allowing sound to be streamed through your LAN.<br />
<br />
To accomplish this, one needs to enable module-native-protocol-tcp, and copy the pulse-cookie to the clients. <br />
<br />
====System-wide daemon====<br />
<br />
{{Warning|System-wide mode is a '''bad idea''' on a desktop. By default, PulseAudio is run per-user and will be started automatically when it is needed; this is simpler, more efficient and more secure. Read [http://pulseaudio.org/wiki/WhatIsWrongWithSystemMode What Is Wrong With System Mode] for more details.}}<br />
<br />
First you need to add the "pulseaudio" daemon to {{Filename|/etc/[[rc.conf]]}}. Example:<br />
DAEMONS=(syslog-ng network netfs crond '''pulseaudio''')<br />
<br />
Then you need to add each user (even root) that should be capable of using PulseAudio to the {{Codeline|pulse-access}} group: <br />
# gpasswd -a <user> pulse-access<br />
<br />
Edit {{Filename|/etc/pulse/system.pa}}, and change the following region:<br />
.ifexists module-hal-detect.so<br />
load-module module-hal-detect<br />
.else<br />
<br />
to the following:<br />
.ifexists module-udev-detect.so<br />
load-module module-udev-detect<br />
.else<br />
<br />
To enable the TCP module, add (or uncomment, if already there) this to {{Filename|/etc/pulse/system.pa}}:<br />
load-module module-native-protocol-tcp<br />
<br />
To allow remote connections to the TCP module, you also have to remember to unblock the service in {{Filename|/etc/hosts.allow}} with for example the following line:<br />
pulseaudio-native: ALL<br />
<br />
If you are running a system-wide PulseAudio instance, the cookie is located in {{Filename|/var/run/pulse/.pulse-cookie}}. This cookie needs to be sent to the client and placed somewhere the pulse-access group can read (and with permissions so only they can read it). Alternatively, you may add {{Codeline|1=auth-anonymous=1}} to the end of the {{Codeline|load-module module-native-protocol-tcp}} line to disable authentication. <br />
# scp /var/run/pulse/.pulse-cookie client:/etc/pulse-cookie<br />
<br />
# chown pulse:pulse-access /etc/pulse-cookie<br />
# chmod 640 /etc/pulse-cookie<br />
<br />
The pulse client needs to know where to look for the cookie.<br />
{{Filename|/etc/pulse/client.conf}}:<br />
### Cookie file<br />
cookie-file=/etc/pulse-cookie<br />
<br />
Then the client needs to be configured to connect to the specified server.<br />
{{Filename|/etc/pulse/client.conf}}:<br />
## The default server to connect to<br />
default-server=192.168.0.5<br />
<br />
To switch between servers on the client from within X, the {{Codeline|pax11publish}} command can be used. For example, to switch from the default server to the local server:<br />
<br />
$ pax11publish -e -S localhost<br />
<br />
Or to switch back to the default:<br />
<br />
$ pax11publish -e -r<br />
<br />
Note that for the switch to become apparent, the programs using Pulse must be restarted.<br />
<br />
To use the ESounD wrapper while using a system-wide daemon, you also need to enable auth-anonymous for the esound-unix module, or copy {{Filename|/var/run/pulse/.esd_auth}} into each home directory.<br />
<br />
====Zeroconf (Avahi) publishing====<br />
For the remote Pulseaudio server to appear in the PulseAudio Device Chooser ({{Filename|padevchooser}}), you will also need to add the {{Filename|avahi-daemon}} to the DAEMONS in rc.conf on both server and clients.<br />
<br />
===Pulseaudio through JACK===<br />
The JACK-Audio-Connection-Kit is popular for audio work, and is widely supported by Linux audio applications. It fills a similar niche as Pulseaudio, but with more of an emphasis on professional audio work. In particular, audio applications such as Ardour and Audacity (recently) work well with Jack.<br />
<br />
Pulseaudio provides module-jack-source and module-jack-sink which allow Pulseaudio to be run as a sound server above the JACK daemon. This allows the usage of per-volume adjustments and the like for the apps which need it, play-back apps for movies and audio, while allowing low-latency and inter-app connectivity for sound-processing apps which connect to JACK. However, this will prevent Pulseaudio from directly writing to the sound card buffers, which will increase overall CPU usage.<br />
<br />
To just try PA on top of jack you can have PA load the necessary modules on start:<br />
pulseaudio -L module-jack-sink -L module-jack-source<br />
<br />
To use pulseaudio with JACK, JACK must be started up before Pulseaudio, using whichever method you prefer. Pulseaudio then needs to be started loading the 2 relevant modules. Edit {{Filename|/etc/pulse/default.pa}}, and change the following region:<br />
### Load audio drivers statically (it is probably better to not load<br />
### these drivers manually, but instead use module-hal-detect --<br />
### see below -- for doing this automatically)<br />
#load-module module-alsa-sink<br />
#load-module module-alsa-source device=hw:1,0<br />
#load-module module-oss device="/dev/dsp" sink_name=output source_name=input<br />
#load-module module-oss-mmap device="/dev/dsp" sink_name=output source_name=input<br />
#load-module module-null-sink<br />
#load-module module-pipe-sink<br />
<br />
### Automatically load driver modules depending on the hardware available<br />
.ifexists module-udev-detect.so<br />
load-module module-udev-detect<br />
.else<br />
### Alternatively use the static hardware detection module (for systems that<br />
### lack udev support)<br />
load-module module-detect<br />
.endif<br />
<br />
to the following:<br />
### Load audio drivers statically (it is probably better to not load<br />
### these drivers manually, but instead use module-hal-detect --<br />
### see below -- for doing this automatically)<br />
#load-module module-alsa-sink<br />
#load-module module-alsa-source device=hw:1,0<br />
#load-module module-oss device="/dev/dsp" sink_name=output source_name=input<br />
#load-module module-oss-mmap device="/dev/dsp" sink_name=output source_name=input<br />
#load-module module-null-sink<br />
#load-module module-pipe-sink<br />
load-module module-jack-source<br />
load-module module-jack-sink<br />
<br />
### Automatically load driver modules depending on the hardware available<br />
#.ifexists module-udev-detect.so<br />
#load-module module-udev-detect<br />
#.else<br />
### Alternatively use the static hardware detection module (for systems that<br />
### lack udev support)<br />
#load-module module-detect<br />
#.endif<br />
<br />
Basically, this prevents module-udev-detect from loading. module-udev-detect will always try to grab your sound-card (JACK has already done that, so this will cause an error). Also, the jack source and sink must be explicitly loaded.<br />
<br />
====QjackCtl with Startup/Shutdown Scripts====<br />
Using the settings listed above you can use QjackCtl to execute a script upon startup and shutdown to load/unload PulseAudio. Part of the reason you may wish to do this is that the above changes disable PulseAudio's automatic hardware detection modules. This particular setup is for using PulseAudio in an exclusive fashion with JACK, though the scripts could be modified to unload and load an alternate non-JACK setup, but killing and starting PulseAudio while programs might be using it would become problematic.<br />
<br />
The following example could be used and modified as necessary as a startup script that daemonizes PulseAudio and loads the ''padevchooser'' program (optional, needs to be built from AUR) called {{Filename|jack_startup}}:<br />
#!/bin/bash<br />
#Load PulseAudio and PulseAudio Device Chooser<br />
<br />
pulseaudio -D<br />
padevchooser&<br />
<br />
as well as a shutdown script to kill PulseAudio and the Pulse Audio Device Chooser, as another example called {{Filename|jack_shutdown}} also in the home directory:<br />
#!/bin/bash<br />
#Kill PulseAudio and PulseAudio Device Chooser<br />
<br />
pulseaudio --kill<br />
killall padevchooser<br />
<br />
Both scripts need to be made executable:<br />
chmod +x jack_startup jack_shutdown<br />
<br />
then with QjackCtl loaded, click on the ''Setup'' button and then the ''Options'' tab and tick both "Execute Script after Startup:" And "Execute Script on Shutdown:" and put either use the ... button or type the path to the scripts (assuming the scripts are in the home directory) {{Filename|~/jack_startup}} and {{Filename|~/jack_shutdown}} making sure to save the changes you have made.<br />
<br />
===Pulseaudio through OSS===<br />
Add the following to {{Filename|/etc/pulse/default.pa}}:<br />
load-module module-oss<br />
<br />
Then start Pulseaudio as usual. You should have sinks and sources for your OSS devices.<br />
<br />
===Pulseaudio from within a chroot (ex. 32-bit chroot in 64-bit install)===<br />
Since a chroot sets up an alternative root for the running/jailing of applications, pulseaudio must be installed within the chroot itself ({{Codeline|pacman -S pulseaudio}} within the chroot environment).<br />
<br />
Pulseaudio, if not set up to connect to any specific server (this can be done in {{Filename|/etc/pulse/client.conf}}, through the PULSE_SERVER environment variable, or through publishing to the local X11 properties using module-x11-publish), will attempt to connect to the local pulse server, failing which it will spawn a new pulse server. Each pulse server has a unique ID based on the machine-id value in {{Filename|/var/lib/dbus}}. To allow for chrooted apps to access the pulse server, the following directories must be mounted within the chroot:-<br />
/var/run<br />
/var/lib/dbus<br />
/tmp<br />
~/.pulse<br />
<br />
{{Filename|/dev/shm}} should also be mounted for efficiency and good performance. Note that mounting /home would normally also allow sharing of the {{Filename|~/.pulse}} folder.<br />
<br />
For specific direction on accomplishing the appropriate mounts, please refer to the wiki on installing a bundled 32-bit system, especially the [http://wiki.archlinux.org/index.php?title=Arch64_Install_bundled_32bit_system#Additional_mount_option_to_allow_32-bit_apps_to_access_the_64-bit_Pulseaudio_server additional section] specific to Pulseaudio.<br />
<br />
==Troubleshooting==<br />
===No sound after install===<br />
====No cards====<br />
If PulseAudio starts, run {{Codeline|pacmd list}}. If no cards are reported, make sure that your ALSA devices are not in use:<br />
$ fuser -v /dev/snd/*<br />
$ fuser -v /dev/dsp<br />
<br />
Make sure any applications using the pcm or dsp files are shut down before restarting PulseAudio.<br />
<br />
====Muted audio device====<br />
If you experience no audio output via any means while using ALSA as your default device, you may have to unmute your sound card. To do this, you will want to launch alsamixer and make sure each column has a green 00 under it (this can be toggled by pressing 'm')<br />
$ alsamixer -c 0<br />
<br />
Sometimes the snd_pcsp driver conflicts with the snd_hda_intel driver (for those of you<br />
using Intel cards) and no sound output is experienced. To fix this, you can blacklist the<br />
snd_pcsp driver in the MODULES array of {{Filename|/etc/rc.conf}} (by appending {{Codeline|!snd_pcsp}}).<br />
<br />
===Daemon startup failed===<br />
Try resetting PulseAudio. To do that:<br />
$ pulseaudio --kill<br />
$ killall pulseaudio<br />
$ killall -9 pulseaudio<br />
$ rm -rf ~/.pulse*<br />
$ rm -rf /tmp/pulse*<br />
<br />
Afterwards, start PulseAudio again.<br />
<br />
===padevchooser===<br />
If you cannot launch the PulseAudio Device Chooser, first (re)start the Avahi daemon as follows:<br />
$ /etc/rc.d/avahi-daemon restart<br />
<br />
===Glitches and high CPU usage since 0.9.14===<br />
The PulseAudio sound server has been rewritten to use timer-based audio scheduling instead of the traditional interrupt-driven approach. Timer-based scheduling may expose issues in some Alsa drivers. To turn timer-based scheduling off, replace the line:<br />
load-module module-udev-detect <br />
in {{Filename|/etc/pulse/default.pa}} by:<br />
load-module module-udev-detect tsched=0<br />
<br />
===Choppy sound===<br />
Choppy sound in pulsaudio can result from wrong settings for the sample rate in /etc/pulse/daemon.conf. Try changing the line <br />
; default-sample-rate = 44100<br />
to <br />
default-sample-rate = 48000<br />
and restart the pulsaudio server by executing<br />
pulseaudio --kill && pulseaudio --start<br />
<br />
===Volume adjustment doesn't work properly===<br />
You might wan't to check <br />
/usr/share/pulseaudio/alsa-mixer/paths/analog-output.conf.common<br />
<br />
==See also==<br />
*[[Allow multiple programs to play sound at once]]<br />
<br />
==External links==<br />
*[http://www.pulseaudio.org/wiki/PerfectSetup http://www.pulseaudio.org/wiki/PerfectSetup] - A good guide to make your configuration perfect<br />
*[http://www.alsa-project.org/main/index.php/Asoundrc http://www.alsa-project.org/main/index.php/Asoundrc] - Alsa wiki on .asoundrc<br />
*[http://www.pulseaudio.org/ http://www.pulseaudio.org/] - PulseAudio official site<br />
*[http://www.pulseaudio.org/wiki/FAQ http://www.pulseaudio.org/wiki/FAQ] - PulseAudio FAQ</div>Ownaginatious