Minimalist Deep [Reinforcement] Learning Software


On this post, I’ll be showing you how to install Arch Linux with i3 windows manager. Yep, that’s it, not DE, minimalist, remember?

Quick note is, the screenshots and disk sizes might not be consistent, this is OK, the thing is, I took the screenshots when I was building the system with a specific configuration, and then I rebuilt it shortly after with a little larger drives.

If you have any questions, feel free to ask!

We will be building the system on a 2 RAID configuration:

  • RAID 10 (mirror+striping): 4 x 500 GB SSD.
  • RAID 0 (striping): 2 x 1 TB HD.

The first RAID will host the OS, which will be Arch Linux. We will let the motherboard software handle the RAIDs so that we can rely on it for drives failure. I’ve found a lot of conflicts when trying to use Linux software RAID like mdadm to create a RAID of the whole disk and a (redundant) boot partition off it, but doing this with the Intel controller works well for me. The system will be able to boot even is a disk fails and will also take advantage of the multi disk config by speeding up 4x the reads and 2x the writes.

The second RAID is where we will put the deep learning data, so since we do not care about keeping this data redundant (as this is online accessible data), we are going to setup a striping array on this set of disks. Basically, we will use the full 2 TB of space available, and also gain a 2x speed up in both reads and writes. Not too shabby!

Set up the disk as software RAID from your motherboard

This is a somewhat important step. Remember, we are building the array on the motherboard software, before the OS. This is how the BIOS would look like after setting up the 2 arrays:

Now, remember that this is a screenshot of my old setup. However, if you follow the prompts on your system, it should be pretty straight-forward to get through this part.

Create your partitions

OK, so I’m assuming you created your Arch Linux boot pen drive and booted on it.

Now, you can take a look at the disks detected by your system with:

fdisk --list

Make note of the RAID partitions that will show up. In my case “md124” was the OS, and “md125” was the data array.

Now, let’s briefly make sure you have network access and set the correct time:

timedatectl set-ntp true

Next, we will create the partitions as follows:

# partition 1 - 100MB EFI -> Hex code ef00
# partition 2 - 500MB Boot -> Hex code 8300
# partition 3 - 100% remaining on disk linux -> Hex code 8300
gdisk /dev/md124
# partition 1 - 100% disk -> Hex code 8300
gdisk /dev/md125

Now, that the partitions are created, we create the “lvm” volume groups, and logical volumes:

vgcreate os /dev/md124p3
vgcreate data /dev/md125p1
# create the volumes on top of the OS array
lvcreate --size 16GB os --name swap
lvcreate --size 60GB os --name root
lvcreate -l +100%FREE os --name home
# create the volume where the working data will reside
lvcreate -l +100%FREE data --name srv
# visualize partitions and volumes

Next, we format all of the partitions created:

# EFI and boot partitions
mkfs.vfat -F32 /dev/md124p1
mkfs.ext2 /dev/md124p2
# system partitions
mkswap /dev/mapper/os-swap
mkfs.ext4 /dev/mapper/os-home
mkfs.ext4 /dev/mapper/os-root
# data partition
mkfs.ext4 /dev/mapper/data-srv

Now, we mount the system to start the installation of the OS:

# mount root and boot partitions
mount /dev/mapper/os-root /mnt
mkdir /mnt/boot
mount /dev/md124p2 /mnt/boot
mkdir /mnt/boot/efi
mount /dev/md124p1 /mnt/boot/efi
# mount os partitions
mkdir /mnt/srv
mkdir /mnt/home
mount /dev/mapper/os-home /mnt/home
mount /dev/mapper/data-srv /mnt/srv
# enable swap partition
swapon /dev/mapper/os-swap

We now install the base system on the mounted partitions, generate the fstab, copy some config files from the USB stick and chroot our new system:

# this installs some base packages to make our system usable
pacstrap /mnt base base-devel grub-efi-x86_64 vim git efibootmgr zsh
# generate the fstab so that our system can find the partitions on boot
genfstab -pU /mnt >> /mnt/etc/fstab
# copy the prompt config from the USB stick - I really like the installer's config
rsync -av /root/ /mnt/root/
rsync -av /etc/zsh/ /mnt/etc/zsh/
# get into the new system
arch-chroot /mnt /bin/zsh

Cool! You are now inside of your new system — treat it nicely.

Let’s do some initial configuration to make the system par to most standard Linux distributions.

ln -fs /usr/share/zoneinfo/America/Chicago /etc/localtime
hwclock --systohc --utc
# my hostname is hash - make this whatever you want yours to be
echo hash > /etc/hostname
hostname hash
vi /etc/hosts # make sure you add your hostname to this too
# this is the root password... set that now
# add your user, mine is mimoralea with group wheel... make this whatever you'd like
useradd -m -g users -G wheel mimoralea
passwd mimoralea
# set some language variables
echo LANG=en_US.UTF-8 >> /etc/locale.conf
echo LANGUAGE=en_US >> /etc/locale.conf
echo LC_ALL=C >> /etc/locale.conf
export LANG="en_US.UTF-8"
echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen
echo LC_COLLATE="C" >> /etc/locale.conf
echo KEYMAP="us" >> /etc/vconsole.conf
echo FONT="eurlatgr" >> /etc/vconsole.conf
# update pacman's database and install some new packages
pacman -Sy --noconfirm
pacman -S --noconfirm grub linux-headers os-prober intel-ucode dosfstools efibootmgr
mdadm --detail --scan >> /etc/mdadm.conf

Let’s edit the grub file and change some variables:

vi /etc/default/grub # uncomment GRUB_DISABLE_LINUX_UUID=true

Since we added mdadm arrays (the OS sees the motherboard created arrays as regular mdadm’s), let’s make a few changes to the mkinitcpio files.

sed -i.bak -r 's/^HOOKS=(.*)block(.*)/HOOKS=\1block mdadm_udev lvm2\2/g' /etc/mkinitcpio.conf 
# BROKEN: sed -i.bak -r 's/^BINARIES=""/BINARIES="/sbin/mdmon"/g' /etc/mkinitcpio.conf

The last command marked as BROKEN is broken, surprise! If you know how to write that sed line please let me know in a comment below :)

But in any case, make sure you change the line BINARIES="" for BINARIES="/sbin/mdmon". Do it manually or let me know!

After you make those 2 changes, execute the following commands to get grub installed:

mkinitcpio -p linux
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=arch_grub --recheck --debug /dev/md/os_0
grub-mkconfig -o /boot/grub/grub.cfg
# these two lines are a trick for some systems that look for the EFI files on a different directory.
# we might not need them, but it does hurt to have them
mkdir /boot/efi/EFI/boot
cp /boot/efi/EFI/arch_grub/grubx64.efi /boot/efi/EFI/boot/bootx64.efi

We can now get off this new system umount, disable the swap partition and reboot:

# we are now back on the installer
umount -R /mnt
swapoff -a

Remove the pen drive and go get a cup of coffee. I’ll see you in few minutes…

Alright, let’s login and immediatelly give your user sudo access:

# login as root
# and uncomment the line that would allow wheel users to sudo

Now, let’s setup your network connectivity:

# still as root let's setup the network connection
ip addr
# my device is 'enp0s31f6'
cp /etc/netctl/examples/ethernet-dhcp /etc/netctl/enp0s31f6
# not sure if we need this one (don't remember)
# but -rf would fail silently
rm -rf /etc/netctl/eth0
# now edit this file to make your device look as needed
vi /etc/netctl/enp0s31f6
# let's get online!
netctl list
netctl start enp0s31f6
netctl enable enp0s31f6

We want to be able to use yaourt to download our packages. We trust the community! Let’s do so:

echo '' >> /etc/pacman.conf 
echo '[archlinuxfr]' >> /etc/pacman.conf
echo 'SigLevel = Never' >> /etc/pacman.conf
echo 'Server =$arch' >> /etc/pacman.conf
pacman -Sy yaourt

Let’s get out of sudo, and install some more packages:

# get out of su
yaourt -S --noconfirm nvidia nvidia-utils cuda i3 i3-wm \
i3status i3lock xterm dmenu xorg xorg-xinit termite \
chromium emacs franz-bin i3blocks rsync wget curl nitrogen \
vlc terminus-font

Now, I’m not going into the details how I personally setup my i3, but I give you a couple of tips:

# this command executes i3 once the xinitr is started
echo 'exec i3 -V >> ~/.config/i3/i3log 2>&1' >> ~/.xinitr
# this one adds a X session when a bash session is added
echo '[ -z "$DISPLAY" -a "$(fgconsole)" -eq 1 ] && exec startx' >> ~/.bash_profile

Also, if you have never used i3 you’ll freak out when you see the default fonts!!OMG! Worry-not, you can fix this with:

yaourt -S --noconfirm adobe-source-code-pro-fonts  \
adobe-source-sans-pro-fonts adobe-source-serif-pro-fonts \
ttf-bitstream-vera ttf-inconsolata ttf-ubuntu-font-family \
ttf-dejavu ttf-freefont ttf-linux-libertine ttf-liberation \
otf-ipafont ttf-amiri ttf-ancient-fonts ttf-ms-fonts \
ttf-monaco ttf-noto ttf-vista-fonts

Fonts should be much better after that!

Finally, I like to use pulseaudio and pavucontrol, I guess using Fedora for a while open my heart to it :)

yaourt -S --noconfirm pavucontrol pulseaudio pulseaudio-bluetooth
pulseaudio --start

Wow! You should like your setup. I do, I love mine. Make sure you share your screenshot: