Create a Bootable Device
A custom Alpine Linux boot medium is basically an Alpine system installed to the device in diskless or data disk-mode.
If the device remains writable, the local configs (.apkovl) and the package cache may also be stored on the same device.
Requirements
In order to follow this document, you will need:
- An Alpine Linux CD-ROM or an .iso file containing an Alpine release (Download).
- A USB drive (flash, external HD, card reader, etc.)
Using setup-bootable
The preferable method to create a custom bootable device now is to follow the Installation for a diskless or data mode system on the device, and use the setup-bootable
script to make the device bootable.
Manually copying Alpine files
This process applies to Alpine Linux 1.9.0 or later.
![]() This include has become obsolete. It is completely unused on the wiki
(Discuss) |
Finishing installation
After one has booted the previously created Alpine Linux bootable USB medium, one has to prepare USB stick to hold local customizations and run setup-alpine to finish the installation.
First let's find out where is our just booted USB media mounted, the location could vary.
# mount | grep /media /dev/sda1 on /media/sda1 type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=utf8,shortname=mixed,errors=remount-ro)
Create local directory on USB media to hold local APK cache (see APK Local Cache for details).
# mount -o remount,rw /media/sda1 # mkdir /media/sda1/cache # setup-apkcache /media/sda1/cache # ls -l /etc/apk/cache lrwxrwxrwx 1 root root 17 Oct 19 13:16 /etc/apk/cache -> /media/sda1/cache
Now run setup-alpine and proceed until a question about local disk selection - in diskless mode we won't use any disk (ie. our bootable media files is basically untouched) and we are going to use sda1 to hold our system customization.
# setup-alpine ... Which disk(s) would you like to use? (or '?' for help or 'none') [none] Enter where to store configs ('floppy', 'sda1', 'usb' or 'none') [sda1]: Enter apk cache directory (or '?' or 'none') [/media/sda1/cache]:
After the installer finished you can see how many created/modified files are detected and will be added to the backup:
# lbu status # lbu status | wc -l 59 # lbu commit # ls -l /media/sda1/*apkovl.tar.gz -rwxr-xr-x 1 root root 9591 Oct 19 15:23 /media/sda1/foo.apkovl.tar.gz
Now all the customization are saved into the foo.apkovl.tar.gz compressed tarball on the USB stick itself.
Troubleshooting
Slow USB Devices
Specifying the 'waitusb=X' option at the end of the syslinux.cfg line might help with certain USB devices that take a bit longer to register. X stands for the amount of seconds kernel will wait before looking for the installation media.
append initrd=/boot/grsec.gz alpine_dev=usbdisk:vfat modules=loop,cramfs,sd-mod,usb-storage quiet waitusb=3
See Also
Alpine Linux has some special applications that helps you to use it in the way you want.
Some of the first scripts you are suggested to use is:
- setup-alpine (Configures all basic things on your Alpine Linux)
- setup-acf (was named setup-webconf before Alpine 1.9 beta 4) (Configures ACF (webconfiguration) so you can manage your box through https)
Other useful pages
- Configure Networking
- Setting up a SSH server (Using ssh is a good way to administer your box remotely)
- Package Management (apk) (How to add/remove packages on your Alpine)
- Init System (rc) (Configure a service to automatically boot at next reboot)
- Alpine local backup (lbu) (Permanently store your modifications in case your box needs reboot)