Howto install archlinuxarm raspberrypi5: Difference between revisions

From Vidalinux Wiki
Jump to navigation Jump to search
 
(44 intermediate revisions by 2 users not shown)
Line 1: Line 1:
= download image =
= requeriments =
* raspberrypi 5
* sdcard 8gb or more
* mini hdmi female to micro hdmi male adapter or cable
* usb-c power adapter
* archlinux or debian system to the create image
 
= download images =
download raspios image:
download raspios image:
  wget https://downloads.raspberrypi.org/raspios_arm64/images/raspios_arm64-2023-12-06/2023-12-05-raspios-bookworm-arm64.img.xz
  wget https://downloads.raspberrypi.org/raspios_arm64/images/raspios_arm64-2023-12-06/2023-12-05-raspios-bookworm-arm64.img.xz
Line 12: Line 19:
use qemu-user-static to interpret the arm instructions in the chroot:
use qemu-user-static to interpret the arm instructions in the chroot:
  pacman -Sy qemu-user-static --noconfirm
  pacman -Sy qemu-user-static --noconfirm
install multipath-tools:
install multipath-tools in archlinux:
  pacman -S multipath-tools
  pacman -S multipath-tools --noconfirm
script to mount raspberrypi image:
if you use debian you can install this packages:
  cat > ./raspimg << 'EOF'
apt install kpartx qemu-user-static
#!/bin/bash
script to mount and umount raspberrypi image:
  if [ $# -eq 0 ]
  curl -ko ./raspimg https://raw.githubusercontent.com/vidalinux/raspi/main/raspimg
  then
  chmod +x ./raspimg
    echo "" && \
mount image to /mnt/temp without binding directories:
    echo " mount:  mount image" && \
./raspimg mount $(date +%F)-archlinux-aarch64.img
    echo " umount: unmount image" && \
  do you want to bind /dev /proc /sys /pkg directories now : no
    echo "" && \
remove image contents from:
    echo " example: ./raspimg mount 2024-02-20-archlinux-aarch64.img"
rm -rf /mnt/temp/*
    echo ""; exit
decompress archlinux arm file to /mnt/temp:
fi
tar xvf ArchLinuxARM-rpi-aarch64-latest.tar.gz -C /mnt/temp
if [ $1 = mount ];
  then
  if [ ! -d /mnt/temp ];
  then
  mkdir /mnt/temp
  fi
  kpartx -va $2 1> /tmp/part-names.txt
  PART2=$(cat /tmp/part-names.txt | awk '{print $3}' | grep p2$)
  PART1=$(cat /tmp/part-names.txt | awk '{print $3}' | grep p1$)
  sleep 1
  mount /dev/mapper/$PART2 /mnt/temp
  mount /dev/mapper/$PART1 /mnt/temp/boot/
  sleep 1
  read -p "do you want to bind /dev /proc /sys /pkg directories now : " QUESTION
  if [ $QUESTION = yes ];
  then
  mount -o bind /dev /mnt/temp/dev
  mount -o bind /dev/pts /mnt/temp/dev/pts
  mount -o bind /proc /mnt/temp/proc
  mount -o bind /sys /mnt/temp/sys
  rm /tmp/part-names.txt
  if [[ $2 == *[32]* ]]; then
  if [ ! -d ./pkg32 ];
  then
  mkdir ./pkg32
  fi
  mount -o bind ./pkg32 /mnt/temp/var/cache/pacman/pkg
  fi
  if [[ $2 == *[64]* ]]; then
  if [ ! -d ./pkg64 ];
  then
  mkdir ./pkg64
  fi
  mount -o bind ./pkg64 /mnt/temp/var/cache/pacman/pkg
  fi
  fi
fi
if [ $1 = umount ];
then
umount /mnt/temp/var/cache/pacman/pkg
umount /mnt/temp/dev/pts
umount /mnt/temp/dev
umount /mnt/temp/proc -l
umount /mnt/temp/sys
umount /mnt/temp/boot
umount /mnt/temp
kpartx -vd $2
fi
EOF
mount image to /mnt/temp:
./raspimg mount 2024-02-20-archlinux-aarch64.img
copy the qemu-aarch64-static binary to the chroot:
copy the qemu-aarch64-static binary to the chroot:
  cp /usr/bin/qemu-aarch64-static /mnt/temp/usr/bin/
  cp /usr/bin/qemu-aarch64-static /mnt/temp/usr/bin/
register the qemu-aarch64-static as an arm interpreter in the kernel:  
register the qemu-aarch64-static as an arm interpreter in the kernel:  
  echo ':aarch64:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xb7:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-aarch64-static:' > /proc/sys/fs/binfmt_misc/register
  curl -ko /usr/local/bin/binfmt_manager https://raw.githubusercontent.com/mikkeloscar/binfmt-manager/master/binfmt_manager
chmod +x /usr/local/bin/binfmt_manager
binfmt_manager register aarch64
umount image:
./raspimg umount $(date +%F)-archlinux-aarch64.img
mount it again binding /dev /proc /sys and pkg directories:
./raspimg mount $(date +%F)-archlinux-aarch64.img
do you want to bind /dev /proc /sys /pkg directories now : yes
enter chroot using arch-chroot:
enter chroot using arch-chroot:
  chroot /mnt/temp
  chroot /mnt/temp


= configure image =
= configure image =
update /etc/fstab for the different sd block device:
sed -i 's/mmcblk0/mmcblk1/g' /etc/fstab
initialize pacman:
initialize pacman:
  pacman-key --init
  pacman-key --init
  pacman-key --populate archlinuxarm
  pacman-key --populate archlinuxarm
remove /etc/resolv.conf file:
rm /etc/resolv.conf
configure dns:
cat > /etc/resolv.conf << EOF
nameserver 4.2.2.1
nameserver 4.2.2.2
EOF
update all system:
pacman -Syuu --noconfirm
install the following packages:
install the following packages:
  pacman -Sy base-devel libnewt git wget rsync networkmanager parted multipath-tools lsof git sudo fakeroot screen --noconfirm
  pacman -Sy base-devel libnewt git wget rsync networkmanager parted multipath-tools lsof git sudo fakeroot screen inetutils --noconfirm
install expand-sd:
install expand-sd:
  curl -ko /usr/local/bin/expand-sd https://img.vidalinux.com/files/expand-sd
  curl -ko /usr/local/bin/expand-sd https://raw.githubusercontent.com/vidalinux/raspi/main/expand-sd
  chmod +x /usr/local/bin/expand-sd
  chmod +x /usr/local/bin/expand-sd
set password to alarm user:
set password to alarm user:
Line 98: Line 72:
change root password:
change root password:
  passwd root
  passwd root
update and replace current kernel:
replace current kernel with aarch64:
  pacman -Sy linux-rpi --noconfirm
  pacman -Sy linux-rpi
make sure you have rpi5 support:
pacman -Ql linux-rpi | grep rpi-5
disable the following services:
disable the following services:
  systemctl disable systemd-networkd
  systemctl disable systemd-networkd
  systemctl disable systemd-networkd.socket
  systemctl disable systemd-networkd.socket
  systemctl disable systemd-resolved
  systemctl disable systemd-resolved
disable suspend, hibernate or sleep:
systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target
start and enable networkmanager:
start and enable networkmanager:
  systemctl enable NetworkManager
  systemctl enable NetworkManager
systemctl start NetworkManager
 
= desktop environment =
= desktop environment =
install xorg:
install xorg:
  pacman -S alsa-utils alsa-oss xorg xorg-server xf86-video-fbdev xorg-xrefresh adobe-source-han-sans-cn-fonts ttf-dejavu ttf-bitstream-vera wqy-zenhei ttf-arphic-ukai ttf-arphic-uming opendesktop-fonts ttf-inconsolata ttf-ubuntu-font-family adobe-source-code-pro-fonts
  pacman -Sy --noconfirm alsa-utils alsa-oss xorg xorg-server xf86-video-fbdev xorg-xrefresh adobe-source-han-sans-cn-fonts ttf-dejavu ttf-bitstream-vera wqy-zenhei ttf-arphic-ukai ttf-arphic-uming opendesktop-fonts ttf-inconsolata ttf-ubuntu-font-family adobe-source-code-pro-fonts xorg-xclock xterm xorg-twm libmd libbsd
install xfce4:
install xfce4:
  pacman -S xfce4 xfce4-goodies lightdm-gtk-greeter accountsservice gvfs gvfs-mtp ntfs-3g exfat-utils p7zip file-roller fcitx fcitx-configtool fcitx-googlepinyin fcitx-cloudpinyin fcitx-gtk2 fcitx-gtk3 network-manager-applet gnome-keyring pavucontrol pavucontrol-qt pulseaudio-alsa
  pacman -Sy --noconfirm xfce4 xfce4-goodies lightdm-gtk-greeter accountsservice gvfs gvfs-mtp ntfs-3g exfat-utils p7zip file-roller fcitx fcitx-configtool fcitx-googlepinyin fcitx-cloudpinyin fcitx-gtk2 fcitx-gtk3 network-manager-applet gnome-keyring pavucontrol pavucontrol-qt pulseaudio-alsa
enable and start lightdm:
enable and start lightdm:
  systemctl enable lightdm
  systemctl enable lightdm
  systemctl start lightdm
 
= copy image to sdcard =
umount image from /mnt/temp:
  ./raspimg umount $(date +%F)-archlinux-aarch64.img
insert sdcard to your computer and confirm which letter have:
dmesg
fdisk -l
now with sdcard correctly identified, copy this image to sdcard using dd:
dd if=$(date +%F)-archlinux-aarch64.img of=/dev/sdd status=progress
 
= desktop auto-login =
= desktop auto-login =
if you want to set auto-login for user alarm add the following to /etc/lightdm/lightdm.conf:
if you want to set auto-login for user alarm add the following to /etc/lightdm/lightdm.conf:
Line 120: Line 107:
  [Seat:*]
  [Seat:*]
  user-session=xcfe4
  user-session=xcfe4
  autologin-user=archy
  autologin-user=alarm
  autologin-user-timeout=0
  autologin-user-timeout=0
  EOF
  EOF
Line 126: Line 113:
  groupadd -r autologin
  groupadd -r autologin
  gpasswd -a alarm autologin
  gpasswd -a alarm autologin
= configure network =
configure wireless using nmcli:
nmcli device wifi rescan
nmcli device wifi list
nmcli device wifi connect ssid-name --ask
= configure remote connection =
installing yay:
su - alarm
git clone https://aur.archlinux.org/yay.git
cd yay
makepkg -si
install nomachine:
yay -S nomachine
edit file "/usr/NX/etc/server.cfg", set "StartNXDaemon" to "Automatic":
StartNXDaemon Automatic
then restart nxserver service:
systemctl restart nxserver
from your desktop computer or another computer install nomachine client:
* for windows:
https://download.nomachine.com/download/8.11/Windows/nomachine_8.11.3_3_x86.exe
* for mac:
https://download.nomachine.com/download/8.11/MacOSX/nomachine_8.11.3_5.dmg
* for linux .rpm:
https://download.nomachine.com/download/8.11/Linux/nomachine_8.11.3_4_x86_64.rpm
* for linux .deb:
https://download.nomachine.com/download/8.11/Linux/nomachine_8.11.3_4_amd64.deb
= troubleshooting =
if you have this error in /var/log/Xorg.0.log is: cannot run in framebuffer mode. please specify busids:
cat > /etc/X11/xorg.conf.d/99-vc4.conf << EOF
Section "OutputClass"
  Identifier "vc4"
  MatchDriver "vc4"
  Driver "modesetting"
  Option "PrimaryGPU" "true"
EndSection
EOF
if you have issues with lightdm not starting reinstall the following packages:
pacman -S shared-mime-info gdk-pixbuf2
= download image =
torrent file for downloading our image:
https://img.vidalinux.com/files/2024-07-08-archlinux-aarch64.img.xz.torrent


= references =
= references =
* https://github.com/mikkeloscar/binfmt-manager
* https://github.com/mikkeloscar/binfmt-manager

Latest revision as of 17:04, 31 July 2024

requeriments

  • raspberrypi 5
  • sdcard 8gb or more
  • mini hdmi female to micro hdmi male adapter or cable
  • usb-c power adapter
  • archlinux or debian system to the create image

download images

download raspios image:

wget https://downloads.raspberrypi.org/raspios_arm64/images/raspios_arm64-2023-12-06/2023-12-05-raspios-bookworm-arm64.img.xz

download archlinux-arm-aarch64 image:

wget http://os.archlinuxarm.org/os/ArchLinuxARM-rpi-aarch64-latest.tar.gz

decompress raspios image:

xz -d 2023-12-05-raspios-bookworm-arm64.img.xz

change raspios image name:

mv 2023-12-05-raspios-bookworm-arm64.img $(date +%F)-archlinux-aarch64.img

chroot with qemu

use qemu-user-static to interpret the arm instructions in the chroot:

pacman -Sy qemu-user-static --noconfirm

install multipath-tools in archlinux:

pacman -S multipath-tools --noconfirm

if you use debian you can install this packages:

apt install kpartx qemu-user-static 

script to mount and umount raspberrypi image:

curl -ko ./raspimg https://raw.githubusercontent.com/vidalinux/raspi/main/raspimg 
chmod +x ./raspimg

mount image to /mnt/temp without binding directories:

./raspimg mount $(date +%F)-archlinux-aarch64.img
do you want to bind /dev /proc /sys /pkg directories now : no

remove image contents from:

rm -rf /mnt/temp/*

decompress archlinux arm file to /mnt/temp:

tar xvf ArchLinuxARM-rpi-aarch64-latest.tar.gz -C /mnt/temp

copy the qemu-aarch64-static binary to the chroot:

cp /usr/bin/qemu-aarch64-static /mnt/temp/usr/bin/

register the qemu-aarch64-static as an arm interpreter in the kernel:

curl -ko /usr/local/bin/binfmt_manager https://raw.githubusercontent.com/mikkeloscar/binfmt-manager/master/binfmt_manager
chmod +x /usr/local/bin/binfmt_manager
binfmt_manager register aarch64

umount image:

./raspimg umount $(date +%F)-archlinux-aarch64.img

mount it again binding /dev /proc /sys and pkg directories:

./raspimg mount $(date +%F)-archlinux-aarch64.img
do you want to bind /dev /proc /sys /pkg directories now : yes

enter chroot using arch-chroot:

chroot /mnt/temp

configure image

update /etc/fstab for the different sd block device:

sed -i 's/mmcblk0/mmcblk1/g' /etc/fstab

initialize pacman:

pacman-key --init
pacman-key --populate archlinuxarm

remove /etc/resolv.conf file:

rm /etc/resolv.conf

configure dns:

cat > /etc/resolv.conf << EOF
nameserver 4.2.2.1
nameserver 4.2.2.2
EOF

update all system:

pacman -Syuu --noconfirm

install the following packages:

pacman -Sy base-devel libnewt git wget rsync networkmanager parted multipath-tools lsof git sudo fakeroot screen inetutils --noconfirm

install expand-sd:

curl -ko /usr/local/bin/expand-sd https://raw.githubusercontent.com/vidalinux/raspi/main/expand-sd
chmod +x /usr/local/bin/expand-sd

set password to alarm user:

passwd alarm
echo "alarm ALL=(ALL:ALL) ALL" > /etc/sudoers.d/alarm

change root password:

passwd root

replace current kernel with aarch64:

pacman -Sy linux-rpi

make sure you have rpi5 support:

pacman -Ql linux-rpi | grep rpi-5

disable the following services:

systemctl disable systemd-networkd
systemctl disable systemd-networkd.socket
systemctl disable systemd-resolved

disable suspend, hibernate or sleep:

systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target

start and enable networkmanager:

systemctl enable NetworkManager

desktop environment

install xorg:

pacman -Sy --noconfirm alsa-utils alsa-oss xorg xorg-server xf86-video-fbdev xorg-xrefresh adobe-source-han-sans-cn-fonts ttf-dejavu ttf-bitstream-vera wqy-zenhei ttf-arphic-ukai ttf-arphic-uming opendesktop-fonts ttf-inconsolata ttf-ubuntu-font-family adobe-source-code-pro-fonts xorg-xclock xterm xorg-twm libmd libbsd

install xfce4:

pacman -Sy --noconfirm xfce4 xfce4-goodies lightdm-gtk-greeter accountsservice gvfs gvfs-mtp ntfs-3g exfat-utils p7zip file-roller fcitx fcitx-configtool fcitx-googlepinyin fcitx-cloudpinyin fcitx-gtk2 fcitx-gtk3 network-manager-applet gnome-keyring pavucontrol pavucontrol-qt pulseaudio-alsa

enable and start lightdm:

systemctl enable lightdm

copy image to sdcard

umount image from /mnt/temp:

./raspimg umount $(date +%F)-archlinux-aarch64.img

insert sdcard to your computer and confirm which letter have:

dmesg
fdisk -l

now with sdcard correctly identified, copy this image to sdcard using dd:

dd if=$(date +%F)-archlinux-aarch64.img of=/dev/sdd status=progress

desktop auto-login

if you want to set auto-login for user alarm add the following to /etc/lightdm/lightdm.conf:

cat >> /etc/lightdm/lightdm.conf << 'EOF'
[Seat:*]
user-session=xcfe4
autologin-user=alarm
autologin-user-timeout=0
EOF

add group autologin and user to the group:

groupadd -r autologin
gpasswd -a alarm autologin

configure network

configure wireless using nmcli:

nmcli device wifi rescan
nmcli device wifi list
nmcli device wifi connect ssid-name --ask

configure remote connection

installing yay:

su - alarm
git clone https://aur.archlinux.org/yay.git
cd yay
makepkg -si

install nomachine:

yay -S nomachine

edit file "/usr/NX/etc/server.cfg", set "StartNXDaemon" to "Automatic":

StartNXDaemon Automatic

then restart nxserver service:

systemctl restart nxserver

from your desktop computer or another computer install nomachine client:

  • for windows:
https://download.nomachine.com/download/8.11/Windows/nomachine_8.11.3_3_x86.exe
  • for mac:
https://download.nomachine.com/download/8.11/MacOSX/nomachine_8.11.3_5.dmg
  • for linux .rpm:
https://download.nomachine.com/download/8.11/Linux/nomachine_8.11.3_4_x86_64.rpm
  • for linux .deb:
https://download.nomachine.com/download/8.11/Linux/nomachine_8.11.3_4_amd64.deb

troubleshooting

if you have this error in /var/log/Xorg.0.log is: cannot run in framebuffer mode. please specify busids:

cat > /etc/X11/xorg.conf.d/99-vc4.conf << EOF
Section "OutputClass"
  Identifier "vc4"
  MatchDriver "vc4"
  Driver "modesetting"
  Option "PrimaryGPU" "true"
EndSection
EOF

if you have issues with lightdm not starting reinstall the following packages:

pacman -S shared-mime-info gdk-pixbuf2

download image

torrent file for downloading our image:

https://img.vidalinux.com/files/2024-07-08-archlinux-aarch64.img.xz.torrent

references