User:Ldj/Full setup

From postmarketOS
Note This seems to be personal notes, shouldn't be in the main namespace

Preamble - recommendations

We will assume you've already installed lk2nd and pmbootstrap.

We will also assume you'll use a text editor like nano to alter system files, and that you're using it with SSH

Note that you may have to use CTRL+SHIFT+V to paste in your terminal (check with your Linux distro)

Commands to be entered are displayed with a leading $

Your default password will be

147147

as long as you don't change it in

$ pmbootstrap init

And your default IP (when connected through USB) should be

172.16.42.1

Finally, your default username is

user

Part I - Install and setup generic system

Install postmarketOS

Obviously, the first thing we need to do is installing pmOS on our device[s], here’s how

Follow the required procedure

$ pmbootstrap init

$ pmbootstrap install

Put phone into "lk2nd mode", and continue

To put the phone in lk2nd mode, turn it on holding down the "Volume down" key pressed. NO OTHER KEYS THAN VOLUME DOWN

$ pmbootstrap flasher flash_kernel

$ pmbootstrap flasher flash_rootfs --partition userdata

$ fastboot erase system

$ fastboot reboot

$ pmbootstrap shutdown

DON'T FORGET TO

$ pmbootstrap shutdown

OR YOU'LL HAVE A BUNCH OF MOUNT POINTS DUE TO CHROOT ENVIRONMENT. LAUNCHING IT REMOVES THE MOUNT POINTS

Start the SSH Daemon

You’ll greatly appreciate setting up everything through SSH, typing commands on the device is possible, but it’s a pain

Edit the required configuration files

I put this in a shell script named ssh.sh (in your WorkStation)

#!/usr/bin/sh

ssh user@172.16.42.1

And

chmod a+x ssh.sh

Run the required commands

From a console window IN YOUR DEVICE, type

$ sudo rc-service sshd start

If everything went fine, then

$ sudo rc-update add sshd

To connect to SSH, you have to type (in your WorkStation, not on the device)

$ ssh user@172.16.42.1

Install software

Now, boot in your OS, connect through SSH (the IP should be 172.16.42.1), and run this (long) command:

Install the required packages

$ sudo apk add epiphany celluloid cheese corepdf corerenamer telegram-desktop umbrello scribus remmina pidgin gnome-music lmms libreoffice kompare ktorrent inkscape httrack handbrake-gtk gimp filezilla evolution kwave bluefish dia tesseract-ocr sphinx espeak zip unzip unrar solvespace recordmydesktop gnome-photos nano eog aml libxkbcommon pixmanAdjust it to your liking

I'm used to get rid of FireFox in favor of Epiphany, if you're too, just

$ sudo apk del firefox-esr

Install and setup FlatPak

FlatPak provides some packages I like, that aren’t in the Alpine/pmOS repos

Install the required packages

$ sudo apk add flatpak

Run the required commands

$ sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo

Enable your MicroSD (if you have it) in fstab

MicroSD is almost mandatory, especially when using many Apps - 16/32 Gb aren’t enough to carry the OS AND our data

Install the required packages

$ sudo apk add fuse-exfat fuse3-libs fuse3 fuse fuse-static s3fs-fuse fuse-common fuse-exfat-utils

Edit the required configuration files

$ sudo blkid

Your MicroSD should be the mmcblk1p1 device, so look at the line which is like this

/dev/mmcblk1p1: UUID="UUID-OF-YOUR-SD" BLOCK_SIZE="512" TYPE="YOUR-FILESYSTEM"

And remember the UUID and FILESYSTEM you got, then add to /etc/fstab (create the file if it doesn't exist)$ sudo touch /etc/fstab$ sudo mkdir /media/sd

UUID="UUID-OF-YOUR-SD" /media/sd YOUR-FILESYSTEM auto,exec,user,rw,sync 0 2

Run the required commands

$ sudo mount -a

Create symlinks to the MicroSD

Replace every directory you're interested in inside your home with a symbolic link to a directory on your SD (if you do, first delete the directory from your home. If it's not empty, first move all files to the directory in your SD)

This is the command

$ ln -s directoryName linkName

So, you will have to type (in example)

$ rmdir /home/user/yourDirectory

$ ln -s /media/sd/targetDirectory /home/user/yourDirectory

And repeat for each directoryNote, the available directories areDesktop, Music, Templates, Documents, Pictures, Videos, Downloads, Public

Fix windows overflowing content

If you use Desktop Apps on pmOS, you will notice the App’s windows overflow the screen. This option fixes this. Note the windows will fit the screen, but will be scaled according to the scale factor you set in phoc.ini, by the way they won’t overflow anymore (may be the UI Scale will be so big that the GUI of the App will be a mess)

Launch the required commands

Launch this command to make all windows fit the screen

$ sudo gsettings set sm.puri.phoc scale-to-fit true

Note your scale factor it's kept, so you may want to change it anyhow. I use 1.2

If the UI is too small for your taste, launch the inverse command

$ sudo gsettings set sm.puri.phoc scale-to-fit false

Edit the required configuration files

You can set a scale rate in /usr/share/phosh/phoc.ini, but the windows could overflow laterally. Edit the file and, in the first entry, modify scale from 2 to something lower (or higher, if you prefer)

The line appears like this

[output:DSI-1]

scale = 2

Replace 2 with your preferred scale factor

Start wayvnc service - create a wayvnc service and start it

As previously said in the SSH section, the ability to use a computer to drive your device will be very useful - think if you have to launch a command that can’t be ran from SSH, or you have to copy text from the Terminal, it would be a pain to do that on the device, anyhow, it’s possible

Install the required packages

$ sudo apk add wayvnc neatvnc

Edit the required configuration files

First, create a ssh key

$ openssl req -x509 -newkey rsa:4096 -sha256 -days 3650 -nodes -keyout key.pem -out cert.pem -subj /CN=localhost -addext subjectAltName=DNS:samsung-a5ulte,DNS:samsung-a5ulte,IP:172.16.42.1

Create a configuration file in /home/user/.config/wayvnc/config containing

address=0.0.0.0

enable_auth=true

username=user

password=YourPassword

private_key_file=/path/to/key.pem

certificate_file=/path/to/cert.pem

Launch the required commands

To start the VNC Server, just type

$ wayvnc 0.0.0.0

Install and setup KeyMapper

KeyMapper will be very useful when using Desktop Apps like Gimp, LMMS, Wings3D, etc. Most Desktop Apps require a 3 button mouse, so you need to replace missing buttons (on a touchscreen, you’ll only have left mouse button, on tapping the display) with something else. Here comes KeyMapper. There also is the Synaptics driver, which supports gestures to emulate mouse buttons and scroll event, among others, but I don’t know how to configure it. Indeed, if you made it to configure Synaptics, please, tell me how you did.

Install the required packages

$ sudo apk add py3-pip build-base libevdev-dev py3-libevdev libevdev xf86-input-evdev xf86-input-evdev-dev linux-headers python3-dev git xf86-input-synaptics xf86-input-libinput evtest

$ sudo pip3 install git+https://github.com/sezanzeb/key-mapper.git

Edit the required configuration files

$ sudo nano /etc/modules

And append

uinput

Create the XOrg configuration file

$ sudo touch /etc/X11/xorg.confAnd insert this linesSection "InputDevice"

Identifier"Syn"

Driver"libinput"

Device"yourDevice (something like /dev/input/event - discover the device with evtest)”

Option"ClickMethod""clickfinger"

Option"Tapping""on"

EndSection


Section "Inputclass"

Identifier"Syn"

Driver"libinput"

MatchIsTouchpad"on"

Option"Tapping""on"

Option"ClickMethod""clickfinger"

EndSectionUnfortunately, the key-mapper service won't work with postmarketOS, so you'll have to manually start the service from the App

Follow the required procedure

Bind buttons to simulated mouse buttons

You'll have several input devices, in my situation I have 4, but I'm only interested in tm2-touchkey

Once chosen the device, name the preset with a meaningful name, then tap on "click here" and press the button you want to map

I used APPSELECT and BACK

Once pressed ONE of the above keys, the key name will appear, and, on its right, you can enter a key name

I used BTN_MIDDLE near APPSELECT, and BTN_RIGHT near BACK

Mapping these keys is recommended if you want to use Desktop Software, such as Gimp, LMMS, etc

Configure your cups printer and start service

Almost every computer user has a printer, most also have a scanner (or an All In One printer). The ability to print and scan from the device will avoid ping-pong file transfers between the device, the computer and the printer

Install the required packages

$ sudo apk add cups cups-libs cups-pdf cups-client cups-filters hplip libusb ghostscript qt py-qt python3 py-reportlab libjpeg libjpeg-turbo net-snmp

Run the required commands

$ sudo adduser root lp

$ sudo adduser root lpadmin

$ sudo adduser user lp

$ sudo adduser user lpadmin

$ sudo rc-service cupsd start

$ sudo rc-update add cupsd

If you have an HP printer, you should also install hplip

$ sudo apk add hplip

Follow the required procedure

connect with your printer with WiFi and setup it by opening, in a browser the following (assuming you have a WiFi Printer)

http://localhost:631

I have an HP All In One printer, so I usually connect the Printer's JetDirect HotSpot. Do this BEFORE opening the address above

Then, go to Administration and choose Add Printer, then follow directions on the page

Configure your sane scanner

Almost every computer user has a printer, most also have a scanner (or an All In One printer). The ability to print and scan from the device will avoid ping-pong file transfers between the device, the computer and the printer

Install the required applications

$ sudo apk add sane sane-saned sane-utils sane-backends


TODO: FINISH THIS SECTION


Part II, Install and setup additional services and applications

Set the ringtone

If you come from Android, you might have a favourite ringtone you want to use in pmOS, or maybe you just don’t like the default one

Run the required commands

$ sudo touch /usr/share/glib-2.0/schemas/11_librem5.gschema.override

$ sudo mkdir /usr/share/glib-2.0/schemas/stereo

Edit the required configuration files

Edit /usr/share/glib-2.0/schemas/11_librem5.gschema.override inserting the following content[Sound Theme]

Name=Default

Directories=stereo

Alert=YourAlertTone.ogg/wav/oga

Notification=YourNotificationTone.ogg/wav/oga

Note you don't have to put /s in the filename, they're there just to point out that the valid file types are, indeed, ogg, wav or oga

Change the background

If you come from Android, you might have a favourite background image you want to use in pmOS, or maybe you just don’t like the default one

Follow the required procedure

Open the image you want as background with Eye Of Gnome, then click on the three bars in the upper-right corner, choose "set as background"

$ eog

Install Google web Apps

If you come from Android, you might have a bunch of Google Apps you want to use in pmOS, but, chances are1) Install AnBox$ sudo apk add postmarketos-anbox2) Launch Google services through EpiphanyAnd here, we will take in account the second method (because I failed running AnBox - because of a segmentation fault on AnBox loading)

Follow the required procedure

The procedure is simple*

Open the Web App you're interested in (by browsing it with Epiphany)
  • If needed, log in the App
  • Tap on the three bars at the top right
  • Tap on "Install WebSite as a web Application"


Configure Telegram

Unfortunately, we don't have WhatsApp in Linux (either Desktop or Mobile), but Telegram is almost as great, if not better.Well, in truth, we have WhatsApp Web, but it requires to periodically authenticate from our Android device, which maybe we don’t use anymore

Follow the required procedure

To configure Telegram, you have two options:

1) Using an already existing account from your Android/iOS SmartPhone

Tap "Start messaging"

Tap "Scan QR Code"

In your SmartPhone, in Telegram, go to Settings->Devices->Scan QR Code

Scan the QR Code with your SmartPhone

You're set!

2) Creating an account from scratch or login with your existing account

Tap "Start messaging"

Insert your mobile phone number (its SIM have to be inserted in your pmOS device, you just need the ability to receive SMS from the device the SIM is in)

Tap on next

Wait for the code to be sent with SMS

Insert the code

You're ready to go

Configure your Google account with gnome-control-center

If you come from Android, you might have a Google account you used with Play Store, GMail, and so on. You might, in this case, want to keep using it, so here’s how

Follow the required procedure*

Open Settings
  • Tap on "OnLine Accounts"
  • Tap on "Google"
  • Login as usual
  • Authorize GNOME to access your Account
  • Select Google services to use on your device
  • Dismiss the Settings App