Setting up new R-01 with i3, syncthing, emacs

I’m coming late to the DevTerm party and just received my new R-01 a few days ago. I’m a longtime Linux user, and I’m impressed with how smoothly the default install seems to be running, after a few small tweaks.

Here are my notes about how I got everything up-and-running. I owe a lot to @ajorg’s post and to @andypiper’s page of notes., so I wanted to pay it forward.

My workflow centers on i3, emacs (especially org-mode) and syncthing, and this little device is perfect for that mix.

Preliminaries

Fixed sources.list to point to jammy rather than devel:

sudo sed -i 's/devel/jammy/g' /etc/apt/sources.list

Got rid of update-notifier-common due to reports of it slowing down updates:

sudo apt purge update-notifier-common

Preferred the @andypiper solution for dealing with the u-boot problem:

Add new line to file /etc/default/u-boot:

U_BOOT_UPDATE=false

Got rid of a few packages I’ll never use.

sudo apt purge gimp inkscape freedom chocolate-doom freedoom

Finally software update

sudo apt dist-upgrade

And then autoremove

sudo apt autoremove

Fixed timezone

sudo timedatectl set-timezone America/New_York (or another string returned by timedatectl list-timezone).

Getting rid of autologin

By default, the cpi user is logged in automatically and once logged in, XWindows is started automatically. Preventing both isn’t straightforward!

First, stop Xwindows from starting automatically.

XWindows starts in .bash_profile in the ~cpi home directory, so comment out the exec startx line by changing it to #exec startx.

Second, get rid of the autologin

XWindows no longer autostarts, but the cpi user still gets auto logged in to the bash shell.

It took a lot of digging, and this may not have been exactly the order in which I did things, but the problem was there was an systemd drop-in file instructing the automatic login of the cpi user on tty1, as in this discussion.

The solution (I think) was to remove the getty@tty1.service with:

sudo systemctl disable getty@tty1.service

I believe I also removed the directory in question with:

sudo rm -R /etc/systemd/system/getty@tty.service.d

At this point, after reboot, tty1 no longer displayed the login prompt. It just displayed the boot messages without any prompt. (Logging in via tty2 still worked using Fn-Ctrl-Alt-2.) To restore the login prompt, readd the service:

sudo systemctl enable getty@tty1.service

Finally, the device prompts the user to login after boot.

Changing the cpi username

All of the above was necessary to rename the cpi user, because the usermod command won’t work if there are any processes owned by the user, so the user must be logged out.

These steps must be run by the root user, so set its password with:

sudo passwd root

(Some sources suggested that the cpi password works, but it did not for me.)

Log out from the cpi account and into the root account.

Use the steps listed in this message board post to rename my user:

  1. killall -u cpi to kill any remaining processes running under that username.
  2. usermod -l newname -m -d /home/newname cpi to rename the user nad move its home directory.
  3. groupmod -n newname cpi to change the user groups.
  4. chfn -f "Your Name" to choose a new full name.

Log back in to the newly renamed user account and run passwd to change the default password.

Installing i3

To install the i3 window manager:

sudo apt install i3

To launch i3 when startx is run, change the last line of ~/.xinitrc to exec /usr/bin/i3.

Configure i3 as in the user’s guide.

By default, i3 maps $mod+Shift+e to “exit” but uses i3-nagbar to confirm the decision. This requires a mouseclick to confirm, forcing the user to use the trackball. Fix this in the i3 config file using the method explained here by adding this to the i3 config file:

mode "exit: [l]ogout, [r]eboot, [s]hutdown" {

  bindsym l exec i3-msg exit

  bindsym r exec systemctl reboot

  bindsym s exec systemctl shutdown

  bindsym Escape mode "default"

  bindsym Return mode "default"

}

bindsym $mod+Shift+x mode "exit: [l]ogout, [r]eboot, [s]hutdown"

And getting rid of the original line:

# exit i3 (logs you out of your X session)
bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'"

After this, startx starts XWindows using i3 as the window manager.

For some reason, i3-sensible-editor didn’t do anything useful, so after installing uxterm changed the line to:

bindsym $mod+Return exec uxterm

Web browsers

A few obvious web browsers don’t seem to have RISC-V versions in the ubuntu packages. One available, keyboard-centric, thin browser, capable of rendering javascript is qutebrowser. The qutebrowser-qtwebngine could not be installed because some dependencies “are not installable.”

The first time launching the browser, a pop-up prompts for the engine, and the qutebrowser-qtwebkit works.

Qutebrowser has a lot of online documentation. The ‘f’ key shows “hints,” which are the clickable areas on the webpage.

As an avid (obsessive?) emacs user, I use eww in a pinch.

Syncthing

Syncthing seems to work pretty well out of the box after installing with:

sudo apt install syncthing

Fonts and colors

Terminal

Choose a color scheme at terminal.sexy, export it to the ~/.Xresources file.

Set the font and font size for the terminal in ~/.Xresources too. Mine reads, as an aid to my aging eyes:

UXTerm*renderFont: true
UXTerm*faceName: DejaVu Sans Mono
UXTerm*faceSize: 16

Add xrdb -merge $HOME/.Xresources to ~/.xinitrc before the line in which i3 is launched.

Emacs

Set font and face size with M-x customize-face and default for the face to edit.

6 Likes