Create a Bootable Device

From Alpine Linux
Revision as of 03:08, 15 March 2021 by Abelito (talk | contribs) (Typos)

Generally there's no difference between Alpine Linux USB bootable installation medium and installed system in diskless or run-from-ram installation mode. The only difference is that after finished installation modified files have to be saved somewhere, hence Alpine Local Backup. Thus this document describes how to proceed to end with an installation of a system in diskless or run-from-ram installation mode with locally saved modifications.

This process applies to Alpine Linux 1.9.0 or later.

Requirements

In order to follow this document, you will need:

  • Alpine Linux CD-ROM (Download a .iso file containing an Alpine release.)
  • A USB drive (flash, external HD, card reader, etc.)

Copy Alpine to USB stick

This material is proposed for deletion ...

This include has become obsolete. It is completely unused on the wiki (Discuss)
Make sure no other pages link here and check the page's history before deleting.

Finishing installation

After one has booted previously created Alpine Linux bootable USB medium, to finish the installation one has to prepare USB stick to hold local customizations and run setup-alpine.

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 files are created/modified by the installer and which need to be preserved:

# 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

Thus all our customization is saved into 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)
Note: Just type any of the above commands on your console and hit Enter to execute the script.

Other useful pages