<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.alpinelinux.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Unicorn</id>
	<title>Alpine Linux - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.alpinelinux.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Unicorn"/>
	<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/wiki/Special:Contributions/Unicorn"/>
	<updated>2026-04-30T02:31:11Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.40.0</generator>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=MDNS&amp;diff=31277</id>
		<title>MDNS</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=MDNS&amp;diff=31277"/>
		<updated>2025-10-26T13:57:34Z</updated>

		<summary type="html">&lt;p&gt;Unicorn: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{DISPLAYTITLE:mDNS}}&lt;br /&gt;
[https://en.wikipedia.org/wiki/Multicast_DNS Multicast DNS] is a protocol that is normally used for the discovery of printers.  Avahi is a popular implementation by but more setup is needed for the regular name resolution to see the results.&lt;br /&gt;
&lt;br /&gt;
== Setup avahi ==&lt;br /&gt;
&lt;br /&gt;
Install, enable and start avahi with:{{cmd|$ doas apk add {{pkg|avahi}}&lt;br /&gt;
$ doas rc-update add avahi-daemon&lt;br /&gt;
$ doas rc-service avahi-daemon start}}&lt;br /&gt;
&lt;br /&gt;
It should now be possible to browse results. To look for a printer, use:&lt;br /&gt;
&lt;br /&gt;
{{cmd|$ doas apk add {{pkg|avahi-tools}}&lt;br /&gt;
$ avahi-browse --resolve --terminate  _ipp._tcp}}&lt;br /&gt;
&lt;br /&gt;
Make note of the hostname, as we will use it afterwards.&lt;br /&gt;
&lt;br /&gt;
== Setup avahi2dns ==&lt;br /&gt;
&lt;br /&gt;
Name resolution is implemented by musl, and it only supports DNS, so we need to make the avahi results accessible through regular DNS lookups. This is done by [https://github.com/LouisBrunner/avahi2dns avahi2dns], which is available in the {{pkg|avahi2dns}} package in the [[Repositories#Testing|testing]] repository. It can be safely installed after following the [[Repositories#Using_testing_repository|testing repository setup guidelines]]:&lt;br /&gt;
&lt;br /&gt;
{{cmd|$ doas apk add avahi2dns@testing}}&lt;br /&gt;
&lt;br /&gt;
Since we will want a DNS server running locally on port 53, avahi2dns needs to use another port. This is done by default with {{path|/etc/conf.d/avahi2dns}} containing:&lt;br /&gt;
&lt;br /&gt;
  command_args=&amp;quot;-p 5354&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Enable and start avahi2dns with the command:{{cmd|$ doas rc-update add avahi2dns&lt;br /&gt;
$ doas rc-service avahi2dns start}}&lt;br /&gt;
&lt;br /&gt;
It should now be possible to use DNS to query the address of the printer:{{cmd|$ drill -p 5354 @127.0.0.1 &amp;lt;printer_name&amp;gt;.local}}&lt;br /&gt;
&lt;br /&gt;
Where printer_name is the hostname given by avahi-browse.&lt;br /&gt;
&lt;br /&gt;
== Setup Networkmanager ==&lt;br /&gt;
&lt;br /&gt;
If you are already using [[NetworkManager|Networkmanager]], you can leverage {{pkg|dnsmasq}} as your DNS server which can easily forward mDNS requests to another server.&lt;br /&gt;
&lt;br /&gt;
Install the {{pkg|networkmanager-dnsmasq}} package: {{cmd|$ doas apk add {{pkg|networkmanager-dnsmasq}}}}&lt;br /&gt;
&lt;br /&gt;
Configure networkmanager to use dnsmasq as it&#039;s dns server by editing {{path|/etc/NetworkManager/NetworkManager.conf}} as follows {{Cat|/etc/NetworkManager/NetworkManager.conf|&amp;lt;nowiki&amp;gt;[main] &lt;br /&gt;
dhcp=internal&lt;br /&gt;
dns=dnsmasq&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
Then we need to tell dnsmasq to forward all mDNS queries to avahidns by editing the file {{path|/etc/NetworkManager/dnsmasq.d/mdns.conf}} as follows {{Cat|/etc/NetworkManager/dnsmasq.d/mdns.conf|# Forward queries for the &amp;quot;local&amp;quot; domain to 127.0.0.1 port 5354&lt;br /&gt;
server{{=}}/local/127.0.0.1#5354}}&lt;br /&gt;
&lt;br /&gt;
Restart networkmanager: {{cmd|$ doas rc-service networkmanager restart}}&lt;br /&gt;
&lt;br /&gt;
== Without NetworkManager ==&lt;br /&gt;
&lt;br /&gt;
If you are not using [[NetworkManager|Networkmanager]], you will need to setup a DNS resolver that will forward request of .local domain to avahi2dns and handle other requests normally. There is more than one way to do it.&lt;br /&gt;
&lt;br /&gt;
=== Setup unbound as DNS resolver ===&lt;br /&gt;
&lt;br /&gt;
We will use [[Setting up unbound DNS server|unbound]] as the local DNS server and {{ic|resolvconf}} to inform local applications that a local DNS server exists and to inform unbound about the DHCP results. This option is probably most convenient for a laptop: using the DHCP provided by the server for the regular DNS requests.&lt;br /&gt;
&lt;br /&gt;
Install the programs: {{cmd|$ doas apk add {{pkg|openresolv}} {{pkg|unbound}}}}&lt;br /&gt;
&lt;br /&gt;
Create {{path|/etc/resolvconf.conf}} as follows:{{Cat|/etc/resolvconf.conf|&amp;lt;nowiki&amp;gt;name_servers=127.0.0.1&lt;br /&gt;
unbound_conf=/etc/unbound/unbound.conf.d/resolvconf.conf&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
This tells resolveconf to use a local nameserver and pass the DHCP provided DNS server to unbound. Create {{path|/etc/unbound/unbound.conf.d/avahi-local.conf}} as follows {{Cat|/etc/unbound/unbound.conf.d/avahi-local.conf|&lt;br /&gt;
  forward-zone:&lt;br /&gt;
        name: &amp;quot;local&amp;quot;&lt;br /&gt;
        forward-addr: 127.0.0.1@5354&lt;br /&gt;
  server:&lt;br /&gt;
        do-not-query-localhost: no&lt;br /&gt;
        domain-insecure: &amp;quot;local&amp;quot;&lt;br /&gt;
}}&lt;br /&gt;
This reads the information provided by resolvconf, but forwards .local requests to avahi2dns. We also need to disable dnssec for .local and tell unbound that it is OK to query localhost.&lt;br /&gt;
&lt;br /&gt;
Enable and start unbound. {{cmd|$ doas rc-update add unbound&lt;br /&gt;
$ doas rc-service unbound start}}&lt;br /&gt;
&lt;br /&gt;
=== Using existing bind server as DNS resolver ===&lt;br /&gt;
&lt;br /&gt;
It is assumed that a bind(named) server is already installed and running, if not, then you can use the instructions [[Small-Time_DNS_with_BIND9]]&lt;br /&gt;
&lt;br /&gt;
Once the bind(named) server is up and running, then the solution is to set an access &amp;quot;zone&amp;quot; for postfix addresses.local&lt;br /&gt;
&lt;br /&gt;
To do this, add the following lines to the bind configuration file {{path|/etc/bind/named.conf}} as follows {{Cat|/etc/bind/named.conf|&lt;br /&gt;
&lt;br /&gt;
 zone &amp;quot;local&amp;quot; {&lt;br /&gt;
   type forward; # type requests&lt;br /&gt;
   forward only; # rule to use only forwards&lt;br /&gt;
   forwarders {&lt;br /&gt;
     127.0.0.1 port 5354; # Avahi2dns address and port&lt;br /&gt;
   };&lt;br /&gt;
 };&lt;br /&gt;
}}&lt;br /&gt;
Additionally, you may need to disable dnssec verification for the .local postfix. To do this, add the following lines inside the options configuration {{Cat|/etc/bind/named.conf|...&lt;br /&gt;
&lt;br /&gt;
 options {&lt;br /&gt;
 ...&lt;br /&gt;
   validate-except {&lt;br /&gt;
     &amp;quot;local&amp;quot;;&lt;br /&gt;
   };&lt;br /&gt;
 ...&lt;br /&gt;
 };&lt;br /&gt;
}}&lt;br /&gt;
After adding the configuration, double-check that you have a .local zone. To do this, use the command: {{Cmd|$ named-checkconf -l # OUTPUT: local IN _default forward}}&lt;br /&gt;
&lt;br /&gt;
If there were no errors, you can reload the bind(named) service:{{Cmd|$ doas rc-service named reload}}&lt;br /&gt;
&lt;br /&gt;
=== Setup DHCP client ===&lt;br /&gt;
&lt;br /&gt;
How send the DHCP provided DNS to resolvconf depends on the DHCP client being used.&lt;br /&gt;
&lt;br /&gt;
==== udhcpc ====&lt;br /&gt;
&lt;br /&gt;
This is the DHCP client in busybox, and will work for both wired and wireless interfaces. Create {{path|/etc/udhcpc/udhcpc.conf}} as follows {{path||/etc/udhcpc/udhcpc.conf|&amp;lt;nowiki&amp;gt;&lt;br /&gt;
RESOLV_CONF=&amp;quot;/etc/udhcpc-resolv.conf&amp;quot;&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
Create the file {{path|/etc/udhcpc/post-bound/resolvconf}} as follows {{Cat|/etc/udhcpc/post-bound/resolvconf|&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
cat /etc/udhcpc-resolv.conf | resolvconf -a $interface&lt;br /&gt;
}}&lt;br /&gt;
and make it executable {{cmd|$ doas chmod 755 /etc/udhcpc/post-bound/resolvconf}}&lt;br /&gt;
&lt;br /&gt;
==== iwd ====&lt;br /&gt;
&lt;br /&gt;
When using [[iwd]] an inconvenience of this setup is that udhcpc will not reconfigure the interface when connecting to other wifi networks. For that to happen one has to run&lt;br /&gt;
&lt;br /&gt;
{{cmd|$ iwctl station wlan0 connect &amp;lt;network_name&amp;gt;&lt;br /&gt;
$ doas kill -USR2 $(cat  /run/udhcpc.wlan0.pid)&lt;br /&gt;
$ doas kill -USR1 $(cat  /run/udhcpc.wlan0.pid)}}&lt;br /&gt;
&lt;br /&gt;
To avoid having to manually reconfigure the wifi interface, we can configure [[iwd]] to use DHCP internally and forward DNS server info to resolveconf. To do that create the file {{path|/etc/iwd/main.conf}} as follows {{Cat|/etc/iwd/main.conf|&amp;lt;nowiki&amp;gt;[General]&lt;br /&gt;
EnableNetworkConfiguration=True&lt;br /&gt;
&lt;br /&gt;
[Network]&lt;br /&gt;
NameResolvingService=resolvconf&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
=== Test the setup ===&lt;br /&gt;
&lt;br /&gt;
You should be able to query for both the printer address and regular addresses with: {{cmd|$ drill @127.0.0.1 &amp;lt;printer_name&amp;gt;.local&lt;br /&gt;
$ drill @127.0.0.1 alpinelinux.org}}&lt;br /&gt;
&lt;br /&gt;
Your {{path|/etc/resolv.conf}} should also contain {{Cat|/etc/resolv.conf|nameserver 127.0.0.1}}&lt;br /&gt;
&lt;br /&gt;
Printer discovery should now be working.&lt;br /&gt;
&lt;br /&gt;
=== Failure in parallel query of A and AAAA requsts ===&lt;br /&gt;
&lt;br /&gt;
An issue with parallel query of A and AAAA requsts was reported to [https://github.com/LouisBrunner/avahi2dns/issues/21 upstream] related to ipv4/ipv6 dual-setups and since been resolved in Alpine Linux {{MR|82560}} by adding a timeout 2.5s.&lt;br /&gt;
&lt;br /&gt;
[[Category:Networking]]&lt;br /&gt;
[[Category:Printers]]&lt;/div&gt;</summary>
		<author><name>Unicorn</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Printer_Setup&amp;diff=31272</id>
		<title>Printer Setup</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Printer_Setup&amp;diff=31272"/>
		<updated>2025-10-23T20:34:10Z</updated>

		<summary type="html">&lt;p&gt;Unicorn: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://en.wikipedia.org/wiki/CUPS CUPS] is a modular printing system for Unix-like computer operating systems. This page explains how to install and configure printers in Alpine Linux. &lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
Install the basic packages need for configuring printers: {{cmd|# apk add cups cups-filters}}&lt;br /&gt;
&lt;br /&gt;
If you want to make use of automatic discovery for [https://openprinting.github.io/printers/ printers that support IPP Everywhere™ or AirPrint™] or other printers that support [https://en.wikipedia.org/wiki/Multicast_DNS Multicast DNS], you also need to set up [[MDNS|mDNS with avahi]].&lt;br /&gt;
&lt;br /&gt;
To use CUPS to print to PDF, you can use the {{pkg|cups-pdf}} package, which is available in the [[Repositories#Testing|testing]] repository. It can be installed after [[Repositories#Using_testing_repository|configuring the testing repository]] with the below command:{{cmd|# apk add cups-pdf@testing}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Service configuration ==&lt;br /&gt;
&lt;br /&gt;
To allow a user to configure CUPS, you need to add them to the &amp;lt;code&amp;gt;lpadmin&amp;lt;/code&amp;gt; group: {{cmd|adduser $USER lpadmin}}&lt;br /&gt;
To be able to use the CLI commands to configure CUPS, you need to log out and back in again or possibly reboot in order for the new group to take effect.&lt;br /&gt;
&lt;br /&gt;
Confirm that the CUPS [[OpenRC]] service starts:{{cmd|# rc-service cupsd start}}&lt;br /&gt;
You may also want to configure it to start automatically:{{cmd|# rc-update add cupsd}}&lt;br /&gt;
&lt;br /&gt;
== Printer configuration == &lt;br /&gt;
&lt;br /&gt;
Go to &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;http://localhost:631&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; with your web browser, click on the &amp;quot;Administration&amp;quot; tab and use the &amp;quot;Add Printer&amp;quot; or &amp;quot;Find New Printers&amp;quot; button to add a new printer. When asked, you can log in with the user that you previously added to the &amp;lt;code&amp;gt;lpadmin&amp;lt;/code&amp;gt; group. Once you have added a printer, you should be able to print.&lt;br /&gt;
&lt;br /&gt;
To configure &#039;&#039;Hewlett-Packard&#039;&#039; (&#039;&#039;HP&#039;&#039;) printers ,the {{pkg|hplip}} package is available in the [[Repositories#Testing|testing]] repository. It can be installed after [[Repositories#Using_testing_repository|configuring the testing repository]] with the below command:{{cmd|# apk add hplip}}&lt;br /&gt;
If that doesn&#039;t work, you may also need to add HPLIP&#039;s dependencies separately.&lt;br /&gt;
&lt;br /&gt;
There are currently no packages for CUPS DDK, &amp;lt;code&amp;gt;hp-setup&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;foomatic&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
{{cmd|# apk add ghostscript py3-reportlab libjpeg net-snmp}}&lt;br /&gt;
&lt;br /&gt;
{{Expand|Modifications/sections required e.g. to address container user-case scenarios, etc.}} &lt;br /&gt;
&lt;br /&gt;
== Configure mdev for USB printers ==&lt;br /&gt;
&lt;br /&gt;
By default USB printer with [[mdev]] would have ownership &#039;&#039;root:root&#039;&#039; and permission &#039;&#039;0660&#039;&#039;. As &#039;&#039;cupsd&#039;&#039; would try to open a libusb-based printer as &#039;&#039;lp&#039;&#039; user, it won&#039;t have permission to use the device in &#039;&#039;/dev/bus/usb&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
First let&#039;s get some info about our USB printer.&lt;br /&gt;
&lt;br /&gt;
 # lsusb.py -uU | grep Printer&lt;br /&gt;
  3-2               04b8:0007 00 1IF  [USB 2.00,   480 Mbps,   2mA] (EPSON USB2.0 Printer (Hi-speed) 55PKAZZ15776790829)&lt;br /&gt;
&lt;br /&gt;
 # grep -H &amp;quot;&amp;quot; /sys/bus/usb/devices/usb3/3-2/{id{Vendor,Product},bcdDevice}&lt;br /&gt;
 /sys/bus/usb/devices/usb3/3-2/idVendor:04b8&lt;br /&gt;
 /sys/bus/usb/devices/usb3/3-2/idProduct:0007&lt;br /&gt;
 /sys/bus/usb/devices/usb3/3-2/bcdDevice:0100&lt;br /&gt;
&lt;br /&gt;
These are important for us to distinguish our printer.&lt;br /&gt;
&lt;br /&gt;
 # cat &amp;gt;&amp;gt; /etc/mdev.conf &amp;lt;&amp;lt;EOF&lt;br /&gt;
 SUBSYSTEM=usb;PRODUCT=4b8/7/100;.* root:lp 660 */lib/mdev/usbdev&lt;br /&gt;
 EOF&lt;br /&gt;
&lt;br /&gt;
Unplug the USB cable and plug it in again. Now the USB printer device at &#039;&#039;/dev/bus/usb/&#039;&#039; will have valid ownership and permissions.&lt;br /&gt;
&lt;br /&gt;
 # ls -l /dev/bus/usb/002/011&lt;br /&gt;
 crw-rw---- 1 root lp 189, 138 Apr 14 21:19 /dev/bus/usb/002/011&lt;br /&gt;
&lt;br /&gt;
CUPS will be able now to use libusb to discover the local USB printer.&lt;br /&gt;
&lt;br /&gt;
== Managing Printers via KDE Plasma Settings ==&lt;br /&gt;
&lt;br /&gt;
To manage printers from KDE Plasma Settings, it is required to add &amp;quot;root&amp;quot; to SystemGroup in &#039;&#039;&#039;&#039;&#039;/etc/cups/cups-files.conf&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
e.g. &lt;br /&gt;
{{Cmd|&lt;br /&gt;
SystemGroup root lpadmin}}&lt;br /&gt;
&lt;br /&gt;
== Managing Printers via Command Line ==&lt;br /&gt;
&lt;br /&gt;
Credit to ArchWiki&#039;s excellent [https://wiki.archlinux.org/index.php/CUPS CUPS] page for guidance with the following basic steps.&lt;br /&gt;
&lt;br /&gt;
=== Locate your printer ===&lt;br /&gt;
&lt;br /&gt;
With your printer connected and powered on, determine the &#039;&#039;URI&#039;&#039; for your printer.  Depending on whether the connection is via &#039;&#039;&#039;usb&#039;&#039;&#039; or &#039;&#039;&#039;parallel&#039;&#039;&#039; ports, the URI will carry a &amp;lt;code&amp;gt;usb://&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;parallel:/&amp;lt;/code&amp;gt; prefix.&lt;br /&gt;
&lt;br /&gt;
 $ lpinfo -v #&lt;br /&gt;
 network lpd&lt;br /&gt;
 network socket&lt;br /&gt;
 network beh&lt;br /&gt;
 file cups-brf:/&lt;br /&gt;
 direct usb://HP/LaserJet%202200&lt;br /&gt;
 network ipp&lt;br /&gt;
 network ipps&lt;br /&gt;
 network https&lt;br /&gt;
 network http&lt;br /&gt;
 direct hp&lt;br /&gt;
&lt;br /&gt;
In the example above, the URI is &amp;lt;code&amp;gt;usb://HP/LaserJet%202200&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Find a .ppd or .ppd.gz &#039;&#039;driver&#039;&#039; ===&lt;br /&gt;
&lt;br /&gt;
If your printer supports &#039;&#039;IPP Everywhere&#039;&#039; -- most recent models do -- see the &#039;&#039;driverless&#039;&#039; command in &#039;&#039;cups-filters&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
 $ driverless ipp_uri &amp;gt; printer.ppd&lt;br /&gt;
&lt;br /&gt;
or just pass &#039;&#039;-m everywhere&#039;&#039; to &#039;&#039;lpadmin&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Otherwise, you could list all the drivers available by running &amp;lt;code&amp;gt;lpinfo -m&amp;lt;/code&amp;gt; and then searching through the results to find a .ppd or .ppd.gz specific to your printer.  A quick solution is to use the &amp;lt;code&amp;gt;--make-and-model&amp;lt;/code&amp;gt; flag and &amp;lt;code&amp;gt;grep&amp;lt;/code&amp;gt; to filter the results by plugging in your printer&#039;s make, model and series in this fashion:&lt;br /&gt;
&lt;br /&gt;
 $ lpinfo --make-and-model &amp;quot;&#039;&#039;make_and_model_names&#039;&#039;&amp;quot; -m | grep -i &#039;&#039;printer_series&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{{Tip|&lt;br /&gt;
*Search for the term &#039;&#039;HP&#039;&#039; to find instances of &#039;&#039;Hewlett-Packard&#039;&#039;.&lt;br /&gt;
*You do not need to state the &amp;lt;code&amp;gt;printer_series&amp;lt;/code&amp;gt; in whole if at all e.g. &#039;&#039;2200&#039;&#039; may be preferable to searching for &#039;&#039;2200M&#039;&#039;, etc.}}&lt;br /&gt;
&lt;br /&gt;
For example, type:&lt;br /&gt;
&lt;br /&gt;
 $ lpinfo --make-and-model &amp;quot;HP LaserJet&amp;quot; -m | grep -i 2200&lt;br /&gt;
&lt;br /&gt;
From the results, you might select the following .ppd &#039;&#039;driver&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
 drv:///hp/hpcups.drv/hp-laserjet_2200_series.ppd&lt;br /&gt;
&lt;br /&gt;
If required, additional drivers can be obtained by installing {{Pkg|gutenprint}}, and running the &amp;lt;code&amp;gt;lpinfo&amp;lt;/code&amp;gt; search again.  These may not specify &amp;lt;code&amp;gt;.ppd&amp;lt;/code&amp;gt; names.&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# apk add gutenprint gutenprint-doc}}&lt;br /&gt;
&lt;br /&gt;
=== Configure a queue ===&lt;br /&gt;
&lt;br /&gt;
Create a queue using a &#039;&#039;queue_name&#039;&#039; of your choice.  Your selected printer&#039;s name is an obvious choice, but do not use spaces.&amp;lt;BR&amp;gt;&lt;br /&gt;
You will also need to be root or use &amp;lt;code&amp;gt;sudo&amp;lt;/code&amp;gt;, and you will also need to plug in the &#039;&#039;URI&#039;&#039; and the .ppd &#039;&#039;driver&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
 # lpadmin -p &#039;&#039;queue_name&#039;&#039; -E -v &amp;quot;&#039;&#039;uri&#039;&#039;&amp;quot; -m &#039;&#039;driver&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
With this example, you could set as follows, but there are other solutions.&lt;br /&gt;
&lt;br /&gt;
 # lpadmin -p HP_LaserJet_2200 -E -v &amp;quot;usb://HP/LaserJet%202200&amp;quot; -m drv:///hp/hpcups.drv/hp-laserjet_2200-pcl3.ppd&lt;br /&gt;
&lt;br /&gt;
This printer queue could be set as &#039;&#039;&#039;default&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
 # lpoptions -d HP_LaserJet_2200&lt;br /&gt;
&lt;br /&gt;
Printer settings can typically be set in your GUI application&#039;s &#039;&#039;&#039;Print&#039;&#039;&#039; menu or by examining the CUPS [https://www.cups.org/doc/man-lpoptions.html lpoptions] page.  If you have a single queue, the setting options available (such as page type, duplex, etc.) for your queue can simply be &#039;&#039;&#039;listed&#039;&#039;&#039; by using the &#039;&#039;&#039;-l&#039;&#039;&#039; flag.  Asterisks(*) indicate current settings:&lt;br /&gt;
&lt;br /&gt;
 # lpoptions -l&lt;br /&gt;
 PageSize/Media Size: Card3x5 Hagaki Photo4x6 A6 Photo5x7 Card5x8 Oufuku A5 B5 JB5 Executive 16k Letter *A4 ExecutiveJIS FLSA Legal EnvA2 EnvC6 EnvChou4 EnvMonarch EnvDL Env10 EnvChou3 EnvC5 EnvB5 Custom.WIDTHxHEIGHT&lt;br /&gt;
 Duplex/Double-Sided Printing: DuplexNoTumble DuplexTumble *None&lt;br /&gt;
 InputSlot/Media Source: *Auto PhotoTray Upper Lower Envelope LargeCapacity Manual MPTray&lt;br /&gt;
 ColorModel/Output Mode: *Gray&lt;br /&gt;
 MediaType/Media Type: *Plain&lt;br /&gt;
 OutputMode/Print Quality: *Normal Draft Best&lt;br /&gt;
 OptionDuplex/Duplexer Installed: *False True&lt;br /&gt;
&lt;br /&gt;
If there is only one queue, &#039;&#039;&#039;options&#039;&#039;&#039; can be set by simply using &#039;&#039;&#039;-o&#039;&#039;&#039; flags for each setting:&lt;br /&gt;
&lt;br /&gt;
 # lpoptions -o PageSize=Legal -o Duplex=DuplexNoTumble&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[MDNS|Use mDNS to discover printers]]&lt;br /&gt;
* [https://www.cups.org/documentation.html CUPS documentation]&lt;br /&gt;
&lt;br /&gt;
[[Category:Printers]]&lt;/div&gt;</summary>
		<author><name>Unicorn</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Printer_Setup&amp;diff=31271</id>
		<title>Printer Setup</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Printer_Setup&amp;diff=31271"/>
		<updated>2025-10-23T20:10:51Z</updated>

		<summary type="html">&lt;p&gt;Unicorn: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://en.wikipedia.org/wiki/CUPS CUPS] is a modular printing system for Unix-like computer operating systems. This page explains how to install and configure printers in Alpine Linux. &lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
Install the basic packages need for configuring printers: {{cmd|# apk add cups cups-filters}}&lt;br /&gt;
&lt;br /&gt;
If you want to make use of automatic discovery for [https://openprinting.github.io/printers/ printers that support IPP Everywhere™ or AirPrint™], you also need to set up [[MDNS|mDNS with avahi]].&lt;br /&gt;
&lt;br /&gt;
To use CUPS to print to PDF, you can use the {{pkg|cups-pdf}} package, which is available in the [[Repositories#Testing|testing]] repository. It can be installed after [[Repositories#Using_testing_repository|configuring the testing repository]] with the below command:{{cmd|# apk add cups-pdf@testing}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Service configuration ==&lt;br /&gt;
&lt;br /&gt;
To allow a user to configure CUPS, you need to add them to the &amp;lt;code&amp;gt;lpadmin&amp;lt;/code&amp;gt; group: {{cmd|adduser $USER lpadmin}}&lt;br /&gt;
To be able to use the CLI commands to configure CUPS, you need to log out and back in again or possibly reboot in order for the new group to take effect.&lt;br /&gt;
&lt;br /&gt;
Confirm that the CUPS [[OpenRC]] service starts:{{cmd|# rc-service cupsd start}}&lt;br /&gt;
You may also want to configure it to start automatically:{{cmd|# rc-update add cupsd}}&lt;br /&gt;
&lt;br /&gt;
== Printer configuration == &lt;br /&gt;
&lt;br /&gt;
Go to &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;http://localhost:631&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; with your web browser, click on the &amp;quot;Administration&amp;quot; tab and use the &amp;quot;Add Printer&amp;quot; or &amp;quot;Find New Printers&amp;quot; button to add a new printer. When asked, you can log in with the user that you previously added to the &amp;lt;code&amp;gt;lpadmin&amp;lt;/code&amp;gt; group. Once you have added a printer, you should be able to print.&lt;br /&gt;
&lt;br /&gt;
To configure &#039;&#039;Hewlett-Packard&#039;&#039; (&#039;&#039;HP&#039;&#039;) printers ,the {{pkg|hplip}} package is available in the [[Repositories#Testing|testing]] repository. It can be installed after [[Repositories#Using_testing_repository|configuring the testing repository]] with the below command:{{cmd|# apk add hplip}}&lt;br /&gt;
If that doesn&#039;t work, you may also need to add HPLIP&#039;s dependencies separately.&lt;br /&gt;
&lt;br /&gt;
There are currently no packages for CUPS DDK, &amp;lt;code&amp;gt;hp-setup&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;foomatic&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
{{cmd|# apk add ghostscript py3-reportlab libjpeg net-snmp}}&lt;br /&gt;
&lt;br /&gt;
{{Expand|Modifications/sections required e.g. to address container user-case scenarios, etc.}} &lt;br /&gt;
&lt;br /&gt;
== Configure mdev for USB printers ==&lt;br /&gt;
&lt;br /&gt;
By default USB printer with [[mdev]] would have ownership &#039;&#039;root:root&#039;&#039; and permission &#039;&#039;0660&#039;&#039;. As &#039;&#039;cupsd&#039;&#039; would try to open a libusb-based printer as &#039;&#039;lp&#039;&#039; user, it won&#039;t have permission to use the device in &#039;&#039;/dev/bus/usb&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
First let&#039;s get some info about our USB printer.&lt;br /&gt;
&lt;br /&gt;
 # lsusb.py -uU | grep Printer&lt;br /&gt;
  3-2               04b8:0007 00 1IF  [USB 2.00,   480 Mbps,   2mA] (EPSON USB2.0 Printer (Hi-speed) 55PKAZZ15776790829)&lt;br /&gt;
&lt;br /&gt;
 # grep -H &amp;quot;&amp;quot; /sys/bus/usb/devices/usb3/3-2/{id{Vendor,Product},bcdDevice}&lt;br /&gt;
 /sys/bus/usb/devices/usb3/3-2/idVendor:04b8&lt;br /&gt;
 /sys/bus/usb/devices/usb3/3-2/idProduct:0007&lt;br /&gt;
 /sys/bus/usb/devices/usb3/3-2/bcdDevice:0100&lt;br /&gt;
&lt;br /&gt;
These are important for us to distinguish our printer.&lt;br /&gt;
&lt;br /&gt;
 # cat &amp;gt;&amp;gt; /etc/mdev.conf &amp;lt;&amp;lt;EOF&lt;br /&gt;
 SUBSYSTEM=usb;PRODUCT=4b8/7/100;.* root:lp 660 */lib/mdev/usbdev&lt;br /&gt;
 EOF&lt;br /&gt;
&lt;br /&gt;
Unplug the USB cable and plug it in again. Now the USB printer device at &#039;&#039;/dev/bus/usb/&#039;&#039; will have valid ownership and permissions.&lt;br /&gt;
&lt;br /&gt;
 # ls -l /dev/bus/usb/002/011&lt;br /&gt;
 crw-rw---- 1 root lp 189, 138 Apr 14 21:19 /dev/bus/usb/002/011&lt;br /&gt;
&lt;br /&gt;
CUPS will be able now to use libusb to discover the local USB printer.&lt;br /&gt;
&lt;br /&gt;
== Managing Printers via KDE Plasma Settings ==&lt;br /&gt;
&lt;br /&gt;
To manage printers from KDE Plasma Settings, it is required to add &amp;quot;root&amp;quot; to SystemGroup in &#039;&#039;&#039;&#039;&#039;/etc/cups/cups-files.conf&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
e.g. &lt;br /&gt;
{{Cmd|&lt;br /&gt;
SystemGroup root lpadmin}}&lt;br /&gt;
&lt;br /&gt;
== Managing Printers via Command Line ==&lt;br /&gt;
&lt;br /&gt;
Credit to ArchWiki&#039;s excellent [https://wiki.archlinux.org/index.php/CUPS CUPS] page for guidance with the following basic steps.&lt;br /&gt;
&lt;br /&gt;
=== Locate your printer ===&lt;br /&gt;
&lt;br /&gt;
With your printer connected and powered on, determine the &#039;&#039;URI&#039;&#039; for your printer.  Depending on whether the connection is via &#039;&#039;&#039;usb&#039;&#039;&#039; or &#039;&#039;&#039;parallel&#039;&#039;&#039; ports, the URI will carry a &amp;lt;code&amp;gt;usb://&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;parallel:/&amp;lt;/code&amp;gt; prefix.&lt;br /&gt;
&lt;br /&gt;
 $ lpinfo -v #&lt;br /&gt;
 network lpd&lt;br /&gt;
 network socket&lt;br /&gt;
 network beh&lt;br /&gt;
 file cups-brf:/&lt;br /&gt;
 direct usb://HP/LaserJet%202200&lt;br /&gt;
 network ipp&lt;br /&gt;
 network ipps&lt;br /&gt;
 network https&lt;br /&gt;
 network http&lt;br /&gt;
 direct hp&lt;br /&gt;
&lt;br /&gt;
In the example above, the URI is &amp;lt;code&amp;gt;usb://HP/LaserJet%202200&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Find a .ppd or .ppd.gz &#039;&#039;driver&#039;&#039; ===&lt;br /&gt;
&lt;br /&gt;
If your printer supports &#039;&#039;IPP Everywhere&#039;&#039; -- most recent models do -- see the &#039;&#039;driverless&#039;&#039; command in &#039;&#039;cups-filters&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
 $ driverless ipp_uri &amp;gt; printer.ppd&lt;br /&gt;
&lt;br /&gt;
or just pass &#039;&#039;-m everywhere&#039;&#039; to &#039;&#039;lpadmin&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Otherwise, you could list all the drivers available by running &amp;lt;code&amp;gt;lpinfo -m&amp;lt;/code&amp;gt; and then searching through the results to find a .ppd or .ppd.gz specific to your printer.  A quick solution is to use the &amp;lt;code&amp;gt;--make-and-model&amp;lt;/code&amp;gt; flag and &amp;lt;code&amp;gt;grep&amp;lt;/code&amp;gt; to filter the results by plugging in your printer&#039;s make, model and series in this fashion:&lt;br /&gt;
&lt;br /&gt;
 $ lpinfo --make-and-model &amp;quot;&#039;&#039;make_and_model_names&#039;&#039;&amp;quot; -m | grep -i &#039;&#039;printer_series&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{{Tip|&lt;br /&gt;
*Search for the term &#039;&#039;HP&#039;&#039; to find instances of &#039;&#039;Hewlett-Packard&#039;&#039;.&lt;br /&gt;
*You do not need to state the &amp;lt;code&amp;gt;printer_series&amp;lt;/code&amp;gt; in whole if at all e.g. &#039;&#039;2200&#039;&#039; may be preferable to searching for &#039;&#039;2200M&#039;&#039;, etc.}}&lt;br /&gt;
&lt;br /&gt;
For example, type:&lt;br /&gt;
&lt;br /&gt;
 $ lpinfo --make-and-model &amp;quot;HP LaserJet&amp;quot; -m | grep -i 2200&lt;br /&gt;
&lt;br /&gt;
From the results, you might select the following .ppd &#039;&#039;driver&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
 drv:///hp/hpcups.drv/hp-laserjet_2200_series.ppd&lt;br /&gt;
&lt;br /&gt;
If required, additional drivers can be obtained by installing {{Pkg|gutenprint}}, and running the &amp;lt;code&amp;gt;lpinfo&amp;lt;/code&amp;gt; search again.  These may not specify &amp;lt;code&amp;gt;.ppd&amp;lt;/code&amp;gt; names.&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# apk add gutenprint gutenprint-doc}}&lt;br /&gt;
&lt;br /&gt;
=== Configure a queue ===&lt;br /&gt;
&lt;br /&gt;
Create a queue using a &#039;&#039;queue_name&#039;&#039; of your choice.  Your selected printer&#039;s name is an obvious choice, but do not use spaces.&amp;lt;BR&amp;gt;&lt;br /&gt;
You will also need to be root or use &amp;lt;code&amp;gt;sudo&amp;lt;/code&amp;gt;, and you will also need to plug in the &#039;&#039;URI&#039;&#039; and the .ppd &#039;&#039;driver&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
 # lpadmin -p &#039;&#039;queue_name&#039;&#039; -E -v &amp;quot;&#039;&#039;uri&#039;&#039;&amp;quot; -m &#039;&#039;driver&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
With this example, you could set as follows, but there are other solutions.&lt;br /&gt;
&lt;br /&gt;
 # lpadmin -p HP_LaserJet_2200 -E -v &amp;quot;usb://HP/LaserJet%202200&amp;quot; -m drv:///hp/hpcups.drv/hp-laserjet_2200-pcl3.ppd&lt;br /&gt;
&lt;br /&gt;
This printer queue could be set as &#039;&#039;&#039;default&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
 # lpoptions -d HP_LaserJet_2200&lt;br /&gt;
&lt;br /&gt;
Printer settings can typically be set in your GUI application&#039;s &#039;&#039;&#039;Print&#039;&#039;&#039; menu or by examining the CUPS [https://www.cups.org/doc/man-lpoptions.html lpoptions] page.  If you have a single queue, the setting options available (such as page type, duplex, etc.) for your queue can simply be &#039;&#039;&#039;listed&#039;&#039;&#039; by using the &#039;&#039;&#039;-l&#039;&#039;&#039; flag.  Asterisks(*) indicate current settings:&lt;br /&gt;
&lt;br /&gt;
 # lpoptions -l&lt;br /&gt;
 PageSize/Media Size: Card3x5 Hagaki Photo4x6 A6 Photo5x7 Card5x8 Oufuku A5 B5 JB5 Executive 16k Letter *A4 ExecutiveJIS FLSA Legal EnvA2 EnvC6 EnvChou4 EnvMonarch EnvDL Env10 EnvChou3 EnvC5 EnvB5 Custom.WIDTHxHEIGHT&lt;br /&gt;
 Duplex/Double-Sided Printing: DuplexNoTumble DuplexTumble *None&lt;br /&gt;
 InputSlot/Media Source: *Auto PhotoTray Upper Lower Envelope LargeCapacity Manual MPTray&lt;br /&gt;
 ColorModel/Output Mode: *Gray&lt;br /&gt;
 MediaType/Media Type: *Plain&lt;br /&gt;
 OutputMode/Print Quality: *Normal Draft Best&lt;br /&gt;
 OptionDuplex/Duplexer Installed: *False True&lt;br /&gt;
&lt;br /&gt;
If there is only one queue, &#039;&#039;&#039;options&#039;&#039;&#039; can be set by simply using &#039;&#039;&#039;-o&#039;&#039;&#039; flags for each setting:&lt;br /&gt;
&lt;br /&gt;
 # lpoptions -o PageSize=Legal -o Duplex=DuplexNoTumble&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[MDNS|Use mDNS to discover printers]]&lt;br /&gt;
* [https://www.cups.org/documentation.html CUPS documentation]&lt;br /&gt;
&lt;br /&gt;
[[Category:Printers]]&lt;/div&gt;</summary>
		<author><name>Unicorn</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Printer_Setup&amp;diff=31270</id>
		<title>Printer Setup</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Printer_Setup&amp;diff=31270"/>
		<updated>2025-10-23T20:09:54Z</updated>

		<summary type="html">&lt;p&gt;Unicorn: Remove redundant user group instructions&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://en.wikipedia.org/wiki/CUPS CUPS] is a modular printing system for Unix-like computer operating systems. This page explains how to install and configure printers in Alpine Linux. &lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
Install the basic packages need for configuring printers: {{cmd|# apk add cups cups-filters}}&lt;br /&gt;
&lt;br /&gt;
If you want to make use of automatic discovery for [https://openprinting.github.io/printers/ printers that support IPP Everywhere™ or AirPrint™], you also need to set up [[MDNS|mDNS with avahi]].&lt;br /&gt;
&lt;br /&gt;
To use CUPS to print to PDF, you can use the {{pkg|cups-pdf}} package, which is available in the [[Repositories#Testing|testing]] repository. It can be installed after [[Repositories#Using_testing_repository|configuring the testing repository]] with the below command:{{cmd|# apk add cups-pdf@testing}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Service configuration ==&lt;br /&gt;
&lt;br /&gt;
To allow a user to configure CUPS, you need to add them to the &amp;lt;code&amp;gt;lpadmin&amp;lt;/code&amp;gt; group: {{cmd|adduser $USER lpadmin}}&lt;br /&gt;
To be able to use the CLI commands to configure CUPS, you need to log out and back in again or possibly reboot in order for the new group to take effect.&lt;br /&gt;
&lt;br /&gt;
Confirm that the CUPS [[OpenRC]] service starts:{{cmd|# rc-service cupsd start}}&lt;br /&gt;
You may also want to configure it to start automatically:{{cmd|# rc-update add cupsd}}&lt;br /&gt;
&lt;br /&gt;
== Printer configuration == &lt;br /&gt;
&lt;br /&gt;
Go to &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;http://localhost:631&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; with your web browser, click on the &amp;quot;Administration&amp;quot; tab and use the &amp;quot;Add Printer&amp;quot; or &amp;quot;Find New Printers&amp;quot; button to add a new printer. When asked, you can log in with the user that you previously added to the &amp;lt;code&amp;gt;lpadmin&amp;lt;/code&amp;gt; group (or root). Once you have added a printer, you should be able to print.&lt;br /&gt;
&lt;br /&gt;
To configure &#039;&#039;Hewlett-Packard&#039;&#039; (&#039;&#039;HP&#039;&#039;) printers ,the {{pkg|hplip}} package is available in the [[Repositories#Testing|testing]] repository. It can be installed after [[Repositories#Using_testing_repository|configuring the testing repository]] with the below command:{{cmd|# apk add hplip}}&lt;br /&gt;
If that doesn&#039;t work, you may also need to add HPLIP&#039;s dependencies separately.&lt;br /&gt;
&lt;br /&gt;
There are currently no packages for CUPS DDK, &amp;lt;code&amp;gt;hp-setup&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;foomatic&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
{{cmd|# apk add ghostscript py3-reportlab libjpeg net-snmp}}&lt;br /&gt;
&lt;br /&gt;
{{Expand|Modifications/sections required e.g. to address container user-case scenarios, etc.}} &lt;br /&gt;
&lt;br /&gt;
== Configure mdev for USB printers ==&lt;br /&gt;
&lt;br /&gt;
By default USB printer with [[mdev]] would have ownership &#039;&#039;root:root&#039;&#039; and permission &#039;&#039;0660&#039;&#039;. As &#039;&#039;cupsd&#039;&#039; would try to open a libusb-based printer as &#039;&#039;lp&#039;&#039; user, it won&#039;t have permission to use the device in &#039;&#039;/dev/bus/usb&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
First let&#039;s get some info about our USB printer.&lt;br /&gt;
&lt;br /&gt;
 # lsusb.py -uU | grep Printer&lt;br /&gt;
  3-2               04b8:0007 00 1IF  [USB 2.00,   480 Mbps,   2mA] (EPSON USB2.0 Printer (Hi-speed) 55PKAZZ15776790829)&lt;br /&gt;
&lt;br /&gt;
 # grep -H &amp;quot;&amp;quot; /sys/bus/usb/devices/usb3/3-2/{id{Vendor,Product},bcdDevice}&lt;br /&gt;
 /sys/bus/usb/devices/usb3/3-2/idVendor:04b8&lt;br /&gt;
 /sys/bus/usb/devices/usb3/3-2/idProduct:0007&lt;br /&gt;
 /sys/bus/usb/devices/usb3/3-2/bcdDevice:0100&lt;br /&gt;
&lt;br /&gt;
These are important for us to distinguish our printer.&lt;br /&gt;
&lt;br /&gt;
 # cat &amp;gt;&amp;gt; /etc/mdev.conf &amp;lt;&amp;lt;EOF&lt;br /&gt;
 SUBSYSTEM=usb;PRODUCT=4b8/7/100;.* root:lp 660 */lib/mdev/usbdev&lt;br /&gt;
 EOF&lt;br /&gt;
&lt;br /&gt;
Unplug the USB cable and plug it in again. Now the USB printer device at &#039;&#039;/dev/bus/usb/&#039;&#039; will have valid ownership and permissions.&lt;br /&gt;
&lt;br /&gt;
 # ls -l /dev/bus/usb/002/011&lt;br /&gt;
 crw-rw---- 1 root lp 189, 138 Apr 14 21:19 /dev/bus/usb/002/011&lt;br /&gt;
&lt;br /&gt;
CUPS will be able now to use libusb to discover the local USB printer.&lt;br /&gt;
&lt;br /&gt;
== Managing Printers via KDE Plasma Settings ==&lt;br /&gt;
&lt;br /&gt;
To manage printers from KDE Plasma Settings, it is required to add &amp;quot;root&amp;quot; to SystemGroup in &#039;&#039;&#039;&#039;&#039;/etc/cups/cups-files.conf&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
e.g. &lt;br /&gt;
{{Cmd|&lt;br /&gt;
SystemGroup root lpadmin}}&lt;br /&gt;
&lt;br /&gt;
== Managing Printers via Command Line ==&lt;br /&gt;
&lt;br /&gt;
Credit to ArchWiki&#039;s excellent [https://wiki.archlinux.org/index.php/CUPS CUPS] page for guidance with the following basic steps.&lt;br /&gt;
&lt;br /&gt;
=== Locate your printer ===&lt;br /&gt;
&lt;br /&gt;
With your printer connected and powered on, determine the &#039;&#039;URI&#039;&#039; for your printer.  Depending on whether the connection is via &#039;&#039;&#039;usb&#039;&#039;&#039; or &#039;&#039;&#039;parallel&#039;&#039;&#039; ports, the URI will carry a &amp;lt;code&amp;gt;usb://&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;parallel:/&amp;lt;/code&amp;gt; prefix.&lt;br /&gt;
&lt;br /&gt;
 $ lpinfo -v #&lt;br /&gt;
 network lpd&lt;br /&gt;
 network socket&lt;br /&gt;
 network beh&lt;br /&gt;
 file cups-brf:/&lt;br /&gt;
 direct usb://HP/LaserJet%202200&lt;br /&gt;
 network ipp&lt;br /&gt;
 network ipps&lt;br /&gt;
 network https&lt;br /&gt;
 network http&lt;br /&gt;
 direct hp&lt;br /&gt;
&lt;br /&gt;
In the example above, the URI is &amp;lt;code&amp;gt;usb://HP/LaserJet%202200&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Find a .ppd or .ppd.gz &#039;&#039;driver&#039;&#039; ===&lt;br /&gt;
&lt;br /&gt;
If your printer supports &#039;&#039;IPP Everywhere&#039;&#039; -- most recent models do -- see the &#039;&#039;driverless&#039;&#039; command in &#039;&#039;cups-filters&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
 $ driverless ipp_uri &amp;gt; printer.ppd&lt;br /&gt;
&lt;br /&gt;
or just pass &#039;&#039;-m everywhere&#039;&#039; to &#039;&#039;lpadmin&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Otherwise, you could list all the drivers available by running &amp;lt;code&amp;gt;lpinfo -m&amp;lt;/code&amp;gt; and then searching through the results to find a .ppd or .ppd.gz specific to your printer.  A quick solution is to use the &amp;lt;code&amp;gt;--make-and-model&amp;lt;/code&amp;gt; flag and &amp;lt;code&amp;gt;grep&amp;lt;/code&amp;gt; to filter the results by plugging in your printer&#039;s make, model and series in this fashion:&lt;br /&gt;
&lt;br /&gt;
 $ lpinfo --make-and-model &amp;quot;&#039;&#039;make_and_model_names&#039;&#039;&amp;quot; -m | grep -i &#039;&#039;printer_series&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{{Tip|&lt;br /&gt;
*Search for the term &#039;&#039;HP&#039;&#039; to find instances of &#039;&#039;Hewlett-Packard&#039;&#039;.&lt;br /&gt;
*You do not need to state the &amp;lt;code&amp;gt;printer_series&amp;lt;/code&amp;gt; in whole if at all e.g. &#039;&#039;2200&#039;&#039; may be preferable to searching for &#039;&#039;2200M&#039;&#039;, etc.}}&lt;br /&gt;
&lt;br /&gt;
For example, type:&lt;br /&gt;
&lt;br /&gt;
 $ lpinfo --make-and-model &amp;quot;HP LaserJet&amp;quot; -m | grep -i 2200&lt;br /&gt;
&lt;br /&gt;
From the results, you might select the following .ppd &#039;&#039;driver&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
 drv:///hp/hpcups.drv/hp-laserjet_2200_series.ppd&lt;br /&gt;
&lt;br /&gt;
If required, additional drivers can be obtained by installing {{Pkg|gutenprint}}, and running the &amp;lt;code&amp;gt;lpinfo&amp;lt;/code&amp;gt; search again.  These may not specify &amp;lt;code&amp;gt;.ppd&amp;lt;/code&amp;gt; names.&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# apk add gutenprint gutenprint-doc}}&lt;br /&gt;
&lt;br /&gt;
=== Configure a queue ===&lt;br /&gt;
&lt;br /&gt;
Create a queue using a &#039;&#039;queue_name&#039;&#039; of your choice.  Your selected printer&#039;s name is an obvious choice, but do not use spaces.&amp;lt;BR&amp;gt;&lt;br /&gt;
You will also need to be root or use &amp;lt;code&amp;gt;sudo&amp;lt;/code&amp;gt;, and you will also need to plug in the &#039;&#039;URI&#039;&#039; and the .ppd &#039;&#039;driver&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
 # lpadmin -p &#039;&#039;queue_name&#039;&#039; -E -v &amp;quot;&#039;&#039;uri&#039;&#039;&amp;quot; -m &#039;&#039;driver&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
With this example, you could set as follows, but there are other solutions.&lt;br /&gt;
&lt;br /&gt;
 # lpadmin -p HP_LaserJet_2200 -E -v &amp;quot;usb://HP/LaserJet%202200&amp;quot; -m drv:///hp/hpcups.drv/hp-laserjet_2200-pcl3.ppd&lt;br /&gt;
&lt;br /&gt;
This printer queue could be set as &#039;&#039;&#039;default&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
 # lpoptions -d HP_LaserJet_2200&lt;br /&gt;
&lt;br /&gt;
Printer settings can typically be set in your GUI application&#039;s &#039;&#039;&#039;Print&#039;&#039;&#039; menu or by examining the CUPS [https://www.cups.org/doc/man-lpoptions.html lpoptions] page.  If you have a single queue, the setting options available (such as page type, duplex, etc.) for your queue can simply be &#039;&#039;&#039;listed&#039;&#039;&#039; by using the &#039;&#039;&#039;-l&#039;&#039;&#039; flag.  Asterisks(*) indicate current settings:&lt;br /&gt;
&lt;br /&gt;
 # lpoptions -l&lt;br /&gt;
 PageSize/Media Size: Card3x5 Hagaki Photo4x6 A6 Photo5x7 Card5x8 Oufuku A5 B5 JB5 Executive 16k Letter *A4 ExecutiveJIS FLSA Legal EnvA2 EnvC6 EnvChou4 EnvMonarch EnvDL Env10 EnvChou3 EnvC5 EnvB5 Custom.WIDTHxHEIGHT&lt;br /&gt;
 Duplex/Double-Sided Printing: DuplexNoTumble DuplexTumble *None&lt;br /&gt;
 InputSlot/Media Source: *Auto PhotoTray Upper Lower Envelope LargeCapacity Manual MPTray&lt;br /&gt;
 ColorModel/Output Mode: *Gray&lt;br /&gt;
 MediaType/Media Type: *Plain&lt;br /&gt;
 OutputMode/Print Quality: *Normal Draft Best&lt;br /&gt;
 OptionDuplex/Duplexer Installed: *False True&lt;br /&gt;
&lt;br /&gt;
If there is only one queue, &#039;&#039;&#039;options&#039;&#039;&#039; can be set by simply using &#039;&#039;&#039;-o&#039;&#039;&#039; flags for each setting:&lt;br /&gt;
&lt;br /&gt;
 # lpoptions -o PageSize=Legal -o Duplex=DuplexNoTumble&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[MDNS|Use mDNS to discover printers]]&lt;br /&gt;
* [https://www.cups.org/documentation.html CUPS documentation]&lt;br /&gt;
&lt;br /&gt;
[[Category:Printers]]&lt;/div&gt;</summary>
		<author><name>Unicorn</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Printer_Setup&amp;diff=31269</id>
		<title>Printer Setup</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Printer_Setup&amp;diff=31269"/>
		<updated>2025-10-23T19:58:13Z</updated>

		<summary type="html">&lt;p&gt;Unicorn: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://en.wikipedia.org/wiki/CUPS CUPS] is a modular printing system for Unix-like computer operating systems. This page explains how to install and configure printers in Alpine Linux. &lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
Install the basic packages need for configuring printers: {{cmd|# apk add cups cups-filters}}&lt;br /&gt;
&lt;br /&gt;
If you want to make use of automatic discovery for [https://openprinting.github.io/printers/ printers that support IPP Everywhere™ or AirPrint™], you also need to set up [[MDNS|mDNS with avahi]].&lt;br /&gt;
&lt;br /&gt;
To use CUPS to print to PDF, you can use the {{pkg|cups-pdf}} package, which is available in the [[Repositories#Testing|testing]] repository. It can be installed after [[Repositories#Using_testing_repository|configuring the testing repository]] with the below command:{{cmd|# apk add cups-pdf@testing}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Service configuration ==&lt;br /&gt;
&lt;br /&gt;
To allow a regular user to configure CUPS, you need to add them to the &amp;lt;code&amp;gt;lpadmin&amp;lt;/code&amp;gt; group: {{cmd|# adduser $USER lpadmin}}&lt;br /&gt;
To be able to use the CLI commands to configure CUPS, you need to log out and back in again or possibly reboot in order for the new group to take effect.&lt;br /&gt;
&lt;br /&gt;
Confirm that the CUPS [[OpenRC]] service starts:{{cmd|# rc-service cupsd start}}&lt;br /&gt;
You may also want to configure it to start automatically:{{cmd|# rc-update add cupsd}}&lt;br /&gt;
&lt;br /&gt;
== Printer configuration == &lt;br /&gt;
&lt;br /&gt;
Go to &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;http://localhost:631&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; with your web browser, click on the &amp;quot;Administration&amp;quot; tab and use the &amp;quot;Add Printer&amp;quot; or &amp;quot;Find New Printers&amp;quot; button to add a new printer. When asked, you can log in with the user that you previously added to the &amp;lt;code&amp;gt;lpadmin&amp;lt;/code&amp;gt; group (or root). Once you have added a printer, you should be able to print.&lt;br /&gt;
&lt;br /&gt;
To configure &#039;&#039;Hewlett-Packard&#039;&#039; (&#039;&#039;HP&#039;&#039;) printers ,the {{pkg|hplip}} package is available in the [[Repositories#Testing|testing]] repository. It can be installed after [[Repositories#Using_testing_repository|configuring the testing repository]] with the below command:{{cmd|# apk add hplip}}&lt;br /&gt;
If that doesn&#039;t work, you may also need to add HPLIP&#039;s dependencies separately.&lt;br /&gt;
&lt;br /&gt;
There are currently no packages for CUPS DDK, &amp;lt;code&amp;gt;hp-setup&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;foomatic&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
{{cmd|# apk add ghostscript py3-reportlab libjpeg net-snmp}}&lt;br /&gt;
&lt;br /&gt;
{{Expand|Modifications/sections required e.g. to address container user-case scenarios, etc.}} &lt;br /&gt;
&lt;br /&gt;
== Configure mdev for USB printers ==&lt;br /&gt;
&lt;br /&gt;
By default USB printer with [[mdev]] would have ownership &#039;&#039;root:root&#039;&#039; and permission &#039;&#039;0660&#039;&#039;. As &#039;&#039;cupsd&#039;&#039; would try to open a libusb-based printer as &#039;&#039;lp&#039;&#039; user, it won&#039;t have permission to use the device in &#039;&#039;/dev/bus/usb&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
First let&#039;s get some info about our USB printer.&lt;br /&gt;
&lt;br /&gt;
 # lsusb.py -uU | grep Printer&lt;br /&gt;
  3-2               04b8:0007 00 1IF  [USB 2.00,   480 Mbps,   2mA] (EPSON USB2.0 Printer (Hi-speed) 55PKAZZ15776790829)&lt;br /&gt;
&lt;br /&gt;
 # grep -H &amp;quot;&amp;quot; /sys/bus/usb/devices/usb3/3-2/{id{Vendor,Product},bcdDevice}&lt;br /&gt;
 /sys/bus/usb/devices/usb3/3-2/idVendor:04b8&lt;br /&gt;
 /sys/bus/usb/devices/usb3/3-2/idProduct:0007&lt;br /&gt;
 /sys/bus/usb/devices/usb3/3-2/bcdDevice:0100&lt;br /&gt;
&lt;br /&gt;
These are important for us to distinguish our printer.&lt;br /&gt;
&lt;br /&gt;
 # cat &amp;gt;&amp;gt; /etc/mdev.conf &amp;lt;&amp;lt;EOF&lt;br /&gt;
 SUBSYSTEM=usb;PRODUCT=4b8/7/100;.* root:lp 660 */lib/mdev/usbdev&lt;br /&gt;
 EOF&lt;br /&gt;
&lt;br /&gt;
Unplug the USB cable and plug it in again. Now the USB printer device at &#039;&#039;/dev/bus/usb/&#039;&#039; will have valid ownership and permissions.&lt;br /&gt;
&lt;br /&gt;
 # ls -l /dev/bus/usb/002/011&lt;br /&gt;
 crw-rw---- 1 root lp 189, 138 Apr 14 21:19 /dev/bus/usb/002/011&lt;br /&gt;
&lt;br /&gt;
CUPS will be able now to use libusb to discover the local USB printer.&lt;br /&gt;
&lt;br /&gt;
== Desktop usage ==&lt;br /&gt;
&lt;br /&gt;
Additionally, in a desktop environment check whether &#039;&#039;root&#039;&#039; and the user&#039;s username (&#039;&#039;yourusername&#039;&#039;) are already members of the &amp;lt;code&amp;gt;lp&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;lpadmin&amp;lt;/code&amp;gt; groups. &lt;br /&gt;
{{Note| A &#039;&#039;&#039;user&#039;&#039;&#039; needs be added to the &amp;lt;code&amp;gt;lpadmin&amp;lt;/code&amp;gt; group, if they should be able to administer the CUPS system with their password}}&lt;br /&gt;
&lt;br /&gt;
 $ groups root&lt;br /&gt;
root bin daemon sys adm disk wheel floppy dialout tape video&lt;br /&gt;
 $ groups &#039;&#039;yourusername&#039;&#039;&lt;br /&gt;
yourusername disk wheel audio cdrom dialout video users plugdev&lt;br /&gt;
&lt;br /&gt;
If not, add them:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# adduser root lp&lt;br /&gt;
&amp;amp;#35; adduser root lpadmin&lt;br /&gt;
&amp;amp;#35; adduser &#039;&#039;yourusername&#039;&#039; lp&lt;br /&gt;
&amp;amp;#35; adduser &#039;&#039;yourusername&#039;&#039; lpadmin}}&lt;br /&gt;
&lt;br /&gt;
Start CUPS (&#039;&#039;&#039;cupsd&#039;&#039;&#039;) and make it persist between boots;  then reboot:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# rc-service cupsd start&lt;br /&gt;
&amp;amp;#35; rc-update add cupsd&lt;br /&gt;
&amp;amp;#35; reboot}}&lt;br /&gt;
&lt;br /&gt;
== Managing Printers via KDE Plasma Settings ==&lt;br /&gt;
&lt;br /&gt;
To manage printers from KDE Plasma Settings, it is required to add &amp;quot;root&amp;quot; to SystemGroup in &#039;&#039;&#039;&#039;&#039;/etc/cups/cups-files.conf&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
e.g. &lt;br /&gt;
{{Cmd|&lt;br /&gt;
SystemGroup root lpadmin}}&lt;br /&gt;
&lt;br /&gt;
== Managing Printers via Command Line ==&lt;br /&gt;
&lt;br /&gt;
Credit to ArchWiki&#039;s excellent [https://wiki.archlinux.org/index.php/CUPS CUPS] page for guidance with the following basic steps.&lt;br /&gt;
&lt;br /&gt;
=== Locate your printer ===&lt;br /&gt;
&lt;br /&gt;
With your printer connected and powered on, determine the &#039;&#039;URI&#039;&#039; for your printer.  Depending on whether the connection is via &#039;&#039;&#039;usb&#039;&#039;&#039; or &#039;&#039;&#039;parallel&#039;&#039;&#039; ports, the URI will carry a &amp;lt;code&amp;gt;usb://&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;parallel:/&amp;lt;/code&amp;gt; prefix.&lt;br /&gt;
&lt;br /&gt;
 $ lpinfo -v #&lt;br /&gt;
 network lpd&lt;br /&gt;
 network socket&lt;br /&gt;
 network beh&lt;br /&gt;
 file cups-brf:/&lt;br /&gt;
 direct usb://HP/LaserJet%202200&lt;br /&gt;
 network ipp&lt;br /&gt;
 network ipps&lt;br /&gt;
 network https&lt;br /&gt;
 network http&lt;br /&gt;
 direct hp&lt;br /&gt;
&lt;br /&gt;
In the example above, the URI is &amp;lt;code&amp;gt;usb://HP/LaserJet%202200&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Find a .ppd or .ppd.gz &#039;&#039;driver&#039;&#039; ===&lt;br /&gt;
&lt;br /&gt;
If your printer supports &#039;&#039;IPP Everywhere&#039;&#039; -- most recent models do -- see the &#039;&#039;driverless&#039;&#039; command in &#039;&#039;cups-filters&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
 $ driverless ipp_uri &amp;gt; printer.ppd&lt;br /&gt;
&lt;br /&gt;
or just pass &#039;&#039;-m everywhere&#039;&#039; to &#039;&#039;lpadmin&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Otherwise, you could list all the drivers available by running &amp;lt;code&amp;gt;lpinfo -m&amp;lt;/code&amp;gt; and then searching through the results to find a .ppd or .ppd.gz specific to your printer.  A quick solution is to use the &amp;lt;code&amp;gt;--make-and-model&amp;lt;/code&amp;gt; flag and &amp;lt;code&amp;gt;grep&amp;lt;/code&amp;gt; to filter the results by plugging in your printer&#039;s make, model and series in this fashion:&lt;br /&gt;
&lt;br /&gt;
 $ lpinfo --make-and-model &amp;quot;&#039;&#039;make_and_model_names&#039;&#039;&amp;quot; -m | grep -i &#039;&#039;printer_series&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{{Tip|&lt;br /&gt;
*Search for the term &#039;&#039;HP&#039;&#039; to find instances of &#039;&#039;Hewlett-Packard&#039;&#039;.&lt;br /&gt;
*You do not need to state the &amp;lt;code&amp;gt;printer_series&amp;lt;/code&amp;gt; in whole if at all e.g. &#039;&#039;2200&#039;&#039; may be preferable to searching for &#039;&#039;2200M&#039;&#039;, etc.}}&lt;br /&gt;
&lt;br /&gt;
For example, type:&lt;br /&gt;
&lt;br /&gt;
 $ lpinfo --make-and-model &amp;quot;HP LaserJet&amp;quot; -m | grep -i 2200&lt;br /&gt;
&lt;br /&gt;
From the results, you might select the following .ppd &#039;&#039;driver&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
 drv:///hp/hpcups.drv/hp-laserjet_2200_series.ppd&lt;br /&gt;
&lt;br /&gt;
If required, additional drivers can be obtained by installing {{Pkg|gutenprint}}, and running the &amp;lt;code&amp;gt;lpinfo&amp;lt;/code&amp;gt; search again.  These may not specify &amp;lt;code&amp;gt;.ppd&amp;lt;/code&amp;gt; names.&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# apk add gutenprint gutenprint-doc}}&lt;br /&gt;
&lt;br /&gt;
=== Configure a queue ===&lt;br /&gt;
&lt;br /&gt;
Create a queue using a &#039;&#039;queue_name&#039;&#039; of your choice.  Your selected printer&#039;s name is an obvious choice, but do not use spaces.&amp;lt;BR&amp;gt;&lt;br /&gt;
You will also need to be root or use &amp;lt;code&amp;gt;sudo&amp;lt;/code&amp;gt;, and you will also need to plug in the &#039;&#039;URI&#039;&#039; and the .ppd &#039;&#039;driver&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
 # lpadmin -p &#039;&#039;queue_name&#039;&#039; -E -v &amp;quot;&#039;&#039;uri&#039;&#039;&amp;quot; -m &#039;&#039;driver&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
With this example, you could set as follows, but there are other solutions.&lt;br /&gt;
&lt;br /&gt;
 # lpadmin -p HP_LaserJet_2200 -E -v &amp;quot;usb://HP/LaserJet%202200&amp;quot; -m drv:///hp/hpcups.drv/hp-laserjet_2200-pcl3.ppd&lt;br /&gt;
&lt;br /&gt;
This printer queue could be set as &#039;&#039;&#039;default&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
 # lpoptions -d HP_LaserJet_2200&lt;br /&gt;
&lt;br /&gt;
Printer settings can typically be set in your GUI application&#039;s &#039;&#039;&#039;Print&#039;&#039;&#039; menu or by examining the CUPS [https://www.cups.org/doc/man-lpoptions.html lpoptions] page.  If you have a single queue, the setting options available (such as page type, duplex, etc.) for your queue can simply be &#039;&#039;&#039;listed&#039;&#039;&#039; by using the &#039;&#039;&#039;-l&#039;&#039;&#039; flag.  Asterisks(*) indicate current settings:&lt;br /&gt;
&lt;br /&gt;
 # lpoptions -l&lt;br /&gt;
 PageSize/Media Size: Card3x5 Hagaki Photo4x6 A6 Photo5x7 Card5x8 Oufuku A5 B5 JB5 Executive 16k Letter *A4 ExecutiveJIS FLSA Legal EnvA2 EnvC6 EnvChou4 EnvMonarch EnvDL Env10 EnvChou3 EnvC5 EnvB5 Custom.WIDTHxHEIGHT&lt;br /&gt;
 Duplex/Double-Sided Printing: DuplexNoTumble DuplexTumble *None&lt;br /&gt;
 InputSlot/Media Source: *Auto PhotoTray Upper Lower Envelope LargeCapacity Manual MPTray&lt;br /&gt;
 ColorModel/Output Mode: *Gray&lt;br /&gt;
 MediaType/Media Type: *Plain&lt;br /&gt;
 OutputMode/Print Quality: *Normal Draft Best&lt;br /&gt;
 OptionDuplex/Duplexer Installed: *False True&lt;br /&gt;
&lt;br /&gt;
If there is only one queue, &#039;&#039;&#039;options&#039;&#039;&#039; can be set by simply using &#039;&#039;&#039;-o&#039;&#039;&#039; flags for each setting:&lt;br /&gt;
&lt;br /&gt;
 # lpoptions -o PageSize=Legal -o Duplex=DuplexNoTumble&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [https://www.cups.org/documentation.html CUPS documentation]&lt;br /&gt;
&lt;br /&gt;
[[Category:Printers]]&lt;/div&gt;</summary>
		<author><name>Unicorn</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Printer_Setup&amp;diff=31268</id>
		<title>Printer Setup</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Printer_Setup&amp;diff=31268"/>
		<updated>2025-10-23T19:57:43Z</updated>

		<summary type="html">&lt;p&gt;Unicorn: Expand basic printer setup instructions, add instructions for non-root configuration&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://en.wikipedia.org/wiki/CUPS CUPS] is a modular printing system for Unix-like computer operating systems. This page explains how to install and configure printers in Alpine Linux. &lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
Install the basic packages need for configuring printers: {{cmd|# apk add cups cups-filters}}&lt;br /&gt;
&lt;br /&gt;
If you want to make use of automatic discovery for [https://openprinting.github.io/printers/ printers that support IPP Everywhere™ or AirPrint™], you also need to set up [[MDNS|mDNS with avahi]].&lt;br /&gt;
&lt;br /&gt;
To use CUPS to print to PDF, you can use the {{pkg|cups-pdf}} package, which is available in the [[Repositories#Testing|testing]] repository. It can be installed after [[Repositories#Using_testing_repository|configuring the testing repository]] with the below command:{{cmd|# apk add cups-pdf@testing}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Service configuration ==&lt;br /&gt;
&lt;br /&gt;
To allow a regular user to configure CUPS, you need to add them to the &amp;lt;code&amp;gt;lpadmin&amp;lt;/code&amp;gt; group: {{cmd|# adduser $USER lpadmin}}&lt;br /&gt;
To be able to use the CLI commands to configure CUPS, you need to log out and back in again or possibly reboot in order for the new group to take effect.&lt;br /&gt;
&lt;br /&gt;
Confirm that the CUPS [[OpenRC]] service starts:{{cmd|# rc-service cupsd start}}&lt;br /&gt;
You may also want to configure it to start automatically:{{cmd|# rc-update add cupsd}}&lt;br /&gt;
&lt;br /&gt;
== Printer configuration == &lt;br /&gt;
&lt;br /&gt;
Go to &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;http://localhost:631&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; with your web browser, click on the &amp;quot;Administration&amp;quot; tab and use the &amp;quot;Add Printer&amp;quot; or &amp;quot;Find New Printers&amp;quot; button to add a new printer. When asked, you can log in with the user that you previously added to the &amp;lt;code&amp;gt;lpadmin&amp;lt;/code&amp;gt; group (or root). Once you have added a printer, you should be able to print.&lt;br /&gt;
&lt;br /&gt;
To configure &#039;&#039;Hewlett-Packard&#039;&#039; (&#039;&#039;HP&#039;&#039;) printers ,the {{pkg|hplip}} package was is available in the [[Repositories#Testing|testing]] repository. It can be installed after [[Repositories#Using_testing_repository|configuring the testing repository]] with the below command:{{cmd|# apk add hplip}}&lt;br /&gt;
If that doesn&#039;t work, you may also need to add HPLIP&#039;s dependencies separately.&lt;br /&gt;
&lt;br /&gt;
There are currently no packages for CUPS DDK, &amp;lt;code&amp;gt;hp-setup&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;foomatic&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
{{cmd|# apk add ghostscript py3-reportlab libjpeg net-snmp}}&lt;br /&gt;
&lt;br /&gt;
{{Expand|Modifications/sections required e.g. to address container user-case scenarios, etc.}} &lt;br /&gt;
&lt;br /&gt;
== Configure mdev for USB printers ==&lt;br /&gt;
&lt;br /&gt;
By default USB printer with [[mdev]] would have ownership &#039;&#039;root:root&#039;&#039; and permission &#039;&#039;0660&#039;&#039;. As &#039;&#039;cupsd&#039;&#039; would try to open a libusb-based printer as &#039;&#039;lp&#039;&#039; user, it won&#039;t have permission to use the device in &#039;&#039;/dev/bus/usb&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
First let&#039;s get some info about our USB printer.&lt;br /&gt;
&lt;br /&gt;
 # lsusb.py -uU | grep Printer&lt;br /&gt;
  3-2               04b8:0007 00 1IF  [USB 2.00,   480 Mbps,   2mA] (EPSON USB2.0 Printer (Hi-speed) 55PKAZZ15776790829)&lt;br /&gt;
&lt;br /&gt;
 # grep -H &amp;quot;&amp;quot; /sys/bus/usb/devices/usb3/3-2/{id{Vendor,Product},bcdDevice}&lt;br /&gt;
 /sys/bus/usb/devices/usb3/3-2/idVendor:04b8&lt;br /&gt;
 /sys/bus/usb/devices/usb3/3-2/idProduct:0007&lt;br /&gt;
 /sys/bus/usb/devices/usb3/3-2/bcdDevice:0100&lt;br /&gt;
&lt;br /&gt;
These are important for us to distinguish our printer.&lt;br /&gt;
&lt;br /&gt;
 # cat &amp;gt;&amp;gt; /etc/mdev.conf &amp;lt;&amp;lt;EOF&lt;br /&gt;
 SUBSYSTEM=usb;PRODUCT=4b8/7/100;.* root:lp 660 */lib/mdev/usbdev&lt;br /&gt;
 EOF&lt;br /&gt;
&lt;br /&gt;
Unplug the USB cable and plug it in again. Now the USB printer device at &#039;&#039;/dev/bus/usb/&#039;&#039; will have valid ownership and permissions.&lt;br /&gt;
&lt;br /&gt;
 # ls -l /dev/bus/usb/002/011&lt;br /&gt;
 crw-rw---- 1 root lp 189, 138 Apr 14 21:19 /dev/bus/usb/002/011&lt;br /&gt;
&lt;br /&gt;
CUPS will be able now to use libusb to discover the local USB printer.&lt;br /&gt;
&lt;br /&gt;
== Desktop usage ==&lt;br /&gt;
&lt;br /&gt;
Additionally, in a desktop environment check whether &#039;&#039;root&#039;&#039; and the user&#039;s username (&#039;&#039;yourusername&#039;&#039;) are already members of the &amp;lt;code&amp;gt;lp&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;lpadmin&amp;lt;/code&amp;gt; groups. &lt;br /&gt;
{{Note| A &#039;&#039;&#039;user&#039;&#039;&#039; needs be added to the &amp;lt;code&amp;gt;lpadmin&amp;lt;/code&amp;gt; group, if they should be able to administer the CUPS system with their password}}&lt;br /&gt;
&lt;br /&gt;
 $ groups root&lt;br /&gt;
root bin daemon sys adm disk wheel floppy dialout tape video&lt;br /&gt;
 $ groups &#039;&#039;yourusername&#039;&#039;&lt;br /&gt;
yourusername disk wheel audio cdrom dialout video users plugdev&lt;br /&gt;
&lt;br /&gt;
If not, add them:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# adduser root lp&lt;br /&gt;
&amp;amp;#35; adduser root lpadmin&lt;br /&gt;
&amp;amp;#35; adduser &#039;&#039;yourusername&#039;&#039; lp&lt;br /&gt;
&amp;amp;#35; adduser &#039;&#039;yourusername&#039;&#039; lpadmin}}&lt;br /&gt;
&lt;br /&gt;
Start CUPS (&#039;&#039;&#039;cupsd&#039;&#039;&#039;) and make it persist between boots;  then reboot:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# rc-service cupsd start&lt;br /&gt;
&amp;amp;#35; rc-update add cupsd&lt;br /&gt;
&amp;amp;#35; reboot}}&lt;br /&gt;
&lt;br /&gt;
== Managing Printers via KDE Plasma Settings ==&lt;br /&gt;
&lt;br /&gt;
To manage printers from KDE Plasma Settings, it is required to add &amp;quot;root&amp;quot; to SystemGroup in &#039;&#039;&#039;&#039;&#039;/etc/cups/cups-files.conf&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
e.g. &lt;br /&gt;
{{Cmd|&lt;br /&gt;
SystemGroup root lpadmin}}&lt;br /&gt;
&lt;br /&gt;
== Managing Printers via Command Line ==&lt;br /&gt;
&lt;br /&gt;
Credit to ArchWiki&#039;s excellent [https://wiki.archlinux.org/index.php/CUPS CUPS] page for guidance with the following basic steps.&lt;br /&gt;
&lt;br /&gt;
=== Locate your printer ===&lt;br /&gt;
&lt;br /&gt;
With your printer connected and powered on, determine the &#039;&#039;URI&#039;&#039; for your printer.  Depending on whether the connection is via &#039;&#039;&#039;usb&#039;&#039;&#039; or &#039;&#039;&#039;parallel&#039;&#039;&#039; ports, the URI will carry a &amp;lt;code&amp;gt;usb://&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;parallel:/&amp;lt;/code&amp;gt; prefix.&lt;br /&gt;
&lt;br /&gt;
 $ lpinfo -v #&lt;br /&gt;
 network lpd&lt;br /&gt;
 network socket&lt;br /&gt;
 network beh&lt;br /&gt;
 file cups-brf:/&lt;br /&gt;
 direct usb://HP/LaserJet%202200&lt;br /&gt;
 network ipp&lt;br /&gt;
 network ipps&lt;br /&gt;
 network https&lt;br /&gt;
 network http&lt;br /&gt;
 direct hp&lt;br /&gt;
&lt;br /&gt;
In the example above, the URI is &amp;lt;code&amp;gt;usb://HP/LaserJet%202200&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Find a .ppd or .ppd.gz &#039;&#039;driver&#039;&#039; ===&lt;br /&gt;
&lt;br /&gt;
If your printer supports &#039;&#039;IPP Everywhere&#039;&#039; -- most recent models do -- see the &#039;&#039;driverless&#039;&#039; command in &#039;&#039;cups-filters&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
 $ driverless ipp_uri &amp;gt; printer.ppd&lt;br /&gt;
&lt;br /&gt;
or just pass &#039;&#039;-m everywhere&#039;&#039; to &#039;&#039;lpadmin&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Otherwise, you could list all the drivers available by running &amp;lt;code&amp;gt;lpinfo -m&amp;lt;/code&amp;gt; and then searching through the results to find a .ppd or .ppd.gz specific to your printer.  A quick solution is to use the &amp;lt;code&amp;gt;--make-and-model&amp;lt;/code&amp;gt; flag and &amp;lt;code&amp;gt;grep&amp;lt;/code&amp;gt; to filter the results by plugging in your printer&#039;s make, model and series in this fashion:&lt;br /&gt;
&lt;br /&gt;
 $ lpinfo --make-and-model &amp;quot;&#039;&#039;make_and_model_names&#039;&#039;&amp;quot; -m | grep -i &#039;&#039;printer_series&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{{Tip|&lt;br /&gt;
*Search for the term &#039;&#039;HP&#039;&#039; to find instances of &#039;&#039;Hewlett-Packard&#039;&#039;.&lt;br /&gt;
*You do not need to state the &amp;lt;code&amp;gt;printer_series&amp;lt;/code&amp;gt; in whole if at all e.g. &#039;&#039;2200&#039;&#039; may be preferable to searching for &#039;&#039;2200M&#039;&#039;, etc.}}&lt;br /&gt;
&lt;br /&gt;
For example, type:&lt;br /&gt;
&lt;br /&gt;
 $ lpinfo --make-and-model &amp;quot;HP LaserJet&amp;quot; -m | grep -i 2200&lt;br /&gt;
&lt;br /&gt;
From the results, you might select the following .ppd &#039;&#039;driver&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
 drv:///hp/hpcups.drv/hp-laserjet_2200_series.ppd&lt;br /&gt;
&lt;br /&gt;
If required, additional drivers can be obtained by installing {{Pkg|gutenprint}}, and running the &amp;lt;code&amp;gt;lpinfo&amp;lt;/code&amp;gt; search again.  These may not specify &amp;lt;code&amp;gt;.ppd&amp;lt;/code&amp;gt; names.&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# apk add gutenprint gutenprint-doc}}&lt;br /&gt;
&lt;br /&gt;
=== Configure a queue ===&lt;br /&gt;
&lt;br /&gt;
Create a queue using a &#039;&#039;queue_name&#039;&#039; of your choice.  Your selected printer&#039;s name is an obvious choice, but do not use spaces.&amp;lt;BR&amp;gt;&lt;br /&gt;
You will also need to be root or use &amp;lt;code&amp;gt;sudo&amp;lt;/code&amp;gt;, and you will also need to plug in the &#039;&#039;URI&#039;&#039; and the .ppd &#039;&#039;driver&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
 # lpadmin -p &#039;&#039;queue_name&#039;&#039; -E -v &amp;quot;&#039;&#039;uri&#039;&#039;&amp;quot; -m &#039;&#039;driver&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
With this example, you could set as follows, but there are other solutions.&lt;br /&gt;
&lt;br /&gt;
 # lpadmin -p HP_LaserJet_2200 -E -v &amp;quot;usb://HP/LaserJet%202200&amp;quot; -m drv:///hp/hpcups.drv/hp-laserjet_2200-pcl3.ppd&lt;br /&gt;
&lt;br /&gt;
This printer queue could be set as &#039;&#039;&#039;default&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
 # lpoptions -d HP_LaserJet_2200&lt;br /&gt;
&lt;br /&gt;
Printer settings can typically be set in your GUI application&#039;s &#039;&#039;&#039;Print&#039;&#039;&#039; menu or by examining the CUPS [https://www.cups.org/doc/man-lpoptions.html lpoptions] page.  If you have a single queue, the setting options available (such as page type, duplex, etc.) for your queue can simply be &#039;&#039;&#039;listed&#039;&#039;&#039; by using the &#039;&#039;&#039;-l&#039;&#039;&#039; flag.  Asterisks(*) indicate current settings:&lt;br /&gt;
&lt;br /&gt;
 # lpoptions -l&lt;br /&gt;
 PageSize/Media Size: Card3x5 Hagaki Photo4x6 A6 Photo5x7 Card5x8 Oufuku A5 B5 JB5 Executive 16k Letter *A4 ExecutiveJIS FLSA Legal EnvA2 EnvC6 EnvChou4 EnvMonarch EnvDL Env10 EnvChou3 EnvC5 EnvB5 Custom.WIDTHxHEIGHT&lt;br /&gt;
 Duplex/Double-Sided Printing: DuplexNoTumble DuplexTumble *None&lt;br /&gt;
 InputSlot/Media Source: *Auto PhotoTray Upper Lower Envelope LargeCapacity Manual MPTray&lt;br /&gt;
 ColorModel/Output Mode: *Gray&lt;br /&gt;
 MediaType/Media Type: *Plain&lt;br /&gt;
 OutputMode/Print Quality: *Normal Draft Best&lt;br /&gt;
 OptionDuplex/Duplexer Installed: *False True&lt;br /&gt;
&lt;br /&gt;
If there is only one queue, &#039;&#039;&#039;options&#039;&#039;&#039; can be set by simply using &#039;&#039;&#039;-o&#039;&#039;&#039; flags for each setting:&lt;br /&gt;
&lt;br /&gt;
 # lpoptions -o PageSize=Legal -o Duplex=DuplexNoTumble&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [https://www.cups.org/documentation.html CUPS documentation]&lt;br /&gt;
&lt;br /&gt;
[[Category:Printers]]&lt;/div&gt;</summary>
		<author><name>Unicorn</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Cron&amp;diff=29020</id>
		<title>Cron</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Cron&amp;diff=29020"/>
		<updated>2025-02-14T20:09:02Z</updated>

		<summary type="html">&lt;p&gt;Unicorn: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page documents the working of [https://en.wikipedia.org/wiki/Cron Cron], a job scheduler on Unix-like operating systems. Cron is most suitable for scheduling repetitive tasks. Scheduling one-time tasks can be accomplished using the associated at utility. &lt;br /&gt;
There are many cron implementations, but Alpine Linux comes inbuilt with the [[BusyBox]] version of cron. Some of the other packages available in Alpine Linux are {{Pkg|cronie}}, {{Pkg|fcron}} and {{Pkg|dcron}}.&lt;br /&gt;
&lt;br /&gt;
For systems that do not run continuously, like laptops or regular desktop computers, cron jobs with large time intervals between invocations may not be executed at all if the system is suspended or powered off during the cron job&#039;s scheduled time. To work around this, many &amp;lt;code&amp;gt;crond&amp;lt;/code&amp;gt; implementations provide special directives like &amp;lt;code&amp;gt;@daily&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;@monthly&amp;lt;/code&amp;gt; which keep track of the last execution time and still execute if the system was down while the job was supposed to run.&lt;br /&gt;
&lt;br /&gt;
Examples of how to achieve this in different &amp;lt;code&amp;gt;crond&amp;lt;/code&amp;gt; implementations can be found below.&lt;br /&gt;
&lt;br /&gt;
== Cronie ==&lt;br /&gt;
&lt;br /&gt;
The {{Pkg|cronie}} package comes with &amp;lt;code&amp;gt;anacron&amp;lt;/Code&amp;gt; tool, which does this kind of asynchronous job processing. &lt;br /&gt;
&lt;br /&gt;
=== Anacron ===&lt;br /&gt;
&lt;br /&gt;
Here are the steps to use &amp;lt;code&amp;gt;anacron&amp;lt;/Code&amp;gt; in Alpine Linux:&lt;br /&gt;
&lt;br /&gt;
# Add the line {{Codeline|&amp;lt;code&amp;gt;@reboot /usr/sbin/anacron -s&amp;lt;/code&amp;gt;}} to the crontab of the &#039;&#039;&#039;root&#039;&#039;&#039; user:&lt;br /&gt;
#: {{Cmd|# crontab -e}}&lt;br /&gt;
# Once edited, &#039;&#039;&#039;root&#039;&#039;&#039; crontab should appear as follows, when viewed using the command {{Codeline|&amp;lt;code&amp;gt;# crontab -l &amp;lt;/code&amp;gt;}} or viewed directly:&lt;br /&gt;
#:{{cat|/var/spool/cron/crontabs/root| &lt;br /&gt;
# do daily/weekly/monthly maintenance&lt;br /&gt;
# min	hour	day	month	weekday	command&lt;br /&gt;
*/15	*	*	*	*	run-parts /etc/periodic/15min&lt;br /&gt;
0	*	*	*	*	run-parts /etc/periodic/hourly&lt;br /&gt;
0	2	*	*	*	run-parts /etc/periodic/daily&lt;br /&gt;
0	3	*	*	6	run-parts /etc/periodic/weekly&lt;br /&gt;
0	5	1	*	*	run-parts /etc/periodic/monthly&lt;br /&gt;
@reboot /usr/sbin/anacron -s&lt;br /&gt;
}}&lt;br /&gt;
# Anacron needs the folder {{Path|/var/spool/anacron}} to avoid the error {{Codeline|cron.err anacron[2893]: Can&#039;t chdir to /var/spool/anacron: No such file or directory}}. So create the folder using the command:&lt;br /&gt;
#: {{Cmd|# mkdir /var/spool/anacron}}&lt;br /&gt;
# Edit the configuration file {{Path|/etc/anacrontab}} and test the configuration validity by &amp;lt;Code&amp;gt;anacron -T&amp;lt;/Code&amp;gt;.&lt;br /&gt;
# Reboot the computer to test the working of anacron. The syslog file {{Path|/var/log/messages}} captures messages from anacron and can be searched by &amp;lt;Code&amp;gt;cat /var/log/messages |grep anacron&amp;lt;/Code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== dcron ==&lt;br /&gt;
&lt;br /&gt;
Another available crond that fully integrates the features of &amp;lt;code&amp;gt;anacron&amp;lt;/code&amp;gt; is {{Pkg|dcron}}, &amp;quot;dillon&#039;s lightweight cron daemon&amp;quot;. To use it, first install the {{Pkg|dcron}} package:&lt;br /&gt;
&lt;br /&gt;
 # apk add dcron&lt;br /&gt;
&lt;br /&gt;
Next, make sure that the default &amp;lt;code&amp;gt;crond&amp;lt;/code&amp;gt; from [[BusyBox]] is stopped and removed from OpenRC:&lt;br /&gt;
&lt;br /&gt;
 # rc-service crond stop&lt;br /&gt;
 # rc-update del crond&lt;br /&gt;
&lt;br /&gt;
Finally, start {{Pkg|dcron}} and tell OpenRC to start it at boot:&lt;br /&gt;
&lt;br /&gt;
 # rc-service dcron start&lt;br /&gt;
 # rc-update add dcron&lt;br /&gt;
&lt;br /&gt;
=== Configuration ===&lt;br /&gt;
&lt;br /&gt;
You can add directives to the crontab with the &amp;lt;code&amp;gt;crontab -e&amp;lt;/code&amp;gt; command, also including the &amp;lt;code&amp;gt;@hourly&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;@daily&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;@weekly&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;@monthly&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;@yearly&amp;lt;/code&amp;gt; directives.&lt;br /&gt;
&lt;br /&gt;
The syntax of these special directives slightly differs from &amp;lt;code&amp;gt;anacron&amp;lt;/code&amp;gt;. Here is how Alpine&#039;s default could be adjusted to use the {{Pkg|dcron}} syntax with the special directives to ensure that they are executed even with systems that are not always running:&lt;br /&gt;
&lt;br /&gt;
{{Cat|/var/spool/cron/crontabs/root|&amp;lt;nowiki&amp;gt;# do daily/weekly/monthly maintenance&lt;br /&gt;
# min   hour    day     month   weekday command&lt;br /&gt;
*/15    *       *       *       *       run-parts /etc/periodic/15min&lt;br /&gt;
@hourly         ID=periodic.hourly      run-parts /etc/periodic/hourly&lt;br /&gt;
@daily          ID=periodic.daily       run-parts /etc/periodic/daily&lt;br /&gt;
@weekly         ID=periodic.weekly      run-parts /etc/periodic/weekly&lt;br /&gt;
@monthly        ID=periodic.monthly     run-parts /etc/periodic/monthly&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
As you can see, the name or &amp;quot;ID&amp;quot; of a job is set in the style of a shell variable assignment. For more information about {{Pkg|dcron}}&#039;s options and its &amp;lt;code&amp;gt;crontab&amp;lt;/code&amp;gt; format, check out the &amp;lt;code&amp;gt;crontab(1)&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;crond(8)&amp;lt;/code&amp;gt; manpages, which you can install with the {{Pkg|dcron-doc}} package.&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
* [https://wiki.archlinux.org/title/Cron Archwiki Cron page]&lt;br /&gt;
* [https://github.com/cronie-crond/cronie Official cronie website]&lt;br /&gt;
* [https://www.jimpryor.net/linux/dcron.html Official dcron website]&lt;br /&gt;
* [https://crontab.guru/ crontab Generator]&lt;br /&gt;
&lt;br /&gt;
[[Category:System Administration‏‎ ]]&lt;br /&gt;
[[Category:Desktop]]&lt;/div&gt;</summary>
		<author><name>Unicorn</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Cron&amp;diff=29019</id>
		<title>Cron</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Cron&amp;diff=29019"/>
		<updated>2025-02-14T20:06:19Z</updated>

		<summary type="html">&lt;p&gt;Unicorn: Added information and example for dcron&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page documents the working of [https://en.wikipedia.org/wiki/Cron Cron], a job scheduler on Unix-like operating systems. Cron is most suitable for scheduling repetitive tasks. Scheduling one-time tasks can be accomplished using the associated at utility. &lt;br /&gt;
There are many cron implementations, but Alpine Linux comes inbuilt with the [[BusyBox]] version of cron. Some of the other packages available in Alpine Linux are {{Pkg|cronie}}, {{Pkg|fcron}} and {{Pkg|dcron}}.&lt;br /&gt;
&lt;br /&gt;
For systems that do not run continuously, like laptops or regular desktop computers, cron jobs with large time intervals between invocations may not be executed at all if the system is suspended or powered off during the cron job&#039;s scheduled time. To work around this, many &amp;lt;code&amp;gt;crond&amp;lt;/code&amp;gt; implementations provide special directives like &amp;lt;code&amp;gt;@daily&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;@monthly&amp;lt;/code&amp;gt; which keep track of the last execution time and still execute if the system was down while the job was supposed to run.&lt;br /&gt;
&lt;br /&gt;
Examples of how to achieve this in different &amp;lt;code&amp;gt;crond&amp;lt;/code&amp;gt; implementations can be found below.&lt;br /&gt;
&lt;br /&gt;
== Cronie ==&lt;br /&gt;
&lt;br /&gt;
The {{Pkg|cronie}} package comes with &amp;lt;code&amp;gt;anacron&amp;lt;/Code&amp;gt; tool, which does this kind of asynchronous job processing. &lt;br /&gt;
&lt;br /&gt;
=== Anacron ===&lt;br /&gt;
&lt;br /&gt;
Here are the steps to use &amp;lt;code&amp;gt;anacron&amp;lt;/Code&amp;gt; in Alpine Linux:&lt;br /&gt;
&lt;br /&gt;
# Add the line {{Codeline|&amp;lt;code&amp;gt;@reboot /usr/sbin/anacron -s&amp;lt;/code&amp;gt;}} to the crontab of the &#039;&#039;&#039;root&#039;&#039;&#039; user:&lt;br /&gt;
#: {{Cmd|# crontab -e}}&lt;br /&gt;
# Once edited, &#039;&#039;&#039;root&#039;&#039;&#039; crontab should appear as follows, when viewed using the command {{Codeline|&amp;lt;code&amp;gt;# crontab -l &amp;lt;/code&amp;gt;}} or viewed directly:&lt;br /&gt;
#:{{cat|/var/spool/cron/crontabs/root| &lt;br /&gt;
# do daily/weekly/monthly maintenance&lt;br /&gt;
# min	hour	day	month	weekday	command&lt;br /&gt;
*/15	*	*	*	*	run-parts /etc/periodic/15min&lt;br /&gt;
0	*	*	*	*	run-parts /etc/periodic/hourly&lt;br /&gt;
0	2	*	*	*	run-parts /etc/periodic/daily&lt;br /&gt;
0	3	*	*	6	run-parts /etc/periodic/weekly&lt;br /&gt;
0	5	1	*	*	run-parts /etc/periodic/monthly&lt;br /&gt;
@reboot /usr/sbin/anacron -s&lt;br /&gt;
}}&lt;br /&gt;
# Anacron needs the folder {{Path|/var/spool/anacron}} to avoid the error {{Codeline|cron.err anacron[2893]: Can&#039;t chdir to /var/spool/anacron: No such file or directory}}. So create the folder using the command:&lt;br /&gt;
#: {{Cmd|# mkdir /var/spool/anacron}}&lt;br /&gt;
# Edit the configuration file {{Path|/etc/anacrontab}} and test the configuration validity by &amp;lt;Code&amp;gt;anacron -T&amp;lt;/Code&amp;gt;.&lt;br /&gt;
# Reboot the computer to test the working of anacron. The syslog file {{Path|/var/log/messages}} captures messages from anacron and can be searched by &amp;lt;Code&amp;gt;cat /var/log/messages |grep anacron&amp;lt;/Code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== dcron ==&lt;br /&gt;
&lt;br /&gt;
Another available crond that fully integrates the features of &amp;lt;code&amp;gt;anacron&amp;lt;/code&amp;gt; is {{Pkg|dcron}}, &amp;quot;dillon&#039;s lightweight cron daemon&amp;quot;. To use it, first install the {{Pkg|dcron}} package:&lt;br /&gt;
&lt;br /&gt;
 # apk add dcron&lt;br /&gt;
&lt;br /&gt;
Next, make sure that the default &amp;lt;code&amp;gt;crond&amp;lt;/code&amp;gt; from [[BusyBox]] is stopped and removed from OpenRC:&lt;br /&gt;
&lt;br /&gt;
 # rc-service crond stop&lt;br /&gt;
 # rc-update del crond&lt;br /&gt;
&lt;br /&gt;
Finally, start {{Pkg|dcron}} and tell OpenRC to start it at boot:&lt;br /&gt;
&lt;br /&gt;
 # rc-service dcron start&lt;br /&gt;
 # rc-update add dcron&lt;br /&gt;
&lt;br /&gt;
=== Configuration ===&lt;br /&gt;
&lt;br /&gt;
You can add directives to the crontab with the &amp;lt;code&amp;gt;crontab -e&amp;lt;/code&amp;gt; command, also including the &amp;lt;code&amp;gt;@hourly&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;@daily&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;@weekly&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;@monthly&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;@yearly&amp;lt;/code&amp;gt; directives.&lt;br /&gt;
&lt;br /&gt;
The syntax of these special directives differs slightly differs from &amp;lt;code&amp;gt;anacron&amp;lt;/code&amp;gt;. Here is how Alpine&#039;s default could be adjusted to use the {{Pkg|dcron}} syntax with the special directives to ensure that they are executed even with systems that are not always running:&lt;br /&gt;
&lt;br /&gt;
{{Cat|/var/spool/cron/crontabs/root|&amp;lt;nowiki&amp;gt;# do daily/weekly/monthly maintenance&lt;br /&gt;
# min   hour    day     month   weekday command&lt;br /&gt;
*/15    *       *       *       *       run-parts /etc/periodic/15min&lt;br /&gt;
@hourly         ID=periodic.hourly      run-parts /etc/periodic/hourly&lt;br /&gt;
@daily          ID=periodic.daily       run-parts /etc/periodic/daily&lt;br /&gt;
@weekly         ID=periodic.weekly      run-parts /etc/periodic/weekly&lt;br /&gt;
@monthly        ID=periodic.monthly     run-parts /etc/periodic/monthly&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
As you can see, the name or &amp;quot;ID&amp;quot; of a job is set in the style of a shell variable assignment. For more information about {{Pkg|dcron}}&#039;s options and its &amp;lt;code&amp;gt;crontab&amp;lt;/code&amp;gt; format, check out the &amp;lt;code&amp;gt;crontab(1)&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;crond(8)&amp;lt;/code&amp;gt; manpages, which you can install with the {{Pkg|dcron-doc}} package.&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
* [https://wiki.archlinux.org/title/Cron Archwiki Cron page]&lt;br /&gt;
* [https://github.com/cronie-crond/cronie Official cronie website]&lt;br /&gt;
* [https://www.jimpryor.net/linux/dcron.html Official dcron website]&lt;br /&gt;
* [https://crontab.guru/ crontab Generator]&lt;br /&gt;
&lt;br /&gt;
[[Category:System Administration‏‎ ]]&lt;br /&gt;
[[Category:Desktop]]&lt;/div&gt;</summary>
		<author><name>Unicorn</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Root_on_ZFS_with_native_encryption&amp;diff=21595</id>
		<title>Root on ZFS with native encryption</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Root_on_ZFS_with_native_encryption&amp;diff=21595"/>
		<updated>2022-02-12T11:52:38Z</updated>

		<summary type="html">&lt;p&gt;Unicorn: Added introduction, minor formatting changes, minor wording changes&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a guide for installing Alpine Linux with its root partition on an encrypted ZFS volume, using ZFS&#039;s own encryption capabilities. The system will be encrypted when powered off and will need to be unlocked by typing a passphrase at boot. To be able to boot the system, the `/boot` partition remains unencrypted.&lt;br /&gt;
&lt;br /&gt;
= Downloading Alpine =&lt;br /&gt;
&lt;br /&gt;
Download the &#039;&#039;&#039;extended&#039;&#039;&#039; release from https://www.alpinelinux.org/downloads/ as only it contains the zfs kernel modules at the time of writing (2022-02-12).&lt;br /&gt;
&lt;br /&gt;
Write it to a USB device and boot from it.&lt;br /&gt;
&lt;br /&gt;
= Initial Setup =&lt;br /&gt;
&lt;br /&gt;
Run the following to start the installation procedure:&lt;br /&gt;
&lt;br /&gt;
    setup-alpine&lt;br /&gt;
&lt;br /&gt;
Answer all the questions, and hit ctrl-c when promted for which disk you&#039;d like to use.&lt;br /&gt;
&lt;br /&gt;
== Optional: SSH access ==&lt;br /&gt;
&lt;br /&gt;
This section is optional and it assumes internet connectivity. You may enable sshd so you can ssh into the box and copy and paste the rest of the commands from these instructions into a terminal window.&lt;br /&gt;
&lt;br /&gt;
Edit `/etc/ssh/sshd_config` and search for `Permit`. Change the value after `PermitRootLogin` to read `yes`&lt;br /&gt;
&lt;br /&gt;
save and exit to shell. Run `service sshd restart`&lt;br /&gt;
&lt;br /&gt;
Now you can ssh in as root. Do not forget to go back and comment this line out when you&#039;re done since it will be enabled on the resulting machine. You will be reminded again at the end of this doc.&lt;br /&gt;
&lt;br /&gt;
= Add required packages  =&lt;br /&gt;
&lt;br /&gt;
    apk add zfs sfdisk e2fsprogs syslinux&lt;br /&gt;
&lt;br /&gt;
= Partition setup =&lt;br /&gt;
&lt;br /&gt;
We&#039;re assuming that `/dev/sda` is the target storage device here and in the rest of the document, but the name of the storage device you wish to install to may be different. To see a list of storage devices and determine the correct one, type `sfdisk -l`.&lt;br /&gt;
&lt;br /&gt;
    echo -e &amp;quot;/dev/sda1: start=1M,size=100M,bootable\n/dev/sda2: start=101M&amp;quot; | sfdisk --quiet --label dos /dev/sda&lt;br /&gt;
&lt;br /&gt;
== Create device nodes ==&lt;br /&gt;
&lt;br /&gt;
    mdev -s&lt;br /&gt;
&lt;br /&gt;
== Create the /boot filesystem ==&lt;br /&gt;
&lt;br /&gt;
    mkfs.ext4 /dev/sda1&lt;br /&gt;
&lt;br /&gt;
= ZFS setup =&lt;br /&gt;
== Create the root zpool ==&lt;br /&gt;
&lt;br /&gt;
    modprobe zfs&lt;br /&gt;
    zpool create -f -o ashift=12 \&lt;br /&gt;
        -O acltype=posixacl -O canmount=off -O compression=lz4 \&lt;br /&gt;
        -O dnodesize=auto -O normalization=formD -O relatime=on -O xattr=sa \&lt;br /&gt;
        -O encryption=aes-256-gcm -O keylocation=prompt -O keyformat=passphrase \&lt;br /&gt;
        -O mountpoint=/ -R /mnt \&lt;br /&gt;
        rpool /dev/sda2&lt;br /&gt;
&lt;br /&gt;
You will have to enter your passphrase at this point. Choose wisely, as your passphrase is most likely [https://gitlab.com/cryptsetup/cryptsetup/wikis/FrequentlyAskedQuestions#5-security-aspects the weakest link in this setup].&lt;br /&gt;
&lt;br /&gt;
A few notes on the options supplied to zpool:&lt;br /&gt;
&lt;br /&gt;
- `ashift=12` is recommended here because many drives today have 4KiB (or larger) physical sectors, even though they present 512B logical sectors&lt;br /&gt;
&lt;br /&gt;
- `acltype=posixacl` enables POSIX ACLs globally&lt;br /&gt;
&lt;br /&gt;
- `normalization=formD` eliminates some corner cases relating to UTF-8 filename normalization. It also enables `utf8only=on`, meaning that only files with valid UTF-8 filenames will be accepted.&lt;br /&gt;
&lt;br /&gt;
- `xattr=sa` vastly improves the performance of extended attributes, but is Linux-only. If you care about using this pool on other OpenZFS implementation don&#039;t specify this option.&lt;br /&gt;
&lt;br /&gt;
After completing this, confirm that the pool has been created:&lt;br /&gt;
&lt;br /&gt;
    # zpool status&lt;br /&gt;
&lt;br /&gt;
Should return something like:&lt;br /&gt;
&lt;br /&gt;
      pool: rpool&lt;br /&gt;
     state: ONLINE&lt;br /&gt;
      scan: none requested&lt;br /&gt;
    config:&lt;br /&gt;
&lt;br /&gt;
        NAME        STATE     READ WRITE CKSUM&lt;br /&gt;
        rpool       ONLINE       0     0     0&lt;br /&gt;
          sda2      ONLINE       0     0     0&lt;br /&gt;
&lt;br /&gt;
    errors: No known data errors&lt;br /&gt;
&lt;br /&gt;
== Create the required datasets and mount root ==&lt;br /&gt;
&lt;br /&gt;
    zfs create -o mountpoint=none -o canmount=off rpool/ROOT&lt;br /&gt;
    zfs create -o mountpoint=legacy rpool/ROOT/alpine&lt;br /&gt;
    mount -t zfs rpool/ROOT/alpine /mnt/&lt;br /&gt;
&lt;br /&gt;
== Mount the `/boot` filesystem ==&lt;br /&gt;
&lt;br /&gt;
    mkdir /mnt/boot/&lt;br /&gt;
    mount -t ext4 /dev/sda1 /mnt/boot/&lt;br /&gt;
&lt;br /&gt;
== Enable ZFS&#039; services ==&lt;br /&gt;
&lt;br /&gt;
    rc-update add zfs-import sysinit&lt;br /&gt;
    rc-update add zfs-mount sysinit&lt;br /&gt;
&lt;br /&gt;
= Install Alpine Linux =&lt;br /&gt;
&lt;br /&gt;
    setup-disk /mnt&lt;br /&gt;
    dd if=/usr/share/syslinux/mbr.bin of=/dev/sda # write mbr so we can boot&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Reboot and enjoy! =&lt;br /&gt;
&lt;br /&gt;
😉&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTE:&#039;&#039;&#039;&lt;br /&gt;
If you went with the optional step, be sure to disable root login after you reboot.&lt;/div&gt;</summary>
		<author><name>Unicorn</name></author>
	</entry>
</feed>