~piotr-machura/mvrck

Pinebook Pro dotfiles
Back to PulseAudio (PipeWire has skipping issues)
Change sound information to PipeWire
Adjust to Sway requirements

refs

master
browse  log 

clone

read-only
https://git.sr.ht/~piotr-machura/mvrck
read/write
git@git.sr.ht:~piotr-machura/mvrck

You can also use your local clone with git send-email.

#Mvrck

Maverick /ˈmævəɹɪk/ - an independent individual who does not go along with a group or party

This repository contains instructions for my personal Pinebook Pro setup. It uses PostmarketOS as base.

#Installation

Perform the initial setup of the operating system which comes with the Pinebook Pro before proceeding. All subsequent steps are performed from within the device itself - an extra SD card is needed, though.

#Flashing Tow-Boot to the SPI

It has become increasingly difficult to boot the Pinebook Pro with anything other than the pre-loaded image. This is partly due to the bootloader bundled with Manjaro - we shall replace it by flashing Tow-Boot to the SPI.

Download Tow-Boot release, extract it and flash the binaries/Tow-Boot.spi.bin file to SPI.

sudo flashcp Tow-Boot.spi.bin /dev/mtd0

Once the flash completes reboot and verify whether the Tow-Boot menu shows up when pressing <Esc>. Select EMMC to get back to pre-installed Manjaro.

#Installing PostmarketOS

PostmarketOS is a lightweight distribution based on Alpine Linux - the console version makes for a great starting point for a personalized, minimal installation.

Download the console PostmarketOS installer image. Insert the SD card (/dev/mmcblkX) into the slot and flash the PostmarketOS installer to it.

xz --decompress --stdout \
    pine64-pinebookpro-installer.img.xz |
    sudo dd of=/dev/mmcblkX bs=4M status=progress

Reboot the device and press <Esc> to get to Tow-Boot menu. Select SD Card and boot into the installer. Follow the steps, reboot and remove the SD card from the slot - you should be greeted with PostmarketOS splash screen and a TTY. Log in with username user and the password set during installation.

#User & hostname

In order to allow root login set a password with sudo passwd. Log out with <Ctrl-d> and log back in as root.

Change the unpriveleged username and home directory

usermod -l piotr user
usermod -d /home/piotr/ -m piotr

The hostname can be now changed to the title of this project.

echo "mvrck" > /etc/hostname

#Swap

Enable the swap by uncommenting the line in /etc/conf.d/swap

rc_need="localmount"

and setting the appropriate swap file size in /etc/conf.d/swapfile

swap_size=6144 # 8192 - 2048

The swapfile can be automatically created & activated with sudo swapfile.

#Local time

Alpine provides a simple script to set the timezone properly - setup-timezone.

#Package installation

The system is now usable - clone the dots branch of this repository (you may need to copy/generate SSH keys first).

sudo apk add git
git clone --single-branch --branch dots --bare \
    git@git.sr.ht:~piotr-machura/dotfiles ~/.config/dots
alias dots="git --git-dir=$HOME/.config/dots --work-tree=$HOME"
dots config --local status.showUntrackedFiles no
dots reset --hard
Heads up: the configuration is geared specifically towards me. This includes specific information (GPG key ID, e-mail provider details) in some of the included files.

The dotfiles should now be available in the home directory. Copy the apk world file to system-wide location in order to automatically install all required programs.

sudo cp ~/.local/share/apk.world /etc/apk/world
sudo apk add

Note: the cloned ~/.config/git/config contains a handy git alias, so that git dots will always access the configs repo directly. Feel free to unalias dots now.

Note 2: the --single-branch option only clones the "dots" branch, which is desirable since an accidental git checkout to the master branch would temporarily remove all of the installed dotfiles, causing great confusion.

#GUI login

Change the default shell to zsh

chsh -s /bin/zsh

and enable autologin by changing one of the lines of /etc/inittab to read

# Set up a couple of getty's
tty1::respawn:/bin/login -f piotr

After another reboot and (now automatic) login Sway should start.

#Hardware tweaks

Some hardware workarounds are necessary to make the Pinebook Pro usable as a daily driver.

#Hibernate

Neihter suspend nor hibernate work. It is best to disable them in /etc/elogind/logind.conf

[Login]
# ...
HandlePowerKey=ignore
HandleSuspendKey=ignore
HandleHibernateKey=ignore
HandleLidSwitch=ignore
HandleLidSwitchExternalPower=ignore
HandleLidSwitchDocked=ignore
# ...

[Sleep]
# ...
AllowSuspend=no
AllowHibernation=no
AllowSuspendThenHibernate=no
AllowHybridSleep=no
# ...

#Sound

The Pinebook Pro has a background noise/crackling problem caused by the audio interface going to sleep.

This power-saving functionality can be disabled in the /etc/pulse/default.pa by commenting the line

### Automatically suspend sinks/sources that become idle for too long
#load-module module-suspend-on-idle # <- comment this

Still, the noise floor (which is now constant since the device does not go to sleeep) remains high. To mitigate it use alsamixer and reduce the gain on left-most bar ("Speakers/Headphones") until noise level is acceptable. Save the settings to /etc/asound.state, which is sourced on startup.

sudo alsactl store

Some noise (resembling coil whine) will still present when using speakers - pavucontrol allows for changing the default port to headphones, which should make the noise disappear completely (and it is not noticeable on headphones, at least not on mine).

#Software tweaks

Manual software tweaks are described here.

#Firewall

Nftables should be enabled by default, with a sensible configuration. Disallow incoming SSH traffic by deleting the appropriate rule.

sudo rm /etc/nftables.d/50_ssh.nft

#Apk world

In order to keep the .local/share/apk.world file up to date, a post-commit hook is necessary

sudo mkdir -p /etc/apk/commit_hooks.d
cat <<EOF
#!/bin/sh

if [ "$1" = 'post-commit' ]; then
    cp -v /etc/apk/world /home/piotr/.local/share/apk.world
    chown piotr:user /home/.local/share/apk.world
fi
EOF > copy_world.sh
sudo mv copy_world.sh /etc/apk/commit_hooks.d/
sudo chmod +x /etc/apk/commit_hooks.d/copy_world.sh

#Email

The himalaya CLI is used to read & sync the email from the remote server to local maildir.

It requires a PGP-encrypted pass.asc password file to be available in its configuration directory.

cd ~/.config/himalaya
echo 'my super-secret email password!' > pass
gpg --encryp --armor -r $GPG_KEYID_HERE pass
shred -u pass

#Mass storage

Format an SD card as exFAT and name it SD using exfatlabel. Add the following line to /etc/fstab to mount on boot, but continue if it is not found

/dev/disk/by-label/SD   /mnt/SD exfat   nofail,noatime,user,uid=10000,gid=10000 0   2

Now it is possible to move some mass-storage directories to the SD card and symlink them into the home directory.

#What does not work?

#Hardware acceleration

Libva-v4l2-request is outdated and does not build on newer kernels.

Resources:

#Waking up from suspend

The system does go to sleep correctly.

# WARNING: do not do this!
echo mem > /sys/power/state

But it does not wake up - not when clicking the mouse, power button etc.