alpine-persistent-usb
alpine-persistent-usb copied to clipboard
Guide for making an Alpine Linux USB with persistence
alpine-persistent-usb
Guide for making an Alpine Linux USB with persistence
Note: Replace all instances of {?X} (including the braces) with the proper value
Preparation
- Download the latest version of Alpline Standard x86_64
- Write it to a USB using
ddorrufusand leave a shared or unallocated partition to use later for your/homedirectory - Reboot to your boot menu and boot to Alpine on the USB
Setup Root Partition
- Login using login:
root, password: (none) - Run
mkdir /media/trueroot - Run
setup-alpine
- Diskless install
- Store configs in
trueroot - Store cache in
/media/trueroot/cache
- Run the following commands
apk add util-linux nano(nano is optional if you're comfortable with vi)lsblkand note what partition (usually/media/usb) the usb is running from on your USBblkid | grep /dev/{?0} >> /etc/fstabwhere{?0}is the currently booted partition,
- Change your
fstabto use the uuid and mount it to/media/trueroot
- Run
nano /etc/fstab - Replace the line that contains your root partition with the UUID at the bottom line to creating the following:
UUID={?m1-own-uu1d} /media/trueroot vfat defaults,noatime 0 0where{?m1-own-uu1d}is the UUID for your root partition on the last line (added with grep) - Press
ctrl+o, followed byctrl+xto save and exit
- Partition your USB
- Run
fdisk /dev/{?sd}where{?sd}is the USB - Create home partition (can also create a shared partition to act like a regular USB`
- Set home partition of type
Linux home - Select
Write - Select
Yes - Exit
- Run the following commands to save and reboot:
lbu cireboot
Setup Home Partition
- Update your repositories and apkcache
- Run
apk add nano e2fsprogs f2fs-tools dosfstools util-linux - Run
nano /etc/apk/repositories - Change top line to
/media/trueroot/apks - Uncomment
edge/mainandedge/communityby removing the# - Comment out everything else by addting a
#at the beginning of the line - Press
ctrl+o, followed byctrl+xto save and exit
- Format your partitions
- Run
mkfs.f2fs /dev/{?sd}where{?sd}is the home partition - (OPTIONAL, shared partition only) Run
mkfs.fat -F32 /dev/{?sd}where{?sd}is the shared partition
- Update your fstab to mount your home partition to
/home
- Run
blkid | grep /dev/{?sd} >> /etc/fstabwhere{?sd}is your home partition created above - Run
nano /etc/fstab - Change the bottom line to the following:
UUID={?m1-h0m3-uu1d} /home f2fs defaults,noatime 0 0where{?m1-h0m3-uu1d}is the UUID for your home partition at the last line (added from grep) - Press
ctrl+o, followed byctrl+xto save and exit
- Update lbu and apkcache
- Run
setup-lbu - Type
trueroot - Run
setup-apkcache - Type
/media/trueroot/cache
- Run the following commands to save and reboot:
lbu cireboot
User Configuration
- Run the following commands for a simple dwm setup
setup-xorg-baseapk add sudo dmenu st dwm font-fira-mono-nerd firefoxsed -i '/%wheel all=(all) all/s/^#//g' /etc/sudoersor simply uncomment%wheel all=(all) allin/etc/sudoersadduser user -G wheelgroupadd user input,tty,video,wheelsu userecho 'exec dwm' >> ~/.xinitrcecho 'startx' >> ~/.profilesudo lbu cistartx
- Follow this guide for audio
- https://wiki.alpinelinux.org/wiki/Sound_Setup
- Follow this guide for flatpak
- Install flatpaks with
--usersince root (system) installs will not save, but user saves in/homepartition - https://gist.github.com/IronOxidizer/06bd98459e9bb0b9d2de3b76fa0ca421
- Reduce drive writes
- https://wiki.archlinux.org/index.php/Install_Arch_Linux_on_a_removable_medium#Tips
- https://wiki.archlinux.org/index.php/Improving_performance#Reduce_disk_reads/writes
- https://foxutech.com/how-to-disable-enable-journaling/
- libeatmydata
eatmydata firefoxhttps://www.reddit.com/r/programming/comments/1qligk
- Config npm if necessary
npm config set prefix '~/.local'
- Config inittab (reduce ttys)
nano /etc/inittab
- Config OpenRc for faster boot times
nano /etc/rc.conf- uncomment
rc_parallel="YES"
lbu ci