Installing Archlinux For Self Driving Car Development Environment

Archlinux + i3 Desktop Image/http://dotshare.it/dots/1410/

Archlinux has been my main operating system since 2015. I actually met Archlinux back in 2012 when the Raspberry Pi hit the market. I tweaked it and in 2015 finally decided to use it fully on my production machine. That was the last time I used Windows on production mode. I don’t have any bad feelings with Windows but being an Electric Engineer (2019) I want to see whats happening in the background. Arch does exactly that. Arch Linux defines simplicity as without unnecessary additions or modifications.

In Self Driving cars developments many engineers use Ubuntu as their primary OS due to the fact that its easy to set up and the ROS (Robot Operating System) runs well on Ubuntu.

In this tutorial I will guide you on how to set up Archlinux on any standard pc for SD Cars development. My PC here is a 2010 Acer Aspire 1 D270 that has an Intel Atom N2600 at 1.6GHz and has 2GB RAM. I use this on my travels around Kenya It keeps charge well for over 7 hours. Due to the fact that its small and compact, it works well for small data analysis and I hope to make it my tool once I star analyzing the electronic side of cars. In Kenya is not safe to walk around with a standard laptop due to insecurity and bulkiness, so I prefer this small baby.

In this installation I will go very minimal so as to leave large system resources for development other that having the computer take up all memory running unnesecary applications. That my goal.

Preparing the Disc (Installation Media)

I will be installing Arch via a USB Drive. The first thing is to head to a site that offers the Archlinux ISO and download it. I prefer this server in Austaria, has never let me down. https://mirror.aarnet.edu.au/pub/archlinux/iso/2017.07.01/
Once the image is downloaded, fire up your favourite Terminal and ener the following command to write the ISO to the USB drive.

dd bs=4M if=/path/to/archlinux.iso of=/dev/sdx status=progress && sync

Be very careful when working with the dd command, double check your drive maps using

sudo lsblk

Wait for a few minutes and when its done, run..

sync

to make sure that the contents are cleared from RAM. Unplug the USB and insert it into the machine to be installed.

Step 2 — Check for Wifi

When installing archlinux, we will require an internet connection, I will be using wifi so first lemme connect to wifi

wifi-menu
 
 After connection, I will ping my server to check for connection
 
 ping www..githuka.command
 
 Successful ping means am online.

Step 3 — Format Drives

cfdisk /dev/sda1
mkfs.ext4 /dev/sda1

I will not be using a SWAP partition because she has 2GB RAM and over the years I have realised that SWAP just caused disk wear so now I dont need it.
To cnfirm that all is okay so far, you can run

lsblk

To show the disk arrangement, you should see the new partitions well lined up.

Step 3 — Install The Base System

Use the pacstrap script to install the base package group:

pacstrap /mnt base base-develoment

base is the default package group for Archlinux. It has 50 members while base-devel has 25 members. This of these as the default tools you need to get your system running. They are 250 MB approximately.

Next we will generate the File System Table

genfstab -U -p /mnt >> /mnt/etc/fstab
nano /mnt/etc/fstab

The fstab (File System Table) should show you the disc arrangement. If you see it, then all is okay. Lets now get into our newly installed system

arch-chroot /mnt

Time and Location

nano /etc/locale.gen
locale-gen
echo LANG=en_US.UTF-8 > /etc/locale.conf
export LANG=en_US.UTF-8
tzselect

Then, set the clock according to your chosen zone with:

hwclock — systohc — utc

Creating User Accounts

Upto now, our machine has the root user and no other normal user. I will now create a user called wilfred.

This is first to give the root password. .

passwd

Now we create my account

useradd -m -g users -G wheel,storage,power -s /bin/bash wilfred
passwd

Our machine need s hostname, I will call it acer

echo acer > /etc/hostname

Lets edit the Package Managers files to enable us to install non-official packages.

nano /etc/pacman.conf
[archlinuxfr]
Siglevel = Never
Server =
http://repo.archlinux.fr/$arch

After adding those lines to the end of the file, run the following to update your system

pacman -Syu

Now we will run the following command to enable us the normal user get privileges upon running the sudo command. Uncomment the line below (Remove preceding hash #)

EDITOR=nano visudo

%wheel ALL = (ALL)

Setting Up the Boot Loader.

Next, you’ll need to install a bootloader that can boot you into your Arch installation. For this guide, we’ll be using the ever-popular GRUB, though you can use something else if you desire. If you’re installing Arch on a UEFI-based motherboard (instead of a BIOS-based motherboard) or if you’re dual-booting, you may want to do some extra reading before continuing, as everyone’s setup is going to be a little different.

To install GRUB, run the following commands, replacing /dev/sda with the drive (not the partition, /dev/sda1) that holds your Arch Linux installation:

pacman -S grub-bios
grub-install — target=i386-pc — recheck /dev/sda
cp /usr/share/locale/en\
@quot/LC_MESSAGES/grub.mo /boot/grub/locale/en.mo

If you’re dual booting, run the following:

pacman -S os-prober

Then, whether you’re dual-booting or not, run:

grub-mkconfig -o /boot/grub/grub.cfg

This will create a config file for your bootloader (which you can edit if you want different options when booting into Arch or another OS).

Because am on wifi, I will install some tools which will enable me to connect to wifi on boot.

sudo pacman -S iw wpa_supplicant dialog

Lastly, exit from chroot, unmount your partitions, and reboot your computer:

exit
umount /mnt/home
umount /mnt
reboot

Sound Setup

Sound is Archlinux can be configured in many ways. I prefer Alsa. To install we use:

sudo pacman -S alsa-utils
run alsamixer
to open your devices and unmute using M

Test your hardware using

speaker-test -c 2

You should hear some sample sounds from your laptop’s speakers.

Xorg and Graphics Setup

Next, it’s time to get some graphics up and running. First, we’ll install the X window system with:

sudo pacman -S xorg-server xorg-xinit xorg-server-utils xorg-twm xorg-xclock xterm

If you want 3D support, you’ll also want to install mesa:

sudo pacman -S mesa

Now comes what, in my experience, is always the most troublesome part of a Linux installation: video drivers and configuring X. The video driver you need will depend on your graphics card and what you want to get from it

My pc is a good old intel so I will run:

sudo pacman -S xf86-video-intel xf86-input-synaptics ttf-dejavu
startx

Install i3 Tiling Window Manager

i3 is a dynamic tiling window manager inspired by wmii that is primarily targeted at developers and advanced users. The stated goals for i3 include clear documentation, proper multi-monitor support, a tree structure for windows, and different modes like in vim.

sudo pacman -S i3-wm i3status i3locker

Enable Light Display manager to be stated at boot

sudo systectl enable lightdm.service

Reboot

Thats it installation complete, in the next post I will install the tools necessary for starting autonomous driving development

Thats all for now, stay safe and keep your hands near the steering wheel when developing your cars.

Circuit Open [ — /— ]