https://wiki.archlinux.org/api.php?action=feedcontributions&user=SilverWyrda&feedformat=atomArchWiki - User contributions [en]2024-03-28T16:35:11ZUser contributionsMediaWiki 1.41.0https://wiki.archlinux.org/index.php?title=AMD_Catalyst&diff=373935AMD Catalyst2015-05-17T00:33:44Z<p>SilverWyrda: Run `fglrxinfo` after starting X as it needs a display. Otherwise, there is a misleading error even if everything is installed properly.</p>
<hr />
<div>[[Category:Graphics]]<br />
[[Category:X Server]]<br />
[[es:ATI Catalyst]]<br />
[[fr:ATI#Catalyst]]<br />
[[it:AMD Catalyst]]<br />
[[ja:AMD Catalyst]]<br />
[[ru:AMD Catalyst]]<br />
[[zh-CN:AMD Catalyst]]<br />
{{Related articles start}}<br />
{{Related|ATI}}<br />
{{Related|Xorg}}<br />
{{Related articles end}}<br />
<br />
Owners of ATI/AMD video cards have a choice between AMD's proprietary driver ({{AUR|catalyst}}) and the [[ATI|open source driver]] ({{Pkg|xf86-video-ati}}). This article covers the proprietary driver.<br />
<br />
AMD's Linux driver package ''catalyst'' was previously named ''fglrx'' ('''F'''ire'''GL''' and '''R'''adeon '''X'''). Only the package name has changed, while the kernel module retains its original ''fglrx.ko'' filename. Therefore, any mention of fglrx below is specifically in reference to the ''kernel module'', '''not the package'''.<br />
<br />
'''Catalyst packages are no longer offered in the official repositories.''' In the past, Catalyst [https://www.archlinux.org/news/ati-catalyst-support-dropped/ has been dropped] from official Arch support because of dissatisfaction with the quality and speed of development. After a brief return they were dropped again in April 2013 and they have not returned since.<br />
<br />
Compared with the open source driver, Catalyst performs better in both 2D and 3D rendering, also having better power management, but it lacks efficient multi-head support. Supported devices are [[wikipedia:Radeon|ATI/AMD Radeon]] video cards with chipset R600 and newer (Radeon HD 2xxx and newer). See the Xorg [http://www.x.org/wiki/RadeonFeature/#index5h2 decoder ring] or [[wikipedia:Comparison of AMD graphics processing units|this table]], to translate ''model'' names (X1900, HD4850) to/from ''chip'' names (R580, RV770 respectively).<br />
<br />
== Installation ==<br />
<br />
There are three ways of installing Catalyst on your system. One way is to use [https://aur.archlinux.org/account/Vi0l0/ Vi0L0's] (Arch's unofficial Catalyst maintainer) repository. This repository contains all the necessary packages. The second method you can use is the AUR; PKGBUILDs offered here are also made by Vi0L0 and are the same he uses to built packages for his repository. Lastly, you can install the driver directly from AMD.<br />
<br />
Before choosing the method you prefer, you will have to see which driver you need. Since Catalyst 12.4, AMD has separated its development for Radeon HD 2xxx, 3xxx and 4xxx cards into the '''legacy''' Catalyst driver. For Radeon HD 5xxx and newer, there is the regular Catalyst driver. Regardless of the driver you need, you will also need the Catalyst utilities.<br />
<br />
{{Note|After the instructions for every method of installing, you will find general instructions '''everyone''' has to perform, regardless of the method you used.}}<br />
<br />
=== Installing the driver ===<br />
<br />
==== Installing from the unofficial repository ====<br />
<br />
If you do not fancy building the packages from the [[Arch User Repository|AUR]], this is the way to go. The repository is maintained by our unofficial Catalyst maintainer, [[User:Vi0L0|Vi0l0]]. All packages are signed and are considered safe to use. As you will see later on in this article, Vi0L0 is also responsible for many other packages that will help you get your system working with your ATI graphic cards. <br />
<br />
Vi0L0 has three different Catalyst repositories, each having different drivers:<br />
* [[Unofficial user repositories#catalyst|catalyst]] for the regular Catalyst driver needed by Radeon HD 5xxx and up, it contains the latest (stable or beta) Catalyst release.<br />
* ''catalyst-stable'' for the regular Catalyst driver needed by Radeon HD 5xxx and up, with the latest stable driver.<br />
* [[Unofficial user repositories#catalyst-hd234k|catalyst-hd234k]] for the legacy Catalyst driver needed by Radeon HD 2xxx, 3xxx and 4xxx cards.<br />
<br />
To enable one of these, follow the instructions in [[Unofficial user repositories]]. Remember to add the chosen repository '''above all other repositories''' in {{ic|pacman.conf}}.<br />
<br />
{{Note|The ''catalyst'' and ''catalyst-stable'' repositories share the same URL. To enable ''catalyst-stable'', follow the instructions for enabling ''catalyst'' and replace {{ic|[catalyst]}} with {{ic|[catalyst-stable]}} in {{ic|pacman.conf}}. If you need to stick with an old version, there are also some versioned repositories using the same URL (for example ''catalyst-stable-13.4'').}}<br />
<br />
{{Warning|<br />
* The legacy Catalyst driver does not support Xorg Server 1.17. Should you want to use this driver, see [[#Xorg repositories]] for instructions on how to roll back to Xorg Server 1.16.<br />
}}<br />
<br />
{{Tip|Because catalyst.wirephire.com will go down if a certain bandwidth limit is exceeded (this happened in the past) or may be too slow at your location, repository mirrors are provided by rtsinformatique at [http://mirror.rts-informatique.fr/archlinux-catalyst/] (France) and goll at [http://mirror.hactar.bz/Vi0L0/] (DE). These mirrors however come with no warranty and are not guaranteed to always be operational. Uncomment the line for the mirror closest to your location. It is also a good idea to keep alternatives in case of mirror downtime.<br />
<br />
Repository mirroring can be easily achieved using {{ic|rsync://mirror.rts-informatique.fr::archlinux-catalyst}}.<br />
}}<br />
<br />
Once you have added some Catalyst repository, update pacman's database and [[pacman|install]] these packages (see [[#Tools]] for more information):<br />
<br />
* ''catalyst-hook''<br />
* ''catalyst-utils''<br />
* ''catalyst-libgl''<br />
* ''opencl-catalyst'' - optional, needed for OpenCL support<br />
* ''lib32-catalyst-utils'' - optional, needed for 32-bit OpenGL support on 64-bit systems<br />
* ''lib32-catalyst-libgl'' - optional, needed for 32-bit OpenGL support on 64-bit systems<br />
* ''lib32-opencl-catalyst'' - optional, needed for 32-bit OpenCL support on 64-bit systems<br />
<br />
If you are using a notebook with hybrid Intel/AMD graphics card, the set of packages will be slightly different:<br />
<br />
* ''catalyst-hook''<br />
* ''catalyst-utils-pxp''<br />
* ''lib32-catalyst-utils-pxp'' - optional, needed for 32-bit OpenGL support on 64-bit systems<br />
<br />
{{Note|If pacman asks you about removing '''libgl''' you can safely do so.}}<br />
<br />
{{Warning|catalyst package was removed from Vi0L0's repository, its place was taken by catalyst-hook.}}<br />
<br />
==== Installing from the AUR ====<br />
The second way to install Catalyst is from the [[Arch User Repository|AUR]]. If you want to build the packages specifically for your computer, this is the way to go. Note that this is also the most tedious way to install Catalyst; it requires the most work and also requires manual updates upon every kernel update.<br />
<br />
{{Warning|If you install the Catalyst package from the AUR, you will have to rebuild Catalyst every time the kernel is updated. Otherwise X '''will''' fail to start.}}<br />
<br />
All packages mentioned above in Vi0L0's unofficial repository are also available on the [[Arch User Repository|AUR]]:<br />
* {{AUR|catalyst}}<br />
* {{AUR|catalyst-generator}}<br />
* {{AUR|catalyst-hook}}<br />
* {{AUR|catalyst-utils}}<br />
* {{AUR|lib32-catalyst-utils}}<br />
<br />
The AUR also holds some packages that are '''not''' found in any of the repositories. These packages contain the so-called ''Catalyst-total'' packages and the beta versions:<br />
* {{AUR|catalyst-total}}<br />
* {{AUR|catalyst-total-pxp}}<br />
* {{AUR|catalyst-total-hd234k}}<br />
* {{AUR|catalyst-test}}<br />
<br />
The {{AUR|catalyst-total}} packages are made to make the lives of AUR users easier. It builds the driver, the kernel utilities and the 32 bit kernel utilities. It also builds the {{AUR|catalyst-hook}} package, which described in [[#Tools]].<br />
<br />
{{AUR|catalyst-total-pxp}} builds Catalyst with experimental powerXpress support.<br />
<br />
=== Configuring the driver ===<br />
After you have installed the driver via your chosen method, you will have to configure X to work with Catalyst. Also, you will have to make sure the module gets loaded at boot. Also, one should disable [[KMS|kernel mode setting]].<br />
<br />
==== Configuring X ====<br />
To configure X, you will have to create an {{ic|xorg.conf}} file. Catalyst provides its own {{ic|aticonfig}} tool to create and/or modify this file.<br />
It also can configure virtually every aspect of the card for it also accesses the {{ic|/etc/ati/amdpcsdb}} file. For a complete list of {{ic|aticonfig}} options, run:<br />
<br />
# aticonfig --help | less<br />
<br />
{{Warning|Use the {{ic|--output}} option before committing to {{ic|/etc/X11/}} as an {{ic|xorg.conf}} file will override anything in {{ic|/etc/X11/xorg.conf.d/}}}}<br />
<br />
{{Note|To adhere to the new config location use {{ic|# aticonfig [...] --output}} to adapt the {{ic|Device}} section to {{ic|/etc/X11/xorg.conf.d/20-radeon.conf}}. The drawback is that many {{ic|aticonfig}} options rely on an {{ic|xorg.conf}}, and will be unavailable.}}<br />
<br />
Now, to configure Catalyst. If you have only one monitor, run this:<br />
<br />
# aticonfig --initial<br />
<br />
{{Note | If you have a PowerXpress problem you should probably install {{AUR|catalyst-total-pxp}}.}}<br />
<br />
However, if you have two monitors and want to use both of them, you can run the command stated below. Note that this will generate a dual head configuration with the second screen located above the first screen.<br />
<br />
# aticonfig --initial=dual-head --screen-layout=above<br />
<br />
{{Note|See [[#Double Screen (Dual Head / Dual Screen / Xinerama)]] for more information on setting up dual monitors.}}<br />
<br />
You can compare the generated file to one of the [[Xorg#Sample configurations|Sample Xorg.conf]] examples listed on the Xorg page.<br />
<br />
Although the current Xorg versions auto-detect most options when started, you may want to specify some in case the defaults change between versions.<br />
<br />
Here is an example (with notes) '''for reference'''. Entries with {{ic|#}} should be required, add entries with {{ic|##}} as needed:<br />
<br />
{{hc|/etc/X11/xorg.conf|2=<br />
Section "ServerLayout"<br />
Identifier "Arch"<br />
Screen 0 "Screen0" 0 0 # 0's are necessary.<br />
EndSection<br />
Section "Module"<br />
Load [...]<br />
[...]<br />
EndSection<br />
Section "Monitor"<br />
Identifier "Monitor0"<br />
[...]<br />
EndSection<br />
Section "Device"<br />
Identifier "Card0"<br />
Driver "fglrx" # Essential.<br />
BusID "PCI:1:0:0" # Recommended if autodetect fails.<br />
Option "OpenGLOverlay" "0" ##<br />
Option "XAANoOffscreenPixmaps" "false" ##<br />
EndSection<br />
Section "Screen"<br />
Identifier "Screen0"<br />
Device "Card0"<br />
Monitor "Monitor0"<br />
DefaultDepth 24<br />
SubSection "Display"<br />
Viewport 0 0<br />
Depth 24 # Should not change from '24'<br />
Modes "1280x1024" "2048x1536" ## 1st value=default resolution, 2nd=maximum.<br />
Virtual 1664 1200 ## (x+64, y) to workaround potential OGL rect. artifacts/<br />
EndSubSection ## fixed in Catalyst 9.8<br />
EndSection<br />
Section "DRI"<br />
Mode 0666 # May help enable direct rendering.<br />
EndSection<br />
}}<br />
<br />
{{Note|With '''every''' Catalyst update you should remove {{ic|amdpcsdb}} file in this way: kill X, remove {{ic|/etc/ati/amdpcsdb}}, start X and then run {{ic|amdcccle}} - otherwise the version of Catalyst may display wrongly in {{ic|amdcccle}}.}}<br />
<br />
''If you need more information on Catalyst, visit [https://bbs.archlinux.org/viewtopic.php?id=57084 this thread].''<br />
<br />
==== Loading the module at boot ====<br />
We have to blacklist the {{ic|radeon}} module to prevent it from auto-loading. To do so, blacklist ''radeon'' in {{ic|/etc/modprobe.d/modprobe.conf}}. Also, make sure that it is not loaded by any file under {{ic|/etc/modules-load.d/}}. For more information, see [[kernel modules#Blacklisting]]. <br />
<br />
Then we will have to make sure that the {{ic|fglrx}} module gets auto-loaded. Either add {{ic|fglrx}} on a new line of an existing module file located under {{ic|/etc/modules-load.d/}}, or create a new file and add {{ic|fglrx}}.<br />
<br />
==== Disable kernel mode setting ====<br />
<br />
{{Note|Do not do this if you are using {{ic|catalyst-utils-pxp}} or {{ic|catalyst-total-pxp}} because intel driver needs it.}}<br />
<br />
Disabling kernel mode setting is important, as the driver does not take advantage of [[KMS]] yet. If you do not deactivate KMS, your system might freeze when trying to switch to a TTY or even when shutting down via your DE.<br />
<br />
To disable kernel mode setting, add {{ic|nomodeset}} to your [[kernel parameters]].<br />
<br />
==== Checking operation ====<br />
<br />
Assuming that a reboot to your login was successful, you can check if {{ic|fglrx}} is running properly with the following commands:<br />
<br />
$ lsmod | grep fglrx<br />
<br />
If you get output, it works. Finally, run X manually with {{ic|$ startx}} or by using a display manager (see [[Xorg#Running]]).<br />
<br />
The following command should output your graphic card model name:<br />
<br />
$ fglrxinfo<br />
<br />
You can then verify that direct rendering is enabled by running the following command in a terminal:<br />
<br />
$ glxinfo | grep "direct rendering"<br />
<br />
If it says {{ic|"direct rendering: yes"}} then you are good to go! If the {{ic|$ glxinfo}} command is not found install the {{Pkg|mesa-demos}} package.<br />
<br />
{{Note|You can also use:<br />
$ fgl_glxgears<br />
as the fglrx alternative test to {{ic|glxgears}}.<br />
}}<br />
<br />
{{Warning|In recent versions of Xorg, the paths of libs are changed. So, sometimes {{ic|libGL.so}} cannot be correctly loaded even if it is installed. Check this if your GL is not working. Please read [[#Troubleshooting]] section for details.}}<br />
<br />
=== Custom kernels ===<br />
<br />
{{Note|If you are at all uncomfortable or inexperienced with making packages, read up the [[ABS]] wiki page first so things go smoothly.}}<br />
<br />
To install catalyst for a custom kernel, you will need to build your own {{ic|catalyst-$kernel}} package:<br />
<br />
# Obtain the {{ic|PKGBUILD}} and {{ic|catalyst.install}} files from [[AUR|Catalyst]].<br />
# Editing the PKGBUILD. Two changes need to be made here:<br />
## Change {{ic|1=pkgname=catalyst}} to {{ic|1=pkgname=catalyst-$kernel_name}}, where {{ic|$kernel_name}} is whatever you want (e.g. custom, mm, themostawesomekernelever).<br />
## Change the dependency of {{ic|linux}} to {{ic|$kernel_name}}.<br />
# Build your package and install; run {{ic|makepkg -i}} or {{ic|makepkg}} followed by {{ic|# pacman -U pkgname.pkg.tar.gz}}<br />
<br />
{{Note|<br />
*If you run multiple kernels, you have to install the {{AUR|catalyst-utils}} packages for all kernels. They will not conflict with one another.<br />
*{{AUR|catalyst-generator}} is able to build {{ic|<nowiki>catalyst-{kernver}</nowiki>}} packages for you so you do not actually need to perform all those steps manually. For more information, see [[#Tools| Tools section]].}}<br />
<br />
=== PowerXpress support ===<br />
<br />
PowerXpress technology allows switching notebooks with dual-graphic capability from integrated graphics (IGP) to discrete graphics either to increase battery life or to achieve better 3D rendering capabilities.<br />
<br />
To use such functionality on Arch you will have to:<br />
* Get and build {{AUR|catalyst-total-pxp}} package from the [[Arch User Repository|AUR]], or<br />
* Install '''catalyst-utils-pxp''' package from the [catalyst] repository (plus additional lib32-catalyst-utils-pxp, if needed).<br />
<br />
To perform a switch into Intel's IGP you will also have to install the {{pkg|mesa-libgl}} package and Intel's drivers: {{pkg|xf86-video-intel}}.<br />
<br />
{{Note|'''With the latest version of Catalyst, version 13.1 (not Catalyst legacy) ChrisXY was able to work on the newest {{pkg|xorg-server}} (version 1.13.1), {{Pkg|mesa}} 9.0.1 and {{pkg|xf86-video-intel}} 2.20.18'''.<br />
<br />
On any version of Catalyst below 13.1 (and all versions of Catalyst legacy) there are some problems with the new Intel drivers and the '''last noted working version of {{pkg|xf86-video-intel}} is 2.20.2-2''', so you will probably have to downgrade from the latest version that you have gotten from Arch's repositories (although we recommend to test the newest one before downgrading - there is always some possibility that it will work).<br />
<br />
{{pkg|xf86-video-intel}} 2.20.2-2 works only with xorg-server 1.12 and so it is a part of the '''xorg112 repository'''. If you want to use it you will have to downgrade xorg-server as well. For information on this, see [[#Xorg repositories]].}}<br />
<br />
Now you can switch between the integrated and the discrete GPU, using these commands:<br />
<br />
{{bc|1=<br />
# aticonfig --px-igpu #for integrated GPU<br />
# aticonfig --px-dgpu #for discrete GPU<br />
}}<br />
<br />
Just remember that fglrx needs {{ic|/etc/X11/xorg.conf}} configured for AMD's card with {{ic|fglrx}} inside.<br />
<br />
You can also use the {{ic|pxp_switch_catalyst}} switching script that will perform some additional usefull operations:<br />
* Switching {{ic|xorg.conf}} - it will rename {{ic|xorg.conf}} into {{ic|xorg.conf.cat}} (if there is fglrx inside) or {{ic|xorg.conf.oth}} (if there is intel inside) and then it will create a symlink to {{ic|xorg.conf}}, depending on what you chose.<br />
* Running {{ic|aticonfig --px-Xgpu}}.<br />
* Running {{ic|switchlibGL}}.<br />
* Adding/removing {{ic|fglrx}} into/from {{ic|/etc/modules-load.d/catalyst.conf}}.<br />
<br />
Usage:<br />
{{bc|1=<br />
# pxp_switch_catalyst amd<br />
# pxp_switch_catalyst intel<br />
}}<br />
<br />
If you have got problems when you try to run X on Intel's driver you may try to force "UXA" acceleration. Just make sure you got {{ic|Option "AccelMethod" "uxa"}} in {{ic|xorg.conf}}:<br />
{{hc|/etc/X11/xorg.conf|2=<br />
Section "Device"<br />
Identifier "Intel Graphics"<br />
Driver "intel"<br />
#Option "AccelMethod" "sna"<br />
'''Option "AccelMethod" "uxa"'''<br />
#Option "AccelMethod" "xaa"<br />
EndSection<br />
}}<br />
<br />
==== Running two X servers (one using the Intel driver, another one using fglrx) simultaneously ====<br />
Because fglrx is crash-prone (regarding PowerXpress), it could be a good idea to use the Intel driver in the main X server and have a secondary X server using fglrx when 3D acceleration is needed. However, simply switching to the discrete GPU from the integrated GPU using {{ic|aticonfig}} or {{ic|amdcccle}} will cause all sorts of weird bugs when starting the second X.<br />
<br />
To run two X servers at the same time (each using different drivers), you should firstly set up a fully working X with Catalyst and then move its {{ic|xorg.conf}} to a temporary place (for example, {{ic|/etc/X11/xorg.conf.fglrx}}. The next time X is started, it will use the Intel driver by default instead of fglrx.<br />
<br />
To start a second X server using fglrx, simply move {{ic|xorg.conf}} back to the proper place ({{ic|/etc/X11/xorg.conf}}) before starting X. This method even allows you to switch between running X sessions. When you are done using fglrx, move {{ic|xorg.conf}} somewhere else again.<br />
<br />
The only disadvantage of this method is not having 3D acceleration using the Intel driver. 2D acceleration, however, is fully functional. Other than that, this will provide us with a completely stable desktop.<br />
<br />
==== Issues with PowerXpress laptops running in AMD mode (pxp_switch_catalyst amd) with external / secondary monitor ====<br />
When using a PowerXpress laptop in AMD-only mode (ie, setting the discrete card to render everything) you sometimes run into issues with artifacting/duplicating between displays. This is a known issue, and seems to effect 7xxxM series cards.<br />
<br />
The artifacting disappears when you transform one of the monitors by either rotating or scaling. So you can use xrandr to fix this:<br />
<br />
{{bc|1=<br />
xrandr --output HDMI1 --left-of LVDS1 --primary --scale 1x1 --output LVDS1 --scale 1.0001x1.0001<br />
}}<br />
<br />
== Xorg repositories ==<br />
Catalyst is notorious for its slow update process. As such, it is common that a new Xorg version is pushed down from upstream that will break compatibility for Catalyst. This means that Catalyst users either have to build Xorg packages on their own, or use a backported repository that only contains the Xorg packages that should be hold back. Vi0L0 has stepped in to fulfil this task and provides several backported repositories. <br />
<br />
To enable one of these, follow the instructions in [[Unofficial user repositories]] (use the same PGP key as for the [[Unofficial user repositories#catalyst|catalyst]] repository). Remember to add the chosen repository '''above all other repositories''' in {{ic|pacman.conf}}, even above your ''catalyst'' repository, should you use one.<br />
<br />
=== xorg116 ===<br />
Catalyst does not support xorg-server 1.17<br />
{{bc|<nowiki><br />
[xorg116]<br />
Server = http://catalyst.wirephire.com/repo/xorg116/$arch<br />
## Mirrors, if the primary server does not work or is too slow:<br />
#Server = http://mirror.rts-informatique.fr/archlinux-catalyst/repo/xorg116/$arch<br />
#Server = http://mirror.hactar.bz/Vi0L0/xorg116/$arch<br />
</nowiki>}}<br />
<br />
=== xorg115 ===<br />
Catalyst < 14.9 does not support xorg-server 1.16<br />
<br />
{{bc|<nowiki><br />
[xorg115]<br />
Server = http://catalyst.wirephire.com/repo/xorg115/$arch<br />
## Mirrors, if the primary server does not work or is too slow:<br />
#Server = http://mirror.rts-informatique.fr/archlinux-catalyst/repo/xorg115/$arch<br />
#Server = http://mirror.hactar.bz/Vi0L0/xorg115/$arch<br />
</nowiki>}}<br />
<br />
=== xorg114 ===<br />
Catalyst < 14.1 does not support xorg-server 1.15.<br />
<br />
{{bc|<nowiki><br />
[xorg114]<br />
Server = http://catalyst.wirephire.com/repo/xorg114/$arch<br />
## Mirrors, if the primary server does not work or is too slow:<br />
#Server = http://mirror.rts-informatique.fr/archlinux-catalyst/repo/xorg114/$arch<br />
#Server = http://mirror.hactar.bz/Vi0L0/xorg114/$arch<br />
</nowiki>}}<br />
<br />
=== xorg113 ===<br />
Catalyst < 13.6 does not support xorg-server 1.14.<br />
<br />
{{bc|<nowiki><br />
[xorg113]<br />
Server = http://catalyst.wirephire.com/repo/xorg113/$arch<br />
## Mirrors, if the primary server does not work or is too slow:<br />
#Server = http://mirror.rts-informatique.fr/archlinux-catalyst/repo/xorg113/$arch<br />
#Server = http://mirror.hactar.bz/Vi0L0/xorg113/$arch<br />
</nowiki>}}<br />
<br />
=== xorg112 ===<br />
Catalyst < 12.10 and Catalyst Legacy do not support xorg-server 1.13.<br />
<br />
{{bc|<nowiki><br />
[xorg112]<br />
Server = http://catalyst.wirephire.com/repo/xorg112/$arch<br />
## Mirrors, if the primary server does not work or is too slow:<br />
#Server = http://mirror.rts-informatique.fr/archlinux-catalyst/repo/xorg112/$arch<br />
#Server = http://mirror.hactar.bz/Vi0L0/xorg112/$arch<br />
</nowiki>}}<br />
<br />
== Tools ==<br />
<br />
=== Catalyst-hook ===<br />
{{AUR|Catalyst-hook}} is a [[systemd]] service that will automatically rebuild the {{ic|fglrx}} modules while the system shuts down or reboots, but only if it is necessary (e.g. after an update).<br />
<br />
Before using this package make sure that both the {{Grp|base-devel}} group and the {{Pkg|linux-headers}} package (the one specific to the kernel you use) are installed.<br />
<br />
To enable the automatic update, enable the {{ic|catalyst-hook.service}}:<br />
<br />
# systemctl enable catalyst-hook<br />
# systemctl start catalyst-hook<br />
<br />
You can also use this package to build the {{ic|fglrx}} module manually. Simply run the {{ic|catalyst_build_module}} script after the kernel has been updated:<br />
<br />
# catalyst_build_module all<br />
<br />
'''A few more technical details:'''<br />
<br />
The {{ic|catalyst-hook.service}} is stopping the systemd "river" and is forcing systemd to wait until catalyst-hook finishes its job.<br />
<br />
The {{ic|catalyst-hook.service}} is calling the {{ic|catalyst_build_module check}} function which checks if fglrx rebuilds are really necessary.<br />
<br />
The {{ic|check}} function is checking if the {{ic|fglrx}} module exists, if it:<br />
<br />
*does not exist, it will build it;<br />
<br />
*does exist, it will compare the two values to be sure that a rebuild is necessary.<br />
<br />
These values are md5sums of the {{ic|/usr/lib/modules/<kernel_version>/build/Module.symvers}} file (because I, Vi0L0, noticed that this file is unique and different for every kernel's release). The first value is the md5sum of the existing {{ic|Module.symvers}} file. The second value is the md5sum of the {{ic|Module.symvers}} file which existed in a moment of the {{ic|fglrx}} module creation. This value was compiled into the {{ic|fglrx}} module by a {{ic|catalyst_build_module}} script.<br />
<br />
If the values are different, it will compile the new {{ic|fglrx}} module.<br />
<br />
The check is checking the whole {{ic|/usr/lib/modules/}} directory and building modules for all of the installed kernels if it is necessary. If the build or rebuild is not necessary, the whole process takes only some milliseconds to complete before it gets killed by systemd.<br />
<br />
=== Catalyst-generator ===<br />
<br />
{{AUR|catalyst-generator}} is a package that is able to build and install the {{ic|fglrx}} module packed into pacman compliant {{ic|<nowiki>catalyst-${kernver}</nowiki>}} packages. The basic difference from [[#Catalyst-hook]] is that you will have to trigger this command manually, whereas Catalyst-hook will do this automatically at boot when a new kernel got installed.<br />
<br />
It creates {{ic|<nowiki>catalyst-${kernver}</nowiki>}} packages using [[makepkg]] and installs them with [[pacman]]. {{ic|${kernver}}} is the kernel version for which each package was built (e.g. catalyst-2.6.35-ARCH package was built for 2.6.35-ARCH kernel).<br />
<br />
To build and install {{ic|<nowiki>catalyst-${kernver}</nowiki>}} package for a currently booted kernel as an unprivileged user (non-root; safer way), use {{ic|catalyst_build_module}}. You will be asked for your root password to proceed to package installation.<br />
<br />
A short summary on how to use this package:<br />
<br />
# As root: {{ic|catalyst_build_module remove}}. This will remove all unused {{ic|<nowiki>catalyst-{kernver}</nowiki>}} packages.<br />
# As unprivileged user: {{ic|<nowiki>catalyst_build_module ${kernver}</nowiki>}}, where {{ic|<nowiki>${kernver}</nowiki>}} is the version of the kernel to which you just updated. For example: {{ic|catalyst_build_module 2.6.36-ARCH}}. You can also build {{ic|<nowiki>catalyst-{kernver}</nowiki>}} for all installed kernels by using {{ic|catalyst_build_module all}}.<br />
# If you want to remove {{ic|catalyst-generator}}, it is best to run this as root before removing catalyst-generator: {{ic|catalyst_build_module remove_all}}. '''This will remove all {{ic|<nowiki>catalyst-{kernver}</nowiki>}} packages from the system.'''<br />
<br />
{{ic|Catalyst-generator}} is not able to remove all those {{ic|<nowiki>catalyst-{kernver}</nowiki>}} packages automatically while being removed because there can not be more than one instance of pacman running. If you forget to run {{ic|# catalyst_build_module remove_all}} before using {{ic|# pacman -R catalyst-generator}} catalyst-generator will tell you which {{ic|<nowiki>catalyst-{kernver}</nowiki>}} packages you will have to remove manually after removing catalyst-generator itself.<br />
<br />
Catalyst-generator is most safe and KISS-friendly solution because:<br />
<br />
# you can use unprivileged user to build the package;<br />
# it is building modules in a fakeroot environment;<br />
# it is not throwing files here and there, [[pacman]] always knows where they are;<br />
# all you have to do is to remember to use it<br />
<br />
{{Note|If you see those warnings:<br />
<br />
'''WARNING:''' Package contains reference to $srcdir<br />
<br />
'''WARNING:''' '.pkg' is not a valid archive extension.<br />
<br />
while building {{ic|<nowiki>catalyst-{kernver}</nowiki>}} package, do not be concerned, it is normal.}}<br />
<br />
=== OpenCL and OpenGL development ===<br />
<br />
Since years AMD is working on tools for OpenCL and OpenGL developement.<br />
<br />
Now under the banner of '''"Heterogeneous Computing"''' AMD is providing even more of them, fortunately most of their computing tools are available also for Linux.<br />
<br />
In the AUR and the [catalyst] repositories you will find packages that represent the most important work from AMD, namely:<br />
<br />
* {{AUR|amdapp-aparapi}}<br />
* {{AUR|amdapp-sdk}}<br />
* {{AUR|amdapp-codex}}{{Broken package link|package not found}}<br />
<br />
APP shortcut stands for Accelerated Parallel Processing.<br />
<br />
==== amdapp-aparapi ====<br />
AMD's Aparapi is an API for expressing data parallel workloads in Java and a runtime component capable of converting the Java bytecode of compatible workloads into OpenCL so that it can be executed on a variety of GPU devices. If Aparapi can’t execute on the GPU, it will execute in a Java thread pool.<br />
<br />
You can find more information about Aparapi [http://developer.amd.com/tools/heterogeneous-computing/aparapi/ here].<br />
<br />
==== amdapp-sdk (formerly known as amdstream) ====<br />
The AMD APP Software Development Kit (SDK) is a complete development platform created by AMD to allow you to quickly and easily develop applications accelerated by AMD APP technology. The SDK provides samples, documentation and other materials to quickly get you started leveraging accelerated compute using OpenCL, Bolt, or C++ AMP in your C/C++ application.<br />
<br />
Since version 2.8 amdapp-sdk is providing aparapiUtil as well as aparapi's samples. A package is available on the [catalyst] repository; it depends on the {{AUR|amdapp-aparapi}} package. The AUR's package will let you decide whether you want aparapi's additions or not.<br />
<br />
Version 2.8 does not provide Profiler functionality, it has been moved to CodeXL.<br />
<br />
You can find more information about AMD APP SDK [http://developer.amd.com/tools/heterogeneous-computing/amd-accelerated-parallel-processing-app-sdk/ here].<br />
<br />
==== amdapp-codexl ====<br />
CodeXL is an OpenCL and OpenGL Debugger and Profiler, with a static OpenCL kernel analyzer. It is a GUI application written atop of the well known [https://aur.archlinux.org/packages/gdebugger gDEBugger] and is available only for x86_64 systems.<br />
<br />
You can find more informations about CodeXL [http://developer.amd.com/tools/heterogeneous-computing/codexl/ here].<br />
<br />
== Features ==<br />
<br />
=== Tear Free Rendering ===<br />
<br />
Presented in '''Catalyst 11.1''', the ''Tear Free Desktop'' feature reduces tearing in 2D, 3D and video applications. This likely adds triple-buffering and v-sync. Do note that it requires additional GPU processing.<br />
<br />
To enable 'Tear Free Desktop' run {{ic|amdcccle}} and go to: {{ic|Display Options}} → {{ic|Tear Free}}.<br />
<br />
Or as root run:<br />
<br />
# aticonfig --set-pcs-u32=DDX,EnableTearFreeDesktop,1<br />
<br />
To disable, again use {{ic|amdcccle}} or run as root:<br />
<br />
# aticonfig --del-pcs-key=DDX,EnableTearFreeDesktop<br />
<br />
=== Video acceleration ===<br />
<br />
'''[[wikipedia:Video_Acceleration_API|Video Acceleration API]] (VA API)''' is an open source software library (libVA) and API specification which provides GPU acceleration for video processing on Linux/UNIX based operating systems. The process works by enabling hardware accelerated video decode at various entry-points (VLD, IDCT, Motion Compensation, deblocking) for common encoding standards (MPEG-2, MPEG-4 ASP/H.263, MPEG-4 AVC/H.264, and VC-1/WMV3).<br />
<br />
VA-API gained a proprietary backend (in November 2009) called {{AUR|xvba-video}}, that allows VA-API programmed applications to take advantage of AMD Radeons UVD2 chipsets via the [[wikipedia:XvBA|XvBA (X-Video Bitstream Acceleration API designed by AMD)]] library.<br />
<br />
{{Note|No need to install the {{AUR|xvba-video}} package when using {{ic|catalyst-test}} or {{ic|catalyst-total}}, because a symlink is being used instead.}}<br />
XvBA support and xvba-video is still under development, however it is '''working very well in most cases'''. Build (or install from Vi0L0's repo) the proprietary {{AUR|xvba-video}} package, or if you have problems with that version, install {{AUR|libva-xvba-driver}}; and also install {{AUR|mplayer-vaapi}} and {{Pkg|libva}}. Then just set your video player to use vaapi:gl as video output:<br />
<br />
$ mplayer -vo vaapi:gl movie.avi<br />
<br />
These options can be added to your mplayer configuration file, see [[MPlayer]].<br />
<br />
For '''smplayer''':<br />
<br />
Options → Preferences → General → Video (tab) → Output driver: User Defined : vaapi:gl<br />
Options → Preferences → General → Video (tab) → Double buffering '''on'''<br />
Options → Preferences → General → General → Screenshots → Turn screenshots '''off'''<br />
Options → Preferences → Performance → Threads for decoding: '''1''' (to turn off -lavdopts parameter)<br />
<br />
{{Note|If Tear Free Desktop is enabled it is better to use:<br />
Options → Preferences → General → Video (tab) → Output driver: vaapi<br />
If Video Output '''vaapi:gl''' is not working - please check:<br />
'''vaapi''', '''vaapi:gl2''' or simply '''xv(0 - AMD Radeon [[wikipedia:Avivo|AVIVO Video]])'''.<br />
}}<br />
<br />
For '''VLC''':<br />
<br />
Tools → Preferences → Input & Codecs → Use GPU accelerated decoding<br />
<br />
It might help to enable v-sync in '''amdcccle''':<br />
<br />
3D → More Settings → Wait for vertical refresh = Always On<br />
<br />
{{Note|If you are using '''Compiz/KWin''', the only way to '''avoid video flickering''' is to watch videos in '''full-screen''' and only when '''Unredirect Fullscreen is off'''.<br />
<br />
In '''compiz''' you need to set '''Redirected Direct Rendering''' in General Options of ccsm. If it is still flickering, try to disable this option in CCSM. It is off by default in '''KWin''', but if you see flickering try to turn "Suspend desktop effects for fullscreen windows" on or off in {{ic|System Settings}} → {{ic|Desktop Effects}} → {{ic|Advanced}}.}}<br />
<br />
=== GPU/Mem frequency, Temperature, Fan speed, Overclocking utilities ===<br />
<br />
You can get the GPU/Mem clocks with: {{ic|$ aticonfig --od-getclocks}}.<br />
<br />
You can get the fan speed with: {{ic|$ aticonfig --pplib-cmd "get fanspeed 0"}}<br />
<br />
You can get the temperature with: {{ic|$ aticonfig --odgt}}<br />
<br />
To set the fanspeed with: {{ic|$ aticonfig --pplib-cmd "set fanspeed 0 50"}} Query Index: 50, Speed in percent<br />
<br />
To overclock and/or underclock it is easier to use a GUI, like '''ATi Overclocking Utility''', which is very simple and requires qt to work. It might be out of date/old, but you can get it [http://kde-apps.org/content/show.php/ATI+Overclock?content=47796 here].<br />
<br />
Another, more complex utility to perform such operations is '''AMDOverdriveCtrl'''. Its homepage is [http://sourceforge.net/projects/amdovdrvctrl here] and you can build {{AUR|amdoverdrivectrl}} from the AUR or from Vi0L0's unofficial repositories.<br />
<br />
=== Double Screen (Dual Head / Dual Screen / Xinerama) ===<br />
<br />
==== Introduction ====<br />
<br />
{{Warning| you should know that there is not one specific solution because each setup differs and needs its own configuration. That is why you will have to adapt the steps below to your own needs. It is possible that you have to try more than once. Therefore, you should save your working {{ic|/etc/X11/xorg.conf}} '''before''' you start modifying and be able to recover from a command-line environment.}}<br />
<br />
* In this chapter, we will describe the installation of two different-sized screens on only one graphics card with two different output ports (DVI + HDMI) using a "BIG Desktop" configuration.<br />
<br />
* The Xinerama solution has some inconveniences, especially because it is not compatible with XrandR. For that very reason, you should not use this solution, because XrandR is a must for our later configuration.<br />
<br />
* The Dual Head solution would allow you to have 2 different sessions (one for each screen). It could be what you want, but you will not be able to move windows from one screen to another. If you have only one screen, you will have to define the mouse inside your Xorg session for each of the two sessions inside the Server Layout section.<br />
<br />
[http://support.amd.com/us/kbarticles/Pages/1105-HowCanIConfigureMultip.aspx ATI Documentation]<br />
<br />
==== ATI Catalyst Control Center ====<br />
<br />
The GUI tool shipped by ATI is very useful and we will try to use it as much as we can. To launch it, open a terminal and use the following command:<br />
<br />
$ {kdesu/gksu} amdcccle<br />
<br />
{{Warning|Do '''not''' use sudo directly with a GUI. Sudo gives you admin rights with user account information. Instead, use ''gksu'' (GNOME) or ''kdesu'' (KDE).}}<br />
<br />
==== Installation ====<br />
<br />
Before we start, make sure that your hardware is plugged in correctly, that power is on and that you know your hardware characteristics (screen dimensions, sizes, refreshment rates, etc.) Normally, both screens are recognized during boot time but not necessarily identified properly, especially if you are not using any Xorg base configuration file ({{ic|/etc/X11/xorg.conf}}) but relying on the hot-plugging feature.<br />
<br />
The first step is to make sure that you screens will be recognized by your DE and by X. For this, you need to generate a basic Xorg configuration file for your two screens:<br />
<br />
# aticonfig --initial --desktop-setup=horizontal --overlay-on=1<br />
<br />
or<br />
<br />
# aticonfig --initial=dual-head --screen-layout=left<br />
<br />
{{Note|{{ic|overlay}} is important because it allows you to have 1 pixel (or more) shared between the 2 screens.}}<br />
{{Tip|For the other possible and available options, do not hesitate to type {{ic|aticonfig --help}} inside a terminal to display all available command lines.}}<br />
<br />
Now you should have a basic Xorg configuration file that you can edit to add your screen resolutions. It is important to use the precise resolution, especially if you have screens of different sizes. These resolutions have to be added in the "Screen" section:<br />
<br />
SubSection "Display"<br />
Depth 24<br />
Modes "X-resolution screen 1xY-resolution screen 1" "Xresolution screen 2xY-resolution screen 2"<br />
EndSubSection<br />
<br />
From now on, instead of editing the {{ic|xorg.conf}} file manually, let us use the ATI GUI tool. Restart X to be sure that your two screens are properly supported and that the resolutions are properly recognized (Screens must be independent, not mirrored).<br />
<br />
==== Configuration ====<br />
<br />
Now you will only have to launch the ATI control center with root privileges, go to the display menu and choose how you would like to set your configuration (small arrow of the drop down menu). A last restart of X and you should be done!<br />
<br />
Before you restart X, do not hesitate to verify your new {{ic|xorg.conf}} file. At this stage, inside the "Display" sub-section of the "Screen" section, you should see a "Virtual" command line, of which the resolution should be the sum of both screens. The "Server Layout" section says all the rest.<br />
<br />
== Uninstallation ==<br />
<br />
If for any reason this driver is not working for you or if you simply want to try out the open source driver, remove the {{ic|catalyst}} and {{ic|catalyst-utils}} packages. Also you should remove {{AUR|catalyst-generator}}, {{AUR|catalyst-hook}} and {{AUR|lib32-catalyst-utils}} packages if they have been installed on your system.<br />
<br />
{{Warning|<br />
*You may need to use {{ic|# pacman -Rdd}} to remove {{AUR|catalyst-utils}} (and/or {{AUR|lib32-catalyst-utils}}) because that package contains ''gl'' related files and many of your installed packages depend on them. These dependencies will be satisfied again when you install {{Pkg|xf86-video-ati}}.<br />
*You may need to remove {{ic|/etc/profile.d/ati-flgrx.sh}} and {{ic|/etc/profile.d/lib32-catalyst}} (if it exists on your system), otherwise {{ic|r600_dri.so}} will fail to load and you would not have 3D support.}}<br />
<br />
{{Note|You should remove unofficial repositories from your {{ic|/etc/pacman.conf}} and run {{ic|# pacman -Syu}}, because those repositories include out-dated Xorg packages to allow use of {{ic|catalyst}} and the {{Pkg|xf86-video-ati}} package needs up-to-date Xorg packages from the [[Official repositories]].}}<br />
<br />
Also follow these steps:<br />
<br />
* If you have the {{ic|/etc/modprobe.d/blacklist-radeon.conf}} file remove it or comment the line {{ic|blacklist radeon}} in that file.<br />
* If you have a file in {{ic|/etc/modules-load.d}} to load the {{ic|fglrx}} module on boot, remove it or comment the line containing {{ic|fglrx}}.<br />
* Make sure to remove or backup {{ic|/etc/X11/xorg.conf}}.<br />
* If you have installed the {{AUR|catalyst-hook}} package, make sure to disable the systemd service.<br />
* If you used the {{ic|nomodeset}} option in your [[kernel parameters]] and plan to use [[#Kernel mode-setting (KMS)|KMS]], remove it.<br />
* '''Reboot''' before installing another driver.<br />
<br />
== Troubleshooting ==<br />
<br />
If you can still boot to command-line, then the problem probably lies in {{ic|/etc/X11/xorg.conf}}<br />
<br />
You can parse the whole {{ic|/var/log/Xorg.0.log}} or, for clues:<br />
<br />
$ grep '(EE)' /var/log/Xorg.0.log<br />
$ grep '(WW)' /var/log/Xorg.0.log<br />
<br />
If you are still confused about what is going on, search the forums first. Then post a message in the [https://bbs.archlinux.org/viewtopic.php?pid=1166052#p1166052/ thread specific to ATI/AMD]. Provide the information from {{ic|xorg.conf}} and both commands mentioned above.<br />
<br />
=== Failed to start atieventsd.service ===<br />
Install {{Pkg|acpid}} from the [[official repositories]]. Start and enable the acpid [[Daemon|service]].<br />
<br />
If the service still fails to start, edit {{ic|/usr/lib/systemd/system/atieventsd.service}} and change {{ic|acpid.socket}} to {{ic|acpid.service}}.<br />
<br />
=== Failed to open fglrx_dri.so ===<br />
Create a symlink from {{ic|/usr/lib/xorg/modules/dri/fglrx_dri.so}} to {{ic|/usr/X11R6/lib64/modules/dri/fglrx_dri.so}} (or other requested path)<br />
<br />
# mkdir -p /usr/X11R6/lib64/modules/dri<br />
# ln -s /usr/lib/xorg/modules/dri/fglrx_dri.so /usr/X11R6/lib64/modules/dri/fglrx_dri.so<br />
<br />
=== GDM fails to start ===<br />
Downgrade the {{pkg|xorg-server}} package or try to use another [[display manager]] like [[LightDM]].<br />
<br />
=== 3D Wine applications freeze ===<br />
If you use a 3D Wine application and it hangs, you have to disable TLS. To do this, either use {{ic|aticonfig}} or edit {{ic|/etc/X11/xorg.conf}}. To use {{ic|aticonfig}}:<br />
<br />
# aticonfig --tls=off<br />
<br />
Or, to edit {{ic|/etc/X11/xorg.conf}}; first open the file in an editor as root and then add {{ic|Option "UseFastTLS" "off"}} to the ''Device'' section of this file. <br />
<br />
After applying either of the solutions, restart X for it to take effect.<br />
<br />
=== Problems with video colours ===<br />
<br />
You may still use {{ic|vaapi:gl}} to avoid video flickering, but without video acceleration:<br />
<br />
* Run '''mplayer''' without {{ic|-vo vaapi}} switch.<br />
<br />
* Run '''smplayer''' remove {{ic|-vo vaapi}} from Options → Preferences → Advanced → Options for MPlayer → Options: -vo vaapi<br />
<br />
Plus for '''smplayer''' you may now safely turn screenshots on.<br />
<br />
=== KWin and composite ===<br />
<br />
You may use XRender if the rendering with OpenGL is slow. However, XRender might also be slower than OpenGL depending on your card.<br />
XRender also solves artefact issues in some cases, for instance when resizing Konsole.<br />
<br />
=== Black screen with complete lockups and/or hangs after reboot or startx ===<br />
<br />
Ensure you have added the {{ic|nomodeset}} option to the kernel options line in your bootloader (see [[#Disable kernel mode setting]]).<br />
<br />
If you are using the legacy driver ({{ic|catalyst-hd234k}}) and get a black screen, try downgrading xorg-server to 1.11 by using the [[#&#91;xorg111&#93;]] repository.<br />
<br />
==== Faulty ACPI hardware calls ====<br />
It is possible that fglrx does not cooperate well with the system's ACPI hardware calls, so it auto-disables itself and there is no screen output.<br />
<br />
If so, try to run this:<br />
<br />
$ aticonfig --acpi-services=off<br />
<br />
=== KDM disappears after logout ===<br />
<br />
If you are running Catalyst proprietary driver and you get a console (tty1) instead of the expected KDM greeting when you log out, you must instruct KDM to restart the X server after each logout. Uncomment the following line under the section titled {{ic|[X-:*-Core]}}<br />
<br />
{{hc|/usr/share/config/kdm/kdmrc|2=<br />
TerminateServer=True<br />
}}<br />
<br />
KDM should now appear when you log out of KDE.<br />
<br />
=== Direct Rendering does not work ===<br />
<br />
This problem may occur when using the proprietary '''Catalyst''' driver.<br />
<br />
{{Warning|This error would also appear if you have not '''rebooted''' your system after the installation or upgrade of catalyst. The system needs to load the fglrx.ko module in order to make the driver work.}}<br />
<br />
If you have problem with direct rendering, run:<br />
<br />
$ LIBGL_DEBUG=verbose glxinfo > /dev/null<br />
<br />
at the command prompt. At the very start of the output, it will usually give you a nice error message saying why you do not have direct rendering.<br />
<br />
Common errors and their solutions, are:<br />
<br />
libGL error: XF86DRIQueryDirectRenderingCapable returned false<br />
<br />
* Ensure that you are loading the correct agp modules for your AGP chipset before you load the {{ic|fglrx}} kernel module. To determine which agp modules you will need, run {{ic|# hwdetect --show-agp}}. Then open your {{ic|/etc/modules-load.d/fglrx.conf}} and add the agp module on a line '''before''' the {{ic|fglrx}} line.<br />
<br />
libGL error: failed to open DRM: Operation not permitted<br />
libGL error: reverting to (slow) indirect rendering<br />
<br />
libGL: OpenDriver: trying /usr/lib/xorg/modules/dri//fglrx_dri.so<br />
libGL error: dlopen /usr/lib/xorg/modules/dri//fglrx_dri.so failed<br />
(/usr/lib/xorg/modules/dri//fglrx_dri.so: cannot open shared object file: No such file or directory)<br />
libGL error: unable to find driver: fglrx_dri.so<br />
<br />
* Something has not been installed correctly. If the paths in the error message are {{ic|/usr/X11R6/lib/modules/dri/fglrx_dri.so}}, then ensure you have logged completely out of your system, then back in. If you are using a graphical login manager (gdm, kdm, xdm), ensure that {{ic|/etc/profile}} is sourced every time you log in. This is usually accomplished by adding {{ic|source /etc/profile}} into {{ic|~/.xsession}} or {{ic|~/.xinitrc}}, but this may vary between login managers.<br />
<br />
* If the paths above in your error message ''are'' {{ic|/usr/lib/xorg/modules/dri/fglrx_dri.so}}, then something has not been correctly installed. Try reinstalling the {{AUR|catalyst}} package.<br />
<br />
Errors such as:<br />
<br />
fglrx: libGL version undetermined - OpenGL module is using glapi fallback<br />
<br />
could be caused by having multiple versions of {{ic|libGL.so}} on your system. The command below should return the following output:<br />
<br />
{{hc|$ locate libGL.s|<br />
/usr/lib/libGL.so<br />
/usr/lib/libGL.so.1<br />
/usr/lib/libGL.so.1.2}}<br />
<br />
These are the only three libGL.so files you should have on your system. If you have any more (e.g. {{ic|/usr/X11R6/lib/libGL.so.1.2}}), then remove them. This should fix your problem.<br />
<br />
You might not get any error to indicate that this is a problem. If you are using X11R7, make sure you do '''not''' have these files on your system:<br />
<br />
/usr/X11R6/lib/libGL.so.1.2<br />
/usr/X11R6/lib/libGL.so.1<br />
<br />
=== Hibernate/Sleep issues ===<br />
<br />
==== Video fails to resume from suspend2ram ====<br />
<br />
ATI's proprietary Catalyst driver cannot resume from suspend if the framebuffer is enabled. To disable the framebuffer, add {{ic|1=vga=0}} to your kernel [[kernel parameters]].<br />
<br />
To see where you need to add this with other bootloaders, see [[#Disable kernel mode setting]].<br />
<br />
=== System freezes/Hard locks ===<br />
<br />
* The {{ic|radeonfb}} framebuffer drivers have been known in the past to cause problems of this nature. If your kernel has radeonfb support compiled in, you may want to try a different kernel and see if this helps.<br />
<br />
* If you experience system freezes when exiting your DE (shut down, suspend, switching to tty etc.) you probably forgot to deactivate KMS. (See [[#Disable kernel mode setting]])<br />
<br />
=== Hardware conflicts ===<br />
<br />
Radeon cards used in conjunction with some versions of the nForce3 chipset (e.g. nForce 3 250Gb) will not have 3D acceleration. Currently the cause of this issue is unknown, but some sources indicate that it may be possible to get acceleration with this combination of hardware by booting Windows with the drivers from nVIDIA and then rebooting the system. This can be verified by getting output something similar to this (using an nForce3-based system):<br />
<br />
{{hc|<nowiki>$ dmesg | grep agp</nowiki>|<br />
agpgart: Detected AGP bridge 0<br />
agpgart: Setting up Nforce3 AGP.<br />
agpgart: aperture base > 4G<br />
}}<br />
<br />
and also if issuing the following command gets you the following output:<br />
<br />
{{hc|<nowiki>$ tail -n 100 /var/log/Xorg.0.log | grep agp</nowiki>|<br />
(EE) fglrx(0): [agp] unable to acquire AGP, error "xf86_ENODEV"}}<br />
<br />
you have this bug.<br />
<br />
Some sources indicate that in some situations, downgrading the motherboard BIOS may help, but this cannot be verified in all cases. Also, '''a bad BIOS downgrade can render your hardware useless, so beware.'''<br />
<br />
See [http://bugzilla.kernel.org/show_bug.cgi?id=6350/ this bugreport] for more information and a potential fix.<br />
<br />
=== Temporary hangs when playing video ===<br />
<br />
This problem may occur when using the proprietary Catalyst.<br />
<br />
If you experience temporary hangs lasting from a few seconds to several minutes occuring randomly during playback with mplayer, check the system logs for output like:<br />
<br />
{{hc|/var/log/messages.log|2=<br />
Nov 28 18:31:56 pandemonium [<c01c64a6>] ? proc_get_sb+0xc6/0x160<br />
Nov 28 18:31:56 pandemonium [<c01c64a6>] ? proc_get_sb+0xc6/0x160<br />
Nov 28 18:31:56 pandemonium [<f8bc628c>] ? ip_firegl_ioctl+0x1c/0x30 [fglrx]<br />
Nov 28 18:31:56 pandemonium [<c01c64a6>] ? proc_get_sb+0xc6/0x160<br />
Nov 28 18:31:56 pandemonium [<c0197038>] ? vfs_ioctl+0x78/0x90<br />
Nov 28 18:31:56 pandemonium [<c01970b7>] ? do_vfs_ioctl+0x67/0x2f0<br />
Nov 28 18:31:56 pandemonium [<c01973a6>] ? sys_ioctl+0x66/0x70<br />
Nov 28 18:31:56 pandemonium [<c0103ef3>] ? sysenter_do_call+0x12/0x33<br />
Nov 28 18:31:56 pandemonium [<c01c64a6>] ? proc_get_sb+0xc6/0x160<br />
Nov 28 18:31:56 pandemonium =======================<br />
}}<br />
<br />
Adding the {{ic|nopat}} and/or {{ic|nomodeset}} [[kernel parameters]] should work.<br />
<br />
=== "aticonfig: No supported adapters detected" ===<br />
<br />
If you get the following:<br />
<br />
{{hc|# aticonfig --initial|<br />
aticonfig: No supported adapters detected<br />
}}<br />
<br />
It may still be possible to get Catalyst working by manually setting the device in your your {{ic|etc/X11/xorg.conf}} file or by copying an older working {{ic|/etc/ati/control}} file (preferred - this also fixes the watermark issue).<br />
<br />
To get an older control file, download a previous version of fglrx from AMD and run it with {{ic|--extract driver}} parameter. You will find the control file in {{ic|driver/common/etc/ati/control}}. Copy the extracted file over the system file and restart Xorg. You can try different versions of the file.<br />
<br />
To set your model in {{ic|xorg.conf}}, edit the device section of {{ic|/etc/X11/xorg.conf}} to:<br />
<br />
{{hc|/etc/X11/xorg.conf|<br />
Section "Device"<br />
Identifier "ATI radeon '''****'''"<br />
Driver "fglrx"<br />
EndSection<br />
}}<br />
<br />
Where {{ic|****}} should be replaced with your device's marketing number (e.g. 6870 for the HD 6870 and 6310 for the E-350 APU).<br />
<br />
Xorg will start and it is possible to use {{ic|amdcccle}} instead of {{ic|aticonfig}}. There will be an "AMD Unsupported hardware" watermark.<br />
<br />
You can remove this watermark using the following script:<br />
<br />
#!/bin/sh<br />
DRIVER=/usr/lib/xorg/modules/drivers/fglrx_drv.so<br />
for x in $(objdump -d $DRIVER|awk '/call/&&/EnableLogo/{print "\\x"$2"\\x"$3"\\x"$4"\\x"$5"\\x"$6}'); do<br />
sed -i "s/$x/\x90\x90\x90\x90\x90/g" $DRIVER<br />
done<br />
<br />
and then reboot your machine.<br />
<br />
=== WebGL support in Chromium ===<br />
<br />
Google has blacklisted Linux's Catalyst driver from supporting webGL in their Chromium/Chrome browsers.<br />
<br />
You can turn webGL on by editing and adding {{ic|--ignore-gpu-blacklist}} flag into the {{ic|Exec}} line so it looks like this:<br />
<br />
{{hc|/usr/share/applications/chromium.desktop|2=<br />
Exec=chromium %U '''--ignore-gpu-blacklist'''<br />
}}<br />
<br />
You can also run chromium from console with the same {{ic|--ignore-gpu-blacklist}} flag:<br />
<br />
$ chromium '''--ignore-gpu-blacklist'''<br />
<br />
{{Warning|Catalyst does not support the {{ic|GL_ARB_robustness}} extension, so it is possible that a malicious site could use WebGL to perform a DoS attack on your graphic card.}}<br />
<br />
=== Lag/freezes when watching flash videos via Adobe's flashplugin ===<br />
<br />
Edit:<br />
<br />
{{hc|/etc/adobe/mms.cfg|2=<br />
#EnableLinuxHWVideoDecode=1<br />
OverrideGPUValidation=true<br />
}}<br />
<br />
If you are using KDE make sure that "Suspend desktop effects for fullscreen windows" is unchecked under {{ic|System Settings}} → {{ic|Desktop Effects}} → {{ic|Advanced}}.<br />
<br />
=== Lag/slow windows movement in GNOME3 ===<br />
<br />
You can try this solution, it has been reported to work for many people.<br />
<br />
Add this line into {{ic|~/.profile}} or into {{ic|/etc/profile}}:<br />
<br />
export CLUTTER_VBLANK=none<br />
<br />
Restart X server or reboot your system.<br />
<br />
=== Not using full screen resolution at 1920x1080 (underscanning, black borders around the screen) ===<br />
<br />
This usually happens when you use a HDMI connection to connect your monitor/TV to your computer.<br />
<br />
Seemed to be a feature by AMD/ATI to work with all HDTVs that could be adjusted via the amdccle.<br />
<br />
Using the amdcccle GUI you can select the affected display, go to adjustments, and set underscan to 0% (aticonfig defaults to 15% underscan). It is possible as well that the underscan slider will not show under the display's adjustments, as sometimes in (at least) version 14.10.<br />
<br />
The problem is that the settings will not persist after restarting X server or rebooting or wake up or might even revert after changing TTYs.<br />
<br />
For the changes to become permanent, you will need to adjust the underscan settings manually using "aticonfig" via console (as root) or manually edit the file {{ic|/etc/ati/amdpcsdb}} (as root)<br />
<br />
'''using aticonfig method:'''<br />
<br />
# aticonfig --set-pcs-u32=MCIL,DigitalHDTVDefaultUnderscan,0<br />
<br />
After changing the settings, reboot.<br />
<br />
For newer version (for example, 12.11), if Catalyst control center repeatedly fails to save the overscan setting you can also try:<br />
<br />
# aticonfig --set-pcs-u32=MCIL,TVEnableOverscan,0<br />
<br />
'''Manually editing /etc/ati/amdpcsdb method:'''<br />
<br />
Add the following line anywhere under the following header {{ic|[AMDPCSROOT/SYSTEM/MCIL]}}<br />
<br />
# DigitalHDTVDefaultUnderscan=V0<br />
<br />
For newer version (for example, 12.11), if Catalyst control center repeatedly fails to save the overscan setting you can also try:<br />
locate under {{ic|[AMDPCSROOT/SYSTEM/MCIL]}} the following line <br />
<br />
# TVEnableOverscan=V1<br />
<br />
and change it to<br />
<br />
# TVEnableOverscan=V0<br />
<br />
After changing the settings, reboot.<br />
<br />
{{note|You might find that the file {{ic|/etc/ati/amdpcsdb}} will be overwritten and revert no matter what you do as user or as root even with log in/log out/reboot, ergo the modification will not stick.<br />
For the amd database file not to be overwritten you have to modify it without the fgrlx driver running.<br />
This can be made by rebooting in any "safe mode" that will not use the driver or directly booting into console mode}}<br />
<br />
'''Workaround:'''<br />
For whatever reason you can find yourself not wanting to touch ATI's config files you can circumvent the problem by forcing the panel's position and resolution:<br />
as user:<br />
<br />
# aticonfig --set-dispattrib=DISPLAYTYPE,positionX:0<br />
# aticonfig --set-dispattrib=DISPLAYTYPE,positionY:0<br />
# aticonfig --set-dispattrib=DISPLAYTYPE,sizeX:1920<br />
# aticonfig --set-dispattrib=DISPLAYTYPE,sizeY:1080<br />
<br />
{{ic|DISPLAYTYPE}} will be the name of the monitor you want to change its attributes, for example "dfp9".<br />
To get the name of your {{ic|DISPLAYTYPE}} run the following command:<br />
<br />
# xrandr --current<br />
<br />
Should RandR be not enabled use:<br />
<br />
# aticonfig --query-monitor<br />
<br />
Using the display switch or DISPLAY variable set to the appropriate display/screen (:0.1 for example) might be necessary.<br />
<br />
That will show you which displays are connected and disconnected and its properties<br />
<br />
This workaround will not persist but it is a quick fix that will show that the panel works just fine and that the above solutions are to be put into place.<br />
<br />
{{note|{{ic|<nowiki>aticonfig --set-pcs-val=MCIL,DigitalHDTVDefaultUnderscan,0</nowiki>}} should not be used on newer versions of the driver as it is deprecated and will be soon removed as stated by ATI.}}<br />
<br />
Try {{ic|<nowiki>aticonfig --help | grep set-pcs-val</nowiki>}} to read ATI's notice<br />
<br />
=== Dual Screen Setup: general problems with acceleration, OpenGL, compositing, performance ===<br />
Try to disable xinerama and xrandr12. Check out ie. this way:<br />
<br />
Type those commands:<br />
# aticonfig --initial<br />
# aticonfig --set-pcs-str="DDX,EnableRandR12,FALSE"<br />
Then reboot your system. In {{ic|/etc/X11/xorg.conf}} check that xinerama is disabled, if it is not, disable it and reboot your system.<br />
<br />
Next run {{ic|amdcccle}} and pick up amdcccle → display manager → multi-display → multidisplay desktop with display(s) 2.<br />
<br />
Reboot again and set up your display layout whatever you desire.<br />
<br />
=== Disabling VariBright feature ===<br />
Type the following command to disable VariBright:<br />
# aticonfig --set-pcs-u32=MCIL,PP_UserVariBrightEnable,0<br />
<br />
=== Hybrid/PowerXpress: turning off discrete GPU ===<br />
When you are using {{AUR|catalyst-total-pxp}} or catalyst-utils-pxp and you are switching to integrated GPU you may notice that discrete GPU is still working, consuming power and making your system's temperature higher. <br />
<br />
Sometimes ie. when your integrated GPU is intel's one you can use {{ic|vgaswitcheroo}} to turn the discrete GPU off.<br />
Sometimes unfortunately, it is not working.<br />
<br />
Then you may check out [https://aur.archlinux.org/packages/?O=0&K=acpi_call acpi_call]. MrDeepPurple has prepared the script which he is using to perform 'turn off' task. He is calling script via systemd service while booting and resuming his system.<br />
Here is his script:<br />
#!/bin/sh<br />
libglx=$(/usr/lib/fglrx/switchlibglx query)<br />
modprobe acpi_call<br />
if [ "$libglx" = "intel" ]; then<br />
echo '\_SB.PCI0.PEG0.PEGP._OFF' > /proc/acpi/call<br />
fi<br />
<br />
=== Switching from X session to TTYs gives a blank screen/low resolution TTY ===<br />
Workaround for this "feature", which appeared in catalyst 13.2 betas, is to use {{ic|1=vga=}} kernel option, like {{ic|1=vga=792}}.<br />
You can get the list of supported resolutions with the<br />
$ hwinfo --framebuffer<br />
command. Get the one that corresponds to your wanted resolution, and copy-paste it into kernel line of your bootloader, so it could look like ie. {{ic|1=vga=0x03d4}}<br />
<br />
=== Switching to TTYs then back to X session gives a black screen with a mouse cursor ===<br />
If you experience this bug, try adding<br />
Option "XAANoOffscreenPixmaps" "true"<br />
to the 'Device' section of your xorg.conf file.<br />
<br />
Also, make sure you have a [[Polkit#Authentication agents|polkit authentication agent]] installed and running, as this behavior can happen when a program is asking for a password, but does not have an authentication agent installed to display the password dialog box.<br />
<br />
=== 30 FPS / Tear-Free / V-Sync bug ===<br />
Bug introduced in Catalyst 13.6 beta, not fixed till now (13.9).<br />
<br />
After enabling "Tear-Free" functionality every freshly started OpenGL application is lagging, often generates only 30 FPS, it also touches composited desktop.<br />
<br />
Workaround is pretty simple and was found by M132. Here are the steps, do everything in "AMD Catalyst Control Center" (amdcccle) application:<br />
<br />
1. Enable Tear-Free, it will set 3D V-Sync option to "Always on".<br />
2. Set 3D V-Sync to "Always Off".<br />
3. Make sure Tear-Free is still on.<br />
4. Restart X / Re-login.<br />
<br />
It is working well on KDE 4.11.x, but in case of problems M132 suggests: "Try disabling "Detect refresh rate" and specify monitor's refresh rate in the Composite plugin."<br />
<br />
=== Backlight adjustment does not work===<br />
If you have a problem with backlight adjustment, you can try the following command: <br />
# aticonfig --set-pcs-u32=MCIL,PP_PhmUseDummyBackEnd,1<br />
Some users reported that this can decrease FPS. To restore defaults, run:<br />
# aticonfig --set-pcs-u32=MCIL,PP_PhmUseDummyBackEnd,0<br />
[http://ati.cchtml.com/show_bug.cgi?id=711 Read more about this bug]<br />
<br />
== See also ==<br />
<br />
* [http://wiki.cchtml.com/index.php/Main_Page Unofficial Wiki for the ATI Linux Driver]<br />
* [http://ati.cchtml.com/query.cgi Unofficial ATI Linux Driver Bugzilla]</div>SilverWyrdahttps://wiki.archlinux.org/index.php?title=SSH_keys&diff=349344SSH keys2014-12-10T01:41:42Z<p>SilverWyrda: /* Keychain */ tip to be prompted only when needed</p>
<hr />
<div>[[Category:Secure Shell]]<br />
[[es:SSH Keys]]<br />
[[it:SSH Keys]]<br />
[[ru:SSH keys]]<br />
[[sr:SSH Keys]]<br />
[[tr:SSH_Anahtarları]]<br />
[[zh-CN:SSH Keys]]<br />
SSH keys serve as a means of identifying yourself to an SSH server using [[Wikipedia:Public-key cryptography|public-key cryptography]] and [[Wikipedia:Challenge-response authentication|challenge-response authentication]]. One immediate advantage this method has over traditional password authentication is that you can be authenticated by the server without ever having to send your password over the network. Anyone eavesdropping on your connection will not be able to intercept and crack your password because it is never actually transmitted. Additionally, using SSH keys for authentication virtually eliminates the risk posed by brute-force password attacks by drastically reducing the chances of the attacker correctly guessing the proper credentials.<br />
<br />
As well as offering additional security, SSH key authentication can be more convenient than the more traditional password authentication. When used with a program known as an SSH agent, SSH keys can allow you to connect to a server, or multiple servers, without having to remember or enter your password for each system.<br />
<br />
SSH keys are not without their drawbacks and may not be appropriate for all environments, but in many circumstances they can offer some strong advantages. A general understanding of how SSH keys work will help you decide how and when to use them to meet your needs. This article assumes you already have a basic understanding of the [[Secure Shell]] protocol and have installed the {{Pkg|openssh}} package, available in the [[official repositories]].<br />
<br />
==Background==<br />
SSH keys always come in pairs, one private and the other public. The private key is known only to you and it should be safely guarded. By contrast, the public key can be shared freely with any SSH server to which you would like to connect.<br />
<br />
When an SSH server has your public key on file and sees you requesting a connection, it uses your public key to construct and send you a challenge. This challenge is like a coded message and it must be met with the appropriate response before the server will grant you access. What makes this coded message particularly secure is that it can only be understood by someone with the private key. While the public key can be used to encrypt the message, it cannot be used to decrypt that very same message. Only you, the holder of the private key, will be able to correctly understand the challenge and produce the correct response.<br />
<br />
This challenge-response phase happens behind the scenes and is invisible to the user. As long as you hold the private key, which is typically stored in the {{ic|~/.ssh/}} directory, your SSH client should be able to reply with the appropriate response to the server.<br />
<br />
Because private keys are considered sensitive information, they are often stored on disk in an encrypted form. In this case, when the private key is required, a passphrase must first be entered in order to decrypt it. While this might superficially appear the same as entering a login password on the SSH server, it is only used to decrypt the private key on the local system. This passphrase is not, and should not, be transmitted over the network.<br />
<br />
==Generating an SSH key pair==<br />
An SSH key pair can be generated by running the {{ic|ssh-keygen}} command:<br />
<br />
{{hc<br />
|$ ssh-keygen -t rsa -b 4096 -C "$(whoami)@$(hostname)-$(date -I)"<br />
|<nowiki>Generating public/private rsa key pair.<br />
Enter file in which to save the key (/home/username/.ssh/id_rsa):<br />
Enter passphrase (empty for no passphrase):<br />
Enter same passphrase again:<br />
Your identification has been saved in /home/username/.ssh/id_rsa.<br />
Your public key has been saved in /home/username/.ssh/id_rsa.pub.<br />
The key fingerprint is:<br />
dd:15:ee:24:20:14:11:01:b8:72:a2:0f:99:4c:79:7f username@localhost-2014-11-22<br />
The key's randomart image is:<br />
+--[RSA 4096]---+<br />
| ..oB=. . |<br />
| . . . . . |<br />
| . . . + |<br />
| oo.o . . = |<br />
|o+.+. S . . . |<br />
|=. . E |<br />
| o . |<br />
| . |<br />
| |<br />
+-----------------+</nowiki>}}<br />
<br />
In the above example, {{ic|ssh-keygen}} generates a 4096 bit long ({{ic|-b 4096}}) public/private RSA ({{ic|-t rsa}}) key pair with an extended comment including the data ({{ic|-C "$(whoami)@$(hostname)-$(date -I)"}}). The [http://www.cs.berkeley.edu/~dawnsong/papers/randomart.pdf randomart image] was introduced in OpenSSH 5.1 as an easier means of visually identifying the key fingerprint.<br />
<br />
===Choosing the type of encryption===<br />
The Elliptic Curve Digital Signature Algorithm (ECDSA) provides smaller key sizes and faster operations for equivalent estimated security to the previous methods. It was introduced as the preferred algorithm for authentication in OpenSSH 5.7, see [http://www.openssh.com/txt/release-5.7 OpenSSH 5.7 Release Notes]. '''ECDSA keys might not be compatible with systems that ship old versions of OpenSSH.''' Some vendors also disable the required implementations due to potential patent issues.<br />
{{Note|As of December 28, 2013, the Windows SSH client PuTTY does not support ECDSA and cannot connect to a server that uses ECDSA keys.}}<br />
{{Note|1=As of June 10, 2014, ECDSA keys will not work with GNOME Keyring because of a known [https://bugzilla.gnome.org/show_bug.cgi?id=641082 GNOME bug].}}<br />
<br />
If you choose to create an RSA (2048-16384 bit) or DSA (2048 bit) key pair instead of ECDSA, use the {{ic|-t rsa}} or {{ic|-t dsa}} switches in your {{ic|ssh-keygen}} command and do not forget to increase the key size. Running {{ic|ssh-keygen}} without the {{ic|-b}} switch should provide reasonable defaults.<br />
<br />
{{Note|These keys are used only to authenticate you; choosing stronger keys will not increase CPU load when transferring data over SSH.}}<br />
<br />
===Choosing the key location and passphrase===<br />
Upon issuing the {{ic|ssh-keygen}} command, you will be prompted for the desired name and location of your private key. By default, keys are stored in the {{ic|~/.ssh/}} directory and named according to the type of encryption used. You are advised to accept the default name and location in order for later code examples in this article to work properly.<br />
<br />
When prompted for a passphrase, choose something that will be hard to guess if you have the security of your private key in mind. A longer, more random password will generally be stronger and harder to crack should it fall into the wrong hands.<br />
<br />
It is also possible to create your private key without a passphrase. While this can be convenient, you need to be aware of the associated risks. Without a passphrase, your private key will be stored on disk in an unencrypted form. Anyone who gains access to your private key file will then be able to assume your identity on any SSH server to which you connect using key-based authentication. Furthermore, without a passphrase, you must also trust the root user, as he can bypass file permissions and will be able to access your unencrypted private key file at any time.<br />
<br />
====Changing the private key's passphrase without changing the key====<br />
If the originally chosen SSH key passphrase is undesirable or must be changed, one can use the {{ic|ssh-keygen}} command to change the passphrase without changing the actual key.<br />
<br />
To change the passphrase for the private RSA key, run the following command:<br />
$ ssh-keygen -f ~/.ssh/id_rsa -p<br />
<br />
====Managing multiple keys====<br />
It's possible to manage keys per host by creating the file {{ic|~/.ssh/config}} and assigning each host another key for authentication if needed. Actually it's not needed, because you could use the same identity for each host. Yet, you don't want to use the same key for each client, then create this file like shown here:<br />
Host SERVERNAME1<br />
IdentitiesOnly yes<br />
IdentityFile ~/.ssh/id_rsa_SERVER1<br />
# CheckHostIP yes<br />
# Port 22<br />
Host SERVERNAME2<br />
IdentitiesOnly yes<br />
IdentityFile ~/.ssh/id_rsa_SERVER2<br />
# CheckHostIP no<br />
# Port 2177<br />
ControlMaster auto<br />
ControlPath /tmp/%r@%h:%p<br />
Many more options you will find with<br />
$ man ssh_config 5<br />
<br />
==Copying the public key to the remote server==<br />
Once you have generated a key pair, you will need to copy the public key to the remote server so that it will use SSH key authentication. The public key file shares the same name as the private key except that it is appended with a {{ic|.pub}} extension. Note that the private key is not shared and remains on the local machine.<br />
<br />
===Simple method===<br />
<br />
{{Note|1=This method might fail if the remote server uses a non-{{ic|sh}} shell such as {{ic|tcsh}} as default. See [https://bugzilla.redhat.com/show_bug.cgi?id=1045191 this bug report].}}<br />
<br />
If your key file is {{ic|~/.ssh/id_rsa.pub}} you can simply enter the following command.<br />
$ ssh-copy-id remote-server.org<br />
<br />
If your username differs on remote machine, be sure to prepend the username followed by {{ic|@}} to the server name.<br />
$ ssh-copy-id username@remote-server.org<br />
<br />
If your public key filename is anything other than the default of {{ic|~/.ssh/id_rsa.pub}} you will get an error stating {{ic|/usr/bin/ssh-copy-id: ERROR: No identities found}}. In this case, you must explicitly provide the location of the public key.<br />
$ ssh-copy-id -i ~/.ssh/id_ecdsa.pub username@remote-server.org<br />
<br />
If the ssh server is listening on a port other than default of 22, be sure to include it within the host argument.<br />
$ ssh-copy-id -i ~/.ssh/id_ecdsa.pub -p 221 username@remote-server.org<br />
<br />
===Traditional method===<br />
By default, for OpenSSH, the public key needs to be concatenated with {{ic|~/.ssh/authorized_keys}}. Begin by copying the public key to the remote server.<br />
<br />
$ scp ~/.ssh/id_ecdsa.pub username@remote-server.org:<br />
<br />
The above example copies the public key ({{ic|id_ecdsa.pub}}) to your home directory on the remote server via {{ic|scp}}. Do not forget to include the {{ic|:}} at the end of the server address. Also note that the name of your public key may differ from the example given.<br />
<br />
On the remote server, you will need to create the {{ic|~/.ssh}} directory if it does not yet exist and append your public key to the {{ic|authorized_keys}} file.<br />
<br />
$ ssh username@remote-server.org<br />
username@remote-server.org's password:<br />
$ mkdir ~/.ssh<br />
$ chmod 700 ~/.ssh<br />
$ cat ~/id_ecdsa.pub >> ~/.ssh/authorized_keys<br />
$ rm ~/id_ecdsa.pub<br />
$ chmod 600 ~/.ssh/authorized_keys<br />
<br />
The last two commands remove the public key file from the server and set the permissions on the {{ic|authorized_keys}} file such that it is only readable and writable by you, the owner.<br />
<br />
==Security==<br />
<br />
===Securing the authorized_keys file===<br />
<br />
For additional protection, you can prevent users from adding new public keys and connecting from them.<br />
<br />
Make the {{ic|authorized_keys}} file read-only for the user and deny all other permissions:<br />
$ chmod 400 ~/.ssh/authorized_keys<br />
<br />
To keep the user from simply changing the permissions back, [[File permissions and attributes#chattr and lsattr|set the immutable bit]] on the {{ic|authorized_keys}} file. After that the user could rename the {{ic|~/.ssh}} directory to something else and create a new {{ic|~/.ssh}} directory and {{ic|authorized_keys}} file. To prevent this, set the immutable bit on the {{ic|~/.ssh}} directory too.<br />
<br />
{{Note|If you find yourself needing to add a new key, you will first have to remove the immutable bit from {{ic|authorized_keys}} and make it writable. Follow the steps above to secure it again.}}<br />
<br />
===Disabling password logins===<br />
While copying your public key to the remote SSH server eliminates the need to transmit your password over the network, it does not give any added protection against a brute-force password attack. In the absence of a private key, the SSH server will fall back to password authentication by default, thus allowing a malicious user to attempt to gain access by guessing your password. To disable this behavior, edit the following lines in the {{ic|/etc/ssh/sshd_config}} file on the remote server.<br />
<br />
{{hc|/etc/ssh/sshd_config|<br />
PasswordAuthentication no<br />
ChallengeResponseAuthentication no}}<br />
<br />
=== Two-factor authentication and public keys ===<br />
<br />
Since OpenSSH 6.2, you can add your own chain to authenticate with using the {{ic|AuthenticationMethods}} option. This enables you to use public keys as well as a two-factor authorization.<br />
<br />
See [[Google Authenticator]] to set up Google Authenticator.<br />
<br />
To use PAM with OpenSSH, edit the following files:<br />
<br />
{{hc|/etc/ssh/sshd_config|<br />
ChallengeResponseAuthentication yes<br />
AuthenticationMethods publickey keyboard-interactive:pam<br />
}}<br />
<br />
Then you can log in with either a publickey, or a password+verification code combination.<br />
<br />
==SSH agents==<br />
If your private key is encrypted with a passphrase, this passphrase must be entered every time you attempt to connect to an SSH server using public-key authentication. Each individual invocation of {{ic|ssh}} or {{ic|scp}} will need the passphrase in order to decrypt your private key before authentication can proceed.<br />
<br />
An SSH agent is a program which caches your decrypted private keys and provides them to SSH client programs on your behalf. In this arrangement, you must only provide your passphrase once, when adding your private key to the agent's cache. This facility can be of great convenience when making frequent SSH connections.<br />
<br />
An agent is typically configured to run automatically upon login and persist for the duration of your login session. A variety of agents, front-ends, and configurations exist to achieve this effect. This section provides an overview of a number of different solutions which can be adapted to meet your specific needs.<br />
<br />
===ssh-agent===<br />
ssh-agent is the default agent included with OpenSSH. It can be used directly or serve as the back-end to a few of the front-end solutions mentioned later in this section. When {{ic|ssh-agent}} is run, it will fork itself to the background and print out the environment variables it would use.<br />
<br />
$ ssh-agent<br />
SSH_AUTH_SOCK=/tmp/ssh-vEGjCM2147/agent.2147; export SSH_AUTH_SOCK;<br />
SSH_AGENT_PID=2148; export SSH_AGENT_PID;<br />
echo Agent pid 2148;<br />
<br />
To make use of these variables, run the command through the {{ic|eval}} command.<br />
<br />
$ eval $(ssh-agent)<br />
Agent pid 2157<br />
<br />
You can append the above command to your {{ic|~/.bash_profile}} script so that it will run automatically when starting a login shell.<br />
<br />
$ echo 'eval $(ssh-agent)' >> ~/.bash_profile<br />
<br />
Once {{ic|ssh-agent}} is running, you will need to add your private key to its cache.<br />
<br />
$ ssh-add ~/.ssh/id_ecdsa<br />
Enter passphrase for /home/user/.ssh/id_ecdsa:<br />
Identity added: /home/user/.ssh/id_ecdsa (/home/user/.ssh/id_ecdsa)<br />
<br />
If you would like your private keys to be added automatically on login. Add the following command to your {{ic|~/.bash_profile}} as well.<br />
<br />
$ ssh-add<br />
<br />
If your private key is encrypted, {{ic|ssh-add}} will prompt you to enter your passphrase. Once your private key has been successfully added to the agent you will be able to make SSH connections without having to enter a passphrase.<br />
<br />
If you would prefer not to be prompted for your passphrase until your key is needed, adding<br />
<br />
$ ssh-add -l >/dev/null || alias ssh='ssh-add -l >/dev/null || ssh-add && unalias ssh; ssh'<br />
<br />
to {{ic|~/.bashrc}} will cause {{ic|ssh-add}} to be run when needed and destroy the alias afterwards.<br />
<br />
One downside to this approach is that a new instance of {{ic|ssh-agent}} is created for every login shell and each instance will persist between login sessions. Over time you can wind up with dozens of needless {{ic|ssh-agent}} processes running. There exist a number of front-ends to ssh-agent and alternative agents described later in this section which avoid this problem.<br />
<br />
Another downside is that the key will not be added by commands other than ssh that use the private key, such as many git commands.<br />
<br />
====Start ssh-agent with systemd user====<br />
<br />
It is possible to use the [[Systemd/User]] facilities to start the agent.<br />
Put the following unit file in your {{ic|~/.config/systemd/user}} folder:<br />
<br />
{{hc|ssh-agent.service|<nowiki><br />
[Unit]<br />
Description=SSH key agent<br />
<br />
[Service]<br />
Type=forking<br />
Environment=SSH_AUTH_SOCK=%t/ssh-agent.socket<br />
ExecStart=/usr/bin/ssh-agent -a $SSH_AUTH_SOCK<br />
<br />
[Install]<br />
WantedBy=</nowiki>''MyTarget''.target<br />
}}<br />
<br />
Add {{ic|1=export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-agent.socket"}} to your shell's startup file, for example {{ic|.bash_profile}} for [[Bash]].<br />
<br />
Then enable and start the service.<br />
<br />
====ssh-agent as a wrapper program====<br />
An alternative way to start ssh-agent (with, say, each X session) is described in [http://upc.lbl.gov/docs/user/sshagent.shtml this ssh-agent tutorial by UC Berkeley Labs]. A basic use case is if you normally begin X with the {{ic|startx}} command, you can instead prefix it with {{ic|ssh-agent}} like so:<br />
<br />
$ ssh-agent startx<br />
<br />
And so you don't even need to think about it you can put an alias in your {{ic|.bash_aliases}} file or equivalent:<br />
<br />
alias startx='ssh-agent startx'<br />
<br />
Doing it this way avoids the problem of having extraneous {{ic|ssh-agent}} instances floating around between login sessions. Exactly one instance will live and die with the entire X session.<br />
<br />
{{note|You can also add {{ic|eval $(ssh-agent)}} to {{ic|~/.xinitrc}}.}}<br />
<br />
See [[#Calling_x11-ssh-askpass_with_ssh-add|the below notes on using x11-ssh-askpass with ssh-add]] for an idea on how to immediately add your key to the agent.<br />
<br />
===GnuPG Agent===<br />
<br />
{{Merge|GnuPG#gpg-agent|This section should just refer to the main article.}}<br />
<br />
The [[GnuPG]] agent, distributed with the {{Pkg|gnupg}} package, available in the [[official repositories]], has OpenSSH agent emulation. If you already use the GnuPG suite, you might consider using its agent to also cache your SSH keys. Additionally, some users may prefer the PIN entry dialog GnuPG agent provides as part of its passphrase management.<br />
<br />
{{Note|If you are using KDE and have {{Pkg|kde-agent}} installed you only need to set {{ic|enable-ssh-support}} into {{ic|~/.gnupg/gpg-agent.conf}}! Otherwise, continue reading.}}<br />
<br />
To start using GnuPG agent for your SSH keys, you should first start ''gpg-agent'' with the {{ic|--enable-ssh-support}} option. Example (do not forget to make the file executable):<br />
{{hc|/etc/profile.d/gpg-agent.sh|<nowiki><br />
#!/bin/sh<br />
<br />
# Start the GnuPG agent and enable OpenSSH agent emulation<br />
gnupginf="${HOME}/.gpg-agent-info"<br />
<br />
if pgrep -x -u "${USER}" gpg-agent >/dev/null 2>&1; then<br />
eval `cat $gnupginf`<br />
eval `cut -d= -f1 $gnupginf | xargs echo export`<br />
else<br />
eval `gpg-agent -s --enable-ssh-support --daemon --write-env-file "$gnupginf"`<br />
fi<br />
</nowiki>}}<br />
<br />
Once ''gpg-agent'' is running you can use ''ssh-add'' to approve keys, just like you did with plain ''ssh-agent''. The list of approved keys is stored in the {{ic|~/.gnupg/sshcontrol}} file. Once your key is approved, you will get a PIN entry dialog every time your passphrase is needed. You can control passphrase caching in the {{ic|~/.gnupg/gpg-agent.conf}} file. The following example would have ''gpg-agent'' cache your keys for 3 hours: <br />
{{hc|~/.gnupg/gpg-agent.conf|<br />
# Cache settings<br />
default-cache-ttl 10800<br />
default-cache-ttl-ssh 10800<br />
}}<br />
Other useful settings for this file include the PIN entry program (GTK, QT, or ncurses version), keyboard grabbing, and so on...<br />
<br />
{{Note|{{ic|gpg-agent.conf}} must be created, and the variable {{ic|write-env-file}} must be set in order to allow ''gpg-agent'' keys to be injected to SSH across logins, unless you restart ''gpg-agent'', and therefore, export its settings, with every login.}}<br />
{{hc|~/.gnupg/gpg-agent.conf|<nowiki><br />
# Environment file<br />
write-env-file /home/username/.gpg-agent-info<br />
<br />
# Keyboard control<br />
#no-grab<br />
<br />
# PIN entry program<br />
#pinentry-program /usr/bin/pinentry-curses<br />
#pinentry-program /usr/bin/pinentry-qt4<br />
#pinentry-program /usr/bin/pinentry-kwallet<br />
pinentry-program /usr/bin/pinentry-gtk-2<br />
<br />
</nowiki>}}<br />
<br />
To use the agent, you can then source and export the environment variables that ''gpg-agent'' writes in {{ic|.gpg-agent-info}}, which is the file specified with {{ic|write-env-file}}.<br />
{{hc|~/.bashrc|<nowiki><br />
...<br />
<br />
if [ -f "${HOME}/.gpg-agent-info" ]; then<br />
. "${HOME}/.gpg-agent-info"<br />
export GPG_AGENT_INFO<br />
export SSH_AUTH_SOCK<br />
fi<br />
</nowiki>}}<br />
<br />
===Keychain===<br />
[http://www.funtoo.org/Keychain Keychain] is a program designed to help you easily manage your SSH keys with minimal user interaction. It is implemented as a shell script which drives both ''ssh-agent'' and ''ssh-add''. A notable feature of Keychain is that it can maintain a single ''ssh-agent'' process across multiple login sessions. This means that you only need to enter your passphrase once each time your local machine is booted.<br />
<br />
[[pacman|Install]] the {{Pkg|keychain}} package, available from the [[official repositories]].<br />
<br />
Append the following line to {{ic|~/.bash_profile}}:<br />
{{hc|~/.bash_profile|<br />
eval $(keychain --eval --agents ssh -Q --quiet id_ecdsa)<br />
}}<br />
<br />
In the above example, the {{ic|--eval}} switch outputs lines to be evaluated by the opening {{ic|eval}} command. This sets the necessary environments variables for SSH client to be able to find your agent. The {{ic|--agents}} switch is not strictly necessary because Keychain will build the list automatically based on the existence of ''ssh-agent'' or ''gpg-agent'' on the system. Adding the {{ic|--quiet}} switch will limit output to warnings, errors, and user prompts. If you want greater security, replace {{ic|-Q}} with {{ic|--clear}} but will be less convenient.<br />
<br />
If necessary, replace {{ic|~/.ssh/id_ecdsa}} with the path to your private key. For those using a non-Bash compatible shell, see {{ic|keychain --help}} or {{ic|man keychain}} for details on other shells.<br />
<br />
To test Keychain, log out from your session and log back in. If this is your first time running Keychain, it will prompt you for the passphrase of the specified private key. Because Keychain reuses the same ''ssh-agent'' process on successive logins, you should not have to enter your passphrase the next time you log in. You will only be prompted for your passphrase once each time the machine is rebooted.<br />
<br />
{{Tip|To be prompted only when needed, you can also define an alias for {{ic|ssh}} (which sets a 10 minute expiration timeout):<br />
{{hc|~/.bash_aliases|2=<br />
alias ssh="eval $(keychain --eval --agents ssh -Q --timeout 10 --quiet id_ecdsa) && ssh"<br />
}}<br />
}}<br />
<br />
===envoy===<br />
<br />
An alternative to keychain is [https://github.com/vodik/envoy envoy]. Envoy is available as {{Pkg|envoy}} in the [[official repositories]], or the Git version is in the [[AUR]] as {{AUR|envoy-git}}.<br />
<br />
After installing it, set up the envoy socket with<br />
<br />
# systemctl enable envoy@ssh-agent.socket<br />
<br />
And add to your shell's rc file:<br />
<br />
envoy -t ssh-agent -a ''ssh_key''<br />
source <(envoy -p)<br />
<br />
If the key is {{ic|~/.ssh/id_rsa}}, {{ic|~/.ssh/id_dsa}}, {{ic|~/.ssh/id_ecdsa}}, or {{ic|~/.ssh/identity}}, the {{ic|-a ''ssh_key''}} parameter is not needed.<br />
<br />
====envoy with key passphrases stored in kwallet====<br />
<br />
If you have long passphrases for your SSH keys, remembering them can be a pain. So let us tell kwallet to store them!<br />
Along with {{Pkg|envoy}}, install {{Pkg|ksshaskpass}} and {{Pkg|kdeutils-kwalletmanager}} from the [[official repositories]]. Next, enable the envoy socket in systemd (see above).<br />
<br />
First, you will add this script to {{ic|~/.kde4/Autostart/ssh-agent.sh}}:<br />
#!/bin/sh<br />
envoy -t ssh-agent -a ''ssh_key''<br />
Then, make sure the script is executable by running: {{ic|chmod +x ~/.kde4/Autostart/ssh-agent.sh}}<br />
<br />
And add this to {{ic|~/.kde4/env/ssh-agent.sh}}:<br />
#!/bin/sh<br />
eval $(envoy -p)<br />
<br />
When you log into KDE, it will execute the {{ic|ssh-agent.sh}} script. This will call ''ksshaskpass'', which will prompt you for your kwallet password when envoy calls ''ssh-agent''.<br />
<br />
===x11-ssh-askpass===<br />
The {{pkg|x11-ssh-askpass}} package provides a graphical dialog for entering your passhrase when running an X session. ''x11-ssh-askpass'' depends only on the {{Pkg|libx11}} and {{Pkg|libxt}} libraries, and the appearance of ''x11-ssh-askpass'' is customizable. While it can be invoked by the ''ssh-add'' program, which will then load your decrypted keys into [[#ssh-agent|ssh-agent]], the following instructions will, instead, configure ''x11-ssh-askpass'' to be invoked by the aforementioned [[#Keychain|Keychain]] script.<br />
<br />
Install {{Pkg|keychain}} and {{Pkg|x11-ssh-askpass}}, both available in the [[official repositories]].<br />
<br />
Edit your {{ic|~/.xinitrc}} file to include the following lines, replacing the name and location of your private key if necessary. Be sure to place these commands '''before''' the line which invokes your window manager.<br />
<br />
{{hc|~/.xinitrc|<br />
keychain ~/.ssh/id_ecdsa<br />
[ -f ~/.keychain/$HOSTNAME-sh ] && . ~/.keychain/$HOSTNAME-sh 2>/dev/null<br />
[ -f ~/.keychain/$HOSTNAME-sh-gpg ] && . ~/.keychain/$HOSTNAME-sh-gpg 2>/dev/null<br />
...<br />
exec openbox-session}}<br />
<br />
In the above example, the first line invokes ''keychain'' and passes the name and location of your private key. If this is not the first time ''keychain'' was invoked, the following two lines load the contents of {{ic|$HOSTNAME-sh}} and {{ic|$HOSTNAME-sh-gpg}}, if they exist. These files store the environment variables of the previous instance of ''keychain''.<br />
<br />
====Calling x11-ssh-askpass with ssh-add====<br />
The ''ssh-add'' manual page specifies that, in addition to needing the {{ic|DISPLAY}} variable defined, you also need {{ic|SSH_ASKPASS}} set to the name of your askpass program (in this case ''x11-ssh-askpass''). It bears keeping in mind that the default Arch Linux installation places the ''x11-ssh-askpass'' binary in {{ic|/usr/lib/ssh/}}, which will not be in most people's {{ic|PATH}}. This is a little annoying, not only when declaring the {{ic|SSH_ASKPASS}} variable, but also when theming. You have to specify the full path everywhere. Both inconveniences can be solved simultaneously by symlinking:<br />
<br />
$ ln -sv /usr/lib/ssh/x11-ssh-askpass ~/bin/ssh-askpass<br />
<br />
This is assuming that {{ic|~/bin}} is in your {{ic|PATH}}. So now in your {{ic|.xinitrc}}, before calling your window manager, one just needs to export the {{ic|SSH_ASKPASS}} environment variable:<br />
<br />
$ export SSH_ASKPASS=ssh-askpass<br />
<br />
and your [[X resources]] will contain something like:<br />
<br />
ssh-askpass*background: #000000<br />
<br />
Doing it this way works well with [[#ssh-agent_as_a_wrapper_program|the above method on using ''ssh-agent'' as a wrapper program]]. You start X with {{ic|ssh-agent startx}} and then add ''ssh-add'' to your window manager's list of start-up programs.<br />
<br />
====Theming====<br />
The appearance of the ''x11-ssh-askpass'' dialog can be customized by setting its associated [[X resources]]. The ''x11-ssh-askpass'' [http://www.jmknoble.net/software/x11-ssh-askpass/ home page] presents some [http://www.jmknoble.net/software/x11-ssh-askpass/screenshots.html example themes]. See the ''x11-ssh-askpass'' manual page for full details.<br />
<br />
====Alternative passphrase dialogs====<br />
There are other passphrase dialog programs which can be used instead of ''x11-ssh-askpass''. The following list provides some alternative solutions.<br />
<br />
* {{Pkg|ksshaskpass}} is available in the official repositories. It is dependent on {{Pkg|kdelibs}} and is suitable for the [[KDE]] Desktop Environment.<br />
<br />
* {{Pkg|openssh-askpass}} depends on the {{Pkg|qt4}} libraries and is available from the official repositories.<br />
<br />
===pam_ssh===<br />
The [http://pam-ssh.sourceforge.net/ pam_ssh] project exists to provide a [[Wikipedia:Pluggable authentication module|Pluggable Authentication Module]] (PAM) for SSH private keys. This module can provide single sign-on behavior for your SSH connections. On login, your SSH private key passphrase can be entered in place of, or in addition to, your traditional system password. Once you have been authenticated, the pam_ssh module spawns ssh-agent to store your decrypted private key for the duration of the session.<br />
<br />
To enable single sign-on behavior at the tty login prompt, install the unofficial {{AUR|pam_ssh}} package, available in the [[Arch User Repository]]. <br />
<br />
{{Note|pam_ssh 2.0 now requires that all private keys used in the authentication process be located under {{ic|~/.ssh/login-keys.d/}}.}}<br />
<br />
Create a symlink to your private key file and place it in {{ic|~/.ssh/login-keys.d/}}. Replace the {{ic|id_rsa}} in the example below with the name of your own private key file.<br />
<br />
$ mkdir ~/.ssh/login-keys.d/<br />
$ cd ~/.ssh/login-keys.d/<br />
$ ln -s ../id_rsa<br />
<br />
Edit the {{ic|/etc/pam.d/login}} configuration file to include the text highlighted in bold in the example below. The order in which these lines appear is significiant and can affect login behavior.<br />
<br />
{{Warning|Misconfiguring PAM can leave the system in a state where all users become locked out. Before making any changes, you should have an understanding of how PAM configuration works as well as a backup means of accessing the PAM configuration files, such as an Arch Live CD, in case you become locked out and need to revert any changes. An IBM developerWorks [http://www.ibm.com/developerworks/linux/library/l-pam/index.html article] is available which explains PAM configuration in further detail.}}<br />
<br />
{{hc|/etc/pam.d/login|2=<br />
#%PAM-1.0<br />
<br />
auth required pam_securetty.so<br />
auth requisite pam_nologin.so<br />
auth include system-local-login<br />
'''auth optional pam_ssh.so try_first_pass'''<br />
account include system-local-login<br />
session include system-local-login<br />
'''session optional pam_ssh.so'''<br />
}}<br />
<br />
In the above example, login authentication initially proceeds as it normally would, with the user being prompted to enter his user password. The additional {{ic|auth}} authentication rule added to the end of the authentication stack then instructs the pam_ssh module to try to decrypt any private keys found in the {{ic|~/.ssh/login-keys.d}} directory. The {{ic|try_first_pass}} option is passed to the pam_ssh module, instructing it to first try to decrypt any SSH private keys using the previously entered user password. If the user's private key passphrase and user password are the same, this should succeed and the user will not be prompted to enter the same password twice. In the case where the user's private key passphrase user password differ, the pam_ssh module will prompt the user to enter the SSH passphrase after the user password has been entered. The {{ic|optional}} control value ensures that users without an SSH private key are still able to log in. In this way, the use of pam_ssh will be transparent to users without an SSH private key.<br />
<br />
If you use another means of logging in, such as an X11 display manager like [[SLiM]] or [[XDM]] and you would like it to provide similar functionality, you must edit its associated PAM configuration file in a similar fashion. Packages providing support for PAM typically place a default configuration file in the {{ic|/etc/pam.d/}} directory.<br />
<br />
Further details on how to use pam_ssh and a list of its options can be found in the pam_ssh man page.<br />
<br />
====Known issues with pam_ssh====<br />
Work on the pam_ssh project is infrequent and the documentation provided is sparse. You should be aware of some of its limitations which are not mentioned in the package itself.<br />
<br />
* Versions of pam_ssh prior to version 2.0 do not support SSH keys employing the newer option of ECDSA (elliptic curve) cryptography. If you are using earlier versions of pam_ssh you must use either RSA or DSA keys.<br />
<br />
* The {{ic|ssh-agent}} process spawned by pam_ssh does not persist between user logins. If you like to keep a [[GNU Screen]] session active between logins you may notice when reattaching to your screen session that it can no longer communicate with ssh-agent. This is because the GNU Screen environment and those of its children will still reference the instance of ssh-agent which existed when GNU Screen was invoked but was subsequently killed in a previous logout. The [[#Keychain|Keychain]] front-end avoids this problem by keeping the ssh-agent process alive between logins.<br />
<br />
===GNOME Keyring===<br />
If you use the [[GNOME]] desktop, the [[GNOME Keyring]] tool can be used as an SSH agent. See the [[GNOME Keyring]] article for further details.<br />
<br />
==Troubleshooting==<br />
If it appears that the SSH server is ignoring your keys, ensure that you have the proper permissions set on all relevant files.<br /><br />
For the local machine:<br />
<br />
$ chmod 700 ~/<br />
$ chmod 700 ~/.ssh<br />
$ chmod 600 ~/.ssh/id_ecdsa<br />
<br />
For the remote machine:<br />
<br />
$ chmod 700 ~/<br />
$ chmod 700 ~/.ssh<br />
$ chmod 600 ~/.ssh/authorized_keys<br />
<br />
If that does not solve the problem you may try temporarily setting {{ic|StrictModes}} to {{ic|no}} in {{ic|sshd_config}}. If authentication with StrictModes off is successful, it is likely an issue with file permissions persists.<br />
{{Tip|Do not forget to set {{ic|StrictModes}} to {{ic|yes}} for added security.}}<br />
Make sure the remote machine supports the type of keys you are using. Try using RSA or DSA keys instead [[#Generating an SSH key pair]]<br />
Some servers do not support ECDSA keys. <br />
<br />
Failing this, run the sshd in debug mode and monitor the output while connecting:<br />
<br />
# /usr/bin/sshd -d<br />
<br />
=== Using kdm ===<br />
KDM doesn't launch the ssh-agent process directly, {{Pkg|kde-agent}} used to start ssh-agent on login, but since version 20140102-1 it got [https://projects.archlinux.org/svntogit/packages.git/commit/trunk?h=packages/kde-agent&id=1070467b0f74b2339ceca2b9471d1c4e2b9c9c8f removed].<br />
<br />
In order to start ssh-agent on KDE startup for a user, create scripts to start ssh-agent on startup and one to kill it on logoff:<br />
{{bc|<nowiki><br />
echo -e '#!/bin/sh\n[ -n "$SSH_AGENT_PID" ] || eval "$(ssh-agent -s)"' > ~/.kde4/env/ssh-agent-startup.sh<br />
echo -e '#!/bin/sh\n[ -z "$SSH_AGENT_PID" ] || eval "$(ssh-agent -k)"' > ~/.kde4/shutdown/ssh-agent-shutdown.sh<br />
chmod 755 ~/.kde4/env/ssh-agent-startup.sh ~/.kde4/shutdown/ssh-agent-shutdown.sh<br />
</nowiki>}}<br />
<br />
==See also==<br />
* [http://www.ibm.com/developerworks/linux/library/l-keyc.html OpenSSH key management, Part 1]<br />
* [http://www.ibm.com/developerworks/linux/library/l-keyc2/ OpenSSH key management, Part 2]<br />
* [http://www.ibm.com/developerworks/library/l-keyc3/ OpenSSH key management, Part 3]<br />
* [http://kimmo.suominen.com/docs/ssh/ Getting started with SSH]<br />
* [http://www.openssh.com/txt/release-5.7 OpenSSH 5.7 Release Notes]</div>SilverWyrdahttps://wiki.archlinux.org/index.php?title=Dnsmasq&diff=276267Dnsmasq2013-09-22T01:46:29Z<p>SilverWyrda: /* Custom Configuration */</p>
<hr />
<div>[[Category:Domain Name System]]<br />
[[it:Dnsmasq]]<br />
[[ru:Dnsmasq]]<br />
[[zh-CN:Dnsmasq]]<br />
{{Lowercase_title}}<br />
<br />
'''dnsmasq''' provides services as a DNS cacher and a DHCP server. As a Domain Name Server (DNS), it can cache DNS queries to improve connection speed to previously visited sites. As a DHCP server, {{Pkg|dnsmasq}} can be used to provide internal IP addresses and routes to computers on a LAN. Either or both of these services can be implemented. dnsmasq is considered to be lightweight and easy to configure; it is designed for personal computer use or for use on a network with less than 50 computers. It also comes with a [[PXE]] server.<br />
<br />
== Installing ==<br />
<br />
[[pacman|Install]] {{Pkg|dnsmasq}} from the [[Official Repositories|official repositories]].<br />
<br />
== DNS Cache Setup ==<br />
<br />
To set up dnsmasq as a DNS caching daemon on a single computer edit {{ic|/etc/dnsmasq.conf}} and uncomment the localhost listening address:<br />
<br />
listen-address=127.0.0.1<br />
<br />
To use this computer to act as a default DNS specify the fixed IP address of the network:<br />
<br />
listen-address=<192.168.1.1> # Example IP<br />
<br />
=== DNS Addresses File ===<br />
<br />
After configuring dnsmasq the DHCP client will need to prepend the localhost address to the known DNS addresses in {{ic|/etc/resolv.conf}}. This causes all queries to be sent to dnsmasq before trying to resolve them with an external DNS. After the DHCP client is configured the network will need to be restarted for changes to take effect.<br />
<br />
==== resolv.conf ====<br />
<br />
One option is a pure {{ic|resolv.conf}} configuration. To do this, just make the first nameserver in {{ic|/etc/resolv.conf}} point point to localhost:<br />
<br />
{{hc|/etc/resolv.conf|<br />
nameserver 127.0.0.1<br />
# External nameservers<br />
...<br />
}}<br />
<br />
Now DNS queries will be resolved first with dnsmasq, only checking external servers if dnsmasq cannot resolve the query. {{Pkg|dhcpcd}}, unfortunately, tends to overwrite {{ic|/etc/resolv.conf}} by default, so if you use DHCP it is a good idea to protect {{ic|/etc/resolv.conf}}. To do this, append {{ic|nohook resolv.conf}} to the dhcpcd config file:<br />
<br />
{{hc|/etc/dhcpcd.conf|<br />
...<br />
nohook resolv.conf}}<br />
<br />
===== More than three nameservers =====<br />
<br />
A limitation the way Linux handles DNS queries is that there can only be a maximum of three nameservers used in {{ic|resolv.conf}}. As a workaround, you can make localhost the only nameserver in {{ic|resolv.conf}}, and then create a separate {{ic|resolv-file}} for your external nameservers. First, create a new resolv file for dnsmasq:<br />
<br />
{{hc|/etc/resolv.dnsmasq.conf|<br />
# Google's nameservers, for example<br />
nameserver 8.8.8.8<br />
nameserver 8.8.4.4<br />
}}<br />
<br />
And then edit {{ic|/etc/dnsmasq.conf}} to use your new resolv file:<br />
<br />
{{hc|/etc/dnsmasq.conf|<br />
...<br />
resolv-file&#61;/etc/resolv.dnsmasq.conf<br />
...<br />
}}<br />
<br />
==== dhcpcd ====<br />
<br />
{{Pkg|dhcpcd}} has the ability to prepend or append nameservers to {{ic|/etc/resolv.conf}} by creating (or editing) the {{ic|/etc/resolv.conf.head}} and {{ic|/etc/resolv.conf.tail}} files respectively:<br />
<br />
echo "nameserver 127.0.0.1" > /etc/resolv.conf.head<br />
<br />
==== dhclient ====<br />
<br />
For dhclient, uncomment in {{ic|/etc/dhclient.conf}}:<br />
<br />
prepend domain-name-servers 127.0.0.1;<br />
<br />
==== NetworkManager ====<br />
<br />
NetworkManager has the ability to start {{ic|dnsmasq}} from its configuration file. Add the option {{ic|1=dns=dnsmasq}} to {{ic|NetworkManager.conf}} in the {{ic|[main]}} section then disable {{ic|dnsmasq}} from loading as a daemon:<br />
<br />
{{hc|/etc/NetworkManager/NetworkManager.conf|<nowiki><br />
[main]<br />
plugins=keyfile<br />
dns=dnsmasq<br />
</nowiki>}}<br />
<br />
For permanent caching add a config directory for {{ic|dnsmasq}} and set the cache number of nameservers (default: 150?):<br />
<br />
mkdir /etc/NetworkManager/dnsmasq.d<br />
echo "cache-size=1000" | sudo tee /etc/NetworkManager/dnsmasq.d/cache<br />
<br />
===== Other methods =====<br />
<br />
If using the dnsmasq daemon, then it is necessary to add the localhost address to {{ic|resolv.conf}} (which NetworkManager will be overriding).<br />
<br />
Since the upgrade of [[NetworkManager]] to 0.7, Arch Linux now calls {{Pkg|dhcpcd}} directly instead of the common default with {{Pkg|dhclient}}. Because of the arguments set with {{Pkg|dhcpcd}}, it no longer sources the {{ic|/etc/resolv.conf.head}}, and {{ic|/etc/resolv.conf.tail}} settings for insertion of name servers. Several options are available.<br />
<br />
The first option would be to add a script to the NetworkManager dispatcher to prepend localhost to {{ic|resolv.conf}}:<br />
<br />
{{hc|/etc/NetworkManager/dispatcher.d/localhost-prepend|<nowiki><br />
#!/bin/bash <br />
# Prepend localhost to resolv.conf for dnsmasq<br />
<br />
if [[ ! $(grep 127.0.0.1 /etc/resolv.conf) ]]; then<br />
sed -i '1s|^|nameserver 127.0.0.1\n|' /etc/resolv.conf<br />
fi</nowiki>}}<br />
<br />
and make it executable:<br />
<br />
# chmod +x /etc/NetworkManager/dispatcher.d/localhost-prepend<br />
<br />
The second option be to go into NetworkManagers' settings (usually by right-clicking the applet) and entering settings manually. Setting up will depending on the type of front-end used; the process usually involves right-clicking on the applet, editing (or creating) a profile, and then choosing DHCP type as 'Automatic (specify addresses).' The DNS addresses will need to be entered and are usually in this form: {{ic|127.0.0.1, DNS-server-one, ...}}.<br />
<br />
Lastly, NetworkManager with dhclient can be used ({{AUR|networkmanager-dhclient}}).<br />
<br />
===== Custom Configuration =====<br />
<br />
As of NetworkManager 0.9.6, custom configurations can be created for {{Pkg|dnsmasq}} by creating configuration files in {{ic|/etc/NetworkManager/dnsmasq.d/}}<br />
<br />
{{Note|You have to add the following line to your NetworkManager configuration file {{ic|/etc/NetworkManager/NetworkManager.conf}} : {{ic|dns&#61;dnsmasq}} in order to enable custom configuration files.}}<br />
<br />
{{Tip|This method can allow you to enable custom DNS settings on particular domains. For instance : {{ic|server&#61;/example1.com/exemple2.com/xx.xxx.xxx.x}} change the first DNS address to {{ic|xx.xxx.xxx.xx}} while browsing only the following websites {{ic|example1.com, example2.com}}. This method is preferred to a global DNS configuration when using particular DNS nameservers which lack of speed, stability, privacy and security.}}<br />
<br />
== DHCP Server Setup ==<br />
<br />
By default dnsmasq has the DHCP functionality turned off, if you want to use it you must turn it on in ({{ic|/etc/dnsmasq.conf}}). Here are the important settings:<br />
<br />
{{bc|<nowiki><br />
# Only listen to routers' LAN NIC. Doing so opens up tcp/udp port 53 to<br />
# localhost and udp port 67 to world:<br />
interface=<LAN-NIC><br />
<br />
# dnsmasq will open tcp/udp port 53 and udp port 67 to world to help with<br />
# dynamic interfaces (assigning dynamic ips). Dnsmasq will discard world<br />
# requests to them, but the paranoid might like to close them and let the <br />
# kernel handle them:<br />
bind-interfaces<br />
<br />
# Dynamic range of IPs to make available to LAN pc<br />
dhcp-range=192.168.111.50,192.168.111.100,12h<br />
<br />
# If you’d like to have dnsmasq assign static IPs, bind the LAN computer's<br />
# NIC MAC address:<br />
dhcp-host=aa:bb:cc:dd:ee:ff,192.168.111.50<br />
</nowiki>}}<br />
<br />
== Start the daemon ==<br />
To have dnsmasq to load upon startup:<br />
<br />
{{bc|# systemctl enable dnsmasq}}<br />
<br />
To start dnsmasq immediately:<br />
<br />
{{bc|# systemctl start dnsmasq}}<br />
<br />
To see if dnsmasq started properly, check the log; dnsmasq sends its messages to {{ic|/var/log/messages.log}}. The network will also need to be restarted so the the DHCP client can create a new {{ic|/etc/resolv.conf}}.<br />
<br />
== Test ==<br />
=== DNS Caching ===<br />
<br />
To do a lookup speed test choose a website that has not been visited since dnsmasq has been started ({{ic|dig}} is part of the {{Pkg|dnsutils}} package):<br />
<br />
$ dig archlinux.org | grep "Query time"<br />
<br />
Running the command again will use the cached DNS IP and result in a faster lookup time if dnsmasq is setup correctly.<br />
<br />
=== DHCP Server ===<br />
<br />
From a computer that is connected to the one with dnsmasq on it, configure it to use DHCP for automatic IP address assignment, then attempt to log into the network normally.<br />
<br />
== Tips and tricks ==<br />
<br />
=== Prevent OpenDNS Redirecting Google Queries ===<br />
<br />
To prevent OpenDNS from redirecting all Google queries to their own search server, add to {{ic|/etc/dnsmasq.conf}}:<br />
{{bc|1=server=/www.google.com/<ISP DNS IP>}}<br />
<br />
=== View leases ===<br />
{{bc|$ cat /var/lib/misc/dnsmasq.leases}}</div>SilverWyrdahttps://wiki.archlinux.org/index.php?title=Dnsmasq&diff=276266Dnsmasq2013-09-22T01:42:39Z<p>SilverWyrda: /* Custom Configuration */</p>
<hr />
<div>[[Category:Domain Name System]]<br />
[[it:Dnsmasq]]<br />
[[ru:Dnsmasq]]<br />
[[zh-CN:Dnsmasq]]<br />
{{Lowercase_title}}<br />
<br />
'''dnsmasq''' provides services as a DNS cacher and a DHCP server. As a Domain Name Server (DNS), it can cache DNS queries to improve connection speed to previously visited sites. As a DHCP server, {{Pkg|dnsmasq}} can be used to provide internal IP addresses and routes to computers on a LAN. Either or both of these services can be implemented. dnsmasq is considered to be lightweight and easy to configure; it is designed for personal computer use or for use on a network with less than 50 computers. It also comes with a [[PXE]] server.<br />
<br />
== Installing ==<br />
<br />
[[pacman|Install]] {{Pkg|dnsmasq}} from the [[Official Repositories|official repositories]].<br />
<br />
== DNS Cache Setup ==<br />
<br />
To set up dnsmasq as a DNS caching daemon on a single computer edit {{ic|/etc/dnsmasq.conf}} and uncomment the localhost listening address:<br />
<br />
listen-address=127.0.0.1<br />
<br />
To use this computer to act as a default DNS specify the fixed IP address of the network:<br />
<br />
listen-address=<192.168.1.1> # Example IP<br />
<br />
=== DNS Addresses File ===<br />
<br />
After configuring dnsmasq the DHCP client will need to prepend the localhost address to the known DNS addresses in {{ic|/etc/resolv.conf}}. This causes all queries to be sent to dnsmasq before trying to resolve them with an external DNS. After the DHCP client is configured the network will need to be restarted for changes to take effect.<br />
<br />
==== resolv.conf ====<br />
<br />
One option is a pure {{ic|resolv.conf}} configuration. To do this, just make the first nameserver in {{ic|/etc/resolv.conf}} point point to localhost:<br />
<br />
{{hc|/etc/resolv.conf|<br />
nameserver 127.0.0.1<br />
# External nameservers<br />
...<br />
}}<br />
<br />
Now DNS queries will be resolved first with dnsmasq, only checking external servers if dnsmasq cannot resolve the query. {{Pkg|dhcpcd}}, unfortunately, tends to overwrite {{ic|/etc/resolv.conf}} by default, so if you use DHCP it is a good idea to protect {{ic|/etc/resolv.conf}}. To do this, append {{ic|nohook resolv.conf}} to the dhcpcd config file:<br />
<br />
{{hc|/etc/dhcpcd.conf|<br />
...<br />
nohook resolv.conf}}<br />
<br />
===== More than three nameservers =====<br />
<br />
A limitation the way Linux handles DNS queries is that there can only be a maximum of three nameservers used in {{ic|resolv.conf}}. As a workaround, you can make localhost the only nameserver in {{ic|resolv.conf}}, and then create a separate {{ic|resolv-file}} for your external nameservers. First, create a new resolv file for dnsmasq:<br />
<br />
{{hc|/etc/resolv.dnsmasq.conf|<br />
# Google's nameservers, for example<br />
nameserver 8.8.8.8<br />
nameserver 8.8.4.4<br />
}}<br />
<br />
And then edit {{ic|/etc/dnsmasq.conf}} to use your new resolv file:<br />
<br />
{{hc|/etc/dnsmasq.conf|<br />
...<br />
resolv-file&#61;/etc/resolv.dnsmasq.conf<br />
...<br />
}}<br />
<br />
==== dhcpcd ====<br />
<br />
{{Pkg|dhcpcd}} has the ability to prepend or append nameservers to {{ic|/etc/resolv.conf}} by creating (or editing) the {{ic|/etc/resolv.conf.head}} and {{ic|/etc/resolv.conf.tail}} files respectively:<br />
<br />
echo "nameserver 127.0.0.1" > /etc/resolv.conf.head<br />
<br />
==== dhclient ====<br />
<br />
For dhclient, uncomment in {{ic|/etc/dhclient.conf}}:<br />
<br />
prepend domain-name-servers 127.0.0.1;<br />
<br />
==== NetworkManager ====<br />
<br />
NetworkManager has the ability to start {{ic|dnsmasq}} from its configuration file. Add the option {{ic|1=dns=dnsmasq}} to {{ic|NetworkManager.conf}} in the {{ic|[main]}} section then disable {{ic|dnsmasq}} from loading as a daemon:<br />
<br />
{{hc|/etc/NetworkManager/NetworkManager.conf|<nowiki><br />
[main]<br />
plugins=keyfile<br />
dns=dnsmasq<br />
</nowiki>}}<br />
<br />
For permanent caching add a config directory for {{ic|dnsmasq}} and set the cache number of nameservers (default: 150?):<br />
<br />
mkdir /etc/NetworkManager/dnsmasq.d<br />
echo "cache-size=1000" | sudo tee /etc/NetworkManager/dnsmasq.d/cache<br />
<br />
===== Other methods =====<br />
<br />
If using the dnsmasq daemon, then it is necessary to add the localhost address to {{ic|resolv.conf}} (which NetworkManager will be overriding).<br />
<br />
Since the upgrade of [[NetworkManager]] to 0.7, Arch Linux now calls {{Pkg|dhcpcd}} directly instead of the common default with {{Pkg|dhclient}}. Because of the arguments set with {{Pkg|dhcpcd}}, it no longer sources the {{ic|/etc/resolv.conf.head}}, and {{ic|/etc/resolv.conf.tail}} settings for insertion of name servers. Several options are available.<br />
<br />
The first option would be to add a script to the NetworkManager dispatcher to prepend localhost to {{ic|resolv.conf}}:<br />
<br />
{{hc|/etc/NetworkManager/dispatcher.d/localhost-prepend|<nowiki><br />
#!/bin/bash <br />
# Prepend localhost to resolv.conf for dnsmasq<br />
<br />
if [[ ! $(grep 127.0.0.1 /etc/resolv.conf) ]]; then<br />
sed -i '1s|^|nameserver 127.0.0.1\n|' /etc/resolv.conf<br />
fi</nowiki>}}<br />
<br />
and make it executable:<br />
<br />
# chmod +x /etc/NetworkManager/dispatcher.d/localhost-prepend<br />
<br />
The second option be to go into NetworkManagers' settings (usually by right-clicking the applet) and entering settings manually. Setting up will depending on the type of front-end used; the process usually involves right-clicking on the applet, editing (or creating) a profile, and then choosing DHCP type as 'Automatic (specify addresses).' The DNS addresses will need to be entered and are usually in this form: {{ic|127.0.0.1, DNS-server-one, ...}}.<br />
<br />
Lastly, NetworkManager with dhclient can be used ({{AUR|networkmanager-dhclient}}).<br />
<br />
===== Custom Configuration =====<br />
<br />
As of NetworkManager 0.9.6, custom configurations can be created for {{Pkg|dnsmasq}} by creating configuration files in {{ic|/etc/NetworkManager/dnsmasq.d/}}<br />
<br />
{{Note|You have to add the following line to your NetworkManager configuration file ({{ic|/etc/NetworkManager/NetworkManager.conf}}) : {{ic|dns&#61;dnsmask}} in order to enable custom configuration files.}}<br />
<br />
{{Tip|This method can allow you to enable custom DNS settings on particular domains. For instance : {{ic|server&#61;/example1.com/exemple2.com/xx.xxx.xxx.x}} change the first DNS address to {{ic|xx.xxx.xxx.xx}} while browsing only the following websites {{ic|example1.com, example2.com}}. This method is preferred to a global DNS configuration when using particular DNS nameservers which lack of speed, stability, privacy and security.}}<br />
<br />
== DHCP Server Setup ==<br />
<br />
By default dnsmasq has the DHCP functionality turned off, if you want to use it you must turn it on in ({{ic|/etc/dnsmasq.conf}}). Here are the important settings:<br />
<br />
{{bc|<nowiki><br />
# Only listen to routers' LAN NIC. Doing so opens up tcp/udp port 53 to<br />
# localhost and udp port 67 to world:<br />
interface=<LAN-NIC><br />
<br />
# dnsmasq will open tcp/udp port 53 and udp port 67 to world to help with<br />
# dynamic interfaces (assigning dynamic ips). Dnsmasq will discard world<br />
# requests to them, but the paranoid might like to close them and let the <br />
# kernel handle them:<br />
bind-interfaces<br />
<br />
# Dynamic range of IPs to make available to LAN pc<br />
dhcp-range=192.168.111.50,192.168.111.100,12h<br />
<br />
# If you’d like to have dnsmasq assign static IPs, bind the LAN computer's<br />
# NIC MAC address:<br />
dhcp-host=aa:bb:cc:dd:ee:ff,192.168.111.50<br />
</nowiki>}}<br />
<br />
== Start the daemon ==<br />
To have dnsmasq to load upon startup:<br />
<br />
{{bc|# systemctl enable dnsmasq}}<br />
<br />
To start dnsmasq immediately:<br />
<br />
{{bc|# systemctl start dnsmasq}}<br />
<br />
To see if dnsmasq started properly, check the log; dnsmasq sends its messages to {{ic|/var/log/messages.log}}. The network will also need to be restarted so the the DHCP client can create a new {{ic|/etc/resolv.conf}}.<br />
<br />
== Test ==<br />
=== DNS Caching ===<br />
<br />
To do a lookup speed test choose a website that has not been visited since dnsmasq has been started ({{ic|dig}} is part of the {{Pkg|dnsutils}} package):<br />
<br />
$ dig archlinux.org | grep "Query time"<br />
<br />
Running the command again will use the cached DNS IP and result in a faster lookup time if dnsmasq is setup correctly.<br />
<br />
=== DHCP Server ===<br />
<br />
From a computer that is connected to the one with dnsmasq on it, configure it to use DHCP for automatic IP address assignment, then attempt to log into the network normally.<br />
<br />
== Tips and tricks ==<br />
<br />
=== Prevent OpenDNS Redirecting Google Queries ===<br />
<br />
To prevent OpenDNS from redirecting all Google queries to their own search server, add to {{ic|/etc/dnsmasq.conf}}:<br />
{{bc|1=server=/www.google.com/<ISP DNS IP>}}<br />
<br />
=== View leases ===<br />
{{bc|$ cat /var/lib/misc/dnsmasq.leases}}</div>SilverWyrdahttps://wiki.archlinux.org/index.php?title=Dnsmasq&diff=276265Dnsmasq2013-09-22T01:40:13Z<p>SilverWyrda: Undo revision 276264 by SilverWyrda (talk)</p>
<hr />
<div>[[Category:Domain Name System]]<br />
[[it:Dnsmasq]]<br />
[[ru:Dnsmasq]]<br />
[[zh-CN:Dnsmasq]]<br />
{{Lowercase_title}}<br />
<br />
'''dnsmasq''' provides services as a DNS cacher and a DHCP server. As a Domain Name Server (DNS), it can cache DNS queries to improve connection speed to previously visited sites. As a DHCP server, {{Pkg|dnsmasq}} can be used to provide internal IP addresses and routes to computers on a LAN. Either or both of these services can be implemented. dnsmasq is considered to be lightweight and easy to configure; it is designed for personal computer use or for use on a network with less than 50 computers. It also comes with a [[PXE]] server.<br />
<br />
== Installing ==<br />
<br />
[[pacman|Install]] {{Pkg|dnsmasq}} from the [[Official Repositories|official repositories]].<br />
<br />
== DNS Cache Setup ==<br />
<br />
To set up dnsmasq as a DNS caching daemon on a single computer edit {{ic|/etc/dnsmasq.conf}} and uncomment the localhost listening address:<br />
<br />
listen-address=127.0.0.1<br />
<br />
To use this computer to act as a default DNS specify the fixed IP address of the network:<br />
<br />
listen-address=<192.168.1.1> # Example IP<br />
<br />
=== DNS Addresses File ===<br />
<br />
After configuring dnsmasq the DHCP client will need to prepend the localhost address to the known DNS addresses in {{ic|/etc/resolv.conf}}. This causes all queries to be sent to dnsmasq before trying to resolve them with an external DNS. After the DHCP client is configured the network will need to be restarted for changes to take effect.<br />
<br />
==== resolv.conf ====<br />
<br />
One option is a pure {{ic|resolv.conf}} configuration. To do this, just make the first nameserver in {{ic|/etc/resolv.conf}} point point to localhost:<br />
<br />
{{hc|/etc/resolv.conf|<br />
nameserver 127.0.0.1<br />
# External nameservers<br />
...<br />
}}<br />
<br />
Now DNS queries will be resolved first with dnsmasq, only checking external servers if dnsmasq cannot resolve the query. {{Pkg|dhcpcd}}, unfortunately, tends to overwrite {{ic|/etc/resolv.conf}} by default, so if you use DHCP it is a good idea to protect {{ic|/etc/resolv.conf}}. To do this, append {{ic|nohook resolv.conf}} to the dhcpcd config file:<br />
<br />
{{hc|/etc/dhcpcd.conf|<br />
...<br />
nohook resolv.conf}}<br />
<br />
===== More than three nameservers =====<br />
<br />
A limitation the way Linux handles DNS queries is that there can only be a maximum of three nameservers used in {{ic|resolv.conf}}. As a workaround, you can make localhost the only nameserver in {{ic|resolv.conf}}, and then create a separate {{ic|resolv-file}} for your external nameservers. First, create a new resolv file for dnsmasq:<br />
<br />
{{hc|/etc/resolv.dnsmasq.conf|<br />
# Google's nameservers, for example<br />
nameserver 8.8.8.8<br />
nameserver 8.8.4.4<br />
}}<br />
<br />
And then edit {{ic|/etc/dnsmasq.conf}} to use your new resolv file:<br />
<br />
{{hc|/etc/dnsmasq.conf|<br />
...<br />
resolv-file&#61;/etc/resolv.dnsmasq.conf<br />
...<br />
}}<br />
<br />
==== dhcpcd ====<br />
<br />
{{Pkg|dhcpcd}} has the ability to prepend or append nameservers to {{ic|/etc/resolv.conf}} by creating (or editing) the {{ic|/etc/resolv.conf.head}} and {{ic|/etc/resolv.conf.tail}} files respectively:<br />
<br />
echo "nameserver 127.0.0.1" > /etc/resolv.conf.head<br />
<br />
==== dhclient ====<br />
<br />
For dhclient, uncomment in {{ic|/etc/dhclient.conf}}:<br />
<br />
prepend domain-name-servers 127.0.0.1;<br />
<br />
==== NetworkManager ====<br />
<br />
NetworkManager has the ability to start {{ic|dnsmasq}} from its configuration file. Add the option {{ic|1=dns=dnsmasq}} to {{ic|NetworkManager.conf}} in the {{ic|[main]}} section then disable {{ic|dnsmasq}} from loading as a daemon:<br />
<br />
{{hc|/etc/NetworkManager/NetworkManager.conf|<nowiki><br />
[main]<br />
plugins=keyfile<br />
dns=dnsmasq<br />
</nowiki>}}<br />
<br />
For permanent caching add a config directory for {{ic|dnsmasq}} and set the cache number of nameservers (default: 150?):<br />
<br />
mkdir /etc/NetworkManager/dnsmasq.d<br />
echo "cache-size=1000" | sudo tee /etc/NetworkManager/dnsmasq.d/cache<br />
<br />
===== Other methods =====<br />
<br />
If using the dnsmasq daemon, then it is necessary to add the localhost address to {{ic|resolv.conf}} (which NetworkManager will be overriding).<br />
<br />
Since the upgrade of [[NetworkManager]] to 0.7, Arch Linux now calls {{Pkg|dhcpcd}} directly instead of the common default with {{Pkg|dhclient}}. Because of the arguments set with {{Pkg|dhcpcd}}, it no longer sources the {{ic|/etc/resolv.conf.head}}, and {{ic|/etc/resolv.conf.tail}} settings for insertion of name servers. Several options are available.<br />
<br />
The first option would be to add a script to the NetworkManager dispatcher to prepend localhost to {{ic|resolv.conf}}:<br />
<br />
{{hc|/etc/NetworkManager/dispatcher.d/localhost-prepend|<nowiki><br />
#!/bin/bash <br />
# Prepend localhost to resolv.conf for dnsmasq<br />
<br />
if [[ ! $(grep 127.0.0.1 /etc/resolv.conf) ]]; then<br />
sed -i '1s|^|nameserver 127.0.0.1\n|' /etc/resolv.conf<br />
fi</nowiki>}}<br />
<br />
and make it executable:<br />
<br />
# chmod +x /etc/NetworkManager/dispatcher.d/localhost-prepend<br />
<br />
The second option be to go into NetworkManagers' settings (usually by right-clicking the applet) and entering settings manually. Setting up will depending on the type of front-end used; the process usually involves right-clicking on the applet, editing (or creating) a profile, and then choosing DHCP type as 'Automatic (specify addresses).' The DNS addresses will need to be entered and are usually in this form: {{ic|127.0.0.1, DNS-server-one, ...}}.<br />
<br />
Lastly, NetworkManager with dhclient can be used ({{AUR|networkmanager-dhclient}}).<br />
<br />
===== Custom Configuration =====<br />
<br />
As of NetworkManager 0.9.6, custom configurations can be created for dnsmasq by creating configuration files in {{ic|/etc/NetworkManager/dnsmasq.d/}}<br />
<br />
{{Note|You have to add the following line to your NetworkManager configuration file ({{ic|/etc/NetworkManager/NetworkManager.conf}}) : {{ic|dns=dnsmask}} in order to enable custom configuration files.}}<br />
<br />
{{Tip|This method can allow you to enable custom DNS settings on particular domains. For instance : {{ic|server=/example1.com/exemple2.com/xx.xxx.xxx.x}} change the first DNS address to {{ic|xx.xxx.xxx.xx}} while browsing only the following websites {{ic|example1.com, example2.com}}. This method is preferred to a global DNS configuration when using particular DNS nameservers which lack of speed, stability, privacy and security.}}<br />
<br />
== DHCP Server Setup ==<br />
<br />
By default dnsmasq has the DHCP functionality turned off, if you want to use it you must turn it on in ({{ic|/etc/dnsmasq.conf}}). Here are the important settings:<br />
<br />
{{bc|<nowiki><br />
# Only listen to routers' LAN NIC. Doing so opens up tcp/udp port 53 to<br />
# localhost and udp port 67 to world:<br />
interface=<LAN-NIC><br />
<br />
# dnsmasq will open tcp/udp port 53 and udp port 67 to world to help with<br />
# dynamic interfaces (assigning dynamic ips). Dnsmasq will discard world<br />
# requests to them, but the paranoid might like to close them and let the <br />
# kernel handle them:<br />
bind-interfaces<br />
<br />
# Dynamic range of IPs to make available to LAN pc<br />
dhcp-range=192.168.111.50,192.168.111.100,12h<br />
<br />
# If you’d like to have dnsmasq assign static IPs, bind the LAN computer's<br />
# NIC MAC address:<br />
dhcp-host=aa:bb:cc:dd:ee:ff,192.168.111.50<br />
</nowiki>}}<br />
<br />
== Start the daemon ==<br />
To have dnsmasq to load upon startup:<br />
<br />
{{bc|# systemctl enable dnsmasq}}<br />
<br />
To start dnsmasq immediately:<br />
<br />
{{bc|# systemctl start dnsmasq}}<br />
<br />
To see if dnsmasq started properly, check the log; dnsmasq sends its messages to {{ic|/var/log/messages.log}}. The network will also need to be restarted so the the DHCP client can create a new {{ic|/etc/resolv.conf}}.<br />
<br />
== Test ==<br />
=== DNS Caching ===<br />
<br />
To do a lookup speed test choose a website that has not been visited since dnsmasq has been started ({{ic|dig}} is part of the {{Pkg|dnsutils}} package):<br />
<br />
$ dig archlinux.org | grep "Query time"<br />
<br />
Running the command again will use the cached DNS IP and result in a faster lookup time if dnsmasq is setup correctly.<br />
<br />
=== DHCP Server ===<br />
<br />
From a computer that is connected to the one with dnsmasq on it, configure it to use DHCP for automatic IP address assignment, then attempt to log into the network normally.<br />
<br />
== Tips and tricks ==<br />
<br />
=== Prevent OpenDNS Redirecting Google Queries ===<br />
<br />
To prevent OpenDNS from redirecting all Google queries to their own search server, add to {{ic|/etc/dnsmasq.conf}}:<br />
{{bc|1=server=/www.google.com/<ISP DNS IP>}}<br />
<br />
=== View leases ===<br />
{{bc|$ cat /var/lib/misc/dnsmasq.leases}}</div>SilverWyrdahttps://wiki.archlinux.org/index.php?title=Dnsmasq&diff=276264Dnsmasq2013-09-22T01:37:54Z<p>SilverWyrda: /* Custom Configuration */</p>
<hr />
<div>[[Category:Domain Name System]]<br />
[[it:Dnsmasq]]<br />
[[ru:Dnsmasq]]<br />
[[zh-CN:Dnsmasq]]<br />
{{Lowercase_title}}<br />
<br />
'''dnsmasq''' provides services as a DNS cacher and a DHCP server. As a Domain Name Server (DNS), it can cache DNS queries to improve connection speed to previously visited sites. As a DHCP server, {{Pkg|dnsmasq}} can be used to provide internal IP addresses and routes to computers on a LAN. Either or both of these services can be implemented. dnsmasq is considered to be lightweight and easy to configure; it is designed for personal computer use or for use on a network with less than 50 computers. It also comes with a [[PXE]] server.<br />
<br />
== Installing ==<br />
<br />
[[pacman|Install]] {{Pkg|dnsmasq}} from the [[Official Repositories|official repositories]].<br />
<br />
== DNS Cache Setup ==<br />
<br />
To set up dnsmasq as a DNS caching daemon on a single computer edit {{ic|/etc/dnsmasq.conf}} and uncomment the localhost listening address:<br />
<br />
listen-address=127.0.0.1<br />
<br />
To use this computer to act as a default DNS specify the fixed IP address of the network:<br />
<br />
listen-address=<192.168.1.1> # Example IP<br />
<br />
=== DNS Addresses File ===<br />
<br />
After configuring dnsmasq the DHCP client will need to prepend the localhost address to the known DNS addresses in {{ic|/etc/resolv.conf}}. This causes all queries to be sent to dnsmasq before trying to resolve them with an external DNS. After the DHCP client is configured the network will need to be restarted for changes to take effect.<br />
<br />
==== resolv.conf ====<br />
<br />
One option is a pure {{ic|resolv.conf}} configuration. To do this, just make the first nameserver in {{ic|/etc/resolv.conf}} point point to localhost:<br />
<br />
{{hc|/etc/resolv.conf|<br />
nameserver 127.0.0.1<br />
# External nameservers<br />
...<br />
}}<br />
<br />
Now DNS queries will be resolved first with dnsmasq, only checking external servers if dnsmasq cannot resolve the query. {{Pkg|dhcpcd}}, unfortunately, tends to overwrite {{ic|/etc/resolv.conf}} by default, so if you use DHCP it is a good idea to protect {{ic|/etc/resolv.conf}}. To do this, append {{ic|nohook resolv.conf}} to the dhcpcd config file:<br />
<br />
{{hc|/etc/dhcpcd.conf|<br />
...<br />
nohook resolv.conf}}<br />
<br />
===== More than three nameservers =====<br />
<br />
A limitation the way Linux handles DNS queries is that there can only be a maximum of three nameservers used in {{ic|resolv.conf}}. As a workaround, you can make localhost the only nameserver in {{ic|resolv.conf}}, and then create a separate {{ic|resolv-file}} for your external nameservers. First, create a new resolv file for dnsmasq:<br />
<br />
{{hc|/etc/resolv.dnsmasq.conf|<br />
# Google's nameservers, for example<br />
nameserver 8.8.8.8<br />
nameserver 8.8.4.4<br />
}}<br />
<br />
And then edit {{ic|/etc/dnsmasq.conf}} to use your new resolv file:<br />
<br />
{{hc|/etc/dnsmasq.conf|<br />
...<br />
resolv-file&#61;/etc/resolv.dnsmasq.conf<br />
...<br />
}}<br />
<br />
==== dhcpcd ====<br />
<br />
{{Pkg|dhcpcd}} has the ability to prepend or append nameservers to {{ic|/etc/resolv.conf}} by creating (or editing) the {{ic|/etc/resolv.conf.head}} and {{ic|/etc/resolv.conf.tail}} files respectively:<br />
<br />
echo "nameserver 127.0.0.1" > /etc/resolv.conf.head<br />
<br />
==== dhclient ====<br />
<br />
For dhclient, uncomment in {{ic|/etc/dhclient.conf}}:<br />
<br />
prepend domain-name-servers 127.0.0.1;<br />
<br />
==== NetworkManager ====<br />
<br />
NetworkManager has the ability to start {{ic|dnsmasq}} from its configuration file. Add the option {{ic|1=dns=dnsmasq}} to {{ic|NetworkManager.conf}} in the {{ic|[main]}} section then disable {{ic|dnsmasq}} from loading as a daemon:<br />
<br />
{{hc|/etc/NetworkManager/NetworkManager.conf|<nowiki><br />
[main]<br />
plugins=keyfile<br />
dns=dnsmasq<br />
</nowiki>}}<br />
<br />
For permanent caching add a config directory for {{ic|dnsmasq}} and set the cache number of nameservers (default: 150?):<br />
<br />
mkdir /etc/NetworkManager/dnsmasq.d<br />
echo "cache-size=1000" | sudo tee /etc/NetworkManager/dnsmasq.d/cache<br />
<br />
===== Other methods =====<br />
<br />
If using the dnsmasq daemon, then it is necessary to add the localhost address to {{ic|resolv.conf}} (which NetworkManager will be overriding).<br />
<br />
Since the upgrade of [[NetworkManager]] to 0.7, Arch Linux now calls {{Pkg|dhcpcd}} directly instead of the common default with {{Pkg|dhclient}}. Because of the arguments set with {{Pkg|dhcpcd}}, it no longer sources the {{ic|/etc/resolv.conf.head}}, and {{ic|/etc/resolv.conf.tail}} settings for insertion of name servers. Several options are available.<br />
<br />
The first option would be to add a script to the NetworkManager dispatcher to prepend localhost to {{ic|resolv.conf}}:<br />
<br />
{{hc|/etc/NetworkManager/dispatcher.d/localhost-prepend|<nowiki><br />
#!/bin/bash <br />
# Prepend localhost to resolv.conf for dnsmasq<br />
<br />
if [[ ! $(grep 127.0.0.1 /etc/resolv.conf) ]]; then<br />
sed -i '1s|^|nameserver 127.0.0.1\n|' /etc/resolv.conf<br />
fi</nowiki>}}<br />
<br />
and make it executable:<br />
<br />
# chmod +x /etc/NetworkManager/dispatcher.d/localhost-prepend<br />
<br />
The second option be to go into NetworkManagers' settings (usually by right-clicking the applet) and entering settings manually. Setting up will depending on the type of front-end used; the process usually involves right-clicking on the applet, editing (or creating) a profile, and then choosing DHCP type as 'Automatic (specify addresses).' The DNS addresses will need to be entered and are usually in this form: {{ic|127.0.0.1, DNS-server-one, ...}}.<br />
<br />
Lastly, NetworkManager with dhclient can be used ({{AUR|networkmanager-dhclient}}).<br />
<br />
===== Custom Configuration =====<br />
<br />
As of NetworkManager 0.9.6, custom configurations can be created for dnsmasq by creating configuration files in {{ic|/etc/NetworkManager/dnsmasq.d/}}<br />
<br />
{{Note|You have to add the following line to your NetworkManager configuration file ({{ic|/etc/NetworkManager/NetworkManager.conf}}) : {{ic|dns&#61;dnsmask}} in order to enable custom configuration files.}}<br />
<br />
{{Tip|This method can allow you to enable custom DNS settings on particular domains. For instance : {{ic|server&#61;/example1.com/exemple2.com/xx.xxx.xxx.x}} change the first DNS address to {{ic|xx.xxx.xxx.xx}} while browsing only the following websites {{ic|example1.com, example2.com}}. This method is preferred to a global DNS configuration when using particular DNS nameservers which lack of speed, stability, privacy and security.}}<br />
<br />
== DHCP Server Setup ==<br />
<br />
By default dnsmasq has the DHCP functionality turned off, if you want to use it you must turn it on in ({{ic|/etc/dnsmasq.conf}}). Here are the important settings:<br />
<br />
{{bc|<nowiki><br />
# Only listen to routers' LAN NIC. Doing so opens up tcp/udp port 53 to<br />
# localhost and udp port 67 to world:<br />
interface=<LAN-NIC><br />
<br />
# dnsmasq will open tcp/udp port 53 and udp port 67 to world to help with<br />
# dynamic interfaces (assigning dynamic ips). Dnsmasq will discard world<br />
# requests to them, but the paranoid might like to close them and let the <br />
# kernel handle them:<br />
bind-interfaces<br />
<br />
# Dynamic range of IPs to make available to LAN pc<br />
dhcp-range=192.168.111.50,192.168.111.100,12h<br />
<br />
# If you’d like to have dnsmasq assign static IPs, bind the LAN computer's<br />
# NIC MAC address:<br />
dhcp-host=aa:bb:cc:dd:ee:ff,192.168.111.50<br />
</nowiki>}}<br />
<br />
== Start the daemon ==<br />
To have dnsmasq to load upon startup:<br />
<br />
{{bc|# systemctl enable dnsmasq}}<br />
<br />
To start dnsmasq immediately:<br />
<br />
{{bc|# systemctl start dnsmasq}}<br />
<br />
To see if dnsmasq started properly, check the log; dnsmasq sends its messages to {{ic|/var/log/messages.log}}. The network will also need to be restarted so the the DHCP client can create a new {{ic|/etc/resolv.conf}}.<br />
<br />
== Test ==<br />
=== DNS Caching ===<br />
<br />
To do a lookup speed test choose a website that has not been visited since dnsmasq has been started ({{ic|dig}} is part of the {{Pkg|dnsutils}} package):<br />
<br />
$ dig archlinux.org | grep "Query time"<br />
<br />
Running the command again will use the cached DNS IP and result in a faster lookup time if dnsmasq is setup correctly.<br />
<br />
=== DHCP Server ===<br />
<br />
From a computer that is connected to the one with dnsmasq on it, configure it to use DHCP for automatic IP address assignment, then attempt to log into the network normally.<br />
<br />
== Tips and tricks ==<br />
<br />
=== Prevent OpenDNS Redirecting Google Queries ===<br />
<br />
To prevent OpenDNS from redirecting all Google queries to their own search server, add to {{ic|/etc/dnsmasq.conf}}:<br />
{{bc|1=server=/www.google.com/<ISP DNS IP>}}<br />
<br />
=== View leases ===<br />
{{bc|$ cat /var/lib/misc/dnsmasq.leases}}</div>SilverWyrdahttps://wiki.archlinux.org/index.php?title=Dnsmasq&diff=276263Dnsmasq2013-09-22T01:36:03Z<p>SilverWyrda: /* Custom Configuration */</p>
<hr />
<div>[[Category:Domain Name System]]<br />
[[it:Dnsmasq]]<br />
[[ru:Dnsmasq]]<br />
[[zh-CN:Dnsmasq]]<br />
{{Lowercase_title}}<br />
<br />
'''dnsmasq''' provides services as a DNS cacher and a DHCP server. As a Domain Name Server (DNS), it can cache DNS queries to improve connection speed to previously visited sites. As a DHCP server, {{Pkg|dnsmasq}} can be used to provide internal IP addresses and routes to computers on a LAN. Either or both of these services can be implemented. dnsmasq is considered to be lightweight and easy to configure; it is designed for personal computer use or for use on a network with less than 50 computers. It also comes with a [[PXE]] server.<br />
<br />
== Installing ==<br />
<br />
[[pacman|Install]] {{Pkg|dnsmasq}} from the [[Official Repositories|official repositories]].<br />
<br />
== DNS Cache Setup ==<br />
<br />
To set up dnsmasq as a DNS caching daemon on a single computer edit {{ic|/etc/dnsmasq.conf}} and uncomment the localhost listening address:<br />
<br />
listen-address=127.0.0.1<br />
<br />
To use this computer to act as a default DNS specify the fixed IP address of the network:<br />
<br />
listen-address=<192.168.1.1> # Example IP<br />
<br />
=== DNS Addresses File ===<br />
<br />
After configuring dnsmasq the DHCP client will need to prepend the localhost address to the known DNS addresses in {{ic|/etc/resolv.conf}}. This causes all queries to be sent to dnsmasq before trying to resolve them with an external DNS. After the DHCP client is configured the network will need to be restarted for changes to take effect.<br />
<br />
==== resolv.conf ====<br />
<br />
One option is a pure {{ic|resolv.conf}} configuration. To do this, just make the first nameserver in {{ic|/etc/resolv.conf}} point point to localhost:<br />
<br />
{{hc|/etc/resolv.conf|<br />
nameserver 127.0.0.1<br />
# External nameservers<br />
...<br />
}}<br />
<br />
Now DNS queries will be resolved first with dnsmasq, only checking external servers if dnsmasq cannot resolve the query. {{Pkg|dhcpcd}}, unfortunately, tends to overwrite {{ic|/etc/resolv.conf}} by default, so if you use DHCP it is a good idea to protect {{ic|/etc/resolv.conf}}. To do this, append {{ic|nohook resolv.conf}} to the dhcpcd config file:<br />
<br />
{{hc|/etc/dhcpcd.conf|<br />
...<br />
nohook resolv.conf}}<br />
<br />
===== More than three nameservers =====<br />
<br />
A limitation the way Linux handles DNS queries is that there can only be a maximum of three nameservers used in {{ic|resolv.conf}}. As a workaround, you can make localhost the only nameserver in {{ic|resolv.conf}}, and then create a separate {{ic|resolv-file}} for your external nameservers. First, create a new resolv file for dnsmasq:<br />
<br />
{{hc|/etc/resolv.dnsmasq.conf|<br />
# Google's nameservers, for example<br />
nameserver 8.8.8.8<br />
nameserver 8.8.4.4<br />
}}<br />
<br />
And then edit {{ic|/etc/dnsmasq.conf}} to use your new resolv file:<br />
<br />
{{hc|/etc/dnsmasq.conf|<br />
...<br />
resolv-file&#61;/etc/resolv.dnsmasq.conf<br />
...<br />
}}<br />
<br />
==== dhcpcd ====<br />
<br />
{{Pkg|dhcpcd}} has the ability to prepend or append nameservers to {{ic|/etc/resolv.conf}} by creating (or editing) the {{ic|/etc/resolv.conf.head}} and {{ic|/etc/resolv.conf.tail}} files respectively:<br />
<br />
echo "nameserver 127.0.0.1" > /etc/resolv.conf.head<br />
<br />
==== dhclient ====<br />
<br />
For dhclient, uncomment in {{ic|/etc/dhclient.conf}}:<br />
<br />
prepend domain-name-servers 127.0.0.1;<br />
<br />
==== NetworkManager ====<br />
<br />
NetworkManager has the ability to start {{ic|dnsmasq}} from its configuration file. Add the option {{ic|1=dns=dnsmasq}} to {{ic|NetworkManager.conf}} in the {{ic|[main]}} section then disable {{ic|dnsmasq}} from loading as a daemon:<br />
<br />
{{hc|/etc/NetworkManager/NetworkManager.conf|<nowiki><br />
[main]<br />
plugins=keyfile<br />
dns=dnsmasq<br />
</nowiki>}}<br />
<br />
For permanent caching add a config directory for {{ic|dnsmasq}} and set the cache number of nameservers (default: 150?):<br />
<br />
mkdir /etc/NetworkManager/dnsmasq.d<br />
echo "cache-size=1000" | sudo tee /etc/NetworkManager/dnsmasq.d/cache<br />
<br />
===== Other methods =====<br />
<br />
If using the dnsmasq daemon, then it is necessary to add the localhost address to {{ic|resolv.conf}} (which NetworkManager will be overriding).<br />
<br />
Since the upgrade of [[NetworkManager]] to 0.7, Arch Linux now calls {{Pkg|dhcpcd}} directly instead of the common default with {{Pkg|dhclient}}. Because of the arguments set with {{Pkg|dhcpcd}}, it no longer sources the {{ic|/etc/resolv.conf.head}}, and {{ic|/etc/resolv.conf.tail}} settings for insertion of name servers. Several options are available.<br />
<br />
The first option would be to add a script to the NetworkManager dispatcher to prepend localhost to {{ic|resolv.conf}}:<br />
<br />
{{hc|/etc/NetworkManager/dispatcher.d/localhost-prepend|<nowiki><br />
#!/bin/bash <br />
# Prepend localhost to resolv.conf for dnsmasq<br />
<br />
if [[ ! $(grep 127.0.0.1 /etc/resolv.conf) ]]; then<br />
sed -i '1s|^|nameserver 127.0.0.1\n|' /etc/resolv.conf<br />
fi</nowiki>}}<br />
<br />
and make it executable:<br />
<br />
# chmod +x /etc/NetworkManager/dispatcher.d/localhost-prepend<br />
<br />
The second option be to go into NetworkManagers' settings (usually by right-clicking the applet) and entering settings manually. Setting up will depending on the type of front-end used; the process usually involves right-clicking on the applet, editing (or creating) a profile, and then choosing DHCP type as 'Automatic (specify addresses).' The DNS addresses will need to be entered and are usually in this form: {{ic|127.0.0.1, DNS-server-one, ...}}.<br />
<br />
Lastly, NetworkManager with dhclient can be used ({{AUR|networkmanager-dhclient}}).<br />
<br />
===== Custom Configuration =====<br />
<br />
As of NetworkManager 0.9.6, custom configurations can be created for dnsmasq by creating configuration files in {{ic|/etc/NetworkManager/dnsmasq.d/}}<br />
<br />
{{Note|You have to add the following line to your NetworkManager configuration file ({{ic|/etc/NetworkManager/NetworkManager.conf}}) : {{ic|dns=dnsmask}} in order to enable custom configuration files.}}<br />
<br />
{{Tip|This method can allow you to enable custom DNS settings on particular domains. For instance : {{ic|server=/example1.com/exemple2.com/xx.xxx.xxx.x}} change the first DNS address to {{ic|xx.xxx.xxx.xx}} while browsing only the following websites {{ic|example1.com, example2.com}}. This method is preferred to a global DNS configuration when using particular DNS nameservers which lack of speed, stability, privacy and security.}}<br />
<br />
== DHCP Server Setup ==<br />
<br />
By default dnsmasq has the DHCP functionality turned off, if you want to use it you must turn it on in ({{ic|/etc/dnsmasq.conf}}). Here are the important settings:<br />
<br />
{{bc|<nowiki><br />
# Only listen to routers' LAN NIC. Doing so opens up tcp/udp port 53 to<br />
# localhost and udp port 67 to world:<br />
interface=<LAN-NIC><br />
<br />
# dnsmasq will open tcp/udp port 53 and udp port 67 to world to help with<br />
# dynamic interfaces (assigning dynamic ips). Dnsmasq will discard world<br />
# requests to them, but the paranoid might like to close them and let the <br />
# kernel handle them:<br />
bind-interfaces<br />
<br />
# Dynamic range of IPs to make available to LAN pc<br />
dhcp-range=192.168.111.50,192.168.111.100,12h<br />
<br />
# If you’d like to have dnsmasq assign static IPs, bind the LAN computer's<br />
# NIC MAC address:<br />
dhcp-host=aa:bb:cc:dd:ee:ff,192.168.111.50<br />
</nowiki>}}<br />
<br />
== Start the daemon ==<br />
To have dnsmasq to load upon startup:<br />
<br />
{{bc|# systemctl enable dnsmasq}}<br />
<br />
To start dnsmasq immediately:<br />
<br />
{{bc|# systemctl start dnsmasq}}<br />
<br />
To see if dnsmasq started properly, check the log; dnsmasq sends its messages to {{ic|/var/log/messages.log}}. The network will also need to be restarted so the the DHCP client can create a new {{ic|/etc/resolv.conf}}.<br />
<br />
== Test ==<br />
=== DNS Caching ===<br />
<br />
To do a lookup speed test choose a website that has not been visited since dnsmasq has been started ({{ic|dig}} is part of the {{Pkg|dnsutils}} package):<br />
<br />
$ dig archlinux.org | grep "Query time"<br />
<br />
Running the command again will use the cached DNS IP and result in a faster lookup time if dnsmasq is setup correctly.<br />
<br />
=== DHCP Server ===<br />
<br />
From a computer that is connected to the one with dnsmasq on it, configure it to use DHCP for automatic IP address assignment, then attempt to log into the network normally.<br />
<br />
== Tips and tricks ==<br />
<br />
=== Prevent OpenDNS Redirecting Google Queries ===<br />
<br />
To prevent OpenDNS from redirecting all Google queries to their own search server, add to {{ic|/etc/dnsmasq.conf}}:<br />
{{bc|1=server=/www.google.com/<ISP DNS IP>}}<br />
<br />
=== View leases ===<br />
{{bc|$ cat /var/lib/misc/dnsmasq.leases}}</div>SilverWyrdahttps://wiki.archlinux.org/index.php?title=Dnsmasq&diff=276262Dnsmasq2013-09-22T01:35:18Z<p>SilverWyrda: /* Custom Configuration */</p>
<hr />
<div>[[Category:Domain Name System]]<br />
[[it:Dnsmasq]]<br />
[[ru:Dnsmasq]]<br />
[[zh-CN:Dnsmasq]]<br />
{{Lowercase_title}}<br />
<br />
'''dnsmasq''' provides services as a DNS cacher and a DHCP server. As a Domain Name Server (DNS), it can cache DNS queries to improve connection speed to previously visited sites. As a DHCP server, {{Pkg|dnsmasq}} can be used to provide internal IP addresses and routes to computers on a LAN. Either or both of these services can be implemented. dnsmasq is considered to be lightweight and easy to configure; it is designed for personal computer use or for use on a network with less than 50 computers. It also comes with a [[PXE]] server.<br />
<br />
== Installing ==<br />
<br />
[[pacman|Install]] {{Pkg|dnsmasq}} from the [[Official Repositories|official repositories]].<br />
<br />
== DNS Cache Setup ==<br />
<br />
To set up dnsmasq as a DNS caching daemon on a single computer edit {{ic|/etc/dnsmasq.conf}} and uncomment the localhost listening address:<br />
<br />
listen-address=127.0.0.1<br />
<br />
To use this computer to act as a default DNS specify the fixed IP address of the network:<br />
<br />
listen-address=<192.168.1.1> # Example IP<br />
<br />
=== DNS Addresses File ===<br />
<br />
After configuring dnsmasq the DHCP client will need to prepend the localhost address to the known DNS addresses in {{ic|/etc/resolv.conf}}. This causes all queries to be sent to dnsmasq before trying to resolve them with an external DNS. After the DHCP client is configured the network will need to be restarted for changes to take effect.<br />
<br />
==== resolv.conf ====<br />
<br />
One option is a pure {{ic|resolv.conf}} configuration. To do this, just make the first nameserver in {{ic|/etc/resolv.conf}} point point to localhost:<br />
<br />
{{hc|/etc/resolv.conf|<br />
nameserver 127.0.0.1<br />
# External nameservers<br />
...<br />
}}<br />
<br />
Now DNS queries will be resolved first with dnsmasq, only checking external servers if dnsmasq cannot resolve the query. {{Pkg|dhcpcd}}, unfortunately, tends to overwrite {{ic|/etc/resolv.conf}} by default, so if you use DHCP it is a good idea to protect {{ic|/etc/resolv.conf}}. To do this, append {{ic|nohook resolv.conf}} to the dhcpcd config file:<br />
<br />
{{hc|/etc/dhcpcd.conf|<br />
...<br />
nohook resolv.conf}}<br />
<br />
===== More than three nameservers =====<br />
<br />
A limitation the way Linux handles DNS queries is that there can only be a maximum of three nameservers used in {{ic|resolv.conf}}. As a workaround, you can make localhost the only nameserver in {{ic|resolv.conf}}, and then create a separate {{ic|resolv-file}} for your external nameservers. First, create a new resolv file for dnsmasq:<br />
<br />
{{hc|/etc/resolv.dnsmasq.conf|<br />
# Google's nameservers, for example<br />
nameserver 8.8.8.8<br />
nameserver 8.8.4.4<br />
}}<br />
<br />
And then edit {{ic|/etc/dnsmasq.conf}} to use your new resolv file:<br />
<br />
{{hc|/etc/dnsmasq.conf|<br />
...<br />
resolv-file&#61;/etc/resolv.dnsmasq.conf<br />
...<br />
}}<br />
<br />
==== dhcpcd ====<br />
<br />
{{Pkg|dhcpcd}} has the ability to prepend or append nameservers to {{ic|/etc/resolv.conf}} by creating (or editing) the {{ic|/etc/resolv.conf.head}} and {{ic|/etc/resolv.conf.tail}} files respectively:<br />
<br />
echo "nameserver 127.0.0.1" > /etc/resolv.conf.head<br />
<br />
==== dhclient ====<br />
<br />
For dhclient, uncomment in {{ic|/etc/dhclient.conf}}:<br />
<br />
prepend domain-name-servers 127.0.0.1;<br />
<br />
==== NetworkManager ====<br />
<br />
NetworkManager has the ability to start {{ic|dnsmasq}} from its configuration file. Add the option {{ic|1=dns=dnsmasq}} to {{ic|NetworkManager.conf}} in the {{ic|[main]}} section then disable {{ic|dnsmasq}} from loading as a daemon:<br />
<br />
{{hc|/etc/NetworkManager/NetworkManager.conf|<nowiki><br />
[main]<br />
plugins=keyfile<br />
dns=dnsmasq<br />
</nowiki>}}<br />
<br />
For permanent caching add a config directory for {{ic|dnsmasq}} and set the cache number of nameservers (default: 150?):<br />
<br />
mkdir /etc/NetworkManager/dnsmasq.d<br />
echo "cache-size=1000" | sudo tee /etc/NetworkManager/dnsmasq.d/cache<br />
<br />
===== Other methods =====<br />
<br />
If using the dnsmasq daemon, then it is necessary to add the localhost address to {{ic|resolv.conf}} (which NetworkManager will be overriding).<br />
<br />
Since the upgrade of [[NetworkManager]] to 0.7, Arch Linux now calls {{Pkg|dhcpcd}} directly instead of the common default with {{Pkg|dhclient}}. Because of the arguments set with {{Pkg|dhcpcd}}, it no longer sources the {{ic|/etc/resolv.conf.head}}, and {{ic|/etc/resolv.conf.tail}} settings for insertion of name servers. Several options are available.<br />
<br />
The first option would be to add a script to the NetworkManager dispatcher to prepend localhost to {{ic|resolv.conf}}:<br />
<br />
{{hc|/etc/NetworkManager/dispatcher.d/localhost-prepend|<nowiki><br />
#!/bin/bash <br />
# Prepend localhost to resolv.conf for dnsmasq<br />
<br />
if [[ ! $(grep 127.0.0.1 /etc/resolv.conf) ]]; then<br />
sed -i '1s|^|nameserver 127.0.0.1\n|' /etc/resolv.conf<br />
fi</nowiki>}}<br />
<br />
and make it executable:<br />
<br />
# chmod +x /etc/NetworkManager/dispatcher.d/localhost-prepend<br />
<br />
The second option be to go into NetworkManagers' settings (usually by right-clicking the applet) and entering settings manually. Setting up will depending on the type of front-end used; the process usually involves right-clicking on the applet, editing (or creating) a profile, and then choosing DHCP type as 'Automatic (specify addresses).' The DNS addresses will need to be entered and are usually in this form: {{ic|127.0.0.1, DNS-server-one, ...}}.<br />
<br />
Lastly, NetworkManager with dhclient can be used ({{AUR|networkmanager-dhclient}}).<br />
<br />
===== Custom Configuration =====<br />
<br />
As of NetworkManager 0.9.6, custom configurations can be created for dnsmasq by creating configuration files in {{ic|/etc/NetworkManager/dnsmasq.d/}}<br />
<br />
{{Note|You have to add the following line to your NetworkManager configuration file ({{ic|/etc/NetworkManager/NetworkManager.conf}}) : {{ic|dns=dnsmask}} in order to enable custom configuration files.}}<br />
<br />
{{Tip|This method can allow you to enable custom DNS settings on particular domains. For instance : {{ic|server=/example1.com/exemple2.com/xx.xxx.xxx.x}} change the first DNS address to {{ic|xx.xxx.xxx.xx}} while browsing only the following websites {{ic|example{1,2}.com}}. This method is preferred to a global DNS configuration when using particular DNS nameservers which lack of speed, stability, privacy and security.}}<br />
<br />
== DHCP Server Setup ==<br />
<br />
By default dnsmasq has the DHCP functionality turned off, if you want to use it you must turn it on in ({{ic|/etc/dnsmasq.conf}}). Here are the important settings:<br />
<br />
{{bc|<nowiki><br />
# Only listen to routers' LAN NIC. Doing so opens up tcp/udp port 53 to<br />
# localhost and udp port 67 to world:<br />
interface=<LAN-NIC><br />
<br />
# dnsmasq will open tcp/udp port 53 and udp port 67 to world to help with<br />
# dynamic interfaces (assigning dynamic ips). Dnsmasq will discard world<br />
# requests to them, but the paranoid might like to close them and let the <br />
# kernel handle them:<br />
bind-interfaces<br />
<br />
# Dynamic range of IPs to make available to LAN pc<br />
dhcp-range=192.168.111.50,192.168.111.100,12h<br />
<br />
# If you’d like to have dnsmasq assign static IPs, bind the LAN computer's<br />
# NIC MAC address:<br />
dhcp-host=aa:bb:cc:dd:ee:ff,192.168.111.50<br />
</nowiki>}}<br />
<br />
== Start the daemon ==<br />
To have dnsmasq to load upon startup:<br />
<br />
{{bc|# systemctl enable dnsmasq}}<br />
<br />
To start dnsmasq immediately:<br />
<br />
{{bc|# systemctl start dnsmasq}}<br />
<br />
To see if dnsmasq started properly, check the log; dnsmasq sends its messages to {{ic|/var/log/messages.log}}. The network will also need to be restarted so the the DHCP client can create a new {{ic|/etc/resolv.conf}}.<br />
<br />
== Test ==<br />
=== DNS Caching ===<br />
<br />
To do a lookup speed test choose a website that has not been visited since dnsmasq has been started ({{ic|dig}} is part of the {{Pkg|dnsutils}} package):<br />
<br />
$ dig archlinux.org | grep "Query time"<br />
<br />
Running the command again will use the cached DNS IP and result in a faster lookup time if dnsmasq is setup correctly.<br />
<br />
=== DHCP Server ===<br />
<br />
From a computer that is connected to the one with dnsmasq on it, configure it to use DHCP for automatic IP address assignment, then attempt to log into the network normally.<br />
<br />
== Tips and tricks ==<br />
<br />
=== Prevent OpenDNS Redirecting Google Queries ===<br />
<br />
To prevent OpenDNS from redirecting all Google queries to their own search server, add to {{ic|/etc/dnsmasq.conf}}:<br />
{{bc|1=server=/www.google.com/<ISP DNS IP>}}<br />
<br />
=== View leases ===<br />
{{bc|$ cat /var/lib/misc/dnsmasq.leases}}</div>SilverWyrdahttps://wiki.archlinux.org/index.php?title=MariaDB&diff=274400MariaDB2013-09-05T04:12:52Z<p>SilverWyrda: /* Upgrade from Oracle MySQL to MariaDB */</p>
<hr />
<div>[[Category:Database management systems]]<br />
[[cs:MySQL]]<br />
[[de:MySQL]]<br />
[[es:MySQL]]<br />
[[fr:MySQL]]<br />
[[it:MySQL]]<br />
[[sr:MySQL]]<br />
[[tr:MySQL]]<br />
[[zh-CN:MySQL]]<br />
MySQL is a widely spread, multi-threaded, multi-user SQL database. For more information about features, see the [http://www.mysql.com/ official homepage].<br />
<br />
{{Note|MariaDB is now officially Arch Linux default implementation of MySQL. It is recommended for all users to [[#Upgrade from Oracle MySQL to MariaDB|upgrade]] to MariaDB. Oracle MySQL was dropped to the AUR. See [https://www.archlinux.org/news/mariadb-replaces-mysql-in-repositories/ the announcement].}}<br />
<br />
== Installation ==<br />
<br />
The MySQL implementation chosen by Arch Linux is called [https://mariadb.org/ MariaDB].<br />
[[pacman|Install]] {{Pkg|mariadb}}, {{Pkg|libmariadbclient}}, {{Pkg|mariadb-clients}} packages from the [[official repositories]].<br />
Alternative implementations are:<br />
* {{App|Oracle MySQL|"The world's most popular open source database". Oracle official implementation.|https://www.mysql.com/|{{AUR|mysql}}}}<br />
* {{App|Percona Server|Alternative which offers breakthrough performance, scalability, features, and instrumentation.|http://www.percona.com/software/percona-server/|{{Pkg|percona-server}}}}<br />
<br />
{{Tip|If the database (in {{ic|/var/lib/mysql}}) resides in a [[btrfs]] filesystem you should consider disabling [[Btrfs#Copy-On-Write_.28CoW.29|Copy-on-Write]] for the directory before creating any database:<br />
{{ic|# chattr +C /var/lib/mysql}}<br />
}}<br />
<br />
Start the ''mysqld'' [[daemon]], run the setup script:<br />
# mysql_secure_installation<br />
and restart the daemon afterwards.<br />
<br />
Frontends available are {{AUR|mysql-gui-tools}} and {{AUR|mysql-workbench}}.<br />
<br />
=== Enable at startup ===<br />
<br />
To enable mysql daemon to start at boot, add the {{ic|mysqld}} service to systemd:<br />
# systemctl enable mysqld.service<br />
<br />
=== Upgrade from Oracle MySQL to MariaDB ===<br />
<br />
{{Note|<br />
It could be needed to remove the following files from {{ic|/var/lib/mysql}} : {{ic|ib_logfile0}}, {{ic|ib_logfile1}} and {{ic|aria_log_control}} before restarting the daemon in the following procedure.}}<br />
<br />
Users who want to switch will need to stop their current {{ic|mysqld}} daemon, install ''mariadb'', ''libmariadbclient'' or ''mariadb-clients'', restart {{ic|mysqld}}and execute:<br />
# mysql_upgrade -p<br />
in order to migrate their systems.<br />
<br />
=== On update ===<br />
<br />
You might consider running this command after you have upgraded MySQL and started it:<br />
# mysql_upgrade -u root -p<br />
<br />
== Configuration ==<br />
<br />
Once you have started the MySQL server, you probably want to add a root account in order to maintain your MySQL users and databases. This can be done manually or automatically, as mentioned by the output of the above script. Either run the commands to set a password for the root account, or run the secure installation script.<br />
<br />
You now should be able to do further configuration using your favorite interface. For example you can use MySQL's command line tool to log in as root into your MySQL server:<br />
$ mysql -p -u root<br />
<br />
=== Disable remote access ===<br />
<br />
The MySQL server is accessible from the network by default. If MySQL is only needed for the localhost, you can improve security by not listening on TCP port 3306. To refuse remote connections, uncomment the following line in {{ic|/etc/mysql/my.cnf}}:<br />
skip-networking<br />
<br />
You will still be able to log in from the localhost.<br />
<br />
=== Enable auto-completion ===<br />
<br />
{{Note|Enabling this feature can make the client initialization longer.}}<br />
The MySQL client completion feature is disabled by default. To enable it system-wide edit {{ic|/etc/mysql/my.cnf}}, and replace {{ic|no-auto-rehash}} by {{ic|auto-rehash}}. Completion will be enabled next time you run the MySQL client.<br />
<br />
=== Using UTF-8 ===<br />
<br />
In the {{ic|/etc/mysql/my.cnf}} file section under the {{ic|mysqld}} group, add:<br />
<br />
{{bc|<nowiki>[mysqld]<br />
init_connect = 'SET collation_connection = utf8_general_ci,NAMES utf8'<br />
collation_server = utf8_general_ci<br />
character_set_client = utf8<br />
character_set_server = utf8</nowiki>}}<br />
<br />
=== Using a TMPFS for tmpdir ===<br />
<br />
The directory used by MySQL for storing temporary files is named ''tmpdir''. For example, it is used to perform disk based large sorts, as well as for internal and explicit temporary tables.<br />
<br />
Create the directory with appropriate permissions:<br />
# mkdir -pv /var/lib/mysqltmp<br />
# chown mysql:mysql /var/lib/mysqltmp<br />
<br />
Find the id and gid of the {{ic|mysql}} user and group:<br />
$ id mysql<br />
uid=27(mysql) gid=27(mysql) groups=27(mysql)<br />
<br />
Add to your {{ic|/etc/fstab}} file.<br />
tmpfs /var/lib/mysqltmp tmpfs rw,gid=27,uid=27,size=100m,mode=0750,noatime 0 0<br />
<br />
Add to your {{ic|/etc/mysql/my.cnf}} file under the {{ic|mysqld}} group:<br />
tmpdir = /var/lib/mysqltmp<br />
<br />
Then reboot or ( shutdown mysql, mount the tmpdir, start mysql ).<br />
<br />
== Backup ==<br />
<br />
The database can be dumped to a file for easy backup. The following shell script will do this for you, creating a {{ic|db_backup.gz}} file in the same directory as the script, containing your database dump:<br />
<br />
{{bc|1=<br />
#!/bin/bash<br />
<br />
THISDIR=$(dirname $(readlink -f "$0"))<br />
<br />
mysqldump --single-transaction --flush-logs --master-data=2 --all-databases \<br />
<nowiki>| gzip > $THISDIR/db_backup.gz<br />
echo 'purge master logs before date_sub(now(), interval 7 day);' |</nowiki> mysql<br />
}}<br />
<br />
See also the official {{ic|mysqldump}} [http://dev.mysql.com/doc/refman/5.6/en/mysqldump.html page] in the MySQL manual.<br />
<br />
== Troubleshooting ==<br />
<br />
=== MySQL daemon cannot start ===<br />
<br />
If MySQL fails to start and there is no entry in the log files, you might want to check the permissions of files in the directories {{ic|/var/lib/mysql}} and {{ic|/var/lib/mysql/mysql}}. If the owner of files in these directories is not {{ic|mysql:mysql}}, you should do the following:<br />
# chown mysql:mysql /var/lib/mysql -R<br />
If you run into permission problems despite having followed the above, ensure that your {{ic|my.cnf}} is copied to {{ic|/etc/}}:<br />
# cp /etc/mysql/my.cnf /etc/my.cnf<br />
Now try and start the daemon.<br />
<br />
If you get these messages in your {{ic|/var/lib/mysql/hostname.err}}:<br />
[ERROR] Can't start server : Bind on unix socket: Permission denied<br />
[ERROR] Do you already have another mysqld server running on socket: /var/run/mysqld/mysqld.sock ?<br />
[ERROR] Aborting<br />
the permissions of {{ic|/var/run/mysqld}} could be the culprit.<br />
# chown mysql:mysql /var/run/mysqld -R<br />
<br />
If you run mysqld and the following error appears:<br />
Fatal error: Can’t open and lock privilege tables: Table ‘mysql.host’ doesn’t exist<br />
Run the following command from the {{ic|/usr}} directory to install the default tables:<br />
# cd /usr<br />
# mysql_install_db --user=mysql --ldata=/var/lib/mysql/<br />
<br />
=== Unable to run mysql_upgrade because MySQL cannot start ===<br />
<br />
Try run MySQL in safemode:<br />
# mysqld_safe --datadir=/var/lib/mysql/<br />
And then run:<br />
# mysql_upgrade -u root -p<br />
<br />
=== Reset the root password ===<br />
<br />
Stop the ''mysqld'' [[daemon]]. Issue the following command:<br />
# mysqld_safe --skip-grant-tables &<br />
Connect to the mysql server. Issue the following command:<br />
# mysql -u root mysql<br />
Change root password:<br />
mysql> UPDATE mysql.user SET Password=PASSWORD('MyNewPass') WHERE User='root';<br />
mysql> FLUSH PRIVILEGES;<br />
mysql> exit<br />
Start the ''mysqld'' daemon.<br />
<br />
=== Check and repair all tables ===<br />
<br />
Check and auto repair all tables in all databases, [http://dev.mysql.com/doc/refman/5.7/en/mysqlcheck.html see more]:<br />
# mysqlcheck -A --auto-repair -u root -p<br />
<br />
=== Optimize all tables ===<br />
<br />
Forcefully Optimize all tables, automatically fixing table errors that may come up.<br />
# mysqlcheck -A --auto-repair -f -o -u root -p<br />
<br />
== See also ==<br />
<br />
* [[LAMP]] - Arch wiki article covering the setup of a LAMP server (Linux Apache MySQL PHP)<br />
* [[PhpMyAdmin]] - Arch wiki article covering the web-based tool to help manage MySQL databases using an Apache/PHP frontend.<br />
* [[PHP]] - Archi wiki article on PHP.<br />
* [http://www.askapache.com/mysql/performance-tuning-mysql.html MySQL Performance Tuning Scripts and Know-How]</div>SilverWyrdahttps://wiki.archlinux.org/index.php?title=MariaDB&diff=274399MariaDB2013-09-05T04:11:44Z<p>SilverWyrda: /* Upgrade from Oracle MySQL to MariaDB */</p>
<hr />
<div>[[Category:Database management systems]]<br />
[[cs:MySQL]]<br />
[[de:MySQL]]<br />
[[es:MySQL]]<br />
[[fr:MySQL]]<br />
[[it:MySQL]]<br />
[[sr:MySQL]]<br />
[[tr:MySQL]]<br />
[[zh-CN:MySQL]]<br />
MySQL is a widely spread, multi-threaded, multi-user SQL database. For more information about features, see the [http://www.mysql.com/ official homepage].<br />
<br />
{{Note|MariaDB is now officially Arch Linux default implementation of MySQL. It is recommended for all users to [[#Upgrade from Oracle MySQL to MariaDB|upgrade]] to MariaDB. Oracle MySQL was dropped to the AUR. See [https://www.archlinux.org/news/mariadb-replaces-mysql-in-repositories/ the announcement].}}<br />
<br />
== Installation ==<br />
<br />
The MySQL implementation chosen by Arch Linux is called [https://mariadb.org/ MariaDB].<br />
[[pacman|Install]] {{Pkg|mariadb}}, {{Pkg|libmariadbclient}}, {{Pkg|mariadb-clients}} packages from the [[official repositories]].<br />
Alternative implementations are:<br />
* {{App|Oracle MySQL|"The world's most popular open source database". Oracle official implementation.|https://www.mysql.com/|{{AUR|mysql}}}}<br />
* {{App|Percona Server|Alternative which offers breakthrough performance, scalability, features, and instrumentation.|http://www.percona.com/software/percona-server/|{{Pkg|percona-server}}}}<br />
<br />
{{Tip|If the database (in {{ic|/var/lib/mysql}}) resides in a [[btrfs]] filesystem you should consider disabling [[Btrfs#Copy-On-Write_.28CoW.29|Copy-on-Write]] for the directory before creating any database:<br />
{{ic|# chattr +C /var/lib/mysql}}<br />
}}<br />
<br />
Start the ''mysqld'' [[daemon]], run the setup script:<br />
# mysql_secure_installation<br />
and restart the daemon afterwards.<br />
<br />
Frontends available are {{AUR|mysql-gui-tools}} and {{AUR|mysql-workbench}}.<br />
<br />
=== Enable at startup ===<br />
<br />
To enable mysql daemon to start at boot, add the {{ic|mysqld}} service to systemd:<br />
# systemctl enable mysqld.service<br />
<br />
=== Upgrade from Oracle MySQL to MariaDB ===<br />
<br />
Users who want to switch will need to stop their current {{ic|mysqld}} daemon, install ''mariadb'', ''libmariadbclient'' or ''mariadb-clients'', restart {{ic|mysqld}}and execute:<br />
# mysql_upgrade -p<br />
in order to migrate their systems.<br />
<br />
{{Note|<br />
It could be needed to remove the following files from {{ic|/var/lib/mysql}} : {{ic|ib_logfile0}}, {{ic|ib_logfile1}} and {{ic|aria_log_control}} before starting the daemon.}}<br />
<br />
=== On update ===<br />
<br />
You might consider running this command after you have upgraded MySQL and started it:<br />
# mysql_upgrade -u root -p<br />
<br />
== Configuration ==<br />
<br />
Once you have started the MySQL server, you probably want to add a root account in order to maintain your MySQL users and databases. This can be done manually or automatically, as mentioned by the output of the above script. Either run the commands to set a password for the root account, or run the secure installation script.<br />
<br />
You now should be able to do further configuration using your favorite interface. For example you can use MySQL's command line tool to log in as root into your MySQL server:<br />
$ mysql -p -u root<br />
<br />
=== Disable remote access ===<br />
<br />
The MySQL server is accessible from the network by default. If MySQL is only needed for the localhost, you can improve security by not listening on TCP port 3306. To refuse remote connections, uncomment the following line in {{ic|/etc/mysql/my.cnf}}:<br />
skip-networking<br />
<br />
You will still be able to log in from the localhost.<br />
<br />
=== Enable auto-completion ===<br />
<br />
{{Note|Enabling this feature can make the client initialization longer.}}<br />
The MySQL client completion feature is disabled by default. To enable it system-wide edit {{ic|/etc/mysql/my.cnf}}, and replace {{ic|no-auto-rehash}} by {{ic|auto-rehash}}. Completion will be enabled next time you run the MySQL client.<br />
<br />
=== Using UTF-8 ===<br />
<br />
In the {{ic|/etc/mysql/my.cnf}} file section under the {{ic|mysqld}} group, add:<br />
<br />
{{bc|<nowiki>[mysqld]<br />
init_connect = 'SET collation_connection = utf8_general_ci,NAMES utf8'<br />
collation_server = utf8_general_ci<br />
character_set_client = utf8<br />
character_set_server = utf8</nowiki>}}<br />
<br />
=== Using a TMPFS for tmpdir ===<br />
<br />
The directory used by MySQL for storing temporary files is named ''tmpdir''. For example, it is used to perform disk based large sorts, as well as for internal and explicit temporary tables.<br />
<br />
Create the directory with appropriate permissions:<br />
# mkdir -pv /var/lib/mysqltmp<br />
# chown mysql:mysql /var/lib/mysqltmp<br />
<br />
Find the id and gid of the {{ic|mysql}} user and group:<br />
$ id mysql<br />
uid=27(mysql) gid=27(mysql) groups=27(mysql)<br />
<br />
Add to your {{ic|/etc/fstab}} file.<br />
tmpfs /var/lib/mysqltmp tmpfs rw,gid=27,uid=27,size=100m,mode=0750,noatime 0 0<br />
<br />
Add to your {{ic|/etc/mysql/my.cnf}} file under the {{ic|mysqld}} group:<br />
tmpdir = /var/lib/mysqltmp<br />
<br />
Then reboot or ( shutdown mysql, mount the tmpdir, start mysql ).<br />
<br />
== Backup ==<br />
<br />
The database can be dumped to a file for easy backup. The following shell script will do this for you, creating a {{ic|db_backup.gz}} file in the same directory as the script, containing your database dump:<br />
<br />
{{bc|1=<br />
#!/bin/bash<br />
<br />
THISDIR=$(dirname $(readlink -f "$0"))<br />
<br />
mysqldump --single-transaction --flush-logs --master-data=2 --all-databases \<br />
<nowiki>| gzip > $THISDIR/db_backup.gz<br />
echo 'purge master logs before date_sub(now(), interval 7 day);' |</nowiki> mysql<br />
}}<br />
<br />
See also the official {{ic|mysqldump}} [http://dev.mysql.com/doc/refman/5.6/en/mysqldump.html page] in the MySQL manual.<br />
<br />
== Troubleshooting ==<br />
<br />
=== MySQL daemon cannot start ===<br />
<br />
If MySQL fails to start and there is no entry in the log files, you might want to check the permissions of files in the directories {{ic|/var/lib/mysql}} and {{ic|/var/lib/mysql/mysql}}. If the owner of files in these directories is not {{ic|mysql:mysql}}, you should do the following:<br />
# chown mysql:mysql /var/lib/mysql -R<br />
If you run into permission problems despite having followed the above, ensure that your {{ic|my.cnf}} is copied to {{ic|/etc/}}:<br />
# cp /etc/mysql/my.cnf /etc/my.cnf<br />
Now try and start the daemon.<br />
<br />
If you get these messages in your {{ic|/var/lib/mysql/hostname.err}}:<br />
[ERROR] Can't start server : Bind on unix socket: Permission denied<br />
[ERROR] Do you already have another mysqld server running on socket: /var/run/mysqld/mysqld.sock ?<br />
[ERROR] Aborting<br />
the permissions of {{ic|/var/run/mysqld}} could be the culprit.<br />
# chown mysql:mysql /var/run/mysqld -R<br />
<br />
If you run mysqld and the following error appears:<br />
Fatal error: Can’t open and lock privilege tables: Table ‘mysql.host’ doesn’t exist<br />
Run the following command from the {{ic|/usr}} directory to install the default tables:<br />
# cd /usr<br />
# mysql_install_db --user=mysql --ldata=/var/lib/mysql/<br />
<br />
=== Unable to run mysql_upgrade because MySQL cannot start ===<br />
<br />
Try run MySQL in safemode:<br />
# mysqld_safe --datadir=/var/lib/mysql/<br />
And then run:<br />
# mysql_upgrade -u root -p<br />
<br />
=== Reset the root password ===<br />
<br />
Stop the ''mysqld'' [[daemon]]. Issue the following command:<br />
# mysqld_safe --skip-grant-tables &<br />
Connect to the mysql server. Issue the following command:<br />
# mysql -u root mysql<br />
Change root password:<br />
mysql> UPDATE mysql.user SET Password=PASSWORD('MyNewPass') WHERE User='root';<br />
mysql> FLUSH PRIVILEGES;<br />
mysql> exit<br />
Start the ''mysqld'' daemon.<br />
<br />
=== Check and repair all tables ===<br />
<br />
Check and auto repair all tables in all databases, [http://dev.mysql.com/doc/refman/5.7/en/mysqlcheck.html see more]:<br />
# mysqlcheck -A --auto-repair -u root -p<br />
<br />
=== Optimize all tables ===<br />
<br />
Forcefully Optimize all tables, automatically fixing table errors that may come up.<br />
# mysqlcheck -A --auto-repair -f -o -u root -p<br />
<br />
== See also ==<br />
<br />
* [[LAMP]] - Arch wiki article covering the setup of a LAMP server (Linux Apache MySQL PHP)<br />
* [[PhpMyAdmin]] - Arch wiki article covering the web-based tool to help manage MySQL databases using an Apache/PHP frontend.<br />
* [[PHP]] - Archi wiki article on PHP.<br />
* [http://www.askapache.com/mysql/performance-tuning-mysql.html MySQL Performance Tuning Scripts and Know-How]</div>SilverWyrdahttps://wiki.archlinux.org/index.php?title=CUPS&diff=274398CUPS2013-09-05T04:09:15Z<p>SilverWyrda: /* HP Printer */</p>
<hr />
<div>[[Category:Printers]]<br />
[[cs:CUPS]]<br />
[[es:CUPS]]<br />
[[fr:CUPS]]<br />
[[it:CUPS]]<br />
[[pl:CUPS]]<br />
[[ru:CUPS]]<br />
[[th:CUPS]]<br />
[[tr:CUPS]]<br />
[[zh-CN:CUPS]]<br />
[[zh-TW:CUPS]]<br />
{{Article summary start|Summary}}<br />
{{Article summary text|Installing and configuring CUPS}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|CUPS printer sharing}}<br />
{{Article summary wiki|CUPS printer-specific problems}}<br />
{{Article summary wiki|Samba}}<br />
{{Article summary end}}<br />
<br />
From [http://www.cups.org/index.php CUPS' site]:<br />
:"''[[Wikipedia:CUPS|CUPS]] is the standards-based, open source printing system developed by Apple Inc. for OS® X and other UNIX®-like operating systems''".<br />
<br />
Although there are other printing packages such as LPRNG, the Common Unix Printing System is the most popular choice because of its relative ease of use.<br />
<br />
== CUPS Linux printing workflow ==<br />
As of {{Pkg|cups}} version 1.5.3-3, Arch Linux makes use of the new full pdf-based printing workflow. For<br />
further reading check [http://www.linuxfoundation.org/collaborate/workgroups/openprinting/pdfasstandardprintjobformat PDF standard printing job format] and an old [https://wiki.linuxfoundation.org/en/OpenPrinting/Database/CUPS-Filter-Chart CUPS filtering chart] for history and fun.<br />
A good starting point for general Linux printing questions is [http://www.linuxfoundation.org/collaborate/workgroups/openprinting here].<br />
<br />
There are two ways to setup a printer.<br />
* If there's a CUPS server running in your network and sharing a printer you only need to install the client package.<br />
* If the printer is connected directly to your system or you have access to an IPP network printer then setup a local CUPS server.<br />
<br />
== Installing the client package ==<br />
<br />
The package {{Pkg|libcups}} is the only required package. [[pacman|Install]] it from the [[official repositories]].<br />
<br />
Then add your CUPS server's IP address or hostname into {{ic|/etc/cups/client.conf}}. That is all you need. Every application should quickly find the printer(s) shared by that CUPS server.<br />
<br />
=== Optional advanced network setup ===<br />
<br />
It is also possible to run a entire cupsd+cups-browsed instance on your client with Avahi browsing enabled to discover unknown shared printers in your network. This can be useful in large setups where the server is unknown.<br />
{{Note|This behavior did not change with cups 1.6.x - the difference is that until 1.5.x cupsd was able to do printer browsing alone and now it can only browse its own shared printers.<br />
To get the local cupsd recognise other shared printers offered by a remote cupsd server you need a running local cups-browsed (supported since cups-filters 1.0.26) instance using Avahi to discover unknown printers. <br />
There is [https://bbs.archlinux.org/viewtopic.php?id&#61;161440 good news] in April 2013 (still has to be incorporated above).}}<br />
<br />
=== Installing CUPS a 32 bit chroot environment ===<br />
<br />
If you have a 64 bit base installation with a [[Install_bundled_32-bit_system_in_Arch64|32 bit chroot environment]], explicit installation of CUPS is not necessary in the 32 bit environment. To access installed CUPS printers from the chroot environment, one needs to bind the {{ic|/var/run/cups}} directory to the same relative location in the chroot environment. Simply create the directory in the chroot (it probably doesn't exist), mount (with {{ic|-o bind}} passed to the command}}, and printers should be available from 32 bit chroot applications immediately.<br />
<br />
{{bc|# mkdir /path/to/chroot/var/run/cups<br />
# Example: # mkdir /opt/arch32/var/run/cups<br />
<br />
# mount -o bind /var/run/cups /path/to/chroot/var/run/cups}}<br />
<br />
== Installing the server packages ==<br />
<br />
The following packages and some printer drivers are needed. [[pacman|Install]] them from the [[official repositories]].<br />
<br />
* {{Pkg|cups}} - the actual CUPS daemon<br />
* {{Pkg|cups-filters}} - essential filters<br />
* {{Pkg|ghostscript}} - (optional) PostScript interpreter<br />
* {{Pkg|gsfonts}} - GhostScript standard Type1 fonts<br />
<br />
If you want to enable printer browsing through your network, also install {{Pkg|avahi}}. Make sure '''avahi-daemon''' is started before '''cupsd'''.<br />
<br />
If the system is connected to a networked printer using the [[Samba]] protocol or if the system is to be a print server for Windows clients, also install {{Pkg|samba}}.<br />
<br />
=== Printer driver ===<br />
<br />
Here are some of the driver packages. Choosing the right driver depends on the printer:<br />
<br />
* '''{{Pkg|gutenprint}}''' - A collection of high quality drivers for Canon, Epson, Lexmark, Sony, Olympus, and PCL printers for use with GhostScript, CUPS, Foomatic, and the [[GIMP]]<br />
* '''{{Pkg|foomatic-db}}, {{Pkg|foomatic-db-engine}}, {{Pkg|foomatic-db-nonfree}}, and {{Pkg|foomatic-filters}}''' - Foomatic is a database-driven system for integrating free software printer drivers with common spoolers under Unix. Installing foomatic-filters should solve problems if the cups error_log is reporting "stopped with status 22!".<br />
* '''{{Pkg|hplip}}''' - HP drivers for DeskJet, OfficeJet, Photosmart, Business Inkjet and some LaserJet printer models, as well as a number of Brother printers.<br />
* '''{{Pkg|splix}}''' - Samsung drivers for SPL (Samsung Printer Language) printers.<br />
<br />
* '''{{AUR|foo2zjs}}''' - Drivers for ZjStream protocol printers such as the HP Laserjet 1018. More info [http://foo2zjs.rkkda.com here]. Package is available in the [[AUR]].<br />
* '''{{AUR|hpoj}}''' - If you are using an HP Officejet, you should also install this package and follow the instructions to avoid problems as in [https://answers.launchpad.net/hplip/+question/133425 this thread]. Package is available in the [[AUR]].<br />
* '''{{AUR|samsung-unified-driver}}''' - Unified Linux Driver for Samsung printers and scanners. Required for new printers such as the ML-2160. Package is available in the [[AUR]].<br />
* '''{{AUR|ufr2}}''' or '''{{AUR|cndrvcups-lb}}''' - Canon UFR2 driver with support for LBP, iR and MF series printers. Package is available in the [[AUR]].<br />
<br />
* '''{{Pkg|cups-pdf}}''' - A package that allows one to setup a virtual PDF Printer that generates a PDF out of jobs sent to it<br />
<br />
If you are not sure of what driver package to install or if the current driver is not working, it may be easiest to just install all of the drivers. Some of the package names are misleading because printers of other makes may rely on them. For example, the Brother HL-2140 needs the hplip driver installed.<br />
<br />
==== Download printer PPD ====<br />
<br />
Depending on the printer, this step is optional and may not be needed, as the standard CUPS installation already comes with quite a few PPD (Postscript Printer Description) files. Moreover, the ''foomatic-filters'', ''gimp-print'' and ''hplip'' packages already include quite a few PPD files which will automatically be detected by CUPS.<br />
<br />
Here is an explanation of what a PPD file is from the Linux Printing website:<br />
:"''For every PostScript printer the manufacturers provide a PPD file which contains all printer-specific information about the particular printer model: Basic printer capabilities as whether the printer is a color printer, fonts, PostScript level, etc., and especially the user-adjustable options, as paper size, resolution, etc.''"<br />
<br />
If the PPD for the printer is ''not'' already in CUPS, then:<br />
*check [[AUR]] to see if there are packages for the printer/manufacturer<br />
*visit the [http://www.openprinting.org/printers OpenPrinting database] and select the manufacturer and model of the printer<br />
*visit the manufacturer's site and search for GNU/Linux drivers<br />
<br />
{{Note|PPD files go in {{ic|/usr/share/cups/model/}}}}<br />
<br />
==== Another source for printer drivers ====<br />
<br />
[http://www.turboprint.de/english.html Turboprint] is a proprietary driver for many printers not yet supported by GNU/Linux (Canon i*, for example). Unlike CUPS, however, high quality prints are either marked with a watermark or are a pay-only service.<br />
<br />
== Hardware support and configuration ==<br />
<br />
=== USB printers ===<br />
<br />
{{Tip|Most USB printers should work out of the box, you can skip this section and come back if you can not get your printer to work.}}<br />
<br />
USB printers can get accessed with two methods: The usblp kernel module and libusb. The former is the classic way. It is simple: data is sent to the printer by writing it to a device file as a simple serial data stream. Reading the same device file allows bi-di access, at least for things like reading out ink levels, status, or printer capability information (PJL). It works very well for simple printers, but for multi-function devices (printer/scanner) it is not suitable and manufacturers like HP supply their own backends. Source: [http://lists.linuxfoundation.org/pipermail/printing-architecture/2012/002412.html here].<br />
<br />
==== Blacklisting usblp ====<br />
<br />
{{Warning|As of {{Pkg|cups}} version 1.6.0, you no longer need to [[Kernel modules#Blacklisting|blacklist]] the {{ic|usblp}} kernel module.<br />
<br />
If you find out this is the only way to fix a remaining issue please report this upstream to the CUPS bug tracker and maybe also get in contact with Till Kamppeter (Debian CUPS maintainer). See [http://cups.org/str.php?L4128 upstream bug] for more.}}<br />
<br />
If you have problems getting your USB printer to work, you can try blacklisting the {{ic|usblp}} [[kernel module]]:<br />
<br />
{{hc|/etc/modprobe.d/blacklistusblp.conf|<br />
blacklist usblp<br />
}}<br />
<br />
Custom kernel users may need to manually load the {{ic|usbcore}} [[kernel module]] before proceeding.<br />
<br />
Once the modules are installed, plug in the printer and check if the kernel detected it by running the following:<br />
# tail /var/log/messages.log<br />
or<br />
# dmesg<br />
<br />
If you're using {{ic|usblp}}, the output should indicate that the printer has been detected like so:<br />
Feb 19 20:17:11 kernel: printer.c: usblp0: USB Bidirectional<br />
printer dev 2 if 0 alt 0 proto 2 vid 0x04E8 pid 0x300E<br />
Feb 19 20:17:11 kernel: usb.c: usblp driver claimed interface cfef3920<br />
Feb 19 20:17:11 kernel: printer.c: v0.13: USB Printer Device Class driver<br />
<br />
If you blacklisted {{ic|usblp}}, you will see something like:<br />
usb 3-2: new full speed USB device using uhci_hcd and address 3<br />
usb 3-2: configuration #1 chosen from 1 choice<br />
<br />
=== Parallel port printers ===<br />
<br />
To use a parallel port printer, you will need to load the {{ic|lp}}, {{ic|parport}} and {{ic|parport_pc}} [[kernel modules]].<br />
<br />
Check the setup by running:<br />
# tail /var/log/messages.log<br />
It should display something like this:<br />
lp0: using parport0 (polling).<br />
<br />
If you are using a USB to parallel port adapter, CUPS will not be able to detect the printer. As a workaround, add the printer using a different connection type and then change DeviceID in {{ic|/etc/cups/printers.conf}}:<br />
DeviceID = parallel:/dev/usb/lp0<br />
<br />
=== HP Printer ===<br />
<br />
HP printers can also be installed via HP's Linux setup tool. Install it by installing {{Pkg|hplip}} from the [[official repositories]].<br />
<br />
To run with qt frontend:<br />
# hp-setup -u<br />
<br />
To run with command line:<br />
# hp-setup -i<br />
<br />
PPD files are in {{ic|/usr/share/ppd/HP/}}.<br />
<br />
For printers that require the proprietary HP plugin (like the Laserjet Pro P1102w), install the {{AUR|hplip-plugin}} package from [[AUR]].<br />
<br />
{{Note|<br />
{{Pkg|hplip}} depends on {{Pkg|foomatic-db-engine}} which prevents the drivers list from appearing when a printer is added to CUPS via the web user interface (following error : "Unable to get list of printer drivers"). The workaround consists in installing {{Pkg|hplip}} first, retrieve the corresponding PPD file from {{ic|/usr/share/ppd/HP/}}, then, remove entierly {{Pkg|hplip}} and the unecessary dependencies. Finally, install the printer manually with the PPD file (can be achieve on the webui) then re-install {{Pkg|hplip}}. You should have after a reboot a fully working printer.}}<br />
<br />
== Configuring ==<br />
<br />
Now that CUPS is installed, there are a variety of options on how to set up printing solutions. As always, the tried and true command line method is at your disposal. CUPS also embeds a full-featured web interface. Likewise, various desktop environments such as GNOME and KDE have useful programs that can help manage printers. Depending on your needs, you may choose one method or the other.<br />
<br />
If you are planning on connecting to a network printer, rather than one that is directly connected to the computer, you might want to read the [[CUPS printer sharing]] page first. Printer sharing between GNU/Linux systems is quite easy and involves very little configuration, whereas sharing between a Windows and GNU/Linux host requires a little bit more effort.<br />
<br />
=== CUPS daemon ===<br />
<br />
With the kernel modules installed, you can now start the '''cups''' and optionally, the '''cups-browsed''' [[daemons]], and enable them as required.<br />
<br />
=== Web interface and tool-kit ===<br />
<br />
Once the daemon is running, open a browser and go to: http://localhost:631 (''The '''localhost''' string may need to be replaced with the hostname found in'' {{ic|/etc/hostname}}).<br />
<br />
From here, follow the various wizards to add the printer. A usual procedure is to start by clicking on ''Adding Printers and Classes'' and then ''Add Printer''. When prompted for a username and password, log in as root. The name assigned to the printer does not matter, the same applies for 'location' and 'description'. Next, a list of devices to select from will be presented. The actual name of the printer shows up next to the label (e.g., next to ''USB Printer #1'' for USB printers). Finally, choose the appropriate drivers and the configuration is complete.<br />
<br />
Now test the configuration by pressing the ''Maintenance'' drop-down menu then ''Print Test Page''. If it does not print and there is certainty regarding the correctness of applied settings, then the problem is most likely due to missing a proper printer driver.<br />
<br />
{{Tip|See: [[#Alternative CUPS interfaces]] for other other front-ends.}}<br />
{{Note|<br />
* When setting up a USB printer, you should see your printer listed on ''Add Printer'' page. If you can only see a "SCSI printer" option, it probably means that CUPS has failed to recognize your printer.<br />
* To enable wireless scanning on certain HP multi-function devices using the {{pkg|hplip}} package, you may need to add the printer as a Network Printer using the HTTP protocol. To determine the proper URI to use, run the {{ic|hp-makeuri}} command.}}<br />
<br />
==== CUPS administration ====<br />
<br />
A username and password will be required when administering the printer in the web interface, such as: adding or removing printers, stopping print tasks, etc. The default username is the one assigned in the ''sys'' group, or root. Other admin groups (e.g. lpadmin or printadmin) may be added to the {{ic|SystemGroup}} line in {{ic|/etc/cups/cups-files.conf}} (you might have to add this line). See [http://www.cups.org/articles.php?L237+T+Qprintadmin these instructions at cups.org]. You might also want to read [https://bbs.archlinux.org/viewtopic.php?id=35567 this post]. Create the group[s] ({{ic|man groupadd}}) and add the group[s] to users ({{ic|man usermod}}). cupsd must be restarted and the user must re-login for these changes to take affect.<br />
<br />
If the root account has been locked (i.e. when using sudo), it is not possible to log in the CUPS administration interface with the default username (root) and password. Follow the instructions above to add other users as cups administrators.<br />
<br />
==== Remote access to web interface ====<br />
<br />
By default, the CUPS web interface can only be accessed by the ''localhost''; i.e. the computer that it is installed on. To remotely access the interface, make the following changes to the {{ic|/etc/cups/cupsd.conf}} file. Replace the line:<br />
Listen localhost:631<br />
with<br />
Port 631<br />
so that CUPS listens to incoming requests.<br />
<br />
Three levels of access can be granted:<br />
<Location /> #access to the server<br />
<Location /admin> #access to the admin pages<br />
<Location /admin/conf> #access to configuration files<br />
<br />
To give remote hosts access to one of these levels, add an {{ic|Allow}} statement to that level's section. An {{ic|Allow}} statement can take one or more of the forms listed below:<br />
Allow from all<br />
Allow from host.domain.com<br />
Allow from *.domain.com<br />
Allow from ip-address<br />
Allow from ip-address/netmask<br />
<br />
Deny statements can also be used. For example, if wanting to give all hosts on the 192.168.1.0/255.255.255.0 subnet full access, file {{ic|/etc/cups/cupsd.conf}} would include this:<br />
# Restrict access to the server...<br />
# By default only localhost connections are possible<br />
<Location /><br />
Order allow,deny<br />
Allow from localhost<br />
'''Allow from 192.168.1.0/255.255.255.0'''<br />
</Location><br />
<br />
# Restrict access to the admin pages...<br />
<Location /admin><br />
# Encryption disabled by default<br />
#Encryption Required<br />
Order allow,deny<br />
Allow from localhost<br />
'''Allow from 192.168.1.0/255.255.255.0'''<br />
</Location><br />
<br />
# Restrict access to configuration files...<br />
<Location /admin/conf><br />
AuthType Basic<br />
Require user @SYSTEM<br />
Order allow,deny<br />
Allow From localhost<br />
'''Allow From 192.168.1.0/255.255.255.0'''<br />
</Location><br />
<br />
You might also need to add:<br />
<br />
DefaultEncryption Never<br />
<br />
This should avoid the error: 426 - Upgrade Required when using the CUPS web interface from a remote machine.<br />
<br />
=== Command-line configuration ===<br />
<br />
CUPS can be fully controlled from command-line with nice tools, ''i.e.'' the lp* and the cups* command families.<br />
<br />
On Arch Linux, most commands support auto-completion with common shells.<br />
Also note that command-line switches cannot be grouped.<br />
<br />
;List the devices<br />
# lpinfo -v<br />
<br />
;List the drivers<br />
# lpinfo -m<br />
<br />
;Add a new printer<br />
# lpadmin -p ''printer'' -E -v ''device'' -P ''ppd''<br />
<br />
The ''printer'' is up to you. The device can be retrieved from the 'lpinfo -i' command.<br />
Example:<br />
# lpadmin -p HP_DESKJET_940C -E -v "usb://HP/DESKJET%20940C?serial=CN16E6C364BH" -P /usr/share/ppd/HP/hp-deskjet_940c.ppd.gz<br />
<br />
In the following, the ''printer'' references the name you have used here to set up the printer.<br />
<br />
;Set the default printer<br />
$ lpoptions -d ''printer''<br />
<br />
;Check the status<br />
$ lpstat -s<br />
$ lpstat -p ''printer''<br />
<br />
;Deactivate a printer<br />
# cupsdisable ''printer''<br />
<br />
;Activate a printer<br />
# cupsenable ''printer''<br />
<br />
;Remove a printer<br />
First set it to reject all incoming entries:<br />
# cupsreject ''printer''<br />
Then disable it.<br />
# cupsdisable ''printer''<br />
Finally remove it.<br />
# lpadmin -x ''printer''<br />
<br />
;Print a file<br />
$ lpr ''file''<br />
$ lpr -# 17 ''file'' # print the file 17 times<br />
$ echo "Hello, world!" | lpr -p # print the result of a command. The -p switch adds a header.<br />
<br />
;Check the printing queue<br />
$ lpq<br />
$ lpq -a # on all printers<br />
<br />
;Clear the printing queue<br />
# lprm # remove last entry only<br />
# lprm - # remove all entries<br />
<br />
=== Alternative CUPS interfaces ===<br />
<br />
==== GNOME ====<br />
<br />
You can configure and manage printers by [[pacman|installing]] {{Pkg|system-config-printer}}. This program does pull in some gnome dependencies.<br />
<br />
If your user does not have sufficient priviliges to administer the cups scheduler, system-config-printer will request the root password when it starts. You can avoid this by performing the following instructions.<br />
<br />
1. Create a group for administering the cups scheduler:<br />
<br />
# groupadd lpadmin<br />
<br />
2. Add yourself to the newly created group:<br />
<br />
# usermod -aG lpadmin ''username''<br />
<br />
3. Tell cups to respect the newly created group:<br />
<br />
{{hc|/etc/cups/cups-files.conf|<br />
...<br />
SystemGroup sys root '''lpadmin'''<br />
...}}<br />
<br />
4. Restart cups:<br />
<br />
# systemctl restart cupsd<br />
<br />
5. Log out and log in again or restart your computer.<br />
<br />
==== KDE ====<br />
<br />
[[KDE]] users can modify their printers from the Control Center. Both should refer to those desktop environments' documentation for more information on how to use the interfaces.<br />
<br />
==== Other ====<br />
<br />
There is also {{AUR|gtklp}} in the [[AUR]].<br />
<br />
== PDF virtual printer ==<br />
<br />
{{Pkg|cups-pdf}} is a nice package that allows one to setup a virtual printer that will generate a PDF from anything sent to it. This package is not necessary, but it can be quite useful.<br />
<br />
After installing the package, set it up as if it were for any other printer by using the web interface. Access the cups print manager: http://localhost:631 and select:<br />
Administration -> Add Printer<br />
Select CUPS-PDF (Virtual PDF), choose for the make and driver:<br />
Make: Generic<br />
Driver: Generic CUPS-PDF Printer<br />
<br />
Find generated PDF documents in a sub-directory located at {{ic|/var/spool/cups-pdf}}. Normally, the subdirectory is named after the user who performed the job. A little tweak helps you to find your printed PDF documents more easily. Edit {{ic|/etc/cups/cups-pdf.conf}} by changing the line<br />
#Out /var/spool/cups-pdf/${USER}<br />
<br />
to<br />
<br />
Out ${HOME}<br />
<br />
=== Print to PostScript ===<br />
<br />
The CUPS-PDF (Virtual PDF Printer) actually creates a PostScript file and then creates the PDF using the ps2pdf utility. To print to PostScript, just print as usual, in the print dialog choose "CUPS-PDF" as the printer, then select the checkbox for "print to file", hit print, enter the filename.ps and click save. This is handy for faxes, etc...<br />
<br />
== Troubleshooting ==<br />
<br />
The best way to get printing working is to set 'LogLevel' in {{ic|/etc/cups/cupsd.conf}} to:<br />
LogLevel debug<br />
<br />
And then viewing the output from {{ic|/var/log/cups/error_log}} like this:<br />
# tail -n 100 -f /var/log/cups/error_log<br />
<br />
The characters at the left of the output stand for:<br />
*D=Debug<br />
*E=Error<br />
*I=Information<br />
*And so on<br />
<br />
These files may also prove useful:<br />
*{{ic|/var/log/cups/page_log}} - Echoes a new entry each time a print is successful<br />
*{{ic|/var/log/cups/access_log}} - Lists all cupsd http1.1 server activity<br />
<br />
Of course, it is important to know how CUPS works if wanting to solve related issues:<br />
# An application sends a .ps file (PostScript, a script language that details how the page will look) to CUPS when 'print' has been selected (this is the case with most programs).<br />
# CUPS then looks at the printer's PPD file (printer description file) and figures out what filters it needs to use to convert the .ps file to a language that the printer understands (like PJL, PCL), usually GhostScript.<br />
# GhostScript takes the input and figures out which filters it should use, then applies them and converts the .ps file to a format understood by the printer.<br />
# Then it is sent to the back-end. For example, if the printer is connected to a USB port, it uses the USB back-end.<br />
<br />
Print a document and watch {{ic|error_log}} to get a more detailed and correct image of the printing process.<br />
<br />
=== Problems resulting from upgrades ===<br />
<br />
''Issues that appeared after CUPS and related program packages underwent a version increment''<br />
<br />
==== CUPS stops working ====<br />
<br />
The chances are that a new configuration file is needed for the new version to work properly. Messages such as "404 - page not found" may result from trying to manage CUPS via localhost:631, for example.<br />
<br />
To use the new configuration, copy {{ic|/etc/cups/cupsd.conf.default}} to {{ic|/etc/cups/cupsd.conf}} (backup the old configuration if needed) and restart CUPS to employ the new settings.<br />
<br />
==== All jobs are "stopped" ====<br />
<br />
If all jobs sent to the printer become "stopped", delete the printer and add it again.<br />
Using the [http://localhost:631 CUPS web interface], go to Printers > Delete Printer.<br />
<br />
To check the printer's settings go to ''Printers'', then ''Modify Printer''. Copy down the information displayed, click 'Modify Printer' to proceed to the next page(s), and so on.<br />
<br />
==== All jobs are "The printer is not responding" ====<br />
<br />
On networked printers, you should check that the name that CUPS uses as its connection URI resolves to the printer's IP via DNS, e.g.<br />
If your printer's connection looks like this:<br />
lpd://BRN_020554/BINARY_P1<br />
<br />
then the hostname 'BRN_020554' needs to resolve to the printer's IP from the server running CUPS<br />
<br />
==== The PPD version is not compatible with gutenprint ====<br />
<br />
Run:<br />
# /usr/bin/cups-genppdupdate<br />
<br />
And restart CUPS (as pointed out in gutenprint's post-install message)<br />
<br />
=== Other ===<br />
<br />
===== CUPS permission errors =====<br />
<br />
* Some users fixed 'NT_STATUS_ACCESS_DENIED' (Windows clients) errors by using a slightly different syntax:<br />
smb://workgroup/username:password@hostname/printer_name<br />
<br />
* Sometimes, the block device has wrong permissions:<br />
# ls /dev/usb/<br />
lp0<br />
# chgrp lp /dev/usb/lp0<br />
<br />
==== HPLIP printer sends "/usr/lib/cups/backend/hp failed" error ====<br />
<br />
Make sure dbus is installed and running. If the error persists, try starting avahi-daemon.<br />
<br />
Try adding the printer as a Network Printer using the http:// protocol. Generate the printer URI with {{ic|hp-makeuri}}.<br />
<br />
{{Note|There might need to set permissions issues right. Follow indications here: [[CUPS#Device node permissions]].}}<br />
<br />
==== HPLIP printer claims job is complete but printer does nothing ====<br />
<br />
This happens on HP printers when you select the (old) hpijs driver (e.g. the Deskjet D1600 series). Instead, use the hpcups driver when adding the printer.<br />
<br />
Some HP printers (e.g HP LaserJet) require their firmware to be downloaded from the computer every time the printer is switched on. If there is an issue with udev (or equivalent) and the firmware download rule is never fired, you may experience this issue.<br />
As a workaround, you can manually download the firmware to the printer. Ensure the printer is plugged in and switched on, then enter<br />
hp-firmware -n<br />
<br />
==== hp-setup asks to specify the PPD file for the discovered printer ====<br />
<br />
Install CUPS before running hp-setup.<br />
<br />
==== I have installed Qt, but hp-setup reports "Qt/PyQt 4 initialization failed" ====<br />
<br />
"hp-check -t" won't give you useful information to find the required package. You have to install all the "Dependent Packages" prefixed with "python2" in https://www.archlinux.org/packages/extra/x86_64/hplip/<br />
<br />
==== hp-setup finds the printer automatically but reports "Unable to communicate with device" when printing test page immediately afterwards ====<br />
<br />
This at least happens to hplip 3.13.5-2 for HP Officejet 6500A through local network connection. To solve the problem, specify the IP address of the HP printer for hp-setup to locate the printer.<br />
<br />
==== hp-toolbox sends an error, "Unable to communicate with device" ====<br />
<br />
If running hp-toolbox as a regular user results in:<br />
# hp-toolbox<br />
# error: Unable to communicate with device (code=12): hp:/usb/''printer id''<br />
or, "{{ic|Unable to communicate with device"}}", then it may be needed to [[Groups#Group management|add the user to the lp and sys groups]].<br />
<br />
This can also be caused by printers such as the P1102 that provide a virtual cd-rom drive for MS-Windows drivers. The lp dev appears and then disappears. In that case try the '''usb-modeswitch''' and '''usb-modeswitch-data''' packages, that lets one switch off the "Smart Drive" (udev rules included in said packages).<br />
<br />
This can also occur with network attached printers if the [[Avahi|avahi-daemon]] is not running. Another possiblility is the specification of the printer's IP address in hp-setup fails to locate the printer because the IP address of the the printer changed due to DHCP.<br />
<br />
==== CUPS returns '"foomatic-rip" not available/stopped with status 3' with a HP printer ====<br />
<br />
If receiving any of the following error messages in {{ic|/var/log/cups/error_log}} while using a HP printer, with jobs appearing to be processed while they all end up not being completed with their status set to 'stopped':<br />
Filter "foomatic-rip" for printer ''printer_name'' not available: No such file or director<br />
or:<br />
PID 5771 (/usr/lib/cups/filter/foomatic-rip) stopped with status 3!<br />
make sure {{pkg|hplip}} has been [[pacman|installed]], in addition to [[#Packages|the packages mentioned above]]. See [https://bbs.archlinux.org/viewtopic.php?id=65615 this forum post] for more information.<br />
<br />
==== Printing fails with unauthorised error ====<br />
<br />
If the user has been added to the lp group, and allowed to print (set in {{ic|cupsd.conf}}), then the problem lies in {{ic|/etc/cups/printers.conf}}. This line could be the culprit:<br />
AuthInfoRequired negotiate<br />
<br />
Comment it out and restart CUPS.<br />
<br />
==== Print button greyed-out in GNOME print dialogs ====<br />
<br />
:''<small>Source: [https://bbs.archlinux.org/viewtopic.php?id=70418 I can't print from gnome applications. - Arch Forums]</small>''<br />
<br />
Be sure the package: '''libgnomeprint''' is installed<br />
<br />
Edit {{ic|/etc/cups/cupsd.conf}} and add:<br />
# HostNameLookups Double<br />
<br />
Restart cups.service.<br />
<br />
==== Unknown supported format: application/postscript ====<br />
<br />
Comment the lines:<br />
application/octet-stream application/vnd.cups-raw 0 -<br />
from {{ic|/etc/cups/mime.convs}}, and:<br />
application/octet-stream<br />
in {{ic|/etc/cups/mime.types}}.<br />
<br />
==== Finding URIs for Windows print servers ====<br />
<br />
Sometimes Windows is a little less than forthcoming about exact device URIs (device locations). If having trouble specifying the correct device location in CUPS, run the following command to list all shares available to a certain windows username:<br />
$ smbtree -U ''windowsusername''<br />
This will list every share available to a certain Windows username on the local area network subnet, as long as Samba is set up and running properly. It should return something like this:<br />
{{bc| WORKGROUP<br />
\\REGULATOR-PC <br />
\\REGULATOR-PC\Z <br />
\\REGULATOR-PC\Public <br />
\\REGULATOR-PC\print$ Printer Drivers<br />
\\REGULATOR-PC\G <br />
\\REGULATOR-PC\EPSON Stylus CX8400 Series EPSON Stylus CX8400 Series}}<br />
What is needed here is first part of the last line, the resource matching the printer description. So to print to the EPSON Stylus printer, one would enter:<br />
smb://username.password@REGULATOR-PC/EPSON Stylus CX8400 Series<br />
as the URI into CUPS. Notice that whitespaces are allowed in URIs, whereas backslashes get replaced with forward slashes.<br />
If it won't work try '%20' instead of spaces.<br />
<br />
==== Print-Job client-error-document-format-not-supported ====<br />
<br />
Try installing the foomatic packages and use a foomatic driver.<br />
<br />
==== /usr/lib/cups/backend/hp failed ====<br />
<br />
Change:<br />
SystemGroup sys root<br />
to:<br />
SystemGroup lp root<br />
in {{ic|/etc/cups/cupsd.conf}}<br />
<br />
<br />
Following steps 1-3 in the Alternative CUPS interfaces below may be a better solution, since newer versions of cups will not allow the same group for both normal and admin operation.<br />
<br />
==== Unable to get list of printer drivers ====<br />
<br />
* Check your ServerName in /etc/cups/client.conf is written without http://<br />
ServerName localhost:631<br />
* Try to remove Foomatic drivers or refer to [[#HP_Printer]] for a workaround.<br />
<br />
==== lp: Error - Scheduler Not Responding ====<br />
<br />
If you get this error when printing a document using:<br />
<br />
$ lp document-to-print<br />
<br />
Try setting the CUPS_SERVER environment variable:<br />
<br />
$ export CUPS_SERVER=localhost<br />
<br />
If this solves your problem, make the solution permanent by adding the export line above to ~/.bash_profile.<br />
<br />
==== CUPS prints only an empty and an error-message page on HP LaserJet ====<br />
<br />
There is a bug that causes CUPS to fail when printing images on HP LaserJet (in my case 3380). The bug has been reported and fixed by [https://bugs.launchpad.net/ubuntu/+source/cups-filters/+bug/998087 Ubuntu].<br />
The first page is empty, the second page contains the following error message:<br />
ERROR:<br />
invalidaccess<br />
OFFENDING COMMAND:<br />
filter<br />
STACK:<br />
/SubFileDecode<br />
endstream<br />
...<br />
<br />
In order to fix the issue, use the following command (as superuser):<br />
lpadmin -p ''printer'' -o pdftops-renderer-default=pdftops<br />
<br />
==== "Using invalid Host" error message ====<br />
<br />
Try to add "ServerAlias *" into cupsd.conf<br />
<br />
==== Printer doesn't print with an "Filter failed" message on CUPS web interface (HP printer) ====<br />
<br />
Change the permissions of the printer USB port:<br />
<br />
Get the bus and device number from lsusb, then set the permission using:<br />
<br />
chmod 0666 /dev/bus/usb/''bus number''/''device number''<br />
<br />
To make the persistent permission change that will be triggered automatically each time the computer is rebooted, add the following line.<br />
<br />
{{hc|/etc/udev/rules.d/10-local.rules|2=<br />
SUBSYSTEM=="usb", ATTRS{idVendor}=="Printer_idVendor", ATTRS{idProduct}=="Printer_idProduct", GROUP="lp", MODE:="666"<br />
}}<br />
<br />
Obtain the right information by using {{ic|lsusb}} command, and don't forget to substitute {{ic|Printer_idVendor}} & {{ic|Printer_idProduct}} with the relevant ones.<br />
<br />
Each system may vary, so consult [[udev#List_attributes_of_a_device]] wiki page.<br />
<br />
==== Printer doesn't print with an "Filter failed" message on CUPS web interface (HP printer connected over network) ====<br />
<br />
Start, enable and restart the avahi-daemon.<br />
<br />
==== HPLIP 3.13: Plugin is installed, but HP Device Manager complains it is not ====<br />
<br />
The issue might have to do with the file permission change that had been made to {{ic|/var/lib/hp/hplip.state}}. To correct the issue, a simple {{ic|chmod 644 /var/lib/hp/hplip.state}} and {{ic|chmod 755 /var/lib/hp}} should be sufficient. For further information, please read this [https://bugs.launchpad.net/hplip/+bug/1131596 link].<br />
<br />
==== Printer is not recognized by CUPS ====<br />
<br />
If your printer is not listed in the "Add Printers" page of the CUPS web interface, nor by lpinfo -v, try the following (suggested in [https://bbs.archlinux.org/viewtopic.php?pid=1037279#p1037279 this thread]):<br />
<br />
* Remove {{ic|usblp}} from blacklist<br />
* Load {{ic|usblp}} module<br />
modprobe usblp<br />
* Stop cups<br />
* Add the following udev rule in a new rule file:<br />
{{hc|/etc/udev/rules.d/10-cups_device_link.rules|2=<br />
KERNEL=="lp[0-9]", SYMLINK+="%k", GROUP="lp"<br />
}}<br />
* Reload udev rules:<br />
# udevadm control --reload-rules<br />
* Unplug and re-plug the printer.<br />
* Wait a few seconds and then start cups again.<br />
<br />
==== Can't load /etc/samba/smb.conf ====<br />
<br />
If you're printing to a remote printer over SMB and get this error message: "Can't load /etc/samba/smb.conf - run testparm to debug it", then create an empty smb.conf:<br />
<br />
# mkdir /etc/samba<br />
# touch /etc/samba/smb.conf<br />
<br />
and restart cupsd.<br />
<br />
==== CUPS' systemd service does not start even though it's enabled ====<br />
<br />
The systemd .service file provided by CUPS uses socket activation, meaning the service is only started when an<br />
application connects to CUPS' socket. However, the systemd .socket file provided by cups only works for the local <br />
{{ic|/var/run/cups/cups.sock}} socket. <br />
<br />
In order to have cupsd start when initiating a print job over the network, create the following file:<br />
<br />
{{hc|/etc/systemd/system/cups.socket|<br />
.include /usr/lib/systemd/system/cups.socket<br />
<br />
[Socket]<br />
ListenStream&#61;0.0.0.0:631<br />
ListenDatagram&#61;0.0.0.0:631<br />
BindIPv6Only&#61;ipv6-only<br />
}}<br />
<br />
Then reload systemd:<br />
<br />
# systemctl --system daemon-reload<br />
<br />
Confirm that everything is working correctly:<br />
<br />
{{bc|<br />
# systemctl is-enabled cups.service &#124;&#124; systemctl enable cups.service<br />
# systemctl status cups.socket<br />
cups.socket - CUPS Printing Service Sockets<br />
Loaded: loaded (/etc/systemd/system/cups.socket; enabled)<br />
Active: inactive (dead)<br />
Listen: /var/run/cups/cups.sock (Stream)<br />
0.0.0.0:631 (Stream)<br />
0.0.0.0:631 (Datagram)<br />
}}<br />
<br />
CUPS should now start automatically when printing locally or over the network.<br />
<br />
== See also ==<br />
<br />
* [http://localhost:631/documentation.html Official CUPS documentation], ''locally installed''<br />
* [http://www.cups.org/ Official CUPS website]<br />
* [http://www.linuxprinting.org/ Linux Printing], ''[http://www.linuxfoundation.org The Linux Foundation]''<br />
* [http://www.gentoo.org/doc/en/printing-howto.xml Gentoo's printing guide], ''[http://www.gentoo.org/doc/en Gentoo Documentation resources]''<br />
* [https://bbs.archlinux.org/ Arch Linux user forums]<br />
* [http://wiki.gotux.net/tutorials/software/hp-printer Install HP printers easy way]</div>SilverWyrdahttps://wiki.archlinux.org/index.php?title=CUPS&diff=274397CUPS2013-09-05T04:08:20Z<p>SilverWyrda: /* HP Printer */</p>
<hr />
<div>[[Category:Printers]]<br />
[[cs:CUPS]]<br />
[[es:CUPS]]<br />
[[fr:CUPS]]<br />
[[it:CUPS]]<br />
[[pl:CUPS]]<br />
[[ru:CUPS]]<br />
[[th:CUPS]]<br />
[[tr:CUPS]]<br />
[[zh-CN:CUPS]]<br />
[[zh-TW:CUPS]]<br />
{{Article summary start|Summary}}<br />
{{Article summary text|Installing and configuring CUPS}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|CUPS printer sharing}}<br />
{{Article summary wiki|CUPS printer-specific problems}}<br />
{{Article summary wiki|Samba}}<br />
{{Article summary end}}<br />
<br />
From [http://www.cups.org/index.php CUPS' site]:<br />
:"''[[Wikipedia:CUPS|CUPS]] is the standards-based, open source printing system developed by Apple Inc. for OS® X and other UNIX®-like operating systems''".<br />
<br />
Although there are other printing packages such as LPRNG, the Common Unix Printing System is the most popular choice because of its relative ease of use.<br />
<br />
== CUPS Linux printing workflow ==<br />
As of {{Pkg|cups}} version 1.5.3-3, Arch Linux makes use of the new full pdf-based printing workflow. For<br />
further reading check [http://www.linuxfoundation.org/collaborate/workgroups/openprinting/pdfasstandardprintjobformat PDF standard printing job format] and an old [https://wiki.linuxfoundation.org/en/OpenPrinting/Database/CUPS-Filter-Chart CUPS filtering chart] for history and fun.<br />
A good starting point for general Linux printing questions is [http://www.linuxfoundation.org/collaborate/workgroups/openprinting here].<br />
<br />
There are two ways to setup a printer.<br />
* If there's a CUPS server running in your network and sharing a printer you only need to install the client package.<br />
* If the printer is connected directly to your system or you have access to an IPP network printer then setup a local CUPS server.<br />
<br />
== Installing the client package ==<br />
<br />
The package {{Pkg|libcups}} is the only required package. [[pacman|Install]] it from the [[official repositories]].<br />
<br />
Then add your CUPS server's IP address or hostname into {{ic|/etc/cups/client.conf}}. That is all you need. Every application should quickly find the printer(s) shared by that CUPS server.<br />
<br />
=== Optional advanced network setup ===<br />
<br />
It is also possible to run a entire cupsd+cups-browsed instance on your client with Avahi browsing enabled to discover unknown shared printers in your network. This can be useful in large setups where the server is unknown.<br />
{{Note|This behavior did not change with cups 1.6.x - the difference is that until 1.5.x cupsd was able to do printer browsing alone and now it can only browse its own shared printers.<br />
To get the local cupsd recognise other shared printers offered by a remote cupsd server you need a running local cups-browsed (supported since cups-filters 1.0.26) instance using Avahi to discover unknown printers. <br />
There is [https://bbs.archlinux.org/viewtopic.php?id&#61;161440 good news] in April 2013 (still has to be incorporated above).}}<br />
<br />
=== Installing CUPS a 32 bit chroot environment ===<br />
<br />
If you have a 64 bit base installation with a [[Install_bundled_32-bit_system_in_Arch64|32 bit chroot environment]], explicit installation of CUPS is not necessary in the 32 bit environment. To access installed CUPS printers from the chroot environment, one needs to bind the {{ic|/var/run/cups}} directory to the same relative location in the chroot environment. Simply create the directory in the chroot (it probably doesn't exist), mount (with {{ic|-o bind}} passed to the command}}, and printers should be available from 32 bit chroot applications immediately.<br />
<br />
{{bc|# mkdir /path/to/chroot/var/run/cups<br />
# Example: # mkdir /opt/arch32/var/run/cups<br />
<br />
# mount -o bind /var/run/cups /path/to/chroot/var/run/cups}}<br />
<br />
== Installing the server packages ==<br />
<br />
The following packages and some printer drivers are needed. [[pacman|Install]] them from the [[official repositories]].<br />
<br />
* {{Pkg|cups}} - the actual CUPS daemon<br />
* {{Pkg|cups-filters}} - essential filters<br />
* {{Pkg|ghostscript}} - (optional) PostScript interpreter<br />
* {{Pkg|gsfonts}} - GhostScript standard Type1 fonts<br />
<br />
If you want to enable printer browsing through your network, also install {{Pkg|avahi}}. Make sure '''avahi-daemon''' is started before '''cupsd'''.<br />
<br />
If the system is connected to a networked printer using the [[Samba]] protocol or if the system is to be a print server for Windows clients, also install {{Pkg|samba}}.<br />
<br />
=== Printer driver ===<br />
<br />
Here are some of the driver packages. Choosing the right driver depends on the printer:<br />
<br />
* '''{{Pkg|gutenprint}}''' - A collection of high quality drivers for Canon, Epson, Lexmark, Sony, Olympus, and PCL printers for use with GhostScript, CUPS, Foomatic, and the [[GIMP]]<br />
* '''{{Pkg|foomatic-db}}, {{Pkg|foomatic-db-engine}}, {{Pkg|foomatic-db-nonfree}}, and {{Pkg|foomatic-filters}}''' - Foomatic is a database-driven system for integrating free software printer drivers with common spoolers under Unix. Installing foomatic-filters should solve problems if the cups error_log is reporting "stopped with status 22!".<br />
* '''{{Pkg|hplip}}''' - HP drivers for DeskJet, OfficeJet, Photosmart, Business Inkjet and some LaserJet printer models, as well as a number of Brother printers.<br />
* '''{{Pkg|splix}}''' - Samsung drivers for SPL (Samsung Printer Language) printers.<br />
<br />
* '''{{AUR|foo2zjs}}''' - Drivers for ZjStream protocol printers such as the HP Laserjet 1018. More info [http://foo2zjs.rkkda.com here]. Package is available in the [[AUR]].<br />
* '''{{AUR|hpoj}}''' - If you are using an HP Officejet, you should also install this package and follow the instructions to avoid problems as in [https://answers.launchpad.net/hplip/+question/133425 this thread]. Package is available in the [[AUR]].<br />
* '''{{AUR|samsung-unified-driver}}''' - Unified Linux Driver for Samsung printers and scanners. Required for new printers such as the ML-2160. Package is available in the [[AUR]].<br />
* '''{{AUR|ufr2}}''' or '''{{AUR|cndrvcups-lb}}''' - Canon UFR2 driver with support for LBP, iR and MF series printers. Package is available in the [[AUR]].<br />
<br />
* '''{{Pkg|cups-pdf}}''' - A package that allows one to setup a virtual PDF Printer that generates a PDF out of jobs sent to it<br />
<br />
If you are not sure of what driver package to install or if the current driver is not working, it may be easiest to just install all of the drivers. Some of the package names are misleading because printers of other makes may rely on them. For example, the Brother HL-2140 needs the hplip driver installed.<br />
<br />
==== Download printer PPD ====<br />
<br />
Depending on the printer, this step is optional and may not be needed, as the standard CUPS installation already comes with quite a few PPD (Postscript Printer Description) files. Moreover, the ''foomatic-filters'', ''gimp-print'' and ''hplip'' packages already include quite a few PPD files which will automatically be detected by CUPS.<br />
<br />
Here is an explanation of what a PPD file is from the Linux Printing website:<br />
:"''For every PostScript printer the manufacturers provide a PPD file which contains all printer-specific information about the particular printer model: Basic printer capabilities as whether the printer is a color printer, fonts, PostScript level, etc., and especially the user-adjustable options, as paper size, resolution, etc.''"<br />
<br />
If the PPD for the printer is ''not'' already in CUPS, then:<br />
*check [[AUR]] to see if there are packages for the printer/manufacturer<br />
*visit the [http://www.openprinting.org/printers OpenPrinting database] and select the manufacturer and model of the printer<br />
*visit the manufacturer's site and search for GNU/Linux drivers<br />
<br />
{{Note|PPD files go in {{ic|/usr/share/cups/model/}}}}<br />
<br />
==== Another source for printer drivers ====<br />
<br />
[http://www.turboprint.de/english.html Turboprint] is a proprietary driver for many printers not yet supported by GNU/Linux (Canon i*, for example). Unlike CUPS, however, high quality prints are either marked with a watermark or are a pay-only service.<br />
<br />
== Hardware support and configuration ==<br />
<br />
=== USB printers ===<br />
<br />
{{Tip|Most USB printers should work out of the box, you can skip this section and come back if you can not get your printer to work.}}<br />
<br />
USB printers can get accessed with two methods: The usblp kernel module and libusb. The former is the classic way. It is simple: data is sent to the printer by writing it to a device file as a simple serial data stream. Reading the same device file allows bi-di access, at least for things like reading out ink levels, status, or printer capability information (PJL). It works very well for simple printers, but for multi-function devices (printer/scanner) it is not suitable and manufacturers like HP supply their own backends. Source: [http://lists.linuxfoundation.org/pipermail/printing-architecture/2012/002412.html here].<br />
<br />
==== Blacklisting usblp ====<br />
<br />
{{Warning|As of {{Pkg|cups}} version 1.6.0, you no longer need to [[Kernel modules#Blacklisting|blacklist]] the {{ic|usblp}} kernel module.<br />
<br />
If you find out this is the only way to fix a remaining issue please report this upstream to the CUPS bug tracker and maybe also get in contact with Till Kamppeter (Debian CUPS maintainer). See [http://cups.org/str.php?L4128 upstream bug] for more.}}<br />
<br />
If you have problems getting your USB printer to work, you can try blacklisting the {{ic|usblp}} [[kernel module]]:<br />
<br />
{{hc|/etc/modprobe.d/blacklistusblp.conf|<br />
blacklist usblp<br />
}}<br />
<br />
Custom kernel users may need to manually load the {{ic|usbcore}} [[kernel module]] before proceeding.<br />
<br />
Once the modules are installed, plug in the printer and check if the kernel detected it by running the following:<br />
# tail /var/log/messages.log<br />
or<br />
# dmesg<br />
<br />
If you're using {{ic|usblp}}, the output should indicate that the printer has been detected like so:<br />
Feb 19 20:17:11 kernel: printer.c: usblp0: USB Bidirectional<br />
printer dev 2 if 0 alt 0 proto 2 vid 0x04E8 pid 0x300E<br />
Feb 19 20:17:11 kernel: usb.c: usblp driver claimed interface cfef3920<br />
Feb 19 20:17:11 kernel: printer.c: v0.13: USB Printer Device Class driver<br />
<br />
If you blacklisted {{ic|usblp}}, you will see something like:<br />
usb 3-2: new full speed USB device using uhci_hcd and address 3<br />
usb 3-2: configuration #1 chosen from 1 choice<br />
<br />
=== Parallel port printers ===<br />
<br />
To use a parallel port printer, you will need to load the {{ic|lp}}, {{ic|parport}} and {{ic|parport_pc}} [[kernel modules]].<br />
<br />
Check the setup by running:<br />
# tail /var/log/messages.log<br />
It should display something like this:<br />
lp0: using parport0 (polling).<br />
<br />
If you are using a USB to parallel port adapter, CUPS will not be able to detect the printer. As a workaround, add the printer using a different connection type and then change DeviceID in {{ic|/etc/cups/printers.conf}}:<br />
DeviceID = parallel:/dev/usb/lp0<br />
<br />
=== HP Printer ===<br />
<br />
HP printers can also be installed via HP's Linux setup tool. Install it by installing {{Pkg|hplip}} from the [[official repositories]].<br />
<br />
To run with qt frontend:<br />
# hp-setup -u<br />
<br />
To run with command line:<br />
# hp-setup -i<br />
<br />
PPD files are in {{ic|/usr/share/ppd/HP/}}.<br />
<br />
For printers that require the proprietary HP plugin (like the Laserjet Pro P1102w), install the {{AUR|hplip-plugin}} package from [[AUR]].<br />
<br />
{{Note|<br />
{{Pkg|hplip}} depends on {{Pkg|foomatic-db-engine}} which prevents the drivers list from appearing when a printer is added to CUPS via the web user interface (following error : "Unable to get list of printer drivers"). The workaround consists in installing {{Pkg|hplip}} first, retrieve the corresponding PPD file from {{ic|/usr/share/ppd/HP/}}, then, remove entierly {{Pkg|hplip}} and the unecessary dependencies. Finally, install the printer manually with the PPD file (possible on the webui) then re-install {{Pkg|hplip}}. You should have after a reboot a fully working printer.}}<br />
<br />
== Configuring ==<br />
<br />
Now that CUPS is installed, there are a variety of options on how to set up printing solutions. As always, the tried and true command line method is at your disposal. CUPS also embeds a full-featured web interface. Likewise, various desktop environments such as GNOME and KDE have useful programs that can help manage printers. Depending on your needs, you may choose one method or the other.<br />
<br />
If you are planning on connecting to a network printer, rather than one that is directly connected to the computer, you might want to read the [[CUPS printer sharing]] page first. Printer sharing between GNU/Linux systems is quite easy and involves very little configuration, whereas sharing between a Windows and GNU/Linux host requires a little bit more effort.<br />
<br />
=== CUPS daemon ===<br />
<br />
With the kernel modules installed, you can now start the '''cups''' and optionally, the '''cups-browsed''' [[daemons]], and enable them as required.<br />
<br />
=== Web interface and tool-kit ===<br />
<br />
Once the daemon is running, open a browser and go to: http://localhost:631 (''The '''localhost''' string may need to be replaced with the hostname found in'' {{ic|/etc/hostname}}).<br />
<br />
From here, follow the various wizards to add the printer. A usual procedure is to start by clicking on ''Adding Printers and Classes'' and then ''Add Printer''. When prompted for a username and password, log in as root. The name assigned to the printer does not matter, the same applies for 'location' and 'description'. Next, a list of devices to select from will be presented. The actual name of the printer shows up next to the label (e.g., next to ''USB Printer #1'' for USB printers). Finally, choose the appropriate drivers and the configuration is complete.<br />
<br />
Now test the configuration by pressing the ''Maintenance'' drop-down menu then ''Print Test Page''. If it does not print and there is certainty regarding the correctness of applied settings, then the problem is most likely due to missing a proper printer driver.<br />
<br />
{{Tip|See: [[#Alternative CUPS interfaces]] for other other front-ends.}}<br />
{{Note|<br />
* When setting up a USB printer, you should see your printer listed on ''Add Printer'' page. If you can only see a "SCSI printer" option, it probably means that CUPS has failed to recognize your printer.<br />
* To enable wireless scanning on certain HP multi-function devices using the {{pkg|hplip}} package, you may need to add the printer as a Network Printer using the HTTP protocol. To determine the proper URI to use, run the {{ic|hp-makeuri}} command.}}<br />
<br />
==== CUPS administration ====<br />
<br />
A username and password will be required when administering the printer in the web interface, such as: adding or removing printers, stopping print tasks, etc. The default username is the one assigned in the ''sys'' group, or root. Other admin groups (e.g. lpadmin or printadmin) may be added to the {{ic|SystemGroup}} line in {{ic|/etc/cups/cups-files.conf}} (you might have to add this line). See [http://www.cups.org/articles.php?L237+T+Qprintadmin these instructions at cups.org]. You might also want to read [https://bbs.archlinux.org/viewtopic.php?id=35567 this post]. Create the group[s] ({{ic|man groupadd}}) and add the group[s] to users ({{ic|man usermod}}). cupsd must be restarted and the user must re-login for these changes to take affect.<br />
<br />
If the root account has been locked (i.e. when using sudo), it is not possible to log in the CUPS administration interface with the default username (root) and password. Follow the instructions above to add other users as cups administrators.<br />
<br />
==== Remote access to web interface ====<br />
<br />
By default, the CUPS web interface can only be accessed by the ''localhost''; i.e. the computer that it is installed on. To remotely access the interface, make the following changes to the {{ic|/etc/cups/cupsd.conf}} file. Replace the line:<br />
Listen localhost:631<br />
with<br />
Port 631<br />
so that CUPS listens to incoming requests.<br />
<br />
Three levels of access can be granted:<br />
<Location /> #access to the server<br />
<Location /admin> #access to the admin pages<br />
<Location /admin/conf> #access to configuration files<br />
<br />
To give remote hosts access to one of these levels, add an {{ic|Allow}} statement to that level's section. An {{ic|Allow}} statement can take one or more of the forms listed below:<br />
Allow from all<br />
Allow from host.domain.com<br />
Allow from *.domain.com<br />
Allow from ip-address<br />
Allow from ip-address/netmask<br />
<br />
Deny statements can also be used. For example, if wanting to give all hosts on the 192.168.1.0/255.255.255.0 subnet full access, file {{ic|/etc/cups/cupsd.conf}} would include this:<br />
# Restrict access to the server...<br />
# By default only localhost connections are possible<br />
<Location /><br />
Order allow,deny<br />
Allow from localhost<br />
'''Allow from 192.168.1.0/255.255.255.0'''<br />
</Location><br />
<br />
# Restrict access to the admin pages...<br />
<Location /admin><br />
# Encryption disabled by default<br />
#Encryption Required<br />
Order allow,deny<br />
Allow from localhost<br />
'''Allow from 192.168.1.0/255.255.255.0'''<br />
</Location><br />
<br />
# Restrict access to configuration files...<br />
<Location /admin/conf><br />
AuthType Basic<br />
Require user @SYSTEM<br />
Order allow,deny<br />
Allow From localhost<br />
'''Allow From 192.168.1.0/255.255.255.0'''<br />
</Location><br />
<br />
You might also need to add:<br />
<br />
DefaultEncryption Never<br />
<br />
This should avoid the error: 426 - Upgrade Required when using the CUPS web interface from a remote machine.<br />
<br />
=== Command-line configuration ===<br />
<br />
CUPS can be fully controlled from command-line with nice tools, ''i.e.'' the lp* and the cups* command families.<br />
<br />
On Arch Linux, most commands support auto-completion with common shells.<br />
Also note that command-line switches cannot be grouped.<br />
<br />
;List the devices<br />
# lpinfo -v<br />
<br />
;List the drivers<br />
# lpinfo -m<br />
<br />
;Add a new printer<br />
# lpadmin -p ''printer'' -E -v ''device'' -P ''ppd''<br />
<br />
The ''printer'' is up to you. The device can be retrieved from the 'lpinfo -i' command.<br />
Example:<br />
# lpadmin -p HP_DESKJET_940C -E -v "usb://HP/DESKJET%20940C?serial=CN16E6C364BH" -P /usr/share/ppd/HP/hp-deskjet_940c.ppd.gz<br />
<br />
In the following, the ''printer'' references the name you have used here to set up the printer.<br />
<br />
;Set the default printer<br />
$ lpoptions -d ''printer''<br />
<br />
;Check the status<br />
$ lpstat -s<br />
$ lpstat -p ''printer''<br />
<br />
;Deactivate a printer<br />
# cupsdisable ''printer''<br />
<br />
;Activate a printer<br />
# cupsenable ''printer''<br />
<br />
;Remove a printer<br />
First set it to reject all incoming entries:<br />
# cupsreject ''printer''<br />
Then disable it.<br />
# cupsdisable ''printer''<br />
Finally remove it.<br />
# lpadmin -x ''printer''<br />
<br />
;Print a file<br />
$ lpr ''file''<br />
$ lpr -# 17 ''file'' # print the file 17 times<br />
$ echo "Hello, world!" | lpr -p # print the result of a command. The -p switch adds a header.<br />
<br />
;Check the printing queue<br />
$ lpq<br />
$ lpq -a # on all printers<br />
<br />
;Clear the printing queue<br />
# lprm # remove last entry only<br />
# lprm - # remove all entries<br />
<br />
=== Alternative CUPS interfaces ===<br />
<br />
==== GNOME ====<br />
<br />
You can configure and manage printers by [[pacman|installing]] {{Pkg|system-config-printer}}. This program does pull in some gnome dependencies.<br />
<br />
If your user does not have sufficient priviliges to administer the cups scheduler, system-config-printer will request the root password when it starts. You can avoid this by performing the following instructions.<br />
<br />
1. Create a group for administering the cups scheduler:<br />
<br />
# groupadd lpadmin<br />
<br />
2. Add yourself to the newly created group:<br />
<br />
# usermod -aG lpadmin ''username''<br />
<br />
3. Tell cups to respect the newly created group:<br />
<br />
{{hc|/etc/cups/cups-files.conf|<br />
...<br />
SystemGroup sys root '''lpadmin'''<br />
...}}<br />
<br />
4. Restart cups:<br />
<br />
# systemctl restart cupsd<br />
<br />
5. Log out and log in again or restart your computer.<br />
<br />
==== KDE ====<br />
<br />
[[KDE]] users can modify their printers from the Control Center. Both should refer to those desktop environments' documentation for more information on how to use the interfaces.<br />
<br />
==== Other ====<br />
<br />
There is also {{AUR|gtklp}} in the [[AUR]].<br />
<br />
== PDF virtual printer ==<br />
<br />
{{Pkg|cups-pdf}} is a nice package that allows one to setup a virtual printer that will generate a PDF from anything sent to it. This package is not necessary, but it can be quite useful.<br />
<br />
After installing the package, set it up as if it were for any other printer by using the web interface. Access the cups print manager: http://localhost:631 and select:<br />
Administration -> Add Printer<br />
Select CUPS-PDF (Virtual PDF), choose for the make and driver:<br />
Make: Generic<br />
Driver: Generic CUPS-PDF Printer<br />
<br />
Find generated PDF documents in a sub-directory located at {{ic|/var/spool/cups-pdf}}. Normally, the subdirectory is named after the user who performed the job. A little tweak helps you to find your printed PDF documents more easily. Edit {{ic|/etc/cups/cups-pdf.conf}} by changing the line<br />
#Out /var/spool/cups-pdf/${USER}<br />
<br />
to<br />
<br />
Out ${HOME}<br />
<br />
=== Print to PostScript ===<br />
<br />
The CUPS-PDF (Virtual PDF Printer) actually creates a PostScript file and then creates the PDF using the ps2pdf utility. To print to PostScript, just print as usual, in the print dialog choose "CUPS-PDF" as the printer, then select the checkbox for "print to file", hit print, enter the filename.ps and click save. This is handy for faxes, etc...<br />
<br />
== Troubleshooting ==<br />
<br />
The best way to get printing working is to set 'LogLevel' in {{ic|/etc/cups/cupsd.conf}} to:<br />
LogLevel debug<br />
<br />
And then viewing the output from {{ic|/var/log/cups/error_log}} like this:<br />
# tail -n 100 -f /var/log/cups/error_log<br />
<br />
The characters at the left of the output stand for:<br />
*D=Debug<br />
*E=Error<br />
*I=Information<br />
*And so on<br />
<br />
These files may also prove useful:<br />
*{{ic|/var/log/cups/page_log}} - Echoes a new entry each time a print is successful<br />
*{{ic|/var/log/cups/access_log}} - Lists all cupsd http1.1 server activity<br />
<br />
Of course, it is important to know how CUPS works if wanting to solve related issues:<br />
# An application sends a .ps file (PostScript, a script language that details how the page will look) to CUPS when 'print' has been selected (this is the case with most programs).<br />
# CUPS then looks at the printer's PPD file (printer description file) and figures out what filters it needs to use to convert the .ps file to a language that the printer understands (like PJL, PCL), usually GhostScript.<br />
# GhostScript takes the input and figures out which filters it should use, then applies them and converts the .ps file to a format understood by the printer.<br />
# Then it is sent to the back-end. For example, if the printer is connected to a USB port, it uses the USB back-end.<br />
<br />
Print a document and watch {{ic|error_log}} to get a more detailed and correct image of the printing process.<br />
<br />
=== Problems resulting from upgrades ===<br />
<br />
''Issues that appeared after CUPS and related program packages underwent a version increment''<br />
<br />
==== CUPS stops working ====<br />
<br />
The chances are that a new configuration file is needed for the new version to work properly. Messages such as "404 - page not found" may result from trying to manage CUPS via localhost:631, for example.<br />
<br />
To use the new configuration, copy {{ic|/etc/cups/cupsd.conf.default}} to {{ic|/etc/cups/cupsd.conf}} (backup the old configuration if needed) and restart CUPS to employ the new settings.<br />
<br />
==== All jobs are "stopped" ====<br />
<br />
If all jobs sent to the printer become "stopped", delete the printer and add it again.<br />
Using the [http://localhost:631 CUPS web interface], go to Printers > Delete Printer.<br />
<br />
To check the printer's settings go to ''Printers'', then ''Modify Printer''. Copy down the information displayed, click 'Modify Printer' to proceed to the next page(s), and so on.<br />
<br />
==== All jobs are "The printer is not responding" ====<br />
<br />
On networked printers, you should check that the name that CUPS uses as its connection URI resolves to the printer's IP via DNS, e.g.<br />
If your printer's connection looks like this:<br />
lpd://BRN_020554/BINARY_P1<br />
<br />
then the hostname 'BRN_020554' needs to resolve to the printer's IP from the server running CUPS<br />
<br />
==== The PPD version is not compatible with gutenprint ====<br />
<br />
Run:<br />
# /usr/bin/cups-genppdupdate<br />
<br />
And restart CUPS (as pointed out in gutenprint's post-install message)<br />
<br />
=== Other ===<br />
<br />
===== CUPS permission errors =====<br />
<br />
* Some users fixed 'NT_STATUS_ACCESS_DENIED' (Windows clients) errors by using a slightly different syntax:<br />
smb://workgroup/username:password@hostname/printer_name<br />
<br />
* Sometimes, the block device has wrong permissions:<br />
# ls /dev/usb/<br />
lp0<br />
# chgrp lp /dev/usb/lp0<br />
<br />
==== HPLIP printer sends "/usr/lib/cups/backend/hp failed" error ====<br />
<br />
Make sure dbus is installed and running. If the error persists, try starting avahi-daemon.<br />
<br />
Try adding the printer as a Network Printer using the http:// protocol. Generate the printer URI with {{ic|hp-makeuri}}.<br />
<br />
{{Note|There might need to set permissions issues right. Follow indications here: [[CUPS#Device node permissions]].}}<br />
<br />
==== HPLIP printer claims job is complete but printer does nothing ====<br />
<br />
This happens on HP printers when you select the (old) hpijs driver (e.g. the Deskjet D1600 series). Instead, use the hpcups driver when adding the printer.<br />
<br />
Some HP printers (e.g HP LaserJet) require their firmware to be downloaded from the computer every time the printer is switched on. If there is an issue with udev (or equivalent) and the firmware download rule is never fired, you may experience this issue.<br />
As a workaround, you can manually download the firmware to the printer. Ensure the printer is plugged in and switched on, then enter<br />
hp-firmware -n<br />
<br />
==== hp-setup asks to specify the PPD file for the discovered printer ====<br />
<br />
Install CUPS before running hp-setup.<br />
<br />
==== I have installed Qt, but hp-setup reports "Qt/PyQt 4 initialization failed" ====<br />
<br />
"hp-check -t" won't give you useful information to find the required package. You have to install all the "Dependent Packages" prefixed with "python2" in https://www.archlinux.org/packages/extra/x86_64/hplip/<br />
<br />
==== hp-setup finds the printer automatically but reports "Unable to communicate with device" when printing test page immediately afterwards ====<br />
<br />
This at least happens to hplip 3.13.5-2 for HP Officejet 6500A through local network connection. To solve the problem, specify the IP address of the HP printer for hp-setup to locate the printer.<br />
<br />
==== hp-toolbox sends an error, "Unable to communicate with device" ====<br />
<br />
If running hp-toolbox as a regular user results in:<br />
# hp-toolbox<br />
# error: Unable to communicate with device (code=12): hp:/usb/''printer id''<br />
or, "{{ic|Unable to communicate with device"}}", then it may be needed to [[Groups#Group management|add the user to the lp and sys groups]].<br />
<br />
This can also be caused by printers such as the P1102 that provide a virtual cd-rom drive for MS-Windows drivers. The lp dev appears and then disappears. In that case try the '''usb-modeswitch''' and '''usb-modeswitch-data''' packages, that lets one switch off the "Smart Drive" (udev rules included in said packages).<br />
<br />
This can also occur with network attached printers if the [[Avahi|avahi-daemon]] is not running. Another possiblility is the specification of the printer's IP address in hp-setup fails to locate the printer because the IP address of the the printer changed due to DHCP.<br />
<br />
==== CUPS returns '"foomatic-rip" not available/stopped with status 3' with a HP printer ====<br />
<br />
If receiving any of the following error messages in {{ic|/var/log/cups/error_log}} while using a HP printer, with jobs appearing to be processed while they all end up not being completed with their status set to 'stopped':<br />
Filter "foomatic-rip" for printer ''printer_name'' not available: No such file or director<br />
or:<br />
PID 5771 (/usr/lib/cups/filter/foomatic-rip) stopped with status 3!<br />
make sure {{pkg|hplip}} has been [[pacman|installed]], in addition to [[#Packages|the packages mentioned above]]. See [https://bbs.archlinux.org/viewtopic.php?id=65615 this forum post] for more information.<br />
<br />
==== Printing fails with unauthorised error ====<br />
<br />
If the user has been added to the lp group, and allowed to print (set in {{ic|cupsd.conf}}), then the problem lies in {{ic|/etc/cups/printers.conf}}. This line could be the culprit:<br />
AuthInfoRequired negotiate<br />
<br />
Comment it out and restart CUPS.<br />
<br />
==== Print button greyed-out in GNOME print dialogs ====<br />
<br />
:''<small>Source: [https://bbs.archlinux.org/viewtopic.php?id=70418 I can't print from gnome applications. - Arch Forums]</small>''<br />
<br />
Be sure the package: '''libgnomeprint''' is installed<br />
<br />
Edit {{ic|/etc/cups/cupsd.conf}} and add:<br />
# HostNameLookups Double<br />
<br />
Restart cups.service.<br />
<br />
==== Unknown supported format: application/postscript ====<br />
<br />
Comment the lines:<br />
application/octet-stream application/vnd.cups-raw 0 -<br />
from {{ic|/etc/cups/mime.convs}}, and:<br />
application/octet-stream<br />
in {{ic|/etc/cups/mime.types}}.<br />
<br />
==== Finding URIs for Windows print servers ====<br />
<br />
Sometimes Windows is a little less than forthcoming about exact device URIs (device locations). If having trouble specifying the correct device location in CUPS, run the following command to list all shares available to a certain windows username:<br />
$ smbtree -U ''windowsusername''<br />
This will list every share available to a certain Windows username on the local area network subnet, as long as Samba is set up and running properly. It should return something like this:<br />
{{bc| WORKGROUP<br />
\\REGULATOR-PC <br />
\\REGULATOR-PC\Z <br />
\\REGULATOR-PC\Public <br />
\\REGULATOR-PC\print$ Printer Drivers<br />
\\REGULATOR-PC\G <br />
\\REGULATOR-PC\EPSON Stylus CX8400 Series EPSON Stylus CX8400 Series}}<br />
What is needed here is first part of the last line, the resource matching the printer description. So to print to the EPSON Stylus printer, one would enter:<br />
smb://username.password@REGULATOR-PC/EPSON Stylus CX8400 Series<br />
as the URI into CUPS. Notice that whitespaces are allowed in URIs, whereas backslashes get replaced with forward slashes.<br />
If it won't work try '%20' instead of spaces.<br />
<br />
==== Print-Job client-error-document-format-not-supported ====<br />
<br />
Try installing the foomatic packages and use a foomatic driver.<br />
<br />
==== /usr/lib/cups/backend/hp failed ====<br />
<br />
Change:<br />
SystemGroup sys root<br />
to:<br />
SystemGroup lp root<br />
in {{ic|/etc/cups/cupsd.conf}}<br />
<br />
<br />
Following steps 1-3 in the Alternative CUPS interfaces below may be a better solution, since newer versions of cups will not allow the same group for both normal and admin operation.<br />
<br />
==== Unable to get list of printer drivers ====<br />
<br />
* Check your ServerName in /etc/cups/client.conf is written without http://<br />
ServerName localhost:631<br />
* Try to remove Foomatic drivers or refer to [[#HP_Printer]] for a workaround.<br />
<br />
==== lp: Error - Scheduler Not Responding ====<br />
<br />
If you get this error when printing a document using:<br />
<br />
$ lp document-to-print<br />
<br />
Try setting the CUPS_SERVER environment variable:<br />
<br />
$ export CUPS_SERVER=localhost<br />
<br />
If this solves your problem, make the solution permanent by adding the export line above to ~/.bash_profile.<br />
<br />
==== CUPS prints only an empty and an error-message page on HP LaserJet ====<br />
<br />
There is a bug that causes CUPS to fail when printing images on HP LaserJet (in my case 3380). The bug has been reported and fixed by [https://bugs.launchpad.net/ubuntu/+source/cups-filters/+bug/998087 Ubuntu].<br />
The first page is empty, the second page contains the following error message:<br />
ERROR:<br />
invalidaccess<br />
OFFENDING COMMAND:<br />
filter<br />
STACK:<br />
/SubFileDecode<br />
endstream<br />
...<br />
<br />
In order to fix the issue, use the following command (as superuser):<br />
lpadmin -p ''printer'' -o pdftops-renderer-default=pdftops<br />
<br />
==== "Using invalid Host" error message ====<br />
<br />
Try to add "ServerAlias *" into cupsd.conf<br />
<br />
==== Printer doesn't print with an "Filter failed" message on CUPS web interface (HP printer) ====<br />
<br />
Change the permissions of the printer USB port:<br />
<br />
Get the bus and device number from lsusb, then set the permission using:<br />
<br />
chmod 0666 /dev/bus/usb/''bus number''/''device number''<br />
<br />
To make the persistent permission change that will be triggered automatically each time the computer is rebooted, add the following line.<br />
<br />
{{hc|/etc/udev/rules.d/10-local.rules|2=<br />
SUBSYSTEM=="usb", ATTRS{idVendor}=="Printer_idVendor", ATTRS{idProduct}=="Printer_idProduct", GROUP="lp", MODE:="666"<br />
}}<br />
<br />
Obtain the right information by using {{ic|lsusb}} command, and don't forget to substitute {{ic|Printer_idVendor}} & {{ic|Printer_idProduct}} with the relevant ones.<br />
<br />
Each system may vary, so consult [[udev#List_attributes_of_a_device]] wiki page.<br />
<br />
==== Printer doesn't print with an "Filter failed" message on CUPS web interface (HP printer connected over network) ====<br />
<br />
Start, enable and restart the avahi-daemon.<br />
<br />
==== HPLIP 3.13: Plugin is installed, but HP Device Manager complains it is not ====<br />
<br />
The issue might have to do with the file permission change that had been made to {{ic|/var/lib/hp/hplip.state}}. To correct the issue, a simple {{ic|chmod 644 /var/lib/hp/hplip.state}} and {{ic|chmod 755 /var/lib/hp}} should be sufficient. For further information, please read this [https://bugs.launchpad.net/hplip/+bug/1131596 link].<br />
<br />
==== Printer is not recognized by CUPS ====<br />
<br />
If your printer is not listed in the "Add Printers" page of the CUPS web interface, nor by lpinfo -v, try the following (suggested in [https://bbs.archlinux.org/viewtopic.php?pid=1037279#p1037279 this thread]):<br />
<br />
* Remove {{ic|usblp}} from blacklist<br />
* Load {{ic|usblp}} module<br />
modprobe usblp<br />
* Stop cups<br />
* Add the following udev rule in a new rule file:<br />
{{hc|/etc/udev/rules.d/10-cups_device_link.rules|2=<br />
KERNEL=="lp[0-9]", SYMLINK+="%k", GROUP="lp"<br />
}}<br />
* Reload udev rules:<br />
# udevadm control --reload-rules<br />
* Unplug and re-plug the printer.<br />
* Wait a few seconds and then start cups again.<br />
<br />
==== Can't load /etc/samba/smb.conf ====<br />
<br />
If you're printing to a remote printer over SMB and get this error message: "Can't load /etc/samba/smb.conf - run testparm to debug it", then create an empty smb.conf:<br />
<br />
# mkdir /etc/samba<br />
# touch /etc/samba/smb.conf<br />
<br />
and restart cupsd.<br />
<br />
==== CUPS' systemd service does not start even though it's enabled ====<br />
<br />
The systemd .service file provided by CUPS uses socket activation, meaning the service is only started when an<br />
application connects to CUPS' socket. However, the systemd .socket file provided by cups only works for the local <br />
{{ic|/var/run/cups/cups.sock}} socket. <br />
<br />
In order to have cupsd start when initiating a print job over the network, create the following file:<br />
<br />
{{hc|/etc/systemd/system/cups.socket|<br />
.include /usr/lib/systemd/system/cups.socket<br />
<br />
[Socket]<br />
ListenStream&#61;0.0.0.0:631<br />
ListenDatagram&#61;0.0.0.0:631<br />
BindIPv6Only&#61;ipv6-only<br />
}}<br />
<br />
Then reload systemd:<br />
<br />
# systemctl --system daemon-reload<br />
<br />
Confirm that everything is working correctly:<br />
<br />
{{bc|<br />
# systemctl is-enabled cups.service &#124;&#124; systemctl enable cups.service<br />
# systemctl status cups.socket<br />
cups.socket - CUPS Printing Service Sockets<br />
Loaded: loaded (/etc/systemd/system/cups.socket; enabled)<br />
Active: inactive (dead)<br />
Listen: /var/run/cups/cups.sock (Stream)<br />
0.0.0.0:631 (Stream)<br />
0.0.0.0:631 (Datagram)<br />
}}<br />
<br />
CUPS should now start automatically when printing locally or over the network.<br />
<br />
== See also ==<br />
<br />
* [http://localhost:631/documentation.html Official CUPS documentation], ''locally installed''<br />
* [http://www.cups.org/ Official CUPS website]<br />
* [http://www.linuxprinting.org/ Linux Printing], ''[http://www.linuxfoundation.org The Linux Foundation]''<br />
* [http://www.gentoo.org/doc/en/printing-howto.xml Gentoo's printing guide], ''[http://www.gentoo.org/doc/en Gentoo Documentation resources]''<br />
* [https://bbs.archlinux.org/ Arch Linux user forums]<br />
* [http://wiki.gotux.net/tutorials/software/hp-printer Install HP printers easy way]</div>SilverWyrdahttps://wiki.archlinux.org/index.php?title=CUPS&diff=274396CUPS2013-09-05T04:07:39Z<p>SilverWyrda: /* Unable to get list of printer drivers */</p>
<hr />
<div>[[Category:Printers]]<br />
[[cs:CUPS]]<br />
[[es:CUPS]]<br />
[[fr:CUPS]]<br />
[[it:CUPS]]<br />
[[pl:CUPS]]<br />
[[ru:CUPS]]<br />
[[th:CUPS]]<br />
[[tr:CUPS]]<br />
[[zh-CN:CUPS]]<br />
[[zh-TW:CUPS]]<br />
{{Article summary start|Summary}}<br />
{{Article summary text|Installing and configuring CUPS}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|CUPS printer sharing}}<br />
{{Article summary wiki|CUPS printer-specific problems}}<br />
{{Article summary wiki|Samba}}<br />
{{Article summary end}}<br />
<br />
From [http://www.cups.org/index.php CUPS' site]:<br />
:"''[[Wikipedia:CUPS|CUPS]] is the standards-based, open source printing system developed by Apple Inc. for OS® X and other UNIX®-like operating systems''".<br />
<br />
Although there are other printing packages such as LPRNG, the Common Unix Printing System is the most popular choice because of its relative ease of use.<br />
<br />
== CUPS Linux printing workflow ==<br />
As of {{Pkg|cups}} version 1.5.3-3, Arch Linux makes use of the new full pdf-based printing workflow. For<br />
further reading check [http://www.linuxfoundation.org/collaborate/workgroups/openprinting/pdfasstandardprintjobformat PDF standard printing job format] and an old [https://wiki.linuxfoundation.org/en/OpenPrinting/Database/CUPS-Filter-Chart CUPS filtering chart] for history and fun.<br />
A good starting point for general Linux printing questions is [http://www.linuxfoundation.org/collaborate/workgroups/openprinting here].<br />
<br />
There are two ways to setup a printer.<br />
* If there's a CUPS server running in your network and sharing a printer you only need to install the client package.<br />
* If the printer is connected directly to your system or you have access to an IPP network printer then setup a local CUPS server.<br />
<br />
== Installing the client package ==<br />
<br />
The package {{Pkg|libcups}} is the only required package. [[pacman|Install]] it from the [[official repositories]].<br />
<br />
Then add your CUPS server's IP address or hostname into {{ic|/etc/cups/client.conf}}. That is all you need. Every application should quickly find the printer(s) shared by that CUPS server.<br />
<br />
=== Optional advanced network setup ===<br />
<br />
It is also possible to run a entire cupsd+cups-browsed instance on your client with Avahi browsing enabled to discover unknown shared printers in your network. This can be useful in large setups where the server is unknown.<br />
{{Note|This behavior did not change with cups 1.6.x - the difference is that until 1.5.x cupsd was able to do printer browsing alone and now it can only browse its own shared printers.<br />
To get the local cupsd recognise other shared printers offered by a remote cupsd server you need a running local cups-browsed (supported since cups-filters 1.0.26) instance using Avahi to discover unknown printers. <br />
There is [https://bbs.archlinux.org/viewtopic.php?id&#61;161440 good news] in April 2013 (still has to be incorporated above).}}<br />
<br />
=== Installing CUPS a 32 bit chroot environment ===<br />
<br />
If you have a 64 bit base installation with a [[Install_bundled_32-bit_system_in_Arch64|32 bit chroot environment]], explicit installation of CUPS is not necessary in the 32 bit environment. To access installed CUPS printers from the chroot environment, one needs to bind the {{ic|/var/run/cups}} directory to the same relative location in the chroot environment. Simply create the directory in the chroot (it probably doesn't exist), mount (with {{ic|-o bind}} passed to the command}}, and printers should be available from 32 bit chroot applications immediately.<br />
<br />
{{bc|# mkdir /path/to/chroot/var/run/cups<br />
# Example: # mkdir /opt/arch32/var/run/cups<br />
<br />
# mount -o bind /var/run/cups /path/to/chroot/var/run/cups}}<br />
<br />
== Installing the server packages ==<br />
<br />
The following packages and some printer drivers are needed. [[pacman|Install]] them from the [[official repositories]].<br />
<br />
* {{Pkg|cups}} - the actual CUPS daemon<br />
* {{Pkg|cups-filters}} - essential filters<br />
* {{Pkg|ghostscript}} - (optional) PostScript interpreter<br />
* {{Pkg|gsfonts}} - GhostScript standard Type1 fonts<br />
<br />
If you want to enable printer browsing through your network, also install {{Pkg|avahi}}. Make sure '''avahi-daemon''' is started before '''cupsd'''.<br />
<br />
If the system is connected to a networked printer using the [[Samba]] protocol or if the system is to be a print server for Windows clients, also install {{Pkg|samba}}.<br />
<br />
=== Printer driver ===<br />
<br />
Here are some of the driver packages. Choosing the right driver depends on the printer:<br />
<br />
* '''{{Pkg|gutenprint}}''' - A collection of high quality drivers for Canon, Epson, Lexmark, Sony, Olympus, and PCL printers for use with GhostScript, CUPS, Foomatic, and the [[GIMP]]<br />
* '''{{Pkg|foomatic-db}}, {{Pkg|foomatic-db-engine}}, {{Pkg|foomatic-db-nonfree}}, and {{Pkg|foomatic-filters}}''' - Foomatic is a database-driven system for integrating free software printer drivers with common spoolers under Unix. Installing foomatic-filters should solve problems if the cups error_log is reporting "stopped with status 22!".<br />
* '''{{Pkg|hplip}}''' - HP drivers for DeskJet, OfficeJet, Photosmart, Business Inkjet and some LaserJet printer models, as well as a number of Brother printers.<br />
* '''{{Pkg|splix}}''' - Samsung drivers for SPL (Samsung Printer Language) printers.<br />
<br />
* '''{{AUR|foo2zjs}}''' - Drivers for ZjStream protocol printers such as the HP Laserjet 1018. More info [http://foo2zjs.rkkda.com here]. Package is available in the [[AUR]].<br />
* '''{{AUR|hpoj}}''' - If you are using an HP Officejet, you should also install this package and follow the instructions to avoid problems as in [https://answers.launchpad.net/hplip/+question/133425 this thread]. Package is available in the [[AUR]].<br />
* '''{{AUR|samsung-unified-driver}}''' - Unified Linux Driver for Samsung printers and scanners. Required for new printers such as the ML-2160. Package is available in the [[AUR]].<br />
* '''{{AUR|ufr2}}''' or '''{{AUR|cndrvcups-lb}}''' - Canon UFR2 driver with support for LBP, iR and MF series printers. Package is available in the [[AUR]].<br />
<br />
* '''{{Pkg|cups-pdf}}''' - A package that allows one to setup a virtual PDF Printer that generates a PDF out of jobs sent to it<br />
<br />
If you are not sure of what driver package to install or if the current driver is not working, it may be easiest to just install all of the drivers. Some of the package names are misleading because printers of other makes may rely on them. For example, the Brother HL-2140 needs the hplip driver installed.<br />
<br />
==== Download printer PPD ====<br />
<br />
Depending on the printer, this step is optional and may not be needed, as the standard CUPS installation already comes with quite a few PPD (Postscript Printer Description) files. Moreover, the ''foomatic-filters'', ''gimp-print'' and ''hplip'' packages already include quite a few PPD files which will automatically be detected by CUPS.<br />
<br />
Here is an explanation of what a PPD file is from the Linux Printing website:<br />
:"''For every PostScript printer the manufacturers provide a PPD file which contains all printer-specific information about the particular printer model: Basic printer capabilities as whether the printer is a color printer, fonts, PostScript level, etc., and especially the user-adjustable options, as paper size, resolution, etc.''"<br />
<br />
If the PPD for the printer is ''not'' already in CUPS, then:<br />
*check [[AUR]] to see if there are packages for the printer/manufacturer<br />
*visit the [http://www.openprinting.org/printers OpenPrinting database] and select the manufacturer and model of the printer<br />
*visit the manufacturer's site and search for GNU/Linux drivers<br />
<br />
{{Note|PPD files go in {{ic|/usr/share/cups/model/}}}}<br />
<br />
==== Another source for printer drivers ====<br />
<br />
[http://www.turboprint.de/english.html Turboprint] is a proprietary driver for many printers not yet supported by GNU/Linux (Canon i*, for example). Unlike CUPS, however, high quality prints are either marked with a watermark or are a pay-only service.<br />
<br />
== Hardware support and configuration ==<br />
<br />
=== USB printers ===<br />
<br />
{{Tip|Most USB printers should work out of the box, you can skip this section and come back if you can not get your printer to work.}}<br />
<br />
USB printers can get accessed with two methods: The usblp kernel module and libusb. The former is the classic way. It is simple: data is sent to the printer by writing it to a device file as a simple serial data stream. Reading the same device file allows bi-di access, at least for things like reading out ink levels, status, or printer capability information (PJL). It works very well for simple printers, but for multi-function devices (printer/scanner) it is not suitable and manufacturers like HP supply their own backends. Source: [http://lists.linuxfoundation.org/pipermail/printing-architecture/2012/002412.html here].<br />
<br />
==== Blacklisting usblp ====<br />
<br />
{{Warning|As of {{Pkg|cups}} version 1.6.0, you no longer need to [[Kernel modules#Blacklisting|blacklist]] the {{ic|usblp}} kernel module.<br />
<br />
If you find out this is the only way to fix a remaining issue please report this upstream to the CUPS bug tracker and maybe also get in contact with Till Kamppeter (Debian CUPS maintainer). See [http://cups.org/str.php?L4128 upstream bug] for more.}}<br />
<br />
If you have problems getting your USB printer to work, you can try blacklisting the {{ic|usblp}} [[kernel module]]:<br />
<br />
{{hc|/etc/modprobe.d/blacklistusblp.conf|<br />
blacklist usblp<br />
}}<br />
<br />
Custom kernel users may need to manually load the {{ic|usbcore}} [[kernel module]] before proceeding.<br />
<br />
Once the modules are installed, plug in the printer and check if the kernel detected it by running the following:<br />
# tail /var/log/messages.log<br />
or<br />
# dmesg<br />
<br />
If you're using {{ic|usblp}}, the output should indicate that the printer has been detected like so:<br />
Feb 19 20:17:11 kernel: printer.c: usblp0: USB Bidirectional<br />
printer dev 2 if 0 alt 0 proto 2 vid 0x04E8 pid 0x300E<br />
Feb 19 20:17:11 kernel: usb.c: usblp driver claimed interface cfef3920<br />
Feb 19 20:17:11 kernel: printer.c: v0.13: USB Printer Device Class driver<br />
<br />
If you blacklisted {{ic|usblp}}, you will see something like:<br />
usb 3-2: new full speed USB device using uhci_hcd and address 3<br />
usb 3-2: configuration #1 chosen from 1 choice<br />
<br />
=== Parallel port printers ===<br />
<br />
To use a parallel port printer, you will need to load the {{ic|lp}}, {{ic|parport}} and {{ic|parport_pc}} [[kernel modules]].<br />
<br />
Check the setup by running:<br />
# tail /var/log/messages.log<br />
It should display something like this:<br />
lp0: using parport0 (polling).<br />
<br />
If you are using a USB to parallel port adapter, CUPS will not be able to detect the printer. As a workaround, add the printer using a different connection type and then change DeviceID in {{ic|/etc/cups/printers.conf}}:<br />
DeviceID = parallel:/dev/usb/lp0<br />
<br />
=== HP Printer ===<br />
<br />
HP printers can also be installed via HP's Linux setup tool. Install it by installing {{Pkg|hplip}} from the [[official repositories]].<br />
<br />
To run with qt frontend:<br />
# hp-setup -u<br />
<br />
To run with command line:<br />
# hp-setup -i<br />
<br />
PPD files are in {{ic|/usr/share/ppd/HP/}}.<br />
<br />
For printers that require the proprietary HP plugin (like the Laserjet Pro P1102w), install the {{AUR|hplip-plugin}} package from [[AUR]].<br />
<br />
Important : {{Pkg|hplip}} depends on {{Pkg|foomatic-db-engine}} which prevents the drivers list from appearing when a printer is added to CUPS via the web user interface (following error : "Unable to get list of printer drivers"). The workaround consists in installing {{Pkg|hplip}} first, retrieve the corresponding PPD file from {{ic|/usr/share/ppd/HP/}}, then, remove entierly {{Pkg|hplip}} and the unecessary dependencies. Finally, install the printer manually with the PPD file (possible on the webui) then re-install {{Pkg|hplip}}. You should have after a reboot a fully working printer.<br />
<br />
== Configuring ==<br />
<br />
Now that CUPS is installed, there are a variety of options on how to set up printing solutions. As always, the tried and true command line method is at your disposal. CUPS also embeds a full-featured web interface. Likewise, various desktop environments such as GNOME and KDE have useful programs that can help manage printers. Depending on your needs, you may choose one method or the other.<br />
<br />
If you are planning on connecting to a network printer, rather than one that is directly connected to the computer, you might want to read the [[CUPS printer sharing]] page first. Printer sharing between GNU/Linux systems is quite easy and involves very little configuration, whereas sharing between a Windows and GNU/Linux host requires a little bit more effort.<br />
<br />
=== CUPS daemon ===<br />
<br />
With the kernel modules installed, you can now start the '''cups''' and optionally, the '''cups-browsed''' [[daemons]], and enable them as required.<br />
<br />
=== Web interface and tool-kit ===<br />
<br />
Once the daemon is running, open a browser and go to: http://localhost:631 (''The '''localhost''' string may need to be replaced with the hostname found in'' {{ic|/etc/hostname}}).<br />
<br />
From here, follow the various wizards to add the printer. A usual procedure is to start by clicking on ''Adding Printers and Classes'' and then ''Add Printer''. When prompted for a username and password, log in as root. The name assigned to the printer does not matter, the same applies for 'location' and 'description'. Next, a list of devices to select from will be presented. The actual name of the printer shows up next to the label (e.g., next to ''USB Printer #1'' for USB printers). Finally, choose the appropriate drivers and the configuration is complete.<br />
<br />
Now test the configuration by pressing the ''Maintenance'' drop-down menu then ''Print Test Page''. If it does not print and there is certainty regarding the correctness of applied settings, then the problem is most likely due to missing a proper printer driver.<br />
<br />
{{Tip|See: [[#Alternative CUPS interfaces]] for other other front-ends.}}<br />
{{Note|<br />
* When setting up a USB printer, you should see your printer listed on ''Add Printer'' page. If you can only see a "SCSI printer" option, it probably means that CUPS has failed to recognize your printer.<br />
* To enable wireless scanning on certain HP multi-function devices using the {{pkg|hplip}} package, you may need to add the printer as a Network Printer using the HTTP protocol. To determine the proper URI to use, run the {{ic|hp-makeuri}} command.}}<br />
<br />
==== CUPS administration ====<br />
<br />
A username and password will be required when administering the printer in the web interface, such as: adding or removing printers, stopping print tasks, etc. The default username is the one assigned in the ''sys'' group, or root. Other admin groups (e.g. lpadmin or printadmin) may be added to the {{ic|SystemGroup}} line in {{ic|/etc/cups/cups-files.conf}} (you might have to add this line). See [http://www.cups.org/articles.php?L237+T+Qprintadmin these instructions at cups.org]. You might also want to read [https://bbs.archlinux.org/viewtopic.php?id=35567 this post]. Create the group[s] ({{ic|man groupadd}}) and add the group[s] to users ({{ic|man usermod}}). cupsd must be restarted and the user must re-login for these changes to take affect.<br />
<br />
If the root account has been locked (i.e. when using sudo), it is not possible to log in the CUPS administration interface with the default username (root) and password. Follow the instructions above to add other users as cups administrators.<br />
<br />
==== Remote access to web interface ====<br />
<br />
By default, the CUPS web interface can only be accessed by the ''localhost''; i.e. the computer that it is installed on. To remotely access the interface, make the following changes to the {{ic|/etc/cups/cupsd.conf}} file. Replace the line:<br />
Listen localhost:631<br />
with<br />
Port 631<br />
so that CUPS listens to incoming requests.<br />
<br />
Three levels of access can be granted:<br />
<Location /> #access to the server<br />
<Location /admin> #access to the admin pages<br />
<Location /admin/conf> #access to configuration files<br />
<br />
To give remote hosts access to one of these levels, add an {{ic|Allow}} statement to that level's section. An {{ic|Allow}} statement can take one or more of the forms listed below:<br />
Allow from all<br />
Allow from host.domain.com<br />
Allow from *.domain.com<br />
Allow from ip-address<br />
Allow from ip-address/netmask<br />
<br />
Deny statements can also be used. For example, if wanting to give all hosts on the 192.168.1.0/255.255.255.0 subnet full access, file {{ic|/etc/cups/cupsd.conf}} would include this:<br />
# Restrict access to the server...<br />
# By default only localhost connections are possible<br />
<Location /><br />
Order allow,deny<br />
Allow from localhost<br />
'''Allow from 192.168.1.0/255.255.255.0'''<br />
</Location><br />
<br />
# Restrict access to the admin pages...<br />
<Location /admin><br />
# Encryption disabled by default<br />
#Encryption Required<br />
Order allow,deny<br />
Allow from localhost<br />
'''Allow from 192.168.1.0/255.255.255.0'''<br />
</Location><br />
<br />
# Restrict access to configuration files...<br />
<Location /admin/conf><br />
AuthType Basic<br />
Require user @SYSTEM<br />
Order allow,deny<br />
Allow From localhost<br />
'''Allow From 192.168.1.0/255.255.255.0'''<br />
</Location><br />
<br />
You might also need to add:<br />
<br />
DefaultEncryption Never<br />
<br />
This should avoid the error: 426 - Upgrade Required when using the CUPS web interface from a remote machine.<br />
<br />
=== Command-line configuration ===<br />
<br />
CUPS can be fully controlled from command-line with nice tools, ''i.e.'' the lp* and the cups* command families.<br />
<br />
On Arch Linux, most commands support auto-completion with common shells.<br />
Also note that command-line switches cannot be grouped.<br />
<br />
;List the devices<br />
# lpinfo -v<br />
<br />
;List the drivers<br />
# lpinfo -m<br />
<br />
;Add a new printer<br />
# lpadmin -p ''printer'' -E -v ''device'' -P ''ppd''<br />
<br />
The ''printer'' is up to you. The device can be retrieved from the 'lpinfo -i' command.<br />
Example:<br />
# lpadmin -p HP_DESKJET_940C -E -v "usb://HP/DESKJET%20940C?serial=CN16E6C364BH" -P /usr/share/ppd/HP/hp-deskjet_940c.ppd.gz<br />
<br />
In the following, the ''printer'' references the name you have used here to set up the printer.<br />
<br />
;Set the default printer<br />
$ lpoptions -d ''printer''<br />
<br />
;Check the status<br />
$ lpstat -s<br />
$ lpstat -p ''printer''<br />
<br />
;Deactivate a printer<br />
# cupsdisable ''printer''<br />
<br />
;Activate a printer<br />
# cupsenable ''printer''<br />
<br />
;Remove a printer<br />
First set it to reject all incoming entries:<br />
# cupsreject ''printer''<br />
Then disable it.<br />
# cupsdisable ''printer''<br />
Finally remove it.<br />
# lpadmin -x ''printer''<br />
<br />
;Print a file<br />
$ lpr ''file''<br />
$ lpr -# 17 ''file'' # print the file 17 times<br />
$ echo "Hello, world!" | lpr -p # print the result of a command. The -p switch adds a header.<br />
<br />
;Check the printing queue<br />
$ lpq<br />
$ lpq -a # on all printers<br />
<br />
;Clear the printing queue<br />
# lprm # remove last entry only<br />
# lprm - # remove all entries<br />
<br />
=== Alternative CUPS interfaces ===<br />
<br />
==== GNOME ====<br />
<br />
You can configure and manage printers by [[pacman|installing]] {{Pkg|system-config-printer}}. This program does pull in some gnome dependencies.<br />
<br />
If your user does not have sufficient priviliges to administer the cups scheduler, system-config-printer will request the root password when it starts. You can avoid this by performing the following instructions.<br />
<br />
1. Create a group for administering the cups scheduler:<br />
<br />
# groupadd lpadmin<br />
<br />
2. Add yourself to the newly created group:<br />
<br />
# usermod -aG lpadmin ''username''<br />
<br />
3. Tell cups to respect the newly created group:<br />
<br />
{{hc|/etc/cups/cups-files.conf|<br />
...<br />
SystemGroup sys root '''lpadmin'''<br />
...}}<br />
<br />
4. Restart cups:<br />
<br />
# systemctl restart cupsd<br />
<br />
5. Log out and log in again or restart your computer.<br />
<br />
==== KDE ====<br />
<br />
[[KDE]] users can modify their printers from the Control Center. Both should refer to those desktop environments' documentation for more information on how to use the interfaces.<br />
<br />
==== Other ====<br />
<br />
There is also {{AUR|gtklp}} in the [[AUR]].<br />
<br />
== PDF virtual printer ==<br />
<br />
{{Pkg|cups-pdf}} is a nice package that allows one to setup a virtual printer that will generate a PDF from anything sent to it. This package is not necessary, but it can be quite useful.<br />
<br />
After installing the package, set it up as if it were for any other printer by using the web interface. Access the cups print manager: http://localhost:631 and select:<br />
Administration -> Add Printer<br />
Select CUPS-PDF (Virtual PDF), choose for the make and driver:<br />
Make: Generic<br />
Driver: Generic CUPS-PDF Printer<br />
<br />
Find generated PDF documents in a sub-directory located at {{ic|/var/spool/cups-pdf}}. Normally, the subdirectory is named after the user who performed the job. A little tweak helps you to find your printed PDF documents more easily. Edit {{ic|/etc/cups/cups-pdf.conf}} by changing the line<br />
#Out /var/spool/cups-pdf/${USER}<br />
<br />
to<br />
<br />
Out ${HOME}<br />
<br />
=== Print to PostScript ===<br />
<br />
The CUPS-PDF (Virtual PDF Printer) actually creates a PostScript file and then creates the PDF using the ps2pdf utility. To print to PostScript, just print as usual, in the print dialog choose "CUPS-PDF" as the printer, then select the checkbox for "print to file", hit print, enter the filename.ps and click save. This is handy for faxes, etc...<br />
<br />
== Troubleshooting ==<br />
<br />
The best way to get printing working is to set 'LogLevel' in {{ic|/etc/cups/cupsd.conf}} to:<br />
LogLevel debug<br />
<br />
And then viewing the output from {{ic|/var/log/cups/error_log}} like this:<br />
# tail -n 100 -f /var/log/cups/error_log<br />
<br />
The characters at the left of the output stand for:<br />
*D=Debug<br />
*E=Error<br />
*I=Information<br />
*And so on<br />
<br />
These files may also prove useful:<br />
*{{ic|/var/log/cups/page_log}} - Echoes a new entry each time a print is successful<br />
*{{ic|/var/log/cups/access_log}} - Lists all cupsd http1.1 server activity<br />
<br />
Of course, it is important to know how CUPS works if wanting to solve related issues:<br />
# An application sends a .ps file (PostScript, a script language that details how the page will look) to CUPS when 'print' has been selected (this is the case with most programs).<br />
# CUPS then looks at the printer's PPD file (printer description file) and figures out what filters it needs to use to convert the .ps file to a language that the printer understands (like PJL, PCL), usually GhostScript.<br />
# GhostScript takes the input and figures out which filters it should use, then applies them and converts the .ps file to a format understood by the printer.<br />
# Then it is sent to the back-end. For example, if the printer is connected to a USB port, it uses the USB back-end.<br />
<br />
Print a document and watch {{ic|error_log}} to get a more detailed and correct image of the printing process.<br />
<br />
=== Problems resulting from upgrades ===<br />
<br />
''Issues that appeared after CUPS and related program packages underwent a version increment''<br />
<br />
==== CUPS stops working ====<br />
<br />
The chances are that a new configuration file is needed for the new version to work properly. Messages such as "404 - page not found" may result from trying to manage CUPS via localhost:631, for example.<br />
<br />
To use the new configuration, copy {{ic|/etc/cups/cupsd.conf.default}} to {{ic|/etc/cups/cupsd.conf}} (backup the old configuration if needed) and restart CUPS to employ the new settings.<br />
<br />
==== All jobs are "stopped" ====<br />
<br />
If all jobs sent to the printer become "stopped", delete the printer and add it again.<br />
Using the [http://localhost:631 CUPS web interface], go to Printers > Delete Printer.<br />
<br />
To check the printer's settings go to ''Printers'', then ''Modify Printer''. Copy down the information displayed, click 'Modify Printer' to proceed to the next page(s), and so on.<br />
<br />
==== All jobs are "The printer is not responding" ====<br />
<br />
On networked printers, you should check that the name that CUPS uses as its connection URI resolves to the printer's IP via DNS, e.g.<br />
If your printer's connection looks like this:<br />
lpd://BRN_020554/BINARY_P1<br />
<br />
then the hostname 'BRN_020554' needs to resolve to the printer's IP from the server running CUPS<br />
<br />
==== The PPD version is not compatible with gutenprint ====<br />
<br />
Run:<br />
# /usr/bin/cups-genppdupdate<br />
<br />
And restart CUPS (as pointed out in gutenprint's post-install message)<br />
<br />
=== Other ===<br />
<br />
===== CUPS permission errors =====<br />
<br />
* Some users fixed 'NT_STATUS_ACCESS_DENIED' (Windows clients) errors by using a slightly different syntax:<br />
smb://workgroup/username:password@hostname/printer_name<br />
<br />
* Sometimes, the block device has wrong permissions:<br />
# ls /dev/usb/<br />
lp0<br />
# chgrp lp /dev/usb/lp0<br />
<br />
==== HPLIP printer sends "/usr/lib/cups/backend/hp failed" error ====<br />
<br />
Make sure dbus is installed and running. If the error persists, try starting avahi-daemon.<br />
<br />
Try adding the printer as a Network Printer using the http:// protocol. Generate the printer URI with {{ic|hp-makeuri}}.<br />
<br />
{{Note|There might need to set permissions issues right. Follow indications here: [[CUPS#Device node permissions]].}}<br />
<br />
==== HPLIP printer claims job is complete but printer does nothing ====<br />
<br />
This happens on HP printers when you select the (old) hpijs driver (e.g. the Deskjet D1600 series). Instead, use the hpcups driver when adding the printer.<br />
<br />
Some HP printers (e.g HP LaserJet) require their firmware to be downloaded from the computer every time the printer is switched on. If there is an issue with udev (or equivalent) and the firmware download rule is never fired, you may experience this issue.<br />
As a workaround, you can manually download the firmware to the printer. Ensure the printer is plugged in and switched on, then enter<br />
hp-firmware -n<br />
<br />
==== hp-setup asks to specify the PPD file for the discovered printer ====<br />
<br />
Install CUPS before running hp-setup.<br />
<br />
==== I have installed Qt, but hp-setup reports "Qt/PyQt 4 initialization failed" ====<br />
<br />
"hp-check -t" won't give you useful information to find the required package. You have to install all the "Dependent Packages" prefixed with "python2" in https://www.archlinux.org/packages/extra/x86_64/hplip/<br />
<br />
==== hp-setup finds the printer automatically but reports "Unable to communicate with device" when printing test page immediately afterwards ====<br />
<br />
This at least happens to hplip 3.13.5-2 for HP Officejet 6500A through local network connection. To solve the problem, specify the IP address of the HP printer for hp-setup to locate the printer.<br />
<br />
==== hp-toolbox sends an error, "Unable to communicate with device" ====<br />
<br />
If running hp-toolbox as a regular user results in:<br />
# hp-toolbox<br />
# error: Unable to communicate with device (code=12): hp:/usb/''printer id''<br />
or, "{{ic|Unable to communicate with device"}}", then it may be needed to [[Groups#Group management|add the user to the lp and sys groups]].<br />
<br />
This can also be caused by printers such as the P1102 that provide a virtual cd-rom drive for MS-Windows drivers. The lp dev appears and then disappears. In that case try the '''usb-modeswitch''' and '''usb-modeswitch-data''' packages, that lets one switch off the "Smart Drive" (udev rules included in said packages).<br />
<br />
This can also occur with network attached printers if the [[Avahi|avahi-daemon]] is not running. Another possiblility is the specification of the printer's IP address in hp-setup fails to locate the printer because the IP address of the the printer changed due to DHCP.<br />
<br />
==== CUPS returns '"foomatic-rip" not available/stopped with status 3' with a HP printer ====<br />
<br />
If receiving any of the following error messages in {{ic|/var/log/cups/error_log}} while using a HP printer, with jobs appearing to be processed while they all end up not being completed with their status set to 'stopped':<br />
Filter "foomatic-rip" for printer ''printer_name'' not available: No such file or director<br />
or:<br />
PID 5771 (/usr/lib/cups/filter/foomatic-rip) stopped with status 3!<br />
make sure {{pkg|hplip}} has been [[pacman|installed]], in addition to [[#Packages|the packages mentioned above]]. See [https://bbs.archlinux.org/viewtopic.php?id=65615 this forum post] for more information.<br />
<br />
==== Printing fails with unauthorised error ====<br />
<br />
If the user has been added to the lp group, and allowed to print (set in {{ic|cupsd.conf}}), then the problem lies in {{ic|/etc/cups/printers.conf}}. This line could be the culprit:<br />
AuthInfoRequired negotiate<br />
<br />
Comment it out and restart CUPS.<br />
<br />
==== Print button greyed-out in GNOME print dialogs ====<br />
<br />
:''<small>Source: [https://bbs.archlinux.org/viewtopic.php?id=70418 I can't print from gnome applications. - Arch Forums]</small>''<br />
<br />
Be sure the package: '''libgnomeprint''' is installed<br />
<br />
Edit {{ic|/etc/cups/cupsd.conf}} and add:<br />
# HostNameLookups Double<br />
<br />
Restart cups.service.<br />
<br />
==== Unknown supported format: application/postscript ====<br />
<br />
Comment the lines:<br />
application/octet-stream application/vnd.cups-raw 0 -<br />
from {{ic|/etc/cups/mime.convs}}, and:<br />
application/octet-stream<br />
in {{ic|/etc/cups/mime.types}}.<br />
<br />
==== Finding URIs for Windows print servers ====<br />
<br />
Sometimes Windows is a little less than forthcoming about exact device URIs (device locations). If having trouble specifying the correct device location in CUPS, run the following command to list all shares available to a certain windows username:<br />
$ smbtree -U ''windowsusername''<br />
This will list every share available to a certain Windows username on the local area network subnet, as long as Samba is set up and running properly. It should return something like this:<br />
{{bc| WORKGROUP<br />
\\REGULATOR-PC <br />
\\REGULATOR-PC\Z <br />
\\REGULATOR-PC\Public <br />
\\REGULATOR-PC\print$ Printer Drivers<br />
\\REGULATOR-PC\G <br />
\\REGULATOR-PC\EPSON Stylus CX8400 Series EPSON Stylus CX8400 Series}}<br />
What is needed here is first part of the last line, the resource matching the printer description. So to print to the EPSON Stylus printer, one would enter:<br />
smb://username.password@REGULATOR-PC/EPSON Stylus CX8400 Series<br />
as the URI into CUPS. Notice that whitespaces are allowed in URIs, whereas backslashes get replaced with forward slashes.<br />
If it won't work try '%20' instead of spaces.<br />
<br />
==== Print-Job client-error-document-format-not-supported ====<br />
<br />
Try installing the foomatic packages and use a foomatic driver.<br />
<br />
==== /usr/lib/cups/backend/hp failed ====<br />
<br />
Change:<br />
SystemGroup sys root<br />
to:<br />
SystemGroup lp root<br />
in {{ic|/etc/cups/cupsd.conf}}<br />
<br />
<br />
Following steps 1-3 in the Alternative CUPS interfaces below may be a better solution, since newer versions of cups will not allow the same group for both normal and admin operation.<br />
<br />
==== Unable to get list of printer drivers ====<br />
<br />
* Check your ServerName in /etc/cups/client.conf is written without http://<br />
ServerName localhost:631<br />
* Try to remove Foomatic drivers or refer to [[#HP_Printer]] for a workaround.<br />
<br />
==== lp: Error - Scheduler Not Responding ====<br />
<br />
If you get this error when printing a document using:<br />
<br />
$ lp document-to-print<br />
<br />
Try setting the CUPS_SERVER environment variable:<br />
<br />
$ export CUPS_SERVER=localhost<br />
<br />
If this solves your problem, make the solution permanent by adding the export line above to ~/.bash_profile.<br />
<br />
==== CUPS prints only an empty and an error-message page on HP LaserJet ====<br />
<br />
There is a bug that causes CUPS to fail when printing images on HP LaserJet (in my case 3380). The bug has been reported and fixed by [https://bugs.launchpad.net/ubuntu/+source/cups-filters/+bug/998087 Ubuntu].<br />
The first page is empty, the second page contains the following error message:<br />
ERROR:<br />
invalidaccess<br />
OFFENDING COMMAND:<br />
filter<br />
STACK:<br />
/SubFileDecode<br />
endstream<br />
...<br />
<br />
In order to fix the issue, use the following command (as superuser):<br />
lpadmin -p ''printer'' -o pdftops-renderer-default=pdftops<br />
<br />
==== "Using invalid Host" error message ====<br />
<br />
Try to add "ServerAlias *" into cupsd.conf<br />
<br />
==== Printer doesn't print with an "Filter failed" message on CUPS web interface (HP printer) ====<br />
<br />
Change the permissions of the printer USB port:<br />
<br />
Get the bus and device number from lsusb, then set the permission using:<br />
<br />
chmod 0666 /dev/bus/usb/''bus number''/''device number''<br />
<br />
To make the persistent permission change that will be triggered automatically each time the computer is rebooted, add the following line.<br />
<br />
{{hc|/etc/udev/rules.d/10-local.rules|2=<br />
SUBSYSTEM=="usb", ATTRS{idVendor}=="Printer_idVendor", ATTRS{idProduct}=="Printer_idProduct", GROUP="lp", MODE:="666"<br />
}}<br />
<br />
Obtain the right information by using {{ic|lsusb}} command, and don't forget to substitute {{ic|Printer_idVendor}} & {{ic|Printer_idProduct}} with the relevant ones.<br />
<br />
Each system may vary, so consult [[udev#List_attributes_of_a_device]] wiki page.<br />
<br />
==== Printer doesn't print with an "Filter failed" message on CUPS web interface (HP printer connected over network) ====<br />
<br />
Start, enable and restart the avahi-daemon.<br />
<br />
==== HPLIP 3.13: Plugin is installed, but HP Device Manager complains it is not ====<br />
<br />
The issue might have to do with the file permission change that had been made to {{ic|/var/lib/hp/hplip.state}}. To correct the issue, a simple {{ic|chmod 644 /var/lib/hp/hplip.state}} and {{ic|chmod 755 /var/lib/hp}} should be sufficient. For further information, please read this [https://bugs.launchpad.net/hplip/+bug/1131596 link].<br />
<br />
==== Printer is not recognized by CUPS ====<br />
<br />
If your printer is not listed in the "Add Printers" page of the CUPS web interface, nor by lpinfo -v, try the following (suggested in [https://bbs.archlinux.org/viewtopic.php?pid=1037279#p1037279 this thread]):<br />
<br />
* Remove {{ic|usblp}} from blacklist<br />
* Load {{ic|usblp}} module<br />
modprobe usblp<br />
* Stop cups<br />
* Add the following udev rule in a new rule file:<br />
{{hc|/etc/udev/rules.d/10-cups_device_link.rules|2=<br />
KERNEL=="lp[0-9]", SYMLINK+="%k", GROUP="lp"<br />
}}<br />
* Reload udev rules:<br />
# udevadm control --reload-rules<br />
* Unplug and re-plug the printer.<br />
* Wait a few seconds and then start cups again.<br />
<br />
==== Can't load /etc/samba/smb.conf ====<br />
<br />
If you're printing to a remote printer over SMB and get this error message: "Can't load /etc/samba/smb.conf - run testparm to debug it", then create an empty smb.conf:<br />
<br />
# mkdir /etc/samba<br />
# touch /etc/samba/smb.conf<br />
<br />
and restart cupsd.<br />
<br />
==== CUPS' systemd service does not start even though it's enabled ====<br />
<br />
The systemd .service file provided by CUPS uses socket activation, meaning the service is only started when an<br />
application connects to CUPS' socket. However, the systemd .socket file provided by cups only works for the local <br />
{{ic|/var/run/cups/cups.sock}} socket. <br />
<br />
In order to have cupsd start when initiating a print job over the network, create the following file:<br />
<br />
{{hc|/etc/systemd/system/cups.socket|<br />
.include /usr/lib/systemd/system/cups.socket<br />
<br />
[Socket]<br />
ListenStream&#61;0.0.0.0:631<br />
ListenDatagram&#61;0.0.0.0:631<br />
BindIPv6Only&#61;ipv6-only<br />
}}<br />
<br />
Then reload systemd:<br />
<br />
# systemctl --system daemon-reload<br />
<br />
Confirm that everything is working correctly:<br />
<br />
{{bc|<br />
# systemctl is-enabled cups.service &#124;&#124; systemctl enable cups.service<br />
# systemctl status cups.socket<br />
cups.socket - CUPS Printing Service Sockets<br />
Loaded: loaded (/etc/systemd/system/cups.socket; enabled)<br />
Active: inactive (dead)<br />
Listen: /var/run/cups/cups.sock (Stream)<br />
0.0.0.0:631 (Stream)<br />
0.0.0.0:631 (Datagram)<br />
}}<br />
<br />
CUPS should now start automatically when printing locally or over the network.<br />
<br />
== See also ==<br />
<br />
* [http://localhost:631/documentation.html Official CUPS documentation], ''locally installed''<br />
* [http://www.cups.org/ Official CUPS website]<br />
* [http://www.linuxprinting.org/ Linux Printing], ''[http://www.linuxfoundation.org The Linux Foundation]''<br />
* [http://www.gentoo.org/doc/en/printing-howto.xml Gentoo's printing guide], ''[http://www.gentoo.org/doc/en Gentoo Documentation resources]''<br />
* [https://bbs.archlinux.org/ Arch Linux user forums]<br />
* [http://wiki.gotux.net/tutorials/software/hp-printer Install HP printers easy way]</div>SilverWyrdahttps://wiki.archlinux.org/index.php?title=CUPS&diff=274395CUPS2013-09-05T04:05:34Z<p>SilverWyrda: /* HP Printer */</p>
<hr />
<div>[[Category:Printers]]<br />
[[cs:CUPS]]<br />
[[es:CUPS]]<br />
[[fr:CUPS]]<br />
[[it:CUPS]]<br />
[[pl:CUPS]]<br />
[[ru:CUPS]]<br />
[[th:CUPS]]<br />
[[tr:CUPS]]<br />
[[zh-CN:CUPS]]<br />
[[zh-TW:CUPS]]<br />
{{Article summary start|Summary}}<br />
{{Article summary text|Installing and configuring CUPS}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|CUPS printer sharing}}<br />
{{Article summary wiki|CUPS printer-specific problems}}<br />
{{Article summary wiki|Samba}}<br />
{{Article summary end}}<br />
<br />
From [http://www.cups.org/index.php CUPS' site]:<br />
:"''[[Wikipedia:CUPS|CUPS]] is the standards-based, open source printing system developed by Apple Inc. for OS® X and other UNIX®-like operating systems''".<br />
<br />
Although there are other printing packages such as LPRNG, the Common Unix Printing System is the most popular choice because of its relative ease of use.<br />
<br />
== CUPS Linux printing workflow ==<br />
As of {{Pkg|cups}} version 1.5.3-3, Arch Linux makes use of the new full pdf-based printing workflow. For<br />
further reading check [http://www.linuxfoundation.org/collaborate/workgroups/openprinting/pdfasstandardprintjobformat PDF standard printing job format] and an old [https://wiki.linuxfoundation.org/en/OpenPrinting/Database/CUPS-Filter-Chart CUPS filtering chart] for history and fun.<br />
A good starting point for general Linux printing questions is [http://www.linuxfoundation.org/collaborate/workgroups/openprinting here].<br />
<br />
There are two ways to setup a printer.<br />
* If there's a CUPS server running in your network and sharing a printer you only need to install the client package.<br />
* If the printer is connected directly to your system or you have access to an IPP network printer then setup a local CUPS server.<br />
<br />
== Installing the client package ==<br />
<br />
The package {{Pkg|libcups}} is the only required package. [[pacman|Install]] it from the [[official repositories]].<br />
<br />
Then add your CUPS server's IP address or hostname into {{ic|/etc/cups/client.conf}}. That is all you need. Every application should quickly find the printer(s) shared by that CUPS server.<br />
<br />
=== Optional advanced network setup ===<br />
<br />
It is also possible to run a entire cupsd+cups-browsed instance on your client with Avahi browsing enabled to discover unknown shared printers in your network. This can be useful in large setups where the server is unknown.<br />
{{Note|This behavior did not change with cups 1.6.x - the difference is that until 1.5.x cupsd was able to do printer browsing alone and now it can only browse its own shared printers.<br />
To get the local cupsd recognise other shared printers offered by a remote cupsd server you need a running local cups-browsed (supported since cups-filters 1.0.26) instance using Avahi to discover unknown printers. <br />
There is [https://bbs.archlinux.org/viewtopic.php?id&#61;161440 good news] in April 2013 (still has to be incorporated above).}}<br />
<br />
=== Installing CUPS a 32 bit chroot environment ===<br />
<br />
If you have a 64 bit base installation with a [[Install_bundled_32-bit_system_in_Arch64|32 bit chroot environment]], explicit installation of CUPS is not necessary in the 32 bit environment. To access installed CUPS printers from the chroot environment, one needs to bind the {{ic|/var/run/cups}} directory to the same relative location in the chroot environment. Simply create the directory in the chroot (it probably doesn't exist), mount (with {{ic|-o bind}} passed to the command}}, and printers should be available from 32 bit chroot applications immediately.<br />
<br />
{{bc|# mkdir /path/to/chroot/var/run/cups<br />
# Example: # mkdir /opt/arch32/var/run/cups<br />
<br />
# mount -o bind /var/run/cups /path/to/chroot/var/run/cups}}<br />
<br />
== Installing the server packages ==<br />
<br />
The following packages and some printer drivers are needed. [[pacman|Install]] them from the [[official repositories]].<br />
<br />
* {{Pkg|cups}} - the actual CUPS daemon<br />
* {{Pkg|cups-filters}} - essential filters<br />
* {{Pkg|ghostscript}} - (optional) PostScript interpreter<br />
* {{Pkg|gsfonts}} - GhostScript standard Type1 fonts<br />
<br />
If you want to enable printer browsing through your network, also install {{Pkg|avahi}}. Make sure '''avahi-daemon''' is started before '''cupsd'''.<br />
<br />
If the system is connected to a networked printer using the [[Samba]] protocol or if the system is to be a print server for Windows clients, also install {{Pkg|samba}}.<br />
<br />
=== Printer driver ===<br />
<br />
Here are some of the driver packages. Choosing the right driver depends on the printer:<br />
<br />
* '''{{Pkg|gutenprint}}''' - A collection of high quality drivers for Canon, Epson, Lexmark, Sony, Olympus, and PCL printers for use with GhostScript, CUPS, Foomatic, and the [[GIMP]]<br />
* '''{{Pkg|foomatic-db}}, {{Pkg|foomatic-db-engine}}, {{Pkg|foomatic-db-nonfree}}, and {{Pkg|foomatic-filters}}''' - Foomatic is a database-driven system for integrating free software printer drivers with common spoolers under Unix. Installing foomatic-filters should solve problems if the cups error_log is reporting "stopped with status 22!".<br />
* '''{{Pkg|hplip}}''' - HP drivers for DeskJet, OfficeJet, Photosmart, Business Inkjet and some LaserJet printer models, as well as a number of Brother printers.<br />
* '''{{Pkg|splix}}''' - Samsung drivers for SPL (Samsung Printer Language) printers.<br />
<br />
* '''{{AUR|foo2zjs}}''' - Drivers for ZjStream protocol printers such as the HP Laserjet 1018. More info [http://foo2zjs.rkkda.com here]. Package is available in the [[AUR]].<br />
* '''{{AUR|hpoj}}''' - If you are using an HP Officejet, you should also install this package and follow the instructions to avoid problems as in [https://answers.launchpad.net/hplip/+question/133425 this thread]. Package is available in the [[AUR]].<br />
* '''{{AUR|samsung-unified-driver}}''' - Unified Linux Driver for Samsung printers and scanners. Required for new printers such as the ML-2160. Package is available in the [[AUR]].<br />
* '''{{AUR|ufr2}}''' or '''{{AUR|cndrvcups-lb}}''' - Canon UFR2 driver with support for LBP, iR and MF series printers. Package is available in the [[AUR]].<br />
<br />
* '''{{Pkg|cups-pdf}}''' - A package that allows one to setup a virtual PDF Printer that generates a PDF out of jobs sent to it<br />
<br />
If you are not sure of what driver package to install or if the current driver is not working, it may be easiest to just install all of the drivers. Some of the package names are misleading because printers of other makes may rely on them. For example, the Brother HL-2140 needs the hplip driver installed.<br />
<br />
==== Download printer PPD ====<br />
<br />
Depending on the printer, this step is optional and may not be needed, as the standard CUPS installation already comes with quite a few PPD (Postscript Printer Description) files. Moreover, the ''foomatic-filters'', ''gimp-print'' and ''hplip'' packages already include quite a few PPD files which will automatically be detected by CUPS.<br />
<br />
Here is an explanation of what a PPD file is from the Linux Printing website:<br />
:"''For every PostScript printer the manufacturers provide a PPD file which contains all printer-specific information about the particular printer model: Basic printer capabilities as whether the printer is a color printer, fonts, PostScript level, etc., and especially the user-adjustable options, as paper size, resolution, etc.''"<br />
<br />
If the PPD for the printer is ''not'' already in CUPS, then:<br />
*check [[AUR]] to see if there are packages for the printer/manufacturer<br />
*visit the [http://www.openprinting.org/printers OpenPrinting database] and select the manufacturer and model of the printer<br />
*visit the manufacturer's site and search for GNU/Linux drivers<br />
<br />
{{Note|PPD files go in {{ic|/usr/share/cups/model/}}}}<br />
<br />
==== Another source for printer drivers ====<br />
<br />
[http://www.turboprint.de/english.html Turboprint] is a proprietary driver for many printers not yet supported by GNU/Linux (Canon i*, for example). Unlike CUPS, however, high quality prints are either marked with a watermark or are a pay-only service.<br />
<br />
== Hardware support and configuration ==<br />
<br />
=== USB printers ===<br />
<br />
{{Tip|Most USB printers should work out of the box, you can skip this section and come back if you can not get your printer to work.}}<br />
<br />
USB printers can get accessed with two methods: The usblp kernel module and libusb. The former is the classic way. It is simple: data is sent to the printer by writing it to a device file as a simple serial data stream. Reading the same device file allows bi-di access, at least for things like reading out ink levels, status, or printer capability information (PJL). It works very well for simple printers, but for multi-function devices (printer/scanner) it is not suitable and manufacturers like HP supply their own backends. Source: [http://lists.linuxfoundation.org/pipermail/printing-architecture/2012/002412.html here].<br />
<br />
==== Blacklisting usblp ====<br />
<br />
{{Warning|As of {{Pkg|cups}} version 1.6.0, you no longer need to [[Kernel modules#Blacklisting|blacklist]] the {{ic|usblp}} kernel module.<br />
<br />
If you find out this is the only way to fix a remaining issue please report this upstream to the CUPS bug tracker and maybe also get in contact with Till Kamppeter (Debian CUPS maintainer). See [http://cups.org/str.php?L4128 upstream bug] for more.}}<br />
<br />
If you have problems getting your USB printer to work, you can try blacklisting the {{ic|usblp}} [[kernel module]]:<br />
<br />
{{hc|/etc/modprobe.d/blacklistusblp.conf|<br />
blacklist usblp<br />
}}<br />
<br />
Custom kernel users may need to manually load the {{ic|usbcore}} [[kernel module]] before proceeding.<br />
<br />
Once the modules are installed, plug in the printer and check if the kernel detected it by running the following:<br />
# tail /var/log/messages.log<br />
or<br />
# dmesg<br />
<br />
If you're using {{ic|usblp}}, the output should indicate that the printer has been detected like so:<br />
Feb 19 20:17:11 kernel: printer.c: usblp0: USB Bidirectional<br />
printer dev 2 if 0 alt 0 proto 2 vid 0x04E8 pid 0x300E<br />
Feb 19 20:17:11 kernel: usb.c: usblp driver claimed interface cfef3920<br />
Feb 19 20:17:11 kernel: printer.c: v0.13: USB Printer Device Class driver<br />
<br />
If you blacklisted {{ic|usblp}}, you will see something like:<br />
usb 3-2: new full speed USB device using uhci_hcd and address 3<br />
usb 3-2: configuration #1 chosen from 1 choice<br />
<br />
=== Parallel port printers ===<br />
<br />
To use a parallel port printer, you will need to load the {{ic|lp}}, {{ic|parport}} and {{ic|parport_pc}} [[kernel modules]].<br />
<br />
Check the setup by running:<br />
# tail /var/log/messages.log<br />
It should display something like this:<br />
lp0: using parport0 (polling).<br />
<br />
If you are using a USB to parallel port adapter, CUPS will not be able to detect the printer. As a workaround, add the printer using a different connection type and then change DeviceID in {{ic|/etc/cups/printers.conf}}:<br />
DeviceID = parallel:/dev/usb/lp0<br />
<br />
=== HP Printer ===<br />
<br />
HP printers can also be installed via HP's Linux setup tool. Install it by installing {{Pkg|hplip}} from the [[official repositories]].<br />
<br />
To run with qt frontend:<br />
# hp-setup -u<br />
<br />
To run with command line:<br />
# hp-setup -i<br />
<br />
PPD files are in {{ic|/usr/share/ppd/HP/}}.<br />
<br />
For printers that require the proprietary HP plugin (like the Laserjet Pro P1102w), install the {{AUR|hplip-plugin}} package from [[AUR]].<br />
<br />
Important : {{Pkg|hplip}} depends on {{Pkg|foomatic-db-engine}} which prevents the drivers list from appearing when a printer is added to CUPS via the web user interface (following error : "Unable to get list of printer drivers"). The workaround consists in installing {{Pkg|hplip}} first, retrieve the corresponding PPD file from {{ic|/usr/share/ppd/HP/}}, then, remove entierly {{Pkg|hplip}} and the unecessary dependencies. Finally, install the printer manually with the PPD file (possible on the webui) then re-install {{Pkg|hplip}}. You should have after a reboot a fully working printer.<br />
<br />
== Configuring ==<br />
<br />
Now that CUPS is installed, there are a variety of options on how to set up printing solutions. As always, the tried and true command line method is at your disposal. CUPS also embeds a full-featured web interface. Likewise, various desktop environments such as GNOME and KDE have useful programs that can help manage printers. Depending on your needs, you may choose one method or the other.<br />
<br />
If you are planning on connecting to a network printer, rather than one that is directly connected to the computer, you might want to read the [[CUPS printer sharing]] page first. Printer sharing between GNU/Linux systems is quite easy and involves very little configuration, whereas sharing between a Windows and GNU/Linux host requires a little bit more effort.<br />
<br />
=== CUPS daemon ===<br />
<br />
With the kernel modules installed, you can now start the '''cups''' and optionally, the '''cups-browsed''' [[daemons]], and enable them as required.<br />
<br />
=== Web interface and tool-kit ===<br />
<br />
Once the daemon is running, open a browser and go to: http://localhost:631 (''The '''localhost''' string may need to be replaced with the hostname found in'' {{ic|/etc/hostname}}).<br />
<br />
From here, follow the various wizards to add the printer. A usual procedure is to start by clicking on ''Adding Printers and Classes'' and then ''Add Printer''. When prompted for a username and password, log in as root. The name assigned to the printer does not matter, the same applies for 'location' and 'description'. Next, a list of devices to select from will be presented. The actual name of the printer shows up next to the label (e.g., next to ''USB Printer #1'' for USB printers). Finally, choose the appropriate drivers and the configuration is complete.<br />
<br />
Now test the configuration by pressing the ''Maintenance'' drop-down menu then ''Print Test Page''. If it does not print and there is certainty regarding the correctness of applied settings, then the problem is most likely due to missing a proper printer driver.<br />
<br />
{{Tip|See: [[#Alternative CUPS interfaces]] for other other front-ends.}}<br />
{{Note|<br />
* When setting up a USB printer, you should see your printer listed on ''Add Printer'' page. If you can only see a "SCSI printer" option, it probably means that CUPS has failed to recognize your printer.<br />
* To enable wireless scanning on certain HP multi-function devices using the {{pkg|hplip}} package, you may need to add the printer as a Network Printer using the HTTP protocol. To determine the proper URI to use, run the {{ic|hp-makeuri}} command.}}<br />
<br />
==== CUPS administration ====<br />
<br />
A username and password will be required when administering the printer in the web interface, such as: adding or removing printers, stopping print tasks, etc. The default username is the one assigned in the ''sys'' group, or root. Other admin groups (e.g. lpadmin or printadmin) may be added to the {{ic|SystemGroup}} line in {{ic|/etc/cups/cups-files.conf}} (you might have to add this line). See [http://www.cups.org/articles.php?L237+T+Qprintadmin these instructions at cups.org]. You might also want to read [https://bbs.archlinux.org/viewtopic.php?id=35567 this post]. Create the group[s] ({{ic|man groupadd}}) and add the group[s] to users ({{ic|man usermod}}). cupsd must be restarted and the user must re-login for these changes to take affect.<br />
<br />
If the root account has been locked (i.e. when using sudo), it is not possible to log in the CUPS administration interface with the default username (root) and password. Follow the instructions above to add other users as cups administrators.<br />
<br />
==== Remote access to web interface ====<br />
<br />
By default, the CUPS web interface can only be accessed by the ''localhost''; i.e. the computer that it is installed on. To remotely access the interface, make the following changes to the {{ic|/etc/cups/cupsd.conf}} file. Replace the line:<br />
Listen localhost:631<br />
with<br />
Port 631<br />
so that CUPS listens to incoming requests.<br />
<br />
Three levels of access can be granted:<br />
<Location /> #access to the server<br />
<Location /admin> #access to the admin pages<br />
<Location /admin/conf> #access to configuration files<br />
<br />
To give remote hosts access to one of these levels, add an {{ic|Allow}} statement to that level's section. An {{ic|Allow}} statement can take one or more of the forms listed below:<br />
Allow from all<br />
Allow from host.domain.com<br />
Allow from *.domain.com<br />
Allow from ip-address<br />
Allow from ip-address/netmask<br />
<br />
Deny statements can also be used. For example, if wanting to give all hosts on the 192.168.1.0/255.255.255.0 subnet full access, file {{ic|/etc/cups/cupsd.conf}} would include this:<br />
# Restrict access to the server...<br />
# By default only localhost connections are possible<br />
<Location /><br />
Order allow,deny<br />
Allow from localhost<br />
'''Allow from 192.168.1.0/255.255.255.0'''<br />
</Location><br />
<br />
# Restrict access to the admin pages...<br />
<Location /admin><br />
# Encryption disabled by default<br />
#Encryption Required<br />
Order allow,deny<br />
Allow from localhost<br />
'''Allow from 192.168.1.0/255.255.255.0'''<br />
</Location><br />
<br />
# Restrict access to configuration files...<br />
<Location /admin/conf><br />
AuthType Basic<br />
Require user @SYSTEM<br />
Order allow,deny<br />
Allow From localhost<br />
'''Allow From 192.168.1.0/255.255.255.0'''<br />
</Location><br />
<br />
You might also need to add:<br />
<br />
DefaultEncryption Never<br />
<br />
This should avoid the error: 426 - Upgrade Required when using the CUPS web interface from a remote machine.<br />
<br />
=== Command-line configuration ===<br />
<br />
CUPS can be fully controlled from command-line with nice tools, ''i.e.'' the lp* and the cups* command families.<br />
<br />
On Arch Linux, most commands support auto-completion with common shells.<br />
Also note that command-line switches cannot be grouped.<br />
<br />
;List the devices<br />
# lpinfo -v<br />
<br />
;List the drivers<br />
# lpinfo -m<br />
<br />
;Add a new printer<br />
# lpadmin -p ''printer'' -E -v ''device'' -P ''ppd''<br />
<br />
The ''printer'' is up to you. The device can be retrieved from the 'lpinfo -i' command.<br />
Example:<br />
# lpadmin -p HP_DESKJET_940C -E -v "usb://HP/DESKJET%20940C?serial=CN16E6C364BH" -P /usr/share/ppd/HP/hp-deskjet_940c.ppd.gz<br />
<br />
In the following, the ''printer'' references the name you have used here to set up the printer.<br />
<br />
;Set the default printer<br />
$ lpoptions -d ''printer''<br />
<br />
;Check the status<br />
$ lpstat -s<br />
$ lpstat -p ''printer''<br />
<br />
;Deactivate a printer<br />
# cupsdisable ''printer''<br />
<br />
;Activate a printer<br />
# cupsenable ''printer''<br />
<br />
;Remove a printer<br />
First set it to reject all incoming entries:<br />
# cupsreject ''printer''<br />
Then disable it.<br />
# cupsdisable ''printer''<br />
Finally remove it.<br />
# lpadmin -x ''printer''<br />
<br />
;Print a file<br />
$ lpr ''file''<br />
$ lpr -# 17 ''file'' # print the file 17 times<br />
$ echo "Hello, world!" | lpr -p # print the result of a command. The -p switch adds a header.<br />
<br />
;Check the printing queue<br />
$ lpq<br />
$ lpq -a # on all printers<br />
<br />
;Clear the printing queue<br />
# lprm # remove last entry only<br />
# lprm - # remove all entries<br />
<br />
=== Alternative CUPS interfaces ===<br />
<br />
==== GNOME ====<br />
<br />
You can configure and manage printers by [[pacman|installing]] {{Pkg|system-config-printer}}. This program does pull in some gnome dependencies.<br />
<br />
If your user does not have sufficient priviliges to administer the cups scheduler, system-config-printer will request the root password when it starts. You can avoid this by performing the following instructions.<br />
<br />
1. Create a group for administering the cups scheduler:<br />
<br />
# groupadd lpadmin<br />
<br />
2. Add yourself to the newly created group:<br />
<br />
# usermod -aG lpadmin ''username''<br />
<br />
3. Tell cups to respect the newly created group:<br />
<br />
{{hc|/etc/cups/cups-files.conf|<br />
...<br />
SystemGroup sys root '''lpadmin'''<br />
...}}<br />
<br />
4. Restart cups:<br />
<br />
# systemctl restart cupsd<br />
<br />
5. Log out and log in again or restart your computer.<br />
<br />
==== KDE ====<br />
<br />
[[KDE]] users can modify their printers from the Control Center. Both should refer to those desktop environments' documentation for more information on how to use the interfaces.<br />
<br />
==== Other ====<br />
<br />
There is also {{AUR|gtklp}} in the [[AUR]].<br />
<br />
== PDF virtual printer ==<br />
<br />
{{Pkg|cups-pdf}} is a nice package that allows one to setup a virtual printer that will generate a PDF from anything sent to it. This package is not necessary, but it can be quite useful.<br />
<br />
After installing the package, set it up as if it were for any other printer by using the web interface. Access the cups print manager: http://localhost:631 and select:<br />
Administration -> Add Printer<br />
Select CUPS-PDF (Virtual PDF), choose for the make and driver:<br />
Make: Generic<br />
Driver: Generic CUPS-PDF Printer<br />
<br />
Find generated PDF documents in a sub-directory located at {{ic|/var/spool/cups-pdf}}. Normally, the subdirectory is named after the user who performed the job. A little tweak helps you to find your printed PDF documents more easily. Edit {{ic|/etc/cups/cups-pdf.conf}} by changing the line<br />
#Out /var/spool/cups-pdf/${USER}<br />
<br />
to<br />
<br />
Out ${HOME}<br />
<br />
=== Print to PostScript ===<br />
<br />
The CUPS-PDF (Virtual PDF Printer) actually creates a PostScript file and then creates the PDF using the ps2pdf utility. To print to PostScript, just print as usual, in the print dialog choose "CUPS-PDF" as the printer, then select the checkbox for "print to file", hit print, enter the filename.ps and click save. This is handy for faxes, etc...<br />
<br />
== Troubleshooting ==<br />
<br />
The best way to get printing working is to set 'LogLevel' in {{ic|/etc/cups/cupsd.conf}} to:<br />
LogLevel debug<br />
<br />
And then viewing the output from {{ic|/var/log/cups/error_log}} like this:<br />
# tail -n 100 -f /var/log/cups/error_log<br />
<br />
The characters at the left of the output stand for:<br />
*D=Debug<br />
*E=Error<br />
*I=Information<br />
*And so on<br />
<br />
These files may also prove useful:<br />
*{{ic|/var/log/cups/page_log}} - Echoes a new entry each time a print is successful<br />
*{{ic|/var/log/cups/access_log}} - Lists all cupsd http1.1 server activity<br />
<br />
Of course, it is important to know how CUPS works if wanting to solve related issues:<br />
# An application sends a .ps file (PostScript, a script language that details how the page will look) to CUPS when 'print' has been selected (this is the case with most programs).<br />
# CUPS then looks at the printer's PPD file (printer description file) and figures out what filters it needs to use to convert the .ps file to a language that the printer understands (like PJL, PCL), usually GhostScript.<br />
# GhostScript takes the input and figures out which filters it should use, then applies them and converts the .ps file to a format understood by the printer.<br />
# Then it is sent to the back-end. For example, if the printer is connected to a USB port, it uses the USB back-end.<br />
<br />
Print a document and watch {{ic|error_log}} to get a more detailed and correct image of the printing process.<br />
<br />
=== Problems resulting from upgrades ===<br />
<br />
''Issues that appeared after CUPS and related program packages underwent a version increment''<br />
<br />
==== CUPS stops working ====<br />
<br />
The chances are that a new configuration file is needed for the new version to work properly. Messages such as "404 - page not found" may result from trying to manage CUPS via localhost:631, for example.<br />
<br />
To use the new configuration, copy {{ic|/etc/cups/cupsd.conf.default}} to {{ic|/etc/cups/cupsd.conf}} (backup the old configuration if needed) and restart CUPS to employ the new settings.<br />
<br />
==== All jobs are "stopped" ====<br />
<br />
If all jobs sent to the printer become "stopped", delete the printer and add it again.<br />
Using the [http://localhost:631 CUPS web interface], go to Printers > Delete Printer.<br />
<br />
To check the printer's settings go to ''Printers'', then ''Modify Printer''. Copy down the information displayed, click 'Modify Printer' to proceed to the next page(s), and so on.<br />
<br />
==== All jobs are "The printer is not responding" ====<br />
<br />
On networked printers, you should check that the name that CUPS uses as its connection URI resolves to the printer's IP via DNS, e.g.<br />
If your printer's connection looks like this:<br />
lpd://BRN_020554/BINARY_P1<br />
<br />
then the hostname 'BRN_020554' needs to resolve to the printer's IP from the server running CUPS<br />
<br />
==== The PPD version is not compatible with gutenprint ====<br />
<br />
Run:<br />
# /usr/bin/cups-genppdupdate<br />
<br />
And restart CUPS (as pointed out in gutenprint's post-install message)<br />
<br />
=== Other ===<br />
<br />
===== CUPS permission errors =====<br />
<br />
* Some users fixed 'NT_STATUS_ACCESS_DENIED' (Windows clients) errors by using a slightly different syntax:<br />
smb://workgroup/username:password@hostname/printer_name<br />
<br />
* Sometimes, the block device has wrong permissions:<br />
# ls /dev/usb/<br />
lp0<br />
# chgrp lp /dev/usb/lp0<br />
<br />
==== HPLIP printer sends "/usr/lib/cups/backend/hp failed" error ====<br />
<br />
Make sure dbus is installed and running. If the error persists, try starting avahi-daemon.<br />
<br />
Try adding the printer as a Network Printer using the http:// protocol. Generate the printer URI with {{ic|hp-makeuri}}.<br />
<br />
{{Note|There might need to set permissions issues right. Follow indications here: [[CUPS#Device node permissions]].}}<br />
<br />
==== HPLIP printer claims job is complete but printer does nothing ====<br />
<br />
This happens on HP printers when you select the (old) hpijs driver (e.g. the Deskjet D1600 series). Instead, use the hpcups driver when adding the printer.<br />
<br />
Some HP printers (e.g HP LaserJet) require their firmware to be downloaded from the computer every time the printer is switched on. If there is an issue with udev (or equivalent) and the firmware download rule is never fired, you may experience this issue.<br />
As a workaround, you can manually download the firmware to the printer. Ensure the printer is plugged in and switched on, then enter<br />
hp-firmware -n<br />
<br />
==== hp-setup asks to specify the PPD file for the discovered printer ====<br />
<br />
Install CUPS before running hp-setup.<br />
<br />
==== I have installed Qt, but hp-setup reports "Qt/PyQt 4 initialization failed" ====<br />
<br />
"hp-check -t" won't give you useful information to find the required package. You have to install all the "Dependent Packages" prefixed with "python2" in https://www.archlinux.org/packages/extra/x86_64/hplip/<br />
<br />
==== hp-setup finds the printer automatically but reports "Unable to communicate with device" when printing test page immediately afterwards ====<br />
<br />
This at least happens to hplip 3.13.5-2 for HP Officejet 6500A through local network connection. To solve the problem, specify the IP address of the HP printer for hp-setup to locate the printer.<br />
<br />
==== hp-toolbox sends an error, "Unable to communicate with device" ====<br />
<br />
If running hp-toolbox as a regular user results in:<br />
# hp-toolbox<br />
# error: Unable to communicate with device (code=12): hp:/usb/''printer id''<br />
or, "{{ic|Unable to communicate with device"}}", then it may be needed to [[Groups#Group management|add the user to the lp and sys groups]].<br />
<br />
This can also be caused by printers such as the P1102 that provide a virtual cd-rom drive for MS-Windows drivers. The lp dev appears and then disappears. In that case try the '''usb-modeswitch''' and '''usb-modeswitch-data''' packages, that lets one switch off the "Smart Drive" (udev rules included in said packages).<br />
<br />
This can also occur with network attached printers if the [[Avahi|avahi-daemon]] is not running. Another possiblility is the specification of the printer's IP address in hp-setup fails to locate the printer because the IP address of the the printer changed due to DHCP.<br />
<br />
==== CUPS returns '"foomatic-rip" not available/stopped with status 3' with a HP printer ====<br />
<br />
If receiving any of the following error messages in {{ic|/var/log/cups/error_log}} while using a HP printer, with jobs appearing to be processed while they all end up not being completed with their status set to 'stopped':<br />
Filter "foomatic-rip" for printer ''printer_name'' not available: No such file or director<br />
or:<br />
PID 5771 (/usr/lib/cups/filter/foomatic-rip) stopped with status 3!<br />
make sure {{pkg|hplip}} has been [[pacman|installed]], in addition to [[#Packages|the packages mentioned above]]. See [https://bbs.archlinux.org/viewtopic.php?id=65615 this forum post] for more information.<br />
<br />
==== Printing fails with unauthorised error ====<br />
<br />
If the user has been added to the lp group, and allowed to print (set in {{ic|cupsd.conf}}), then the problem lies in {{ic|/etc/cups/printers.conf}}. This line could be the culprit:<br />
AuthInfoRequired negotiate<br />
<br />
Comment it out and restart CUPS.<br />
<br />
==== Print button greyed-out in GNOME print dialogs ====<br />
<br />
:''<small>Source: [https://bbs.archlinux.org/viewtopic.php?id=70418 I can't print from gnome applications. - Arch Forums]</small>''<br />
<br />
Be sure the package: '''libgnomeprint''' is installed<br />
<br />
Edit {{ic|/etc/cups/cupsd.conf}} and add:<br />
# HostNameLookups Double<br />
<br />
Restart cups.service.<br />
<br />
==== Unknown supported format: application/postscript ====<br />
<br />
Comment the lines:<br />
application/octet-stream application/vnd.cups-raw 0 -<br />
from {{ic|/etc/cups/mime.convs}}, and:<br />
application/octet-stream<br />
in {{ic|/etc/cups/mime.types}}.<br />
<br />
==== Finding URIs for Windows print servers ====<br />
<br />
Sometimes Windows is a little less than forthcoming about exact device URIs (device locations). If having trouble specifying the correct device location in CUPS, run the following command to list all shares available to a certain windows username:<br />
$ smbtree -U ''windowsusername''<br />
This will list every share available to a certain Windows username on the local area network subnet, as long as Samba is set up and running properly. It should return something like this:<br />
{{bc| WORKGROUP<br />
\\REGULATOR-PC <br />
\\REGULATOR-PC\Z <br />
\\REGULATOR-PC\Public <br />
\\REGULATOR-PC\print$ Printer Drivers<br />
\\REGULATOR-PC\G <br />
\\REGULATOR-PC\EPSON Stylus CX8400 Series EPSON Stylus CX8400 Series}}<br />
What is needed here is first part of the last line, the resource matching the printer description. So to print to the EPSON Stylus printer, one would enter:<br />
smb://username.password@REGULATOR-PC/EPSON Stylus CX8400 Series<br />
as the URI into CUPS. Notice that whitespaces are allowed in URIs, whereas backslashes get replaced with forward slashes.<br />
If it won't work try '%20' instead of spaces.<br />
<br />
==== Print-Job client-error-document-format-not-supported ====<br />
<br />
Try installing the foomatic packages and use a foomatic driver.<br />
<br />
==== /usr/lib/cups/backend/hp failed ====<br />
<br />
Change:<br />
SystemGroup sys root<br />
to:<br />
SystemGroup lp root<br />
in {{ic|/etc/cups/cupsd.conf}}<br />
<br />
<br />
Following steps 1-3 in the Alternative CUPS interfaces below may be a better solution, since newer versions of cups will not allow the same group for both normal and admin operation.<br />
<br />
==== Unable to get list of printer drivers ====<br />
<br />
* Check your ServerName in /etc/cups/client.conf is written without http://<br />
ServerName localhost:631<br />
* Try to remove Foomatic drivers.<br />
<br />
==== lp: Error - Scheduler Not Responding ====<br />
<br />
If you get this error when printing a document using:<br />
<br />
$ lp document-to-print<br />
<br />
Try setting the CUPS_SERVER environment variable:<br />
<br />
$ export CUPS_SERVER=localhost<br />
<br />
If this solves your problem, make the solution permanent by adding the export line above to ~/.bash_profile.<br />
<br />
==== CUPS prints only an empty and an error-message page on HP LaserJet ====<br />
<br />
There is a bug that causes CUPS to fail when printing images on HP LaserJet (in my case 3380). The bug has been reported and fixed by [https://bugs.launchpad.net/ubuntu/+source/cups-filters/+bug/998087 Ubuntu].<br />
The first page is empty, the second page contains the following error message:<br />
ERROR:<br />
invalidaccess<br />
OFFENDING COMMAND:<br />
filter<br />
STACK:<br />
/SubFileDecode<br />
endstream<br />
...<br />
<br />
In order to fix the issue, use the following command (as superuser):<br />
lpadmin -p ''printer'' -o pdftops-renderer-default=pdftops<br />
<br />
==== "Using invalid Host" error message ====<br />
<br />
Try to add "ServerAlias *" into cupsd.conf<br />
<br />
==== Printer doesn't print with an "Filter failed" message on CUPS web interface (HP printer) ====<br />
<br />
Change the permissions of the printer USB port:<br />
<br />
Get the bus and device number from lsusb, then set the permission using:<br />
<br />
chmod 0666 /dev/bus/usb/''bus number''/''device number''<br />
<br />
To make the persistent permission change that will be triggered automatically each time the computer is rebooted, add the following line.<br />
<br />
{{hc|/etc/udev/rules.d/10-local.rules|2=<br />
SUBSYSTEM=="usb", ATTRS{idVendor}=="Printer_idVendor", ATTRS{idProduct}=="Printer_idProduct", GROUP="lp", MODE:="666"<br />
}}<br />
<br />
Obtain the right information by using {{ic|lsusb}} command, and don't forget to substitute {{ic|Printer_idVendor}} & {{ic|Printer_idProduct}} with the relevant ones.<br />
<br />
Each system may vary, so consult [[udev#List_attributes_of_a_device]] wiki page.<br />
<br />
==== Printer doesn't print with an "Filter failed" message on CUPS web interface (HP printer connected over network) ====<br />
<br />
Start, enable and restart the avahi-daemon.<br />
<br />
==== HPLIP 3.13: Plugin is installed, but HP Device Manager complains it is not ====<br />
<br />
The issue might have to do with the file permission change that had been made to {{ic|/var/lib/hp/hplip.state}}. To correct the issue, a simple {{ic|chmod 644 /var/lib/hp/hplip.state}} and {{ic|chmod 755 /var/lib/hp}} should be sufficient. For further information, please read this [https://bugs.launchpad.net/hplip/+bug/1131596 link].<br />
<br />
==== Printer is not recognized by CUPS ====<br />
<br />
If your printer is not listed in the "Add Printers" page of the CUPS web interface, nor by lpinfo -v, try the following (suggested in [https://bbs.archlinux.org/viewtopic.php?pid=1037279#p1037279 this thread]):<br />
<br />
* Remove {{ic|usblp}} from blacklist<br />
* Load {{ic|usblp}} module<br />
modprobe usblp<br />
* Stop cups<br />
* Add the following udev rule in a new rule file:<br />
{{hc|/etc/udev/rules.d/10-cups_device_link.rules|2=<br />
KERNEL=="lp[0-9]", SYMLINK+="%k", GROUP="lp"<br />
}}<br />
* Reload udev rules:<br />
# udevadm control --reload-rules<br />
* Unplug and re-plug the printer.<br />
* Wait a few seconds and then start cups again.<br />
<br />
==== Can't load /etc/samba/smb.conf ====<br />
<br />
If you're printing to a remote printer over SMB and get this error message: "Can't load /etc/samba/smb.conf - run testparm to debug it", then create an empty smb.conf:<br />
<br />
# mkdir /etc/samba<br />
# touch /etc/samba/smb.conf<br />
<br />
and restart cupsd.<br />
<br />
==== CUPS' systemd service does not start even though it's enabled ====<br />
<br />
The systemd .service file provided by CUPS uses socket activation, meaning the service is only started when an<br />
application connects to CUPS' socket. However, the systemd .socket file provided by cups only works for the local <br />
{{ic|/var/run/cups/cups.sock}} socket. <br />
<br />
In order to have cupsd start when initiating a print job over the network, create the following file:<br />
<br />
{{hc|/etc/systemd/system/cups.socket|<br />
.include /usr/lib/systemd/system/cups.socket<br />
<br />
[Socket]<br />
ListenStream&#61;0.0.0.0:631<br />
ListenDatagram&#61;0.0.0.0:631<br />
BindIPv6Only&#61;ipv6-only<br />
}}<br />
<br />
Then reload systemd:<br />
<br />
# systemctl --system daemon-reload<br />
<br />
Confirm that everything is working correctly:<br />
<br />
{{bc|<br />
# systemctl is-enabled cups.service &#124;&#124; systemctl enable cups.service<br />
# systemctl status cups.socket<br />
cups.socket - CUPS Printing Service Sockets<br />
Loaded: loaded (/etc/systemd/system/cups.socket; enabled)<br />
Active: inactive (dead)<br />
Listen: /var/run/cups/cups.sock (Stream)<br />
0.0.0.0:631 (Stream)<br />
0.0.0.0:631 (Datagram)<br />
}}<br />
<br />
CUPS should now start automatically when printing locally or over the network.<br />
<br />
== See also ==<br />
<br />
* [http://localhost:631/documentation.html Official CUPS documentation], ''locally installed''<br />
* [http://www.cups.org/ Official CUPS website]<br />
* [http://www.linuxprinting.org/ Linux Printing], ''[http://www.linuxfoundation.org The Linux Foundation]''<br />
* [http://www.gentoo.org/doc/en/printing-howto.xml Gentoo's printing guide], ''[http://www.gentoo.org/doc/en Gentoo Documentation resources]''<br />
* [https://bbs.archlinux.org/ Arch Linux user forums]<br />
* [http://wiki.gotux.net/tutorials/software/hp-printer Install HP printers easy way]</div>SilverWyrdahttps://wiki.archlinux.org/index.php?title=CUPS&diff=274394CUPS2013-09-05T04:04:07Z<p>SilverWyrda: /* HP Printer */</p>
<hr />
<div>[[Category:Printers]]<br />
[[cs:CUPS]]<br />
[[es:CUPS]]<br />
[[fr:CUPS]]<br />
[[it:CUPS]]<br />
[[pl:CUPS]]<br />
[[ru:CUPS]]<br />
[[th:CUPS]]<br />
[[tr:CUPS]]<br />
[[zh-CN:CUPS]]<br />
[[zh-TW:CUPS]]<br />
{{Article summary start|Summary}}<br />
{{Article summary text|Installing and configuring CUPS}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|CUPS printer sharing}}<br />
{{Article summary wiki|CUPS printer-specific problems}}<br />
{{Article summary wiki|Samba}}<br />
{{Article summary end}}<br />
<br />
From [http://www.cups.org/index.php CUPS' site]:<br />
:"''[[Wikipedia:CUPS|CUPS]] is the standards-based, open source printing system developed by Apple Inc. for OS® X and other UNIX®-like operating systems''".<br />
<br />
Although there are other printing packages such as LPRNG, the Common Unix Printing System is the most popular choice because of its relative ease of use.<br />
<br />
== CUPS Linux printing workflow ==<br />
As of {{Pkg|cups}} version 1.5.3-3, Arch Linux makes use of the new full pdf-based printing workflow. For<br />
further reading check [http://www.linuxfoundation.org/collaborate/workgroups/openprinting/pdfasstandardprintjobformat PDF standard printing job format] and an old [https://wiki.linuxfoundation.org/en/OpenPrinting/Database/CUPS-Filter-Chart CUPS filtering chart] for history and fun.<br />
A good starting point for general Linux printing questions is [http://www.linuxfoundation.org/collaborate/workgroups/openprinting here].<br />
<br />
There are two ways to setup a printer.<br />
* If there's a CUPS server running in your network and sharing a printer you only need to install the client package.<br />
* If the printer is connected directly to your system or you have access to an IPP network printer then setup a local CUPS server.<br />
<br />
== Installing the client package ==<br />
<br />
The package {{Pkg|libcups}} is the only required package. [[pacman|Install]] it from the [[official repositories]].<br />
<br />
Then add your CUPS server's IP address or hostname into {{ic|/etc/cups/client.conf}}. That is all you need. Every application should quickly find the printer(s) shared by that CUPS server.<br />
<br />
=== Optional advanced network setup ===<br />
<br />
It is also possible to run a entire cupsd+cups-browsed instance on your client with Avahi browsing enabled to discover unknown shared printers in your network. This can be useful in large setups where the server is unknown.<br />
{{Note|This behavior did not change with cups 1.6.x - the difference is that until 1.5.x cupsd was able to do printer browsing alone and now it can only browse its own shared printers.<br />
To get the local cupsd recognise other shared printers offered by a remote cupsd server you need a running local cups-browsed (supported since cups-filters 1.0.26) instance using Avahi to discover unknown printers. <br />
There is [https://bbs.archlinux.org/viewtopic.php?id&#61;161440 good news] in April 2013 (still has to be incorporated above).}}<br />
<br />
=== Installing CUPS a 32 bit chroot environment ===<br />
<br />
If you have a 64 bit base installation with a [[Install_bundled_32-bit_system_in_Arch64|32 bit chroot environment]], explicit installation of CUPS is not necessary in the 32 bit environment. To access installed CUPS printers from the chroot environment, one needs to bind the {{ic|/var/run/cups}} directory to the same relative location in the chroot environment. Simply create the directory in the chroot (it probably doesn't exist), mount (with {{ic|-o bind}} passed to the command}}, and printers should be available from 32 bit chroot applications immediately.<br />
<br />
{{bc|# mkdir /path/to/chroot/var/run/cups<br />
# Example: # mkdir /opt/arch32/var/run/cups<br />
<br />
# mount -o bind /var/run/cups /path/to/chroot/var/run/cups}}<br />
<br />
== Installing the server packages ==<br />
<br />
The following packages and some printer drivers are needed. [[pacman|Install]] them from the [[official repositories]].<br />
<br />
* {{Pkg|cups}} - the actual CUPS daemon<br />
* {{Pkg|cups-filters}} - essential filters<br />
* {{Pkg|ghostscript}} - (optional) PostScript interpreter<br />
* {{Pkg|gsfonts}} - GhostScript standard Type1 fonts<br />
<br />
If you want to enable printer browsing through your network, also install {{Pkg|avahi}}. Make sure '''avahi-daemon''' is started before '''cupsd'''.<br />
<br />
If the system is connected to a networked printer using the [[Samba]] protocol or if the system is to be a print server for Windows clients, also install {{Pkg|samba}}.<br />
<br />
=== Printer driver ===<br />
<br />
Here are some of the driver packages. Choosing the right driver depends on the printer:<br />
<br />
* '''{{Pkg|gutenprint}}''' - A collection of high quality drivers for Canon, Epson, Lexmark, Sony, Olympus, and PCL printers for use with GhostScript, CUPS, Foomatic, and the [[GIMP]]<br />
* '''{{Pkg|foomatic-db}}, {{Pkg|foomatic-db-engine}}, {{Pkg|foomatic-db-nonfree}}, and {{Pkg|foomatic-filters}}''' - Foomatic is a database-driven system for integrating free software printer drivers with common spoolers under Unix. Installing foomatic-filters should solve problems if the cups error_log is reporting "stopped with status 22!".<br />
* '''{{Pkg|hplip}}''' - HP drivers for DeskJet, OfficeJet, Photosmart, Business Inkjet and some LaserJet printer models, as well as a number of Brother printers.<br />
* '''{{Pkg|splix}}''' - Samsung drivers for SPL (Samsung Printer Language) printers.<br />
<br />
* '''{{AUR|foo2zjs}}''' - Drivers for ZjStream protocol printers such as the HP Laserjet 1018. More info [http://foo2zjs.rkkda.com here]. Package is available in the [[AUR]].<br />
* '''{{AUR|hpoj}}''' - If you are using an HP Officejet, you should also install this package and follow the instructions to avoid problems as in [https://answers.launchpad.net/hplip/+question/133425 this thread]. Package is available in the [[AUR]].<br />
* '''{{AUR|samsung-unified-driver}}''' - Unified Linux Driver for Samsung printers and scanners. Required for new printers such as the ML-2160. Package is available in the [[AUR]].<br />
* '''{{AUR|ufr2}}''' or '''{{AUR|cndrvcups-lb}}''' - Canon UFR2 driver with support for LBP, iR and MF series printers. Package is available in the [[AUR]].<br />
<br />
* '''{{Pkg|cups-pdf}}''' - A package that allows one to setup a virtual PDF Printer that generates a PDF out of jobs sent to it<br />
<br />
If you are not sure of what driver package to install or if the current driver is not working, it may be easiest to just install all of the drivers. Some of the package names are misleading because printers of other makes may rely on them. For example, the Brother HL-2140 needs the hplip driver installed.<br />
<br />
==== Download printer PPD ====<br />
<br />
Depending on the printer, this step is optional and may not be needed, as the standard CUPS installation already comes with quite a few PPD (Postscript Printer Description) files. Moreover, the ''foomatic-filters'', ''gimp-print'' and ''hplip'' packages already include quite a few PPD files which will automatically be detected by CUPS.<br />
<br />
Here is an explanation of what a PPD file is from the Linux Printing website:<br />
:"''For every PostScript printer the manufacturers provide a PPD file which contains all printer-specific information about the particular printer model: Basic printer capabilities as whether the printer is a color printer, fonts, PostScript level, etc., and especially the user-adjustable options, as paper size, resolution, etc.''"<br />
<br />
If the PPD for the printer is ''not'' already in CUPS, then:<br />
*check [[AUR]] to see if there are packages for the printer/manufacturer<br />
*visit the [http://www.openprinting.org/printers OpenPrinting database] and select the manufacturer and model of the printer<br />
*visit the manufacturer's site and search for GNU/Linux drivers<br />
<br />
{{Note|PPD files go in {{ic|/usr/share/cups/model/}}}}<br />
<br />
==== Another source for printer drivers ====<br />
<br />
[http://www.turboprint.de/english.html Turboprint] is a proprietary driver for many printers not yet supported by GNU/Linux (Canon i*, for example). Unlike CUPS, however, high quality prints are either marked with a watermark or are a pay-only service.<br />
<br />
== Hardware support and configuration ==<br />
<br />
=== USB printers ===<br />
<br />
{{Tip|Most USB printers should work out of the box, you can skip this section and come back if you can not get your printer to work.}}<br />
<br />
USB printers can get accessed with two methods: The usblp kernel module and libusb. The former is the classic way. It is simple: data is sent to the printer by writing it to a device file as a simple serial data stream. Reading the same device file allows bi-di access, at least for things like reading out ink levels, status, or printer capability information (PJL). It works very well for simple printers, but for multi-function devices (printer/scanner) it is not suitable and manufacturers like HP supply their own backends. Source: [http://lists.linuxfoundation.org/pipermail/printing-architecture/2012/002412.html here].<br />
<br />
==== Blacklisting usblp ====<br />
<br />
{{Warning|As of {{Pkg|cups}} version 1.6.0, you no longer need to [[Kernel modules#Blacklisting|blacklist]] the {{ic|usblp}} kernel module.<br />
<br />
If you find out this is the only way to fix a remaining issue please report this upstream to the CUPS bug tracker and maybe also get in contact with Till Kamppeter (Debian CUPS maintainer). See [http://cups.org/str.php?L4128 upstream bug] for more.}}<br />
<br />
If you have problems getting your USB printer to work, you can try blacklisting the {{ic|usblp}} [[kernel module]]:<br />
<br />
{{hc|/etc/modprobe.d/blacklistusblp.conf|<br />
blacklist usblp<br />
}}<br />
<br />
Custom kernel users may need to manually load the {{ic|usbcore}} [[kernel module]] before proceeding.<br />
<br />
Once the modules are installed, plug in the printer and check if the kernel detected it by running the following:<br />
# tail /var/log/messages.log<br />
or<br />
# dmesg<br />
<br />
If you're using {{ic|usblp}}, the output should indicate that the printer has been detected like so:<br />
Feb 19 20:17:11 kernel: printer.c: usblp0: USB Bidirectional<br />
printer dev 2 if 0 alt 0 proto 2 vid 0x04E8 pid 0x300E<br />
Feb 19 20:17:11 kernel: usb.c: usblp driver claimed interface cfef3920<br />
Feb 19 20:17:11 kernel: printer.c: v0.13: USB Printer Device Class driver<br />
<br />
If you blacklisted {{ic|usblp}}, you will see something like:<br />
usb 3-2: new full speed USB device using uhci_hcd and address 3<br />
usb 3-2: configuration #1 chosen from 1 choice<br />
<br />
=== Parallel port printers ===<br />
<br />
To use a parallel port printer, you will need to load the {{ic|lp}}, {{ic|parport}} and {{ic|parport_pc}} [[kernel modules]].<br />
<br />
Check the setup by running:<br />
# tail /var/log/messages.log<br />
It should display something like this:<br />
lp0: using parport0 (polling).<br />
<br />
If you are using a USB to parallel port adapter, CUPS will not be able to detect the printer. As a workaround, add the printer using a different connection type and then change DeviceID in {{ic|/etc/cups/printers.conf}}:<br />
DeviceID = parallel:/dev/usb/lp0<br />
<br />
=== HP Printer ===<br />
<br />
HP printers can also be installed via HP's Linux setup tool. Install it by installing {{Pkg|hplip}} from the [[official repositories]].<br />
<br />
To run with qt frontend:<br />
# hp-setup -u<br />
<br />
To run with command line:<br />
# hp-setup -i<br />
<br />
PPD files are in {{ic|/usr/share/ppd/HP/}}.<br />
<br />
For printers that require the proprietary HP plugin (like the Laserjet Pro P1102w), install the {{AUR|hplip-plugin}} package from [[AUR]].<br />
<br />
Important : {{Pkg|hplip}} depends on {{Pkg|foomatic-db-engine}} which prevents the drivers list from appearing when a printer is added to CUPS via the web user interface (following error : "Unable to get list of printer drivers"). The workaround consists in installing {{Pkg|hplip}} first, retrieve the corresponding PPD file from {{ic|/usr/share/ppd/HP/}}, then, remove entierly {{Pkg|hplip}} and the unecessary dependencies. Finally, install the printer with the PPD file then re-install {{Pkg|hplip}}. You should have after a reboot a fully working printer.<br />
<br />
== Configuring ==<br />
<br />
Now that CUPS is installed, there are a variety of options on how to set up printing solutions. As always, the tried and true command line method is at your disposal. CUPS also embeds a full-featured web interface. Likewise, various desktop environments such as GNOME and KDE have useful programs that can help manage printers. Depending on your needs, you may choose one method or the other.<br />
<br />
If you are planning on connecting to a network printer, rather than one that is directly connected to the computer, you might want to read the [[CUPS printer sharing]] page first. Printer sharing between GNU/Linux systems is quite easy and involves very little configuration, whereas sharing between a Windows and GNU/Linux host requires a little bit more effort.<br />
<br />
=== CUPS daemon ===<br />
<br />
With the kernel modules installed, you can now start the '''cups''' and optionally, the '''cups-browsed''' [[daemons]], and enable them as required.<br />
<br />
=== Web interface and tool-kit ===<br />
<br />
Once the daemon is running, open a browser and go to: http://localhost:631 (''The '''localhost''' string may need to be replaced with the hostname found in'' {{ic|/etc/hostname}}).<br />
<br />
From here, follow the various wizards to add the printer. A usual procedure is to start by clicking on ''Adding Printers and Classes'' and then ''Add Printer''. When prompted for a username and password, log in as root. The name assigned to the printer does not matter, the same applies for 'location' and 'description'. Next, a list of devices to select from will be presented. The actual name of the printer shows up next to the label (e.g., next to ''USB Printer #1'' for USB printers). Finally, choose the appropriate drivers and the configuration is complete.<br />
<br />
Now test the configuration by pressing the ''Maintenance'' drop-down menu then ''Print Test Page''. If it does not print and there is certainty regarding the correctness of applied settings, then the problem is most likely due to missing a proper printer driver.<br />
<br />
{{Tip|See: [[#Alternative CUPS interfaces]] for other other front-ends.}}<br />
{{Note|<br />
* When setting up a USB printer, you should see your printer listed on ''Add Printer'' page. If you can only see a "SCSI printer" option, it probably means that CUPS has failed to recognize your printer.<br />
* To enable wireless scanning on certain HP multi-function devices using the {{pkg|hplip}} package, you may need to add the printer as a Network Printer using the HTTP protocol. To determine the proper URI to use, run the {{ic|hp-makeuri}} command.}}<br />
<br />
==== CUPS administration ====<br />
<br />
A username and password will be required when administering the printer in the web interface, such as: adding or removing printers, stopping print tasks, etc. The default username is the one assigned in the ''sys'' group, or root. Other admin groups (e.g. lpadmin or printadmin) may be added to the {{ic|SystemGroup}} line in {{ic|/etc/cups/cups-files.conf}} (you might have to add this line). See [http://www.cups.org/articles.php?L237+T+Qprintadmin these instructions at cups.org]. You might also want to read [https://bbs.archlinux.org/viewtopic.php?id=35567 this post]. Create the group[s] ({{ic|man groupadd}}) and add the group[s] to users ({{ic|man usermod}}). cupsd must be restarted and the user must re-login for these changes to take affect.<br />
<br />
If the root account has been locked (i.e. when using sudo), it is not possible to log in the CUPS administration interface with the default username (root) and password. Follow the instructions above to add other users as cups administrators.<br />
<br />
==== Remote access to web interface ====<br />
<br />
By default, the CUPS web interface can only be accessed by the ''localhost''; i.e. the computer that it is installed on. To remotely access the interface, make the following changes to the {{ic|/etc/cups/cupsd.conf}} file. Replace the line:<br />
Listen localhost:631<br />
with<br />
Port 631<br />
so that CUPS listens to incoming requests.<br />
<br />
Three levels of access can be granted:<br />
<Location /> #access to the server<br />
<Location /admin> #access to the admin pages<br />
<Location /admin/conf> #access to configuration files<br />
<br />
To give remote hosts access to one of these levels, add an {{ic|Allow}} statement to that level's section. An {{ic|Allow}} statement can take one or more of the forms listed below:<br />
Allow from all<br />
Allow from host.domain.com<br />
Allow from *.domain.com<br />
Allow from ip-address<br />
Allow from ip-address/netmask<br />
<br />
Deny statements can also be used. For example, if wanting to give all hosts on the 192.168.1.0/255.255.255.0 subnet full access, file {{ic|/etc/cups/cupsd.conf}} would include this:<br />
# Restrict access to the server...<br />
# By default only localhost connections are possible<br />
<Location /><br />
Order allow,deny<br />
Allow from localhost<br />
'''Allow from 192.168.1.0/255.255.255.0'''<br />
</Location><br />
<br />
# Restrict access to the admin pages...<br />
<Location /admin><br />
# Encryption disabled by default<br />
#Encryption Required<br />
Order allow,deny<br />
Allow from localhost<br />
'''Allow from 192.168.1.0/255.255.255.0'''<br />
</Location><br />
<br />
# Restrict access to configuration files...<br />
<Location /admin/conf><br />
AuthType Basic<br />
Require user @SYSTEM<br />
Order allow,deny<br />
Allow From localhost<br />
'''Allow From 192.168.1.0/255.255.255.0'''<br />
</Location><br />
<br />
You might also need to add:<br />
<br />
DefaultEncryption Never<br />
<br />
This should avoid the error: 426 - Upgrade Required when using the CUPS web interface from a remote machine.<br />
<br />
=== Command-line configuration ===<br />
<br />
CUPS can be fully controlled from command-line with nice tools, ''i.e.'' the lp* and the cups* command families.<br />
<br />
On Arch Linux, most commands support auto-completion with common shells.<br />
Also note that command-line switches cannot be grouped.<br />
<br />
;List the devices<br />
# lpinfo -v<br />
<br />
;List the drivers<br />
# lpinfo -m<br />
<br />
;Add a new printer<br />
# lpadmin -p ''printer'' -E -v ''device'' -P ''ppd''<br />
<br />
The ''printer'' is up to you. The device can be retrieved from the 'lpinfo -i' command.<br />
Example:<br />
# lpadmin -p HP_DESKJET_940C -E -v "usb://HP/DESKJET%20940C?serial=CN16E6C364BH" -P /usr/share/ppd/HP/hp-deskjet_940c.ppd.gz<br />
<br />
In the following, the ''printer'' references the name you have used here to set up the printer.<br />
<br />
;Set the default printer<br />
$ lpoptions -d ''printer''<br />
<br />
;Check the status<br />
$ lpstat -s<br />
$ lpstat -p ''printer''<br />
<br />
;Deactivate a printer<br />
# cupsdisable ''printer''<br />
<br />
;Activate a printer<br />
# cupsenable ''printer''<br />
<br />
;Remove a printer<br />
First set it to reject all incoming entries:<br />
# cupsreject ''printer''<br />
Then disable it.<br />
# cupsdisable ''printer''<br />
Finally remove it.<br />
# lpadmin -x ''printer''<br />
<br />
;Print a file<br />
$ lpr ''file''<br />
$ lpr -# 17 ''file'' # print the file 17 times<br />
$ echo "Hello, world!" | lpr -p # print the result of a command. The -p switch adds a header.<br />
<br />
;Check the printing queue<br />
$ lpq<br />
$ lpq -a # on all printers<br />
<br />
;Clear the printing queue<br />
# lprm # remove last entry only<br />
# lprm - # remove all entries<br />
<br />
=== Alternative CUPS interfaces ===<br />
<br />
==== GNOME ====<br />
<br />
You can configure and manage printers by [[pacman|installing]] {{Pkg|system-config-printer}}. This program does pull in some gnome dependencies.<br />
<br />
If your user does not have sufficient priviliges to administer the cups scheduler, system-config-printer will request the root password when it starts. You can avoid this by performing the following instructions.<br />
<br />
1. Create a group for administering the cups scheduler:<br />
<br />
# groupadd lpadmin<br />
<br />
2. Add yourself to the newly created group:<br />
<br />
# usermod -aG lpadmin ''username''<br />
<br />
3. Tell cups to respect the newly created group:<br />
<br />
{{hc|/etc/cups/cups-files.conf|<br />
...<br />
SystemGroup sys root '''lpadmin'''<br />
...}}<br />
<br />
4. Restart cups:<br />
<br />
# systemctl restart cupsd<br />
<br />
5. Log out and log in again or restart your computer.<br />
<br />
==== KDE ====<br />
<br />
[[KDE]] users can modify their printers from the Control Center. Both should refer to those desktop environments' documentation for more information on how to use the interfaces.<br />
<br />
==== Other ====<br />
<br />
There is also {{AUR|gtklp}} in the [[AUR]].<br />
<br />
== PDF virtual printer ==<br />
<br />
{{Pkg|cups-pdf}} is a nice package that allows one to setup a virtual printer that will generate a PDF from anything sent to it. This package is not necessary, but it can be quite useful.<br />
<br />
After installing the package, set it up as if it were for any other printer by using the web interface. Access the cups print manager: http://localhost:631 and select:<br />
Administration -> Add Printer<br />
Select CUPS-PDF (Virtual PDF), choose for the make and driver:<br />
Make: Generic<br />
Driver: Generic CUPS-PDF Printer<br />
<br />
Find generated PDF documents in a sub-directory located at {{ic|/var/spool/cups-pdf}}. Normally, the subdirectory is named after the user who performed the job. A little tweak helps you to find your printed PDF documents more easily. Edit {{ic|/etc/cups/cups-pdf.conf}} by changing the line<br />
#Out /var/spool/cups-pdf/${USER}<br />
<br />
to<br />
<br />
Out ${HOME}<br />
<br />
=== Print to PostScript ===<br />
<br />
The CUPS-PDF (Virtual PDF Printer) actually creates a PostScript file and then creates the PDF using the ps2pdf utility. To print to PostScript, just print as usual, in the print dialog choose "CUPS-PDF" as the printer, then select the checkbox for "print to file", hit print, enter the filename.ps and click save. This is handy for faxes, etc...<br />
<br />
== Troubleshooting ==<br />
<br />
The best way to get printing working is to set 'LogLevel' in {{ic|/etc/cups/cupsd.conf}} to:<br />
LogLevel debug<br />
<br />
And then viewing the output from {{ic|/var/log/cups/error_log}} like this:<br />
# tail -n 100 -f /var/log/cups/error_log<br />
<br />
The characters at the left of the output stand for:<br />
*D=Debug<br />
*E=Error<br />
*I=Information<br />
*And so on<br />
<br />
These files may also prove useful:<br />
*{{ic|/var/log/cups/page_log}} - Echoes a new entry each time a print is successful<br />
*{{ic|/var/log/cups/access_log}} - Lists all cupsd http1.1 server activity<br />
<br />
Of course, it is important to know how CUPS works if wanting to solve related issues:<br />
# An application sends a .ps file (PostScript, a script language that details how the page will look) to CUPS when 'print' has been selected (this is the case with most programs).<br />
# CUPS then looks at the printer's PPD file (printer description file) and figures out what filters it needs to use to convert the .ps file to a language that the printer understands (like PJL, PCL), usually GhostScript.<br />
# GhostScript takes the input and figures out which filters it should use, then applies them and converts the .ps file to a format understood by the printer.<br />
# Then it is sent to the back-end. For example, if the printer is connected to a USB port, it uses the USB back-end.<br />
<br />
Print a document and watch {{ic|error_log}} to get a more detailed and correct image of the printing process.<br />
<br />
=== Problems resulting from upgrades ===<br />
<br />
''Issues that appeared after CUPS and related program packages underwent a version increment''<br />
<br />
==== CUPS stops working ====<br />
<br />
The chances are that a new configuration file is needed for the new version to work properly. Messages such as "404 - page not found" may result from trying to manage CUPS via localhost:631, for example.<br />
<br />
To use the new configuration, copy {{ic|/etc/cups/cupsd.conf.default}} to {{ic|/etc/cups/cupsd.conf}} (backup the old configuration if needed) and restart CUPS to employ the new settings.<br />
<br />
==== All jobs are "stopped" ====<br />
<br />
If all jobs sent to the printer become "stopped", delete the printer and add it again.<br />
Using the [http://localhost:631 CUPS web interface], go to Printers > Delete Printer.<br />
<br />
To check the printer's settings go to ''Printers'', then ''Modify Printer''. Copy down the information displayed, click 'Modify Printer' to proceed to the next page(s), and so on.<br />
<br />
==== All jobs are "The printer is not responding" ====<br />
<br />
On networked printers, you should check that the name that CUPS uses as its connection URI resolves to the printer's IP via DNS, e.g.<br />
If your printer's connection looks like this:<br />
lpd://BRN_020554/BINARY_P1<br />
<br />
then the hostname 'BRN_020554' needs to resolve to the printer's IP from the server running CUPS<br />
<br />
==== The PPD version is not compatible with gutenprint ====<br />
<br />
Run:<br />
# /usr/bin/cups-genppdupdate<br />
<br />
And restart CUPS (as pointed out in gutenprint's post-install message)<br />
<br />
=== Other ===<br />
<br />
===== CUPS permission errors =====<br />
<br />
* Some users fixed 'NT_STATUS_ACCESS_DENIED' (Windows clients) errors by using a slightly different syntax:<br />
smb://workgroup/username:password@hostname/printer_name<br />
<br />
* Sometimes, the block device has wrong permissions:<br />
# ls /dev/usb/<br />
lp0<br />
# chgrp lp /dev/usb/lp0<br />
<br />
==== HPLIP printer sends "/usr/lib/cups/backend/hp failed" error ====<br />
<br />
Make sure dbus is installed and running. If the error persists, try starting avahi-daemon.<br />
<br />
Try adding the printer as a Network Printer using the http:// protocol. Generate the printer URI with {{ic|hp-makeuri}}.<br />
<br />
{{Note|There might need to set permissions issues right. Follow indications here: [[CUPS#Device node permissions]].}}<br />
<br />
==== HPLIP printer claims job is complete but printer does nothing ====<br />
<br />
This happens on HP printers when you select the (old) hpijs driver (e.g. the Deskjet D1600 series). Instead, use the hpcups driver when adding the printer.<br />
<br />
Some HP printers (e.g HP LaserJet) require their firmware to be downloaded from the computer every time the printer is switched on. If there is an issue with udev (or equivalent) and the firmware download rule is never fired, you may experience this issue.<br />
As a workaround, you can manually download the firmware to the printer. Ensure the printer is plugged in and switched on, then enter<br />
hp-firmware -n<br />
<br />
==== hp-setup asks to specify the PPD file for the discovered printer ====<br />
<br />
Install CUPS before running hp-setup.<br />
<br />
==== I have installed Qt, but hp-setup reports "Qt/PyQt 4 initialization failed" ====<br />
<br />
"hp-check -t" won't give you useful information to find the required package. You have to install all the "Dependent Packages" prefixed with "python2" in https://www.archlinux.org/packages/extra/x86_64/hplip/<br />
<br />
==== hp-setup finds the printer automatically but reports "Unable to communicate with device" when printing test page immediately afterwards ====<br />
<br />
This at least happens to hplip 3.13.5-2 for HP Officejet 6500A through local network connection. To solve the problem, specify the IP address of the HP printer for hp-setup to locate the printer.<br />
<br />
==== hp-toolbox sends an error, "Unable to communicate with device" ====<br />
<br />
If running hp-toolbox as a regular user results in:<br />
# hp-toolbox<br />
# error: Unable to communicate with device (code=12): hp:/usb/''printer id''<br />
or, "{{ic|Unable to communicate with device"}}", then it may be needed to [[Groups#Group management|add the user to the lp and sys groups]].<br />
<br />
This can also be caused by printers such as the P1102 that provide a virtual cd-rom drive for MS-Windows drivers. The lp dev appears and then disappears. In that case try the '''usb-modeswitch''' and '''usb-modeswitch-data''' packages, that lets one switch off the "Smart Drive" (udev rules included in said packages).<br />
<br />
This can also occur with network attached printers if the [[Avahi|avahi-daemon]] is not running. Another possiblility is the specification of the printer's IP address in hp-setup fails to locate the printer because the IP address of the the printer changed due to DHCP.<br />
<br />
==== CUPS returns '"foomatic-rip" not available/stopped with status 3' with a HP printer ====<br />
<br />
If receiving any of the following error messages in {{ic|/var/log/cups/error_log}} while using a HP printer, with jobs appearing to be processed while they all end up not being completed with their status set to 'stopped':<br />
Filter "foomatic-rip" for printer ''printer_name'' not available: No such file or director<br />
or:<br />
PID 5771 (/usr/lib/cups/filter/foomatic-rip) stopped with status 3!<br />
make sure {{pkg|hplip}} has been [[pacman|installed]], in addition to [[#Packages|the packages mentioned above]]. See [https://bbs.archlinux.org/viewtopic.php?id=65615 this forum post] for more information.<br />
<br />
==== Printing fails with unauthorised error ====<br />
<br />
If the user has been added to the lp group, and allowed to print (set in {{ic|cupsd.conf}}), then the problem lies in {{ic|/etc/cups/printers.conf}}. This line could be the culprit:<br />
AuthInfoRequired negotiate<br />
<br />
Comment it out and restart CUPS.<br />
<br />
==== Print button greyed-out in GNOME print dialogs ====<br />
<br />
:''<small>Source: [https://bbs.archlinux.org/viewtopic.php?id=70418 I can't print from gnome applications. - Arch Forums]</small>''<br />
<br />
Be sure the package: '''libgnomeprint''' is installed<br />
<br />
Edit {{ic|/etc/cups/cupsd.conf}} and add:<br />
# HostNameLookups Double<br />
<br />
Restart cups.service.<br />
<br />
==== Unknown supported format: application/postscript ====<br />
<br />
Comment the lines:<br />
application/octet-stream application/vnd.cups-raw 0 -<br />
from {{ic|/etc/cups/mime.convs}}, and:<br />
application/octet-stream<br />
in {{ic|/etc/cups/mime.types}}.<br />
<br />
==== Finding URIs for Windows print servers ====<br />
<br />
Sometimes Windows is a little less than forthcoming about exact device URIs (device locations). If having trouble specifying the correct device location in CUPS, run the following command to list all shares available to a certain windows username:<br />
$ smbtree -U ''windowsusername''<br />
This will list every share available to a certain Windows username on the local area network subnet, as long as Samba is set up and running properly. It should return something like this:<br />
{{bc| WORKGROUP<br />
\\REGULATOR-PC <br />
\\REGULATOR-PC\Z <br />
\\REGULATOR-PC\Public <br />
\\REGULATOR-PC\print$ Printer Drivers<br />
\\REGULATOR-PC\G <br />
\\REGULATOR-PC\EPSON Stylus CX8400 Series EPSON Stylus CX8400 Series}}<br />
What is needed here is first part of the last line, the resource matching the printer description. So to print to the EPSON Stylus printer, one would enter:<br />
smb://username.password@REGULATOR-PC/EPSON Stylus CX8400 Series<br />
as the URI into CUPS. Notice that whitespaces are allowed in URIs, whereas backslashes get replaced with forward slashes.<br />
If it won't work try '%20' instead of spaces.<br />
<br />
==== Print-Job client-error-document-format-not-supported ====<br />
<br />
Try installing the foomatic packages and use a foomatic driver.<br />
<br />
==== /usr/lib/cups/backend/hp failed ====<br />
<br />
Change:<br />
SystemGroup sys root<br />
to:<br />
SystemGroup lp root<br />
in {{ic|/etc/cups/cupsd.conf}}<br />
<br />
<br />
Following steps 1-3 in the Alternative CUPS interfaces below may be a better solution, since newer versions of cups will not allow the same group for both normal and admin operation.<br />
<br />
==== Unable to get list of printer drivers ====<br />
<br />
* Check your ServerName in /etc/cups/client.conf is written without http://<br />
ServerName localhost:631<br />
* Try to remove Foomatic drivers.<br />
<br />
==== lp: Error - Scheduler Not Responding ====<br />
<br />
If you get this error when printing a document using:<br />
<br />
$ lp document-to-print<br />
<br />
Try setting the CUPS_SERVER environment variable:<br />
<br />
$ export CUPS_SERVER=localhost<br />
<br />
If this solves your problem, make the solution permanent by adding the export line above to ~/.bash_profile.<br />
<br />
==== CUPS prints only an empty and an error-message page on HP LaserJet ====<br />
<br />
There is a bug that causes CUPS to fail when printing images on HP LaserJet (in my case 3380). The bug has been reported and fixed by [https://bugs.launchpad.net/ubuntu/+source/cups-filters/+bug/998087 Ubuntu].<br />
The first page is empty, the second page contains the following error message:<br />
ERROR:<br />
invalidaccess<br />
OFFENDING COMMAND:<br />
filter<br />
STACK:<br />
/SubFileDecode<br />
endstream<br />
...<br />
<br />
In order to fix the issue, use the following command (as superuser):<br />
lpadmin -p ''printer'' -o pdftops-renderer-default=pdftops<br />
<br />
==== "Using invalid Host" error message ====<br />
<br />
Try to add "ServerAlias *" into cupsd.conf<br />
<br />
==== Printer doesn't print with an "Filter failed" message on CUPS web interface (HP printer) ====<br />
<br />
Change the permissions of the printer USB port:<br />
<br />
Get the bus and device number from lsusb, then set the permission using:<br />
<br />
chmod 0666 /dev/bus/usb/''bus number''/''device number''<br />
<br />
To make the persistent permission change that will be triggered automatically each time the computer is rebooted, add the following line.<br />
<br />
{{hc|/etc/udev/rules.d/10-local.rules|2=<br />
SUBSYSTEM=="usb", ATTRS{idVendor}=="Printer_idVendor", ATTRS{idProduct}=="Printer_idProduct", GROUP="lp", MODE:="666"<br />
}}<br />
<br />
Obtain the right information by using {{ic|lsusb}} command, and don't forget to substitute {{ic|Printer_idVendor}} & {{ic|Printer_idProduct}} with the relevant ones.<br />
<br />
Each system may vary, so consult [[udev#List_attributes_of_a_device]] wiki page.<br />
<br />
==== Printer doesn't print with an "Filter failed" message on CUPS web interface (HP printer connected over network) ====<br />
<br />
Start, enable and restart the avahi-daemon.<br />
<br />
==== HPLIP 3.13: Plugin is installed, but HP Device Manager complains it is not ====<br />
<br />
The issue might have to do with the file permission change that had been made to {{ic|/var/lib/hp/hplip.state}}. To correct the issue, a simple {{ic|chmod 644 /var/lib/hp/hplip.state}} and {{ic|chmod 755 /var/lib/hp}} should be sufficient. For further information, please read this [https://bugs.launchpad.net/hplip/+bug/1131596 link].<br />
<br />
==== Printer is not recognized by CUPS ====<br />
<br />
If your printer is not listed in the "Add Printers" page of the CUPS web interface, nor by lpinfo -v, try the following (suggested in [https://bbs.archlinux.org/viewtopic.php?pid=1037279#p1037279 this thread]):<br />
<br />
* Remove {{ic|usblp}} from blacklist<br />
* Load {{ic|usblp}} module<br />
modprobe usblp<br />
* Stop cups<br />
* Add the following udev rule in a new rule file:<br />
{{hc|/etc/udev/rules.d/10-cups_device_link.rules|2=<br />
KERNEL=="lp[0-9]", SYMLINK+="%k", GROUP="lp"<br />
}}<br />
* Reload udev rules:<br />
# udevadm control --reload-rules<br />
* Unplug and re-plug the printer.<br />
* Wait a few seconds and then start cups again.<br />
<br />
==== Can't load /etc/samba/smb.conf ====<br />
<br />
If you're printing to a remote printer over SMB and get this error message: "Can't load /etc/samba/smb.conf - run testparm to debug it", then create an empty smb.conf:<br />
<br />
# mkdir /etc/samba<br />
# touch /etc/samba/smb.conf<br />
<br />
and restart cupsd.<br />
<br />
==== CUPS' systemd service does not start even though it's enabled ====<br />
<br />
The systemd .service file provided by CUPS uses socket activation, meaning the service is only started when an<br />
application connects to CUPS' socket. However, the systemd .socket file provided by cups only works for the local <br />
{{ic|/var/run/cups/cups.sock}} socket. <br />
<br />
In order to have cupsd start when initiating a print job over the network, create the following file:<br />
<br />
{{hc|/etc/systemd/system/cups.socket|<br />
.include /usr/lib/systemd/system/cups.socket<br />
<br />
[Socket]<br />
ListenStream&#61;0.0.0.0:631<br />
ListenDatagram&#61;0.0.0.0:631<br />
BindIPv6Only&#61;ipv6-only<br />
}}<br />
<br />
Then reload systemd:<br />
<br />
# systemctl --system daemon-reload<br />
<br />
Confirm that everything is working correctly:<br />
<br />
{{bc|<br />
# systemctl is-enabled cups.service &#124;&#124; systemctl enable cups.service<br />
# systemctl status cups.socket<br />
cups.socket - CUPS Printing Service Sockets<br />
Loaded: loaded (/etc/systemd/system/cups.socket; enabled)<br />
Active: inactive (dead)<br />
Listen: /var/run/cups/cups.sock (Stream)<br />
0.0.0.0:631 (Stream)<br />
0.0.0.0:631 (Datagram)<br />
}}<br />
<br />
CUPS should now start automatically when printing locally or over the network.<br />
<br />
== See also ==<br />
<br />
* [http://localhost:631/documentation.html Official CUPS documentation], ''locally installed''<br />
* [http://www.cups.org/ Official CUPS website]<br />
* [http://www.linuxprinting.org/ Linux Printing], ''[http://www.linuxfoundation.org The Linux Foundation]''<br />
* [http://www.gentoo.org/doc/en/printing-howto.xml Gentoo's printing guide], ''[http://www.gentoo.org/doc/en Gentoo Documentation resources]''<br />
* [https://bbs.archlinux.org/ Arch Linux user forums]<br />
* [http://wiki.gotux.net/tutorials/software/hp-printer Install HP printers easy way]</div>SilverWyrdahttps://wiki.archlinux.org/index.php?title=CUPS&diff=274393CUPS2013-09-05T04:01:23Z<p>SilverWyrda: /* HP Printer */</p>
<hr />
<div>[[Category:Printers]]<br />
[[cs:CUPS]]<br />
[[es:CUPS]]<br />
[[fr:CUPS]]<br />
[[it:CUPS]]<br />
[[pl:CUPS]]<br />
[[ru:CUPS]]<br />
[[th:CUPS]]<br />
[[tr:CUPS]]<br />
[[zh-CN:CUPS]]<br />
[[zh-TW:CUPS]]<br />
{{Article summary start|Summary}}<br />
{{Article summary text|Installing and configuring CUPS}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|CUPS printer sharing}}<br />
{{Article summary wiki|CUPS printer-specific problems}}<br />
{{Article summary wiki|Samba}}<br />
{{Article summary end}}<br />
<br />
From [http://www.cups.org/index.php CUPS' site]:<br />
:"''[[Wikipedia:CUPS|CUPS]] is the standards-based, open source printing system developed by Apple Inc. for OS® X and other UNIX®-like operating systems''".<br />
<br />
Although there are other printing packages such as LPRNG, the Common Unix Printing System is the most popular choice because of its relative ease of use.<br />
<br />
== CUPS Linux printing workflow ==<br />
As of {{Pkg|cups}} version 1.5.3-3, Arch Linux makes use of the new full pdf-based printing workflow. For<br />
further reading check [http://www.linuxfoundation.org/collaborate/workgroups/openprinting/pdfasstandardprintjobformat PDF standard printing job format] and an old [https://wiki.linuxfoundation.org/en/OpenPrinting/Database/CUPS-Filter-Chart CUPS filtering chart] for history and fun.<br />
A good starting point for general Linux printing questions is [http://www.linuxfoundation.org/collaborate/workgroups/openprinting here].<br />
<br />
There are two ways to setup a printer.<br />
* If there's a CUPS server running in your network and sharing a printer you only need to install the client package.<br />
* If the printer is connected directly to your system or you have access to an IPP network printer then setup a local CUPS server.<br />
<br />
== Installing the client package ==<br />
<br />
The package {{Pkg|libcups}} is the only required package. [[pacman|Install]] it from the [[official repositories]].<br />
<br />
Then add your CUPS server's IP address or hostname into {{ic|/etc/cups/client.conf}}. That is all you need. Every application should quickly find the printer(s) shared by that CUPS server.<br />
<br />
=== Optional advanced network setup ===<br />
<br />
It is also possible to run a entire cupsd+cups-browsed instance on your client with Avahi browsing enabled to discover unknown shared printers in your network. This can be useful in large setups where the server is unknown.<br />
{{Note|This behavior did not change with cups 1.6.x - the difference is that until 1.5.x cupsd was able to do printer browsing alone and now it can only browse its own shared printers.<br />
To get the local cupsd recognise other shared printers offered by a remote cupsd server you need a running local cups-browsed (supported since cups-filters 1.0.26) instance using Avahi to discover unknown printers. <br />
There is [https://bbs.archlinux.org/viewtopic.php?id&#61;161440 good news] in April 2013 (still has to be incorporated above).}}<br />
<br />
=== Installing CUPS a 32 bit chroot environment ===<br />
<br />
If you have a 64 bit base installation with a [[Install_bundled_32-bit_system_in_Arch64|32 bit chroot environment]], explicit installation of CUPS is not necessary in the 32 bit environment. To access installed CUPS printers from the chroot environment, one needs to bind the {{ic|/var/run/cups}} directory to the same relative location in the chroot environment. Simply create the directory in the chroot (it probably doesn't exist), mount (with {{ic|-o bind}} passed to the command}}, and printers should be available from 32 bit chroot applications immediately.<br />
<br />
{{bc|# mkdir /path/to/chroot/var/run/cups<br />
# Example: # mkdir /opt/arch32/var/run/cups<br />
<br />
# mount -o bind /var/run/cups /path/to/chroot/var/run/cups}}<br />
<br />
== Installing the server packages ==<br />
<br />
The following packages and some printer drivers are needed. [[pacman|Install]] them from the [[official repositories]].<br />
<br />
* {{Pkg|cups}} - the actual CUPS daemon<br />
* {{Pkg|cups-filters}} - essential filters<br />
* {{Pkg|ghostscript}} - (optional) PostScript interpreter<br />
* {{Pkg|gsfonts}} - GhostScript standard Type1 fonts<br />
<br />
If you want to enable printer browsing through your network, also install {{Pkg|avahi}}. Make sure '''avahi-daemon''' is started before '''cupsd'''.<br />
<br />
If the system is connected to a networked printer using the [[Samba]] protocol or if the system is to be a print server for Windows clients, also install {{Pkg|samba}}.<br />
<br />
=== Printer driver ===<br />
<br />
Here are some of the driver packages. Choosing the right driver depends on the printer:<br />
<br />
* '''{{Pkg|gutenprint}}''' - A collection of high quality drivers for Canon, Epson, Lexmark, Sony, Olympus, and PCL printers for use with GhostScript, CUPS, Foomatic, and the [[GIMP]]<br />
* '''{{Pkg|foomatic-db}}, {{Pkg|foomatic-db-engine}}, {{Pkg|foomatic-db-nonfree}}, and {{Pkg|foomatic-filters}}''' - Foomatic is a database-driven system for integrating free software printer drivers with common spoolers under Unix. Installing foomatic-filters should solve problems if the cups error_log is reporting "stopped with status 22!".<br />
* '''{{Pkg|hplip}}''' - HP drivers for DeskJet, OfficeJet, Photosmart, Business Inkjet and some LaserJet printer models, as well as a number of Brother printers.<br />
* '''{{Pkg|splix}}''' - Samsung drivers for SPL (Samsung Printer Language) printers.<br />
<br />
* '''{{AUR|foo2zjs}}''' - Drivers for ZjStream protocol printers such as the HP Laserjet 1018. More info [http://foo2zjs.rkkda.com here]. Package is available in the [[AUR]].<br />
* '''{{AUR|hpoj}}''' - If you are using an HP Officejet, you should also install this package and follow the instructions to avoid problems as in [https://answers.launchpad.net/hplip/+question/133425 this thread]. Package is available in the [[AUR]].<br />
* '''{{AUR|samsung-unified-driver}}''' - Unified Linux Driver for Samsung printers and scanners. Required for new printers such as the ML-2160. Package is available in the [[AUR]].<br />
* '''{{AUR|ufr2}}''' or '''{{AUR|cndrvcups-lb}}''' - Canon UFR2 driver with support for LBP, iR and MF series printers. Package is available in the [[AUR]].<br />
<br />
* '''{{Pkg|cups-pdf}}''' - A package that allows one to setup a virtual PDF Printer that generates a PDF out of jobs sent to it<br />
<br />
If you are not sure of what driver package to install or if the current driver is not working, it may be easiest to just install all of the drivers. Some of the package names are misleading because printers of other makes may rely on them. For example, the Brother HL-2140 needs the hplip driver installed.<br />
<br />
==== Download printer PPD ====<br />
<br />
Depending on the printer, this step is optional and may not be needed, as the standard CUPS installation already comes with quite a few PPD (Postscript Printer Description) files. Moreover, the ''foomatic-filters'', ''gimp-print'' and ''hplip'' packages already include quite a few PPD files which will automatically be detected by CUPS.<br />
<br />
Here is an explanation of what a PPD file is from the Linux Printing website:<br />
:"''For every PostScript printer the manufacturers provide a PPD file which contains all printer-specific information about the particular printer model: Basic printer capabilities as whether the printer is a color printer, fonts, PostScript level, etc., and especially the user-adjustable options, as paper size, resolution, etc.''"<br />
<br />
If the PPD for the printer is ''not'' already in CUPS, then:<br />
*check [[AUR]] to see if there are packages for the printer/manufacturer<br />
*visit the [http://www.openprinting.org/printers OpenPrinting database] and select the manufacturer and model of the printer<br />
*visit the manufacturer's site and search for GNU/Linux drivers<br />
<br />
{{Note|PPD files go in {{ic|/usr/share/cups/model/}}}}<br />
<br />
==== Another source for printer drivers ====<br />
<br />
[http://www.turboprint.de/english.html Turboprint] is a proprietary driver for many printers not yet supported by GNU/Linux (Canon i*, for example). Unlike CUPS, however, high quality prints are either marked with a watermark or are a pay-only service.<br />
<br />
== Hardware support and configuration ==<br />
<br />
=== USB printers ===<br />
<br />
{{Tip|Most USB printers should work out of the box, you can skip this section and come back if you can not get your printer to work.}}<br />
<br />
USB printers can get accessed with two methods: The usblp kernel module and libusb. The former is the classic way. It is simple: data is sent to the printer by writing it to a device file as a simple serial data stream. Reading the same device file allows bi-di access, at least for things like reading out ink levels, status, or printer capability information (PJL). It works very well for simple printers, but for multi-function devices (printer/scanner) it is not suitable and manufacturers like HP supply their own backends. Source: [http://lists.linuxfoundation.org/pipermail/printing-architecture/2012/002412.html here].<br />
<br />
==== Blacklisting usblp ====<br />
<br />
{{Warning|As of {{Pkg|cups}} version 1.6.0, you no longer need to [[Kernel modules#Blacklisting|blacklist]] the {{ic|usblp}} kernel module.<br />
<br />
If you find out this is the only way to fix a remaining issue please report this upstream to the CUPS bug tracker and maybe also get in contact with Till Kamppeter (Debian CUPS maintainer). See [http://cups.org/str.php?L4128 upstream bug] for more.}}<br />
<br />
If you have problems getting your USB printer to work, you can try blacklisting the {{ic|usblp}} [[kernel module]]:<br />
<br />
{{hc|/etc/modprobe.d/blacklistusblp.conf|<br />
blacklist usblp<br />
}}<br />
<br />
Custom kernel users may need to manually load the {{ic|usbcore}} [[kernel module]] before proceeding.<br />
<br />
Once the modules are installed, plug in the printer and check if the kernel detected it by running the following:<br />
# tail /var/log/messages.log<br />
or<br />
# dmesg<br />
<br />
If you're using {{ic|usblp}}, the output should indicate that the printer has been detected like so:<br />
Feb 19 20:17:11 kernel: printer.c: usblp0: USB Bidirectional<br />
printer dev 2 if 0 alt 0 proto 2 vid 0x04E8 pid 0x300E<br />
Feb 19 20:17:11 kernel: usb.c: usblp driver claimed interface cfef3920<br />
Feb 19 20:17:11 kernel: printer.c: v0.13: USB Printer Device Class driver<br />
<br />
If you blacklisted {{ic|usblp}}, you will see something like:<br />
usb 3-2: new full speed USB device using uhci_hcd and address 3<br />
usb 3-2: configuration #1 chosen from 1 choice<br />
<br />
=== Parallel port printers ===<br />
<br />
To use a parallel port printer, you will need to load the {{ic|lp}}, {{ic|parport}} and {{ic|parport_pc}} [[kernel modules]].<br />
<br />
Check the setup by running:<br />
# tail /var/log/messages.log<br />
It should display something like this:<br />
lp0: using parport0 (polling).<br />
<br />
If you are using a USB to parallel port adapter, CUPS will not be able to detect the printer. As a workaround, add the printer using a different connection type and then change DeviceID in {{ic|/etc/cups/printers.conf}}:<br />
DeviceID = parallel:/dev/usb/lp0<br />
<br />
=== HP Printer ===<br />
<br />
HP printers can also be installed via HP's Linux setup tool. Install it by installing {{Pkg|hplip}} from the [[official repositories]].<br />
<br />
To run with qt frontend:<br />
# hp-setup -u<br />
<br />
To run with command line:<br />
# hp-setup -i<br />
<br />
PPD files are in {{ic|/usr/share/ppd/HP/}}.<br />
<br />
For printers that require the proprietary HP plugin (like the Laserjet Pro P1102w), install the {{AUR|hplip-plugin}} package from [[AUR]].<br />
<br />
Important : {{Pkg|hplip}} depends on {{Pkg|foomatic-db-engine}} which prevents the drivers list from appearing when a printer is added to CUPS via the web user interface. The workaround consists in installing {{Pkg|hplip}} first, retrieve the corresponding PPD file from {{ic|/usr/share/ppd/HP/}}, then, remove entierly {{Pkg|hplip}} and the unecessary dependencies. Finally, install the printer with the PPD file then re-install {{Pkg|hplip}}. You should have after a reboot a fully working printer.<br />
<br />
== Configuring ==<br />
<br />
Now that CUPS is installed, there are a variety of options on how to set up printing solutions. As always, the tried and true command line method is at your disposal. CUPS also embeds a full-featured web interface. Likewise, various desktop environments such as GNOME and KDE have useful programs that can help manage printers. Depending on your needs, you may choose one method or the other.<br />
<br />
If you are planning on connecting to a network printer, rather than one that is directly connected to the computer, you might want to read the [[CUPS printer sharing]] page first. Printer sharing between GNU/Linux systems is quite easy and involves very little configuration, whereas sharing between a Windows and GNU/Linux host requires a little bit more effort.<br />
<br />
=== CUPS daemon ===<br />
<br />
With the kernel modules installed, you can now start the '''cups''' and optionally, the '''cups-browsed''' [[daemons]], and enable them as required.<br />
<br />
=== Web interface and tool-kit ===<br />
<br />
Once the daemon is running, open a browser and go to: http://localhost:631 (''The '''localhost''' string may need to be replaced with the hostname found in'' {{ic|/etc/hostname}}).<br />
<br />
From here, follow the various wizards to add the printer. A usual procedure is to start by clicking on ''Adding Printers and Classes'' and then ''Add Printer''. When prompted for a username and password, log in as root. The name assigned to the printer does not matter, the same applies for 'location' and 'description'. Next, a list of devices to select from will be presented. The actual name of the printer shows up next to the label (e.g., next to ''USB Printer #1'' for USB printers). Finally, choose the appropriate drivers and the configuration is complete.<br />
<br />
Now test the configuration by pressing the ''Maintenance'' drop-down menu then ''Print Test Page''. If it does not print and there is certainty regarding the correctness of applied settings, then the problem is most likely due to missing a proper printer driver.<br />
<br />
{{Tip|See: [[#Alternative CUPS interfaces]] for other other front-ends.}}<br />
{{Note|<br />
* When setting up a USB printer, you should see your printer listed on ''Add Printer'' page. If you can only see a "SCSI printer" option, it probably means that CUPS has failed to recognize your printer.<br />
* To enable wireless scanning on certain HP multi-function devices using the {{pkg|hplip}} package, you may need to add the printer as a Network Printer using the HTTP protocol. To determine the proper URI to use, run the {{ic|hp-makeuri}} command.}}<br />
<br />
==== CUPS administration ====<br />
<br />
A username and password will be required when administering the printer in the web interface, such as: adding or removing printers, stopping print tasks, etc. The default username is the one assigned in the ''sys'' group, or root. Other admin groups (e.g. lpadmin or printadmin) may be added to the {{ic|SystemGroup}} line in {{ic|/etc/cups/cups-files.conf}} (you might have to add this line). See [http://www.cups.org/articles.php?L237+T+Qprintadmin these instructions at cups.org]. You might also want to read [https://bbs.archlinux.org/viewtopic.php?id=35567 this post]. Create the group[s] ({{ic|man groupadd}}) and add the group[s] to users ({{ic|man usermod}}). cupsd must be restarted and the user must re-login for these changes to take affect.<br />
<br />
If the root account has been locked (i.e. when using sudo), it is not possible to log in the CUPS administration interface with the default username (root) and password. Follow the instructions above to add other users as cups administrators.<br />
<br />
==== Remote access to web interface ====<br />
<br />
By default, the CUPS web interface can only be accessed by the ''localhost''; i.e. the computer that it is installed on. To remotely access the interface, make the following changes to the {{ic|/etc/cups/cupsd.conf}} file. Replace the line:<br />
Listen localhost:631<br />
with<br />
Port 631<br />
so that CUPS listens to incoming requests.<br />
<br />
Three levels of access can be granted:<br />
<Location /> #access to the server<br />
<Location /admin> #access to the admin pages<br />
<Location /admin/conf> #access to configuration files<br />
<br />
To give remote hosts access to one of these levels, add an {{ic|Allow}} statement to that level's section. An {{ic|Allow}} statement can take one or more of the forms listed below:<br />
Allow from all<br />
Allow from host.domain.com<br />
Allow from *.domain.com<br />
Allow from ip-address<br />
Allow from ip-address/netmask<br />
<br />
Deny statements can also be used. For example, if wanting to give all hosts on the 192.168.1.0/255.255.255.0 subnet full access, file {{ic|/etc/cups/cupsd.conf}} would include this:<br />
# Restrict access to the server...<br />
# By default only localhost connections are possible<br />
<Location /><br />
Order allow,deny<br />
Allow from localhost<br />
'''Allow from 192.168.1.0/255.255.255.0'''<br />
</Location><br />
<br />
# Restrict access to the admin pages...<br />
<Location /admin><br />
# Encryption disabled by default<br />
#Encryption Required<br />
Order allow,deny<br />
Allow from localhost<br />
'''Allow from 192.168.1.0/255.255.255.0'''<br />
</Location><br />
<br />
# Restrict access to configuration files...<br />
<Location /admin/conf><br />
AuthType Basic<br />
Require user @SYSTEM<br />
Order allow,deny<br />
Allow From localhost<br />
'''Allow From 192.168.1.0/255.255.255.0'''<br />
</Location><br />
<br />
You might also need to add:<br />
<br />
DefaultEncryption Never<br />
<br />
This should avoid the error: 426 - Upgrade Required when using the CUPS web interface from a remote machine.<br />
<br />
=== Command-line configuration ===<br />
<br />
CUPS can be fully controlled from command-line with nice tools, ''i.e.'' the lp* and the cups* command families.<br />
<br />
On Arch Linux, most commands support auto-completion with common shells.<br />
Also note that command-line switches cannot be grouped.<br />
<br />
;List the devices<br />
# lpinfo -v<br />
<br />
;List the drivers<br />
# lpinfo -m<br />
<br />
;Add a new printer<br />
# lpadmin -p ''printer'' -E -v ''device'' -P ''ppd''<br />
<br />
The ''printer'' is up to you. The device can be retrieved from the 'lpinfo -i' command.<br />
Example:<br />
# lpadmin -p HP_DESKJET_940C -E -v "usb://HP/DESKJET%20940C?serial=CN16E6C364BH" -P /usr/share/ppd/HP/hp-deskjet_940c.ppd.gz<br />
<br />
In the following, the ''printer'' references the name you have used here to set up the printer.<br />
<br />
;Set the default printer<br />
$ lpoptions -d ''printer''<br />
<br />
;Check the status<br />
$ lpstat -s<br />
$ lpstat -p ''printer''<br />
<br />
;Deactivate a printer<br />
# cupsdisable ''printer''<br />
<br />
;Activate a printer<br />
# cupsenable ''printer''<br />
<br />
;Remove a printer<br />
First set it to reject all incoming entries:<br />
# cupsreject ''printer''<br />
Then disable it.<br />
# cupsdisable ''printer''<br />
Finally remove it.<br />
# lpadmin -x ''printer''<br />
<br />
;Print a file<br />
$ lpr ''file''<br />
$ lpr -# 17 ''file'' # print the file 17 times<br />
$ echo "Hello, world!" | lpr -p # print the result of a command. The -p switch adds a header.<br />
<br />
;Check the printing queue<br />
$ lpq<br />
$ lpq -a # on all printers<br />
<br />
;Clear the printing queue<br />
# lprm # remove last entry only<br />
# lprm - # remove all entries<br />
<br />
=== Alternative CUPS interfaces ===<br />
<br />
==== GNOME ====<br />
<br />
You can configure and manage printers by [[pacman|installing]] {{Pkg|system-config-printer}}. This program does pull in some gnome dependencies.<br />
<br />
If your user does not have sufficient priviliges to administer the cups scheduler, system-config-printer will request the root password when it starts. You can avoid this by performing the following instructions.<br />
<br />
1. Create a group for administering the cups scheduler:<br />
<br />
# groupadd lpadmin<br />
<br />
2. Add yourself to the newly created group:<br />
<br />
# usermod -aG lpadmin ''username''<br />
<br />
3. Tell cups to respect the newly created group:<br />
<br />
{{hc|/etc/cups/cups-files.conf|<br />
...<br />
SystemGroup sys root '''lpadmin'''<br />
...}}<br />
<br />
4. Restart cups:<br />
<br />
# systemctl restart cupsd<br />
<br />
5. Log out and log in again or restart your computer.<br />
<br />
==== KDE ====<br />
<br />
[[KDE]] users can modify their printers from the Control Center. Both should refer to those desktop environments' documentation for more information on how to use the interfaces.<br />
<br />
==== Other ====<br />
<br />
There is also {{AUR|gtklp}} in the [[AUR]].<br />
<br />
== PDF virtual printer ==<br />
<br />
{{Pkg|cups-pdf}} is a nice package that allows one to setup a virtual printer that will generate a PDF from anything sent to it. This package is not necessary, but it can be quite useful.<br />
<br />
After installing the package, set it up as if it were for any other printer by using the web interface. Access the cups print manager: http://localhost:631 and select:<br />
Administration -> Add Printer<br />
Select CUPS-PDF (Virtual PDF), choose for the make and driver:<br />
Make: Generic<br />
Driver: Generic CUPS-PDF Printer<br />
<br />
Find generated PDF documents in a sub-directory located at {{ic|/var/spool/cups-pdf}}. Normally, the subdirectory is named after the user who performed the job. A little tweak helps you to find your printed PDF documents more easily. Edit {{ic|/etc/cups/cups-pdf.conf}} by changing the line<br />
#Out /var/spool/cups-pdf/${USER}<br />
<br />
to<br />
<br />
Out ${HOME}<br />
<br />
=== Print to PostScript ===<br />
<br />
The CUPS-PDF (Virtual PDF Printer) actually creates a PostScript file and then creates the PDF using the ps2pdf utility. To print to PostScript, just print as usual, in the print dialog choose "CUPS-PDF" as the printer, then select the checkbox for "print to file", hit print, enter the filename.ps and click save. This is handy for faxes, etc...<br />
<br />
== Troubleshooting ==<br />
<br />
The best way to get printing working is to set 'LogLevel' in {{ic|/etc/cups/cupsd.conf}} to:<br />
LogLevel debug<br />
<br />
And then viewing the output from {{ic|/var/log/cups/error_log}} like this:<br />
# tail -n 100 -f /var/log/cups/error_log<br />
<br />
The characters at the left of the output stand for:<br />
*D=Debug<br />
*E=Error<br />
*I=Information<br />
*And so on<br />
<br />
These files may also prove useful:<br />
*{{ic|/var/log/cups/page_log}} - Echoes a new entry each time a print is successful<br />
*{{ic|/var/log/cups/access_log}} - Lists all cupsd http1.1 server activity<br />
<br />
Of course, it is important to know how CUPS works if wanting to solve related issues:<br />
# An application sends a .ps file (PostScript, a script language that details how the page will look) to CUPS when 'print' has been selected (this is the case with most programs).<br />
# CUPS then looks at the printer's PPD file (printer description file) and figures out what filters it needs to use to convert the .ps file to a language that the printer understands (like PJL, PCL), usually GhostScript.<br />
# GhostScript takes the input and figures out which filters it should use, then applies them and converts the .ps file to a format understood by the printer.<br />
# Then it is sent to the back-end. For example, if the printer is connected to a USB port, it uses the USB back-end.<br />
<br />
Print a document and watch {{ic|error_log}} to get a more detailed and correct image of the printing process.<br />
<br />
=== Problems resulting from upgrades ===<br />
<br />
''Issues that appeared after CUPS and related program packages underwent a version increment''<br />
<br />
==== CUPS stops working ====<br />
<br />
The chances are that a new configuration file is needed for the new version to work properly. Messages such as "404 - page not found" may result from trying to manage CUPS via localhost:631, for example.<br />
<br />
To use the new configuration, copy {{ic|/etc/cups/cupsd.conf.default}} to {{ic|/etc/cups/cupsd.conf}} (backup the old configuration if needed) and restart CUPS to employ the new settings.<br />
<br />
==== All jobs are "stopped" ====<br />
<br />
If all jobs sent to the printer become "stopped", delete the printer and add it again.<br />
Using the [http://localhost:631 CUPS web interface], go to Printers > Delete Printer.<br />
<br />
To check the printer's settings go to ''Printers'', then ''Modify Printer''. Copy down the information displayed, click 'Modify Printer' to proceed to the next page(s), and so on.<br />
<br />
==== All jobs are "The printer is not responding" ====<br />
<br />
On networked printers, you should check that the name that CUPS uses as its connection URI resolves to the printer's IP via DNS, e.g.<br />
If your printer's connection looks like this:<br />
lpd://BRN_020554/BINARY_P1<br />
<br />
then the hostname 'BRN_020554' needs to resolve to the printer's IP from the server running CUPS<br />
<br />
==== The PPD version is not compatible with gutenprint ====<br />
<br />
Run:<br />
# /usr/bin/cups-genppdupdate<br />
<br />
And restart CUPS (as pointed out in gutenprint's post-install message)<br />
<br />
=== Other ===<br />
<br />
===== CUPS permission errors =====<br />
<br />
* Some users fixed 'NT_STATUS_ACCESS_DENIED' (Windows clients) errors by using a slightly different syntax:<br />
smb://workgroup/username:password@hostname/printer_name<br />
<br />
* Sometimes, the block device has wrong permissions:<br />
# ls /dev/usb/<br />
lp0<br />
# chgrp lp /dev/usb/lp0<br />
<br />
==== HPLIP printer sends "/usr/lib/cups/backend/hp failed" error ====<br />
<br />
Make sure dbus is installed and running. If the error persists, try starting avahi-daemon.<br />
<br />
Try adding the printer as a Network Printer using the http:// protocol. Generate the printer URI with {{ic|hp-makeuri}}.<br />
<br />
{{Note|There might need to set permissions issues right. Follow indications here: [[CUPS#Device node permissions]].}}<br />
<br />
==== HPLIP printer claims job is complete but printer does nothing ====<br />
<br />
This happens on HP printers when you select the (old) hpijs driver (e.g. the Deskjet D1600 series). Instead, use the hpcups driver when adding the printer.<br />
<br />
Some HP printers (e.g HP LaserJet) require their firmware to be downloaded from the computer every time the printer is switched on. If there is an issue with udev (or equivalent) and the firmware download rule is never fired, you may experience this issue.<br />
As a workaround, you can manually download the firmware to the printer. Ensure the printer is plugged in and switched on, then enter<br />
hp-firmware -n<br />
<br />
==== hp-setup asks to specify the PPD file for the discovered printer ====<br />
<br />
Install CUPS before running hp-setup.<br />
<br />
==== I have installed Qt, but hp-setup reports "Qt/PyQt 4 initialization failed" ====<br />
<br />
"hp-check -t" won't give you useful information to find the required package. You have to install all the "Dependent Packages" prefixed with "python2" in https://www.archlinux.org/packages/extra/x86_64/hplip/<br />
<br />
==== hp-setup finds the printer automatically but reports "Unable to communicate with device" when printing test page immediately afterwards ====<br />
<br />
This at least happens to hplip 3.13.5-2 for HP Officejet 6500A through local network connection. To solve the problem, specify the IP address of the HP printer for hp-setup to locate the printer.<br />
<br />
==== hp-toolbox sends an error, "Unable to communicate with device" ====<br />
<br />
If running hp-toolbox as a regular user results in:<br />
# hp-toolbox<br />
# error: Unable to communicate with device (code=12): hp:/usb/''printer id''<br />
or, "{{ic|Unable to communicate with device"}}", then it may be needed to [[Groups#Group management|add the user to the lp and sys groups]].<br />
<br />
This can also be caused by printers such as the P1102 that provide a virtual cd-rom drive for MS-Windows drivers. The lp dev appears and then disappears. In that case try the '''usb-modeswitch''' and '''usb-modeswitch-data''' packages, that lets one switch off the "Smart Drive" (udev rules included in said packages).<br />
<br />
This can also occur with network attached printers if the [[Avahi|avahi-daemon]] is not running. Another possiblility is the specification of the printer's IP address in hp-setup fails to locate the printer because the IP address of the the printer changed due to DHCP.<br />
<br />
==== CUPS returns '"foomatic-rip" not available/stopped with status 3' with a HP printer ====<br />
<br />
If receiving any of the following error messages in {{ic|/var/log/cups/error_log}} while using a HP printer, with jobs appearing to be processed while they all end up not being completed with their status set to 'stopped':<br />
Filter "foomatic-rip" for printer ''printer_name'' not available: No such file or director<br />
or:<br />
PID 5771 (/usr/lib/cups/filter/foomatic-rip) stopped with status 3!<br />
make sure {{pkg|hplip}} has been [[pacman|installed]], in addition to [[#Packages|the packages mentioned above]]. See [https://bbs.archlinux.org/viewtopic.php?id=65615 this forum post] for more information.<br />
<br />
==== Printing fails with unauthorised error ====<br />
<br />
If the user has been added to the lp group, and allowed to print (set in {{ic|cupsd.conf}}), then the problem lies in {{ic|/etc/cups/printers.conf}}. This line could be the culprit:<br />
AuthInfoRequired negotiate<br />
<br />
Comment it out and restart CUPS.<br />
<br />
==== Print button greyed-out in GNOME print dialogs ====<br />
<br />
:''<small>Source: [https://bbs.archlinux.org/viewtopic.php?id=70418 I can't print from gnome applications. - Arch Forums]</small>''<br />
<br />
Be sure the package: '''libgnomeprint''' is installed<br />
<br />
Edit {{ic|/etc/cups/cupsd.conf}} and add:<br />
# HostNameLookups Double<br />
<br />
Restart cups.service.<br />
<br />
==== Unknown supported format: application/postscript ====<br />
<br />
Comment the lines:<br />
application/octet-stream application/vnd.cups-raw 0 -<br />
from {{ic|/etc/cups/mime.convs}}, and:<br />
application/octet-stream<br />
in {{ic|/etc/cups/mime.types}}.<br />
<br />
==== Finding URIs for Windows print servers ====<br />
<br />
Sometimes Windows is a little less than forthcoming about exact device URIs (device locations). If having trouble specifying the correct device location in CUPS, run the following command to list all shares available to a certain windows username:<br />
$ smbtree -U ''windowsusername''<br />
This will list every share available to a certain Windows username on the local area network subnet, as long as Samba is set up and running properly. It should return something like this:<br />
{{bc| WORKGROUP<br />
\\REGULATOR-PC <br />
\\REGULATOR-PC\Z <br />
\\REGULATOR-PC\Public <br />
\\REGULATOR-PC\print$ Printer Drivers<br />
\\REGULATOR-PC\G <br />
\\REGULATOR-PC\EPSON Stylus CX8400 Series EPSON Stylus CX8400 Series}}<br />
What is needed here is first part of the last line, the resource matching the printer description. So to print to the EPSON Stylus printer, one would enter:<br />
smb://username.password@REGULATOR-PC/EPSON Stylus CX8400 Series<br />
as the URI into CUPS. Notice that whitespaces are allowed in URIs, whereas backslashes get replaced with forward slashes.<br />
If it won't work try '%20' instead of spaces.<br />
<br />
==== Print-Job client-error-document-format-not-supported ====<br />
<br />
Try installing the foomatic packages and use a foomatic driver.<br />
<br />
==== /usr/lib/cups/backend/hp failed ====<br />
<br />
Change:<br />
SystemGroup sys root<br />
to:<br />
SystemGroup lp root<br />
in {{ic|/etc/cups/cupsd.conf}}<br />
<br />
<br />
Following steps 1-3 in the Alternative CUPS interfaces below may be a better solution, since newer versions of cups will not allow the same group for both normal and admin operation.<br />
<br />
==== Unable to get list of printer drivers ====<br />
<br />
* Check your ServerName in /etc/cups/client.conf is written without http://<br />
ServerName localhost:631<br />
* Try to remove Foomatic drivers.<br />
<br />
==== lp: Error - Scheduler Not Responding ====<br />
<br />
If you get this error when printing a document using:<br />
<br />
$ lp document-to-print<br />
<br />
Try setting the CUPS_SERVER environment variable:<br />
<br />
$ export CUPS_SERVER=localhost<br />
<br />
If this solves your problem, make the solution permanent by adding the export line above to ~/.bash_profile.<br />
<br />
==== CUPS prints only an empty and an error-message page on HP LaserJet ====<br />
<br />
There is a bug that causes CUPS to fail when printing images on HP LaserJet (in my case 3380). The bug has been reported and fixed by [https://bugs.launchpad.net/ubuntu/+source/cups-filters/+bug/998087 Ubuntu].<br />
The first page is empty, the second page contains the following error message:<br />
ERROR:<br />
invalidaccess<br />
OFFENDING COMMAND:<br />
filter<br />
STACK:<br />
/SubFileDecode<br />
endstream<br />
...<br />
<br />
In order to fix the issue, use the following command (as superuser):<br />
lpadmin -p ''printer'' -o pdftops-renderer-default=pdftops<br />
<br />
==== "Using invalid Host" error message ====<br />
<br />
Try to add "ServerAlias *" into cupsd.conf<br />
<br />
==== Printer doesn't print with an "Filter failed" message on CUPS web interface (HP printer) ====<br />
<br />
Change the permissions of the printer USB port:<br />
<br />
Get the bus and device number from lsusb, then set the permission using:<br />
<br />
chmod 0666 /dev/bus/usb/''bus number''/''device number''<br />
<br />
To make the persistent permission change that will be triggered automatically each time the computer is rebooted, add the following line.<br />
<br />
{{hc|/etc/udev/rules.d/10-local.rules|2=<br />
SUBSYSTEM=="usb", ATTRS{idVendor}=="Printer_idVendor", ATTRS{idProduct}=="Printer_idProduct", GROUP="lp", MODE:="666"<br />
}}<br />
<br />
Obtain the right information by using {{ic|lsusb}} command, and don't forget to substitute {{ic|Printer_idVendor}} & {{ic|Printer_idProduct}} with the relevant ones.<br />
<br />
Each system may vary, so consult [[udev#List_attributes_of_a_device]] wiki page.<br />
<br />
==== Printer doesn't print with an "Filter failed" message on CUPS web interface (HP printer connected over network) ====<br />
<br />
Start, enable and restart the avahi-daemon.<br />
<br />
==== HPLIP 3.13: Plugin is installed, but HP Device Manager complains it is not ====<br />
<br />
The issue might have to do with the file permission change that had been made to {{ic|/var/lib/hp/hplip.state}}. To correct the issue, a simple {{ic|chmod 644 /var/lib/hp/hplip.state}} and {{ic|chmod 755 /var/lib/hp}} should be sufficient. For further information, please read this [https://bugs.launchpad.net/hplip/+bug/1131596 link].<br />
<br />
==== Printer is not recognized by CUPS ====<br />
<br />
If your printer is not listed in the "Add Printers" page of the CUPS web interface, nor by lpinfo -v, try the following (suggested in [https://bbs.archlinux.org/viewtopic.php?pid=1037279#p1037279 this thread]):<br />
<br />
* Remove {{ic|usblp}} from blacklist<br />
* Load {{ic|usblp}} module<br />
modprobe usblp<br />
* Stop cups<br />
* Add the following udev rule in a new rule file:<br />
{{hc|/etc/udev/rules.d/10-cups_device_link.rules|2=<br />
KERNEL=="lp[0-9]", SYMLINK+="%k", GROUP="lp"<br />
}}<br />
* Reload udev rules:<br />
# udevadm control --reload-rules<br />
* Unplug and re-plug the printer.<br />
* Wait a few seconds and then start cups again.<br />
<br />
==== Can't load /etc/samba/smb.conf ====<br />
<br />
If you're printing to a remote printer over SMB and get this error message: "Can't load /etc/samba/smb.conf - run testparm to debug it", then create an empty smb.conf:<br />
<br />
# mkdir /etc/samba<br />
# touch /etc/samba/smb.conf<br />
<br />
and restart cupsd.<br />
<br />
==== CUPS' systemd service does not start even though it's enabled ====<br />
<br />
The systemd .service file provided by CUPS uses socket activation, meaning the service is only started when an<br />
application connects to CUPS' socket. However, the systemd .socket file provided by cups only works for the local <br />
{{ic|/var/run/cups/cups.sock}} socket. <br />
<br />
In order to have cupsd start when initiating a print job over the network, create the following file:<br />
<br />
{{hc|/etc/systemd/system/cups.socket|<br />
.include /usr/lib/systemd/system/cups.socket<br />
<br />
[Socket]<br />
ListenStream&#61;0.0.0.0:631<br />
ListenDatagram&#61;0.0.0.0:631<br />
BindIPv6Only&#61;ipv6-only<br />
}}<br />
<br />
Then reload systemd:<br />
<br />
# systemctl --system daemon-reload<br />
<br />
Confirm that everything is working correctly:<br />
<br />
{{bc|<br />
# systemctl is-enabled cups.service &#124;&#124; systemctl enable cups.service<br />
# systemctl status cups.socket<br />
cups.socket - CUPS Printing Service Sockets<br />
Loaded: loaded (/etc/systemd/system/cups.socket; enabled)<br />
Active: inactive (dead)<br />
Listen: /var/run/cups/cups.sock (Stream)<br />
0.0.0.0:631 (Stream)<br />
0.0.0.0:631 (Datagram)<br />
}}<br />
<br />
CUPS should now start automatically when printing locally or over the network.<br />
<br />
== See also ==<br />
<br />
* [http://localhost:631/documentation.html Official CUPS documentation], ''locally installed''<br />
* [http://www.cups.org/ Official CUPS website]<br />
* [http://www.linuxprinting.org/ Linux Printing], ''[http://www.linuxfoundation.org The Linux Foundation]''<br />
* [http://www.gentoo.org/doc/en/printing-howto.xml Gentoo's printing guide], ''[http://www.gentoo.org/doc/en Gentoo Documentation resources]''<br />
* [https://bbs.archlinux.org/ Arch Linux user forums]<br />
* [http://wiki.gotux.net/tutorials/software/hp-printer Install HP printers easy way]</div>SilverWyrdahttps://wiki.archlinux.org/index.php?title=MariaDB&diff=268149MariaDB2013-07-26T23:20:30Z<p>SilverWyrda: /* Upgrade from Oracle MySQL to MariaDB */</p>
<hr />
<div>[[Category:Database management systems]]<br />
[[cs:MySQL]]<br />
[[de:MySQL]]<br />
[[es:MySQL]]<br />
[[fr:MySQL]]<br />
[[it:MySQL]]<br />
[[sr:MySQL]]<br />
[[tr:MySQL]]<br />
[[zh-CN:MySQL]]<br />
MySQL is a widely spread, multi-threaded, multi-user SQL database. For more information about features, see the [http://www.mysql.com/ official homepage].<br />
<br />
{{Note|MariaDB is now officially Arch Linux default implementation of MySQL. It is recommended for all users to [[#Upgrade from Oracle MySQL to MariaDB|upgrade]] to MariaDB. Oracle MySQL was dropped to the AUR. See [https://www.archlinux.org/news/mariadb-replaces-mysql-in-repositories/ the announcement].}}<br />
<br />
== Installation ==<br />
<br />
The MySQL implementation choosen by Archlinux is called MariaDB.<br />
[[pacman|Install]] {{Pkg|mariadb}}, {{Pkg|libmariadbclient}}, {{Pkg|mariadb-clients}} packages from the [[official repositories]].<br />
Alternate implementations are {{Pkg|percona-server}} and Oracle {{AUR|mysql}}.<br />
<br />
{{Tip|If the database (in /var/lib/mysql) resides in a [[btrfs]] filesystem you should consider disabling [[Btrfs#Copy-On-Write_.28CoW.29|Copy-on-Write]] for the directory before creating any database:<br />
{{ic|# chattr +C /var/lib/mysql}}<br />
}}<br />
<br />
Start the {{ic|mysqld}} [[daemon]], run the setup script and restart the daemon afterwards:<br />
# systemctl start mysqld<br />
# mysql_secure_installation<br />
# systemctl restart mysqld<br />
<br />
Frontends available are {{AUR|mysql-gui-tools}} and {{AUR|mysql-workbench}}.<br />
<br />
=== Upgrade from Oracle MySQL to MariaDB ===<br />
<br />
Users who want to switch will need to install mariadb, libmariadbclient or mariadb-clients and execute mysql_upgrade in order to migrate their systems.<br />
# systemctl stop mysqld<br />
# pacman -S mariadb libmariadbclient mariadb-clients<br />
# systemctl start mysqld<br />
# mysql_upgrade -p<br />
<br />
Notice that it could be needed to remove the following files from {{ic|/var/lib/mysql}} : {{ic|ib_logfile0}}, {{ic|ib_logfile1}} and {{ic|aria_log_control}} before starting the daemon.<br />
<br />
=== On update ===<br />
<br />
You might consider running this command after you have upgraded MySQL and started it:<br />
# mysql_upgrade -u root -p<br />
<br />
== Configuration ==<br />
<br />
Once you have started the MySQL server, you probably want to add a root account in order to maintain your MySQL users and databases. This can be done manually or automatically, as mentioned by the output of the above script. Either run the commands to set a password for the root account, or run the secure installation script.<br />
<br />
You now should be able to do further configuration using your favorite interface. For example you can use MySQL's command line tool to log in as root into your MySQL server:<br />
$ mysql -p -u root<br />
<br />
=== Disable remote access ===<br />
<br />
The MySQL server is accessible from the network by default. If MySQL is only needed for the localhost, you can improve security by not listening on TCP port 3306. To refuse remote connections, uncomment the following line in {{ic|/etc/mysql/my.cnf}}:<br />
skip-networking<br />
<br />
You will still be able to log in from the localhost.<br />
<br />
=== Enable auto-completion ===<br />
<br />
{{Note|Enabling this feature can make the client initialization longer.}}<br />
The MySQL client completion feature is disabled by default. To enable it system-wide edit {{ic|/etc/mysql/my.cnf}}, and replace {{ic|no-auto-rehash}} by {{ic|auto-rehash}}. Completion will be enabled next time you run the MySQL client.<br />
<br />
=== Using UTF-8 ===<br />
<br />
In the {{ic|/etc/mysql/my.cnf}} file section under the "mysqld" group, add:<br />
<br />
{{bc|<nowiki>[mysqld]<br />
init_connect = 'SET collation_connection = utf8_general_ci,NAMES utf8'<br />
collation_server = utf8_general_ci<br />
character_set_client = utf8<br />
character_set_server = utf8</nowiki>}}<br />
<br />
=== Using a TMPFS for tmpdir ===<br />
<br />
The directory used by MySQL for storing temporary files is named "tmpdir". For example, it is used to perform disk based large sorts, as well as for internal and explicit temporary tables.<br />
<br />
Create the directory with appropriate permissions:<br />
$ mkdir -pv /var/lib/mysqltmp<br />
$ chown mysql:mysql /var/lib/mysqltmp<br />
<br />
Find the id and gid of the "mysql" user and group:<br />
$ id mysql<br />
uid=27(mysql) gid=27(mysql) groups=27(mysql)<br />
<br />
Add to your {{ic|/etc/fstab}} file.<br />
tmpfs /var/lib/mysqltmp tmpfs rw,gid=27,uid=27,size=100m,mode=0750,noatime 0 0<br />
<br />
Add to your {{ic|/etc/mysql/my.cnf}} file under the "mysqld" group:<br />
tmpdir = /var/lib/mysqltmp<br />
<br />
Then reboot or ( shutdown mysql, mount the tmpdir, start mysql ).<br />
<br />
== Backup ==<br />
<br />
The database can be dumped to a file for easy backup. The following shell script will do this for you, creating a {{ic|db_backup.gz}} file in the same directory as the script, containing your database dump:<br />
<br />
{{bc|1=<br />
#!/bin/bash<br />
<br />
THISDIR=$(dirname $(readlink -f "$0"))<br />
<br />
mysqldump --single-transaction --flush-logs --master-data=2 --all-databases \<br />
<nowiki>| gzip > $THISDIR/db_backup.gz<br />
echo 'purge master logs before date_sub(now(), interval 7 day);' |</nowiki> mysql<br />
}}<br />
<br />
See also the official {{ic|mysqldump}} [http://dev.mysql.com/doc/refman/5.6/en/mysqldump.html page] in the MySQL manual.<br />
<br />
== Troubleshooting ==<br />
<br />
=== MySQL daemon cannot start ===<br />
<br />
If MySQL fails to start and there is no entry in the log files, you might want to check the permissions of files in the directories {{ic|/var/lib/mysql}} and {{ic|/var/lib/mysql/mysql}}. If the owner of files in these directories is not {{ic|mysql:mysql}}, you should do the following:<br />
# chown mysql:mysql /var/lib/mysql -R<br />
If you run into permission problems despite having followed the above, ensure that your {{ic|my.cnf}} is copied to {{ic|/etc/}}:<br />
# cp /etc/mysql/my.cnf /etc/my.cnf<br />
Now try and start the daemon.<br />
<br />
If you get these messages in your {{ic|/var/lib/mysql/hostname.err}}<br />
[ERROR] Can't start server : Bind on unix socket: Permission denied<br />
[ERROR] Do you already have another mysqld server running on socket: /var/run/mysqld/mysqld.sock ?<br />
[ERROR] Aborting<br />
The permissions of {{ic|/var/run/mysqld}} could be the culprit.<br />
# chown mysql:mysql /var/run/mysqld -R<br />
<br />
If you run mysqld and the following error appears:<br />
Fatal error: Can’t open and lock privilege tables: Table ‘mysql.host’ doesn’t exist<br />
Run the following command from the {{ic|/usr}} directory to install the default tables:<br />
# cd /usr<br />
# mysql_install_db --user=mysql --ldata=/var/lib/mysql/<br />
<br />
=== Unable to run mysql_upgrade because MySQL cannot start ===<br />
<br />
Try run MySQL in safemode:<br />
# mysqld_safe --datadir=/var/lib/mysql/<br />
And then run:<br />
# mysql_upgrade -u root -p<br />
<br />
=== Reset the root password ===<br />
<br />
Stop the ''mysqld'' [[daemon]]. Issue the following command:<br />
# mysqld_safe --skip-grant-tables &<br />
Connect to the mysql server. Issue the following command:<br />
# mysql -u root mysql<br />
Change root password:<br />
mysql> UPDATE mysql.user SET Password=PASSWORD('MyNewPass') WHERE User='root';<br />
mysql> FLUSH PRIVILEGES;<br />
mysql> exit<br />
Start the ''mysqld'' daemon.<br />
<br />
=== Check and repair all tables ===<br />
<br />
Check and auto repair all tables in all databases, [http://dev.mysql.com/doc/refman/5.7/en/mysqlcheck.html see more]<br />
# mysqlcheck -A --auto-repair -u root -p<br />
<br />
=== Optimize all tables ===<br />
<br />
Forcefully Optimize all tables, automatically fixing table errors that may come up.<br />
# mysqlcheck -A --auto-repair -f -o -u root -p<br />
<br />
== See also ==<br />
<br />
* [[LAMP]] - Arch wiki article covering the setup of a LAMP server (Linux Apache MySQL PHP)<br />
* [[PhpMyAdmin]] - Arch wiki article covering the web-based tool to help manage MySQL databases using an Apache/PHP frontend.<br />
* [[PHP]] - Archi wiki article on PHP.<br />
<br />
== External links ==<br />
<br />
* [https://mariadb.org/ MariaDB Official Website]<br />
* [http://www.mysql.com/ Oracle MySQL Official Website]<br />
* [http://www.percona.com/software Percona Software for MySQL]<br />
* [http://www.askapache.com/mysql/performance-tuning-mysql.html MySQL Performance Tuning Scripts and Know-How]</div>SilverWyrdahttps://wiki.archlinux.org/index.php?title=Prey&diff=264847Prey2013-07-01T16:47:08Z<p>SilverWyrda: </p>
<hr />
<div>[[Category:Networking]]<br />
[[Category:Security]]<br />
[http://www.preyproject.com/ Prey] is a set of bash scripts that helps you track your computer when it is stolen.<br />
<br />
This guide shows you how to install Prey.<br />
<br />
== Installation ==<br />
<br />
Install {{AUR|prey-tracker}} from the [[AUR]]. <br />
<br />
== Configuration ==<br />
Add your device using the control panel on Prey's website. <br />
<br />
{{Note|The 'Add new device' button in the control panel links to Prey's download page for whatever reason. You can add a new device here: https://panel.preyproject.com/devices/new}}<br />
<br />
Edit {{ic|/usr/share/prey/config}} and add your device key and API key, both of which are listed in Prey's control panel. <br />
<br />
Run {{ic|/usr/share/prey/prey.sh}} as root to ensure that the configuration is correct.<br />
<br />
{{Note|The old version of {{AUR|prey-tracker}} ( < 0.5.9-3) was in {{ic|/usr/share/prey-tracker/}} folder, now (>0.5.10-2) it is in {{ic|/usr/share/prey/}}.}}<br />
<br />
Enable [[systemd]] service '''prey-tracker''' to automatically start Prey at boot {{ic|# systemctl enable prey-tracker.timer}}<br />
<br />
=== Modules ===<br />
To enable/disable modules, you must change the executable permissions for the the "run" files in prey's respective modules/core subdirectories. Adding executable permissions to a module will enable it, while removing permissions will disable the module.<br />
<br />
=== GUI config ===<br />
<br />
You can use a GUI to configure prey using the {{ic|prey-config}} script:<br />
<br />
# /usr/share/prey/platform/linux/prey-config.py<br />
<br />
Note that if this doesn't work you are missing a dependency, not sure if Python alone suffices.<br />
<br />
=== Standalone Mode ===<br />
<br />
The GUI can be used to configure standalone mode.<br />
<br />
Alternatively,{{ic|/usr/share/prey/config}} can be edited to change {{ic|post_method}} to {{ic|email}} and edit the SMTP settings.<br />
<br />
Note that in Standalone Mode, all modules in {{ic|/usr/share/prey/modules}} run by default. To disable them, remove executable permissions on the module's {{ic|run}} file (located within the module's {{ic|core}} subdirectory). For example, the following command disables the {{ic|alarm}} module:<br />
{{bc|# chmod -x /usr/share/prey/modules/alarm/core/run}}<br />
<br />
=== Troubleshooting ===<br />
To troubleshoot, run<br />
<br />
{{bc|# /usr/share/prey/prey.sh --check}}<br />
<br />
Ensure you have enabled [[systemd]] service '''prey-tracker.service''' and '''prey-tracker.timer''' to start Prey at boot.<br />
<br />
If you're not receiving webcam images in you reports, install {{Pkg|xawtv}} from the official repositories.<br />
<br />
==== Beeping ====<br />
If [[Taking_a_Screenshot#scrot|scrot]] is installed, prey will use it to take a screenshot if the {{ic|session}} module is enabled. Unfortunately, scrot emits an annoying beep everytime it is run. To disable beeping, append {{ic|xset -b}}<br />
to the beginning of {{ic|/usr/share/prey/modules/session/core/run}}.<br />
<br />
=== Bugs ===<br />
There seems to be a bug in version 0.5.3 which gives an error if the SMTP password is set when using "email" post_method, which returns an error, but works fine when executed normally without the --check option.</div>SilverWyrdahttps://wiki.archlinux.org/index.php?title=Prey&diff=264845Prey2013-07-01T16:46:33Z<p>SilverWyrda: </p>
<hr />
<div>[[Category:Networking]]<br />
[[Category:Security]]<br />
[http://www.preyproject.com/ Prey] is a set of bash scripts that helps you track your computer when it is stolen.<br />
<br />
This guide shows you how to install Prey.<br />
<br />
== Installation ==<br />
<br />
Install {{AUR|prey-tracker}} from the [[AUR]]. <br />
<br />
== Configuration ==<br />
Add your device using the control panel on Prey's website. <br />
<br />
{{Note|The 'Add new device' button in the control panel links to Prey's download page for whatever reason. You can add a new device here: https://panel.preyproject.com/devices/new}}<br />
<br />
Edit {{ic|/usr/share/prey/config}} and add your device key and API key, both of which are listed in Prey's control panel. <br />
<br />
Run {{ic|/usr/share/prey/prey.sh}} as root to ensure that the configuration is correct.<br />
<br />
{{Note|The old version of {{AUR|prey-tracker}} ( < 0.5.9-3) was in {{ic|/usr/share/prey-tracker/}} folder, now (>0.5.10-2) it is in {{ic|/usr/share/prey/}}.}}<br />
<br />
Enable [[systemd]] service '''prey-tracker''' to automatically start Prey at boot {{ic|# systemctl enable prey-tracker.timer}}<br />
<br />
=== Modules ===<br />
To enable/disable modules, you must change the executable permissions for the the "run" files in prey's respective modules/core subdirectories. Adding executable permissions to a module will enable it, while removing permissions will disable the module.<br />
<br />
=== GUI config ===<br />
<br />
You can use a GUI to configure prey using the {{ic|prey-config}} script:<br />
<br />
# /usr/share/prey/platform/linux/prey-config.py<br />
<br />
Note that if this doesn't work you are missing a dependency, not sure if Python alone suffices.<br />
<br />
=== Standalone Mode ===<br />
<br />
The GUI can be used to configure standalone mode.<br />
<br />
Alternatively,{{ic|/usr/share/prey/config}} can be edited to change {{ic|post_method}} to {{ic|email}} and edit the SMTP settings.<br />
<br />
Note that in Standalone Mode, all modules in {{ic|/usr/share/prey/modules}} run by default. To disable them, remove executable permissions on the module's {{ic|run}} file (located within the module's {{ic|core}} subdirectory). For example, the following command disables the {{ic|alarm}} module:<br />
{{bc|# chmod -x /usr/share/prey/modules/alarm/core/run}}<br />
<br />
=== Troubleshooting ===<br />
To troubleshoot, run<br />
<br />
{{bc|# /usr/share/prey/prey.sh --check}}<br />
<br />
Ensure you have enabled [[systemd]] service '''prey-tracker.service''' and '''prey-trackter.timer''' to start Prey at boot.<br />
<br />
If you're not receiving webcam images in you reports, install {{Pkg|xawtv}} from the official repositories.<br />
<br />
==== Beeping ====<br />
If [[Taking_a_Screenshot#scrot|scrot]] is installed, prey will use it to take a screenshot if the {{ic|session}} module is enabled. Unfortunately, scrot emits an annoying beep everytime it is run. To disable beeping, append {{ic|xset -b}}<br />
to the beginning of {{ic|/usr/share/prey/modules/session/core/run}}.<br />
<br />
=== Bugs ===<br />
There seems to be a bug in version 0.5.3 which gives an error if the SMTP password is set when using "email" post_method, which returns an error, but works fine when executed normally without the --check option.</div>SilverWyrda