Je voulais installer un système light sur mon raspberry 3 avec swayvm. J'ai fait un test avec une debian en suivant cet excellent tuto de BeeScreen mais c'était d'une lenteur. J'ai donc essayé d'installer une arch avec sway. J'ai bien failli abandonner car le système ne bootait pas après l'install, mais en désespoir de cause j'ai modifié un truc et ça l'a finallement fait.
Préparation de la SDCard
su # ou sudo -i
cd /root
tee burn.sh > /dev/null <<"EOT"
#!/bin/bash
# A adapter suivant votre config
# lsblk pour avoir la liste des disques
export SDDEV=/dev/sda
export SDPARTBOOT=/dev/sda1
export SDPARTROOT=/dev/sda2
export SDMOUNT=/root/tmp/root
export DOWNLOADDIR=/root/tmp
mkdir -p $DOWNLOADDIR
(
cd $DOWNLOADDIR && \
curl -JLO http://os.archlinuxarm.org/os/ArchLinuxARM-rpi-aarch64-latest.tar.gz
)
sfdisk --quiet --wipe always $SDDEV << EOF
,512M,0c,
,,,
EOF
mkfs.vfat -F 32 $SDPARTBOOT
mkfs.ext4 -q -E lazy_itable_init=0,lazy_journal_init=0 -F $SDPARTROOT
mkdir -p $SDMOUNT
mount $SDPARTROOT $SDMOUNT
mkdir -p ${SDMOUNT}/boot
mount $SDPARTBOOT ${SDMOUNT}/boot
bsdtar -xpf ${DOWNLOADDIR}/ArchLinuxARM-rpi-aarch64-latest.tar.gz -C $SDMOUNT
# sur mon modèle j'ai conservé le fstab d'origine mmcblk0
# sed -i 's/mmcblk0/mmcblk1/' ${SDMOUNT}/etc/fstab
EOT
chmod +x burn.sh
./burn.sh
En l'état mon système ne bootait pas. J'avais un message d'erreur qui s'affichait en boucle : error -5 whilst initialising SD card
Pour corriger ça, j'ai dû modifier le fichier boot.txt en remplacant certain fdt_addr_r en fdt_addr :
# After modifying, run ./mkscr
# Set root partition to the second partition of boot device
part uuid ${devtype} ${devnum}:2 uuid
setenv bootargs console=ttyS1,115200 console=tty0 root=PARTUUID=${uuid} rw rootwait smsc95xx.macaddr="${usbethaddr}"
if load ${devtype} ${devnum}:${bootpart} ${kernel_addr_r} /Image; then
if load ${devtype} ${devnum}:${bootpart} ${fdt_addr_r} /dtbs/${fdtfile}; then
if load ${devtype} ${devnum}:${bootpart} ${ramdisk_addr_r} /initramfs-linux.img; then
# fdt_addr_r -> fdt_addr
booti ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdt_addr};
else
# fdt_addr_r -> fdt_addr
booti ${kernel_addr_r} - ${fdt_addr};
fi;
fi;
fi;
Ensuite il faut exécuter ./mkscr (il faudra installer pacman -S uboot-tools)
sync
umount /dev/sda1 /dev/sda2
On peut maintenant installer la carte SD dans le raspberry et démarrer.
Configuration
Se logger en root (il y 2 utilisateurs par défaut : root / root ou alarm / alarm), si le clavier est en qwerty taper qlqr, pour alarm.
# on passe en francais
loadkeys fr
# rendre persistant avec
localectl set-keymap fr
# timezone
timedatectl set-timezone Europe/Paris
# locale
sed -i "s/^en_GB.UTF-8 UTF-8/#en_GB.UTF-8 UTF-8/" /etc/locale.gen
sed -i "s/^#en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/" /etc/locale.gen
locale-gen
localectl set-locale LANG=en_US.UTF-8
# on connecte le wifi
wifi-menu
# on met à jour le système
pacman-key --init
pacman-key --populate archlinuxarm
pacman -Syu
# mise à jour du fichier /etc/hosts
tee /etc/hosts > /dev/null <<"EOT"
# Static table lookup for hostnames.
# See hosts(5) for details.
127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
127.0.1.1 berry
::1 berry
EOT
# on modifie les comptes utilisateurs
# modif mot de passe root
passwd
# modif mot de passe alarm
passwd alarm
# on change l'utilisateur alarm en jch
usermod -l jch alarm
# on change sa home
usermod -d /home/jch -m jch
# on renomme le groupe alarm en jch
groupmod -n jch alarm
modifier le fichier /boot/config.txt :
# Set the configuration
tee /boot/config.txt > /dev/null <<"EOT"
# For more options and information see
# http://rpf.io/configtxt
# Some settings may impact device functionality. See link above for details
[all]
# Enable audio (loads snd_bcm2835)
dtparam=audio=on
# Automatically load overlays for detected cameras
camera_auto_detect=1
# Automatically load overlays for detected DSI displays
display_auto_detect=1
# Enable DRM VC4 V3D driver
dtoverlay=vc4-kms-v3d
max_framebuffers=2
gpu_mem=128
# Run in 64-bit mode
arm_64bit=1
# Disable compensation for displays with overscan
disable_overscan=1
[pi4]
# Run as fast as firmware / board allows
arm_boost=1
EOT
Install de base
Connexion auto au wifi
systemctl enable netctl-auto@wlan0.service
Ajout de package de utils
pacman -Syu sudo bat git-delta fd fzf ripgrep dosfstools man-db rsync \
neovim net-tools bash-completion pamixer alsa-utils chrony fake-hwclock
# pour être à l'heure et avoir une horloge système synchro sinon il y aura
# des pb de navigation sur internet
systemctl enable --now chronyd.service
systemctl enable --now fake-hwclock.service
pacman -R vi nano
ajout utilisateur à sudo, comme mon utilisateur appartient au group wheel :
EDITOR=nvim visudo
# supprimer le # de la ligne
# %wheel ALL=(ALL) NOPASSWD: ALL
création d'une clé ssh
ssh-keygen
Install sway
pacman -Syu wayland mesa mesa-utils vulkan-broadcom vulkan-mesa-layers pipewire pipewire-jack pango sway foot wofi mako nemo firefox lite-xl gnu-free-fonts noto-fonts ttf-fantasque-nerd otf-font-awesome ttf-noto-nerd
Configuration sway
se logger en jch :
cd ~
mkdir -p .config/{foot,sway,mako,wofi}
mkdir -p .cache
mkdir -p .local/{share,state}
mkdir -p bin downloads documents music pictures videos
tee bin/sway-run > /dev/null <<'EOT'
#!/bin/sh
export TERM=foot
export _JAVA_AWT_WM_NONREPARENTING=1
export XKB_DEFAULT_OPTIONS=caps:escape
export GDK_BACKEND=wayland
export XDG_SESSION_TYPE=wayland
export XCURSOR_THEME=Adwaita
export XDG_DESKTOP_DIR="$HOME"
export XDG_DOWNLOAD_DIR="$HOME/downloads"
export XDG_DOCUMENTS_DIR="$HOME/documents"
export XDG_MUSIC_DIR="$HOME/music"
export XDG_PICTURES_DIR="$HOME/pictures"
export XDG_VIDEOS_DIR="$HOME/videos"
export XDG_CURRENT_DESKTOP=sway
export XDG_CACHE_HOME="$HOME/.cache"
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_DATA_HOME="$HOME/.local/share"
export XDG_STATE_HOME="$HOME/.local/state"
export LANG="en_US.utf8"
export LC_COLLATE="C.UTF-8"
export LC_TIME="en_US.UTF-8"
export LC_MONETARY="en_US.UTF-8"
export LC_NUMERIC="en_US.UTF-8"
if [ -z "$XDG_RUNTIME_DIR" ]
then
mkdir -p /tmp/runtime/jch
chmod 700 /tmp/runtime/jch
export XDG_RUNTIME_DIR=/tmp/runtime/jch
fi
exec dbus-run-session sway |& tee "$HOME/sway.log"
# exec sway
EOT
chmod +x bin/sway-run
rm .bash_profile
tee .profile > /dev/null <<'EOT'
#
# ~/.profile
#
export PATH=~/bin:$PATH
export EDITOR=vim
export LANG=en_US.utf8
# Fuck you Google, eat shit
export GOPROXY=direct
export GOSUMDB=off
export GOTELEMETRY=off
export GOTOOLCHAIN=local
# [ -e .config/$(hostname).profile ] && . .config/$(hostname).profile
[ -f ~/.bashrc ] && . ~/.bashrc
# If running from tty1 start sway
[ "$(tty)" = "/dev/tty1" ] && exec sway-run
EOT
tee .bashrc > /dev/null <<'EOT'
#
# ~/.bashrc
#
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
# Bash Opt
# history search with up/down
bind '"\e[A": history-search-backward'
bind '"\e[B": history-search-forward'
export HISTCONTROL="erasedups:ignorespace"
export HISTSIZE=10000
# eg.: /etc -> cd /etc
shopt -s autocd
# Starship
command -v starship >/dev/null 2>&1 && eval "$(starship init bash)"
# Direnv
command -v direnv >/dev/null 2>&1 && eval "$(direnv hook bash)"
# Set up fzf key bindings and fuzzy completion
command -v fzf >/dev/null 2>&1 && eval "$(fzf --bash)"
# zoxide
command -v zoxide >/dev/null 2>&1 && eval "$(zoxide init bash)"
# Custom alias
alias ls='ls --color=auto'
alias l='ls -lh'
alias ll='ls -lha'
alias grep='grep --color=auto'
alias vim='nvim'
# git
alias gs='git status'
alias ga='git add'
alias gc='git commit'
alias gd='git diff'
alias gco='git checkout'
alias gpl='git pull'
alias gps='git push'
alias gr='git remote'
alias gb='git branch'
# docker
alias dps='docker ps'
alias dl='docker logs'
alias db='docker build'
alias dr='docker run'
alias de='docker exec'
# docker compose
alias dcupd='docker compose up -d'
alias dcdn='docker compose down'
alias dcps='docker compose ps'
alias dcl='docker compose logs'
alias dcb='docker compose build'
alias dcr='docker compose run'
alias dce='docker compose exec'
EOT
sudo tee .config/foot/foot.ini > /dev/null <<'EOT'
# -*- conf -*-
font=FantasqueSansM Nerd Font:size=14
# dpi-aware=0
include=/usr/share/foot/themes/monokai-pro
[bell]
urgent=yes
[scrollback]
# lines=1000
# multiplier=3.0
# indicator-position=relative
# indicator-format=
[cursor]
style=block
# color=111111 dcdccc
blink=yes
[mouse]
hide-when-typing=no
# alternate-scroll-mode=yes
[url]
# launch=xdg-open ${url}
EOT
tee .config/wofi/config > /dev/null <<'EOT'
insensitive=true
location=center
mode=drun
EOT
tee .config/wofi/style.css > /dev/null <<'EOT'
/* Author: TODO */
window {
font-family: monospace;
font-size: 12px;
margin: 5px;
background-color: #282a36;
}
#outer-box {
margin: 5px;
border: 2px solid #44475a;
background-color: #282a36;
}
#input {
margin: 5px;
border: 2px solid #6272a4;
background-color: #44475a;
color: #f8f8f2;
}
#inner-box {
margin: 5px;
background-color: #282a36;
}
#scroll {
margin: 5px;
border: 2px solid #6272a4;
background-color: #282a36;
color: #f8f8f2;
}
#scroll label {
margin: 2px 0px;
}
#entry {
margin: 5px;
background-color: #282a36;
}
#entry:selected {
background-color: #44475a;
border: 2px solid #bd93f9;
}
#img {
margin: 5px;
}
#img:selected {
background-color: #44475a;
}
#text {
margin: 5px;
border: none;
color: #f8f8f2;
}
#text:selected {
background-color: #44475a;
}
EOT
tee .config/mako/config > /dev/null <<'EOT'
background-color=#101010
text-color=#F92672
border-color=#F92672
progress-color=over #302D41
font=FantasqueSansM Nerd Font 12
[urgency=high]
border-color=#F8BD96
EOT
tee .config/sway/config > /dev/null <<'EOT'
# Config for sway
#
# Read `man 5 sway` for a complete reference.
### Variables
#
# Logo (Windows) key. Use Mod1 for Alt.
set $mod Mod4
# Your preferred terminal emulator
set $term foot
# Your preferred application launcher
set $menu dmenu_path | wofi | xargs swaymsg exec --
# Font family and size
font monospace 12
set $wsk0 twosuperior
set $wsk1 ampersand
set $wsk2 eacute
set $wsk3 quotedbl
set $wsk4 apostrophe
set $wsk5 parenleft
set $wsk6 minus
set $wsk7 egrave
set $wsk8 underscore
include /etc/sway/config-vars.d/*
### Key bindings
#
# Basics:
#
# Start a terminal
bindsym $mod+Return exec $term
# Kill focused window
bindsym $mod+Shift+q kill
# Start your launcher
bindsym $mod+d exec $menu
# Drag floating windows by holding down $mod and left mouse button.
# Resize them with right mouse button + $mod.
# Despite the name, also works for non-floating windows.
# Change normal to inverse to use left mouse button for resizing and right
# mouse button for dragging.
floating_modifier $mod normal
# Reload the configuration file
bindsym $mod+Shift+c reload
# Exit sway (logs you out of your Wayland session)
bindsym $mod+Shift+e exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'swaymsg exit'
#
# Moving around:
#
# Move your focus around
bindsym $mod+Left focus left
bindsym $mod+Down focus down
bindsym $mod+Up focus up
bindsym $mod+Right focus right
# Move the focused window with the same, but add Shift
bindsym $mod+Shift+Left move left
bindsym $mod+Shift+Down move down
bindsym $mod+Shift+Up move up
bindsym $mod+Shift+Right move right
#
# Workspaces:
#
# Switch to workspace
bindsym $mod+$wsk0 workspace number 0
bindsym $mod+$wsk1 workspace number 1
bindsym $mod+$wsk2 workspace number 2
bindsym $mod+$wsk3 workspace number 3
bindsym $mod+$wsk4 workspace number 4
bindsym $mod+$wsk5 workspace number 5
bindsym $mod+$wsk6 workspace number 6
bindsym $mod+$wsk7 workspace number 7
bindsym $mod+$wsk8 workspace number 8
# Move focused container to workspace
bindsym $mod+Shift+$wsk0 move container to workspace number 0
bindsym $mod+Shift+$wsk1 move container to workspace number 1
bindsym $mod+Shift+$wsk2 move container to workspace number 2
bindsym $mod+Shift+$wsk3 move container to workspace number 3
bindsym $mod+Shift+$wsk4 move container to workspace number 4
bindsym $mod+Shift+$wsk5 move container to workspace number 5
bindsym $mod+Shift+$wsk6 move container to workspace number 6
bindsym $mod+Shift+$wsk7 move container to workspace number 7
bindsym $mod+Shift+$wsk8 move container to workspace number 8
# Note: workspaces can have any name you want, not just numbers.
# We just use 1-10 as the default.
#
# Layout stuff:
#
# You can "split" the current object of your focus with
# $mod+b or $mod+v, for horizontal and vertical splits
# respectively.
bindsym $mod+h splith
bindsym $mod+v splitv
# Make the current focus fullscreen
bindsym $mod+f fullscreen
# Toggle the current focus between tiling and floating mode
bindsym $mod+Shift+space floating toggle
# Swap focus between the tiling area and the floating area
bindsym $mod+space focus mode_toggle
# Move focus to the parent container
bindsym $mod+a focus parent
#
# Resizing containers:
#
mode "resize" {
# left will shrink the containers width
# right will grow the containers width
# up will shrink the containers height
# down will grow the containers height
bindsym Left resize shrink width 10px
bindsym Down resize grow height 10px
bindsym Up resize shrink height 10px
bindsym Right resize grow width 10px
# Return to default mode
bindsym Return mode "default"
bindsym Escape mode "default"
}
bindsym $mod+r mode "resize"
#
# Status Bar:
#
# Read `man 5 sway-bar` for more information about this section.
bar {
position top
# When the status_command prints a new line to stdout, swaybar updates.
# The default just shows the current date and time.
status_command while date +'%Y-%m-%d %l:%M:%S %p'; do sleep 1; done
colors {
statusline #ffffff
background #323232
inactive_workspace #32323200 #32323200 #5c5c5c
}
}
### Inputs configuration
input * {
xkb_layout "fr"
xkb_variant ""
xkb_numlock enabled
}
#
# Autostart
#
#exec /usr/libexec/pipewire-launcher &
#exec dbus-update-activation-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway &
exec mako &
#exec wl-paste --watch /usr/bin/cliphist store
#
# Application
#
# screenshot
# bindsym $mod+Print exec shotman --capture window
# bindsym $mod+Shift+Print exec shotman --capture region
# bindsym $mod+Ctrl+Print exec shotman --capture output
# clipboard
# bindsym $mod+alt+c exec /usr/bin/cliphist list | tofi | /usr/bin/cliphist decode | wl-copy
# mako
bindsym $mod+n exec makoctl dismiss
bindsym $mod+Shift+n exec makoctl dismiss -a
# quick start some applications
bindsym $mod+k exec nemo
bindsym $mod+l exec firefox
bindsym $mod+m exec lite-xl
include ~/.config/sway/config.d/*
EOT
problème pour lancer sway
Après tout ça, impossible de lancer sway.
J'avais le message Found 0 GPUs, cannot create backend.
J'ai passé du temps à essayer de corriger ce pb mais sans trop de succés :
- ajout groupes à mon utilisateur utilisateur,
- paramètres dans /boot/config.txt,
- early KMS (pas tout compris),
- drivers graphique, mesa, vulkann ...
avant d'abandonner, je sais pas pourquoi, j'ai testé de changer de kernel en installant linux-rpi à la place de linux-aarch64
et là ça a fonctionné.
sudo pacman -Syu linux-rpi
j'avais fait ça également, je pense que c'est nécessaire mais je suis pas certain :
sudo usermod -a -G video jch
sudo usermod -a -G audio jch
sudo usermod -a -G seat jch
todo
- gestion du presse papier
- gestion capture d'écran
- une barre de status améliorée
- et tout plein d'autres trucs, mais vu l'utilisation de ce rasberry...
status bar ?
A tester
sudo tee bin/status > /dev/null <<'EOT'
#!/bin/dash
sp=$(if [ -f ~/.config/sway/scratchpad ];then echo ON;else echo OFF;fi)
cpu=$(top -b -n 1 | grep Cpu | awk '{print $2}')%
temp=$(($(cat /sys/class/thermal/thermal_zone*/temp)/1000))°C
mem=$(free -m | grep "Mem" | awk '{print $4}')
wifi=$(cat /proc/net/wireless | awk '{print $3+$2}' | tail -1)
eth=$(cat /sys/class/net/eth0/operstate | tr [:lower:] [:upper:])
vol=$(pactl list sinks | tr ' ' '\n' | grep -m1 '%' | tr -d '%')
date=$(date +'%a %_d, %l:%M %p')
echo "$sp $cpu $temp $mem $wifi $eth $vol $date "
exit 0