You are not logged in.

#1 2023-09-29 01:28:31

bedtime
Member
Registered: 2019-02-12
Posts: 68

Installing arch with btrfs on a USB stick

I got this working on Fedora, Debian, and EndeavorOS, but I'm having troubles with getting it going on Arch.

Spent about 10 hours today, same yesterday. Tried several tutorials and no go. Tried legacy and EFI with my bios at the proper settings, and not working. By this I mean my machine won't even register it.

There must be a tutorial out there that has this. I could print the script I used to install if it helps.

*** edit ***

arch-install.sh:

timedatectl


disks=/dev/sdb


sed -e 's/\s*\([\+0-9a-zA-Z]*\).*/\1/' << EOF | fdisk $disk
d     # Delete partition

d     # Delete partition

d     # Delete partition

d     # Delete partition

d     # Delete partition

d     # Delete partition

n     # Add a new partition
p     # Partition number (Accept default: 1)
      # First sector (Accept default: varies)
      #
+1G   # Last sector (Accept default: varies)
t     # Type of filesystem
uefi  # Type of partition (EFI system partition)
n     # Add a new partition
      # Partition number (Accept default: 4)
      # Accept first sector
      # Accept last sector (Default: remaining space)
t     # Type of partition
      # Accept default
linux # Type of partition
p     # Printout partitions
w     # Write the changes
EOF


mkfs.fat -F 32 -n SYS $disk'1'
mkfs.btrfs -f -L ROOT $disk'2'

mkdir -p $mnt
mount $disk'2' $mnt

cd $mnt

btrfs subvolume create @
btrfs subvolume create @varlog
btrfs subvolume create @vartmp
btrfs subvolume create @varcache
btrfs subvolume create @snapshots

cd /
umount $mnt

mount -o compress=zstd,noatime,subvol=@ $disk'2' $mnt

mkdir -p $mnt/{boot,var/{log,cache,tmp},tmp,.snapshots}

mount -o compress=zstd,noatime,subvol=@varlog $disk'2' $mnt/var/log
mount -o compress=zstd,noatime,subvol=@varcache $disk'2' $mnt/var/cache
mount -o compress=zstd,noatime,subvol=@vartmp $disk'2' $mnt/var/tmp
mount -o compress=zstd,noatime,subvol=@snapshots $disk'2' $mnt/.snapshots

# Make dirs nocow
chattr +C $mnt/var/log $mnt/var/cache $mnt/var/tmp


# mount efi partition
mount --mkdir $disk'1' $mnt/boot


pacstrap -K $mnt base linux linux-firmware btrfs-progs iwd vi

genfstab -U $mnt >> $mnt/etc/fstab

arch-chroot $mnt /./chroot-script.sh

exit


cd /
umount --recursive $mnt

chroot-script.sh:

ln -sf /usr/share/zoneinfo/Canada/Eastern /etc/localtime

disk=/dev/sdb

hwclock --systohc

locale-gen

echo 'LANG=en_US.UTF-8' > /etc/locale.conf
echo 'archiso' > /etc/hostname
echo 'KEYMAP=us' > /etc/vconsole.conf

printf "123456\n123456\n" | passwd root

ls -la /

pacman --needed -Sy grub efibootmgr os-prober

grub-install --target=i386-pc $disk --recheck
grub-install --target=x86_64-efi --bootloader-id=GRUB --efi-directory=/boot/efi

grub-mkconfig -o /boot/grub/grub.cfg
mkdir /boot/efi/EFI/BOOT
cp /boot/efi/EFI/GRUB/grubx64.efi /boot/efi/EFI/BOOT/BOOTX64.EFI


systemctl enable systemd-networkd
systemctl enable systemd-resolved

useradd -m user -p 123456
usermod -aG wheel user

Last edited by bedtime (2023-09-29 01:43:59)

Offline

#2 2023-09-29 01:56:55

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,598

Re: Installing arch with btrfs on a USB stick

You mounted your ESP to /boot but told grub-install it was at /boot/EFI. You also didn't use grub-install's --removable option, which is needed on many/most machines for USB installations.

Offline

#3 2023-09-29 02:05:03

bedtime
Member
Registered: 2019-02-12
Posts: 68

Re: Installing arch with btrfs on a USB stick

Scimmia wrote:

You mounted your ESP to /boot but told grub-install it was at /boot/EFI. You also didn't use grub-install's --removable option, which is needed on many/most machines for USB installations.

Thanks so much for the quick reply.

Getting ready for bed now, but I'll be sure to give it a go tomorrow!

*** edit ***

Couldn't keep away, lol. Just tried it and it worked. big_smile

Actual command change was:

grub-install --target=x86_64-efi --bootloader-id=GRUB --efi-directory=/boot/ --removable

Time for the sandman.

Thanks again Scimmia! I'll be sure to post the entire script tomorrow if anyone is interested.

Last edited by bedtime (2023-09-29 02:44:01)

Offline

Board footer

Powered by FluxBB