<?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=Mtbu</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=Mtbu"/>
	<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/wiki/Special:Contributions/Mtbu"/>
	<updated>2026-05-03T08:12:47Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.40.0</generator>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=23476</id>
		<title>Raspberry Pi</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=23476"/>
		<updated>2023-05-18T22:58:24Z</updated>

		<summary type="html">&lt;p&gt;Mtbu: /* Netboot */  Typo&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{warning | 11 Feb 2021 - There is currently a known bug upstream &amp;lt;br /&amp;gt;[https://github.com/raspberrypi/firmware/issues/1529 kernel/initramfs cannot be loaded from subdirectory with same name as volume label] }}&lt;br /&gt;
&lt;br /&gt;
{{TOC right}}&lt;br /&gt;
&lt;br /&gt;
This tutorial explains how to install Alpine Linux on a Raspberry Pi. Alpine Linux will be installed in [[Installation#Diskless_Mode|diskless mode]], hence, [[Alpine local backup|Alpine Local Backup (lbu)]] is required to save modifications between reboots.&lt;br /&gt;
&lt;br /&gt;
For scenarios where there is not expected to be significant changes to disk after setup (like running a static HTTP server), this is likely preferable, as running the entire system from memory will improve performance (by avoiding the slow SD card) and improve the SD card life (by reducing the writes to the card, as all logging will happen in RAM). Diskless installations still allow you to install packages, save local files, and tune the system to your needs.&lt;br /&gt;
&lt;br /&gt;
If any of the following apply, then installation in [[Classic install or sys mode on Raspberry Pi|sys-mode installation]] is likely more appropriate.&lt;br /&gt;
&lt;br /&gt;
* There will be constant changes to the disk after initial setup (for example, if you expect people to login and save files to their home directories)&lt;br /&gt;
* Logs should persists across reboots&lt;br /&gt;
* Plan to install packages which consume more space than can be loaded into RAM&lt;br /&gt;
* Plan to install kernel modules (such as ZFS or Wireguard)&lt;br /&gt;
&lt;br /&gt;
== Preparation ==&lt;br /&gt;
&lt;br /&gt;
# [http://alpinelinux.org/downloads/ Download] the Alpine for Raspberry Pi tarball. You should be safe using the &#039;&#039;&#039;armhf&#039;&#039;&#039; build on all versions of Raspberry Pi (including Pi Zero and Compute Modules); but it may perform less optimally on recent versions of Raspberry Pi. The &#039;&#039;&#039;armv7&#039;&#039;&#039; build is compatible with Raspberry Pi 2 Model B. The &#039;&#039;&#039;aarch64&#039;&#039;&#039; build should be compatible with Raspberry Pi 2 Model v1.2, Raspberry Pi 3 and Compute Module 3, and Raspberry Pi 4 model B.&lt;br /&gt;
# [[Create_a_Bootable_Device#Manually_copying_Alpine_files|Create a bootable FAT32 partition on your SD card.]] The partitioning and formatting part of the instructions on the linked page could be done using a graphical partitioning tool such as [https://en.wikipedia.org/wiki/GNOME_Disks gnome-disks], just make sure the partition type is &amp;lt;code&amp;gt;W95 FAT32 (LBA)&amp;lt;/code&amp;gt;. (The current type can be found in the &amp;quot;Type&amp;quot; column in the output of &amp;lt;code&amp;gt;fdisk -l&amp;lt;/code&amp;gt;.)&lt;br /&gt;
# Extract the tarball to the root of the bootable FAT32 partition.&lt;br /&gt;
&lt;br /&gt;
To setup a headless system, a bootstrapping configuration overlay file [https://github.com/macmpi/alpine-linux-headless-bootstrap  headless.apkovl.tar.gz] may be added to enable basic networking, so that following configuration steps can be performed under &amp;lt;code&amp;gt;ssh&amp;lt;/code&amp;gt;. Pi Zero may be configured with simple USB ethernet-gadget networking with another computer sharing its internet connection.&lt;br /&gt;
&lt;br /&gt;
Optionally create a &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; file on the partition to configure low-level system settings. Specifications can be found [https://www.raspberrypi.org/documentation/configuration/config-txt here]. However, note some settings can only be set directly in &#039;&#039;&#039;config.txt&#039;&#039;&#039;, which may be overwritten after updates. In particular, &amp;lt;code&amp;gt;gpu_mem&amp;lt;/code&amp;gt; will have no effect when specified in &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; ([https://github.com/raspberrypi/firmware/issues/1332 source]). Some interesting values include:&lt;br /&gt;
* To enable the UART console: &amp;lt;code&amp;gt;enable_uart=1&amp;lt;/code&amp;gt;&lt;br /&gt;
* To enable audio: &amp;lt;code&amp;gt;dtparam=audio=on&amp;lt;/code&amp;gt;&lt;br /&gt;
* If you see black edges around your screen after booting the Pi, you can add &amp;lt;code&amp;gt;disable_overscan=1&amp;lt;/code&amp;gt;&lt;br /&gt;
* If you plan to install on a Pi Compute Module 4 with I/O board, you may need to add: &amp;lt;code&amp;gt;otg_mode=1&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Recent versions include Broadcom firmware files. If you&#039;re using an older Alpine version, see [[#Wireless_support_with_older_Alpine_images|section below]].&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
Follow these steps to install Alpine Linux in Diskless Mode:&lt;br /&gt;
&lt;br /&gt;
# Insert the SD card into the Raspberry Pi and power it on&lt;br /&gt;
# Login into the Alpine system as root.  Leave the password empty.&lt;br /&gt;
# Type &amp;lt;code&amp;gt;setup-alpine&amp;lt;/code&amp;gt;&lt;br /&gt;
# Once the installation is complete, commit the changes by typing &amp;lt;code&amp;gt;lbu commit -d&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Type &amp;lt;code&amp;gt;reboot&amp;lt;/code&amp;gt; to verify that the installation was indeed successful.&lt;br /&gt;
&lt;br /&gt;
== Post Installation ==&lt;br /&gt;
&lt;br /&gt;
=== Update the System ===&lt;br /&gt;
&lt;br /&gt;
After installation, make sure your system is up-to-date:&lt;br /&gt;
&lt;br /&gt;
{{cmd|apk update&lt;br /&gt;
apk upgrade}}&lt;br /&gt;
&lt;br /&gt;
Don&#039;t forget to save the changes:&lt;br /&gt;
&lt;br /&gt;
{{cmd|lbu commit -d}}&lt;br /&gt;
&lt;br /&gt;
Note: this does not upgrade the kernel. In order to upgrade the kernel, a full upgrade of the Alpine Linux version must be performed as described in [[Upgrading Alpine#Upgrading Alpine Linux on other removable media (such as CF/USB)|upgrading Alpine Linux for removable media]].&lt;br /&gt;
&lt;br /&gt;
=== Clock-related error messages ===&lt;br /&gt;
&lt;br /&gt;
During the booting time, you might notice errors related to the hardware clock.  The Raspberry Pi does not have&lt;br /&gt;
a hardware clock, thus you need to disable the hwclock daemon and enable swclock:&lt;br /&gt;
&lt;br /&gt;
{{cmd|rc-update add swclock boot    # enable the software clock&lt;br /&gt;
rc-update del hwclock boot    # disable the hardware clock}}&lt;br /&gt;
&lt;br /&gt;
Since the Raspberry Pi does not have a clock, Alpine Linux needs to know what the time is by using a&lt;br /&gt;
[https://en.wikipedia.org/wiki/Network_Time_Protocol Network Time Protocol (NTP)] daemon.  Make sure you have a&lt;br /&gt;
NTP daemon installed and running.  If you are not sure, you can install an NTP client by running the following&lt;br /&gt;
command:&lt;br /&gt;
&lt;br /&gt;
{{cmd|setup-ntp}}&lt;br /&gt;
&lt;br /&gt;
The Busybox NTP client might be the most lightweight solution.  Save the changes and reboot, once the NTP software is&lt;br /&gt;
installed and running:&lt;br /&gt;
&lt;br /&gt;
{{cmd|lbu commit -d&lt;br /&gt;
reboot}}&lt;br /&gt;
&lt;br /&gt;
After reboot, make sure the &amp;lt;code&amp;gt;date&amp;lt;/code&amp;gt; command outputs the correct date and time.&lt;br /&gt;
&lt;br /&gt;
=== WiFi on boot ===&lt;br /&gt;
If you have already [[Connecting_to_a_wireless_access_point|configured WiFi]] during the setup, the connection will not return on reboot.&lt;br /&gt;
You will need to start up a service to automatically connect to the wireless access point.&lt;br /&gt;
# Run &amp;lt;code&amp;gt;rc-update add wpa_supplicant boot&amp;lt;/code&amp;gt; to connect to the wireless access point during bootup.&lt;br /&gt;
# Run it manually with &amp;lt;code&amp;gt;/etc/init.d/wpa_supplicant start&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Enable Graphics ===&lt;br /&gt;
Remount the boot partition writeable (i.e. &amp;lt;code&amp;gt;/media/mmcblk0p1&amp;lt;/code&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
{{cmd|mount /media/mmcblk0p1 -o rw,remount}}&lt;br /&gt;
&lt;br /&gt;
Add the following lines to &amp;lt;code&amp;gt;/media/mmcblk0p1/config.txt&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 dtoverlay=vc4-kms-v3d&lt;br /&gt;
&lt;br /&gt;
If you are experiencing graphical issues, you can also try:&lt;br /&gt;
&lt;br /&gt;
 dtoverlay=vc4-fkms-v3d&lt;br /&gt;
&lt;br /&gt;
And perhaps also raising the default &amp;lt;code&amp;gt;gpu_mem&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 gpu_mem=128&lt;br /&gt;
&lt;br /&gt;
Note that raising the gpu memory is not likely to [https://www.raspberrypi.com/documentation/computers/config_txt.html#gpu_mem actually improve performance on the Pi4]&lt;br /&gt;
&lt;br /&gt;
Install the Mesa drivers:&lt;br /&gt;
&lt;br /&gt;
{{cmd|&amp;lt;nowiki&amp;gt;apk add mesa-dri-gallium&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
Then reboot:&lt;br /&gt;
&lt;br /&gt;
{{cmd|lbu_commit -d; reboot}}&lt;br /&gt;
&lt;br /&gt;
=== WiFi drivers ===&lt;br /&gt;
As of Alpine 3.14, the WiFi drivers for the Raspberry Pi were moved from &amp;lt;code&amp;gt;linux-firmware-brcm&amp;lt;/code&amp;gt; to the &amp;lt;code&amp;gt;linux-firmware-cypress&amp;lt;/code&amp;gt; package (source?). Since the images seem to be an outdated version of the former, Wi-Fi will work during installation, but after the first update it will break.&lt;br /&gt;
Use the ethernet interface to download the required packages:&lt;br /&gt;
&lt;br /&gt;
{{cmd|apk add linux-firmware-cypress}}&lt;br /&gt;
&lt;br /&gt;
And reboot.&lt;br /&gt;
&lt;br /&gt;
== Persistent storage ==&lt;br /&gt;
=== Loopback image with overlayfs ===&lt;br /&gt;
&lt;br /&gt;
When you install Alpine in diskless mode, the entire system is loaded into memory at boot. If you want additional storage (for example, if you need more space than offered by your RAM) we need to create loop-back storage onto the SD card mounted with overlayfs.&lt;br /&gt;
&lt;br /&gt;
First, make the SD card writable again and change fstab to always do so:&lt;br /&gt;
{{cmd|mount /media/mmcblk0p1 -o rw,remount&lt;br /&gt;
sed -i &#039;s/vfat\ ro,/vfat\ rw,/&#039; /etc/fstab}}&lt;br /&gt;
&lt;br /&gt;
Create the loop-back file, this example is 1 GB:&lt;br /&gt;
&lt;br /&gt;
{{cmd|dd if&amp;amp;#61;/dev/zero of&amp;amp;#61;/media/mmcblk0p1/persist.img bs&amp;amp;#61;1024 count&amp;amp;#61;0 seek&amp;amp;#61;1048576}}&lt;br /&gt;
&lt;br /&gt;
Install the ext utilities:&lt;br /&gt;
&lt;br /&gt;
{{cmd|apk add e2fsprogs}}&lt;br /&gt;
&lt;br /&gt;
Format the loop-back file:&lt;br /&gt;
&lt;br /&gt;
{{cmd|mkfs.ext4 /media/mmcblk0p1/persist.img}}&lt;br /&gt;
&lt;br /&gt;
Mount the storage: &lt;br /&gt;
&lt;br /&gt;
{{cmd|echo &amp;quot;/media/mmcblk0p1/persist.img /media/persist ext4 rw,relatime,errors&amp;amp;#61;remount-ro 0 0&amp;quot; &amp;gt;&amp;gt; /etc/fstab&lt;br /&gt;
mkdir /media/persist &lt;br /&gt;
mount -a}}&lt;br /&gt;
&lt;br /&gt;
Make the overlay folders, we are using the /usr directory here, but you can use /home or anything else. &lt;br /&gt;
{{Warning|Overlay workdir needs to be an empty directory on the same filesystem mount as the upper directory. So each overlay must use its own workdir.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{cmd|mkdir /media/persist/usr &lt;br /&gt;
mkdir /media/persist/.work_usr &lt;br /&gt;
echo &amp;quot;overlay /usr overlay lowerdir&amp;amp;#61;/usr,upperdir&amp;amp;#61;/media/persist/usr,workdir&amp;amp;#61;/media/persist/.work_usr 0 0&amp;quot; &amp;gt;&amp;gt; /etc/fstab &lt;br /&gt;
mount -a}}&lt;br /&gt;
&lt;br /&gt;
Your /etc/fstab should look something like this:&lt;br /&gt;
{{Cmd|/dev/cdrom      /media/cdrom    iso9660 noauto,ro 0 0&lt;br /&gt;
/dev/usbdisk    /media/usb      vfat    noauto,ro 0 0&lt;br /&gt;
/dev/mmcblk0p1 /media/mmcblk0p1 vfat rw,relatime,fmask&amp;amp;#61;0022,dmask&amp;amp;#61;0022,errors&amp;amp;#61;remount-ro 0 0&lt;br /&gt;
/media/mmcblk0p1/persist.img /media/persist ext4 rw,relatime,errors&amp;amp;#61;remount-ro 0 0&lt;br /&gt;
overlay /usr overlay lowerdir&amp;amp;#61;/usr,upperdir&amp;amp;#61;/media/persist/usr,workdir&amp;amp;#61;/media/persist/.work_usr 0 0}}&lt;br /&gt;
&lt;br /&gt;
Now commit the changes: (optionally remove the e2fsprogs, but it does contain repair tools)&lt;br /&gt;
{{cmd|lbu_commit -d}}&lt;br /&gt;
&lt;br /&gt;
Remember, with this setup if you install things and you have done this overlay for /usr, you must not commit the &#039;apk add&#039;, otherwise, while it boots it will try and install it to memory, not to the persistent storage.&lt;br /&gt;
&lt;br /&gt;
If you do want to install something small at boot, you can use `apk add` and `lbu commit -d`.&lt;br /&gt;
&lt;br /&gt;
If it is something a bit bigger, then you can use `apk add` but then not commit it. It will be persistent (in /user), but be sure to check everything you need is in that directory and not in folders you have not made persistent.&lt;br /&gt;
&lt;br /&gt;
=== Traditional disk-based (sys) installation ===&lt;br /&gt;
{{Merge|Classic install or sys mode on Raspberry Pi|There&#039;s an existing page for sys-installations on RasPi.}}&lt;br /&gt;
&lt;br /&gt;
It is also possible to switch to a fully disk-based installation. This is not yet formally supported, but can be done somewhat manually. This frees all the memory otherwise needed for the root filesystem, allowing more installed packages.&lt;br /&gt;
&lt;br /&gt;
Split your SD card into two partitions: the FAT32 boot partition described above (in this example it&#039;ll be &amp;lt;code&amp;gt;mmcblk0p1&amp;lt;/code&amp;gt;) , and a second partition to hold the root filesystem (here it&#039;ll be &amp;lt;code&amp;gt;mmcblk0p2&amp;lt;/code&amp;gt;). Boot and configure your diskless system as above, then create a root filesystem:&lt;br /&gt;
&lt;br /&gt;
{{cmd|apk add e2fsprogs&lt;br /&gt;
mkfs.ext4 /dev/mmcblk0p2}}&lt;br /&gt;
&lt;br /&gt;
Now do a disk install via a mountpoint. The &amp;lt;code&amp;gt;setup-disk&amp;lt;/code&amp;gt; script will give some errors about syslinux/extlinux, but you can ignore them.&lt;br /&gt;
The Raspberry Pi doesn&#039;t need them to boot.&lt;br /&gt;
&lt;br /&gt;
{{cmd|&amp;lt;nowiki&amp;gt;mkdir /stage&lt;br /&gt;
mount /dev/mmcblk0p2 /stage&lt;br /&gt;
setup-disk -o /media/mmcblk0p1/MYHOSTNAME.apkovl.tar.gz /stage&lt;br /&gt;
# (ignore errors about syslinux/extlinux)&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
Add a line to &amp;lt;code&amp;gt;/stage/etc/fstab&amp;lt;/code&amp;gt; to mount the Pi&#039;s boot partition again:&lt;br /&gt;
&lt;br /&gt;
{{cmd|/dev/mmcblk0p1 /media/mmcblk0p1 vfat defaults 0 0}}&lt;br /&gt;
&lt;br /&gt;
Now add a &amp;lt;code&amp;gt;root=/dev/mmcblk0p2&amp;lt;/code&amp;gt; parameter to the Pi&#039;s boot command line, either &amp;lt;code&amp;gt;cmdline-rpi2.txt&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;cmdline-rpi.txt&amp;lt;/code&amp;gt; depending on model:&lt;br /&gt;
&lt;br /&gt;
{{cmd|&amp;lt;nowiki&amp;gt;mount -o remount,rw /media/mmcblk0p1&lt;br /&gt;
sed -i &#039;$ s/$/ root=\/dev\/mmcblk0p2/&#039; /media/mmcblk0p1/cmdline-rpi2.txt&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
You might also consider &amp;lt;code&amp;gt;overlaytmpfs=yes&amp;lt;/code&amp;gt; here, which will cause the underlying SD card root filesystem to be mounted read-only, with an overlayed tmpfs for modifications which will be discarded at shutdown.&lt;br /&gt;
&lt;br /&gt;
N.B. &amp;lt;b&amp;gt;the contents of /boot will be ignored when the Pi boots&amp;lt;/b&amp;gt;. It will use the kernel, initramfs, and modloop images from the FAT32 boot partition. To update the kernel, initfs or modules, you will need to manually (generate and) copy these to the boot partition or you could use bind mount, in which case,&lt;br /&gt;
copying the files to boot partition manually, is not needed.&lt;br /&gt;
&lt;br /&gt;
{{cmd|&amp;lt;nowiki&amp;gt;echo /media/mmcblk0p1/boot /boot none defaults,bind 0 0 &amp;gt;&amp;gt; /etc/fstab&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
=== Persistent Installation on Raspberry Pi 3 ===&lt;br /&gt;
See [[Classic install or sys mode on Raspberry Pi]] and https://web.archive.org/web/20171125115835/https://forum.alpinelinux.org/comment/1084#comment-1084&lt;br /&gt;
&lt;br /&gt;
=== Persistent Installation on Raspberry Pi 4 ===&lt;br /&gt;
As of 3.14, setup-alpine should ask you if you want to create a sys mode partition on your Raspberry Pi 4.&lt;br /&gt;
&lt;br /&gt;
== Netboot ==&lt;br /&gt;
&lt;br /&gt;
=== Netbooting Raspberry Pi 4 ===&lt;br /&gt;
&lt;br /&gt;
The Raspberry Pi 4 bootloader can be configured to boot from the network [https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#raspberry-pi-4-bootloader-configuration]. Configure the bootloader with at least&lt;br /&gt;
&lt;br /&gt;
{{cmd|&amp;lt;nowiki&amp;gt;BOOT_ORDER=0xf142&lt;br /&gt;
TFTP_PREFIX=1&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
and optionally also {{cmd|&amp;lt;nowiki&amp;gt;TFTP_IP=x.x.x.x&amp;lt;/nowiki&amp;gt;}} where &amp;lt;code&amp;gt;x.x.x.x&amp;lt;/code&amp;gt; is the IP address of your TFTP server.&lt;br /&gt;
&lt;br /&gt;
If not configuring &amp;lt;code&amp;gt;TFTP_IP&amp;lt;/code&amp;gt; in the bootloader, you&#039;ll need to configure your DHCP server to advertise the TFTP server IP address. This varies depending on your DHCP server; use the following details if applicable:&lt;br /&gt;
&lt;br /&gt;
# Vendor class: &amp;lt;code&amp;gt;PXEClient:Arch:00000:UNDI:002001&amp;lt;/code&amp;gt;&lt;br /&gt;
# Filename: &amp;lt;code&amp;gt;/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The minimal set of files that your TFTP server needs to host are:&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;code&amp;gt;bcm2711-rpi-4-b.dtb&amp;lt;/code&amp;gt; (from [https://raw.githubusercontent.com/raspberrypi/firmware/master/boot/bcm2711-rpi-4-b.dtb raspberrypi/firmware/master/boot/bcm2711-rpi-4-b.dtb])&lt;br /&gt;
# &amp;lt;code&amp;gt;cmdline.txt&amp;lt;/code&amp;gt; (see below)&lt;br /&gt;
# &amp;lt;code&amp;gt;config.txt&amp;lt;/code&amp;gt; (see below)&lt;br /&gt;
# &amp;lt;code&amp;gt;fixup4.dat&amp;lt;/code&amp;gt; (from [https://raw.githubusercontent.com/raspberrypi/firmware/master/boot/fixup4.dat raspberrypi/firmware/master/boot/fixup4.dat], alternatively &amp;lt;code&amp;gt;fixup4cd.dat&amp;lt;/code&amp;gt; for the cut down version)&lt;br /&gt;
# &amp;lt;code&amp;gt;initramfs-rpi4&amp;lt;/code&amp;gt; (from [http://dl-cdn.alpinelinux.org/alpine/edge/releases/aarch64/netboot/initramfs-rpi4 alpine/edge/releases/aarch64/netboot/initramfs-rpi4])&lt;br /&gt;
# &amp;lt;code&amp;gt;start4.elf&amp;lt;/code&amp;gt; (from [https://raw.githubusercontent.com/raspberrypi/firmware/master/boot/start4.elf raspberrypi/firmware/master/boot/start4.elf], alternatively &amp;lt;code&amp;gt;start4cd.elf&amp;lt;/code&amp;gt; for the cut down version)&lt;br /&gt;
# &amp;lt;code&amp;gt;vmlinuz-rpi4&amp;lt;/code&amp;gt; (from [http://dl-cdn.alpinelinux.org/alpine/edge/releases/aarch64/netboot/vmlinuz-rpi4 alpine/edge/releases/aarch64/netboot/vmlinuz-rpi4])&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;config.txt&amp;lt;/code&amp;gt;:&lt;br /&gt;
{{cmd|&amp;lt;nowiki&amp;gt;[pi4]&lt;br /&gt;
kernel=vmlinuz-rpi4&lt;br /&gt;
initramfs initramfs-rpi4&lt;br /&gt;
arm_64bit=1&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;cmdline.txt&amp;lt;/code&amp;gt;:&lt;br /&gt;
{{cmd|&amp;lt;nowiki&amp;gt;modules=loop,squashfs console=ttyAMA0,115200 ip=dhcp alpine_repo=http://dl-cdn.alpinelinux.org/alpine/edge/main modloop=http://dl-cdn.alpinelinux.org/alpine/edge/releases/aarch64/netboot/modloop-rpi4&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
Instead of using the http://dl-cdn.alpinelinux.org/alpine/edge/releases/aarch64/netboot/ base URL above, pinning to a specific point in time is preferred. Raspberry Pi 4 netboot files are available from https://dl-cdn.alpinelinux.org/alpine/edge/releases/aarch64/netboot-20230329/ onward.&lt;br /&gt;
&lt;br /&gt;
With the above configured the Raspberry Pi 4 should be able to boot from the network without an SD card.&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
=== Long boot time when running headless ===&lt;br /&gt;
&lt;br /&gt;
If no peripherals are connected, the system might hang for an exceptionally long period of time while it attempts to accumulate entropy.&lt;br /&gt;
&lt;br /&gt;
If this is the case, simply plugging in any USB device should work around this issue, since it increases the amount of entropy available to the kernel via interrupts.&lt;br /&gt;
&lt;br /&gt;
=== apk indicating &#039;No space left on device&#039; ===&lt;br /&gt;
&lt;br /&gt;
Note some models of the Raspberry Pi such as the 3A+ only have 512M of RAM, which on fresh Alpine deployment will only leave around 200M for tmpfs root. It&#039;s important to keep this limitation in mind when using these boards.&lt;br /&gt;
&lt;br /&gt;
=== Wireless support with older Alpine images ===&lt;br /&gt;
&lt;br /&gt;
If you need Wi-Fi, you&#039;ll need to [https://github.com/RPi-Distro/firmware-nonfree/tree/master/brcm download] the latest Broadcom drivers to your SD card.&lt;br /&gt;
(Replace /mnt/sdcard with the correct mount point.)&lt;br /&gt;
&lt;br /&gt;
  git clone --depth 1 https://github.com/RPi-Distro/firmware-nonfree.git&lt;br /&gt;
  cp firmware-nonfree/brcm/* /mnt/sdcard/firmware/brcm&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
* [[Classic install or sys mode on Raspberry Pi]] - a variant.&lt;br /&gt;
* [[Raspberry Pi 3 - Setting Up Bluetooth]]&lt;br /&gt;
* [[Raspberry Pi 3 - Configuring it as wireless access point -AP Mode]]&lt;br /&gt;
* [[Raspberry Pi 3 - Browser Client]]&lt;br /&gt;
* [[Linux Router with VPN on a Raspberry Pi]]&lt;br /&gt;
* [[Create a bootable SDHC from a Mac]]&lt;br /&gt;
* Build custom Raspberry Pi images based on Alpine via [https://github.com/tolstoyevsky/pieman Pieman]&lt;br /&gt;
* [[Tutorials and Howtos#Raspberry Pi]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;br /&gt;
[[Category: Raspberry]]&lt;/div&gt;</summary>
		<author><name>Mtbu</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Alpine_Linux:FAQ&amp;diff=19989</id>
		<title>Alpine Linux:FAQ</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Alpine_Linux:FAQ&amp;diff=19989"/>
		<updated>2021-07-30T21:25:06Z</updated>

		<summary type="html">&lt;p&gt;Mtbu: /* My cron jobs don&amp;#039;t run? */  typo in code example &amp;quot;daildy&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Image:filetypes.svg|64px|left|link=]]&lt;br /&gt;
This is a list of &#039;&#039;&#039;frequently asked questions&#039;&#039;&#039; about Alpine Linux.&amp;lt;br&amp;gt;&lt;br /&gt;
If your question is not answered on this page, use the search box above to find work in progress pages not linked here, or in case of no answer, edit this page and write down your question.&lt;br /&gt;
{{Tip| Prepare your question. Think it through. Make it simple and understandable.}} &lt;br /&gt;
&lt;br /&gt;
=General=&lt;br /&gt;
&lt;br /&gt;
Alpine Linux is used heavily in containers (e.g. docker images) on servers, so many of its main packages are focused on server services.&lt;br /&gt;
&lt;br /&gt;
== Where to start? ==&lt;br /&gt;
&lt;br /&gt;
The «[[Installation|Installation page]]» provides a basic orientation.&lt;br /&gt;
&lt;br /&gt;
A broader overview may be found on the official «[http://alpinelinux.org/about About page]», and at the «[[Alpine Linux:Overview|Wiki Overview]]».&lt;br /&gt;
&lt;br /&gt;
Please note that testing is safer on your own virtual machine or on a public «[https://distrotest.net/AlpineLinux/ DistroTest.net]».&lt;br /&gt;
&lt;br /&gt;
== I have found a bug, where can I report it? ==&lt;br /&gt;
&lt;br /&gt;
You can report it in the [https://gitlab.alpinelinux.org/groups/alpine/-/issues bugtracker], but search it first to see if the issue has already been reported.&lt;br /&gt;
&lt;br /&gt;
== Are there any details about the releases available? ==&lt;br /&gt;
Yes, please check the [https://alpinelinux.org/releases/ releases] page.&lt;br /&gt;
&lt;br /&gt;
== How can I contribute? ==&lt;br /&gt;
You can contribute by:&lt;br /&gt;
* Using the software and giving feedback.&lt;br /&gt;
* Documenting your [http://www.alpinelinux.org Alpine Linux] experiences on this [[Main_Page|wiki]].&lt;br /&gt;
* In many other ways.&lt;br /&gt;
Please visit [[Contribute|Contribute page]] to read more about this topic.&lt;br /&gt;
&lt;br /&gt;
== Why don&#039;t I have man pages or where is the &#039;man&#039; command? ==&lt;br /&gt;
The &#039;&#039;man&#039;&#039; command and &#039;&#039;man pages&#039;&#039; are not installed by default. Many packages have documentation companion packages suffixed &#039;&#039;-doc&#039;&#039;. Keep in mind, not all packages have a corresponding documentation package and when there is one it may not include &#039;&#039;man pages&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
To install the &#039;&#039;man&#039;&#039; command, and related utilities, first add the {{pkg|man-db}} package:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;apk add man-db&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once installed, add documentation for the package where you need it. For example, say you installed {{pkg|nftables}} and you now require its man pages:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;apk add nftables-doc&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now we&#039;ve installed &#039;&#039;nft(8)&#039;&#039; and [https://pkgs.alpinelinux.org/contents?branch=edge&amp;amp;name=nftables-doc&amp;amp;arch=x86_64&amp;amp;repo=main other documentation] to our system and you can issue the command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;man nft&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
To always install the documentation companion package, when available, add the {{pkg|docs}} meta package.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;apk add docs&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== What is the difference between edge and stable releases? ==&lt;br /&gt;
Stable releases are just what they sound like: initially a point-in-time snapshot of the package archives, but then maintained with bug-fixes only in order to keep a stable environment.&lt;br /&gt;
&lt;br /&gt;
[[Edge]] is more of a rolling-release, with the latest and greatest packages available in the online repositories.&amp;lt;br&amp;gt;&lt;br /&gt;
Occasionally, snapshot ISO images of the then-current state of [[edge]] are made and are available for download.&amp;lt;br&amp;gt;&lt;br /&gt;
Typically these are made when there are major kernel upgrades or package upgrades that require initramfs rebuilds.&lt;br /&gt;
&lt;br /&gt;
== What architectures does Alpine support? ==&lt;br /&gt;
As Alpine uses the Linux kernel, it supports:&lt;br /&gt;
* &#039;&#039;&#039;aarch64&#039;&#039;&#039;: The 64-bit only ARM execution state of the ARMv8 device machines.&lt;br /&gt;
* &#039;&#039;&#039;armhf&#039;&#039;&#039;: The newer ARM hard-float for newer, more powerful 32-bit devices alongside 64-bit&lt;br /&gt;
* &#039;&#039;&#039;armv7&#039;&#039;&#039;: The 32-bit only ARM execution state of the ARMv7 devices machines.&lt;br /&gt;
* &#039;&#039;&#039;mips64&#039;&#039;&#039;:&lt;br /&gt;
* &#039;&#039;&#039;s390x&#039;&#039;&#039;: For the Super powered IBM mainframes, especially IBM Z and IBM LinuxONE servers.&lt;br /&gt;
* &#039;&#039;&#039;ppc64le&#039;&#039;&#039;: For 64-bit PowerPC devices with pure little-endian mode, mostly for POWER8 and POWER9&lt;br /&gt;
* &#039;&#039;&#039;x86&#039;&#039;&#039;: (i386, PC 32bit) and x86_64 (i686, PC 64bit and amd64)&lt;br /&gt;
* &#039;&#039;&#039;x86_64&#039;&#039;&#039;: The popular AMD64 compatible 64-bit x86 based machines, i386 is not recommended for newer/latest hardware.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Please check [https://alpinelinux.org/downloads Download] page for media availability on each one&#039;&#039;&#039; and check [[Alpine_Linux:Releases|Releases]] pages for latest.&lt;br /&gt;
&lt;br /&gt;
== What kind of release of Alpine Linux are available? ==&lt;br /&gt;
Please check the [https://alpinelinux.org/releases/ Releases] page for more information.&lt;br /&gt;
&lt;br /&gt;
=Setup=&lt;br /&gt;
&lt;br /&gt;
== What is the difference between &#039;&#039;sys&#039;&#039;, &#039;&#039;data&#039;&#039;, and &#039;&#039;diskless&#039;&#039; when running &amp;lt;code&amp;gt;setup-alpine&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;setup-disk&amp;lt;/code&amp;gt;? ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;sys:&#039;&#039;&#039; This mode is a traditional disk install. The following partitions will be created on the disk: &#039;&#039;/boot/&#039;&#039;, &#039;&#039;/&#039;&#039; (filesystem root) and &#039;&#039;swap&#039;&#039;.&lt;br /&gt;
This mode may be used for development boxes, desktops, virtual servers, etc.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;data:&#039;&#039;&#039; This mode uses your disk(s) for data storage, not for the operating system. Runs from the media and only a &#039;&#039;/var/&#039;&#039; is created on disk.  The system itself will run from a &#039;&#039;tmpfs&#039;&#039; (RAM).  Use this mode if you only want to use the disk(s) for data, like &#039;&#039;mailspool&#039;&#039;, &#039;&#039;databases&#039;&#039;, &#039;&#039;logs&#039;&#039;, etc.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;diskless:&#039;&#039;&#039; No disks are to be used.  [[Alpine local backup]] may still be used in this mode.&lt;br /&gt;
&lt;br /&gt;
These modes are explained further [[Installation#Installation_Overview|on the &#039;&#039;&#039;Installation&#039;&#039;&#039; page]].&lt;br /&gt;
&lt;br /&gt;
== How do I upgrade Alpine? ==&lt;br /&gt;
&lt;br /&gt;
To upgrade to a new stable release or edge:&lt;br /&gt;
&amp;lt;code&amp;gt;apk upgrade --available&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==My cron jobs don&#039;t run?==&lt;br /&gt;
&lt;br /&gt;
Start service &#039;&#039;crond&#039;&#039; and add it to runlevel:&lt;br /&gt;
&lt;br /&gt;
: {{cmd|rc-service crond start &amp;amp;&amp;amp; rc-update add crond}}&lt;br /&gt;
&lt;br /&gt;
After that the cron daemon is started automatically on system boot and executes the scripts placed in the folders under &#039;&#039;/etc/periodic/&#039;&#039; - there&#039;re folders for &#039;&#039;15min&#039;&#039;, &#039;&#039;hourly&#039;&#039;, &#039;&#039;daily&#039;&#039;, &#039;&#039;weekly&#039;&#039; and &#039;&#039;monthly&#039;&#039; scripts.&lt;br /&gt;
&lt;br /&gt;
To check whether your scripts are likely to run, use the &#039;&#039;run-parts&#039;&#039; command, for example:&lt;br /&gt;
&lt;br /&gt;
{{cmd|run-parts --test /etc/periodic/15min}}&lt;br /&gt;
&lt;br /&gt;
This command will tell you what should run but will not actually execute the scripts.&lt;br /&gt;
&lt;br /&gt;
If the results of the test are not as expected, check the following:&lt;br /&gt;
&lt;br /&gt;
* Make sure the script is executable - if unsure, issue the command {{cmd|chmod a+x /etc/periodic/[path/scriptname]}}&lt;br /&gt;
* Make sure the first line of your script is &amp;lt;code&amp;gt;#!/bin/sh&amp;lt;/code&amp;gt;&lt;br /&gt;
* Do not use periods on your script file names - this stops them from working; for example: &amp;lt;code&amp;gt;/etc/periodic/daily/myscript&amp;lt;/code&amp;gt; will run, but &amp;lt;code&amp;gt;/etc/periodic/daily/myscript.sh&amp;lt;/code&amp;gt; won&#039;t.&lt;br /&gt;
&lt;br /&gt;
= Time and timezones =&lt;br /&gt;
&lt;br /&gt;
== How do I set the local timezone? ==&lt;br /&gt;
&lt;br /&gt;
If you wish to edit the &#039;&#039;timezone&#039;&#039; (TZ) after installation, run the [[Alpine_setup_scripts#setup-timezone|setup-timezone]] script.&lt;br /&gt;
&lt;br /&gt;
= Packages =&lt;br /&gt;
&lt;br /&gt;
== Can you build an apk package for ...? ==&lt;br /&gt;
Yes, we probably can.&amp;lt;br&amp;gt;&lt;br /&gt;
Please create an [https://gitlab.alpinelinux.org/alpine/aports/issues/new issue] in the [https://gitlab.alpinelinux.org bugtracker]. Prefix with &amp;quot;feat&amp;quot; in title and include a short description (one-line), an URL for the home page, and an URL for the source package.&lt;br /&gt;
&lt;br /&gt;
== How can I build my own package? ==&lt;br /&gt;
Please see the [[Creating an Alpine package]] page.&lt;br /&gt;
&lt;br /&gt;
== What does &amp;quot;required by: world[$pkgname]&amp;quot; mean? ==&lt;br /&gt;
&lt;br /&gt;
It means that the package you try to install does not exist in the repositories you have configured.&lt;br /&gt;
&lt;br /&gt;
Maybe you forgot to add community, testing or unmaintained to &#039;&#039;/etc/apk/repositories&#039;&#039;? &lt;br /&gt;
&lt;br /&gt;
Or is the package in a [[Alpine_Linux_package_management#Repository_pinning|pinned repository]] and you forgot to suffix the package with the repo tag? Example:&lt;br /&gt;
&lt;br /&gt;
{{cmd|apk add experimental-package@testing}}&lt;br /&gt;
&lt;br /&gt;
== How can I find out if a certain package exists in Alpine? ==&lt;br /&gt;
&lt;br /&gt;
If you want to only search repositories you have configured in /etc/apk/repositories, then &amp;lt;code&amp;gt;apk search $pkgname&amp;lt;/code&amp;gt; should get you sorted. If you want to search all repositories have a look at the [https://pkgs.alpinelinux.org/ online pkg oracle]&lt;br /&gt;
&lt;br /&gt;
== WARNING: Ignoring APKINDEX.xxxx.tar.gz ==&lt;br /&gt;
If you get &amp;lt;code&amp;gt;WARNING: Ignoring APKINDEX.xxxx.tar.gz: No such file or directory&amp;lt;/code&amp;gt; while running [[Alpine_Linux_package_management|package related tools]], check your &#039;&#039;/etc/apk/repositories&#039;&#039; file.&lt;br /&gt;
&lt;br /&gt;
To check the content of the repositories file&lt;br /&gt;
{{Cmd|cat /etc/apk/repositories}}&lt;br /&gt;
&lt;br /&gt;
or &lt;br /&gt;
{{Cmd|setup-apkrepos}}&lt;br /&gt;
&lt;br /&gt;
= Dynamic DNS =&lt;br /&gt;
== How do I schedule a regular dynamic DNS update? ==&lt;br /&gt;
You&#039;ll want to install the {{pkg|ez-ipupdate}} package:&lt;br /&gt;
{{cmd|apk add ez-ipupdate}}&lt;br /&gt;
&lt;br /&gt;
After that, create a new file at {{path|/etc/ez-ipupdate.conf}} with contents similar to:&lt;br /&gt;
 service-type=dyndns&lt;br /&gt;
 user=myusername:mypassword&lt;br /&gt;
 interface=eth1&lt;br /&gt;
 host=myhostname.dyndns.org&lt;br /&gt;
&lt;br /&gt;
Make the new ip cache directory:&lt;br /&gt;
{{cmd|mkdir /var/cache/ez-ipupdate&lt;br /&gt;
lbu add /var/cache/ez-ipupdate}}&lt;br /&gt;
&lt;br /&gt;
Then schedule a new cron job with this command:&lt;br /&gt;
{{cmd|echo &amp;gt;&amp;gt; /var/log/ez-ipupdate &amp;amp;&amp;amp; \&amp;lt;br&amp;gt;/bin/date &amp;gt;&amp;gt; /var/log/ez-ipupdate &amp;amp;&amp;amp; \&amp;lt;br&amp;gt;ez-ipupdate --config-file /etc/ez-ipupdate.conf -f -F /var/run/ez-ipupdate.pid \&amp;lt;br&amp;gt;  --cache-file /var/cache/ez-ipupdate/ipcache --quiet &amp;gt;&amp;gt; /var/log/ez-ipupdate 2&amp;gt;&amp;amp;1}}&lt;br /&gt;
&lt;br /&gt;
Don&#039;t forget to backup your settings!&lt;br /&gt;
{{cmd|lbu ci}}&lt;br /&gt;
&lt;br /&gt;
= Terminal =&lt;br /&gt;
&lt;br /&gt;
== How to enable/fix colors for git? ==&lt;br /&gt;
&lt;br /&gt;
The problem is not in git itself or terminal, but in the &amp;lt;tt&amp;gt;less&amp;lt;/tt&amp;gt; command.&lt;br /&gt;
Busybox’s &amp;lt;tt&amp;gt;less&amp;lt;/tt&amp;gt; doesn’t support &amp;lt;tt&amp;gt;-r&amp;lt;/tt&amp;gt; (&amp;lt;tt&amp;gt;--raw-control-chars&amp;lt;/tt&amp;gt;) and &amp;lt;tt&amp;gt;-R&amp;lt;/tt&amp;gt; (&amp;lt;tt&amp;gt;--RAW-CONTROL-CHARS&amp;lt;/tt&amp;gt;) options.&lt;br /&gt;
&lt;br /&gt;
The simplest (yet not ideal) solution is to install GNU less:&lt;br /&gt;
&lt;br /&gt;
{{cmd|apk add less}}&lt;br /&gt;
&lt;br /&gt;
= Old questions, no longer freqently asked =&lt;br /&gt;
&lt;br /&gt;
== Alpine freezes during boot from Compact Flash, how can I fix? ==&lt;br /&gt;
Most Compact Flash card readers do not support proper DMA.&amp;lt;br&amp;gt;&lt;br /&gt;
You should append &#039;&#039;&#039;nodma&#039;&#039;&#039; to the &#039;&#039;append&#039;&#039; line in {{path|syslinux.cfg}}.&lt;br /&gt;
&lt;br /&gt;
== How do I remove the CDROM? ==&lt;br /&gt;
Since the modloop loopback device is on CDROM you cannot just run &amp;lt;code&amp;gt;eject&amp;lt;/code&amp;gt;. You need to unmount the modloop first.&amp;lt;br&amp;gt;&lt;br /&gt;
Unmounting both the modloop and the CDROM in one step can be done by executing:&lt;br /&gt;
{{Cmd|/etc/init.d/modloop stop}}&lt;br /&gt;
&lt;br /&gt;
Then it&#039;s possible to eject the CDROM:&lt;br /&gt;
{{Cmd|eject}}&lt;br /&gt;
&lt;br /&gt;
== How can I install a custom firmware in a diskless system? ==&lt;br /&gt;
&lt;br /&gt;
The modules and firmware are both special images which are mounted as read-only.&amp;lt;br&amp;gt;&lt;br /&gt;
To fix this issue you can copy the firmware directory to your writeable media (cf/usb) and copy your custom firmware to it.&amp;lt;br&amp;gt;&lt;br /&gt;
After reboot Alpine should automatically use the directory on your local storage instead of the loopback device.&lt;br /&gt;
&lt;br /&gt;
== How do I play my .ogg/.mp3 files? ==&lt;br /&gt;
First, the sound card should be recognized (you must have {{path|/dev/snd/*****}} files)&lt;br /&gt;
&lt;br /&gt;
{{pkg|sox}}, {{pkg|mpg123}}, etc all use the oss sound driver, while Alpine uses ALSA drivers.&amp;lt;br&amp;gt;&lt;br /&gt;
So you need to load the snd-pcm-oss compatibility module.&amp;lt;br&amp;gt;&lt;br /&gt;
While you&#039;re at it, you might need {{pkg|aumix}} to turn up the sound volume&lt;br /&gt;
{{cmd|echo snd-pcm-oss &amp;gt;&amp;gt; /etc/modules&lt;br /&gt;
modprobe snd-pcm-oss &lt;br /&gt;
apk_add aumix sox&lt;br /&gt;
aumix (set volume settings)&lt;br /&gt;
play really_cool_song.mp3}}&lt;br /&gt;
&lt;br /&gt;
== OpenNTPD reports an error with &amp;quot;adjtime&amp;quot; ==&lt;br /&gt;
Your log contains something like:&lt;br /&gt;
 reply from 85.214.86.126: offset 865033148.784255 delay 0.055466, next query 32s&lt;br /&gt;
 reply from 202.150.212.24: offset 865033148.779314 delay 0.400771, next query 3s&lt;br /&gt;
 adjusting local clock by 865033148.779835s                                      &lt;br /&gt;
 adjtime failed: Invalid argument    &lt;br /&gt;
&lt;br /&gt;
{{pkg|openntpd}} is supposed to make small adjustments in the time without causing time jumps.&amp;lt;br&amp;gt;&lt;br /&gt;
If the adjustment is too big then something is clearly wrong and ntpd gives up. (its actually adjtime(3) that has a limit on how big adjustments are allowed)&lt;br /&gt;
&lt;br /&gt;
You can make ntpd set the time at startup by adding &#039;&#039;-s&#039;&#039; option to ntpd. This is done by setting &#039;&#039;&#039;NTPD_OPTS=&amp;quot;-s&amp;quot;&#039;&#039;&#039; in {{path|/etc/conf.d/ntpd}}.&lt;br /&gt;
&lt;br /&gt;
== Using a cron job to keep the time in sync ==&lt;br /&gt;
Add the following to {{path|/etc/periodic/daily}} (or use another folder under the {{path|/etc/periodic}} heirarchy if you want to run the script more/less frequently)&lt;br /&gt;
&lt;br /&gt;
Example: file called {{path|do-ntp}}&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
ntpd -d -q -n -p uk.pool.ntp.org&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This queries the uk time server pool - you can modify this to suit your localisation, or just use &#039;&#039;pool.ntp.org&#039;&#039;. More info here: [http://www.pool.ntp.org/zone/@ http://www.pool.ntp.org/zone/@]&lt;br /&gt;
&lt;br /&gt;
== Windows clients reports an error when trying to sync ==&lt;br /&gt;
{{pkg|openntpd}} needs to run for a while before it is satisfied it is in sync.&lt;br /&gt;
Until then it will set a flag &amp;quot;clock not synchronized&amp;quot; and Windows will report an error while trying to sync with your {{pkg|openntpd}} server.&lt;br /&gt;
&lt;br /&gt;
Only thing to do is wait, do something else for 15-20mins and then check.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Newbie]]&lt;/div&gt;</summary>
		<author><name>Mtbu</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Alpine_Package_Keeper&amp;diff=19916</id>
		<title>Alpine Package Keeper</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Alpine_Package_Keeper&amp;diff=19916"/>
		<updated>2021-07-24T15:24:58Z</updated>

		<summary type="html">&lt;p&gt;Mtbu: /* Upgrading &amp;quot;diskless&amp;quot; and &amp;quot;data&amp;quot; disk mode installs */   Fix typo&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;!--For searching: apk, APK--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{TOC right}}&lt;br /&gt;
&lt;br /&gt;
Because Alpine Linux is designed to run from RAM, package management involves two phases:&lt;br /&gt;
* Installing / Upgrading / Deleting packages on a running system.&lt;br /&gt;
* Restoring a system to a previously configured state (e.g. after reboot), including all previously installed packages and locally modified configuration files. &#039;&#039;&#039;(RAM-Based Installs Only)&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;apk&#039;&#039;&#039; is the tool used to install, upgrade, or delete software on a running system.&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;lbu&#039;&#039;&#039; is the tool used to capture the data necessary to restore a system to a previously configured state.&lt;br /&gt;
&lt;br /&gt;
This page documents the [https://git.alpinelinux.org/apk-tools/ apk tool] - See the [[Alpine_local_backup|Alpine Local Backup page]] for the lbu tool.&lt;br /&gt;
&lt;br /&gt;
= Overview =&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;apk&#039;&#039;&#039; tool supports the following operations:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| [[#Add a Package|add]] &lt;br /&gt;
| Add new packages or upgrade packages to the running system&lt;br /&gt;
|-&lt;br /&gt;
| [[#Remove a Package|del]]&lt;br /&gt;
| Delete packages from the running system&lt;br /&gt;
|-&lt;br /&gt;
| fix &lt;br /&gt;
| Attempt to repair or upgrade an installed package &lt;br /&gt;
|-&lt;br /&gt;
| [[#Update the Package list|update]] &lt;br /&gt;
| Update the index of available packages&lt;br /&gt;
|-&lt;br /&gt;
| [[#Information on Packages|info]]&lt;br /&gt;
| Prints information about installed or available packages&lt;br /&gt;
|-&lt;br /&gt;
| [[#Search for Packages|search]] &lt;br /&gt;
| Search for packages or descriptions with wildcard patterns&lt;br /&gt;
|-&lt;br /&gt;
| [[#Upgrade a Running System|upgrade]]&lt;br /&gt;
| Upgrade the currently installed packages&lt;br /&gt;
|-&lt;br /&gt;
| [[#Cache maintenance|cache]]&lt;br /&gt;
| Maintenance operations for locally cached package repository&lt;br /&gt;
|-&lt;br /&gt;
| version &lt;br /&gt;
| Compare version differences between installed and available packages&lt;br /&gt;
|-&lt;br /&gt;
| index &lt;br /&gt;
| create a repository index from a list of packages&lt;br /&gt;
|-&lt;br /&gt;
| fetch &lt;br /&gt;
| download (but not install) packages&lt;br /&gt;
|-&lt;br /&gt;
| audit &lt;br /&gt;
| List changes to the file system from pristine package install state&lt;br /&gt;
|-&lt;br /&gt;
| verify &lt;br /&gt;
| Verify a package signature&lt;br /&gt;
|- &lt;br /&gt;
| dot&lt;br /&gt;
| Create a [http://graphviz.org/ graphviz] graph description for a given package&lt;br /&gt;
|- &lt;br /&gt;
| [[#apk_policy|policy]]&lt;br /&gt;
| Display the repository that updates a given package, plus repositories that also offer the package&lt;br /&gt;
|- &lt;br /&gt;
| stats &lt;br /&gt;
| Display statistics, including number of packages installed and available, number of directories and files, etc.&lt;br /&gt;
|- &lt;br /&gt;
| manifest&lt;br /&gt;
| Display checksums for files contained in a given package&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= Packages and Repositories =&lt;br /&gt;
&lt;br /&gt;
Software packages for Alpine Linux are digitally signed tar.gz archives containing programs, configuration files, and dependency metadata. They have the extension &amp;lt;code&amp;gt;.apk&amp;lt;/code&amp;gt;, and are often called &amp;quot;a-packs&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The packages are stored in one or more &#039;&#039;repositories&#039;&#039;. A repository is simply a directory with a collection of *.apk files.  The directory must include a special index file, named {{Path|APKINDEX.tar.gz}} to be considered a repository.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;apk&#039;&#039;&#039; utility can install packages from multiple repositories.  The list of repositories to check is stored in {{Path|/etc/apk/repositories}}, one repository per line. If you booted from a USB stick ({{Path|/media/sda1}}) or CD-ROM ({{Path|/media/cdrom}}), your repository file probably looks something like this:&lt;br /&gt;
&lt;br /&gt;
{{Cat|/etc/apk/repositories|/media/sda1/apks/}}&lt;br /&gt;
&lt;br /&gt;
In addition to local repositories, the &#039;&#039;&#039;apk&#039;&#039;&#039; utility uses &#039;&#039;&#039;busybox wget&#039;&#039;&#039; to fetch packages using &#039;&#039;http:&#039;&#039;, &#039;&#039;https:&#039;&#039; or &#039;&#039;ftp:&#039;&#039; protocols. The following is a valid repository file:&lt;br /&gt;
&lt;br /&gt;
{{Cat|/etc/apk/repositories|&lt;br /&gt;
/media/sda1/apks&lt;br /&gt;
http://dl-3.alpinelinux.org/alpine/v2.6/main&lt;br /&gt;
https://dl-3.alpinelinux.org/alpine/v2.6/main&lt;br /&gt;
ftp://dl-3.alpinelinux.org/alpine/v2.6/main&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{Note|  A list of public repositories is in [https://mirrors.alpinelinux.org/ mirrors.alpinelinux.org].  Accepted protocols vary.}}&lt;br /&gt;
&lt;br /&gt;
== Repository pinning ==&lt;br /&gt;
&lt;br /&gt;
You can specify additional &amp;quot;tagged&amp;quot; repositories in {{Path|/etc/apk/repositories}}:&lt;br /&gt;
&lt;br /&gt;
{{Cat|/etc/apk/repositories|&lt;br /&gt;
http://nl.alpinelinux.org/alpine/v3.7/main&lt;br /&gt;
http://nl.alpinelinux.org/alpine/v3.7/community&lt;br /&gt;
@edge http://nl.alpinelinux.org/alpine/edge/main&lt;br /&gt;
@edgecommunity http://nl.alpinelinux.org/alpine/edge/community&lt;br /&gt;
@testing http://nl.alpinelinux.org/alpine/edge/testing&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
After which you can &amp;quot;pin&amp;quot; dependencies to these tags using:&lt;br /&gt;
&lt;br /&gt;
{{cmd|apk add stableapp newapp@edge bleedingapp@testing}}&lt;br /&gt;
&lt;br /&gt;
Apk will now by default only use the untagged repositories, but adding a tag to specific package:&lt;br /&gt;
&lt;br /&gt;
1. will prefer the repository with that tag for the named package, even if a later version of the package is available in another repository&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;allows&#039;&#039; pulling in dependencies for the tagged package from the tagged repository (though it &#039;&#039;prefers&#039;&#039; to use untagged repositories to satisfy dependencies if possible)&lt;br /&gt;
&lt;br /&gt;
== Commandline repository options ==&lt;br /&gt;
&lt;br /&gt;
By default, the &#039;&#039;&#039;apk&#039;&#039;&#039; utility will use the system repositories for all operations. This behavior can be overridden by the following options:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| --repositories-file REPOFILE&lt;br /&gt;
| Override the system repositories by specifying a repositories file.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;nowiki&amp;gt;-X|--repository REPO&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
| Specify a supplemental repository that will be used in addition to the system repositories. This option can be provided multiple times.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= Update the Package list =&lt;br /&gt;
&lt;br /&gt;
Remote repositories change as packages are added and upgraded.   To get the latest list of available packages, use the &#039;&#039;update&#039;&#039; command.  The command downloads the {{Path|APKINDEX.tar.gz}} from each repository and stores it in the local cache, typically {{Path|/var/cache/apk/}}, {{Path|/var/lib/apk/}} or {{Path|/etc/apk/cache/}}.&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk update}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
fetch http://dl-3.alpinelinux.org/alpine/v2.1/main/APKINDEX.tar.gz&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Adding the &amp;lt;code&amp;gt;--update-cache&amp;lt;/code&amp;gt;, or for short &amp;lt;code&amp;gt;-U&amp;lt;/code&amp;gt; switch to another apk command, as in &amp;lt;code&amp;gt;apk --update-cache upgrade&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;apk -U add ...&amp;lt;/code&amp;gt;, the command has the same effect as first running &amp;lt;code&amp;gt;apk update&amp;lt;/code&amp;gt; before the other apk command.&lt;br /&gt;
&lt;br /&gt;
{{Tip|With remote repositories, it is a good idea to always do an &#039;&#039;&#039;update&#039;&#039;&#039; right &#039;&#039;&#039;before&#039;&#039;&#039; doing an &#039;&#039;&#039;upgrade or add&#039;&#039;&#039; command. That way the command will install the latest available packages.}}&lt;br /&gt;
&lt;br /&gt;
= Add a Package =&lt;br /&gt;
&lt;br /&gt;
Use &#039;&#039;&#039;add&#039;&#039;&#039; to install packages from a repository. Any necessary dependencies are also installed. If you have multiple repositories, the &#039;&#039;&#039;add&#039;&#039;&#039; command installs the newest package.&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk add openssh&lt;br /&gt;
apk add openssh openntp vim}}&lt;br /&gt;
&lt;br /&gt;
If you only have the main repository enabled in your configuration, apk will not include packages from the other repositories. To install a package from the edge/testing repository without changing your repository configuration file, use the command below. This will tell apk to use that particular repository.&lt;br /&gt;
&lt;br /&gt;
{{cmd|apk add cherokee --update-cache --repository http://dl-3.alpinelinux.org/alpine/edge/testing/ --allow-untrusted}}&lt;br /&gt;
&lt;br /&gt;
{{Note|Be careful when using third-party or the testing repository. Your system can go down.}}&lt;br /&gt;
&lt;br /&gt;
= Add a local Package =&lt;br /&gt;
&lt;br /&gt;
To install a locally available apk package, for example if this device has no internet access but you can upload apk packages directly to it, use the &#039;&#039;&#039;--allow-untrusted&#039;&#039;&#039; flag:&lt;br /&gt;
&lt;br /&gt;
{{cmd|apk add --allow-untrusted /path/to/file.apk}}&lt;br /&gt;
&lt;br /&gt;
Note that multiple packages can be given.  When installing a local package, all dependencies should also be specified.  For example:&lt;br /&gt;
&lt;br /&gt;
{{cmd|apk add --allow-untrusted /var/tig-2.2-r0.apk /var/git-2.11.1-20.apk}}&lt;br /&gt;
&lt;br /&gt;
= Remove a Package  =&lt;br /&gt;
Use &#039;&#039;&#039;del&#039;&#039;&#039; to remove a package (and dependencies that are no longer needed.)  &lt;br /&gt;
&lt;br /&gt;
{{cmd|apk del openssh&lt;br /&gt;
apk del openssh openntp vim}}&lt;br /&gt;
&lt;br /&gt;
= Upgrade a Running System =&lt;br /&gt;
&lt;br /&gt;
=== Packages in general ===&lt;br /&gt;
&lt;br /&gt;
To get the latest security upgrades and bugfixes available for the &#039;&#039;installed&#039;&#039; packages of a running system, first &#039;&#039;&#039;update&#039;&#039;&#039; the list of available packages and then &#039;&#039;&#039;upgrade&#039;&#039;&#039; the installed packages:&lt;br /&gt;
&lt;br /&gt;
{{cmd|apk update&lt;br /&gt;
apk upgrade&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Or, combining the same into one single command:&lt;br /&gt;
&lt;br /&gt;
{{cmd|apk -U upgrade&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is an example, showing the procedure on a system that has several additional [https://wiki.alpinelinux.org/wiki/Alpine_Linux_package_management#Repository_pinning repositories pinned]:&lt;br /&gt;
&lt;br /&gt;
 # apk update&lt;br /&gt;
 fetch http://dl-3.alpinelinux.org/alpine/v3.6/main/x86_64/APKINDEX.tar.gz&lt;br /&gt;
 fetch http://dl-3.alpinelinux.org/alpine/v3.6/community/x86_64/APKINDEX.tar.gz&lt;br /&gt;
 fetch http://dl-3.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz&lt;br /&gt;
 fetch http://dl-3.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz&lt;br /&gt;
 fetch http://dl-3.alpinelinux.org/alpine/edge/testing/x86_64/APKINDEX.tar.gz&lt;br /&gt;
 v3.6.2-191-gf98d79930f [http://dl-3.alpinelinux.org/alpine/v3.6/main]&lt;br /&gt;
 v3.6.2-190-ga5d68c47df [http://dl-3.alpinelinux.org/alpine/v3.6/community]&lt;br /&gt;
 v3.6.0-4618-g0bf77c9821 [http://dl-3.alpinelinux.org/alpine/edge/main]&lt;br /&gt;
 v3.6.0-4605-g85ed51dd83 [http://dl-3.alpinelinux.org/alpine/edge/community]&lt;br /&gt;
 v3.6.0-4624-g11f1b9c8ab [http://dl-3.alpinelinux.org/alpine/edge/testing]&lt;br /&gt;
 OK: 20118 distinct packages available&lt;br /&gt;
 &lt;br /&gt;
 # apk upgrade&lt;br /&gt;
 (1/2) Upgrading extra-cmake-modules@testing (5.38.0-r0 -&amp;gt; 5.39.0-r0)&lt;br /&gt;
 (2/2) Upgrading extra-cmake-modules-doc@testing (5.38.0-r0 -&amp;gt; 5.39.0-r0)&lt;br /&gt;
 Executing mdocml-apropos-1.14.1-r0.trigger&lt;br /&gt;
 OK: 2635 MiB in 803 packages&lt;br /&gt;
&lt;br /&gt;
To upgrade only &#039;&#039;specific&#039;&#039; packages, use the &#039;&#039;-u&#039;&#039; or &#039;&#039;--upgrade&#039;&#039; option of the &#039;&#039;&#039;add&#039;&#039;&#039; command:&lt;br /&gt;
&lt;br /&gt;
{{cmd|apk update&lt;br /&gt;
apk add --upgrade busybox &lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To enable unattended, automatic upgrades of packages, see the {{pkg|apk-autoupdate}} package.&lt;br /&gt;
&lt;br /&gt;
To upgrade to a newer release, refer to the corresponding release notes and [[Upgrading_Alpine]].&lt;br /&gt;
&lt;br /&gt;
=== Upgrading &amp;quot;diskless&amp;quot; and &amp;quot;data&amp;quot; disk mode installs ===&lt;br /&gt;
&lt;br /&gt;
If booting a &amp;quot;diskless&amp;quot; system from a read-only device, or iso image on writable media, it&#039;s not possible to update the boot files (kernel, modules, firmware, ...) that reside on that device.&lt;br /&gt;
&lt;br /&gt;
It becomes possible to update the boot files, though, if using a boot device that is writable and has been prepared with &amp;lt;code&amp;gt;[[Alpine_setup_scripts#setup-bootable|setup-bootable]]&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
However, even then, the kernel, with its modules and firmware files, can still not be updated directly through regular packages updates. Instead, there is the &amp;lt;code&amp;gt;update-kernel&amp;lt;/code&amp;gt; script that can generate initfs images and install them together with upgraded kernels.&lt;br /&gt;
&lt;br /&gt;
Upgrading can be done as follows.&lt;br /&gt;
{{cmd|apk add mkinitfs&lt;br /&gt;
}}&lt;br /&gt;
This package is required for the generation of the initial filesystem used during boot.&lt;br /&gt;
* Additional initfs features that are missing in the default configuration, like the &amp;quot;btrfs&amp;quot; filesystem support (at the time of writing, to allow loading .apkovl configs and package cache during boot), may be enabled in &amp;lt;code&amp;gt;/etc/mkinitfs/mkinitfs.conf&amp;lt;/code&amp;gt;.&lt;br /&gt;
* Available initfs features may be listed with &amp;lt;code&amp;gt;ls /etc/mkinitfs/features.d&amp;lt;/code&amp;gt;&lt;br /&gt;
{{cmd|ls /etc/mkinitfs/features.d&lt;br /&gt;
apk add nano&lt;br /&gt;
nano /etc/mkinitfs/mkinitfs.conf&lt;br /&gt;
lbu commit&lt;br /&gt;
}}&lt;br /&gt;
Finally update the kernel and its boot environment.&lt;br /&gt;
{{cmd|update-kernel /media/sdXY/boot/&lt;br /&gt;
}}&lt;br /&gt;
* An &amp;lt;code&amp;gt;update-kernel&amp;lt;/code&amp;gt; run needs at least 8 GB free ram memory to avoid a broken modloop-image.&lt;br /&gt;
* See &amp;lt;code&amp;gt;update-kernel --help&amp;lt;/code&amp;gt; for options to manually add additional module or firmware packages.&lt;br /&gt;
&lt;br /&gt;
= Search for Packages =&lt;br /&gt;
The &#039;&#039;&#039;search&#039;&#039;&#039; command searches the repository Index files for installable packages. &lt;br /&gt;
&lt;br /&gt;
The return format is &#039;&#039;&#039;Package&#039;&#039;&#039;-&#039;&#039;&#039;Version&#039;&#039;&#039;. Omit &#039;&#039;&#039;Version&#039;&#039;&#039; for &#039;&#039;apk add &#039;&#039;&#039;Package&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Examples:&lt;br /&gt;
* To list all packages available, along with their descriptions: {{cmd|apk search -v}}&lt;br /&gt;
* To list all packages are part of the ACF system: {{cmd|apk search -v &#039;acf*&#039; }}&lt;br /&gt;
* To list all packages that list NTP as part of their description, use the &#039;&#039;-d&#039;&#039; or &#039;&#039;--description&#039;&#039; option: {{cmd|apk search -v --description &#039;NTP&#039; }}&lt;br /&gt;
&lt;br /&gt;
= Information on Packages =&lt;br /&gt;
&lt;br /&gt;
== apk info ==&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;info&#039;&#039;&#039; command provides information on the contents of packages, their dependencies, and which files belong to a package.&lt;br /&gt;
&lt;br /&gt;
For a given package, each element can be chosen (for example, &#039;&#039;-w&#039;&#039; to show just the webpage information), or all information displayed with the &#039;&#039;-a&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
Example: {{cmd|apk info -a zlib}}&lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;zlib-1.2.5-r1 description:&#039;&#039;&#039;&lt;br /&gt;
 A compression/decompression Library&lt;br /&gt;
 &lt;br /&gt;
 &#039;&#039;&#039;zlib-1.2.5-r1 webpage:&#039;&#039;&#039;&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;http://zlib.net&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &#039;&#039;&#039;zlib-1.2.5-r1 installed size:&#039;&#039;&#039;&lt;br /&gt;
 94208&lt;br /&gt;
 &lt;br /&gt;
 &#039;&#039;&#039;zlib-1.2.5-r1 depends on:&#039;&#039;&#039;&lt;br /&gt;
 libc0.9.32&lt;br /&gt;
 &lt;br /&gt;
 &#039;&#039;&#039;zlib-1.2.5-r1 is required by:&#039;&#039;&#039;&lt;br /&gt;
 libcrypto1.0-1.0.0-r0&lt;br /&gt;
 apk-tools-2.0.2-r4&lt;br /&gt;
 openssh-client-5.4_p1-r2&lt;br /&gt;
 openssh-5.4_p1-r2&lt;br /&gt;
 libssl1.0-1.0.0-r0&lt;br /&gt;
 freeswitch-1.0.6-r6&lt;br /&gt;
 atop-1.25-r0 &lt;br /&gt;
 &lt;br /&gt;
 &#039;&#039;&#039;zlib-1.2.5-r1 contains:&#039;&#039;&#039;&lt;br /&gt;
 lib/libz.so.1.2.5&lt;br /&gt;
 lib/libz.so.1&lt;br /&gt;
 lib/libz.so &lt;br /&gt;
 &lt;br /&gt;
 &#039;&#039;&#039;zlib-1.2.5-r1 triggers:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
As shown in the example you can determine&lt;br /&gt;
* The &#039;&#039;&#039;description&#039;&#039;&#039; of the package (&#039;&#039;-d&#039;&#039; or &#039;&#039;--description&#039;&#039;)&lt;br /&gt;
* The &#039;&#039;&#039;webpage&#039;&#039;&#039; where the application is hosted (&#039;&#039;-w&#039;&#039; or &#039;&#039;--webpage&#039;&#039;)&lt;br /&gt;
* The &#039;&#039;&#039;size&#039;&#039;&#039; the package will require once installed (in bytes) (&#039;&#039;-s&#039;&#039; or &#039;&#039;--size&#039;&#039;)&lt;br /&gt;
* What packages are required to use this one  (&#039;&#039;&#039;depends&#039;&#039;&#039;) (&#039;&#039;-R&#039;&#039; or &#039;&#039;--depends&#039;&#039;)&lt;br /&gt;
* What packages require this one to be installed (&#039;&#039;&#039;required by&#039;&#039;&#039;) (&#039;&#039;-r&#039;&#039; or &#039;&#039;--rdepends&#039;&#039;)&lt;br /&gt;
* The &#039;&#039;&#039;contents&#039;&#039;&#039; of the package, that is, which files it installs (&#039;&#039;-L&#039;&#039; or &#039;&#039;--contents&#039;&#039;)&lt;br /&gt;
* Any &#039;&#039;&#039;triggers&#039;&#039;&#039; this package sets. (&#039;&#039;-t&#039;&#039; or &#039;&#039;--triggers&#039;&#039;) Listed here are directories that are watched; if a change happens to the directory, then the trigger script is run at the end of the apk add/delete. For example, doing a depmod once after installing all packages that add kernel modules.&lt;br /&gt;
&lt;br /&gt;
{{Tip|The &#039;&#039;&#039;info&#039;&#039;&#039; command is also useful to determine which package a file belongs to.  For example: {{cmd|apk info --who-owns /sbin/lbu}} will display&lt;br /&gt;
&lt;br /&gt;
 /sbin/lbu is owned by alpine-conf-x.x-rx&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=== Listing installed packages ===&lt;br /&gt;
&lt;br /&gt;
To list all installed packages, use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;apk info&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To list all installed packages in alphabetical order, with a description of each, do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;apk -vv info|sort&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== apk policy ==&lt;br /&gt;
&lt;br /&gt;
To display the repository a package was installed from and will be updated from, plus any [https://wiki.alpinelinux.org/wiki/Alpine_Linux_package_management#Repository_pinning tagged] or enabled repositories where it is also offered, if any, for this architecture - its &#039;&#039;&#039;policy&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
 apk policy &#039;&#039;package&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 $ apk policy vlc&lt;br /&gt;
 vlc policy:&lt;br /&gt;
  2.2.6-r1:&lt;br /&gt;
    lib/apk/db/installed&lt;br /&gt;
    http://dl-3.alpinelinux.org/alpine/v3.7/community&lt;br /&gt;
  3.0.0_rc2-r1:&lt;br /&gt;
    @edgecommunity http://dl-3.alpinelinux.org/alpine/edge/community&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Additional apk Commands =&lt;br /&gt;
In progress...&lt;br /&gt;
&lt;br /&gt;
= Local Cache =&lt;br /&gt;
&lt;br /&gt;
{{:Local_APK_cache}}&lt;br /&gt;
&lt;br /&gt;
= Advanced APK Usage =&lt;br /&gt;
&lt;br /&gt;
== Holding a specific package back ==&lt;br /&gt;
&lt;br /&gt;
In certain cases, you may want to upgrade a system, but keep a specific package at a back level. It is possible to add &amp;quot;sticky&amp;quot; or versioned dependencies. For instance, to hold the &#039;&#039;asterisk&#039;&#039; package to the 1.6.2 level or lower:&lt;br /&gt;
{{cmd|1=apk add asterisk=1.6.0.21-r0}}&lt;br /&gt;
or&lt;br /&gt;
{{cmd|apk add &#039;asterisk&amp;lt;1.6.1&#039;}}&lt;br /&gt;
&lt;br /&gt;
after which a {{cmd|apk upgrade}}&lt;br /&gt;
&lt;br /&gt;
will upgrade the entire system, keeping the asterisk package at the 1.6.0 or lower level&lt;br /&gt;
&lt;br /&gt;
To later upgrade to the current version,&lt;br /&gt;
&lt;br /&gt;
{{cmd|apk add &#039;asterisk&amp;gt;1.6.1&#039;}}&lt;br /&gt;
&lt;br /&gt;
will ensure that 1.6.1 is the minimum version used.&lt;br /&gt;
&lt;br /&gt;
You can also use &amp;quot;fuzzy&amp;quot; version matching to pin the version to a major/minor release.  For example:&lt;br /&gt;
&lt;br /&gt;
{{cmd|1=apk add &#039;asterisk=~1.6&#039;}}&lt;br /&gt;
&lt;br /&gt;
will match any version of asterisk that starts with 1.6 (such as 1.6.0.21-r0 or 1.6.9.31-r9)  &amp;lt;ref&amp;gt;[https://git.alpinelinux.org/apk-tools/commit/?id=693b4bcdb0f22904a521a7c8ac4f13e697dc4d71 Alpine source commit message]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you desire deterministic, repeatable package installation (such as with containerized environments) via package pinning, it is important to understand your package repo&#039;s version retention rules.  For example, most Alpine package repos contain an &amp;quot;edge&amp;quot; branch, which may drop package versions that are not deemed fit to make it into a stable branch.  This means that pinning to a version on the edge branch may stop working after the package version is revoked from the repo.  Always pin to a package version that is intended for your current Alpine Linux version.&lt;br /&gt;
&lt;br /&gt;
= Troubleshooting =&lt;br /&gt;
&lt;br /&gt;
== &amp;quot;apk-tools is old&amp;quot; == &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;apk update&#039;&#039;&#039;, &#039;&#039;&#039;apk upgrade&#039;&#039;&#039; or &#039;&#039;&#039;apk add&#039;&#039;&#039; may report the following: &lt;br /&gt;
 WARNING: This apk-tools is OLD! Some packages might not function properly&lt;br /&gt;
&lt;br /&gt;
This may happen if you are running Alpine Linux stable version with a certain edge/main, edge/community or testing package(s) also installed.  One resolution is to consider upgrading {{pkg|apk-tools}}.  If edge is already [https://wiki.alpinelinux.org/wiki/Alpine_Linux_package_management#Repository_pinning tagged] in your repositories, then try:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;sudo apk add --upgrade apk-tools@edge&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= =&lt;br /&gt;
* [https://www.cyberciti.biz/faq/10-alpine-linux-apk-command-examples/ 10 Alpine Linux apk Command Examples]  Vivek Gite 2019&lt;br /&gt;
&lt;br /&gt;
[[Category:Package Manager]]&lt;/div&gt;</summary>
		<author><name>Mtbu</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=19893</id>
		<title>Raspberry Pi</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=19893"/>
		<updated>2021-07-23T08:07:36Z</updated>

		<summary type="html">&lt;p&gt;Mtbu: /* See Also */ Link to Raspberry Pi Headless Installation page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{warning | 11 Feb 2021 - There is currently a known bug upstream &amp;lt;br /&amp;gt;[https://github.com/raspberrypi/firmware/issues/1529 kernel/initramfs cannot be loaded from subdirectory with same name as volume label] }}&lt;br /&gt;
&lt;br /&gt;
{{TOC right}}&lt;br /&gt;
&lt;br /&gt;
This tutorial will help you install Alpine Linux on your Raspberry Pi.&lt;br /&gt;
&lt;br /&gt;
== Preparation ==&lt;br /&gt;
&lt;br /&gt;
# [http://alpinelinux.org/downloads/ Download] the Alpine for Raspberry Pi tarball. You should be safe using the &#039;&#039;&#039;armhf&#039;&#039;&#039; build on all versions of Raspberry Pi (including Pi Zero and Compute Modules); but it may perform less optimally on recent versions of Raspberry Pi. The &#039;&#039;&#039;armv7&#039;&#039;&#039; build is compatible with Raspberry Pi 2 Model B. The &#039;&#039;&#039;aarch64&#039;&#039;&#039; build should be compatible with Raspberry Pi 2 Model v1.2, Raspberry Pi 3 and Compute Module 3, and Raspberry Pi 4 model B.&lt;br /&gt;
# [[Create a Bootable USB#Format USB stick|Create a bootable FAT32 partition on your SD card.]] The partition type should be &amp;lt;code&amp;gt;W95 FAT32 (LBA)&amp;lt;/code&amp;gt;. (The current type can be found in the &amp;quot;Type&amp;quot; column in the output of &amp;lt;code&amp;gt;fdisk -l&amp;lt;/code&amp;gt;.) You can use a partitioning tool such as [https://en.wikipedia.org/wiki/GNOME_Disks gnome-disks] or [http://linux.die.net/man/8/fdisk fdisk].&lt;br /&gt;
# Create a filesystem on the partition with &amp;lt;code&amp;gt;mkdosfs -F 32 /dev/sdX1&amp;lt;/code&amp;gt; (Replace sdX1 with the correct reference to the partition you just created.)&lt;br /&gt;
# Mount the partition and extract the tarball contents onto it.&lt;br /&gt;
&lt;br /&gt;
Optionally create a &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; file on the partition to configure low-level system settings. Specifications can be found [https://www.raspberrypi.org/documentation/configuration/config-txt here]. However, note some settings can only be set directly in &#039;&#039;&#039;config.txt&#039;&#039;&#039;, which may be overwritten after updates. In particular, &amp;lt;code&amp;gt;gpu_mem&amp;lt;/code&amp;gt; will have no effect when specified in &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; ([https://github.com/raspberrypi/firmware/issues/1332 source]). Some interesting values include:&lt;br /&gt;
* To enable audio: &amp;lt;code&amp;gt;dtparam=audio=on&amp;lt;/code&amp;gt;&lt;br /&gt;
* If you see black edges around your screen after booting the Pi, you can add &amp;lt;code&amp;gt;disable_overscan=1&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Recent versions include Broadcom firmware files. If you&#039;re using an older Alpine version, see [[#Wireless_support_with_older_Alpine_images|section below]].&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
Alpine Linux will be installed in [[Installation#Installation_Handbook|diskless mode]], hence you need to use [[Alpine local backup|Alpine Local Backup (lbu)]] to save your modifications between reboots.&lt;br /&gt;
&lt;br /&gt;
For users who will be using their Raspberry Pi in scenarios where there is not expected to be significant changes to disk after setup (like running a static HTTP server), this is likely preferable, as running the entire system from memory will improve performance (by avoiding the slow SD card) and improve the SD card life (by reducing the writes to the card, as all logging will happen in RAM). Diskless installations still allow you to install packages, save local files, and tune the system to your needs. &lt;br /&gt;
&lt;br /&gt;
However, if you:&lt;br /&gt;
* Expect there will be constant changes to the disk after initial setup (for example, if you expect people to login and save files to their home directories)&lt;br /&gt;
* Need logs to persist after reboot&lt;br /&gt;
* Plan to install packages which consume more space than can be loaded into RAM&lt;br /&gt;
* Want to install kernel modules (such as ZFS or Wireguard)&lt;br /&gt;
&lt;br /&gt;
Then you may be better served by a [[Classic install or sys mode on Raspberry Pi|sys-mode installation]]. &lt;br /&gt;
&lt;br /&gt;
Follow these steps to install Alpine Linux in Diskless Mode:&lt;br /&gt;
&lt;br /&gt;
# Insert the SD card into the Raspberry Pi and power it on&lt;br /&gt;
# Login into the Alpine system as root.  Leave the password empty.&lt;br /&gt;
# Type &amp;lt;code&amp;gt;setup-alpine&amp;lt;/code&amp;gt;&lt;br /&gt;
# Once the installation is complete, commit the changes by typing &amp;lt;code&amp;gt;lbu commit -d&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Type &amp;lt;code&amp;gt;reboot&amp;lt;/code&amp;gt; to verify that the installation was indeed successful.&lt;br /&gt;
&lt;br /&gt;
== Post Installation ==&lt;br /&gt;
&lt;br /&gt;
=== Update the System ===&lt;br /&gt;
&lt;br /&gt;
After installation, make sure your system is up-to-date:&lt;br /&gt;
&lt;br /&gt;
{{cmd|apk update&lt;br /&gt;
apk upgrade}}&lt;br /&gt;
&lt;br /&gt;
Don&#039;t forget to save the changes:&lt;br /&gt;
&lt;br /&gt;
{{cmd|lbu commit -d}}&lt;br /&gt;
&lt;br /&gt;
Note: this does not upgrade the kernel. In order to upgrade the kernel, a full upgrade of the Alpine Linux version must be performed as described in [[Upgrading Alpine#Upgrading Alpine Linux on other removable media (such as CF/USB)|upgrading Alpine Linux for removable media]].&lt;br /&gt;
&lt;br /&gt;
=== Clock-related error messages ===&lt;br /&gt;
&lt;br /&gt;
During the booting time, you might notice errors related to the hardware clock.  The Raspberry Pi does not have&lt;br /&gt;
a hardware clock, thus you need to disable the hwclock daemon and enable swclock:&lt;br /&gt;
&lt;br /&gt;
{{cmd|rc-update add swclock boot    # enable the software clock&lt;br /&gt;
rc-update del hwclock boot    # disable the hardware clock}}&lt;br /&gt;
&lt;br /&gt;
Since the Raspberry Pi does not have a clock, Alpine Linux needs to know what the time is by using a&lt;br /&gt;
[https://en.wikipedia.org/wiki/Network_Time_Protocol Network Time Protocol (NTP)] daemon.  Make sure you have a&lt;br /&gt;
NTP daemon installed and running.  If you are not sure, you can install an NTP client by running the following&lt;br /&gt;
command:&lt;br /&gt;
&lt;br /&gt;
{{cmd|setup-ntp}}&lt;br /&gt;
&lt;br /&gt;
The Busybox NTP client might be the most lightweight solution.  Save the changes and reboot, once the NTP software is&lt;br /&gt;
installed and running:&lt;br /&gt;
&lt;br /&gt;
{{cmd|lbu commit -d&lt;br /&gt;
reboot}}&lt;br /&gt;
&lt;br /&gt;
After reboot, make sure the &amp;lt;code&amp;gt;date&amp;lt;/code&amp;gt; command outputs the correct date and time.&lt;br /&gt;
&lt;br /&gt;
=== WiFi on boot ===&lt;br /&gt;
If you have already [[Connecting_to_a_wireless_access_point|configured WiFi]] during the setup, the connection will not return on reboot.&lt;br /&gt;
You will need to start up a service to automatically connect to the wireless access point.&lt;br /&gt;
# Run &amp;lt;code&amp;gt;rc-update add wpa_supplicant boot&amp;lt;/code&amp;gt; to connect to the wireless access point during bootup.&lt;br /&gt;
# Run it manually with &amp;lt;code&amp;gt;/etc/init.d/wpa_supplicant start&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Enable OpenGL (Raspberry Pi 3/4) ===&lt;br /&gt;
Remount the boot partition writeable (i.e. &amp;lt;code&amp;gt;/media/mmcblk0p1&amp;lt;/code&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
{{cmd|mount /media/mmcblk0p1 -o rw,remount}}&lt;br /&gt;
&lt;br /&gt;
Add the following lines to &amp;lt;code&amp;gt;/media/mmcblk0p1/config.txt&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 gpu_mem=128&lt;br /&gt;
 # Raspberry Pi 3:&lt;br /&gt;
 dtoverlay=vc4-kms-v3d&lt;br /&gt;
 # Raspberry Pi 4:&lt;br /&gt;
 dtoverlay=vc4-fkms-v3d&lt;br /&gt;
&lt;br /&gt;
256MB (and more on the Raspberry Pi 4) &amp;lt;code&amp;gt;gpu_mem&amp;lt;/code&amp;gt; is also possible.&lt;br /&gt;
&lt;br /&gt;
Install the Mesa drivers:&lt;br /&gt;
&lt;br /&gt;
{{cmd|&amp;lt;nowiki&amp;gt;# Raspberry Pi 3:&lt;br /&gt;
apk add mesa-dri-vc4&lt;br /&gt;
# Raspberry Pi 4:&lt;br /&gt;
apk add mesa-dri-gallium&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
Then reboot:&lt;br /&gt;
&lt;br /&gt;
{{cmd|lbu_commit -d; reboot}}&lt;br /&gt;
&lt;br /&gt;
=== WiFi drivers ===&lt;br /&gt;
As of Alpine 3.14, the WiFi drivers for the Raspberry Pi were moved from &amp;lt;code&amp;gt;linux-firmware-brcm&amp;lt;/code&amp;gt; to the &amp;lt;code&amp;gt;linux-firmware-cypress&amp;lt;/code&amp;gt; package (source?). Since the images seem to be an outdated version of the former, Wi-Fi will work during installation, but after the first update it will break.&lt;br /&gt;
Use the ethernet interface to download the required packages:&lt;br /&gt;
&lt;br /&gt;
{{cmd|apk add linux-firmware-cypress}}&lt;br /&gt;
&lt;br /&gt;
And reboot.&lt;br /&gt;
&lt;br /&gt;
== Persistent storage ==&lt;br /&gt;
=== Loopback image with overlayfs ===&lt;br /&gt;
&lt;br /&gt;
When you install Alpine in diskless mode, the entire system is loaded into memory at boot. If you want additional storage (for example, if you need more space than offered by your RAM) we need to create loop-back storage onto the SD card mounted with overlayfs.&lt;br /&gt;
&lt;br /&gt;
First, make the SD card writable again and change fstab to always do so:&lt;br /&gt;
{{cmd|mount /media/mmcblk0p1 -o rw,remount&lt;br /&gt;
sed -i &#039;s/vfat\ ro,/vfat\ rw,/&#039; /etc/fstab}}&lt;br /&gt;
&lt;br /&gt;
Create the loop-back file, this example is 1 GB:&lt;br /&gt;
&lt;br /&gt;
{{cmd|dd if&amp;amp;#61;/dev/zero of&amp;amp;#61;/media/mmcblk0p1/persist.img bs&amp;amp;#61;1024 count&amp;amp;#61;0 seek&amp;amp;#61;1048576}}&lt;br /&gt;
&lt;br /&gt;
Install the ext utilities:&lt;br /&gt;
&lt;br /&gt;
{{cmd|apk add e2fsprogs}}&lt;br /&gt;
&lt;br /&gt;
Format the loop-back file:&lt;br /&gt;
&lt;br /&gt;
{{cmd|mkfs.ext4 /media/mmcblk0p1/persist.img}}&lt;br /&gt;
&lt;br /&gt;
Mount the storage: &lt;br /&gt;
&lt;br /&gt;
{{cmd|echo &amp;quot;/media/mmcblk0p1/persist.img /media/persist ext4 rw,relatime,errors&amp;amp;#61;remount-ro 0 0&amp;quot; &amp;gt;&amp;gt; /etc/fstab&lt;br /&gt;
mkdir /media/persist &lt;br /&gt;
mount -a}}&lt;br /&gt;
&lt;br /&gt;
Make the overlay folders, we are using the /usr directory here, but you can use /home or anything else:&lt;br /&gt;
&lt;br /&gt;
{{cmd|mkdir /media/persist/usr &lt;br /&gt;
mkdir /media/persist/.work &lt;br /&gt;
echo &amp;quot;overlay /usr overlay lowerdir&amp;amp;#61;/usr,upperdir&amp;amp;#61;/media/persist/usr,workdir&amp;amp;#61;/media/persist/.work 0 0&amp;quot; &amp;gt;&amp;gt; /etc/fstab &lt;br /&gt;
mount -a}}&lt;br /&gt;
&lt;br /&gt;
Your /etc/fstab should look something like this:&lt;br /&gt;
{{Cmd|/dev/cdrom      /media/cdrom    iso9660 noauto,ro 0 0&lt;br /&gt;
/dev/usbdisk    /media/usb      vfat    noauto,ro 0 0&lt;br /&gt;
/dev/mmcblk0p1 /media/mmcblk0p1 vfat rw,relatime,fmask&amp;amp;#61;0022,dmask&amp;amp;#61;0022,errors&amp;amp;#61;remount-ro 0 0&lt;br /&gt;
/media/mmcblk0p1/persist.img /media/persist ext4 rw,relatime,errors&amp;amp;#61;remount-ro 0 0&lt;br /&gt;
overlay /usr overlay lowerdir&amp;amp;#61;/usr,upperdir&amp;amp;#61;/media/persist/usr,workdir&amp;amp;#61;/media/persist/.work 0 0}}&lt;br /&gt;
&lt;br /&gt;
Now commit the changes: (optionally remove the e2fsprogs, but it does contain repair tools)&lt;br /&gt;
{{cmd|lbu_commit -d}}&lt;br /&gt;
&lt;br /&gt;
Remember, with this setup if you install things and you have done this overlay for /usr, you must not commit the &#039;apk add&#039;, otherwise, while it boots it will try and install it to memory, not to the persistent storage.&lt;br /&gt;
&lt;br /&gt;
If you do want to install something small at boot, you can use `apk add` and `lbu commit -d`.&lt;br /&gt;
&lt;br /&gt;
If it is something a bit bigger, then you can use `apk add` but then not commit it. It will be persistent (in /user), but be sure to check everything you need is in that directory and not in folders you have not made persistent.&lt;br /&gt;
&lt;br /&gt;
=== Traditional disk-based (sys) installation ===&lt;br /&gt;
{{Merge|Classic install or sys mode on Raspberry Pi|There&#039;s an existing page for sys-installations on RasPi.}}&lt;br /&gt;
&lt;br /&gt;
It is also possible to switch to a fully disk-based installation. This is not yet formally supported, but can be done somewhat manually. This frees all the memory otherwise needed for the root filesystem, allowing more installed packages.&lt;br /&gt;
&lt;br /&gt;
Split your SD card into two partitions: the FAT32 boot partition described above (in this example it&#039;ll be &amp;lt;code&amp;gt;mmcblk0p1&amp;lt;/code&amp;gt;) , and a second partition to hold the root filesystem (here it&#039;ll be &amp;lt;code&amp;gt;mmcblk0p2&amp;lt;/code&amp;gt;). Boot and configure your diskless system as above, then create a root filesystem:&lt;br /&gt;
&lt;br /&gt;
{{cmd|apk add e2fsprogs&lt;br /&gt;
mkfs.ext4 /dev/mmcblk0p2}}&lt;br /&gt;
&lt;br /&gt;
Now do a disk install via a mountpoint. The &amp;lt;code&amp;gt;setup-disk&amp;lt;/code&amp;gt; script will give some errors about syslinux/extlinux, but you can ignore them.&lt;br /&gt;
The Raspberry Pi doesn&#039;t need them to boot.&lt;br /&gt;
&lt;br /&gt;
{{cmd|&amp;lt;nowiki&amp;gt;mkdir /stage&lt;br /&gt;
mount /dev/mmcblk0p2 /stage&lt;br /&gt;
setup-disk -o /media/mmcblk0p1/MYHOSTNAME.apkovl.tar.gz /stage&lt;br /&gt;
# (ignore errors about syslinux/extlinux)&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
Add a line to &amp;lt;code&amp;gt;/stage/etc/fstab&amp;lt;/code&amp;gt; to mount the Pi&#039;s boot partition again:&lt;br /&gt;
&lt;br /&gt;
{{cmd|/dev/mmcblk0p1 /media/mmcblk0p1 vfat defaults 0 0}}&lt;br /&gt;
&lt;br /&gt;
Now add a &amp;lt;code&amp;gt;root=/dev/mmcblk0p2&amp;lt;/code&amp;gt; parameter to the Pi&#039;s boot command line, either &amp;lt;code&amp;gt;cmdline-rpi2.txt&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;cmdline-rpi.txt&amp;lt;/code&amp;gt; depending on model:&lt;br /&gt;
&lt;br /&gt;
{{cmd|&amp;lt;nowiki&amp;gt;mount -o remount,rw /media/mmcblk0p1&lt;br /&gt;
sed -i &#039;$ s/$/ root=\/dev\/mmcblk0p2/&#039; /media/mmcblk0p1/cmdline-rpi2.txt&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
You might also consider &amp;lt;code&amp;gt;overlaytmpfs=yes&amp;lt;/code&amp;gt; here, which will cause the underlying SD card root filesystem to be mounted read-only, with an overlayed tmpfs for modifications which will be discarded at shutdown.&lt;br /&gt;
&lt;br /&gt;
N.B. &amp;lt;b&amp;gt;the contents of /boot will be ignored when the Pi boots&amp;lt;/b&amp;gt;. It will use the kernel, initramfs, and modloop images from the FAT32 boot partition. To update the kernel, initfs or modules, you will need to manually (generate and) copy these to the boot partition or you could use bind mount, in which case,&lt;br /&gt;
copying the files to boot partition manually, is not needed.&lt;br /&gt;
&lt;br /&gt;
{{cmd|&amp;lt;nowiki&amp;gt;echo /media/mmcblk0p1/boot /boot none defaults,bind 0 0 &amp;gt;&amp;gt; /etc/fstab&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
=== Persistent Installation on Raspberry Pi 3 ===&lt;br /&gt;
See [[Classic install or sys mode on Raspberry Pi]] and https://web.archive.org/web/20171125115835/https://forum.alpinelinux.org/comment/1084#comment-1084&lt;br /&gt;
&lt;br /&gt;
=== Persistent Installation on Raspberry Pi 4 ===&lt;br /&gt;
As of 3.14, setup-alpine should ask you if you want to create a sys mode partition on your Raspberry Pi 4.&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
=== Long boot time when running headless ===&lt;br /&gt;
&lt;br /&gt;
If no peripherals are connected, the system might hang for an exceptionally long period of time while it attempts to accumulate entropy.&lt;br /&gt;
&lt;br /&gt;
If this is the case, simply plugging in any USB device should work around this issue.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Alternatively&#039;&#039;&#039;, installing haveged, the random numbers generator, would speed up the process: &lt;br /&gt;
&lt;br /&gt;
  apk update &lt;br /&gt;
  apk add haveged&lt;br /&gt;
  rc-update add haveged boot&lt;br /&gt;
  lbu commit -d&lt;br /&gt;
  service haveged start&lt;br /&gt;
&lt;br /&gt;
(Tested on a raspberry pi zero W in headless mode, no USB connected, Alpine 3.10.3)&lt;br /&gt;
&lt;br /&gt;
=== apk indicating &#039;No space left on device&#039; ===&lt;br /&gt;
&lt;br /&gt;
Note some models of the Raspberry Pi such as the 3A+ only have 512M of RAM, which on fresh Alpine deployment will only leave around 200M for tmpfs root. It&#039;s important to keep this limitation in mind when using these boards.&lt;br /&gt;
&lt;br /&gt;
=== Wireless support with older Alpine images ===&lt;br /&gt;
&lt;br /&gt;
If you need Wi-Fi, you&#039;ll need to [https://github.com/RPi-Distro/firmware-nonfree/tree/master/brcm download] the latest Broadcom drivers to your SD card.&lt;br /&gt;
(Replace /mnt/sdcard with the correct mount point.)&lt;br /&gt;
&lt;br /&gt;
  git clone --depth 1 https://github.com/RPi-Distro/firmware-nonfree.git&lt;br /&gt;
  cp firmware-nonfree/brcm/* /mnt/sdcard/firmware/brcm&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
* [[Classic install or sys mode on Raspberry Pi]] - a variant.&lt;br /&gt;
* [[Raspberry Pi - Headless Installation]]&lt;br /&gt;
* [[Raspberry Pi 3 - Setting Up Bluetooth]]&lt;br /&gt;
* [[Raspberry Pi 3 - Configuring it as wireless access point -AP Mode]]&lt;br /&gt;
* [[Raspberry Pi 3 - Browser Client]]&lt;br /&gt;
* [[Linux Router with VPN on a Raspberry Pi]]&lt;br /&gt;
* [[Create a bootable SDHC from a Mac]]&lt;br /&gt;
* Build custom Raspberry Pi images based on Alpine via [https://github.com/tolstoyevsky/pieman Pieman]&lt;br /&gt;
* [[Tutorials and Howtos#Raspberry Pi]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;br /&gt;
[[Category: Raspberry]]&lt;/div&gt;</summary>
		<author><name>Mtbu</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Setup_Hardware_Clock_(RTC)_Module_on_a_Raspberry_Pi&amp;diff=19862</id>
		<title>Setup Hardware Clock (RTC) Module on a Raspberry Pi</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Setup_Hardware_Clock_(RTC)_Module_on_a_Raspberry_Pi&amp;diff=19862"/>
		<updated>2021-07-17T09:51:30Z</updated>

		<summary type="html">&lt;p&gt;Mtbu: Add page to Raspberry category as it&amp;#039;s focusing on a Raspberry Pi&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Install Hardware =&lt;br /&gt;
&lt;br /&gt;
I used a [http://www.piface.org.uk/products/piface_clock PiFace Real Time Clock]. After installing the CR1220 battery and correctly mounting on the board, [http://www.piface.org.uk/assets/piface_clock/PiFaceClockguide.pdf see manual] for that.&lt;br /&gt;
&lt;br /&gt;
= Install Software =&lt;br /&gt;
Add the modules from the kernel&lt;br /&gt;
&lt;br /&gt;
== /etc/modules/ ==&lt;br /&gt;
Add these modules so they&#039;re loaded on boot. You can modprobe each one individually if you don&#039;t want to reboot.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;i2c_dev&lt;br /&gt;
i2c_bcm2708&lt;br /&gt;
i2c:mcp7941x&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== /media/mmcblk0p1/config.txt ==&lt;br /&gt;
You will need to mount this as read-write&lt;br /&gt;
&lt;br /&gt;
{{cmd|mount -o remount,rw /media/mmcblk0p1}}&lt;br /&gt;
&lt;br /&gt;
Add these two parameters to the bottom&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;dtparam=i2c1=on&lt;br /&gt;
dtparam=i2c_arm=on&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{cmd|mount -o remount,ro /media/mmcblk0p1}}&lt;br /&gt;
&lt;br /&gt;
Then you will need to reboot.&lt;br /&gt;
&lt;br /&gt;
== Binding the hardware clock device ==&lt;br /&gt;
&lt;br /&gt;
You will want to make sure the device is created when hwclock starts, if it isn&#039;t already created. To the bottom of /etc/conf.d/hwclock add this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;start_pre() {&lt;br /&gt;
    if [ -d &amp;quot;/sys/class/i2c-adapter/i2c-1/i2c-dev/i2c-1&amp;quot; ]; then&lt;br /&gt;
        einfo &amp;quot;Creating RTC device&amp;quot;;&lt;br /&gt;
        echo mcp7941x 0x6f &amp;gt; /sys/class/i2c-adapter/i2c-1/new_device&lt;br /&gt;
    fi&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the time being this is necessary but in the future when [https://github.com/raspberrypi/linux/issues/1032 issue 1032] you should be able to just add&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;dtparam=i2c-rtc,mcp7941x&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
to /media/mmcblk0p1/config.txt&lt;br /&gt;
&lt;br /&gt;
[[Category:Hardware]]&lt;br /&gt;
[[Category:System Administration]]&lt;br /&gt;
[[Category:Raspberry]]&lt;/div&gt;</summary>
		<author><name>Mtbu</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=OpenRC&amp;diff=19861</id>
		<title>OpenRC</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=OpenRC&amp;diff=19861"/>
		<updated>2021-07-17T09:45:17Z</updated>

		<summary type="html">&lt;p&gt;Mtbu: /* Quick-Start Information */ Fix typo&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Quick-Start Information ==&lt;br /&gt;
Alpine Linux uses [https://wiki.gentoo.org/wiki/OpenRC OpenRC] for its init system.&lt;br /&gt;
&lt;br /&gt;
The following commands are available to manage the init system:&lt;br /&gt;
* Basics:&lt;br /&gt;
 {{Cmd|rc-update add &amp;lt;service&amp;gt; &amp;lt;runlevel&amp;gt;}}&lt;br /&gt;
 {{Cmd|rc-update del &amp;lt;service&amp;gt; &amp;lt;runlevel&amp;gt;}}&lt;br /&gt;
 {{Cmd|rc-service &amp;lt;service&amp;gt; &amp;lt;start stop restart&amp;gt; # ⇔ /etc/init.d/service &amp;lt;start stop restart&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
* To check services and their set runlevels:&lt;br /&gt;
 {{Cmd|rc-status}}&lt;br /&gt;
&lt;br /&gt;
* To change to a different runlevel:&lt;br /&gt;
 {{Cmd|rc &amp;lt;runlevel&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
* Reboot/Halt/Poweroff: (And their equivalent from traditional GNU/Linux systems)&lt;br /&gt;
 {{Cmd|reboot   # ⇔ shutdown now -r}}&lt;br /&gt;
 {{Cmd|halt     # ⇔ shutdown now -H}}&lt;br /&gt;
 {{Cmd|poweroff # ⇔ shutdown now -P}}&lt;br /&gt;
&lt;br /&gt;
{{Tip|Prior to Alpine Linux 2.0.0, you might need to use the following commands instead: &#039;&#039;rc_add, rc_delete,&#039;&#039; and &#039;&#039;rc_status&#039;&#039;.}}&lt;br /&gt;
&lt;br /&gt;
== Available Runlevels ==&lt;br /&gt;
The available runlevels are:&lt;br /&gt;
* &#039;&#039;&#039;default&#039;&#039;&#039; - Used if no runlevel is specified. (This is generally the runlevel you want to add services to.)&lt;br /&gt;
* &#039;&#039;&#039;hotplugged&#039;&#039;&#039;&lt;br /&gt;
* &#039;&#039;&#039;manual&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The special runlevels are:&lt;br /&gt;
* &#039;&#039;&#039;sysinit&#039;&#039;&#039; - Brings up any system specific stuff such as &amp;lt;code&amp;gt;/dev&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/proc&amp;lt;/code&amp;gt; and optionally &amp;lt;code&amp;gt;/sys&amp;lt;/code&amp;gt; for Linux based systems. It also mounts &amp;lt;code&amp;gt;/lib/rc/init.d&amp;lt;/code&amp;gt; as a ramdisk using tmpfs where available unless &amp;lt;code&amp;gt;/&amp;lt;/code&amp;gt; is mounted rw at boot. &amp;lt;code&amp;gt;&#039;&#039;&#039;rc&#039;&#039;&#039;&amp;lt;/code&amp;gt; uses &amp;lt;code&amp;gt;/lib/rc/init.d&amp;lt;/code&amp;gt; to hold state information about the services it runs. sysinit always runs when the host first starts and should not be run again.&lt;br /&gt;
* &#039;&#039;&#039;boot&#039;&#039;&#039; - Generally the only services you should add to the boot runlevel are those which deal with the mounting of filesystems, set the initial state of attached peripherals and logging. Hotplugged services are added to the boot runlevel by the system. All services in the boot and sysinit runlevels are automatically included in all other runlevels except for those listed here.&lt;br /&gt;
* &#039;&#039;&#039;single&#039;&#039;&#039; - Stops all services except for those in the sysinit runlevel.&lt;br /&gt;
* &#039;&#039;&#039;reboot&#039;&#039;&#039; - Changes to the shutdown runlevel and then reboots the host.&lt;br /&gt;
* &#039;&#039;&#039;shutdown&#039;&#039;&#039; - Changes to the shutdown runlevel and then halts the host.&lt;br /&gt;
&lt;br /&gt;
== rc-update usage ==&lt;br /&gt;
 Usage: rc-update [options] add service &amp;lt;runlevel&amp;gt;&lt;br /&gt;
        rc-update [options] del service &amp;lt;runlevel&amp;gt;&lt;br /&gt;
        rc-update [options] show&lt;br /&gt;
 &lt;br /&gt;
 Options: [suChqv]&lt;br /&gt;
   -s, --stack                       Stack a runlevel instead of a service&lt;br /&gt;
   -u, --update                      Force an update of the dependency tree&lt;br /&gt;
   -h, --help                        Display this help output&lt;br /&gt;
   -C, --nocolor                     Disable color output&lt;br /&gt;
   -v, --verbose                     Run verbosely&lt;br /&gt;
   -q, --quiet                       Run quietly&lt;br /&gt;
&lt;br /&gt;
== rc-status usage ==&lt;br /&gt;
 Usage: rc-status [options] [runlevel1] [runlevel2] ...&lt;br /&gt;
 &lt;br /&gt;
 Options: [aclrsuChqv]&lt;br /&gt;
   -a, --all                         Show services from all run levels&lt;br /&gt;
   -c, --crashed                     Show crashed services&lt;br /&gt;
   -l, --list                        Show list of run levels&lt;br /&gt;
   -r, --runlevel                    Show the name of the current runlevel&lt;br /&gt;
   -s, --servicelist                 Show service list&lt;br /&gt;
   -u, --unused                      Show services not assigned to any runlevel&lt;br /&gt;
   -h, --help                        Display this help output&lt;br /&gt;
   -C, --nocolor                     Disable color output&lt;br /&gt;
   -v, --verbose                     Run verbosely&lt;br /&gt;
   -q, --quiet                       Run quietly&lt;br /&gt;
&lt;br /&gt;
== rc-service usage ==&lt;br /&gt;
 Usage: rc-service [options]&lt;br /&gt;
 &lt;br /&gt;
 Options: [e:ilr:ChqVv]&lt;br /&gt;
   -e, --exists &amp;lt;arg&amp;gt;                tests if the service exists or not&lt;br /&gt;
   -i, --ifexists                    if the service exists then run the command&lt;br /&gt;
   -l, --list                        list all available services&lt;br /&gt;
   -r, --resolve &amp;lt;arg&amp;gt;               resolve the service name to an init script&lt;br /&gt;
   -h, --help                        Display this help output&lt;br /&gt;
   -C, --nocolor                     Disable color output&lt;br /&gt;
   -V, --version                     Display software version&lt;br /&gt;
   -v, --verbose                     Run verbosely&lt;br /&gt;
   -q, --quiet                       Run quietly&lt;br /&gt;
&lt;br /&gt;
== rc usage ==&lt;br /&gt;
 Usage: rc [options]&lt;br /&gt;
 &lt;br /&gt;
 Options: [a:o:s:SChqVv]&lt;br /&gt;
   -a, --applet &amp;lt;arg&amp;gt;                runs the applet specified by the next argument&lt;br /&gt;
   -o, --override &amp;lt;arg&amp;gt;              override the next runlevel to change into&lt;br /&gt;
                                     when leaving single user or boot runlevels&lt;br /&gt;
   -s, --service &amp;lt;arg&amp;gt;               runs the service specified with the rest&lt;br /&gt;
                                     of the arguments&lt;br /&gt;
   -S, --sys                         output the RC system type, if any&lt;br /&gt;
   -h, --help                        Display this help output&lt;br /&gt;
   -C, --nocolor                     Disable color output&lt;br /&gt;
   -V, --version                     Display software version&lt;br /&gt;
   -v, --verbose                     Run verbosely&lt;br /&gt;
   -q, --quiet                       Run quietly&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Booting]]&lt;/div&gt;</summary>
		<author><name>Mtbu</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi_3_-_Browser_Client&amp;diff=19857</id>
		<title>Raspberry Pi 3 - Browser Client</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi_3_-_Browser_Client&amp;diff=19857"/>
		<updated>2021-07-16T19:00:19Z</updated>

		<summary type="html">&lt;p&gt;Mtbu: Add page to Category:Raspberry&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a guide for setting up a RAM based Alpine which is able to run X, and firefox. This tutorial will go through setting up auto login, and starting X on boot without user interaction. It is a type of kiosk or possibly digital signage.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Tested as of 05/2020&#039;&#039;&#039; - RPI 3&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;12/2020&#039;&#039;&#039; - x86&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;04/2021&#039;&#039;&#039; - RPI 4&lt;br /&gt;
&lt;br /&gt;
==Overview==&lt;br /&gt;
This guide uses the following:&lt;br /&gt;
* aarch64 img (though this guide is also x86-compatible)&lt;br /&gt;
* RPI3&lt;br /&gt;
* community repo is used.&lt;br /&gt;
&lt;br /&gt;
It is based off of this guide: [[Raspberry_Pi]]. Due to the dependencies required to run X and FF, there is very little RAM disk space for the user to operate in, after this tutorial is complete (about 30MB is v3.11). The 2GB RPI 4 has 1GB of ram, without adjusting /boot/config.txt. 1GB may be enough for most needs.&lt;br /&gt;
&lt;br /&gt;
aarch64 is used, because firefox-esr is in the community repo. armhf (as of v3.11) does not have firefox prepackaged in the base or community repo.&lt;br /&gt;
&lt;br /&gt;
See https://pkgs.alpinelinux.org/packages?name=*firefox*&amp;amp;branch=v3.11&amp;amp;arch=aarch64&lt;br /&gt;
&lt;br /&gt;
Note that the aarch64 build is not compatible with all RPI. See [[Raspberry Pi]].&lt;br /&gt;
&lt;br /&gt;
==Steps==&lt;br /&gt;
===Base Install===&lt;br /&gt;
&lt;br /&gt;
These steps are duplicated from [[Raspberry_Pi]] page.&lt;br /&gt;
&lt;br /&gt;
Use fdisk or gdisk to format the SD card. You must have the first partition&lt;br /&gt;
be a bootable, FAT filesystem. &lt;br /&gt;
e.g.:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Command (m for help): p&lt;br /&gt;
Disk /dev/sdb: 59.5 GiB, 63864569856 bytes, 124735488 sectors&lt;br /&gt;
Units: sectors of 1 * 512 = 512 bytes&lt;br /&gt;
Sector size (logical/physical): 512 bytes / 512 bytes&lt;br /&gt;
I/O size (minimum/optimal): 512 bytes / 512 bytes&lt;br /&gt;
Disklabel type: dos&lt;br /&gt;
Disk identifier: 0x00000000&lt;br /&gt;
&lt;br /&gt;
Device     Boot Start      End  Sectors Size Id Type&lt;br /&gt;
/dev/sdb1  *     2048 62916607 62914560  30G  b W95 FAT32&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 mkdosfs -F 32 /dev/sdX1&lt;br /&gt;
&lt;br /&gt;
untar onto mounted disk&lt;br /&gt;
&lt;br /&gt;
 mount /dev/sdX1 /mnt/folder&lt;br /&gt;
 tar xvf archive.tar -C /mnt/folder/.&lt;br /&gt;
&lt;br /&gt;
If you plan to enable increased RAM (e.g. for RPI4 with 2 or 4GB) or other&lt;br /&gt;
config settings, do so in a usercfg.txt now.&lt;br /&gt;
&lt;br /&gt;
Again, duplicating the [[Raspberry Pi]] page &lt;br /&gt;
&lt;br /&gt;
    Insert the SD card into the Raspberry Pi and turn it on&lt;br /&gt;
    Login into the Alpine system as root. Leave the password empty.&lt;br /&gt;
    Type setup-alpine&lt;br /&gt;
    Once the installation is complete, commit the changes by typing lbu commit -d&lt;br /&gt;
&lt;br /&gt;
Things to keep in mind here:&lt;br /&gt;
* There is no need to make multiple partitions (e.g. on an sdcard). One partition that takes up the whole of the storage will suffice in diskless / sys mode. &lt;br /&gt;
* For the setup-alpine install, most of the choices will be at the defaults. Particularly when prompted with &amp;quot;No disks available, try boot media /mmcblk0p1&amp;quot;. Here you will click the default [n]. If you make a mistake during the install, you can always reimage and start over.&lt;br /&gt;
&lt;br /&gt;
Saving space: busybox instead of chronyd, dropbear instead of openssh&lt;br /&gt;
&lt;br /&gt;
After setup, make sure dropbear is installed&lt;br /&gt;
 apk add dropbear&lt;br /&gt;
&lt;br /&gt;
Start it:&lt;br /&gt;
 rc-service dropbear start&lt;br /&gt;
&lt;br /&gt;
Add it to the default runlevel:&lt;br /&gt;
 rc-update add dropbear&lt;br /&gt;
&lt;br /&gt;
If you need an accurate clock, enable software/ntp here (optional, i don&#039;t need a clock for the website I view).&lt;br /&gt;
 rc-update add swclock boot # enable the software clock &lt;br /&gt;
 rc-update del hwclock boot # disable the hardware clock&lt;br /&gt;
 setup-ntp&lt;br /&gt;
&lt;br /&gt;
===Browser Client Install===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Enable community repo (/etc/apk/repositories) (uncomment community)&lt;br /&gt;
 nano /etc/apk/repositories&lt;br /&gt;
 apk update&lt;br /&gt;
&lt;br /&gt;
install firefox and X dependencies:&lt;br /&gt;
 apk add libx11-dev libxft-dev libxinerama-dev adwaita-gtk2-theme adwaita-icon-theme ttf-dejavu&lt;br /&gt;
&amp;lt;small&amp;gt;Note that the fonts/icon theme are required for FF to display correctly. Without these, firefox will load, but text will not render on the browser menus.&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the RAM tmp fs remaining can be viewed while installing, with watch df -h&lt;br /&gt;
&lt;br /&gt;
install firefox&lt;br /&gt;
 apk add firefox-esr&lt;br /&gt;
install X&lt;br /&gt;
 setup-xorg-base&lt;br /&gt;
The RPI also requires for X:&lt;br /&gt;
 apk add xf86-video-fbdev&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;note: this command can vary if you are using x86. For example, I installed no xf86-video... drivers, and had a libEGL.so missing library error on Xorg, and that was resolved via &amp;quot;apk search libEGL.so&amp;quot; which pointed to mesa-egl. Note that apk search is case sensitive.&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At this point, we have about 421MB used up (if NTP was not setup).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Filesystem                Size      Used Available Use% Mounted on&lt;br /&gt;
devtmpfs                 10.0M         0     10.0M   0% /dev&lt;br /&gt;
shm                     457.9M         0    457.9M   0% /dev/shm&lt;br /&gt;
/dev/mmcblk0p1           30.0G    259.4M     29.7G   1% /media/mmcblk0p1&lt;br /&gt;
tmpfs                   457.9M    420.0M     37.9M  92% /&lt;br /&gt;
tmpfs                    91.6M    188.0K     91.4M   0% /run&lt;br /&gt;
/dev/loop0               24.9M     24.9M         0 100% /.modloop&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 lbu_commit -d&lt;br /&gt;
&lt;br /&gt;
===AutoLogin, Startx automatically on Boot===&lt;br /&gt;
&lt;br /&gt;
At this point, you should be able to login as root, and run startx manually. Now, we will add a number of configuration files that allow this to happen without user interaction.&lt;br /&gt;
&lt;br /&gt;
/root/ doesn&#039;t save any files, so it&#039;s necessary to edit files in /etc/ and lbu_commit -d after all changes. First let&#039;s add a file that will call firefox.&lt;br /&gt;
&amp;lt;small&amp;gt;lbu_commit is alpine local backup. If you want to save folders other than /etc see:https://wiki.alpinelinux.org/wiki/Alpine_local_backup#Include_special_files.2Ffolders_to_the_apkovl&lt;br /&gt;
also see: /etc/apk/protected_paths.d/lbu.list&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
create a file named /etc/startup.sh:&lt;br /&gt;
 #!/bin/ash&lt;br /&gt;
 firefox http://somewebsite.com&lt;br /&gt;
&lt;br /&gt;
!!!NOTE: This is ash, not bash. By default, alpine ships with the ashbourne shell. Although bash is available in the repositories.&lt;br /&gt;
&lt;br /&gt;
We have to edit xinitrc, and the profile configs. Normally, this would be done in the user&#039;s directory, but here we will use the globals for simplicity.&lt;br /&gt;
 mv /etc/X11/xinit/xinitrc /etc/X11/xinit/xinitrc_BAK&lt;br /&gt;
 nano /etc/X11/xinit/xinitrc&lt;br /&gt;
In this file put:&lt;br /&gt;
 /etc/startup.sh&lt;br /&gt;
At the end of /etc/profile (leave the existing file) append&lt;br /&gt;
 startx&lt;br /&gt;
And remember to: lbu_commit -d  For autologin, alpine uses busybox, which has an alias to /sbin/getty as well as /bin/login. It&#039;s possible to navigate to /sbin/ or /bin/ and run /sbin/getty -h to see what settings are available. To have root auto login upon boot, review the existing inittab and edit as needed, according to the config below.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Set up a couple of getty&#039;s&lt;br /&gt;
#tty1::respawn:/sbin/getty 38400 tty1&lt;br /&gt;
tty2::respawn:/sbin/getty 38400 tty2&lt;br /&gt;
tty3::respawn:/sbin/getty 38400 tty3&lt;br /&gt;
tty4::respawn:/sbin/getty 38400 tty4&lt;br /&gt;
tty5::respawn:/sbin/getty 38400 tty5&lt;br /&gt;
tty6::respawn:/sbin/getty 38400 tty6&lt;br /&gt;
&lt;br /&gt;
tty1::respawn:/bin/login -f root&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Disable Screensaver, and refresh webpage (optional)===&lt;br /&gt;
&lt;br /&gt;
As a kiosk, the RPI will need to have the screensaver ([https://wiki.archlinux.org/DPMS DPMS]) disabled. Also, my particular application (video streams) required a refresh occasionally. These were managed with xorg.conf, xdotool, and crontab respectively.&lt;br /&gt;
&lt;br /&gt;
{{cat|/etc/X11/xorg.conf|&lt;br /&gt;
Section &amp;quot;Extensions&amp;quot;&lt;br /&gt;
    Option      &amp;quot;DPMS&amp;quot; &amp;quot;Disable&amp;quot;&lt;br /&gt;
EndSection}} &lt;br /&gt;
&lt;br /&gt;
{{cmd|# apk add xdotool}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;# crontab -u root -e &lt;br /&gt;
* * * * * DISPLAY=:0 /usr/bin/xdotool key F5&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Note that xset is not an option here, as it&#039;s not included by default. It can be installed from repositories, if needed.&amp;lt;/small&amp;gt;&lt;br /&gt;
That&#039;s it. Now reboot, and watch the RPI boot into firefox without user intervention. At this point, you have a functioning minimal OS booting from RAM, with firefox, and ~30MB of available space for further configuration.&lt;br /&gt;
&lt;br /&gt;
==Digital Signage==&lt;br /&gt;
It&#039;s common to use GNULinux and x86/RPIs for digital signage. A quick glance at https://elinux.org/RPi_Projects/Digital_Signage will show a number of options. Why would you use this guide for digital signage vs. those pre-built projects? &lt;br /&gt;
# Alpine runs from RAM, which increases the lifetime of the storage (flash / hdd). &lt;br /&gt;
# There is no requirement to use &#039;cloud&#039; services, or depend upon an internet connection. &lt;br /&gt;
# You have full control over the build and design (all kiosk build steps are documented &amp;amp; have a small learning curve, compared to some of the more complex projects mentioned above).&lt;br /&gt;
# Free software. No recurring costs (outside of optional maintenance). &lt;br /&gt;
# No ties to external infrastructure / frameworks. Full freedom.&lt;br /&gt;
&lt;br /&gt;
In this addition to the guide above, I will install Chromium, which seems to be the defacto standard. However, you could use any application that runs in X. Here we will also run a web server with PHP, which hosts the resources we want to display on the sign.&lt;br /&gt;
Make sure community apk is enabled in /etc/apk/repositories&lt;br /&gt;
 apk add chromium&lt;br /&gt;
In /etc/startup.sh add the browser instead of firefox:&lt;br /&gt;
  chromium-browser --home-page http://127.0.0.1/resource --no-sandbox --window-size=1920,1280 --start-fullscreen --test-type&lt;br /&gt;
Note that this is a potentially insecure setup, and users are advised to add a user, and remove the --no-sandbox tag. The tags used are the following: --home-page will start us on a given URL. --no-sandbox will allow root to run chromium. --window-size will give us the resolution we want, and start-fullscreen will ensure the browser takes up all of the screen.&lt;br /&gt;
&lt;br /&gt;
If you deploy the device on a TV, and you are unsure what resolution it is, you can access the resolution from the terminal (not in X), by using &lt;br /&gt;
 xrandr -d :0&lt;br /&gt;
For example, I built my device on a computer monitor that was 1920x1280, but when I deployed, the TV was 1920x1080. Since we run chromium straight on X, without any WM, it&#039;s necessary to query xrandr from the console. If desired, you could install DWM and hide the bar, obtaining access to a terminal accessible via keyboard shortcut configured in dwm&#039;s config.h, But a WM is not required.&lt;br /&gt;
&lt;br /&gt;
Make sure to lbu_commit -d, in order to save any changes as needed in the apkvol on the SD or HDD storage.&lt;br /&gt;
&lt;br /&gt;
===Install Apache/PHP===&lt;br /&gt;
See [[Apache]].&lt;br /&gt;
&lt;br /&gt;
===Install xset to disable screensaver===&lt;br /&gt;
 apk add xset&lt;br /&gt;
 xset q&lt;br /&gt;
 xset s off&lt;br /&gt;
&lt;br /&gt;
===Hide Scrollbars of Browser===&lt;br /&gt;
This can be done in CSS.&lt;br /&gt;
 body {&lt;br /&gt;
   overflow: hidden; /* Hide scrollbars */&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
==Tips/Troubleshooting==&lt;br /&gt;
===Why was this setup used? Why not Awesome, or dwm?===&lt;br /&gt;
I ran through a few different setups of alpine on the rpi, and found that (dwm | awesome) &amp;amp; firefox required too many dependencies to run on an RPI3 with 512MB in /tmp (running in RAM), or other browsers which used less dependencies were unstable (the application was viewing video streams). Therefore, running firefox direct off X was just barely able to fit into the available space, and was stable. This is one of the reasons aarch64 was used, instead of armhf. The 2GB RPI4 by default has 1GB of ram in alpine available (for storage), and doesn&#039;t have this limitation. It should be possible to get more RAM via /boot/config.txt&lt;br /&gt;
&lt;br /&gt;
If your application doesn&#039;t require media (i.e. a static webpage) you may be able to run other browsers, such as midori, falkon, or surf, without stability issues on the RPI.&lt;br /&gt;
&lt;br /&gt;
It is possible that VLC or a GTK/QT app would also fit into the limited space on the RPI 3. This was not tested.&lt;br /&gt;
&lt;br /&gt;
===Width &amp;amp; height of firefox doesn&#039;t fit the monitor===&lt;br /&gt;
Firefox can be called with -height and -width flags, e.g. &lt;br /&gt;
 firefox -width 480 -height 640 somewebsite.com&lt;br /&gt;
&lt;br /&gt;
===Periodic Firefox Crashes on RPI3 due to Low Memory===&lt;br /&gt;
With the RPI3, I found firefox crashing reliably after a couple days uptime of watching video. On the server I saw notices of memory running out. This may have been a memory leak, and with the small amount of RAM available, it would crash firefox, leaving the screen blank. &lt;br /&gt;
&lt;br /&gt;
The solution was to setup a nightly reboot of the system via cron, and this has kept the system stable since. However, if I was to do this again, I would try an RPI4 with &amp;gt;1GB ram which may obviate the need for a nightly reboot.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Related Links==&lt;br /&gt;
* [[dwm]]&lt;br /&gt;
* [[Raspberry Pi]]&lt;br /&gt;
* [[Apache]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Raspberry]]&lt;/div&gt;</summary>
		<author><name>Mtbu</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi_4_-_Persistent_system_acting_as_a_NAS_and_Time_Machine&amp;diff=19856</id>
		<title>Raspberry Pi 4 - Persistent system acting as a NAS and Time Machine</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi_4_-_Persistent_system_acting_as_a_NAS_and_Time_Machine&amp;diff=19856"/>
		<updated>2021-07-16T18:59:49Z</updated>

		<summary type="html">&lt;p&gt;Mtbu: Add page to Category:Raspberry&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Tinker, Tailor, Raspberry Pi ==&lt;br /&gt;
&lt;br /&gt;
I went ahead and got myself a Raspberry Pi 4B with 4GB RAM, which I intend to use as a job scheduling server, only to find out that the suggested OS, Raspberry Pi OS, is 32-bit. Fortunately, the Linux distro Alpine, which I’ve grown very fond of lately, is available for Raspberry Pi as aarch64, meaning it’s both 64-bit kernel and userland. Unfortunately the distro is currently, as of version 3.12, not set up for persistent storage and is more of a live playground. Gathering bits and pieces from various guides online, that can be remedied with some tinkering. On this page you will find how to set up a persistent 64-bit OS on the Raspberry Pi, share a USB attached disk, as well as some interesting software.&lt;br /&gt;
&lt;br /&gt;
Note: the Pi 4 has micro-HDMI ports. I thought they were mini, for which I already had cabling, but alas, another adapter had to be purchased. Also, when attaching a USB disk it is better if it is externally powered. The Pi can however power newer external SSD drives that have low power consumption. I tried with a USB powered magnetic disk drive, but it behaved somewhat strangely. With that said, let’s look at how to get yourself a shiny, tiny, new server.&lt;br /&gt;
&lt;br /&gt;
=== Tinkering for Persistence ===&lt;br /&gt;
&lt;br /&gt;
After downloading the Alpine v3.12 tarball, the next step is to set up the SDHC card for the Pi. I borrowed a MacBook Air, since it has a built-in card reader. The Pi boots off a FAT32 partition, but ultimately, we want the system to reside in an ext4 partition. We&#039;ll start by reserving a small portion of the card for the boot partition. This is done using Terminal in macOS with the following commands.&lt;br /&gt;
&lt;br /&gt;
 diskutil list&lt;br /&gt;
 diskutil partitionDisk /dev/disk2 MBR &amp;quot;FAT32&amp;quot; ALP 256MB &amp;quot;Free Space&amp;quot; SYS R&lt;br /&gt;
 sudo fdisk -e /dev/disk2&lt;br /&gt;
 &amp;gt; f 1&lt;br /&gt;
 &amp;gt; w&lt;br /&gt;
 &amp;gt; exit&lt;br /&gt;
&lt;br /&gt;
The tarball should have decompressed once it hit your download folder. If not, use the option “xvzf” for tar.&lt;br /&gt;
&lt;br /&gt;
 cd /Volumes/ALP&lt;br /&gt;
 tar xvf ~/Downloads/alpine-rpi-3.12.0-aarch64.tar&lt;br /&gt;
 nano usercfg.txt&lt;br /&gt;
&lt;br /&gt;
The newly created file usercfg.txt should contain the following:&lt;br /&gt;
&lt;br /&gt;
 enable_uart=1&lt;br /&gt;
 gpu_mem=32&lt;br /&gt;
 disable_overscan=1&lt;br /&gt;
&lt;br /&gt;
The smallest amount of memory for a headless install is 32MB. Removing overscan gives you more usable screen area. If you intend to use this as a desktop computer rather than a headless server, you probably want to allocate more memory to the GPU and enable sound. Full specifications for options can be found on the official Raspberry Pi homepage.&lt;br /&gt;
&lt;br /&gt;
After that, you need to make sure the card is not busy. Change to a safe directory then eject the card (making sure that any pending writes are finalized).&lt;br /&gt;
&lt;br /&gt;
 cd&lt;br /&gt;
 diskutil eject /dev/disk2&lt;br /&gt;
&lt;br /&gt;
Put the SDHC card in the Pi and boot. Login with “root” as username and no password. This presumes that you have connected everything else, e.g. a keyboard and monitor.&lt;br /&gt;
&lt;br /&gt;
 setup-alpine&lt;br /&gt;
&lt;br /&gt;
During setup, select your keymap, hostname, etc, as desired. However, when asked where to store configs, type “none”, and the same for the apk cache directory. If you want to follow this guide to the point, you should also select “chrony” as the NTP client. The most important part here though is to get your network up and running. A full description of the setup programs can be found on the Alpine homepage.&lt;br /&gt;
&lt;br /&gt;
 apk update&lt;br /&gt;
 apk upgrade&lt;br /&gt;
 apk add cfdisk&lt;br /&gt;
 cfdisk /dev/mmcblk0&lt;br /&gt;
&lt;br /&gt;
In cfdisk, select “Free space” and the &amp;quot;New&amp;quot; option. It will suggest using the entire available space, so just press enter, then select the option &amp;quot;primary&amp;quot; followed by &amp;quot;Write&amp;quot;. Type &amp;quot;yes&amp;quot; to write the partition table to disk, then select &amp;quot;Quit&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
 apk add e2fsprogs&lt;br /&gt;
 mkfs.ext4 /dev/mmcblk0p2&lt;br /&gt;
 mount /dev/mmcblk0p2 /mnt&lt;br /&gt;
 setup-disk -m sys /mnt&lt;br /&gt;
 mount -o remount,rw /media/mmcblk0p1&lt;br /&gt;
&lt;br /&gt;
Ignore the warnings about extlinux. This and the following trick was found in the Alpine Wiki, but in a confusing order. &lt;br /&gt;
&lt;br /&gt;
 rm -f /media/mmcblk0p1/boot/*&lt;br /&gt;
 cd /mnt&lt;br /&gt;
 rm boot/boot&lt;br /&gt;
 mv boot/* /media/mmcblk0p1/boot/&lt;br /&gt;
 rm -Rf boot&lt;br /&gt;
 mkdir media/mmcblk0p1&lt;br /&gt;
 ln -s media/mmcblk0p1/boot boot&lt;br /&gt;
&lt;br /&gt;
Now the mountpoints need fixing, so run:&lt;br /&gt;
&lt;br /&gt;
 apk add nano&lt;br /&gt;
 nano etc/fstab&lt;br /&gt;
&lt;br /&gt;
If you prefer some other editor (since people tend to become religious about these things) feel free to use whatever you want. Add the following line:&lt;br /&gt;
&lt;br /&gt;
 /dev/mmcblk0p1   /media/mmcblk0p1   vfat   defaults   0 0&lt;br /&gt;
&lt;br /&gt;
Now the kernel needs to know where the root filesystem is.&lt;br /&gt;
&lt;br /&gt;
 nano /media/mmcblk0p1/cmdline.txt&lt;br /&gt;
&lt;br /&gt;
Append the following at the end of the one and only line in the file:&lt;br /&gt;
&lt;br /&gt;
 root=/dev/mmcblk0p2&lt;br /&gt;
&lt;br /&gt;
After exiting nano, reboot:&lt;br /&gt;
&lt;br /&gt;
 reboot&lt;br /&gt;
&lt;br /&gt;
After rebooting, login using &amp;quot;root&amp;quot; as username, and the password you selected during setup-alpine earlier. Now you have a persistent system, as opposed to the way the original distro was configured.&lt;br /&gt;
&lt;br /&gt;
=== Tailoring for Remote Access ===&lt;br /&gt;
&lt;br /&gt;
OpenSSH should already be installed, but it will not allow remote root login. Initially, we&#039;ll relax this restriction. Last in this article is a section on hardening where we again disallow root login. If you intend to have this box accessible from the Internet, I strongly advise hardening the Pi.&lt;br /&gt;
&lt;br /&gt;
 nano /etc/ssh/sshd_config&lt;br /&gt;
&lt;br /&gt;
Uncomment and change the line (about 30 lines down) with PermitRootLogin to:&lt;br /&gt;
&lt;br /&gt;
 PermitRootLogin yes&lt;br /&gt;
&lt;br /&gt;
Then restart the service:&lt;br /&gt;
&lt;br /&gt;
 rc-service sshd restart&lt;br /&gt;
&lt;br /&gt;
Now you should be able to ssh to your Pi. The following steps are easier when you can cut and paste things into a terminal window.&lt;br /&gt;
&lt;br /&gt;
=== Keeping the Time ===&lt;br /&gt;
&lt;br /&gt;
If you selected chrony as your NTP client, it may take a long time for it to correct the clock. Since the Pi does not have a hardware clock, it’s necessary to have the correct time at bootup. We&#039;ll change the configuration such that the clock gets set if it is more than 60 seconds off during the first 10 lookups. &lt;br /&gt;
&lt;br /&gt;
 nano /etc/chrony/chrony.conf&lt;br /&gt;
&lt;br /&gt;
Add the following line at the bottom of the file.&lt;br /&gt;
&lt;br /&gt;
 makestep 60 10&lt;br /&gt;
&lt;br /&gt;
Check the date, restart the service, and check the (now hopefully corrected) date again.&lt;br /&gt;
&lt;br /&gt;
 date&lt;br /&gt;
 rc-service chronyd restart&lt;br /&gt;
 date&lt;br /&gt;
&lt;br /&gt;
Having the correct time is a good thing, particularly when building a job scheduling server.&lt;br /&gt;
&lt;br /&gt;
=== Silencing the Fan ===&lt;br /&gt;
&lt;br /&gt;
Together with the Pi, I also bought a fan, the Pimoroni Fan Shim. According to reviews it is one of the better ways to cool your Pi. Unless control software is installed, it runs at full speed. It’s not noisy, but still noticeable a meter from the Pi. Again, some tinkering will be needed since the control software needs some prerequisites installed. We lost nano between reboots, so we&#039;ll reinstall it.&lt;br /&gt;
&lt;br /&gt;
 apk update&lt;br /&gt;
 apk upgrade&lt;br /&gt;
 apk add nano&lt;br /&gt;
&lt;br /&gt;
Other software we need is in the “community” repositories of Alpine. In order to activate that repository, we need to edit a file:&lt;br /&gt;
&lt;br /&gt;
 nano /etc/apk/repositories&lt;br /&gt;
&lt;br /&gt;
Uncomment the second line (ending in v3.12/community), exit, then install the necessary packages.&lt;br /&gt;
&lt;br /&gt;
 apk update&lt;br /&gt;
 apk add git bash python3 python3-dev py3-pip py3-wheel build-base&lt;br /&gt;
&lt;br /&gt;
After those prerequisites are in place, install the fan shim software using:&lt;br /&gt;
&lt;br /&gt;
 git clone https://github.com/pimoroni/fanshim-python&lt;br /&gt;
 cd fanshim-python&lt;br /&gt;
 ./install.sh&lt;br /&gt;
 apk add py3-psutil&lt;br /&gt;
 cd examples&lt;br /&gt;
 ./install-service.sh&lt;br /&gt;
&lt;br /&gt;
The last script will fail with “systemctl: command not found”, since Alpine uses OpenRC as its init system, and not systemd which this script presumes.&lt;br /&gt;
We&#039;ll write our own startup script:&lt;br /&gt;
&lt;br /&gt;
 nano /etc/init.d/fanshim&lt;br /&gt;
&lt;br /&gt;
The new file should have the following contents:&lt;br /&gt;
&lt;br /&gt;
 #!/sbin/openrc-run&lt;br /&gt;
 name=&amp;quot;fanshim&amp;quot;&lt;br /&gt;
 command=&amp;quot;/usr/bin/python3 /root/fanshim-python/examples/automatic.py&amp;quot;&lt;br /&gt;
 command_args=&amp;quot;--on-threshold 65 --off-threshold 55 --delay 2&amp;quot;&lt;br /&gt;
 pidfile=&amp;quot;/var/run/$SVCNAME.pid&amp;quot;&lt;br /&gt;
 command_background=&amp;quot;yes&amp;quot;&lt;br /&gt;
&lt;br /&gt;
There are a lot of interesting options for fanshim you can explore, like tuning it’s RGB led. We want this to run at boot time, so add it the the default runlevel, then start it.&lt;br /&gt;
&lt;br /&gt;
 rc-update add fanshim default&lt;br /&gt;
 rc-service fanshim start&lt;br /&gt;
&lt;br /&gt;
Enjoy the silence!&lt;br /&gt;
&lt;br /&gt;
=== Adding and Sharing a Disk ===&lt;br /&gt;
&lt;br /&gt;
Some of files we&#039;ll be transferring are quite large. It would also be neat to be able to access files easily from the Finder in macOS, so I am adding a USB3 connected hard disk with 4TB storage. What follows will be very similar to setting up a NAS, and in fact, the way I fell in love with Alpine was by building my own NAS from scratch (with the minor differences being more disks and using zfs). &lt;br /&gt;
&lt;br /&gt;
First we need to change the filesystem. The disk comes formatted as FAT32, which is very poorly suited for a network disk. Samba, which is what we will be using for sharing, more or less requires a filesystem that supports extended attributes. After plugging in the drive, we will repartition the drive and format it to ext4. &lt;br /&gt;
&lt;br /&gt;
 cfdisk /dev/sda&lt;br /&gt;
&lt;br /&gt;
Using cfdisk, delete any existing partitions and create one new partition. It should become &amp;quot;Linux filesystem&amp;quot; by default. Don’t forget to &amp;quot;Write&amp;quot; before &amp;quot;Quit&amp;quot;ing. Next, format it:&lt;br /&gt;
&lt;br /&gt;
 mkfs.ext4 /dev/sda1&lt;br /&gt;
&lt;br /&gt;
Now we need to add autofs to get automatic mounting. This package is in edge/testing though, so we need to enable that branch and repository, but still have main and community take preference. This can be done by labelling a repository.&lt;br /&gt;
&lt;br /&gt;
 nano /etc/apk/repositories&lt;br /&gt;
&lt;br /&gt;
Change the line with the testing repository to the following. Note that yours will have some server.from.setup/path depending on what you selected in setup-alpine. You only uncomment and add the @testing label in other words.&lt;br /&gt;
&lt;br /&gt;
 @testing http://&amp;lt;server.from.setup/path&amp;gt;/edge/testing&lt;br /&gt;
&lt;br /&gt;
Now autofs can be installed from the labelled repo.&lt;br /&gt;
&lt;br /&gt;
 apk add autofs@testing&lt;br /&gt;
&lt;br /&gt;
Note that dependencies are still pulled from main/community to the extent it is possible. In order to configure autofs, first:&lt;br /&gt;
&lt;br /&gt;
 nano /etc/autofs/auto.master&lt;br /&gt;
&lt;br /&gt;
Add the following line after the uncommented line starting with /misc. It will also disconnect the hard disk after 5 minutes to save energy:&lt;br /&gt;
&lt;br /&gt;
 /-   /etc/autofs/auto.hdd   --timeout=300&lt;br /&gt;
&lt;br /&gt;
Then create this new config file:&lt;br /&gt;
&lt;br /&gt;
 nano /etc/autofs/auto.hdd&lt;br /&gt;
&lt;br /&gt;
Add the the following line to the empty file.&lt;br /&gt;
&lt;br /&gt;
 /hdd   -fstype=ext4   :/dev/sda1&lt;br /&gt;
&lt;br /&gt;
Now, the user pi needs to be created.&lt;br /&gt;
&lt;br /&gt;
 adduser pi&lt;br /&gt;
 smbpasswd -a pi&lt;br /&gt;
&lt;br /&gt;
Select passwords for the pi user. The latter one will later be stored in the macOS keychain and therefore easy to forget, so make note of it somewhere. &lt;br /&gt;
&lt;br /&gt;
Add autofs to startup and start it now. Change the ownership of /hdd to pi.&lt;br /&gt;
&lt;br /&gt;
 rc-update add autofs default&lt;br /&gt;
 rc-service autofs start&lt;br /&gt;
 chown -R pi.pi /hdd&lt;br /&gt;
&lt;br /&gt;
With that in place (disk can be accessed through /hdd) it is time to set up the sharing. For this we will use samba and avahi for network discovery.&lt;br /&gt;
&lt;br /&gt;
 apk add samba avahi dbus&lt;br /&gt;
 nano /etc/samba/smb.cfg&lt;br /&gt;
&lt;br /&gt;
Now, this is what my entire smb.cfg file looks like, with all the tweaks to get stuff running well from macOS.&lt;br /&gt;
&lt;br /&gt;
 [global]&lt;br /&gt;
  create mask = 0664&lt;br /&gt;
  directory mask = 0775&lt;br /&gt;
  veto files = /.DS_Store/lost+found/&lt;br /&gt;
  delete veto files = true&lt;br /&gt;
  nt acl support = no&lt;br /&gt;
  inherit acls = yes&lt;br /&gt;
  ea support = yes&lt;br /&gt;
  security = user&lt;br /&gt;
  passdb backend = tdbsam&lt;br /&gt;
  map to guest = Bad User&lt;br /&gt;
  vfs objects = catia fruit streams_xattr recycle&lt;br /&gt;
  acl_xattr:ignore system acls = yes&lt;br /&gt;
  recycle:repository = .recycle&lt;br /&gt;
  recycle:keeptree = yes&lt;br /&gt;
  recycle:versions = yes&lt;br /&gt;
  fruit:aapl = yes&lt;br /&gt;
  fruit:metadata = stream&lt;br /&gt;
  fruit:model = MacSamba&lt;br /&gt;
  fruit:veto_appledouble = yes&lt;br /&gt;
  fruit:posix_rename = yes &lt;br /&gt;
  fruit:zero_file_id = yes&lt;br /&gt;
  fruit:wipe_intentionally_left_blank_rfork = yes &lt;br /&gt;
  fruit:delete_empty_adfiles = yes &lt;br /&gt;
  server max protocol = SMB3&lt;br /&gt;
  server min protocol = SMB2&lt;br /&gt;
  workgroup = WORKGROUP    &lt;br /&gt;
  server string = NAS      &lt;br /&gt;
  server role = standalone server&lt;br /&gt;
  dns proxy = no&lt;br /&gt;
 [Harddisk]&lt;br /&gt;
  comment = Raspberry Pi Removable Harddisk                     &lt;br /&gt;
  path = /hdd    &lt;br /&gt;
  browseable = yes          &lt;br /&gt;
  writable = yes            &lt;br /&gt;
  spotlight = yes           &lt;br /&gt;
  valid users = pi       &lt;br /&gt;
  fruit:resource = xattr &lt;br /&gt;
  fruit:time machine = yes&lt;br /&gt;
  fruit:advertise_fullsync = true&lt;br /&gt;
&lt;br /&gt;
Those last two lines can be removed if you are not interested in using the disk as a Time Machine backup for your Apple devices. I will likely not use it, but since this is how I configured my NAS and it was a hassle to figure out how to get it working I thought I’d leave it here for reference. Doesn’t hurt to keep it there.&lt;br /&gt;
&lt;br /&gt;
Let us also configure the avahi-daemon, by creating a config file for the samba service. Avahi will announce the server using Bonjour, making them easily recognizable from macOS (where they automagically show up in the Finder). &lt;br /&gt;
&lt;br /&gt;
 nano /etc/avahi/services/samba.service&lt;br /&gt;
&lt;br /&gt;
This new file should have the following contents:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; standalone=&#039;no&#039;?&amp;gt;&lt;br /&gt;
 &amp;lt;!DOCTYPE service-group SYSTEM &amp;quot;avahi-service.dtd&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;service-group&amp;gt;&lt;br /&gt;
 &amp;lt;name replace-wildcards=&amp;quot;yes&amp;quot;&amp;gt;%h&amp;lt;/name&amp;gt;&lt;br /&gt;
 &amp;lt;service&amp;gt;&lt;br /&gt;
 &amp;lt;type&amp;gt;_smb._tcp&amp;lt;/type&amp;gt;&lt;br /&gt;
 &amp;lt;port&amp;gt;445&amp;lt;/port&amp;gt;&lt;br /&gt;
 &amp;lt;/service&amp;gt;&lt;br /&gt;
 &amp;lt;service&amp;gt;&lt;br /&gt;
 &amp;lt;type&amp;gt;_device-info._tcp&amp;lt;/type&amp;gt;&lt;br /&gt;
 &amp;lt;port&amp;gt;0&amp;lt;/port&amp;gt;&lt;br /&gt;
 &amp;lt;txt-record&amp;gt;model=RackMac&amp;lt;/txt-record&amp;gt;&lt;br /&gt;
 &amp;lt;/service&amp;gt;&lt;br /&gt;
 &amp;lt;service&amp;gt;&lt;br /&gt;
 &amp;lt;type&amp;gt;_adisk._tcp&amp;lt;/type&amp;gt;&lt;br /&gt;
 &amp;lt;txt-record&amp;gt;sys=waMa=0,adVF=0x100&amp;lt;/txt-record&amp;gt;&lt;br /&gt;
 &amp;lt;txt-record&amp;gt;dk0=adVN=HDD,adVF=0x82&amp;lt;/txt-record&amp;gt;&lt;br /&gt;
 &amp;lt;/service&amp;gt;&lt;br /&gt;
 &amp;lt;/service-group&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Not that the txt-record containing adVN=HDD can be removed if you are not interested in using the disk as a Time Machine backup. Still, leaving it won’t hurt.&lt;br /&gt;
&lt;br /&gt;
Finally, it’s time to add samba and avahi to the startup, and start the services.&lt;br /&gt;
&lt;br /&gt;
 rc-update add samba default&lt;br /&gt;
 rc-update add avahi-daemon default&lt;br /&gt;
 rc-service samba start&lt;br /&gt;
 rc-service avahi-daemon start&lt;br /&gt;
&lt;br /&gt;
The disk should now be visible from macOS. Remember to click “Connect as…” and enter “pi” as the username and your selected smbpasswd from earlier. Check the box “Remember this password in my keychain” for quicker access next time. Sometimes, due to a bug in Catalina, you may get “The original item cannot be found” when accessing the remote disk. If that happens, force quit Finder, and you should be good to go again. If anyone knows of any other fix to this issue, let me know!&lt;br /&gt;
&lt;br /&gt;
=== Automation ===&lt;br /&gt;
&lt;br /&gt;
This server will be used as a job server. Some of the jobs running will need the psql command from PostgreSQL and some others will be R jobs. Let’s install both, or whatever you need to satisfy your desire. You can skip this step for now if you are undecided about what to run or just need basic services like the built-in shell scripting.&lt;br /&gt;
&lt;br /&gt;
 apk add R postgresql&lt;br /&gt;
&lt;br /&gt;
In order to automate these jobs, we will be using Cronicle. It depends on node.js so we need to install the prerequisites. It’s run script is fetched using curl, so that will also need to be installed.&lt;br /&gt;
&lt;br /&gt;
 apk add nodejs npm curl&lt;br /&gt;
&lt;br /&gt;
The installation is done as follows (it is a oneliner even if it looks broken here).&lt;br /&gt;
&lt;br /&gt;
 curl -s https://raw.githubusercontent.com/jhuckaby/Cronicle/master/bin/install.js | node&lt;br /&gt;
&lt;br /&gt;
I want to use standard ports, so I had to change the config slightly.&lt;br /&gt;
&lt;br /&gt;
 nano /opt/cronicle/conf/config.json&lt;br /&gt;
&lt;br /&gt;
Change base_app_url from port 3012 to 80. Much further down, change http_port from 3012 to 80, and https_port from 3013 to 443. If you want mail to be sent, change smtp_hostname at the beginning of the file to the mail relay you are using. After that, an initialization script needs to be run.&lt;br /&gt;
&lt;br /&gt;
 /opt/cronicle/bin/control.sh setup&lt;br /&gt;
&lt;br /&gt;
We need to get it running at boot time. This is, however, a service that we do not want to “kill” using a PID, so we are going to enable local scripts that start and stop the service in a controlled manner instead.&lt;br /&gt;
&lt;br /&gt;
 rc-update add local default&lt;br /&gt;
 nano /etc/local.d/cronicle.start&lt;br /&gt;
&lt;br /&gt;
This new file should have the following line in it:&lt;br /&gt;
&lt;br /&gt;
 /opt/cronicle/bin/control.sh start&lt;br /&gt;
&lt;br /&gt;
Now we need to create a stop file as well:&lt;br /&gt;
&lt;br /&gt;
 nano /etc/local.d/cronicle.stop&lt;br /&gt;
&lt;br /&gt;
This file should have the contents:&lt;br /&gt;
&lt;br /&gt;
 /opt/cronicle/bin/control.sh stop&lt;br /&gt;
&lt;br /&gt;
In order for the local script daemon to run these, they need to be executable.&lt;br /&gt;
&lt;br /&gt;
 chmod +x /etc/local.d/cronicle.*&lt;br /&gt;
&lt;br /&gt;
With that, let’s secure things.&lt;br /&gt;
&lt;br /&gt;
=== Hardening ===&lt;br /&gt;
&lt;br /&gt;
Now that most configuring is done, it’s time to harden the Pi. First we will install a firewall with some basic login protection using the builtin &#039;limit&#039; in iptables. Assuming you are in the 192.168.1.0/24 range, which was set during setup-alpine, the following should be run. Only clients on the local network are allowed access to shared folders.&lt;br /&gt;
&lt;br /&gt;
 apk add ufw@testing&lt;br /&gt;
 rc-update add ufw default&lt;br /&gt;
 ufw allow 22&lt;br /&gt;
 ufw limit 22/tcp&lt;br /&gt;
 ufw allow 80&lt;br /&gt;
 ufw allow 443&lt;br /&gt;
 ufw allow from 192.168.1.0/24 to any app CIFS&lt;br /&gt;
 ufw allow Bonjour&lt;br /&gt;
&lt;br /&gt;
With the rules in place, it’s time to disallow root login via ssh, and make sure only fresh protocols are used.&lt;br /&gt;
&lt;br /&gt;
 nano /etc/ssh/sshd_config&lt;br /&gt;
&lt;br /&gt;
Change the line that previously said yes to no, and add the other lines at the bottom of the file (borrowed from this security site):&lt;br /&gt;
&lt;br /&gt;
 PermitRootLogin no&lt;br /&gt;
 PrintMotd no&lt;br /&gt;
 Protocol 2&lt;br /&gt;
 HostKey /etc/ssh/ssh_host_ed25519_key&lt;br /&gt;
 HostKey /etc/ssh/ssh_host_rsa_key&lt;br /&gt;
 KexAlgorithms curve25519-sha256@libssh.org,diffie-hellman-group-exchange-sha256&lt;br /&gt;
 Ciphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr&lt;br /&gt;
 MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,umac-128@openssh.com&lt;br /&gt;
&lt;br /&gt;
After that, enable ufw and restart sshd. Note: if something goes wrong here, you will need to plug in a monitor and keyboard again to login locally and fix things.&lt;br /&gt;
&lt;br /&gt;
 ufw enable&lt;br /&gt;
 rc-service sshd restart&lt;br /&gt;
&lt;br /&gt;
Now is a good time to reboot and reconnect to check that everything is working.&lt;br /&gt;
&lt;br /&gt;
 reboot&lt;br /&gt;
&lt;br /&gt;
With root not being able to login, you will instead login as &amp;quot;pi&amp;quot;. It is possible for this user to (temporarily, until exit) elevate privileges with the following command:&lt;br /&gt;
&lt;br /&gt;
 su&lt;br /&gt;
&lt;br /&gt;
Another option is to use sudo, but I will leave it like this for now, and go ahead with setting up some jobs. That’s a story for another article though.&lt;br /&gt;
&lt;br /&gt;
I hope this guide has been of help. It should be of use for anyone tinkering with Alpine on their Raspberries, and likely some parts for those running other Linux flavors on different hardware as well.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Raspberry]]&lt;/div&gt;</summary>
		<author><name>Mtbu</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Configure_Wake-on-LAN&amp;diff=19855</id>
		<title>Configure Wake-on-LAN</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Configure_Wake-on-LAN&amp;diff=19855"/>
		<updated>2021-07-16T16:28:55Z</updated>

		<summary type="html">&lt;p&gt;Mtbu: Add page to Category:Networking&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Configuring Wake-on-LAN is a simple process on Alpine Linux. First, check if your network card supports Wake-on-LAN (&#039;&#039;WOL&#039;&#039;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# apk add ethtool&lt;br /&gt;
# ethtool eth0 | grep -i wake&lt;br /&gt;
        Supports Wake-on: pumbg&lt;br /&gt;
        Wake-on: d&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Supports Wake-on: pumbg&#039;&#039; means that WOL is supported, &#039;&#039;Wake-on: d&#039;&#039; means that it is currently disabled. To enable it, edit &#039;&#039;/etc/network/interfaces&#039;&#039; as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
auto eth0&lt;br /&gt;
  pre-up /usr/sbin/ethtool -s eth0 wol g&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Reboot, and you should now be able to wake your machine from LAN. You can check if it is really enabled like so:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# ethtool eth0 | grep -i wake&lt;br /&gt;
        Supports Wake-on: pumbg&lt;br /&gt;
        Wake-on: g&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Wake-on: g&#039;&#039; means that it is now enabled.&lt;br /&gt;
&lt;br /&gt;
There are many tools that allow you to wake up the machine now that WOL is supported; https://github.com/sabhiram/go-wol is an excellent one.&lt;br /&gt;
&lt;br /&gt;
[[Category:Networking]]&lt;/div&gt;</summary>
		<author><name>Mtbu</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Setting_up_a_new_user&amp;diff=19853</id>
		<title>Setting up a new user</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Setting_up_a_new_user&amp;diff=19853"/>
		<updated>2021-07-16T16:02:11Z</updated>

		<summary type="html">&lt;p&gt;Mtbu: /* User creation and defaults */ Fix some typos&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
The &amp;lt;code&amp;gt;root&amp;lt;/code&amp;gt; account should be used only for local administrative purposes that require elevated access permissions.&lt;br /&gt;
&lt;br /&gt;
This page shows how to create non-privileged user accounts. i.e. those used for daily work, including desktop usage and remote logins.&lt;br /&gt;
&lt;br /&gt;
= Overview =&lt;br /&gt;
&lt;br /&gt;
Creating user accounts provides users their own $HOME directory and allows you (the root user) to limit the access those user accounts have to the operating system configuration files.&lt;br /&gt;
&lt;br /&gt;
Using them increases security, because they limit possible actions and thus possible damage (even from accidental errors).&lt;br /&gt;
&lt;br /&gt;
= Creating a new user =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Warning|If using a &#039;&#039;&#039;&amp;quot;diskless&amp;quot; or &amp;quot;data&amp;quot; disk mode&#039;&#039;&#039; installation, it&#039;s important to make the &amp;lt;code&amp;gt;/home&amp;lt;/code&amp;gt; directory persistent.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* Either the &amp;lt;code&amp;gt;/home&amp;lt;/code&amp;gt; filesystem needs to be mounted from a writable partition, or&lt;br /&gt;
* the /home directories have to be added to the lbu backup, and a new local backup needs to be committed after creating the user:&lt;br /&gt;
{{Cmd| # lbu include /home&lt;br /&gt;
 # lbu commit&lt;br /&gt;
}} (Not recommended, as reverting to an older .apkovl will also revert the files in /home).&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Regular user accounts can be created with:&lt;br /&gt;
{{Cmd|# adduser [-g &amp;quot;&amp;lt;Full Name&amp;gt;&amp;quot;] &amp;lt;username&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
By default, adduser will:&lt;br /&gt;
* prompt you to set a password for the new user&lt;br /&gt;
* create a home directory in {{Path|/home/&amp;lt;username&amp;gt;}}&lt;br /&gt;
* set the shell to the one used by the &amp;lt;code&amp;gt;root&amp;lt;/code&amp;gt; account (ash by default)&lt;br /&gt;
* assign user ID and group ID starting at 1000&lt;br /&gt;
* set the GECOS (full name) field to &amp;quot;Linux User,,,&amp;quot;&lt;br /&gt;
&lt;br /&gt;
{{Tip|The optional &amp;lt;code&amp;gt;-g &amp;quot;&amp;lt;Full Name&amp;gt;&amp;quot;&amp;lt;/code&amp;gt; above sets the GECOS field.&lt;br /&gt;
This can be very useful to specify. Setting this string - at least equal to the username - makes the user distinguishable, e.g. when they are listed at the login screen of a display manager.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Only&#039;&#039;&#039; if &amp;lt;code&amp;gt;elogind&amp;lt;/code&amp;gt; is not being used and running, then X users would need to be added to the video and input groups to be able to work with a graphical display.&lt;br /&gt;
 adduser &#039;UserName&#039; video&lt;br /&gt;
 adduser &#039;UserName&#039; input&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;If a user &#039;&#039;really must&#039;&#039; be allowed to have access to the root account&#039;&#039;&#039;, the &amp;lt;username&amp;gt; can be added to the wheel group, &amp;lt;code&amp;gt;doas&amp;lt;/code&amp;gt; (&amp;quot;do as&amp;quot;) may be installed, and the group &amp;quot;wheel&amp;quot; can be allowed to become root:&lt;br /&gt;
 adduser -g &amp;quot;&amp;lt;username&amp;gt;&amp;quot; &amp;lt;username&amp;gt;&lt;br /&gt;
 adduser &amp;lt;username&amp;gt; wheel&lt;br /&gt;
 apk add doas&lt;br /&gt;
 apk add nano&lt;br /&gt;
 nano /etc/doas.conf&lt;br /&gt;
&lt;br /&gt;
{{Warning|It&#039;s recommended to &#039;&#039;&#039;not&#039;&#039;&#039; run complete applications, like editors, as root just to modify administrative files.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* Many desktop environments and file browsers support using &amp;lt;code&amp;gt;admin:///&amp;lt;/code&amp;gt; in their address bars, to access files through a local gvfs-admin mount&lt;br /&gt;
* [https://github.com/AN3223/scripts/blob/master/doasedit &amp;lt;code&amp;gt;doasedit&amp;lt;/code&amp;gt;] or &amp;lt;code&amp;gt;sudoedit&amp;lt;/code&amp;gt; enables starting an editor with a temporary copy of a file, which overwrites the original file after the user modifies and saves it. For example, &amp;lt;code&amp;gt;sudoedit /etc/apk/lbu.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
The &amp;lt;code&amp;gt;sudo&amp;lt;/code&amp;gt; package is an alternative to using the BSD-like &amp;lt;code&amp;gt;doas&amp;lt;/code&amp;gt;, but is a much larger package.&lt;br /&gt;
It may be used as follows: adding a custom user configuration file to avoid having to deal with manually changing configuration files later during package upgrades.&lt;br /&gt;
 apk add sudo&lt;br /&gt;
 NEWUSER=&#039;yourUserName&#039;&lt;br /&gt;
 adduser -d &amp;quot;${NEWUSER}&amp;quot; $NEWUSER&lt;br /&gt;
 echo &amp;quot;$NEWUSER ALL=(ALL) ALL&amp;quot; &amp;gt; /etc/sudoers.d/$NEWUSER &amp;amp;&amp;amp; chmod 0440 /etc/sudoers.d/$NEWUSER&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The new user gets listed in &lt;br /&gt;
&lt;br /&gt;
{{Cat|/etc/passwd|root:x:0:0:root:/root:/bin/ash&lt;br /&gt;
.&lt;br /&gt;
.&lt;br /&gt;
.&lt;br /&gt;
&amp;lt;username&amp;gt;:x:1000:1000:Linux User,,,:/home/&amp;lt;username&amp;gt;:/bin/ash}}&lt;br /&gt;
&lt;br /&gt;
Now you should be able to issue the command &amp;lt;code&amp;gt;exit&amp;lt;/code&amp;gt; and login to the new account.&lt;br /&gt;
&lt;br /&gt;
= Options =&lt;br /&gt;
&lt;br /&gt;
=== adduser ===&lt;br /&gt;
&lt;br /&gt;
Usage (from &amp;quot;man busybox&amp;quot;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;adduser [OPTIONS] USER [GROUP]&lt;br /&gt;
&lt;br /&gt;
Create new user, or add USER to GROUP&lt;br /&gt;
&lt;br /&gt;
     -h --home DIR           Home directory&lt;br /&gt;
     -g --gecos GECOS        GECOS field&lt;br /&gt;
     -s --shell SHELL        Login shell named SHELL by example /bin/bash&lt;br /&gt;
     -G --ingroup GRP        Group (by name)&lt;br /&gt;
     -S --system             Create a system user&lt;br /&gt;
     -D --disabled-password  Don&#039;t assign a password, so cannot login&lt;br /&gt;
     -H --no-create-home     Don&#039;t create home directory&lt;br /&gt;
     -u --uid UID            User id&lt;br /&gt;
     -k SKEL                 Skeleton directory (/etc/skel)&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Tip|Multi-user collaboration&lt;br /&gt;
If &amp;lt;nowiki&amp;gt;--ingroup&amp;lt;/nowiki&amp;gt; isn&#039;t set, (default) the new user is assigned a new GID that matches the UID. If the GID corresponding to a provided UID already exists, adduser will fail.&lt;br /&gt;
&lt;br /&gt;
This ensures new users default to having a &amp;quot;user&#039;s private group&amp;quot; (UPG) as primary group. These allow the system to use a permission umask (002), which creates new files automatically as group-writable, but only by the user&#039;s private group. In special set-group-id (collaboration) directories, new files can be automatically created writable by the directory&#039;s group.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=== addgroup ===&lt;br /&gt;
&lt;br /&gt;
Usage (from &amp;quot;man busybox&amp;quot;): &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;addgroup [-g GID] [-S] [USER] GROUP&lt;br /&gt;
&lt;br /&gt;
Create a group or add a user to a group&lt;br /&gt;
&lt;br /&gt;
    -g --gid GID    Group id&lt;br /&gt;
    -s --system     Create a system group&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Legacy =&lt;br /&gt;
&lt;br /&gt;
=== Common permission groups ===&lt;br /&gt;
&lt;br /&gt;
(Taken from https://git.alpinelinux.org/alpine-baselayout/tree/group)&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;disk&#039;&#039;&#039;:x:6:root,adm  needed only for use vith virtual machines and access to other partitions.&lt;br /&gt;
* &#039;&#039;&#039;lp&#039;&#039;&#039;:x:7:lp  needed for printing services and printers management.&lt;br /&gt;
* &#039;&#039;&#039;wheel&#039;&#039;&#039;:x:10:root  Administrator group, members can use &amp;lt;code&amp;gt;sudo&amp;lt;/code&amp;gt; to run commands as root if enabled in the sudo configuration.&lt;br /&gt;
* &#039;&#039;&#039;floppy&#039;&#039;&#039;:x:11:root  Backward compatible group. Use only if access to special external devices is needed.&lt;br /&gt;
* &#039;&#039;&#039;audio&#039;&#039;&#039;:x:18:  Needed for audio listening and management of sound volume as normal user.&lt;br /&gt;
* &#039;&#039;&#039;cdrom&#039;&#039;&#039;:x:19:  For access to CD/DVD/BR writers and mounting DVD, BR or CD rom disk as normal user.&lt;br /&gt;
* &#039;&#039;&#039;dialout&#039;&#039;&#039;:x:20:root  Needed for dialing private connections and use of modems as normal user.&lt;br /&gt;
* &#039;&#039;&#039;tape&#039;&#039;&#039;:x:26:root  Needed if you&#039;re planning to use special devices for backup. Rare. Ususally used only on servers.&lt;br /&gt;
* &#039;&#039;&#039;video&#039;&#039;&#039;:x:27:root  For usage of cameras, more than one GPU special features, as normal user.&lt;br /&gt;
* &#039;&#039;&#039;netdev&#039;&#039;&#039;:x:28:  For network connections management as normal user.&lt;br /&gt;
* &#039;&#039;&#039;kvm&#039;&#039;&#039;:x:34:kvm Only if a normal user will manage virtual machines via a GUI. Rare. Ususally used only on servers.&lt;br /&gt;
* &#039;&#039;&#039;games&#039;&#039;&#039;:x:35:  Needed if you want to play games. Especially if sharing scores between users.&lt;br /&gt;
* &#039;&#039;&#039;cdrw&#039;&#039;&#039;:x:80:  Needed to write RW-DVD, RW-BR or RW-CD disk on a disk writing device.&lt;br /&gt;
* &#039;&#039;&#039;apache&#039;&#039;&#039;:x:81: Needed if you do development as normal user and want to publish locally on web server.&lt;br /&gt;
* &#039;&#039;&#039;usb&#039;&#039;&#039;:x:85: Needed to access to special usb devices. Deprecated group.&lt;br /&gt;
* &#039;&#039;&#039;users&#039;&#039;&#039;:x:100:games Needed if you plan to use common files for all users. Mandatory for desktop usage.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Old newbie notes =&lt;br /&gt;
&lt;br /&gt;
=== User creation and defaults ===&lt;br /&gt;
&lt;br /&gt;
The following commands will set up root environment login, then assign a new password:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
cat &amp;gt; /root/.cshrc &amp;lt;&amp;lt; EOF&lt;br /&gt;
unsetenv DISPLAY || true&lt;br /&gt;
HISTCONTROL=ignoreboth&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
cp /root/.cshrc /root/.profile&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;secret_new_root_password&amp;quot; | chpasswd&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By default, remote management cannot be done directly with the root account. Because of SSH security we need to set up a remote connection account that will be used to switch to the root user via the su command, once connected.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s an example: create user named &amp;quot;remote&amp;quot; and a user named &amp;quot;general&amp;quot;. We will set up a hardened, limited, user environment and create those two users:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
mkdir -p /etc/skel/&lt;br /&gt;
&lt;br /&gt;
cat &amp;gt; /etc/skel/.logout &amp;lt;&amp;lt; EOF&lt;br /&gt;
history -c&lt;br /&gt;
/bin/rm -f /opt/remote/.mysql_history&lt;br /&gt;
/bin/rm -f /opt/remote/.history&lt;br /&gt;
/bin/rm -f /opt/remote/.bash_history&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
cat &amp;gt; /etc/skel/.cshrc &amp;lt;&amp;lt; EOF&lt;br /&gt;
set autologout = 30&lt;br /&gt;
set prompt = &amp;quot;$ &amp;quot;&lt;br /&gt;
set history = 0&lt;br /&gt;
set ignoreeof&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
cp /etc/skel/.cshrc /etc/skel/.profile&lt;br /&gt;
&lt;br /&gt;
adduser -D --home /opt/remote --shell /bin/ash remote&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;secret_new_remote_user_password&amp;quot; | chpasswd&lt;br /&gt;
&lt;br /&gt;
adduser -D --shell /bin/bash general&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;secret_new_general_user_password&amp;quot; | chpasswd&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Tip|&amp;quot;&#039;&#039;&#039;general&#039;&#039;&#039;&amp;quot; is the name of the user. That name MUST contain ONLY lowercase letters, NO spaces and NO symbols}}&lt;br /&gt;
&lt;br /&gt;
Note that those users are created with minimal privilege settings.&lt;br /&gt;
&lt;br /&gt;
== User management and system access ==&lt;br /&gt;
&lt;br /&gt;
By default, a newly created user will not have enough privileges for most desktop purposes.&lt;br /&gt;
&lt;br /&gt;
To add newly created users to groups that may come in handy for desktop useage, you run this command as root:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
for u in $(ls /home); do for g in disk lp floppy audio cdrom dialout video netdev games users; do addgroup $u $g; done;done&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mtbu</name></author>
	</entry>
</feed>