Blog

April 3, 2020

Manjaro Linux, Bash & Touchscreen on a Raspberry PI 4 – 1

A HowTo and helper for Manjaro ARM with RPI4. And a lot of generic stuff on BASH, Linux, etc.

Read time: 10  minutes – check the Table of Contents.  The full article is available as a PDF here.

Part 2. Part 3. Part 4.


INTRODUCTION:

I decided to work with a Raspberry Pi 4 (RPI4), with attached 7 inch touch screen (sold by Kuman, HDMI based).  I wanted a scalable OS, which will provide me the biggest support of SW and libraries – and this can be only Linux. I wanted to be able to custom trim it up to level where I really have only and exactly what I need – so this would be Yocto based builds.

So – as I person who have used Ubuntu, Fedora, Linux Mint and Arch Linux – I had to look for better, purer and trimmable Linux. Some details related to this research are presented here. To keep the long story short – I chose Arch Linux.

Arch is one of the distros known for keeping most up-to-date kernel, to be rolling release based; most limited in extra features; has a great community; and is around since 2002.

I wanted to use on the test PC the same Linux Distro I can use on the RPI4 – so that I can easily transfer developed modules. And later jump on Yocto to make my custom trims.

And Arch Linux turned out to be hard lately – I had multiple issues when I installed the latest version on my test PC (despite that the previous time I worked with it I seldom had blockers).

Hence I searched for the best user friendly (and with XFCE) Arch based distro. Manjaro was the best option I got. Plus – there were some ports for RPI4 already. It turned out the community is strong, and it is the most prominent Arch based distro around. In addition – after testing it – it was simple, stable, and good! Here are some whys.

By the way – one of the greatest tools on the web to help you see ALL major and minor Linux distros, where they come from, when were they started is here on Wikipedia.

This journal is a full summary of my milestones, issues, findings, recommendations, and HowTos. It is split in 4 parts – 1. HW and Installation (this one), 2. Basics of BASH and simple compilation (crucial for this system, check if you don’t have some knowledge!), 3. Installation on RPI4 and what to do on it after installing, 4. Installation and calibration of the Touchscreen.

I hope that those will be helpful to others. I’ve cut the trash, and left here only the final, proved and corrected information. I also put some significant effort to provide a lot of links directly in the text for your convenience. If you have questions or spot an error – write me, I will be really grateful. But before this – google it, and try all the things by yourself. Self-experience and reading is the best teacher after all.

******* ******* ******* ******* ******* ******* ******


Basics – HW, Manjaro installation, few basic commands, package manager, installation of user SW

—    —    —    —    —    —    —    —

HW overview and the heating issue with RPI4

I’ve equipped my Raspberry Pi 4 (RPI4) “Model B 4 GB RAM” with a 7 inch display from Kuman (you can also use any regular HDMI monitor with RPI4), some heat sinks, a fan (ventilator) and housing. RPI 4 is reported to overheat if used with higher workload, so the market boomed with such solutions after its appearance. Some photos and a bit more information:

HW Listing:

RPI 4 B 4GB RAM

Kuman RPI4 7 Inch Capacitive Touch screen with plexiglass / plastic housing, a self-build kit – pointing out again – you can use ANY regular HDMI PC monitor 😉

Miuzei housing with ventilator and heat sinks, a self-build kit.

Logitech MK270 Mouse and keyboard with single USB receiver.

SanDisk Extreme 32 GB Video Speed Class V30 micro SD card

Original photos:

From Kuman:

From Muizei:

 

I’ve checked multiple comparisons of cooling systems. The best would be a whole Heat sink like this from Geekworm. I considered the following points:

  1. I wanted to have access to the RPI HW
  2. Geekworm didn’t show significantly better results compared to the Muizei in some reviews (on the internet Geekworm was cooler with around 6-10 degrees, but both provided enough cooling to be far from the overheating temperature)
  3. I needed to be able to mount it on the back of the Kuman LCD and this was critical.
  4. The Muizei kit had enough heat sinks

I chose to use the Muizei plastic solution. And it works good. It’s a bit noisy, but not too much. A hint – I used some of the additional screws from Geekworm, and few from my special collections. In particular I had to be careful as I removed the additional bottom blue cover of Muzei’s solution and some of the layers. Also in my opinion the mounting required some distance between the bottom of the RPI4 and the back of the display housing – it’s always better to have some free air floating, and not to cover fully (put in a closed box) test HW planned to be potentially overheated.

FYI – here are some good links related to the heating issue when putting a lot of workload on the RPI4:

Raspberry Pi 4 Cooling Review: Pimoroni Heatsink and Fan Shim Tested

Do You Need to Use a Fan for Cooling with the New Raspberry Pi 4?

Cooling Options for the Hot Raspberry Pi 4

YouTube: The Ultimate Cooling Solution for your Raspberry Pi !!!

YouTube: Raspberry Pi 4 Dual Cooling Fan Aluminum Alloy Case

YouTube: Voltlog #264 – Passive Heatsink Cooling For The Raspberry Pi 4

Official 3A RPI 4 Power Supply


Installation

For my Test PC  (Fan-less small 2 core machine with CPU 64 bit Intel Celeron J1800) I used the Latest Manjaro build (end of Feb 2020: Linux Kernel 5.4.23, Manjaro ver. 19.2 Kyria) – I installed it with Rufus on a USB 3.0 stick, then connected it to the test PC – and it was super-fast and easy setup.

Official guidelines for installing Manjaro are here, more notes here, here and one more. I can say that the single potentially “tricky” point for a person without knowledge (who does everything manually) is to pay attention on the SWAP space when configuring the HDD /SSD partitions. If your system is low on RAM – having at least 4 GB of SWAP (better 8) is recommended. My guide with screenshots specially on Partition setup together with the basic points of what is BIOS, (U)EFI, MBR and GPT is here. It also contains few simple things to do after it.

Apart from the Partitioning of your hard disk the rest of the setup is quite next->localization / KBD next-> name ->next-> blabla -> next…. and it is installed. A simple GUI based OS. I love it!

For the RPI 4 I used  Manjaro-ARM-xfce-rpi4-20.02.img.xz and you don’t need some special partitioning for it. Here is the installation guide with screenshots.

Why use a Test PC – if you work 100% on the RPI4 – it is not that fast and you will wear out the SD card faster. You can setup a Virtual Machine or Dual boot on your PC. For one of my Laptops I chose Virtual box, the first step guide mention as well VmWare Player and Qemu.

Final point – I chose LibreOffice (during setup you have a choice of it vs Free Office from Softmaker).

—    —    —    —    —    —    —    —

Basic Linux commands in the Terminal on fresh system. These are useful after install – to check what has been detected and configured during installation – check them out.

$ uname -srm – prints the current Linux version

$ lsmem – check the memory – I have 4 GB RAM, 8 GB SWAP space

$ hwinfo – Shows Present Hardware Info

$ nproc – Print Number of Processing Units

$ df – to see the current file system locations, sizes, used and free space

$ ping – works as usual, to check your ping 😉

$ vi /etc/locale.gen – to edit some file (e.g. /etc/locale.gen) with the vi Terminal based editor. It is preinstalled in Manjaro. Vim is NOT! Hint – vi is great, but hard. Check tutorials if you wish. Some basic commands are definitely simple.

$ mount – mount a file system

$ umount – unmounts a file system

$ reboot – restart the system

$ screenfetch – a CLI (Command Line Interface) Bash script to show the system /theme info – VERY GOOD – works on over 100 distros, pre-integrated, shows OS, Kernel, Shell, Resolution, Graphical environment, CPU, GPU, RAM, etc. This command is not available for Manjaro ARM by default.

To check / list the partition tables on some of the disks or all of them:

$ sudo parted -l

$ sudo parted /dev/sda print

$ sudo gdisk -l /dev/sda

—    —    —    —    —    —    —    —


Basic Tools for SW Development

Already latest version in the Manjaro 19.2 Kyria:

GCC (g++) – 9.2

gdb – 9.1

python – 3.8.1

git – 2.25.1

BASH shell – I will stick to it as the default in Kyria – version 5.0.16

IDE (Integrated Development Environment) – I started with the good old Eclipse as I know it quite well. It turned out it is too heavy for my Test PC. So I will use Gedit and also some of these two (as they were both on top of many reviews):

Atom – developed by the GitHub community.

Sublime – considered one of the best.

—    —    —    —    —    —    —    —


Installing SW on Manjro / Arch Linux

We do this with a Package Manager or in simple language – the tool helping is to install new SW, and resolving for us the dependencies on different libraries and modules.

As an ex “Arch user” – I was used to pacman. It gives access to released official builds, but also to modules from the AURArch User Repository, where many modules (which are not yet in the official upstream) are available. Those are practically under development, or the latest version under development e.g. before confirmed to be stable.

Pacman is working perfectly on Manjaro (as an Arch based distro, and this is the main Arch tool for package management), but requires the sudo many times. And by this and other reasons Manjaro chose to develop a new one. It is called pamac.

It has also a GUI (which is not pre-installed in the Manjaro Kyria XFCE).

Few important commands for pamac:

$ pamac search X_STRING_X – check if some module exists which holds “X_STRING_X” in it’s name.

Options:

-a” – adding this searches also in AUR

$ pamac install smplayer – this will install the given module. Tip: When using pamac install – this will check to see if packages are installed and only install the ones not already on the system.

$ pamac build umplayer – If you want to install packages from AUR you use the command “pamac build XXXX_module”.

$ pamac remove smplayer smplayer-themes umplayer – this will remove (uninstall in other language) the listed modules.

$ pamac list -i  – list all installed modules – it is LONG 😉

$ pamac info gcc   –   gives detailed info about the package – version, dates, licenses, dependencies, package group, website and whatever info was given for the package. QUITE useful! No matter whether the given packages is installed or not!

for help of course:

$ pamac -h  (or –help)

———————————

Pamac is great, but while I was checking around – it turned out there is a GUI based nice tool. It comes from Manjaro – simply click the Command button to open the Manjaro (Main) Menu, and write Add – this will give you the “Add/Remove Software” – click it. Now in there if you type directly some SW name (e.g. Eclipse) – it will show you the related packages, whether they are installed, and also an option to (un)install.

 

When I pressed install on Eclipse – as it should have done also on the command line with pamac or pacman – the GUI told me which additional package will be downloaded and installed. Then I just pressed Apply.

———————————

Lately there is another quite famous way to install SW. It is called a snap, info from the Manjaro Wiki. More info from the snapcraft official page. It is available in Arch and Manjaro and has a GUI called Discover.

Snap is a software deployment and package management system. The packages are called ‘snaps’ and the tool for using them is ‘snapd’, which works across a range of Linux distributions and allows, therefore, distro-agnostic upstream software deployment. Snap was originally designed and built by Canonical (the Ubuntu Developers).

snapd is a REST API daemon for managing snap packages. Users can interact with it by using the snap client, which is part of the same package. Or via Discover GUI tool 🙂

Why would we use it? To install the snap based applications. As written in the Manjaro Wiki: Snaps are a distro independent method for packaging and distributing Linux software.

Using software distributed by Snap has a couple of distinct advantages:

– Software that is not compatible with current system libraries will still work when packaged as a Snap

– Snaps are automatically updated

—————

Final points:

No matter whether you choose a snap, pamac, Add/Remove GUI or pacman – be aware – sometimes SW added via Discover or Add/Remove will not be available when querying the system e.g. like this:

$ pamac info eclipse

E.g. for Eclipse which I installed with Add/Remove (and it was working, despite that it was slow) pamac didn’t showed it as installed, whereas pacman did.

We can dig on why this happened, but I will not go deeper now. Play with it, try, learn and keep this note in your mind.

As a result I will use a mixture of the methods listed above, at my convenience (after all that’s the good thing of having a choice).

Next important thing – on Linux you need to use Terminal for many things like e.g. search for files and it’s easy. Before going on further into this – simply click around and try the basic SW provided with your GUI. For Xfce we have the File Manager – to look through our files, as well as several other useful applications, e.g. the Mozilla Firefox Browser. All of them preinstalled (that’s why I wanted a Linux distro packed with GUI frontend and a basic SW package).

Coming up next: PART 2.

Manjaro Linux on Raspberry Pi 4

Leave a Reply

Your email address will not be published. Required fields are marked *