Friday, December 20, 2024

GUIX Package Manager

 For those who don't know, GUIX is a package manager for Linux. It is supposed to work across all (or most) Linux distributions and provides some level sand boxing between applications. There is also a distribution based entirely on this software. It is supposed to be an alternative to Flatpak and Snap, both of which have their own problems.

Yesterday I spent the day messing around with it. I installed the distro on my test machine, I also tried it on an clean install of Debian. I have used a lot of package managers over the years, Apt, Yum, Pacman, Portage, and yes, Flatpak and Snap, I have used most all of them at one point or another. Guix is without a doubt the worst package manager I have ever used. I have no idea who thought this package manager implementation was a good idea, but I hope they did not quit their day job to develop this garbage.

First the things I liked; Nothing, I didn't like anything about Guix. It does nothing Flatpak or Snap doesn't do, it brings no new ideas or technology to the table, it is just a terrible implementation of a good idea.

Things I didn't like. Fuck where do I start. The Guix distribution took half a day to install a basic system and I do mean basic, no web browser, no email client, nothing more complex than a text editor. Debian takes 30 minutes for a full install, bells, whistle and all. On top of that once I had it install, it was taking up close to 20 GB of storage, what the hell Guix? A full install of Debian comes in well under 5 GB.

Once I had the basic install, I started installing programs, that was a bloody mistake. Every program took half an hour to install and a boat load of other packages would install with it, often simply reinstalling packages that were already on the system. To make things worse, commonly used programs like Firefox and Thunderbird were not available. I either had to compile from source or use Guix equivalents, Icecat and Icedove. Which apparently are freer and more open sourcey than Firefox and Thunderbird, but lack just about every feature implemented in those two programs in the last 5 years.

After nearly 8 hours of screwing about with the distro and still not having a system I could use as a daily driver, I gave it up. I installed a basic install of Debian and whittled it down to the same state the basic install of Guix gave me, as I said earlier, this took me less than 30 minutes to accomplish. I then installed the Guix package manager on this poor machine. Guix immediately brought all its worst features to Debian. It took over an hour to pull down its repository information and then promptly installed a bunch of packages that already existed on the system, which took an hour. Then I tried to install Icecat, and it repeated the same bullshit it did on its own distro and after half an hour when it was finished, I could not actually run Icecat. It was not on the menu and I could not run it from the command line. At this point, I was done with Guix.

No one should be using Guix. I would recommend Gentoo Linux before I would recommend Guix as a distribution. Debian + Flatpak will give you everything Guix gives you, but you will have more storage left, you will spend far less time managing it and you will not hate your computer and yourself everyday. If you want a challenge, install Arch Linux, install Gentoo, heck to Linux from Scratch, but please for the love of god, do not use Guix, don't encourage them.

Sunday, December 1, 2024

Minimalist Linux III

If all that was too much work for you, go to my github where you will find all my config files and a nice little install script to do the heavy lifting for you.

 https://github.com/cjstoddard/My-Openbox

This will make your desktop look and function like mine. However if you actually read the blog posts, making minor changes should not be a problem.


You will still need a basic install of Debian 12.

Tiling windows managers still suck.

Minimalist Linux II

Now that we have a functional desktop, it is time to pretty it up a bit and add a bit of functionality. Nobody normal like a stock boring desktop, so I am going to show you some customization tricks.

The first thing most people do is set wall paper. Find an image you like and download it into your home directory and rename it to something simple, I named mine angel.jpg.

mv background.jpg angel.jpg
Next we want to make it available system wide, for later.
sudo mkdir /usr/share/backgrounds
sudo cp angel.jpg /usr/share/backgrounds/
sudo chown root:root /usr/share/backgrounds/angel.jpg
Now place the picture wherever you want it to go. Normally there is a Pictures folder, you can just put it there.
mkdir Pictures
mv angel.jpg Pictures/
Now run these commands;
feh --bg-scale Pictures/angel.jpg
nano ~/.config/openbox/autostart
Add this line to the autostart file;
(sleep 1; ~/.fehbg) &
Now if you exit out of Openbox and go back in, you should have a nice background. Our next step is to change the Openbox theme, the default is Clearlooks. Which is fine, but for whatever reason lots of people like darker themes. Edit the configuration file;
nano ~/.config/openbox/rc.xml
Look for the <theme> section, and replace <name>Clearlooks</name> with <name>Artwiz-boxed</name>. Restart Openbox and you should see a change in how the windows decorations look. If this is not to your taste, there are many themes available in /usr/share/themes. You will have to google the themes to see how they each look.

The biggest issue with this setup so far is when you boot to the system it drops to the command line and you have to run startx to get to you desktop. There is also no way to lock the screen if you need to. We will need a display manager for this, lightdm is the one I like.
sudo apt install lightdm
sudo systemctl enable lightdm
When you reboot the system, you should come to a graphical login screen. We could leave it there, but that would be boring. To change the background open the configuration file;
sudo nano /etc/lightdm/lightdm-gtk-greeter.conf
At the bottom, add the following line;
background=/usr/share/backgrounds/angel.jpg
This will set the background of the login screen. Any picture you want to use, will have to be placed in the /usr/share/backgrounds/, otherwise it will not work properly.

Next we want to add the ability to lock the screen when needed. Run;
nano ~/.config/openbox/rc.xml
search for </keyboard> and add these lines just above that line;
<!-- Keybindings for [l]ock screen -->
  <keybind key="W-l">
    <action name="Execute">
      <command>i3lock -c 000000</command>
    </action>
  </keybind>
Once you restart Openbox, the screen can now be locked by pressing the Winows key + l.

For the final piece of customization, we are going to use a program called conky to add a dynamic element to your desktop. The first thing we need is a default config file.
cp /etc/conky/conky.conf .conkyrc
nano .conkyrc
The first thing I like to do is make conky transparent. I mean why have wallpaper if you are just going to block it out. Right under conky.config = { add this line;
own_window_transparent = true,
Next look for this section;
${color grey}Networking:
Up:$color ${upspeed} ${color grey} - Down:$color ${downspeed}
and change it to look like this;
$hr
${color grey}Networking:
IP Address:$color ${addr enp3s0}
Up:$color ${upspeed enp3s0} ${color grey} - Down:$color ${downspeed enp3s0}
My network device is enp3s0, you will need to run the command "ip addr" to find your network device and replace accordingly. Now go to the bottom of the file and just above the ]], place these lines;
$hr
${exec cat .keys.txt}
$hr
Now save and exit the file. The last lines I had you place are there because I like to have an onscreen reminder of all those dumb keybindings we setup that I can never remember, so run this command;
nano .keys.txt

and put the following text into it, then save and exit.

-------------------------------------
Keybindings
-------------------------------------
ROX-filer     windows-f(ile manager)
Rofi          windows-m(enu)
Firefox-ESR   windows-w(eb)
Tilix         windows-t(erminal)
Thunderbird   windows-e(mail)
Audacious     windows-a(udio)
VLC           windows-v(ideo)

Print Screen  windows-prtscn
Lock Screen   windows-l

Switch Desktops;
  ctrl-alt-right
  ctrl-alt-left
-------------------------------------
Finally, edit the autostart file

nano ~/.config/openbox/autostart
and add this line, then save and exit the file.
(sleep 5 && conky -c .conkyrc) &
Finally, reboot the system and if all went well, things should look much better. With a display manager and conky running, the amount of memory consumed crawled up above 512 MB, but probably not by much. I consider it to be a worth while trade off for the added functionality and general look of the desktop.

As a final note, I know some of you are going to scream that I should have used a tiling WM like Suckless or i3. I do not like tiling WM's, I prefer stacking WM's. Tiling WM's make me work the way the developers think I should be working, fuck that is all I am going to say about it.

Saturday, November 30, 2024

Minimalist Linux

Honestly, I am not a fan of the minimalist Linux movement. Today's machines are more than capable of handling what we throw at them and RAM is cheap. There is no reason not to use Gnome or KDE and even if you prefer a more legacy look, MATE and Cinnamon work just as well. The problem with minimalist desktops is you sacrifice ease of use and functionality. I don't care what anyone says ctrl-t is not easier than clicking on a button.

Having said that, there is some use for such a setup, for instance if you have a low end machine with limited RAM and no upgrade paths. In this case a GUI that eats less than 512 MB of RAM is nice. I have a Lenovo ideapad-1 with a Celeron G4020 and 4 GB of RAM, I like it because it is light and easy to carry around a busy airport. Gnome or KDE would bring this system to its knees and even MATE is a bit much for it.

In a case like this, I would forgo a Desktop Environment (DE) altogether and just use a Windows Manager (WM), in this case Openbox. A WM provides the basics, windows and decorations nothing more, a DE goes a step further and add the bells and whistles that make things easier to use and flashier.

The first step is to install Debian 12, when you get to the part where it asks what Desktop you want, uncheck everything except the bottom two options. Once that is done, reboot and log in as root, update the system and add the user you created to the sudo group. Then reboot again and log in under you user account.

Next comes installing what you need

sudo apt install xorg xbacklight xbindkeys xvkbd xinit xinput xserver-xorg-input-all xterm openbox obconf dunst dbus-x11 feh hsetroot i3lock libnotify-bin libxcb-xinerama0 lxappearance lximage-qt menu picom rofi scrot tint2 volumeicon-alsa xfce4-power-manager alsa-utils fonts-dejavu fonts-firacode fonts-font-awesome fonts-liberation2 fonts-ubuntu fonts-jetbrains-mono gtk2-engines-murrine gtk2-engines-pixbuf network-manager network-manager-gnome papirus-icon-theme pavucontrol pipewire-audio qt5-style-plugins rox-filer conky

Here we are installing our applications, I am avoiding heavy duty applications like LibreOffice and GIMP in favor of applications like Abiword and Inkscape, which eat less memory. Adjust to taste.

sudo apt install firefox-esr audacious thunderbird vlc emacs abiword gnumeric atril pluma mate-calc tilix inkscape
These next commands setup our WM in a basic configuration

mkdir -p ~/.config/openbox
cp /etc/xdg/openbox/* ~/.config/openbox/
systemctl --user --now enable wireplumber.service
Then we are going to setup the utilities needed for the basic functioning of the desktop. Type the following;

nano ~/.config/openbox/autostart
And add these lines;

hsetroot -solid "#000000"
xfce4-power-manager &
dunst -config ~/.config/dunst/dunstrc &
tint2 &
(sleep 5; volumeicon) &
nm-applet &
The hsetroot command sets the background color, #000000 is hexadecimal for black, for a nice blue, use #2e86c1, if you want to choose your own color, this site will help, https://htmlcolorcodes.com/ . You can set a picture as your background using a program call feh, but I am not covering that here.

Next we need to edit the .xinitrc file so when xorg starts, it knows what WM we are using. Type this command;

nano .xinitrc

and add these lines;

#!/bin/bash
exec openbox-session
Now, type startx and Openbox will start. You will see a blank screen, with a bar at the bottom. Right click on the background and choose terminal off the menu. In the terminal type in;

rofi-theme-selector

Rofi is the tool we will use to find and run programs. In its default state a window pops up in the middle of your screen, I prefer a bar at the top. Off the menu of choices, choose the demnu theme, to set the theme. Then we will want to configure rofi, so it shows icons with the programs. Type in the terminal;

nano .config/rofi/config.rasi

and add these lines to the file;

configuration{
display-drun: "Applications:";
display-window: "Windows:";
font: "JetBrainsMono Nerd Font Medium 10";
modi: ["drun", "window", "run"];
icon-theme: "Papirus";
show-icons: true;
}

@theme "/usr/share/rofi/themes/dmenu.rasi"
The final step is to setup our hotkeys for running the applications we use the most. Type in the following command;

nano ~/.config/openbox/rc.xml

search for </keyboard> and add these lines just above that line;

 <!-- Launch rox-filer when windows-f is pressed -->
  <keybind key="W-f">
    <action name="Execute"><command>rox-filer</command></action>
  </keybind>
<!-- Launch rofi when windows-m is pressed -->
  <keybind key="W-m">
    <action name="Execute"><command>rofi -show drun</command></action>
  </keybind>
<!-- Launch firefox when windows-w is pressed -->
  <keybind key="W-w">
    <action name="Execute"><command>firefox-esr</command></action>
  </keybind>
<!-- Launch tilix when windows-t is pressed -->
  <keybind key="W-t">
    <action name="Execute"><command>tilix</command></action>
  </keybind>
<!-- Launch thunderbird when windows-e is pressed -->
  <keybind key="W-e">
    <action name="Execute"><command>thunderbird</command></action>
  </keybind>
<!-- Launch audacious when windows-a is pressed -->
  <keybind key="W-a">
    <action name="Execute"><command>audacious</command></action>
  </keybind>
<!-- Launch vlc when windows-v is pressed -->
  <keybind key="W-v">
    <action name="Execute"><command>vlc</command></action>
  </keybind>
<!-- Launch scrot for screen caps when windows-print is pressed -->
  <keybind key="W-Print">
    <action name="Execute"><command>scrot 'screenshot-%Y-%m-%dT%H%M%S.png'</command></action>
  </keybind>

With this configuration, your keybindings will be as follows.

ROX-filer         windows-f(ile manager)
Rofi                 windows-m(enu)
Firefox-ESR    windows-w(eb)
Tilix                windows-t(erminal)
Thunderbird   windows-e(mail)
Audacious      windows-a(udio)
vlc                  windows-v(ideo)

Switch Desktops;
  ctrl-alt-right
  ctrl-alt-left
Print Screen  windows-prtscn

All that is left to do is right click on the background and choose Exit, this will drop you back to the command line, reboot the system and log back in. Then type startx to get back to your desktop. To run a program you do not have a hotkey for, simply press the Windows Key + m, at the top rofi will appear, simply start typing the name of the program and when it appears, highlight it and press enter.

Keep in mind, this is a very basic and plain setup. As I said earlier, you can set a background picture and you can add some interesting bling using conky. I may go into these things later. But for now, enjoy your minimalist desktop that consumes less than 512 MB of memory.

Tuesday, November 26, 2024

Building a Firefox Kiosk

 In my home lab I have been experimenting with various types of virtual machines. Mostly this has been complete operating systems. However one of the things Broker servers can do for you is give access to single applications, without the need for complete operating systems. Broker software like VMWare Horizon is expensive, but honestly, something like Remmina, which is a multi protocol desktop connection client, serves the same purpose.

In this example, I am setting up Firefox as a app, when the VM is launched Firefox is all the user has access to. If you wanted to, you could install this setup on a PC and just use it as a kiosk, no virtualization is really needed.

The first step is installing Debian 12, you can use Ubuntu server as well. We want a minimal install, no extra software outside of ssh server, not even a desktop environment. The resource requirements are very low; 1 core, 2 GB of RAM and 8 GB of storage will be more than enough. Once you are done, log in as root and install the needed software

apt update && apt upgrade

apt install sudo firefox-esr xorg openbox lightdm tigervnc-standalone-server tigervnc-common

Once that is done you will need to add the kiosk user, which is the account which the system will automatically log into when anyone accesses the virtual machine.

useradd kiosk

Next, enter the kiosk user account;

su - kiosk

Now we are going to make 2 confiuration files, one for VNC so the account can be accessed remotely and one for Openbox, which is the window manager we will use.

mkdir .vnc

nano .vnc/config

Enter the following text into the file, then press ctrl-x, save the file and exit.

session=openbox
geometry=1200x720
localhost
alwaysshared

Then move on to Openbox;

mkdir -p .config/openbox

nano .config/openbox/autostart

Enter the following text into the file, then press ctrl-x, save the file and exit.

env DISPLAY=:1 firefox-esr -kiosk 'http://url' &

If you want to setup a different application, this is the place to do it. Firefox can be replaced with Chrome or LibreCalc, just make sure the appropriate software is installed. Go a head and exit the kiosk user account by typing exit and you will be back in the root account.

We now want to give over display :1 to the kiosk user so when when someone logs in via RDP, Firefox will display on the VNC connection instead of the local display.

nano /etc/tigervnc/vncserver.users

Enter the following text into the file, then press ctrl-x, save the file and exit.

 :1=kiosk

The next step is to make it so the system booting directly into the kiosk user account and starts the VNC server.

 nano /etc/lightdm/lightdm.conf

Go to the bottom of the files and add these lines, then press ctrl-x, save the file and exit;

[SeatDefaults]
autologin-user=kisok
user-session=openbox
[VNCServer]
enabled=true
command=/usr/bin/Xvnc -rfbauth /etc/vncpasswd
port=5901
width=1200
height=720
depth=32

Finally, we want to setup the VNC password, that will be required when the user initiates a VNC connection.

vncpasswd /etc/vncpasswd

Now, reboot the system. On the local display, you will get a blank screen, if you right click on the background, you should get a menu. When you access it with VNC, Firefox should automatically start up in kiosk mode.

Tuesday, November 19, 2024

Installing VNC Server software into Debian 12

 Something that should be easy to do in Linux is getting VNC server software up and running without too much problem, except its not. All the instructions I found used TightVNC or TigerVNC and for whatever reason required the installation of XFCE to make work. XFCE is not bad really, but it is not the desktop environment that I normally used.

This got me to wondering whatever happened to vino, which was a VNC package I used years ago but no longer seemed to be in favor. I looked around and although it is still available it is no longer being maintained. Further, because of a bug, the last person who worked on it, removed the configuration dialog, which forced the user to configure it with a command line tool. Ultimately though, it is still pretty easy to install and get running without all the extra hoops needed for TightVNC or TigerVNC.

sudo apt install vino
gsettings set org.gnome.Vino prompt-enabled false

Then run this command to make sure the prompt is disabled.

gsettings list-recursively org.gnome.Vino

Finally, add this to your startup programs and reboot the system;

/usr/lib/vino/vino-server --display=:0 &

That is pretty much it. You should now be able to access the desktop with Remmia or similar using port 5900.

Saturday, July 20, 2024

10 things to do after you get your ClockworkPi uConsole

Note: For a more up to date version of this post, please see my github.

https://github.com/cjstoddard/Clockworkpi-uConsole

Unless you bought your uConsole from ebay for way too much money or you bought it from a sketchy Alliexpress seller, you probably waited months to receive it. Once you have it, the question is, what now? Well, The first thing you probably did was  assemble it, I am not going to cover that, there are plenty of Youtube videos out there for that. I am going to cover the things I had to do after I assembled it to get it where I wanted it to be in terms of software and usability. Here are the 10 things you can do to improve your uConsole experience. This list does require some working knowledge of Linux and Raspberry Pi's in general.

1. Get the Community OS image

The first thing t do is either boot to the SD card sent with the uConsole, if you did not get an SD card, get a 32GB SD card and download the stock image.

https://github.com/clockworkpi/uConsole/tree/master#uconsole-os-images

Burn it to the SD card and boot your uConsole with it. Test it out, make sure everything works. Now shut it down, remove this card and set it aside. This is your base line, if something goes wrong you can always boot off this SD card to make sure your problem is not just wonky software.

Next get a 64, 128 or bigger SD card, a 32 GB SD will fill up fast. Go download the community image.

https://forum.clockworkpi.com/t/bookworm-6-6-y-for-the-uconsole-and-devterm/13235

This image is based on a much newer version of the Raspberry Pi image along with an updated kernel. Burn this image to the larger SD card. Use it to boot up your uConsole and make sure everything works.

2. Update your system

Having an up to date system is paramount for any system, run these commands on a regular basis.

sudo apt update

sudo apt upgrade

3. Install useful programs

The first set of programs are text mode programs that I find useful, the second set are GUI programs I use. Adjust according to taste.

sudo apt install sudo mc links cmus htop neofetch tmux ffmpeg net-tools build-essential lame zsh mailutils git ufw default-jre tty-clock calcurse git wget curl flex bison bc libavcodec-extra -y
sudo apt install synaptic tilix audacious flameshot thunderbird filezilla transmission remmina gdebi thonny mozo vlc zim code -y

4. Change Desktop Environment (DE)

I am not a big fan of Wayfire or Wayland. If you want to change your DE to something else, use Tasksel to install the DE of your choice. I would also select Debian desktop environment, this will install things like LibreOffice and GIMP, but if you prefer a minimal setup, then leave it unchecked.

sudo tasksel
If you do this, the default Display Manager does not let you change your DE, for that you will need to install sddm.
sudo apt install sddm
The problem with sddm is when you reboot it will be sideways, so follow the next set of instructions to correct the screen orientation for sddm before you reboot.
sudo echo "xrandr --output DSI-1 --rotate right" >>  /usr/share/sddm/scripts/Xsetup

sudo echo "[X11\]" >> /var/lib/sddm/state.conf

sudo echo "DisplayCommand=/usr/share/sddm/scripts/Xsetup" >> /var/lib/sddm/state.conf

Once you have logged into your new DE, you will likely have to go to the display settings and rotate the display.

5. Safely Overclock your uConsole

The Raspberry Pi Compute Module CPU speed is 1.5 Ghz, and the GPU speed is 500 Mhz.  Most people find this barely usable. You can kick this up by overclocking your CPU and GPU. I have done this many times and I have never had a problem with these settings. While this speed is still not great, you will find the system much more usable. Run the following command;

sudo nano /boot/firmware/config.txt
add these lines to the bottom of the file, save and reboot.
over_voltage=6
arm_freq=2000
gpu_freq=750
gpu-mem=256
After your reboot run;

vcgencmd measure_clock arm
To make sure your CPU is running at 2 Ghz. You can try to set the CPU speed higher using arm_freq=2147, but not all devices will handle this speed gracefully. If you are going to experiment, please do so carefully and don't blame me if your shit breaks.

6. Setup Firewall

If you are going to be using your uConsole in public places, you will want to take some steps to secure it from bad actors. If you have not installed ufw yet, do so now with "apt install ufw".  Before you enable the firewall, you will want to allow ssh connections through your firewall so you can connect to it remotely.

sudo ufw allow ssh
sudo ufw enable

7. Secure ssh access to your system

Next you will want to setup your uConsole so it will only accept ssh connections from system you want it to. First log into your uConsole from the system you want to access it from, then log back out, then run the following command to generate a private and public key set.

ssh-keygen

Just hit enter three times to generate the keys. Next you will want to copy your public key to your uConsole with the following command;

ssh-copy-id remote_username@remote_server_ip_address

Now you should be able to log in using ssh, but the uConsole will not require a password. Repeat these steps from each machine you want to remotely access the uConsole from. Once you have done that, you will now want to disable password authentication so that only connections from systems that the uConsole has a key for will be allowed to log in. Run the following command;

sudo nano /etc/ssh/sshd_config

Search for the line "#PasswordAuthentication yes", delete the # and change yes to no. Save the file and then reboot the system.

8. Install Flatpak

Raspberry Pi OS has the same issue as Debian, the packages tend to fall behind long before a new release is made.  If you have programs that you want to stay up to date on, Flatpak is the way to do it. If you have not installed Flatpak, please do so now with "sudo apt install flatpak". Then to enable the repo run the following command;

flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
Now you can install programs from the Flatpak repo, which will be more up to date without breaking your install. For instance, if you want to install Discord, run the following;
flatpak install --user --assumeyes flathub com.discordapp.Discord
You can go to https://flathub.org/ to see what programs are available.

9. Get a screen protector

LCD screens are prone to  getting scratched, so this is a necessary step to preserve you investment in this device. Fortunately the uConsole screen is pretty close to the Blackmagic Pocket Cinema 6K Camera in screen size, so almost any screen protector for it will work for a uConsole.

https://www.amazon.com/dp/B07WCQD1NZ?ref=ppx_yo2ov_dt_b_product_details&th=1 

10. Get a carrying case

A nice hard shell is also a good idea. The one I am using is Hermitshell Hard Travel Case. It is designed for VR headsets, but works great for the uConsole and accessories.

https://www.amazon.com/gp/product/B01DVMTJQE/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1

Bonus. Build Emacs from source

This is not particularly necessary, you could just install it with "apt install emacs" or "flatpak install flathub org.gnu.emacs", but what fun is that. Besides showing your Hacker Street Cred, this is also a good way to stretch the legs of your new uConsole and make sure that the overclock settings are not causing any problems. For this exercise you will need to enable the source repo's in /etc/apt/sources.list and run "sudo apt update".

sudo apt install build-essential libgtk-3-dev libwebkit2gtk-4.0-dev
sudo apt build-dep emacs

flatpak install flathub org.gnu.emacsflatpak install flathub org.gnu.emacs

git clone https://github.com/emacs-mirror/emacs.git
cd emacs
./autogen.sh
mkdir build
cd build
../configure --with-cairo --with-xwidgets --with-x-toolkit=gtk3
make -j4
sudo make install

Doing it this way means you cannot update Emacs using apt or flatpak and you will need to do it manually. I would make shell script out of this and run it once a month or whatever.

cd emacs
git pull
cd build
make -j4
sudo make install

Alternatively, if you prefer Neovim, here is how to build it from source.

sudo apt-get install ninja-build gettext libtool libtool-bin autoconf automake cmake g++ pkg-config unzip curl doxygen
sudo apt build-dep neovim

git clone https://github.com/neovim/neovim.git
cd neovim
make -j4 CMAKE_BUILD_TYPE=RelWithDebInfo
sudo make install

Tuesday, July 16, 2024

M5Stack Cardputer

 

On the other side of the cool hardware spectrum from the uConsole, is the M5Stack Cardputer. This is a neat little gadget, with some medicore bits of software. The Cardputer runs about $30, but if you buy it from the manufacturer it will be on a slow boat from China, literally. It is better to grab one off of ebay. I got mine for $45 shipped and had it in 3 days.

In 1985 if you had asked me what a computer would look like in 2025, this is probably what I would have described. Basically what we had back then, maybe slightly more powerful, but definitely smaller. This has a lot in common with the Commodore 64, limited RAM, can only run one program at a time, the main difference being you copy firmware onto the internal storage rather than swap cartridges and it requires a reboot to switch programs.

I do see some potential for this little device, but I struggle to find anything super useful to do with it. It does run Doom pretty well, but beyond that most of the programs pranks and low grade hacking tools. Even the Mp3 players available are not particularly good, mostly because of the under powered hardware. The best program I have found so far is the Pipboy Demo, which does actually have one or two useful features, like a web radio and note pad.

It does have four exposed GPIO pins, one for 3.3v power, one for ground and two for communication, again pretty limited when compared to something like the Rasperry Pi Pico or just about any Arduino.

In theory, this is a neat idea, but in practice, not terribly useful. I think someone needs to port Basic to it and make it easy to swap out programs without rebooting the bloody thing. Until it finds its niche, I suggest skipping this one.

ClockworkPi uConsole, My new favorite toy

 

This is something I ordered months ago and finally received. Clockwork Pi is terrible at getting product out the door, it is so bad, I had basically forgotten that I ordered it. The uConsole hand held costs $189.00 with the Raspberry Pi CM4 board, if you can source your own, they cost $119.00, which is what I suggest you do, simply because you can then get the CM4 with 8 GB of RAM, rather than the 4 GB they send. If you do not want to wait months and months to get one, they regularly become available on ebay, but you will pay a premium for them. You should also be prepared to assemble this yourself, which for me was half the fun.

Things I didn't like:

The screen is a bit small for my eyes, but considering its size, it is a trade off I am willing to make. I am not much of a thumb typist, so the keyboard took some getting use to. The assembly can be a bit tricky and the instructions are a bit vague. The big mistake I made was putting the CM4 in upside down, it would not boot, but I quickly figured the issue out when I saw an actual picture of what it was supposed to look like, so I had to tear it apart again. The default image of the Raspberry Pi OS provided by the company is based on an old version of Debian. Fortunately there is a community image based on the current version of Debian that seems to work really well. Finally, you will find your wifi signal to be weak, it is just a design flaw with positioning of the antenna. It was not a serious problem for me, but if you find it is, there are a couple of hacks out there for fixing the problem.

Things I liked:

This is just fucking cool. On the box it calls the uConsole a "Fantasy Console" and I agree with them. When I very first read Neuromancer back in the late 80's, this was what I envisioned a cyberdeck to looked like, the only thing it is missing is a headset. I like the tiny track ball, it is nicely calibrated for the screen and has a nice feel to it. While the keyboard does take some getting use to, the buttons are very tactile and feel solid. The screen, while a bit small, is very clear with a solid refresh rate. The CM4 with 8 GB of RAM make this a peppy little system, even though the OS does run off an SD card. If your are familiar with the Raspberry Pi 4, runs about the same.

Overall:

I think with some practice this could easily replace my laptop for traveling. Usually when I am out and about, I am not doing anything heavy duty. I don't think I could do any heavy lifting on this system, but for web browsing, email, light document creation and quick programing projects, this would exceed my expectations. Honestly, this thing is a work of art. It is beautiful to behold and a heck of a lot of fun to put together.

Tuesday, June 18, 2024

Radxa X2L Single Board Computer Part 2

I have been experimenting with the Radxa X2L One of the conclusions I have come to is the Picomite Basic firmware is easier to work with on an RP2040 than MircoPython or Circuit Python. I am aware that the Basic programing language is not exactly in vogue these days and Python is superior in almost every way, but really no programing language beats Basic for rapid prototyping. On top of that, I really do like this Basic implementation, it keeps a lot of what made the old 1980's Basic fun, while adding modern features.

  https://geoffg.net/picomite.html

 To keep everything in line, I also opted to use FreeBasic on the Intel side of this system. FreeBasic is a pretty good implementation of the Basic language and even has some switches to make it compatible with old Basic code.

 https://www.freebasic.net/

This project is going to show you how to use FreeBasic to retrieve the IP address of your system in Linux, then transmit your IP address to the RP2040, which will then use Picomite MMBasic to display the data on a SSD1309 OLED. This is useful for systems in a DHCP environment IP addresses change frequently. You could also use this method to display CPU temperatures or even a joke of the day.

 The first thing you will need to do is flash the firmware into the RP2040, this is covered in the Picomite documentation and a dozen or so Youtube video, so I will not go over it. The second thing you will need to do is wire your OLED to the RP2040 GPIO pins. Again, there are plenty of tutorials about how to do this.

Next you will need to connect to the RP2040 through the serial port. I use Minicom in Linux

minicom -D /dev/ttyACM0

Finally before we can start programming, we need to configure the Picomite software to use I2C and the SSD1306 OLED. You do this by typing the following two lines into your terminal program, you will only have to do this once.

OPTION SYSTEM I2C GP2, GP19

OPTION LCDPANEL SSD1306I2C, LANDSCAPE

The GP2 and GP19 switches tell the software what wires you are using for communication, if you are using different GPIO pins, you will need to adjust your command appropriately. The first one is the SDA pin, the second is the SCL pin.

 Now, in your terminal, type edit and press enter. This will open the built in text editor. Go a head and type this program in.

'RP2040.BAS

CLS
Box 0, 0, 128, 64, 2, RGB(WHITE), RGB(BLACK)
Text 10, 10, "Connected", "L", 1, 1, RGB(WHITE), RGB(BLACK)

Input "IP Address: ", ipaddr$
Text 10, 20, ipaddr$, "L", 1, 1, RGB(WHITE), RGB(BLACK)

 The first line is simply a comment stating the name of the program. I do this because when you save a program to the flash memory, it automatically names it whatever is in the first line. Doing this makes it easy to identify which is which.

The next five lines;

  1. Clear the OLED screen
  2. Draws a framing box around the edge of the display
  3. Writes "Connected" to the screen
  4. It then waits for input
  5. Once it receives input, it writes that input to the OLED.

Once you have typed in the program, or done a copy/paste, press the F1 key to save it. Next type "FLASH SAVE 1", This will save the program to the build in storage, so it can be retrieved later. Lastly, you will want to type "run", you should see is waiting for input, leave it be.

Now open a new terminal, if you have not installed FreeBasic, you should do so now. Type "nano intel.bas" and enter this program.

dim as string ipaddr
open pipe "for input as #1ip -4 addr show | grep wl* | grep -oP '(?<=inet\s)\d+(\.\d+){3}'"
        line input #1, ipaddr
close #1

open "/dev/ttyACM0" for output as #1
print #1, ipaddr
close #1

Each line of this program

  1. Defines the variable ipaddr as a string
  2. Runs a shell command to retrieve the IP address of the system
  3. Sets the ipaddr variable to the IP address of the system
  4. Closes the pipe used for running the shell command
  5. Opens the serial port so it can be written to
  6. Transmits the ipaddr variable to the RP2040
  7. Closes the serial port

Once the program has been written, press Ctrl-x, press Y and then enter. This will save the program. To compile the program, type "fbc intel.bas", you should now have an intel executable, simply type "./intel" and press enter. If all went well, you should see the IP address appear in the minicom terminal and on the OLED.

If you want this to run each time the system boots up, type "OPTION AUTORUN 1" into the minicom terminal. This will tell the RP 2040 to run the program in slot 1 on boot up. Then copy the intel executable to /usr/local/bin and add it to you startup programs.

That is pretty much it. You will still have two slots on the RP2040 to save other programs. This is a pretty good start to making the RP2040 useful to you when using the Radxa X2L. I kind of feel like all computers should have an RP2040 built in.

 

Mastodon