<?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=Legale</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=Legale"/>
	<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/wiki/Special:Contributions/Legale"/>
	<updated>2026-05-02T06:17:40Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.40.0</generator>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Finding_the_fastest_mirror&amp;diff=31385</id>
		<title>Finding the fastest mirror</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Finding_the_fastest_mirror&amp;diff=31385"/>
		<updated>2025-11-04T10:39:25Z</updated>

		<summary type="html">&lt;p&gt;Legale: update mirrors url&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;After you install Alpine, you may be wondering how do I figure out the fastest mirror again?&lt;br /&gt;
&lt;br /&gt;
You could run &amp;lt;code&amp;gt;setup-apkrepos&amp;lt;/code&amp;gt; again.&lt;br /&gt;
&lt;br /&gt;
The following script shows the closest mirror for a single ping, which might not be accurate:&lt;br /&gt;
&lt;br /&gt;
{{Cat|/home/user/fastestmirror|&amp;lt;nowiki&amp;gt;&lt;br /&gt;
data=&amp;quot;&amp;quot;&lt;br /&gt;
for s in $(wget -qO- https://mirrors.alpinelinux.org/mirrors.txt); do&lt;br /&gt;
        t=$(time -f &amp;quot;%E&amp;quot; wget -q $s/MIRRORS.txt -O /dev/null 2&amp;gt;&amp;amp;1)&lt;br /&gt;
        echo &amp;quot;$s was $t&amp;quot;&lt;br /&gt;
        data=&amp;quot;$data$t $s\n&amp;quot;&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;===RESULTS===&amp;quot;&lt;br /&gt;
&lt;br /&gt;
echo -e $data | sort&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[How to setup a Alpine Linux mirror]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Package Manager]]&lt;/div&gt;</summary>
		<author><name>Legale</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Setting_up_a_Samba_server&amp;diff=21592</id>
		<title>Setting up a Samba server</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Setting_up_a_Samba_server&amp;diff=21592"/>
		<updated>2022-02-09T12:57:44Z</updated>

		<summary type="html">&lt;p&gt;Legale: /* Create smb.conf */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Installation =&lt;br /&gt;
Install packages:&lt;br /&gt;
{{Cmd|# apk add samba}}&lt;br /&gt;
&lt;br /&gt;
= Create a share directory =&lt;br /&gt;
This will be the directory that&#039;s shared to clients. You can create as many of these as you wish.&lt;br /&gt;
{{Cmd|# mkdir /media/storage}}&lt;br /&gt;
{{Cmd|# chmod 0777 /media/storage}}&lt;br /&gt;
&lt;br /&gt;
= Create smb.conf =&lt;br /&gt;
Alpine provides an example configuration file located at /etc/samba/smb.conf. The following is a simple example to get you up and running.&lt;br /&gt;
{{cat|/etc/samba/smb.conf|# /etc/samba/smb.conf&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
[global]&lt;br /&gt;
#to allow symlinks from everywhere&lt;br /&gt;
allow insecure wide links = yes &lt;br /&gt;
workgroup = WORKGROUP&lt;br /&gt;
dos charset = cp866&lt;br /&gt;
unix charset = utf-8&lt;br /&gt;
force user = username&lt;br /&gt;
&lt;br /&gt;
[storage]&lt;br /&gt;
# to follow symlinks&lt;br /&gt;
follow symlinks = yes  &lt;br /&gt;
# to allow symlinks from outside&lt;br /&gt;
wide links = yes       &lt;br /&gt;
browseable = yes&lt;br /&gt;
writeable = yes&lt;br /&gt;
path = /media/storage&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
{{note|For each directory share, you&#039;ll need to add a subsection to &#039;&#039;&#039;smb.conf&#039;&#039;&#039;}}&lt;br /&gt;
&lt;br /&gt;
= Create a system user and Samba user =&lt;br /&gt;
Create a user on the system. Create a Samba user. Give both users the same password.&lt;br /&gt;
{{Cmd|# adduser username}}&lt;br /&gt;
{{Cmd|# smbpasswd -a username}}&lt;br /&gt;
&lt;br /&gt;
= Configure the Samba service =&lt;br /&gt;
Run these two commands to start the service on boot and to start the service right now.&lt;br /&gt;
{{Cmd|# rc-update add samba}}&lt;br /&gt;
{{Cmd|# rc-service samba start}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Server]]&lt;br /&gt;
[[Category:Printers]]&lt;br /&gt;
[[Category:Authentication]]&lt;/div&gt;</summary>
		<author><name>Legale</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Setting_up_a_Samba_server&amp;diff=21591</id>
		<title>Setting up a Samba server</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Setting_up_a_Samba_server&amp;diff=21591"/>
		<updated>2022-02-09T12:56:35Z</updated>

		<summary type="html">&lt;p&gt;Legale: /* Create smb.conf */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Installation =&lt;br /&gt;
Install packages:&lt;br /&gt;
{{Cmd|# apk add samba}}&lt;br /&gt;
&lt;br /&gt;
= Create a share directory =&lt;br /&gt;
This will be the directory that&#039;s shared to clients. You can create as many of these as you wish.&lt;br /&gt;
{{Cmd|# mkdir /media/storage}}&lt;br /&gt;
{{Cmd|# chmod 0777 /media/storage}}&lt;br /&gt;
&lt;br /&gt;
= Create smb.conf =&lt;br /&gt;
Alpine provides an example configuration file located at /etc/samba/smb.conf. The following is a simple example to get you up and running.&lt;br /&gt;
{{cat|/etc/samba/smb.conf|# /etc/samba/smb.conf&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
 [global]&lt;br /&gt;
   #to allow symlinks from everywhere&lt;br /&gt;
   allow insecure wide links = yes &lt;br /&gt;
   workgroup = WORKGROUP&lt;br /&gt;
   dos charset = cp850&lt;br /&gt;
   unix charset = ISO-8859-1&lt;br /&gt;
   force user = username&lt;br /&gt;
 &lt;br /&gt;
 [storage]&lt;br /&gt;
   # to follow symlinks&lt;br /&gt;
   follow symlinks = yes  &lt;br /&gt;
   # to allow symlinks from outside&lt;br /&gt;
   wide links = yes       &lt;br /&gt;
   browseable = yes&lt;br /&gt;
   writeable = yes&lt;br /&gt;
   path = /media/storage&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
{{note|For each directory share, you&#039;ll need to add a subsection to &#039;&#039;&#039;smb.conf&#039;&#039;&#039;}}&lt;br /&gt;
&lt;br /&gt;
= Create a system user and Samba user =&lt;br /&gt;
Create a user on the system. Create a Samba user. Give both users the same password.&lt;br /&gt;
{{Cmd|# adduser username}}&lt;br /&gt;
{{Cmd|# smbpasswd -a username}}&lt;br /&gt;
&lt;br /&gt;
= Configure the Samba service =&lt;br /&gt;
Run these two commands to start the service on boot and to start the service right now.&lt;br /&gt;
{{Cmd|# rc-update add samba}}&lt;br /&gt;
{{Cmd|# rc-service samba start}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Server]]&lt;br /&gt;
[[Category:Printers]]&lt;br /&gt;
[[Category:Authentication]]&lt;/div&gt;</summary>
		<author><name>Legale</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Setting_up_a_Samba_server&amp;diff=21590</id>
		<title>Setting up a Samba server</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Setting_up_a_Samba_server&amp;diff=21590"/>
		<updated>2022-02-09T12:51:08Z</updated>

		<summary type="html">&lt;p&gt;Legale: /* Create smb.conf */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Installation =&lt;br /&gt;
Install packages:&lt;br /&gt;
{{Cmd|# apk add samba}}&lt;br /&gt;
&lt;br /&gt;
= Create a share directory =&lt;br /&gt;
This will be the directory that&#039;s shared to clients. You can create as many of these as you wish.&lt;br /&gt;
{{Cmd|# mkdir /media/storage}}&lt;br /&gt;
{{Cmd|# chmod 0777 /media/storage}}&lt;br /&gt;
&lt;br /&gt;
= Create smb.conf =&lt;br /&gt;
Alpine provides an example configuration file located at /etc/samba/smb.conf. The following is a simple example to get you up and running.&lt;br /&gt;
{{cat|/etc/samba/smb.conf|# /etc/samba/smb.conf&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
 [global]&lt;br /&gt;
   allow insecure wide links = yes #to allow symlinks from everywhere&lt;br /&gt;
   workgroup = WORKGROUP&lt;br /&gt;
   dos charset = cp850&lt;br /&gt;
   unix charset = ISO-8859-1&lt;br /&gt;
   force user = username&lt;br /&gt;
 &lt;br /&gt;
 [storage]&lt;br /&gt;
   follow symlinks = yes  # to follow symlinks&lt;br /&gt;
   wide links = yes       # to allow symlinks from outside&lt;br /&gt;
   browseable = yes&lt;br /&gt;
   writeable = yes&lt;br /&gt;
   path = /media/storage&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
{{note|For each directory share, you&#039;ll need to add a subsection to &#039;&#039;&#039;smb.conf&#039;&#039;&#039;}}&lt;br /&gt;
&lt;br /&gt;
= Create a system user and Samba user =&lt;br /&gt;
Create a user on the system. Create a Samba user. Give both users the same password.&lt;br /&gt;
{{Cmd|# adduser username}}&lt;br /&gt;
{{Cmd|# smbpasswd -a username}}&lt;br /&gt;
&lt;br /&gt;
= Configure the Samba service =&lt;br /&gt;
Run these two commands to start the service on boot and to start the service right now.&lt;br /&gt;
{{Cmd|# rc-update add samba}}&lt;br /&gt;
{{Cmd|# rc-service samba start}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Server]]&lt;br /&gt;
[[Category:Printers]]&lt;br /&gt;
[[Category:Authentication]]&lt;/div&gt;</summary>
		<author><name>Legale</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Openbox&amp;diff=20389</id>
		<title>Openbox</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Openbox&amp;diff=20389"/>
		<updated>2021-11-26T20:38:30Z</updated>

		<summary type="html">&lt;p&gt;Legale: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Initial setup =&lt;br /&gt;
Start by booting Alpine (see [[Installation|these]] instructions on how to do that)&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Enable Community Repository =&lt;br /&gt;
We need the Community Repository available for access to the OpenBox packages. Instructions are available on the [[Enable_Community_Repository|Enable Community Repository]] page.&lt;br /&gt;
&lt;br /&gt;
= Install packages =&lt;br /&gt;
Install openbox, xterm, and terminus font.&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# apk add openbox xterm terminus-font}}&lt;br /&gt;
&lt;br /&gt;
xterm is needed so you have a way to access the terminal in X. There are alternatives but this is the classic.&lt;br /&gt;
Terminus is needed because without any fonts, you will not be able to see any text in OpenBox.&lt;br /&gt;
&lt;br /&gt;
= Configure xorg-server =&lt;br /&gt;
On most systems, xorg should be able to autodetect all devices. However, you can still configure xorg-server manually by launching:&lt;br /&gt;
{{Cmd|# setup-xorg-base}}&lt;br /&gt;
&lt;br /&gt;
= Configure user =&lt;br /&gt;
To make Xorg work as normal user you need to add user to these groups: video, input.&lt;br /&gt;
{{Cmd|# addgroup &amp;lt;username&amp;gt; input}}&lt;br /&gt;
{{Cmd|# addgroup &amp;lt;username&amp;gt; video}}&lt;br /&gt;
&lt;br /&gt;
== acpid ==&lt;br /&gt;
If you installed your Alpine Linux as a VirtualBox or VMWare guest, you might find it handy to be able execute an ACPI shutdown.&amp;lt;BR&amp;gt;&lt;br /&gt;
{{Cmd|# rc-update add acpid}}&lt;br /&gt;
&lt;br /&gt;
= Set openbox as the default WM =&lt;br /&gt;
{{Cmd|$ echo &#039;exec openbox-session&#039; &amp;gt;&amp;gt; ~/.xinitrc}}&lt;br /&gt;
&lt;br /&gt;
= Copy the config files to your home folder = &lt;br /&gt;
{{Cmd|$ mkdir /home/&amp;lt;newuser&amp;gt;/.config}}&lt;br /&gt;
{{Cmd|$ cp -r /etc/xdg/openbox ~/.config}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; The default configuration is minimal and most menu options won&#039;t work unless you customize and/or install additional packages. More information is available in the [http://openbox.org/wiki/Help:Configuration OpenBox configuration documentation].&lt;br /&gt;
&lt;br /&gt;
= Edit openbox settings =&lt;br /&gt;
You can now edit the openbox settings for your user by editing the files located in&lt;br /&gt;
{{Cmd|~/.config/openbox}}&lt;br /&gt;
&lt;br /&gt;
The OpenBox configuration details can he studied on the [http://openbox.org/wiki/Help:Contents#Configuration OpenBox wiki]. &lt;br /&gt;
&lt;br /&gt;
= Start your X! =&lt;br /&gt;
{{Cmd|$ startx}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; The default OpenBox menu (right click on desktop) will have a lot of options that won&#039;t work because we didnt install anything else! Luckily XTerm will work if you added the package in the first step, and you can use that to add additional packages.&lt;br /&gt;
&lt;br /&gt;
The default configuration is minimal and most menu options won&#039;t work unless you customize and/or install additional packages. More information is available in the [http://openbox.org/wiki/Help:Configuration OpenBox configuration documentation].&lt;/div&gt;</summary>
		<author><name>Legale</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Openbox&amp;diff=20388</id>
		<title>Openbox</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Openbox&amp;diff=20388"/>
		<updated>2021-11-26T20:21:06Z</updated>

		<summary type="html">&lt;p&gt;Legale: /* Set openbox as the default WM */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Initial setup =&lt;br /&gt;
Start by booting Alpine (see [[Installation|these]] instructions on how to do that)&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Enable Community Repository =&lt;br /&gt;
We need the Community Repository available for access to the OpenBox packages. Instructions are available on the [[Enable_Community_Repository|Enable Community Repository]] page.&lt;br /&gt;
&lt;br /&gt;
= Install packages =&lt;br /&gt;
Install openbox, xterm, and terminus font.&amp;lt;BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# apk add openbox xterm terminus-font}}&lt;br /&gt;
&lt;br /&gt;
xterm is needed so you have a way to access the terminal in X. There are alternatives but this is the classic.&lt;br /&gt;
Terminus is needed because without any fonts, you will not be able to see any text in OpenBox.&lt;br /&gt;
&lt;br /&gt;
= Configure xorg-server =&lt;br /&gt;
On most systems, xorg should be able to autodetect all devices. However, you can still configure xorg-server manually by launching:&lt;br /&gt;
{{Cmd|# setup-xorg-base}}&lt;br /&gt;
&lt;br /&gt;
== acpid ==&lt;br /&gt;
If you installed your Alpine Linux as a VirtualBox or VMWare guest, you might find it handy to be able execute an ACPI shutdown.&amp;lt;BR&amp;gt;&lt;br /&gt;
{{Cmd|# rc-update add acpid}}&lt;br /&gt;
&lt;br /&gt;
= Set openbox as the default WM =&lt;br /&gt;
{{Cmd|$ echo &#039;exec openbox-session&#039; &amp;gt;&amp;gt; ~/.xinitrc}}&lt;br /&gt;
&lt;br /&gt;
= Copy the config files to your home folder = &lt;br /&gt;
{{Cmd|$ mkdir /home/&amp;lt;newuser&amp;gt;/.config}}&lt;br /&gt;
{{Cmd|$ cp -r /etc/xdg/openbox ~/.config}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; The default configuration is minimal and most menu options won&#039;t work unless you customize and/or install additional packages. More information is available in the [http://openbox.org/wiki/Help:Configuration OpenBox configuration documentation].&lt;br /&gt;
&lt;br /&gt;
= Edit openbox settings =&lt;br /&gt;
You can now edit the openbox settings for your user by editing the files located in&lt;br /&gt;
{{Cmd|~/.config/openbox}}&lt;br /&gt;
&lt;br /&gt;
The OpenBox configuration details can he studied on the [http://openbox.org/wiki/Help:Contents#Configuration OpenBox wiki]. &lt;br /&gt;
&lt;br /&gt;
= Start your X! =&lt;br /&gt;
{{Cmd|$ startx}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; The default OpenBox menu (right click on desktop) will have a lot of options that won&#039;t work because we didnt install anything else! Luckily XTerm will work if you added the package in the first step, and you can use that to add additional packages.&lt;br /&gt;
&lt;br /&gt;
The default configuration is minimal and most menu options won&#039;t work unless you customize and/or install additional packages. More information is available in the [http://openbox.org/wiki/Help:Configuration OpenBox configuration documentation].&lt;/div&gt;</summary>
		<author><name>Legale</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=20180</id>
		<title>Raspberry Pi</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=20180"/>
		<updated>2021-10-07T18:51:58Z</updated>

		<summary type="html">&lt;p&gt;Legale: /* Loopback image with overlayfs */&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;
{{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;
== 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>Legale</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=20179</id>
		<title>Raspberry Pi</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=20179"/>
		<updated>2021-10-07T18:51:27Z</updated>

		<summary type="html">&lt;p&gt;Legale: /* Loopback image with overlayfs */&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;
{{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;
== 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>Legale</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=20178</id>
		<title>Raspberry Pi</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=20178"/>
		<updated>2021-10-07T18:50:18Z</updated>

		<summary type="html">&lt;p&gt;Legale: /* Loopback image with overlayfs */&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;
{{Note|Overlay workdir needs to be an empty directory on the same filesystem mount as the upper directory. So each overlay should 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;
== 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>Legale</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=20177</id>
		<title>Raspberry Pi</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=20177"/>
		<updated>2021-10-07T18:48:59Z</updated>

		<summary type="html">&lt;p&gt;Legale: /* Loopback image with overlayfs */&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;
{{Note|Overlay workdir needs to be an empty directory on the same filesystem mount as the upper directory. So each overlay should 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 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;
== 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>Legale</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=20176</id>
		<title>Raspberry Pi</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=20176"/>
		<updated>2021-10-07T18:41:09Z</updated>

		<summary type="html">&lt;p&gt;Legale: /* Loopback image with overlayfs */&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_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 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;
== 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>Legale</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Wi-Fi&amp;diff=20173</id>
		<title>Wi-Fi</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Wi-Fi&amp;diff=20173"/>
		<updated>2021-10-06T15:11:03Z</updated>

		<summary type="html">&lt;p&gt;Legale: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This document describes how to set up a wireless network connection with WPA encryption.&lt;br /&gt;
&lt;br /&gt;
== Install necessary drivers and software  ==&lt;br /&gt;
&lt;br /&gt;
First make sure your wireless drivers are loaded properly. (if you are using a &#039;&#039;&#039;Broadcom chipset&#039;&#039;&#039;, see the [[#Broadcom_Wi-Fi_Chipset_Users|section at the bottom of this post]].)&lt;br /&gt;
&lt;br /&gt;
Install {{Pkg|wireless-tools}} and {{Pkg|wpa_supplicant}}, which are probably available to be installed in the base setup.&lt;br /&gt;
{{Cmd|apk add wireless-tools wpa_supplicant}}&lt;br /&gt;
&lt;br /&gt;
== Manual Configuration  ==&lt;br /&gt;
&lt;br /&gt;
List your available network interfaces. If you don&#039;t see any wireless interfaces (e.g. {{Path|wlan0}}), you probably need to load and/or install drivers/firmware.&lt;br /&gt;
{{Cmd|ip link}}&lt;br /&gt;
&lt;br /&gt;
Bring up the desired interface.&lt;br /&gt;
{{Cmd|ip link set wlan0 up}}&lt;br /&gt;
&lt;br /&gt;
{{Note|If this errors with &amp;lt;code&amp;gt;ioctl 0x8914 failed: No error information&amp;lt;/code&amp;gt;, that&#039;s &amp;lt;code&amp;gt;busybox ip&amp;lt;/code&amp;gt;&#039;s way of saying your wireless radio is rfkill&#039;d. See [https://wiki.archlinux.org/index.php/Wireless_network_configuration#Rfkill_caveat here] for information on how to unblock your wireless radio.&lt;br /&gt;
The base installation should have &amp;lt;code&amp;gt;busybox rfkill&amp;lt;/code&amp;gt; available.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Use the interface to scan for wireless access points. Make sure the ESSID you want to connect to appears here.&lt;br /&gt;
{{Cmd|iwlist wlan0 scanning}}&lt;br /&gt;
&lt;br /&gt;
Associate the interface with desired ESSID.&lt;br /&gt;
{{Cmd|iwconfig wlan0 essid ExampleWifi}}&lt;br /&gt;
&lt;br /&gt;
Sanity check: the interface should be configured with {{Path|ESSID:&amp;quot;ExampleWifi&amp;quot;}}.&lt;br /&gt;
{{Cmd|iwconfig wlan0}}&lt;br /&gt;
&lt;br /&gt;
Create a wpa_supplicant configuration stanza for the wireless access point.&lt;br /&gt;
{{Cmd|wpa_passphrase &#039;ExampleWifi&#039; &#039;ExampleWifiPassword&#039; &amp;gt; /etc/wpa_supplicant/wpa_supplicant.conf}}&lt;br /&gt;
&#039;&#039;(Access point not broadcasting its SSID requires additional line &amp;lt;code&amp;gt;scan_ssid=1&amp;lt;/code&amp;gt; in the file &amp;lt;code&amp;gt;wpa_supplicant.conf&amp;lt;/code&amp;gt;)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Start wpa_supplicant in the foreground to make sure the connection succeeds.&lt;br /&gt;
{{Cmd|wpa_supplicant -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf}}&lt;br /&gt;
&lt;br /&gt;
If all is well, run it as a daemon in the background by setting the {{Path|-B}} option.&lt;br /&gt;
{{Cmd|wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf}}&lt;br /&gt;
&lt;br /&gt;
Configure the interface with an IP address.&lt;br /&gt;
{{Cmd|udhcpc -i wlan0}}&lt;br /&gt;
&lt;br /&gt;
Sanity check: the interface should have an {{Path|inet}} address.&lt;br /&gt;
{{Cmd|ip addr show wlan0}}&lt;br /&gt;
&lt;br /&gt;
== Automatic Configuration on System Boot  ==&lt;br /&gt;
&lt;br /&gt;
Add a stanza for the desired interface (e.g. {{Path|wlan0}}) to {{Path|/etc/network/interfaces}}:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
auto wlan0&lt;br /&gt;
iface wlan0 inet dhcp&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make sure {{Path|/etc/wpa_supplicant/wpa_supplicant.conf}} is the correct configuration for the wireless access point you want to connect to.&lt;br /&gt;
&lt;br /&gt;
Bring the interface down.&lt;br /&gt;
&lt;br /&gt;
{{Cmd|ifconfig wlan0 down}}&lt;br /&gt;
&lt;br /&gt;
Manually start wpa_supplicant.&lt;br /&gt;
&lt;br /&gt;
{{Cmd|/etc/init.d/wpa_supplicant start}}&lt;br /&gt;
&lt;br /&gt;
If all is well (confirm with the sanity checks in [[#Manual_Configuration|Manual Configuration]]), configure wpa_supplicant to start automatically on boot.&lt;br /&gt;
&lt;br /&gt;
{{Cmd|rc-update add wpa_supplicant boot}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Launching udhcpc through wpa_cli actions ===&lt;br /&gt;
&lt;br /&gt;
With the above configuration, udhcpc will only run once at boot.&lt;br /&gt;
If the Wifi isn&#039;t available then, or the network changes in between, it needs to be notified.&lt;br /&gt;
This is done through the wpa_cli action script in /etc/wpa_supplicant/wpa_cli.sh&lt;br /&gt;
&lt;br /&gt;
== Automatic Reconnection when WIFI signal is lost  ==&lt;br /&gt;
To enable automatic reconnection when wifi signal is lost add these to config:&lt;br /&gt;
&lt;br /&gt;
{{Cat|/etc/wpa_supplicant/wpa_supplicant.conf|&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
ap_scan=1&lt;br /&gt;
autoscan=periodic:10&lt;br /&gt;
disable_scan_offload=1&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cmd|rc-update add wpa_cli boot}}&lt;br /&gt;
&lt;br /&gt;
== Broadcom Wi-Fi Chipset Users  ==&lt;br /&gt;
&lt;br /&gt;
The Broadcom chipset is quite popular among older computers. You will need to compile the firmware manually for this chipset as it is not included. &lt;br /&gt;
&lt;br /&gt;
You can check if you have a Broadcom chipset by using dmesg:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|dmesg {{!}} grep Broadcom}}&lt;br /&gt;
&lt;br /&gt;
First install the SDK and Git:&lt;br /&gt;
{{Cmd|apk add alpine-sdk git}}&lt;br /&gt;
&lt;br /&gt;
Then git clone aports from git.alpinelinux.org.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cmd|git clone git://git.alpinelinux.org/aports}}&lt;br /&gt;
&lt;br /&gt;
Change your directory to &#039;&#039;&#039;aports/non-free/b43-firmware&#039;&#039;&#039;, then build it.&lt;br /&gt;
&lt;br /&gt;
{{Tip|You can&#039;t be root and must be a user of the group abuild (use groupadd f.e. &#039;&#039;&#039;addgroup $(whoami) abuild&#039;&#039;&#039;)}}&lt;br /&gt;
{{Tip|If this is your first time building a package you will need to generate a key for use in signing packages (use &#039;&#039;&#039;abuild-keygen -a -i&#039;&#039;&#039;)}}&lt;br /&gt;
&lt;br /&gt;
{{Cmd|abuild -r}}&lt;br /&gt;
&lt;br /&gt;
Install the generated packge file (it will be in ~/packages/) - make sure to pass &#039;&#039;&#039;--allow-untrusted&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk add --allow-untrusted ~/packages/...pkg}}&lt;br /&gt;
&lt;br /&gt;
Now we need fwcutter, which is executed from the firmware package:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk add b43-fwcutter b43-firmware}}&lt;br /&gt;
&lt;br /&gt;
Now you need to use modprobe so the device will show up:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|modprobe b43}}&lt;br /&gt;
&lt;br /&gt;
To automate this on startup add it to /etc/modules:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|echo b43 &amp;gt;&amp;gt; /etc/modules}}&lt;br /&gt;
&lt;br /&gt;
Now continue with the normal instructions. &lt;br /&gt;
&lt;br /&gt;
[[Category:Networking]]&lt;/div&gt;</summary>
		<author><name>Legale</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Wi-Fi&amp;diff=20172</id>
		<title>Wi-Fi</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Wi-Fi&amp;diff=20172"/>
		<updated>2021-10-06T15:01:17Z</updated>

		<summary type="html">&lt;p&gt;Legale: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This document describes how to set up a wireless network connection with WPA encryption.&lt;br /&gt;
&lt;br /&gt;
== Install necessary drivers and software  ==&lt;br /&gt;
&lt;br /&gt;
First make sure your wireless drivers are loaded properly. (if you are using a &#039;&#039;&#039;Broadcom chipset&#039;&#039;&#039;, see the [[#Broadcom_Wi-Fi_Chipset_Users|section at the bottom of this post]].)&lt;br /&gt;
&lt;br /&gt;
Install {{Pkg|wireless-tools}} and {{Pkg|wpa_supplicant}}, which are probably available to be installed in the base setup.&lt;br /&gt;
{{Cmd|apk add wireless-tools wpa_supplicant}}&lt;br /&gt;
&lt;br /&gt;
== Manual Configuration  ==&lt;br /&gt;
&lt;br /&gt;
List your available network interfaces. If you don&#039;t see any wireless interfaces (e.g. {{Path|wlan0}}), you probably need to load and/or install drivers/firmware.&lt;br /&gt;
{{Cmd|ip link}}&lt;br /&gt;
&lt;br /&gt;
Bring up the desired interface.&lt;br /&gt;
{{Cmd|ip link set wlan0 up}}&lt;br /&gt;
&lt;br /&gt;
{{Note|If this errors with &amp;lt;code&amp;gt;ioctl 0x8914 failed: No error information&amp;lt;/code&amp;gt;, that&#039;s &amp;lt;code&amp;gt;busybox ip&amp;lt;/code&amp;gt;&#039;s way of saying your wireless radio is rfkill&#039;d. See [https://wiki.archlinux.org/index.php/Wireless_network_configuration#Rfkill_caveat here] for information on how to unblock your wireless radio.&lt;br /&gt;
The base installation should have &amp;lt;code&amp;gt;busybox rfkill&amp;lt;/code&amp;gt; available.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Use the interface to scan for wireless access points. Make sure the ESSID you want to connect to appears here.&lt;br /&gt;
{{Cmd|iwlist wlan0 scanning}}&lt;br /&gt;
&lt;br /&gt;
Associate the interface with desired ESSID.&lt;br /&gt;
{{Cmd|iwconfig wlan0 essid ExampleWifi}}&lt;br /&gt;
&lt;br /&gt;
Sanity check: the interface should be configured with {{Path|ESSID:&amp;quot;ExampleWifi&amp;quot;}}.&lt;br /&gt;
{{Cmd|iwconfig wlan0}}&lt;br /&gt;
&lt;br /&gt;
Create a wpa_supplicant configuration stanza for the wireless access point.&lt;br /&gt;
{{Cmd|wpa_passphrase &#039;ExampleWifi&#039; &#039;ExampleWifiPassword&#039; &amp;gt; /etc/wpa_supplicant/wpa_supplicant.conf}}&lt;br /&gt;
&#039;&#039;(Access point not broadcasting its SSID requires additional line &amp;lt;code&amp;gt;scan_ssid=1&amp;lt;/code&amp;gt; in the file &amp;lt;code&amp;gt;wpa_supplicant.conf&amp;lt;/code&amp;gt;)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Start wpa_supplicant in the foreground to make sure the connection succeeds.&lt;br /&gt;
{{Cmd|wpa_supplicant -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf}}&lt;br /&gt;
&lt;br /&gt;
If all is well, run it as a daemon in the background by setting the {{Path|-B}} option.&lt;br /&gt;
{{Cmd|wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf}}&lt;br /&gt;
&lt;br /&gt;
Configure the interface with an IP address.&lt;br /&gt;
{{Cmd|udhcpc -i wlan0}}&lt;br /&gt;
&lt;br /&gt;
Sanity check: the interface should have an {{Path|inet}} address.&lt;br /&gt;
{{Cmd|ip addr show wlan0}}&lt;br /&gt;
&lt;br /&gt;
== Automatic Configuration on System Boot  ==&lt;br /&gt;
&lt;br /&gt;
Add a stanza for the desired interface (e.g. {{Path|wlan0}}) to {{Path|/etc/network/interfaces}}:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
auto wlan0&lt;br /&gt;
iface wlan0 inet dhcp&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make sure {{Path|/etc/wpa_supplicant/wpa_supplicant.conf}} is the correct configuration for the wireless access point you want to connect to.&lt;br /&gt;
&lt;br /&gt;
Bring the interface down.&lt;br /&gt;
&lt;br /&gt;
{{Cmd|ifconfig wlan0 down}}&lt;br /&gt;
&lt;br /&gt;
Manually start wpa_supplicant.&lt;br /&gt;
&lt;br /&gt;
{{Cmd|/etc/init.d/wpa_supplicant start}}&lt;br /&gt;
&lt;br /&gt;
If all is well (confirm with the sanity checks in [[#Manual_Configuration|Manual Configuration]]), configure wpa_supplicant to start automatically on boot.&lt;br /&gt;
&lt;br /&gt;
{{Cmd|rc-update add wpa_supplicant boot}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Launching udhcpc through wpa_cli actions ===&lt;br /&gt;
&lt;br /&gt;
With the above configuration, udhcpc will only run once at boot.&lt;br /&gt;
If the Wifi isn&#039;t available then, or the network changes in between, it needs to be notified.&lt;br /&gt;
This is done through the wpa_cli action script in /etc/wpa_supplicant/wpa_cli.sh&lt;br /&gt;
&lt;br /&gt;
== Automatic Reconnection when WIFI signal is lost  ==&lt;br /&gt;
`/etc/wpa_supplicant/wpa_supplicant.conf`&lt;br /&gt;
&lt;br /&gt;
To enable automatic reconnection when wifi signal is lost add these to config:&lt;br /&gt;
```&lt;br /&gt;
ap_scan=1&lt;br /&gt;
disable_scan_offload=1&lt;br /&gt;
```&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cmd|rc-update add wpa_cli boot}}&lt;br /&gt;
&lt;br /&gt;
== Broadcom Wi-Fi Chipset Users  ==&lt;br /&gt;
&lt;br /&gt;
The Broadcom chipset is quite popular among older computers. You will need to compile the firmware manually for this chipset as it is not included. &lt;br /&gt;
&lt;br /&gt;
You can check if you have a Broadcom chipset by using dmesg:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|dmesg {{!}} grep Broadcom}}&lt;br /&gt;
&lt;br /&gt;
First install the SDK and Git:&lt;br /&gt;
{{Cmd|apk add alpine-sdk git}}&lt;br /&gt;
&lt;br /&gt;
Then git clone aports from git.alpinelinux.org.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cmd|git clone git://git.alpinelinux.org/aports}}&lt;br /&gt;
&lt;br /&gt;
Change your directory to &#039;&#039;&#039;aports/non-free/b43-firmware&#039;&#039;&#039;, then build it.&lt;br /&gt;
&lt;br /&gt;
{{Tip|You can&#039;t be root and must be a user of the group abuild (use groupadd f.e. &#039;&#039;&#039;addgroup $(whoami) abuild&#039;&#039;&#039;)}}&lt;br /&gt;
{{Tip|If this is your first time building a package you will need to generate a key for use in signing packages (use &#039;&#039;&#039;abuild-keygen -a -i&#039;&#039;&#039;)}}&lt;br /&gt;
&lt;br /&gt;
{{Cmd|abuild -r}}&lt;br /&gt;
&lt;br /&gt;
Install the generated packge file (it will be in ~/packages/) - make sure to pass &#039;&#039;&#039;--allow-untrusted&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk add --allow-untrusted ~/packages/...pkg}}&lt;br /&gt;
&lt;br /&gt;
Now we need fwcutter, which is executed from the firmware package:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk add b43-fwcutter b43-firmware}}&lt;br /&gt;
&lt;br /&gt;
Now you need to use modprobe so the device will show up:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|modprobe b43}}&lt;br /&gt;
&lt;br /&gt;
To automate this on startup add it to /etc/modules:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|echo b43 &amp;gt;&amp;gt; /etc/modules}}&lt;br /&gt;
&lt;br /&gt;
Now continue with the normal instructions. &lt;br /&gt;
&lt;br /&gt;
[[Category:Networking]]&lt;/div&gt;</summary>
		<author><name>Legale</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Finding_the_fastest_mirror&amp;diff=20145</id>
		<title>Finding the fastest mirror</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Finding_the_fastest_mirror&amp;diff=20145"/>
		<updated>2021-09-27T08:28:23Z</updated>

		<summary type="html">&lt;p&gt;Legale: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;After you install Alpine, you may be wondering how do I figure out the fastest mirror again?&lt;br /&gt;
&lt;br /&gt;
{{Cat|/home/user/fastestmirror|&amp;lt;nowiki&amp;gt;&lt;br /&gt;
data=&amp;quot;&amp;quot;&lt;br /&gt;
for s in $(wget -qO- http://rsync.alpinelinux.org/alpine/MIRRORS.txt); do&lt;br /&gt;
        t=$(time -f &amp;quot;%E&amp;quot; wget -q $s/MIRRORS.txt -O /dev/null 2&amp;gt;&amp;amp;1)&lt;br /&gt;
        echo &amp;quot;$s was $t&amp;quot;&lt;br /&gt;
        data=&amp;quot;$data$t $s\n&amp;quot;&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;===RESULTS===&amp;quot;&lt;br /&gt;
&lt;br /&gt;
echo -e $data | sort&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is more advanced implementation.&lt;br /&gt;
{{Cat|/etc/apk/fastest-mirror|&amp;lt;nowiki&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
get_hostname_url() {&lt;br /&gt;
  local n=${1#*://}&lt;br /&gt;
  echo ${n%%/*}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
time_cmd() {&lt;br /&gt;
  local proc=$(cut -d &#039; &#039; -f1 /proc/uptime)&lt;br /&gt;
  local start=&amp;quot;$(echo $proc | cut -d . -f1)$(echo $proc | cut -d . -f2)&amp;quot;&lt;br /&gt;
  $@ &amp;gt;/dev/null 2&amp;gt;&amp;amp;1 || return&lt;br /&gt;
  proc=$(cut -d &#039; &#039; -f1 /proc/uptime)&lt;br /&gt;
  local end=&amp;quot;$(echo $proc | cut -d . -f1)$(echo $proc | cut -d . -f2)&amp;quot; &lt;br /&gt;
  echo $(( $end - $start  ))&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
DATA=&amp;quot;&amp;quot;&lt;br /&gt;
MIRRORS=$(wget -qO- &amp;quot;http://rsync.alpinelinux.org/alpine/MIRRORS.txt&amp;quot;)&lt;br /&gt;
DST=/etc/apk/mirrors.txt&lt;br /&gt;
&lt;br /&gt;
#find best&lt;br /&gt;
for URL in $MIRRORS; do&lt;br /&gt;
	TIME=$(time_cmd wget -T 1 -q ${URL%/} -O /dev/null)&lt;br /&gt;
	if [ -n &amp;quot;$TIME&amp;quot; ]; then	&lt;br /&gt;
		echo &amp;quot;$(get_hostname_url $URL) was $TIME&amp;quot;&lt;br /&gt;
		DATA=&amp;quot;$DATA$TIME $URL\n&amp;quot;&lt;br /&gt;
	fi&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
echo -e $DATA | sort -n | tail -n +2 &amp;gt; $DST&lt;br /&gt;
[ $? = 0 ] &amp;amp;&amp;amp; echo file $DST created&lt;br /&gt;
&lt;br /&gt;
BEST=$(head -n1 $DST | cut -d &#039; &#039; -f2)&lt;br /&gt;
echo &amp;quot;Best mirror is: $BEST&amp;quot;&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s#^http.+/(.+/main)#&#039;${BEST%/}&#039;/\1#&#039; /etc/apk/repositories&lt;br /&gt;
sed -i -r &#039;s#^http.+/(.+/community)#&#039;${BEST%/}&#039;/\1#&#039; /etc/apk/repositories&lt;br /&gt;
sed -i -r &#039;s#^http.+/(.+/testing)#&#039;${BEST%/}&#039;/\1#&#039; /etc/apk/repositories&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Package Manager]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Package Manager]]&lt;/div&gt;</summary>
		<author><name>Legale</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Finding_the_fastest_mirror&amp;diff=20144</id>
		<title>Finding the fastest mirror</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Finding_the_fastest_mirror&amp;diff=20144"/>
		<updated>2021-09-26T22:14:09Z</updated>

		<summary type="html">&lt;p&gt;Legale: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;After you install Alpine, you may be wondering how do I figure out the fastest mirror again?&lt;br /&gt;
&lt;br /&gt;
{{Cat|/home/user/fastestmirror|&amp;lt;nowiki&amp;gt;&lt;br /&gt;
data=&amp;quot;&amp;quot;&lt;br /&gt;
for s in $(wget -qO- http://rsync.alpinelinux.org/alpine/MIRRORS.txt); do&lt;br /&gt;
        t=$(time -f &amp;quot;%E&amp;quot; wget -q $s/MIRRORS.txt -O /dev/null 2&amp;gt;&amp;amp;1)&lt;br /&gt;
        echo &amp;quot;$s was $t&amp;quot;&lt;br /&gt;
        data=&amp;quot;$data$t $s\n&amp;quot;&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;===RESULTS===&amp;quot;&lt;br /&gt;
&lt;br /&gt;
echo -e $data | sort&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is more advanced implementation.&lt;br /&gt;
{{Cat|/etc/apk/fastest-mirror|&amp;lt;nowiki&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
get_hostname_url() {&lt;br /&gt;
  local n=${1#*://}&lt;br /&gt;
  echo ${n%%/*}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
time_cmd() {&lt;br /&gt;
  local proc=$(cut -d &#039; &#039; -f1 /proc/uptime)&lt;br /&gt;
  local start=&amp;quot;$(echo $proc | cut -d . -f1)$(echo $proc | cut -d . -f2)&amp;quot;&lt;br /&gt;
  $@ &amp;gt;/dev/null 2&amp;gt;&amp;amp;1 || return&lt;br /&gt;
  proc=$(cut -d &#039; &#039; -f1 /proc/uptime)&lt;br /&gt;
  local end=&amp;quot;$(echo $proc | cut -d . -f1)$(echo $proc | cut -d . -f2)&amp;quot; &lt;br /&gt;
  echo $(( $end - $start  ))&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
DATA=&amp;quot;&amp;quot;&lt;br /&gt;
MIRRORS=$(wget -qO- &amp;quot;http://rsync.alpinelinux.org/alpine/MIRRORS.txt&amp;quot;)&lt;br /&gt;
DST=/etc/apk/mirrors.txt&lt;br /&gt;
&lt;br /&gt;
#find best&lt;br /&gt;
for URL in $MIRRORS; do&lt;br /&gt;
	TIME=$(time_cmd wget -T 1 -q ${URL%/} -O /dev/null)&lt;br /&gt;
	if [ -n &amp;quot;$TIME&amp;quot; ]; then	&lt;br /&gt;
		echo &amp;quot;$(get_hostname_url $URL) was $TIME&amp;quot;&lt;br /&gt;
		DATA=&amp;quot;$DATA$TIME $URL\n&amp;quot;&lt;br /&gt;
	fi&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
echo -e $DATA | sort -n | tail -n +2 &amp;gt; $DST&lt;br /&gt;
$? &amp;amp;&amp;amp; echo file $DST created&lt;br /&gt;
&lt;br /&gt;
BEST=$(head -n1 $DST | cut -d &#039; &#039; -f2)&lt;br /&gt;
echo &amp;quot;Best mirror is: $BEST&amp;quot;&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s#^http.+/(.+/main)#&#039;${BEST%/}&#039;/\1#&#039; /etc/apk/repositories&lt;br /&gt;
sed -i -r &#039;s#^http.+/(.+/community)#&#039;${BEST%/}&#039;/\1#&#039; /etc/apk/repositories&lt;br /&gt;
sed -i -r &#039;s#^http.+/(.+/testing)#&#039;${BEST%/}&#039;/\1#&#039; /etc/apk/repositories&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Package Manager]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Package Manager]]&lt;/div&gt;</summary>
		<author><name>Legale</name></author>
	</entry>
</feed>