Install Alpine on a btrfs filesystem with refind as boot manager: Difference between revisions
Prabuanand (talk | contribs) m (fixed grammar issues) |
Prabuanand (talk | contribs) m (added Note: template) |
||
(3 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{Note| This tutorial assumes that your other OS is already installed and working with <code>[[#rEFInd|rEFInd]]</code> as boot manager and your harddisk filesystem is [[btrfs]]. Eventhough, {{pkg|refind|branch=edge|repo=testing}} is available in the testing repository of Alpine Linux, this tutorial does not need it to be installed.}} | |||
Boot your PC from the Alpine Linux USB. Once booted, log in as root (no password required). | Boot your PC from the Alpine Linux USB. Once booted, log in as root (no password required). | ||
Line 11: | Line 11: | ||
</pre> | </pre> | ||
Mount the btrfs partition to /mnt | Mount the btrfs partition to /mnt. | ||
{{cmd|# mount /dev/nvme0n1p3 /mnt -t btrfs}} | {{cmd|# mount /dev/nvme0n1p3 /mnt -t btrfs}} | ||
Line 29: | Line 29: | ||
* Choose a mirror for packages | * Choose a mirror for packages | ||
* Create a new user (optional but recommended) | * Create a new user (optional but recommended) | ||
* After this accept the remaining choices. | * After this accept the remaining choices, if any. | ||
Once basic setup is complete, prepare your disk for installation: | Once basic setup is complete, prepare your disk for installation of Alpine as a subvolume in the [[btrfs]] filesystem: | ||
Create a new [[Btrfs]] subvolume for Alpine and you need btrfs-progs package | |||
Create a new [[Btrfs]] subvolume for Alpine and you need {{Pkg|btrfs-progs}} package | |||
{{cmd|# apk add btrfs-progs }} | {{cmd|# apk add btrfs-progs }} | ||
Create a new Btrfs subvolume for Alpine: | Create a new Btrfs subvolume for Alpine: | ||
{{cmd|# btrfs subvolume create /mnt/@alpine}} | {{cmd|# btrfs subvolume create /mnt/@alpine}} | ||
Create a new mountpoint and mount the newly created subvolume: | |||
{{cmd|# mkdir /mnt/os}} | {{cmd|# mkdir /mnt/os}} | ||
<pre># mount -o subvol=@alpine /dev/nvme0n1p3 /mnt/os</pre> | <pre># mount -o subvol=@alpine /dev/nvme0n1p3 /mnt/os</pre> | ||
Line 47: | Line 45: | ||
Install the base system using the below command: | Install the base system using the below command: | ||
{{cmd|# setup-disk -m sys /mnt/os}} | {{cmd|# setup-disk -m sys /mnt/os}} | ||
This will install the base system to the mounted subvolume. Once the base system is installed, chroot into the new system: | This will install the base system to the mounted subvolume. Once the base system is installed, chroot into the new system: | ||
{{cmd|# chroot /mnt/os}} | {{cmd|# chroot /mnt/os}} | ||
Edit /etc/fstab to use the correct subvolume. Ensure that root entry looks like below. Mounting the efi partition is optional. If you want to share your @home subvolume between both the operating systems, you can also add an entry for it now. | |||
{{Cat|/etc/fstab |<nowiki> | |||
UUID=823a3283-30a7-4fef-b50b-8a2230c71b5b / btrfs rw,relatime,compress=zlib:3,ssd,discard=async,space_cache=v2,subvol=/@alpine 0 1 | |||
UUID=55C3-8AB4 /boot/efi vfat rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=utf8,shortname=mixed,errors=remount-ro 0 2 | |||
</nowiki>}} | |||
Verify linux kernel is installed successfully. | |||
{{cmd|# apk list --installed |grep linux}} | {{cmd|# apk list --installed |grep linux}} | ||
If your other OS is already installed and working with refind as boot manager, then there is no need to install refind here. | If your other OS is already installed and working with refind as boot manager, then there is no need to install refind here. | ||
Line 76: | Line 74: | ||
Edit /mnt/os/boot/efi/EFI/refind/refind.conf to boot alpine | Edit /mnt/os/boot/efi/EFI/refind/refind.conf to boot alpine by adding an entry for Alpine Linux as shown below: | ||
{{Cat|/boot/efi/EFI/refind/refind.conf|<nowiki> | |||
menuentry "Alpine Linux" { | menuentry "Alpine Linux" { | ||
volume "BTRFSVOL" | volume "BTRFSVOL" | ||
Line 85: | Line 82: | ||
initrd @alpine/boot/initramfs-lts | initrd @alpine/boot/initramfs-lts | ||
options "root=UUID=823a3283-30a7-4fef-b50b-8a2230c71b5b rw rootflags=subvol=@alpine rootfstype=btrfs" | options "root=UUID=823a3283-30a7-4fef-b50b-8a2230c71b5b rw rootflags=subvol=@alpine rootfstype=btrfs" | ||
} | } | ||
</nowiki>}} | |||
Do not use PARTUUID in refind.conf as it does not work for booting alpine. | |||
Unmount everything: | Unmount everything: | ||
Line 99: | Line 97: | ||
Now, you should now see an option to boot into Alpine Linux in the rEFInd boot menu. | Now, you should now see an option to boot into Alpine Linux in the rEFInd boot menu. | ||
* [https://wiki.archlinux.org/title/REFInd#For_manual_boot_stanzas Refind in Arch Wiki] |
Latest revision as of 11:19, 12 August 2024
rEFInd
as boot manager and your harddisk filesystem is btrfs. Eventhough, refind is available in the testing repository of Alpine Linux, this tutorial does not need it to be installed.Boot your PC from the Alpine Linux USB. Once booted, log in as root (no password required). Identify your partitions by using the command.
# blkid
/dev/nvme0n1p1: UUID="55C3-8AB4" TYPE="vfat" /dev/nvme0n1p2: UUID="dab64e31-fb89-4364-b90f-b79400f73304" TYPE="swap" /dev/nvme0n1p3: LABEL="BTRFSVOL" UUID="823a3283-30a7-4fef-b50b-8a2230c71b5b" TYPE="btrfs"
Mount the btrfs partition to /mnt.
# mount /dev/nvme0n1p3 /mnt -t btrfs
Run the setup script:
# setup-alpine
This will guide you through basic system configuration. Follow the prompts to:
- Select keyboard layout
- Set hostname
- Configure network (choose your WiFi interface and enter your WiFi credentials)
- Set root password
- Choose timezone
- Choose NTP client (chronyd)
- Choose a mirror for packages
- Create a new user (optional but recommended)
- After this accept the remaining choices, if any.
Once basic setup is complete, prepare your disk for installation of Alpine as a subvolume in the btrfs filesystem:
Create a new Btrfs subvolume for Alpine and you need btrfs-progs package
# apk add btrfs-progs
Create a new Btrfs subvolume for Alpine:
# btrfs subvolume create /mnt/@alpine
Create a new mountpoint and mount the newly created subvolume:
# mkdir /mnt/os
# mount -o subvol=@alpine /dev/nvme0n1p3 /mnt/os
Install the base system using the below command:
# setup-disk -m sys /mnt/os
This will install the base system to the mounted subvolume. Once the base system is installed, chroot into the new system:
# chroot /mnt/os
Edit /etc/fstab to use the correct subvolume. Ensure that root entry looks like below. Mounting the efi partition is optional. If you want to share your @home subvolume between both the operating systems, you can also add an entry for it now.
Contents of /etc/fstab
Verify linux kernel is installed successfully.
# apk list --installed
If your other OS is already installed and working with refind as boot manager, then there is no need to install refind here. You may want to remove the grub and grub-efi packages
# apk del grub grub-efi
Exit the chroot:
# exit
Mount the EFI partition to edit the refind.conf file
# mkdir /mnt/os/boot/efi
# mount dev/nvme0n1p1 /mnt/os/boot/efi
Edit /mnt/os/boot/efi/EFI/refind/refind.conf to boot alpine by adding an entry for Alpine Linux as shown below:
Contents of /boot/efi/EFI/refind/refind.conf
Do not use PARTUUID in refind.conf as it does not work for booting alpine.
Unmount everything:
# umount -R /mnt
Reboot your system.
# reboot
Now, you should now see an option to boot into Alpine Linux in the rEFInd boot menu.