Make Live USB on Alpine Linux

What is Alpine Linux

It's a lightweight Linux that lets busybox do anything. Due to its light weight, it is often used as a component of Docker. GUI? I don't know.

Alpine Linux ISO image

The image of Alpine Linux is below.

https://www.alpinelinux.org/downloads/

Normally, a Standard ISO image is used. For offline installations, Extend is a good choice. Use Virtual ISO for the virtual OS. The Virtual image is extraordinarily small at 40MB.

Features of Alpine Linux

The main command is busybox symlink

busybox is a command for embedding, and the file size is reduced by making ls and cp symbolic of busybox. Actually this has a trap (behavior is slightly different)

By the way, if you look under/bin of initramfs, there are only sh and busybox.

The shell is not bash.

Alpine Linux uses a shell called ash. Compatible with sh, but not compatible with bash. If you want to run bash-dependent scripts, you need to install bash separately.

Make Live USB

--For Windows, write in ISO mode with rafus. --Linux is the official reference

I tried inserting the 1GB USB I picked up, but it works well.

install

Alpine Linux does not autostart the installer. When you start it, the login screen just starts. Log in as root and then from the command line

setup-alpine

You can install it by typing ――, but this time it will not be done.

Reflect updates on Live USB

From here is the production.

Alpine Linux has a system called Alpine local backup. You can do something similar to Ubuntu's live usb perticient (casper-rw), but

lbu commit

If you do not type, the update will not be reflected. It seems that the range to be updated is only some other parts such as/etc, and/root and/bin etc. are not reflected (There are ways to change the settings under/etc/lbu or use lbu include). When running lbu, you need to rewrite /etc/lbu/lbu.conf first.

This update file will be spit out to the root with a name like localhost.apkov.tar.gz, so you can fix it by hand. Use this for customization. Unlike casper-rw, it does not require a mount and is tar.gz, so it can be easily rewritten. It's also lightweight because it doesn't sync.

First, in order to execute in the Japanese environment, execute the following.

##Change keymap
# setup-keymap 
##Change time zone
# setup-timezone
##Save changes
# lbu commit

Japanese? Unfamiliar child

Easy custom Live USB

Insert the apk file into the free media. USB is mounted on/media/usb,

So rewrite/etc/inittab.

Change before

tty1::respawn:/sbin/getty 38400 tty1

After change

tty1::respawn:/bin/sh /media/usb/init.sh 38400 tty1

As I wrote earlier, the update will not be reflected unless you execute lbu commit.

Then write a script to run init.sh (/ media/usb is in read only mode so it can't be rewritten directly). Here,/media/usb is called, but if it is under/etc, it will work even if the USB memory is removed after startup.

However, note that once the memory is removed, the area under/media/usb will be empty.

--If the behavior is strange after startup, switch terminals with CTRL + ALT + F2 and process

With this, you can easily make HDD cleaners without troublesome customization.

Notes

For example, shred is used to make a disc shredder imitation, but Alpine Linux shred is a busybox symbolic link. Busybox shred can only erase files and has different options. So you need to install GNU coreutils separately.

The package manager for Alpine Linux is apk, and add is used when installing.

 apk add coreutils

――If so, you will be able to use GNU shred, which is not busybox.

Alpine Linux is lightweight, so it seems that there are cases where the library is insufficient when trying to run the utility.

However, those apks should be installed at startup. For small binaries, the installation time is within the margin of error (you can also change the settings under/etc/lbu)

Create an extra folder on the USB and throw in the apk to install.

 apk add --no-network --allow-untrusted --force-non-repository /media/usb/extra/*.apk

In this way, I forcibly install it from init.sh (I have no choice but to make one without a package), so I can easily make LiveUSB because I do not customize it.

I feel that using the lbu package is the correct way to do it ...

Recommended Posts

Make Live USB on Alpine Linux
Command to create Linux Live USB
Enjoy edge computing on Alpine Linux
Make Unity Accelerator a service on Linux
How to install packages on Alpine Linux
Daemonizing processes on Linux
Specify the volume on linux and make a sound
Install Grub on USB memory (UEFI) ~ Boot Linux from grub on USB memory ~
jblas on Arch Linux
Linux (WSL) on Windows
NAT router on Linux
Make your cursor a photo of your choice on Linux
Realtek RTL8761B Cheap Bluetooth 5.0 USB Dongle Runs on Linux
Develop .NET on Linux
Wake on lan on Linux
Monitor traffic on Linux
Update vscode on linux
Try NeosVR on Linux
Check capacity on Linux
LiveUSB creation on Linux
Linux operation on Win10
Game distribution to YouTube Live on Arch Linux (Nintendo Switch)
Install Linux (CentOS) on your PC using a USB stick
[Tips] Persistence of Kali Linux Live Image with USB memory
NTP configuration memo on Linux
Install Minecraft on Arch Linux
Install Linux on your Chromebox
Downgrade Mcomix on Arch Linux
Monitor disk usage on Linux
Alpine Linux 3.13 installation, Japanese input
USB Wifi on Ubuntu 20.04LTS
Use Github Desktop on Linux
Install the JDK on Linux
Recording and playback on Linux
Make Cython available on Windows.
Check TTL on Linux router
Read core voltage on Linux
Put jenv on Amazon Linux
Easy df command on Linux
Linux on Windows -1-: debian introduction
Install tomcat 5.5 on Amazon Linux.
Introducing Elixir on Linux Mint
Make Amazon Linux 2 (CentOS) GUI
Use sshpass on Amazon linux2
Install Homebrew on Amazon Linux 2
Paste the link on linux
Install strongSwan 5.9.1 on Amazon Linux 2
Linux environment construction (on WSL environment)
Run FreeBSD on Linux + qemu
Use Linux on Windows 10 (WSL2)