<?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=Bogon</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=Bogon"/>
	<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/wiki/Special:Contributions/Bogon"/>
	<updated>2026-05-02T11:02:33Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.40.0</generator>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Release_Notes_for_Alpine_3.13.0&amp;diff=18324</id>
		<title>Release Notes for Alpine 3.13.0</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Release_Notes_for_Alpine_3.13.0&amp;diff=18324"/>
		<updated>2020-12-21T17:26:01Z</updated>

		<summary type="html">&lt;p&gt;Bogon: /* Removed applets */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== aports ==&lt;br /&gt;
&lt;br /&gt;
===== musl upgrade to 1.2 =====&lt;br /&gt;
&lt;br /&gt;
musl has been upgraded to 1.2. This release changes the definition of &amp;lt;code&amp;gt;time_t&amp;lt;/code&amp;gt; on 32-bits systems (affecting x86, armv7 and armhf on Alpine Linux). See the [https://musl.libc.org/time64.html time64 release notes] for more details.&lt;br /&gt;
&lt;br /&gt;
===== Deprecation of berkley db =====&lt;br /&gt;
&lt;br /&gt;
Oracle has changed the license of bdb to AGPL, making it unsuitable to link it to packages with a GPG incompatible license. This means we decided to remove the package from aports and fix all dependent packages.&lt;br /&gt;
&lt;br /&gt;
For postfix, this means using lmdb and dropping support for &amp;lt;code&amp;gt;hash&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;btree&amp;lt;/code&amp;gt; databases. Before upgrading, update all references of these types in &amp;lt;code&amp;gt;/etc/postfix/main.cf&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;lmdb&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Switching from busybox ifupdown to ifupdown-ng =====&lt;br /&gt;
&lt;br /&gt;
Alpine Linux switched from the busybox ifupdown to [https://github.com/ifupdown-ng/ifupdown-ng/ ifupdown-ng] as default implementation. This version is compatible with debian ifupdown and busybox ifupdown, but please read the [https://github.com/ifupdown-ng/ifupdown-ng/blob/master/README.md readme] and the [https://github.com/ifupdown-ng/ifupdown-ng/blob/master/doc/ADMIN-GUIDE.md admin guide].&lt;br /&gt;
&lt;br /&gt;
===== GCC10 =====&lt;br /&gt;
&lt;br /&gt;
GCC has been updated to version 10. Noteworthy changes are two options that are enabled by default now: &amp;lt;code&amp;gt;-fno-common&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;-fstrict-aliasing&amp;lt;/code&amp;gt;, which may cause build issues for projects that have not been fixed yet.&lt;br /&gt;
&lt;br /&gt;
== busybox ==&lt;br /&gt;
&lt;br /&gt;
=== Removed applets ===&lt;br /&gt;
&lt;br /&gt;
These applets are -- presumably -- rarely used and/or better served using the full version.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;hdparm&#039;&#039;&#039;: Provided by the &amp;lt;code&amp;gt;hdparm&amp;lt;/code&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;conspy&amp;lt;sup&amp;gt;*&amp;lt;/sup&amp;gt;&#039;&#039;&#039;:&lt;br /&gt;
* &#039;&#039;&#039;fdformat&#039;&#039;&#039;: Provided by &amp;lt;code&amp;gt;util-linux&amp;lt;/code&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;readprofile&#039;&#039;&#039;: Provided by &amp;lt;code&amp;gt;util-linux&amp;lt;/code&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;lspci&#039;&#039;&#039;: Provided by &amp;lt;code&amp;gt;pciutils&amp;lt;/code&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;sendmail&#039;&#039;&#039;: Provided by &amp;lt;code&amp;gt;ssmtp&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;opensmtpd&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;dma&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;exim&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;nullmailer&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;postfix&amp;lt;/code&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;smemcap&amp;lt;sup&amp;gt;*&amp;lt;/sup&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
* &#039;&#039;&#039;dumpleases&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;sup&amp;gt;*&amp;lt;/sup&amp;gt;There are currently no alternative packages available, but they can be packaged on request.&lt;br /&gt;
&lt;br /&gt;
=== Changes ===&lt;br /&gt;
&lt;br /&gt;
The following applets now support long-form options:&lt;br /&gt;
&lt;br /&gt;
* gzip&lt;br /&gt;
* install&lt;br /&gt;
* ipcalc&lt;br /&gt;
&lt;br /&gt;
== apk-tools ==&lt;br /&gt;
&lt;br /&gt;
===== Man page =====&lt;br /&gt;
&lt;br /&gt;
apk-tools now has an official man-page. You can install it with &amp;lt;code&amp;gt;apk add apk-tools-docs&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;apk add docs&amp;lt;/code&amp;gt; to automatically install all man pages for installed packages.&lt;/div&gt;</summary>
		<author><name>Bogon</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Setting_Up_Lighttpd_With_FastCGI&amp;diff=18103</id>
		<title>Setting Up Lighttpd With FastCGI</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Setting_Up_Lighttpd_With_FastCGI&amp;diff=18103"/>
		<updated>2020-10-15T02:09:16Z</updated>

		<summary type="html">&lt;p&gt;Bogon: /* Configure Lighttpd */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;For installing the additional packages first activate community packages:&lt;br /&gt;
{{Cmd|vi /etc/apk/repositories}}&lt;br /&gt;
Uncomment the following:&lt;br /&gt;
{{Cmd|http://pkg.example.com/alpine/v3.11/community}}&lt;br /&gt;
&lt;br /&gt;
Update the packagelist:&lt;br /&gt;
{{Cmd|apk update}}&lt;br /&gt;
&lt;br /&gt;
Install the additional packages:&lt;br /&gt;
{{Cmd|apk add lighttpd php7-common php7-iconv php7-json php7-gd php7-curl php7-xml php7-mysqli php7-imap php7-cgi fcgi php7-pdo php7-pdo_mysql php7-soap php7-xmlrpc php7-posix php7-mcrypt php7-gettext php7-ldap php7-ctype php7-dom}}&lt;br /&gt;
&lt;br /&gt;
==Configure Lighttpd==&lt;br /&gt;
&#039;&#039;&#039;Edit lighttpd.conf&#039;&#039;&#039;&lt;br /&gt;
{{Cmd|vi /etc/lighttpd/lighttpd.conf}}&lt;br /&gt;
Uncomment line:&lt;br /&gt;
 include &amp;quot;mod_fastcgi.conf&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==Start lighttpd service and add to needed runlevel==&lt;br /&gt;
&lt;br /&gt;
{{Cmd|rc-service lighttpd start &amp;amp;&amp;amp; rc-update add lighttpd default}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Server]]&lt;br /&gt;
[[Category:PHP]]&lt;/div&gt;</summary>
		<author><name>Bogon</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Linux_iSCSI_Target_(TCM)&amp;diff=16859</id>
		<title>Linux iSCSI Target (TCM)</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Linux_iSCSI_Target_(TCM)&amp;diff=16859"/>
		<updated>2020-02-06T07:55:27Z</updated>

		<summary type="html">&lt;p&gt;Bogon: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Since kernel 2.6.38 Linux has a new generic Target Core module, merged from LIO [[http://linux-iscsi.org/wiki/Main_Page]], and since 3.1 there is iSCSI support. This how-to quickly explains how to use it.&lt;br /&gt;
&lt;br /&gt;
Install the utilities to configure Target Core:&lt;br /&gt;
&lt;br /&gt;
  # apk add targetcli&lt;br /&gt;
  # rc-update add targetcli&lt;br /&gt;
  # rc-update add dbus&lt;br /&gt;
  # service targetcli start&lt;br /&gt;
  # service dbus start&lt;br /&gt;
&lt;br /&gt;
In contrast with plain text files as usual, all configuration is done in ConfigFS via targetcli shell (you can use tab for command auto-completion and &amp;quot;ls&amp;quot; for inspecting current config):&lt;br /&gt;
&lt;br /&gt;
  # targetcli&lt;br /&gt;
  Welcome to the targetcli shell::&lt;br /&gt;
  Copyright (c) 2011 by RisingTide Systems LLC.&lt;br /&gt;
&lt;br /&gt;
  For help on commands, type &#039;help&#039;.&lt;br /&gt;
&lt;br /&gt;
  /&amp;gt; ls&lt;br /&gt;
  o- / ..................................................................... [...]&lt;br /&gt;
  o- backstores .......................................................... [...]&lt;br /&gt;
  | o- fileio ............................................... [0 Storage Object]&lt;br /&gt;
  | o- iblock ............................................... [0 Storage Object]&lt;br /&gt;
  | o- pscsi ................................................ [0 Storage Object]&lt;br /&gt;
  | o- rd_dr ................................................ [0 Storage Object]&lt;br /&gt;
  | o- rd_mcp ............................................... [0 Storage Object]&lt;br /&gt;
  o- ib_srpt ........................................................ [0 Target]&lt;br /&gt;
  o- iscsi .......................................................... [0 Target]&lt;br /&gt;
  o- loopback ....................................................... [0 Target]&lt;br /&gt;
  o- qla2xxx ........................................................ [0 Target]&lt;br /&gt;
  /&amp;gt; &lt;br /&gt;
&lt;br /&gt;
You can create a file to be exported as a target:&lt;br /&gt;
&lt;br /&gt;
  /&amp;gt; cd backstores/fileio&lt;br /&gt;
  /backstores/fileio&amp;gt; create file_backstore file1 1M&lt;br /&gt;
  Generating a wwn serial.&lt;br /&gt;
  Not using buffered mode.&lt;br /&gt;
  Created fileio file_backstore.&lt;br /&gt;
  /backstores/fileio&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Or you can use a block device:&lt;br /&gt;
&lt;br /&gt;
  /&amp;gt; cd backstores/blockio&lt;br /&gt;
  /backstores/blockio&amp;gt; create block0 /dev/sda1&lt;br /&gt;
&lt;br /&gt;
You can use any block device, including RAID and LVM2. Now create an iSCSI Target and a Target Portal Group (tpg) (the iqn is automatically created. You can also specify one by hand):&lt;br /&gt;
&lt;br /&gt;
  /&amp;gt; cd /iscsi&lt;br /&gt;
  /iscsi&amp;gt; create&lt;br /&gt;
  Created target iqn.2003-01.org.linux-iscsi.rtsnode1.x8664:sn.83a8cde7aca8.&lt;br /&gt;
  Selected TPG Tag 1.&lt;br /&gt;
  Successfully created TPG 1.&lt;br /&gt;
&lt;br /&gt;
Now you have to tell Target Core to use the previously create backstore for the target now created:&lt;br /&gt;
&lt;br /&gt;
  /iscsi&amp;gt; cd iqn.2003-01.org.linux-iscsi.rtsnode1.x8664:sn.83a8cde7aca8/tpg1/luns&lt;br /&gt;
  ../tpg1/luns&amp;gt; create lun=0 storage_object=/backstores/blockio/block0&lt;br /&gt;
  Successfully created LUN 0.&lt;br /&gt;
&lt;br /&gt;
Now create the iSCSI portal:&lt;br /&gt;
&lt;br /&gt;
  ../tpg1/luns&amp;gt; cd ../portals&lt;br /&gt;
  ../tpg1/portals&amp;gt; create ip_address=192.168.1.10&lt;br /&gt;
  Using default IP port 3260&lt;br /&gt;
  Successfully created network portal 192.168.1.10:3260.&lt;br /&gt;
&lt;br /&gt;
By default authentication is enabled. To disable it:&lt;br /&gt;
&lt;br /&gt;
  ../tpg1&amp;gt; set attribute authentication=0&lt;br /&gt;
  Parameter authentication is now &#039;0&#039;.&lt;br /&gt;
  ../tpg1&amp;gt; set attribute generate_node_acls=1&lt;br /&gt;
  Parameter generate_node_acls is now &#039;1&#039;.&lt;br /&gt;
&lt;br /&gt;
Finally save the configuration:&lt;br /&gt;
&lt;br /&gt;
  /&amp;gt; saveconfig&lt;br /&gt;
  Existing file /etc/target/saveconfig.json backed up to saveconfig.json.backup&lt;br /&gt;
  Configuration saved to /etc/target/saveconfig.json&lt;br /&gt;
&lt;br /&gt;
For real use, you should always track changes to the saveconfig file and make sure &lt;br /&gt;
(there&#039;s a flag for it) to not save config if you are in an error situation. By default, &lt;br /&gt;
targetcli creates a config backup if you exit, meaning you might lose the working&lt;br /&gt;
config at the time. So better to be prepared.&lt;br /&gt;
Errors don&#039;t simply appear, but i.e. if you&#039;re missing a HBA on boot, these settings&lt;br /&gt;
will not be loaded and thus not be in the configuration upon save.&lt;br /&gt;
&lt;br /&gt;
[[Category:Storage]]&lt;/div&gt;</summary>
		<author><name>Bogon</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Linux_iSCSI_Target_(TCM)&amp;diff=16858</id>
		<title>Linux iSCSI Target (TCM)</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Linux_iSCSI_Target_(TCM)&amp;diff=16858"/>
		<updated>2020-02-06T07:52:35Z</updated>

		<summary type="html">&lt;p&gt;Bogon: Requires dbus&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Since kernel 2.6.38 Linux has a new generic Target Core module, merged from LIO [[http://linux-iscsi.org/wiki/Main_Page]], and since 3.1 there is iSCSI support. This how-to quickly explains how to use it.&lt;br /&gt;
&lt;br /&gt;
Install the utilities to configure Target Core:&lt;br /&gt;
&lt;br /&gt;
  # apk add targetcli&lt;br /&gt;
  # rc-update add targetcli&lt;br /&gt;
  # rc-update add dbus&lt;br /&gt;
  # service targetcli start&lt;br /&gt;
  # service dbus start&lt;br /&gt;
&lt;br /&gt;
In contrast with plain text files as usual, all configuration is done in ConfigFS via targetcli shell (you can use tab for command auto-completion and &amp;quot;ls&amp;quot; for inspecting current config):&lt;br /&gt;
&lt;br /&gt;
  # targetcli&lt;br /&gt;
  Welcome to the targetcli shell::&lt;br /&gt;
  Copyright (c) 2011 by RisingTide Systems LLC.&lt;br /&gt;
&lt;br /&gt;
  For help on commands, type &#039;help&#039;.&lt;br /&gt;
&lt;br /&gt;
  /&amp;gt; ls&lt;br /&gt;
  o- / ..................................................................... [...]&lt;br /&gt;
  o- backstores .......................................................... [...]&lt;br /&gt;
  | o- fileio ............................................... [0 Storage Object]&lt;br /&gt;
  | o- iblock ............................................... [0 Storage Object]&lt;br /&gt;
  | o- pscsi ................................................ [0 Storage Object]&lt;br /&gt;
  | o- rd_dr ................................................ [0 Storage Object]&lt;br /&gt;
  | o- rd_mcp ............................................... [0 Storage Object]&lt;br /&gt;
  o- ib_srpt ........................................................ [0 Target]&lt;br /&gt;
  o- iscsi .......................................................... [0 Target]&lt;br /&gt;
  o- loopback ....................................................... [0 Target]&lt;br /&gt;
  o- qla2xxx ........................................................ [0 Target]&lt;br /&gt;
  /&amp;gt; &lt;br /&gt;
&lt;br /&gt;
You can create a file to be exported as a target:&lt;br /&gt;
&lt;br /&gt;
  /&amp;gt; cd backstores/fileio&lt;br /&gt;
  /backstores/fileio&amp;gt; create file_backstore file1 1M&lt;br /&gt;
  Generating a wwn serial.&lt;br /&gt;
  Not using buffered mode.&lt;br /&gt;
  Created fileio file_backstore.&lt;br /&gt;
  /backstores/fileio&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Or you can use a block device:&lt;br /&gt;
&lt;br /&gt;
  /&amp;gt; cd backstores/blockio&lt;br /&gt;
  /backstores/blockio&amp;gt; create block0 /dev/sda1&lt;br /&gt;
&lt;br /&gt;
You can use any block device, including RAID and LVM2. Now create an iSCSI Target and a Target Portal Group (tpg) (the iqn is automatically created. You can also specify one by hand):&lt;br /&gt;
&lt;br /&gt;
  /&amp;gt; cd /iscsi&lt;br /&gt;
  /iscsi&amp;gt; create&lt;br /&gt;
  Created target iqn.2003-01.org.linux-iscsi.rtsnode1.x8664:sn.83a8cde7aca8.&lt;br /&gt;
  Selected TPG Tag 1.&lt;br /&gt;
  Successfully created TPG 1.&lt;br /&gt;
&lt;br /&gt;
Now you have to tell Target Core to use the previously create backstore for the target now created:&lt;br /&gt;
&lt;br /&gt;
  ../tpg1&amp;gt; cd luns&lt;br /&gt;
  ../tpg1/luns&amp;gt; create lun=0 storage_object=/backstores/blockio/block0&lt;br /&gt;
  Successfully created LUN 0.&lt;br /&gt;
&lt;br /&gt;
Now create the iSCSI portal:&lt;br /&gt;
&lt;br /&gt;
  ../tpg1/luns&amp;gt; cd ../portals&lt;br /&gt;
  ../tpg1/portals&amp;gt; create ip_address=192.168.1.10&lt;br /&gt;
  Using default IP port 3260&lt;br /&gt;
  Successfully created network portal 192.168.1.10:3260.&lt;br /&gt;
&lt;br /&gt;
By default authentication is enabled. To disable it:&lt;br /&gt;
&lt;br /&gt;
  ../tpg1&amp;gt; set attribute authentication=0&lt;br /&gt;
  Parameter authentication is now &#039;0&#039;.&lt;br /&gt;
  ../tpg1&amp;gt; set attribute generate_node_acls=1&lt;br /&gt;
  Parameter generate_node_acls is now &#039;1&#039;.&lt;br /&gt;
&lt;br /&gt;
Finally save the configuration:&lt;br /&gt;
&lt;br /&gt;
  /&amp;gt; saveconfig&lt;br /&gt;
  Existing file /etc/target/saveconfig.json backed up to saveconfig.json.backup&lt;br /&gt;
  Configuration saved to /etc/target/saveconfig.json&lt;br /&gt;
&lt;br /&gt;
For real use, you should always track changes to the saveconfig file and make sure &lt;br /&gt;
(there&#039;s a flag for it) to not save config if you are in an error situation. By default, &lt;br /&gt;
targetcli creates a config backup if you exit, meaning you might lose the working&lt;br /&gt;
config at the time. So better to be prepared.&lt;br /&gt;
Errors don&#039;t simply appear, but i.e. if you&#039;re missing a HBA on boot, these settings&lt;br /&gt;
will not be loaded and thus not be in the configuration upon save.&lt;br /&gt;
&lt;br /&gt;
[[Category:Storage]]&lt;/div&gt;</summary>
		<author><name>Bogon</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=16662</id>
		<title>Raspberry Pi</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=16662"/>
		<updated>2019-11-12T19:22:06Z</updated>

		<summary type="html">&lt;p&gt;Bogon: /* Preparation */ Removed the note about needing 3.2, since 3.2 and previous versions are no longer supported. Various readability improvements.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&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, and is compatible with Raspberry Pi 3 and Compute Module 3.&lt;br /&gt;
# Create a bootable FAT32 partition on your SD card. 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 unto 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]. 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;
If you need WiFi to work, you have to [https://github.com/RPi-Distro/firmware-nonfree/tree/master/brcm download] the latest Broadcom drivers to your SD card. (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;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
Alpine Linux will be installed as [[Installation#Installation_Handbook|diskless mode]], hence you need to use [[Alpine local backup|Alpine Local Backup (lbu)]] to save your modifications between reboots.  Follow these steps to install Alpine Linux:&lt;br /&gt;
&lt;br /&gt;
# Insert the SD card into the Raspberry Pi and turn it on&lt;br /&gt;
# Login into the Alpine system as root.  Leave the password empty.&lt;br /&gt;
# Type &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;
Upon installation, make sure that 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;
=== 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 and therefore 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 Raspberry Pi does not have a clock, the 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 that you a&lt;br /&gt;
NTP daemon installed and running.  If you are not sure, then you can install 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 that 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 on boot.&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) ===&lt;br /&gt;
&lt;br /&gt;
Remount the boot partition writeable (ie. /media/mmcblk0p1):&lt;br /&gt;
&lt;br /&gt;
{{cmd|mount -o remount,rw /media/mmcblk0p1}}&lt;br /&gt;
&lt;br /&gt;
Add the following lines to /media/mmcblk0p1/config.txt &lt;br /&gt;
&lt;br /&gt;
 dtoverlay=vc4-kms-v3d&lt;br /&gt;
 gpu_mem=128&lt;br /&gt;
&lt;br /&gt;
256MB gpu_mem is also possible&lt;br /&gt;
&lt;br /&gt;
Install mesa-dri-vc4:&lt;br /&gt;
{{cmd|apk add mesa-dri-vc4}}&lt;br /&gt;
&lt;br /&gt;
Reboot:&lt;br /&gt;
&lt;br /&gt;
{{cmd|lbu_commit -d; reboot}}&lt;br /&gt;
&lt;br /&gt;
== Persistent storage ==&lt;br /&gt;
&lt;br /&gt;
=== Loopback image with overlayfs ===&lt;br /&gt;
&lt;br /&gt;
The install is in diskless mode and forces everything into memory, if you want additional storage we need to create loop-back storage onto the SD 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 doing /usr here, but you can do /home or anything else:&lt;br /&gt;
&lt;br /&gt;
{{cmd|mkdir /media/persist/usr &lt;br /&gt;
mkdir /media/persist/.work &lt;br /&gt;
echo &amp;quot;overlay /usr overlay lowerdir&amp;amp;#61;/usr,upperdir&amp;amp;#61;/media/persist/usr,workdir&amp;amp;#61;/media/persist/.work 0 0&amp;quot; &amp;gt;&amp;gt; /etc/fstab &lt;br /&gt;
mount -a}}&lt;br /&gt;
&lt;br /&gt;
Your /etc/fstab should look something like this:&lt;br /&gt;
{{Cmd|/dev/cdrom      /media/cdrom    iso9660 noauto,ro 0 0&lt;br /&gt;
/dev/usbdisk    /media/usb      vfat    noauto,ro 0 0&lt;br /&gt;
/dev/mmcblk0p1 /media/mmcblk0p1 vfat rw,relatime,fmask&amp;amp;#61;0022,dmask&amp;amp;#61;0022,errors&amp;amp;#61;remount-ro 0 0&lt;br /&gt;
/media/mmcblk0p1/persist.img /media/persist ext4 rw,relatime,errors&amp;amp;#61;remount-ro 0 0&lt;br /&gt;
overlay /usr overlay lowerdir&amp;amp;#61;/usr,upperdir&amp;amp;#61;/media/persist/usr,workdir&amp;amp;#61;/media/persist/.work 0 0}}&lt;br /&gt;
&lt;br /&gt;
Now commit the changes: (optionally remove the e2fsprogs, but it does contain repair tools)&lt;br /&gt;
{{cmd|lbu_commit -d}}&lt;br /&gt;
&lt;br /&gt;
Remember with this setup, if you install things and you have done this overlay for /usr, you must not commit the &#039;apk add&#039;, otherwise while it boots it will try and install it to memory and not to the persist 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 do 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;
&lt;br /&gt;
{{Warning|This isn&#039;t yet supported by the Alpine setup scripts for Raspberry Pi. It requires manual intervention, and might break.}}&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 these: the Raspberry Pi doesn&#039;t need this to boot anyway.&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 on shutdown.&lt;br /&gt;
&lt;br /&gt;
Beware, though, that &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 so that manually copy the files to boot partition 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;
&lt;br /&gt;
See this page : https://wiki.alpinelinux.org/wiki/Classic_install_or_sys_mode_on_Raspberry_Pi&lt;br /&gt;
&lt;br /&gt;
See https://web.archive.org/web/20171125115835/https://forum.alpinelinux.org/comment/1084#comment-1084&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;
=== 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;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
* [[Classic install or sys mode on Raspberry Pi]] - a variant.&lt;br /&gt;
* [[Raspberry Pi 3 - Setting Up Bluetooth]]&lt;br /&gt;
* [[Raspberry Pi 3 - Configuring it as wireless access point -AP Mode]]&lt;br /&gt;
* [[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;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;br /&gt;
[[Category: Raspberry]]&lt;/div&gt;</summary>
		<author><name>Bogon</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=16661</id>
		<title>Raspberry Pi</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=16661"/>
		<updated>2019-11-12T19:00:55Z</updated>

		<summary type="html">&lt;p&gt;Bogon: /* Preparation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&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;
This section will help you format and partition your SD card:&lt;br /&gt;
&lt;br /&gt;
# [http://alpinelinux.org/downloads/ Download] Alpine for Raspberry Pi tarball for the &#039;&#039;&#039;armhf&#039;&#039;&#039; architecture which is named as &amp;lt;code&amp;gt;alpine-rpi-&amp;lt;version&amp;gt;-armhf.tar.gz&amp;lt;/code&amp;gt;.  You will need version 3.2.0 or greater if you have a Raspberry Pi 2.&lt;br /&gt;
# Mount your SD card to your workstation&lt;br /&gt;
# Use [https://en.wikipedia.org/wiki/GNOME_Disks gnome-disks] or [http://linux.die.net/man/8/fdisk fdisk] to create a FAT32 partition.  If you are using fdisk, the FAT32 partition type is called &#039;&#039;W95 FAT32 (LBA)&#039;&#039; and its ID is 0x0C.&lt;br /&gt;
# Mark the newly created partition as bootable and save&lt;br /&gt;
# If you used fdisk to create the partition you need to create a filesystem on it with mkdosfs -F 32 /dev/sdX1&lt;br /&gt;
# Mount the previously created partition&lt;br /&gt;
# Extract the tarball contents to your FAT32 partition&lt;br /&gt;
# Unmount the SD Card.&lt;br /&gt;
&lt;br /&gt;
Note: 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, and is compatible with Raspberry Pi 3 and Compute Module 3.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Optionally create a &amp;quot;usercfg.txt&amp;quot; file on your SD card to configure low-level system settings. Specifications can be found [https://www.raspberrypi.org/documentation/configuration/config-txt here]. Some interesting values include:&lt;br /&gt;
* Enable audio: dtparam=audio=on&lt;br /&gt;
* If you see black edges around your screen after booting the Pi, you can add: disable_overscan=1&lt;br /&gt;
&lt;br /&gt;
=== WiFi support ===&lt;br /&gt;
If you need WiFi to work, perform the following before unmounting the SD card:&lt;br /&gt;
# [https://github.com/RPi-Distro/firmware-nonfree/tree/master/brcm Download] the latest Broadcom drivers for the Raspberry Pi to your machine and &lt;br /&gt;
# Copy them to [SD card]/firmware/brcm/.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
git clone --depth 1 https://github.com/RPi-Distro/firmware-nonfree.git&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
cp firmware-nonfree/brcm/* [SD card]/firmware/brcm&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
Alpine Linux will be installed as [[Installation#Installation_Handbook|diskless mode]], hence you need to use [[Alpine local backup|Alpine Local Backup (lbu)]] to save your modifications between reboots.  Follow these steps to install Alpine Linux:&lt;br /&gt;
&lt;br /&gt;
# Insert the SD card into the Raspberry Pi and turn it on&lt;br /&gt;
# Login into the Alpine system as root.  Leave the password empty.&lt;br /&gt;
# Type &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;
Upon installation, make sure that 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;
=== 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 and therefore 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 Raspberry Pi does not have a clock, the 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 that you a&lt;br /&gt;
NTP daemon installed and running.  If you are not sure, then you can install 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 that 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 on boot.&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) ===&lt;br /&gt;
&lt;br /&gt;
Remount the boot partition writeable (ie. /media/mmcblk0p1):&lt;br /&gt;
&lt;br /&gt;
{{cmd|mount -o remount,rw /media/mmcblk0p1}}&lt;br /&gt;
&lt;br /&gt;
Add the following lines to /media/mmcblk0p1/config.txt &lt;br /&gt;
&lt;br /&gt;
 dtoverlay=vc4-kms-v3d&lt;br /&gt;
 gpu_mem=128&lt;br /&gt;
&lt;br /&gt;
256MB gpu_mem is also possible&lt;br /&gt;
&lt;br /&gt;
Install mesa-dri-vc4:&lt;br /&gt;
{{cmd|apk add mesa-dri-vc4}}&lt;br /&gt;
&lt;br /&gt;
Reboot:&lt;br /&gt;
&lt;br /&gt;
{{cmd|lbu_commit -d; reboot}}&lt;br /&gt;
&lt;br /&gt;
== Persistent storage ==&lt;br /&gt;
&lt;br /&gt;
=== Loopback image with overlayfs ===&lt;br /&gt;
&lt;br /&gt;
The install is in diskless mode and forces everything into memory, if you want additional storage we need to create loop-back storage onto the SD 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 doing /usr here, but you can do /home or anything else:&lt;br /&gt;
&lt;br /&gt;
{{cmd|mkdir /media/persist/usr &lt;br /&gt;
mkdir /media/persist/.work &lt;br /&gt;
echo &amp;quot;overlay /usr overlay lowerdir&amp;amp;#61;/usr,upperdir&amp;amp;#61;/media/persist/usr,workdir&amp;amp;#61;/media/persist/.work 0 0&amp;quot; &amp;gt;&amp;gt; /etc/fstab &lt;br /&gt;
mount -a}}&lt;br /&gt;
&lt;br /&gt;
Your /etc/fstab should look something like this:&lt;br /&gt;
{{Cmd|/dev/cdrom      /media/cdrom    iso9660 noauto,ro 0 0&lt;br /&gt;
/dev/usbdisk    /media/usb      vfat    noauto,ro 0 0&lt;br /&gt;
/dev/mmcblk0p1 /media/mmcblk0p1 vfat rw,relatime,fmask&amp;amp;#61;0022,dmask&amp;amp;#61;0022,errors&amp;amp;#61;remount-ro 0 0&lt;br /&gt;
/media/mmcblk0p1/persist.img /media/persist ext4 rw,relatime,errors&amp;amp;#61;remount-ro 0 0&lt;br /&gt;
overlay /usr overlay lowerdir&amp;amp;#61;/usr,upperdir&amp;amp;#61;/media/persist/usr,workdir&amp;amp;#61;/media/persist/.work 0 0}}&lt;br /&gt;
&lt;br /&gt;
Now commit the changes: (optionally remove the e2fsprogs, but it does contain repair tools)&lt;br /&gt;
{{cmd|lbu_commit -d}}&lt;br /&gt;
&lt;br /&gt;
Remember with this setup, if you install things and you have done this overlay for /usr, you must not commit the &#039;apk add&#039;, otherwise while it boots it will try and install it to memory and not to the persist 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 do 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;
&lt;br /&gt;
{{Warning|This isn&#039;t yet supported by the Alpine setup scripts for Raspberry Pi. It requires manual intervention, and might break.}}&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 these: the Raspberry Pi doesn&#039;t need this to boot anyway.&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 on shutdown.&lt;br /&gt;
&lt;br /&gt;
Beware, though, that &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 so that manually copy the files to boot partition 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;
&lt;br /&gt;
See this page : https://wiki.alpinelinux.org/wiki/Classic_install_or_sys_mode_on_Raspberry_Pi&lt;br /&gt;
&lt;br /&gt;
See https://web.archive.org/web/20171125115835/https://forum.alpinelinux.org/comment/1084#comment-1084&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;
=== 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;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
* [[Classic install or sys mode on Raspberry Pi]] - a variant.&lt;br /&gt;
* [[Raspberry Pi 3 - Setting Up Bluetooth]]&lt;br /&gt;
* [[Raspberry Pi 3 - Configuring it as wireless access point -AP Mode]]&lt;br /&gt;
* [[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;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;br /&gt;
[[Category: Raspberry]]&lt;/div&gt;</summary>
		<author><name>Bogon</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=16660</id>
		<title>Raspberry Pi</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=16660"/>
		<updated>2019-11-12T19:00:12Z</updated>

		<summary type="html">&lt;p&gt;Bogon: X11 and Xfce setup have their own articles, they don&amp;#039;t differ for the Pi&lt;/p&gt;
&lt;hr /&gt;
&lt;div&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;
This section will help you format and partition your SD card:&lt;br /&gt;
&lt;br /&gt;
# [http://alpinelinux.org/downloads/ Download] Alpine for Raspberry Pi tarball for the &#039;&#039;&#039;armhf&#039;&#039;&#039; architecture which is named as &amp;lt;code&amp;gt;alpine-rpi-&amp;lt;version&amp;gt;-armhf.tar.gz&amp;lt;/code&amp;gt;.  You will need version 3.2.0 or greater if you have a Raspberry Pi 2.&lt;br /&gt;
# Mount your SD card to your workstation&lt;br /&gt;
# Use [https://en.wikipedia.org/wiki/GNOME_Disks gnome-disks] or [http://linux.die.net/man/8/fdisk fdisk] to create a FAT32 partition.  If you are using fdisk, the FAT32 partition type is called &#039;&#039;W95 FAT32 (LBA)&#039;&#039; and its ID is 0x0C.&lt;br /&gt;
# Mark the newly created partition as bootable and save&lt;br /&gt;
# If you used fdisk to create the partition you need to create a filesystem on it with mkdosfs -F 32 /dev/sdX1&lt;br /&gt;
# Mount the previously created partition&lt;br /&gt;
# Extract the tarball contents to your FAT32 partition&lt;br /&gt;
# Unmount the SD Card.&lt;br /&gt;
&lt;br /&gt;
Note: 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, and is compatible with Raspberry Pi 3 and Compute Module 3.&lt;br /&gt;
&lt;br /&gt;
=== WiFi support ===&lt;br /&gt;
If you need WiFi to work, perform the following before unmounting the SD card:&lt;br /&gt;
# [https://github.com/RPi-Distro/firmware-nonfree/tree/master/brcm Download] the latest Broadcom drivers for the Raspberry Pi to your machine and &lt;br /&gt;
# Copy them to [SD card]/firmware/brcm/.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
git clone --depth 1 https://github.com/RPi-Distro/firmware-nonfree.git&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
cp firmware-nonfree/brcm/* [SD card]/firmware/brcm&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Optionally create a &amp;quot;usercfg.txt&amp;quot; file on your SD card to configure low-level system settings. Specifications can be found [https://www.raspberrypi.org/documentation/configuration/config-txt here]. Some interesting values include:&lt;br /&gt;
* Enable audio: dtparam=audio=on&lt;br /&gt;
* If you see black edges around your screen after booting the Pi, you can add: disable_overscan=1&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
Alpine Linux will be installed as [[Installation#Installation_Handbook|diskless mode]], hence you need to use [[Alpine local backup|Alpine Local Backup (lbu)]] to save your modifications between reboots.  Follow these steps to install Alpine Linux:&lt;br /&gt;
&lt;br /&gt;
# Insert the SD card into the Raspberry Pi and turn it on&lt;br /&gt;
# Login into the Alpine system as root.  Leave the password empty.&lt;br /&gt;
# Type &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;
Upon installation, make sure that 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;
=== 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 and therefore 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 Raspberry Pi does not have a clock, the 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 that you a&lt;br /&gt;
NTP daemon installed and running.  If you are not sure, then you can install 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 that 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 on boot.&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) ===&lt;br /&gt;
&lt;br /&gt;
Remount the boot partition writeable (ie. /media/mmcblk0p1):&lt;br /&gt;
&lt;br /&gt;
{{cmd|mount -o remount,rw /media/mmcblk0p1}}&lt;br /&gt;
&lt;br /&gt;
Add the following lines to /media/mmcblk0p1/config.txt &lt;br /&gt;
&lt;br /&gt;
 dtoverlay=vc4-kms-v3d&lt;br /&gt;
 gpu_mem=128&lt;br /&gt;
&lt;br /&gt;
256MB gpu_mem is also possible&lt;br /&gt;
&lt;br /&gt;
Install mesa-dri-vc4:&lt;br /&gt;
{{cmd|apk add mesa-dri-vc4}}&lt;br /&gt;
&lt;br /&gt;
Reboot:&lt;br /&gt;
&lt;br /&gt;
{{cmd|lbu_commit -d; reboot}}&lt;br /&gt;
&lt;br /&gt;
== Persistent storage ==&lt;br /&gt;
&lt;br /&gt;
=== Loopback image with overlayfs ===&lt;br /&gt;
&lt;br /&gt;
The install is in diskless mode and forces everything into memory, if you want additional storage we need to create loop-back storage onto the SD 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 doing /usr here, but you can do /home or anything else:&lt;br /&gt;
&lt;br /&gt;
{{cmd|mkdir /media/persist/usr &lt;br /&gt;
mkdir /media/persist/.work &lt;br /&gt;
echo &amp;quot;overlay /usr overlay lowerdir&amp;amp;#61;/usr,upperdir&amp;amp;#61;/media/persist/usr,workdir&amp;amp;#61;/media/persist/.work 0 0&amp;quot; &amp;gt;&amp;gt; /etc/fstab &lt;br /&gt;
mount -a}}&lt;br /&gt;
&lt;br /&gt;
Your /etc/fstab should look something like this:&lt;br /&gt;
{{Cmd|/dev/cdrom      /media/cdrom    iso9660 noauto,ro 0 0&lt;br /&gt;
/dev/usbdisk    /media/usb      vfat    noauto,ro 0 0&lt;br /&gt;
/dev/mmcblk0p1 /media/mmcblk0p1 vfat rw,relatime,fmask&amp;amp;#61;0022,dmask&amp;amp;#61;0022,errors&amp;amp;#61;remount-ro 0 0&lt;br /&gt;
/media/mmcblk0p1/persist.img /media/persist ext4 rw,relatime,errors&amp;amp;#61;remount-ro 0 0&lt;br /&gt;
overlay /usr overlay lowerdir&amp;amp;#61;/usr,upperdir&amp;amp;#61;/media/persist/usr,workdir&amp;amp;#61;/media/persist/.work 0 0}}&lt;br /&gt;
&lt;br /&gt;
Now commit the changes: (optionally remove the e2fsprogs, but it does contain repair tools)&lt;br /&gt;
{{cmd|lbu_commit -d}}&lt;br /&gt;
&lt;br /&gt;
Remember with this setup, if you install things and you have done this overlay for /usr, you must not commit the &#039;apk add&#039;, otherwise while it boots it will try and install it to memory and not to the persist 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 do 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;
&lt;br /&gt;
{{Warning|This isn&#039;t yet supported by the Alpine setup scripts for Raspberry Pi. It requires manual intervention, and might break.}}&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 these: the Raspberry Pi doesn&#039;t need this to boot anyway.&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 on shutdown.&lt;br /&gt;
&lt;br /&gt;
Beware, though, that &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 so that manually copy the files to boot partition 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;
&lt;br /&gt;
See this page : https://wiki.alpinelinux.org/wiki/Classic_install_or_sys_mode_on_Raspberry_Pi&lt;br /&gt;
&lt;br /&gt;
See https://web.archive.org/web/20171125115835/https://forum.alpinelinux.org/comment/1084#comment-1084&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;
=== 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;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
* [[Classic install or sys mode on Raspberry Pi]] - a variant.&lt;br /&gt;
* [[Raspberry Pi 3 - Setting Up Bluetooth]]&lt;br /&gt;
* [[Raspberry Pi 3 - Configuring it as wireless access point -AP Mode]]&lt;br /&gt;
* [[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;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;br /&gt;
[[Category: Raspberry]]&lt;/div&gt;</summary>
		<author><name>Bogon</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Sshguard&amp;diff=15920</id>
		<title>Sshguard</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Sshguard&amp;diff=15920"/>
		<updated>2019-05-05T19:26:24Z</updated>

		<summary type="html">&lt;p&gt;Bogon: Created page with &amp;quot;[https://www.sshguard.net/ sshguard] protects hosts from brute-force attacks against SSH and other services. It aggregates system logs and blocks repeat offenders using one of...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://www.sshguard.net/ sshguard] protects hosts from brute-force attacks against SSH and other services. It aggregates system logs and blocks repeat offenders using one of several firewall backends, including iptables, ipfw, and pf.&lt;br /&gt;
&lt;br /&gt;
sshguard can read log messages from standard input (suitable for piping from syslog) or monitor one or more log files. Log messages are parsed, line-by-line, for recognized patterns. If an attack, such as several login failures within a few seconds, is detected, the offending IP is blocked. Offenders are unblocked after a set interval, but can be semi-permanently banned using the blacklist option.&lt;br /&gt;
&lt;br /&gt;
sshguard does not support custom log parsing. Check the website too see which services they support.&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
Sshguard can use several backends, you can see them with &amp;lt;code&amp;gt;ls /usr/libexec/sshg-fw*&amp;lt;/code&amp;gt;. The easiest backend on Alpine is nftables. After you install sshguard, you will need to create a config file or it won&#039;t start.&lt;br /&gt;
&lt;br /&gt;
 apk add sshguard nftables&lt;br /&gt;
 vi /etc/sshguard.conf&lt;br /&gt;
&lt;br /&gt;
 #!/bin/sh&lt;br /&gt;
 BACKEND=&#039;/usr/libexec/sshg-fw-nft-sets&#039;&lt;br /&gt;
 FILES=&#039;/var/log/messages&#039;&lt;br /&gt;
&lt;br /&gt;
You can view the rules with &amp;lt;code&amp;gt;nft list ruleset&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Iptables backend ==&lt;br /&gt;
&lt;br /&gt;
To use the iptables backend, you must first create a chain called &amp;quot;sshguard&amp;quot;. Enable the iptables-service to save the rules at shutdown and reload them when booting&lt;br /&gt;
&lt;br /&gt;
  iptables -A INPUT -j sshguard&lt;br /&gt;
  rc-update add iptables boot&lt;br /&gt;
&lt;br /&gt;
You can view the rules with &amp;lt;code&amp;gt;iptables -L&amp;lt;/code&amp;gt;&lt;/div&gt;</summary>
		<author><name>Bogon</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=KVM&amp;diff=15905</id>
		<title>KVM</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=KVM&amp;diff=15905"/>
		<updated>2019-04-28T06:34:04Z</updated>

		<summary type="html">&lt;p&gt;Bogon: /* Management */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://www.linux-kvm.org/page/Main_Page KVM] is an free and open source virtualization solution in a kernel module. Although it is often simply referred to as KVM, the actual hypervisor is [https://www.qemu.org QEMU]. QEMU runs from user-space, but can integrate with KVM, providing better performance by leveraging the hardware from kernel-space. QEMU can virtualize x86, PowerPC, and S390 guests, amongst others. [https://libvirt.org Libvirt] is a management framework that integrates with QEMU/KVM, [https://wiki.alpinelinux.org/wiki/LXC LXC], [https://wiki.alpinelinux.org/wiki/Xen_Dom0 Xen] and others.&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
The following commands provide &#039;&#039;&#039;libvirt&#039;&#039;&#039; as well as &#039;&#039;&#039;QEMU with emulation for x86_64&#039;&#039;&#039; and &#039;&#039;&#039;qemu-img&#039;&#039;&#039;, a necessary component for using various disk formats such as qcow2. Without qemu-img, only raw disks are available. It can also convert images between several formats like vhdx and vmdk.&lt;br /&gt;
{{Cmd|&amp;lt;nowiki&amp;gt;# apk add libvirt-daemon qemu-img qemu-system-x86_64&lt;br /&gt;
# rc-update add libvirtd&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
== Networking ==&lt;br /&gt;
By default, libvirt uses NAT for VM connectivity. If you want to use the default configuration, you need to load the tun module.&lt;br /&gt;
{{Cmd|# modprobe tun}}&lt;br /&gt;
&lt;br /&gt;
If you prefer bridging a guest over your Ethernet interface, you need to make a [https://wiki.alpinelinux.org/wiki/Bridge#Configuration_file bridge].&lt;br /&gt;
&lt;br /&gt;
== Management ==&lt;br /&gt;
For (non-root) management, you will need to add your user to the libvirt group.&lt;br /&gt;
{{Cmd|# addgroup user libvirt}}&lt;br /&gt;
&lt;br /&gt;
You can use libvirt&#039;s virsh on the CLI. It can execute commands as well as run as an interactive shell. Read its manual page and/or use the &amp;quot;help&amp;quot; command for more info. Some basic commands are:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|&amp;lt;nowiki&amp;gt;virsh help&lt;br /&gt;
virsh list --all&lt;br /&gt;
virsh start $domain&lt;br /&gt;
virsh shutdown $domain&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The libvirt project provides a GUI for managing hosts, called virt-manager. It handles local systems as well as remote ones via SSH.&lt;br /&gt;
{{Cmd|&amp;lt;nowiki&amp;gt;# apk add dbus polkit virt-manager&lt;br /&gt;
# rc-update add dbus&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
In order to use libvirtd to remotely control KVM over ssh PolicyKit needs a .pkla informing it that this is allowed.&lt;br /&gt;
Write the following file to /etc/polkit-1/localauthority/50-local.d/50-libvirt-ssh-remote-access-policy.pkla&lt;br /&gt;
{{Cmd|&amp;lt;nowiki&amp;gt;[Remote libvirt SSH access]&lt;br /&gt;
 Identity=unix-group:libvirt&lt;br /&gt;
 Action=org.libvirt.unix.manage&lt;br /&gt;
 ResultAny=yes&lt;br /&gt;
 ResultInactive=yes&lt;br /&gt;
 ResultActive=yes&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Virtualization]]&lt;/div&gt;</summary>
		<author><name>Bogon</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=KVM&amp;diff=15898</id>
		<title>KVM</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=KVM&amp;diff=15898"/>
		<updated>2019-04-25T23:38:49Z</updated>

		<summary type="html">&lt;p&gt;Bogon: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://www.linux-kvm.org/page/Main_Page KVM] is an free and open source virtualization solution in a kernel module. Although it is often simply referred to as KVM, the actual hypervisor is [https://www.qemu.org QEMU]. QEMU runs from user-space, but can integrate with KVM, providing better performance by leveraging the hardware from kernel-space. QEMU can virtualize x86, PowerPC, and S390 guests, amongst others. [https://libvirt.org Libvirt] is a management framework that integrates with QEMU/KVM, [https://wiki.alpinelinux.org/wiki/LXC LXC], [https://wiki.alpinelinux.org/wiki/Xen_Dom0 Xen] and others.&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
The following commands provide &#039;&#039;&#039;libvirt&#039;&#039;&#039; as well as &#039;&#039;&#039;QEMU with emulation for x86_64&#039;&#039;&#039; and &#039;&#039;&#039;qemu-img&#039;&#039;&#039;, a necessary component for using various disk formats such as qcow2. Without qemu-img, only raw disks are available. It can also convert images between several formats like vhdx and vmdk.&lt;br /&gt;
{{Cmd|&amp;lt;nowiki&amp;gt;# apk add libvirt qemu-img qemu-system-x86_64&lt;br /&gt;
# rc-update add libvirtd&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
== Networking ==&lt;br /&gt;
By default, libvirt uses NAT for VM connectivity. If you want to use the default configuration, you need to load the tun module.&lt;br /&gt;
{{Cmd|# modprobe tun}}&lt;br /&gt;
&lt;br /&gt;
If you prefer bridging a guest over your Ethernet interface, you need to make a [https://wiki.alpinelinux.org/wiki/Bridge#Configuration_file bridge].&lt;br /&gt;
&lt;br /&gt;
== Management ==&lt;br /&gt;
For (non-root) management, you will need to add your user to the libvirt group.&lt;br /&gt;
{{Cmd|# addgroup user libvirt}}&lt;br /&gt;
&lt;br /&gt;
The libvirt project provides a GUI for managing hosts, called virt-manager. It handles local systems as well as remote ones via SSH.&lt;br /&gt;
{{Cmd|&amp;lt;nowiki&amp;gt;# apk add dbus polkit virt-manager&lt;br /&gt;
# rc-update add dbus&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
In order to use libvirtd to remotely control KVM over ssh PolicyKit needs a .pkla informing it that this is allowed.&lt;br /&gt;
Write the following file to /etc/polkit-1/localauthority/50-local.d/50-libvirt-ssh-remote-access-policy.pkla&lt;br /&gt;
{{Cmd|&amp;lt;nowiki&amp;gt;[Remote libvirt SSH access]&lt;br /&gt;
 Identity=unix-group:libvirt&lt;br /&gt;
 Action=org.libvirt.unix.manage&lt;br /&gt;
 ResultAny=yes&lt;br /&gt;
 ResultInactive=yes&lt;br /&gt;
 ResultActive=yes&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Virtualization]]&lt;/div&gt;</summary>
		<author><name>Bogon</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=15361</id>
		<title>Raspberry Pi</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=15361"/>
		<updated>2018-07-25T14:30:23Z</updated>

		<summary type="html">&lt;p&gt;Bogon: Added info on usercfg.txt and put it into Installation section&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Installation]]&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;
This section will help you format and partition your SD card:&lt;br /&gt;
&lt;br /&gt;
# [http://alpinelinux.org/downloads/ Download] Alpine for Raspberry Pi tarball which is named as &amp;lt;code&amp;gt;alpine-rpi-&amp;lt;version&amp;gt;-armhf.rpi.tar.gz&amp;lt;/code&amp;gt;.  You will need version 3.2.0 or greater if you have a Raspberry Pi 2.&lt;br /&gt;
# Mount your SD card to your workstation&lt;br /&gt;
# Use [https://en.wikipedia.org/wiki/GNOME_Disks gnome-disks] or [http://linux.die.net/man/8/fdisk fdisk] to create a FAT32 partition.  If you are using fdisk, the FAT32 partition type is called &#039;&#039;W95 FAT32 (LBA)&#039;&#039; and its ID is 0x0C.&lt;br /&gt;
# Mark the newly created partition as bootable and save&lt;br /&gt;
# Mount the previously created partition&lt;br /&gt;
# Extract the tarball contents to your FAT32 partition&lt;br /&gt;
# Unmount the SD Card.&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
Optionally create a &amp;quot;usercfg.txt&amp;quot; file on your SD card to configure low-level system settings. Specifications can be found [https://www.raspberrypi.org/documentation/configuration/config-txt here]. Some interesting values include:&lt;br /&gt;
* Enable audio: dtparam=audio=on&lt;br /&gt;
* If you see black edges around your screen: disable_overscan=1&lt;br /&gt;
&lt;br /&gt;
Alpine Linux will be installed as [[Installation#Installation_Handbook|diskless mode]], hence you need to use [[Alpine local backup|Alpine Local Backup (lbu)]] to save your modifications between reboots.  Follow these steps to install Alpine Linux:&lt;br /&gt;
&lt;br /&gt;
# Insert the SD Card into the Raspberry Pi and turn it on&lt;br /&gt;
# Login into the Alpine system as root.  Leave the password empty.&lt;br /&gt;
# Type &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;
Upon installation, make sure that 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;
=== 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 and therefore 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 Raspberry Pi does not have a clock, the 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 that you a&lt;br /&gt;
NTP daemon installed and running.  If you are not sure, then you can install 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;
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 that 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;
=== X11 Setup ===&lt;br /&gt;
Here are what you need if you want to try and run a single X11 application like a browser kiosk or maybe even a desktop: ​{{cmd|setup-xorg-base &lt;br /&gt;
​apk add xf86-video-fbdev xf86-video-vesa xf86-input-mouse xf86-input-keyboard dbus ​set​xkbmap kbd  &lt;br /&gt;
rc-update ​​add dbus}}&lt;br /&gt;
&lt;br /&gt;
Install XFCE:&lt;br /&gt;
{{cmd|apk add xfce4}}&lt;br /&gt;
&lt;br /&gt;
Commit your changes:&lt;br /&gt;
{{cmd|lbu_commit -d}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{cmd|startx}}&lt;br /&gt;
&lt;br /&gt;
=== Enable OpenGL (RPi 3) ===&lt;br /&gt;
&lt;br /&gt;
Remount the boot partition writeable (ie. /media/mmcblk0p1):&lt;br /&gt;
&lt;br /&gt;
{{cmd|mount -o remount,rw /media/mmcblk0p1}}&lt;br /&gt;
&lt;br /&gt;
Add the following lines to /media/mmcblk0p1/config.txt &lt;br /&gt;
&lt;br /&gt;
 dtoverlay=vc4-kms-v3d&lt;br /&gt;
 gpu_mem=128&lt;br /&gt;
&lt;br /&gt;
256MB gpu_mem is also possible&lt;br /&gt;
&lt;br /&gt;
Install mesa-dri-vc4:&lt;br /&gt;
{{cmd|apk add mesa-dri-vc4}}&lt;br /&gt;
&lt;br /&gt;
Reboot:&lt;br /&gt;
&lt;br /&gt;
{{cmd|lbu_commit -d; reboot}}&lt;br /&gt;
&lt;br /&gt;
== Persistent storage ==&lt;br /&gt;
&lt;br /&gt;
=== Loopback image with overlayfs ===&lt;br /&gt;
&lt;br /&gt;
The install is in disk-less mode and forces everything into memory, if you want additional storage we need to create loop-back storage onto the SD 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 doing /usr here, but you can do /home or anything else:&lt;br /&gt;
&lt;br /&gt;
{{cmd|mkdir /media/persist/usr &lt;br /&gt;
mkdir /media/persist/.work &lt;br /&gt;
echo &amp;quot;overlay /usr overlay lowerdir&amp;amp;#61;/usr,upperdir&amp;amp;#61;/media/persist/usr,workdir&amp;amp;#61;/media/persist/.work 0 0&amp;quot; &amp;gt;&amp;gt; /etc/fstab &lt;br /&gt;
mount -a}}&lt;br /&gt;
&lt;br /&gt;
Your /etc/fstab should look something like this:&lt;br /&gt;
{{Cmd|/dev/cdrom      /media/cdrom    iso9660 noauto,ro 0 0&lt;br /&gt;
/dev/usbdisk    /media/usb      vfat    noauto,ro 0 0&lt;br /&gt;
/dev/mmcblk0p1 /media/mmcblk0p1 vfat rw,relatime,fmask&amp;amp;#61;0022,dmask&amp;amp;#61;0022,errors&amp;amp;#61;remount-ro 0 0&lt;br /&gt;
/media/mmcblk0p1/persist.img /media/persist ext4 rw,relatime,errors&amp;amp;#61;remount-ro 0 0&lt;br /&gt;
overlay /usr overlay lowerdir&amp;amp;#61;/usr,upperdir&amp;amp;#61;/media/persist/usr,workdir&amp;amp;#61;/media/persist/.work 0 0}}&lt;br /&gt;
&lt;br /&gt;
Now commit the changes: (optionally remove the e2fsprogs, but it does contain repair tools)&lt;br /&gt;
{{cmd|lbu_commit -d}}&lt;br /&gt;
&lt;br /&gt;
Remember with this setup, if you install things and you have done this overlay for /usr, you must not commit the &#039;apk add&#039;, otherwise while it boots it will try and install it to memory and not to the persist 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 do 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;
&lt;br /&gt;
{{Warning|This isn&#039;t yet supported by the Alpine setup scripts for Raspberry Pi. It requires manual intervention, and might break.}}&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 these: the Raspberry Pi doesn&#039;t need this to boot anyway.&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 on shutdown.&lt;br /&gt;
&lt;br /&gt;
Beware, though, that &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 so that manually copy the files to boot partition 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 RPi3 ===&lt;br /&gt;
&lt;br /&gt;
See this page : https://wiki.alpinelinux.org/wiki/Classic_install_or_sys_mode_on_Raspberry_Pi&lt;br /&gt;
&lt;br /&gt;
See https://web.archive.org/web/20171125115835/https://forum.alpinelinux.org/comment/1084#comment-1084&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
* [[Classic install or sys mode on Raspberry Pi]] - a variant.&lt;br /&gt;
* [[Raspberry Pi 3 - Setting Up Bluetooth]]&lt;br /&gt;
* [[Raspberry Pi 3 - Configuring it as wireless access point -AP Mode]]&lt;br /&gt;
* [[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;/div&gt;</summary>
		<author><name>Bogon</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=15359</id>
		<title>Raspberry Pi</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=15359"/>
		<updated>2018-07-24T14:36:31Z</updated>

		<summary type="html">&lt;p&gt;Bogon: /* Preparation */ Changed note, bug #7024 is no longer an issue since 3.8, but kept info on usercfg.txt --&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Installation]]&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;
This section will help you format and partition your SD card:&lt;br /&gt;
&lt;br /&gt;
# [http://alpinelinux.org/downloads/ Download] Alpine for Raspberry Pi tarball which is named as &amp;lt;code&amp;gt;alpine-rpi-&amp;lt;version&amp;gt;-armhf.rpi.tar.gz&amp;lt;/code&amp;gt;.  You will need version 3.2.0 or greater if you have a Raspberry Pi 2.&lt;br /&gt;
# Mount your SD card to your workstation&lt;br /&gt;
# Use [https://en.wikipedia.org/wiki/GNOME_Disks gnome-disks] or [http://linux.die.net/man/8/fdisk fdisk] to create a FAT32 partition.  If you are using fdisk, the FAT32 partition type is called &#039;&#039;W95 FAT32 (LBA)&#039;&#039; and its ID is 0x0C.&lt;br /&gt;
# Mark the newly created partition as bootable and save&lt;br /&gt;
# Mount the previously created partition&lt;br /&gt;
# Extract the tarball contents to your FAT32 partition&lt;br /&gt;
# Unmount the SD Card.&lt;br /&gt;
{{note| You can create a &amp;quot;usercfg.txt&amp;quot; file to configure low-level system settings. Specifications can be found here: https://www.raspberrypi.org/documentation/configuration/config-txt }}&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
Alpine Linux will be installed as [[Installation#Installation_Handbook|diskless mode]], hence you need to use [[Alpine local backup|Alpine Local Backup (lbu)]] to save your modifications between reboots.  Follow these steps to install Alpine Linux:&lt;br /&gt;
&lt;br /&gt;
# Insert the SD Card into the Raspberry Pi and turn it on&lt;br /&gt;
# Login into the Alpine system as root.  Leave the password empty.&lt;br /&gt;
# Type &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;
Upon installation, make sure that 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;
=== 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 and therefore 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 Raspberry Pi does not have a clock, the 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 that you a&lt;br /&gt;
NTP daemon installed and running.  If you are not sure, then you can install 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;
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 that 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;
=== X11 Setup ===&lt;br /&gt;
Here are what you need if you want to try and run a single X11 application like a browser kiosk or maybe even a desktop: ​{{cmd|setup-xorg-base &lt;br /&gt;
​apk add xf86-video-fbdev xf86-video-vesa xf86-input-mouse xf86-input-keyboard dbus ​set​xkbmap kbd  &lt;br /&gt;
rc-update ​​add dbus}}&lt;br /&gt;
&lt;br /&gt;
Install XFCE:&lt;br /&gt;
{{cmd|apk add xfce4}}&lt;br /&gt;
&lt;br /&gt;
Commit your changes:&lt;br /&gt;
{{cmd|lbu_commit -d}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{cmd|startx}}&lt;br /&gt;
&lt;br /&gt;
=== Enable OpenGL (RPi 3) ===&lt;br /&gt;
&lt;br /&gt;
Remount the boot partition writeable (ie. /media/mmcblk0p1):&lt;br /&gt;
&lt;br /&gt;
{{cmd|mount -o remount,rw /media/mmcblk0p1}}&lt;br /&gt;
&lt;br /&gt;
Add the following lines to /media/mmcblk0p1/config.txt &lt;br /&gt;
&lt;br /&gt;
 dtoverlay=vc4-kms-v3d&lt;br /&gt;
 gpu_mem=128&lt;br /&gt;
&lt;br /&gt;
256MB gpu_mem is also possible&lt;br /&gt;
&lt;br /&gt;
Install mesa-dri-vc4:&lt;br /&gt;
{{cmd|apk add mesa-dri-vc4}}&lt;br /&gt;
&lt;br /&gt;
Reboot:&lt;br /&gt;
&lt;br /&gt;
{{cmd|lbu_commit -d; reboot}}&lt;br /&gt;
&lt;br /&gt;
== Persistent storage ==&lt;br /&gt;
&lt;br /&gt;
=== Loopback image with overlayfs ===&lt;br /&gt;
&lt;br /&gt;
The install is in disk-less mode and forces everything into memory, if you want additional storage we need to create loop-back storage onto the SD 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 doing /usr here, but you can do /home or anything else:&lt;br /&gt;
&lt;br /&gt;
{{cmd|mkdir /media/persist/usr &lt;br /&gt;
mkdir /media/persist/.work &lt;br /&gt;
echo &amp;quot;overlay /usr overlay lowerdir&amp;amp;#61;/usr,upperdir&amp;amp;#61;/media/persist/usr,workdir&amp;amp;#61;/media/persist/.work 0 0&amp;quot; &amp;gt;&amp;gt; /etc/fstab &lt;br /&gt;
mount -a}}&lt;br /&gt;
&lt;br /&gt;
Your /etc/fstab should look something like this:&lt;br /&gt;
{{Cmd|/dev/cdrom      /media/cdrom    iso9660 noauto,ro 0 0&lt;br /&gt;
/dev/usbdisk    /media/usb      vfat    noauto,ro 0 0&lt;br /&gt;
/dev/mmcblk0p1 /media/mmcblk0p1 vfat rw,relatime,fmask&amp;amp;#61;0022,dmask&amp;amp;#61;0022,errors&amp;amp;#61;remount-ro 0 0&lt;br /&gt;
/media/mmcblk0p1/persist.img /media/persist ext4 rw,relatime,errors&amp;amp;#61;remount-ro 0 0&lt;br /&gt;
overlay /usr overlay lowerdir&amp;amp;#61;/usr,upperdir&amp;amp;#61;/media/persist/usr,workdir&amp;amp;#61;/media/persist/.work 0 0}}&lt;br /&gt;
&lt;br /&gt;
Now commit the changes: (optionally remove the e2fsprogs, but it does contain repair tools)&lt;br /&gt;
{{cmd|lbu_commit -d}}&lt;br /&gt;
&lt;br /&gt;
Remember with this setup, if you install things and you have done this overlay for /usr, you must not commit the &#039;apk add&#039;, otherwise while it boots it will try and install it to memory and not to the persist 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 do 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;
&lt;br /&gt;
{{Warning|This isn&#039;t yet supported by the Alpine setup scripts for Raspberry Pi. It requires manual intervention, and might break.}}&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 these: the Raspberry Pi doesn&#039;t need this to boot anyway.&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 on shutdown.&lt;br /&gt;
&lt;br /&gt;
Beware, though, that &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 so that manually copy the files to boot partition 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 RPi3 ===&lt;br /&gt;
&lt;br /&gt;
See this page : https://wiki.alpinelinux.org/wiki/Classic_install_or_sys_mode_on_Raspberry_Pi&lt;br /&gt;
&lt;br /&gt;
See https://web.archive.org/web/20171125115835/https://forum.alpinelinux.org/comment/1084#comment-1084&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
* [[Classic install or sys mode on Raspberry Pi]] - a variant.&lt;br /&gt;
* [[Raspberry Pi 3 - Setting Up Bluetooth]]&lt;br /&gt;
* [[Raspberry Pi 3 - Configuring it as wireless access point -AP Mode]]&lt;br /&gt;
* [[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;/div&gt;</summary>
		<author><name>Bogon</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=13719</id>
		<title>Raspberry Pi</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=13719"/>
		<updated>2017-08-05T15:15:19Z</updated>

		<summary type="html">&lt;p&gt;Bogon: /* Preparation */ Add info on bug #7024&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Installation]]&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;
This section will help you format and partition your SD card:&lt;br /&gt;
&lt;br /&gt;
# [http://alpinelinux.org/downloads/ Download] Alpine for Raspberry Pi tarball which is named as &amp;lt;code&amp;gt;alpine-rpi-&amp;lt;version&amp;gt;-armhf.rpi.tar.gz&amp;lt;/code&amp;gt;.  You will need version 3.2.0 or greater if you have a Raspberry Pi 2.&lt;br /&gt;
# Mount your SD card to your workstation&lt;br /&gt;
# Use [https://en.wikipedia.org/wiki/GNOME_Disks gnome-disks] or [http://linux.die.net/man/8/fdisk fdisk] to create a FAT32 partition.  If you are using fdisk, the FAT32 partition type is called &#039;&#039;W95 FAT32 (LBA)&#039;&#039; and its ID is 0xC.&lt;br /&gt;
# Mark the newly created partition as bootable and save&lt;br /&gt;
# Mount the previously created partition&lt;br /&gt;
# Extract the tarball contents to your FAT32 partition&lt;br /&gt;
# Unmount the SD Card.&lt;br /&gt;
{{note| Due to a bug (#7024), you might want to add a &amp;quot;usercfg.txt&amp;quot; file (which is included by config.txt) with &amp;lt;code&amp;gt;enable_uart&amp;amp;#61;1&amp;lt;/code&amp;gt; written in it. Otherwise, the error message &amp;quot;Can&#039;t open /dev/ttyS0&amp;quot; will repeatedly be written to the console.}}&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
Alpine Linux will be installed as [[Installation#Installation_Handbook|diskless mode]], hence you need to use [[Alpine local backup|Alpine Local Backup (lbu)]] to save your modifications between reboots.  Follow these steps to install Alpine Linux:&lt;br /&gt;
&lt;br /&gt;
# Insert the SD Card into the Raspberry Pi and turn it on&lt;br /&gt;
# Login into the Alpine system as root.  Leave the password empty.&lt;br /&gt;
# Type &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;
Upon installation, make sure that 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;
=== 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 and therefore 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 Raspberry Pi does not have a clock, the 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 that you a&lt;br /&gt;
NTP daemon installed and running.  If you are not sure, then you can install 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;
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 that 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;
=== X11 Setup ===&lt;br /&gt;
Here are what you need if you want to try and run a single X11 application like a browser kiosk or maybe even a desktop: ​{{cmd|setup-xorg-base &lt;br /&gt;
​apk add xf86-video-fbdev xf86-input-mouse xf86-input-keyboard dbus ​set​xkbmap&lt;br /&gt;
rc-update ​​add dbus}}&lt;br /&gt;
&lt;br /&gt;
Also edit the default X11 module config: /etc/X11/xorg.conf.d/20-modules.conf&lt;br /&gt;
{{cmd|Section &amp;quot;Module&amp;quot;&lt;br /&gt;
    Load &amp;quot;fbdevhw&amp;quot;&lt;br /&gt;
    Load &amp;quot;fb&amp;quot;&lt;br /&gt;
    Load &amp;quot;shadow&amp;quot;&lt;br /&gt;
    Load &amp;quot;shadowfb&amp;quot;&lt;br /&gt;
    Load &amp;quot;dbe&amp;quot;&lt;br /&gt;
    Load &amp;quot;glx&amp;quot;&lt;br /&gt;
    Disable &amp;quot;dri&amp;quot;&lt;br /&gt;
EndSection}}&lt;br /&gt;
&lt;br /&gt;
Commit your changes:&lt;br /&gt;
{{cmd|lbu_commit -d}}&lt;br /&gt;
&lt;br /&gt;
Now you should be able to run a browser or desktop. (Guides may follow)&lt;br /&gt;
&lt;br /&gt;
If setup-xorg-base gives you an error regarding rc-update that fails to add mdev to sysinit just run:&lt;br /&gt;
{{cmd|rc-update mdev sysinit}}&lt;br /&gt;
to add it manually. If you skip this the next time you reboot your Raspberry Pi the screen maybe will not display anything on screen.&lt;br /&gt;
&lt;br /&gt;
== Persistent storage ==&lt;br /&gt;
&lt;br /&gt;
=== Loopback image with overlayfs ===&lt;br /&gt;
&lt;br /&gt;
The install is in disk-less mode and forces everything into memory, if you want additional storage we need to create loop-back storage onto the SD 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 doing /usr here, but you can do /home or anything else:&lt;br /&gt;
&lt;br /&gt;
{{cmd|mkdir /media/persist/usr &lt;br /&gt;
mkdir /media/persist/.work &lt;br /&gt;
echo &amp;quot;overlay /usr overlay lowerdir&amp;amp;#61;/usr,upperdir&amp;amp;#61;/media/persist/usr,workdir&amp;amp;#61;/media/persist/.work 0 0&amp;quot; &amp;gt;&amp;gt; /etc/fstab &lt;br /&gt;
mount -a}}&lt;br /&gt;
&lt;br /&gt;
Your /etc/fstab should look something like this:&lt;br /&gt;
{{Cmd|/dev/cdrom      /media/cdrom    iso9660 noauto,ro 0 0&lt;br /&gt;
/dev/usbdisk    /media/usb      vfat    noauto,ro 0 0&lt;br /&gt;
/dev/mmcblk0p1 /media/mmcblk0p1 vfat rw,relatime,fmask&amp;amp;#61;0022,dmask&amp;amp;#61;0022,errors&amp;amp;#61;remount-ro 0 0&lt;br /&gt;
/media/mmcblk0p1/persist.img /media/persist ext4 rw,relatime,errors&amp;amp;#61;remount-ro 0 0&lt;br /&gt;
overlay /usr overlay lowerdir&amp;amp;#61;/usr,upperdir&amp;amp;#61;/media/persist/usr,workdir&amp;amp;#61;/media/persist/.work 0 0}}&lt;br /&gt;
&lt;br /&gt;
Now commit the changes: (optionally remove the e2fsprogs, but it does contain repair tools)&lt;br /&gt;
{{cmd|lbu_commit -d}}&lt;br /&gt;
&lt;br /&gt;
Remember with this setup, if you install things and you have done this overlay for /usr, you must not commit the &#039;apk add&#039;, otherwise while it boots it will try and install it to memory and not to the persist 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 do 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;
&lt;br /&gt;
{{Warning|This isn&#039;t yet supported by the Alpine setup scripts for Raspberry Pi. It requires manual intervention, and might break.}}&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 these: the Raspberry Pi doesn&#039;t need this to boot anyway.&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 on shutdown.&lt;br /&gt;
&lt;br /&gt;
Beware, though, that &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 so that manually copy the files to boot partition 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; /etc/fstab&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
* [[Create a bootable SDHC from a Mac]]&lt;/div&gt;</summary>
		<author><name>Bogon</name></author>
	</entry>
</feed>