Joseph Zikusooka ~ Zik

A software engineer specializing in open source technologies | Very experienced in building and configuring UNIX/Linux systems and servers. Passionate about developing software applications and hardware for the smart home | Currently serving as the CEO of Jambula Labs and the project leader at JambulaTV, a smart home automation and entertainment platform - https://jambulatv.com | This blog focuses on the following areas: Linux How-Tos and Tutorials ::: IT Security News ::: Free and Libre Open Source Software ::: Smart Home Software ::: Digital Innovations in East Africa https://mastodon.social/@jzik | https://github.com/zikusooka

Linux

Linux related articles

Jambula OS Linux now offers support for Home Assistant

🚀✨ Exciting news for smart home enthusiasts! I have added support for Home Assistant Core installs & upgrades to Jambula OS (starting with version 2024.10.0) 🎉

⚙️ Jambula OS is a custom Linux operating system 🐧 designed specifically for SoC devices like the Raspberry Pi 5

⬇️ You can download it here: https://github.com/zikusooka/Jambula-OS/

🏡 Upgrade today and kickstart your journey to creating a private, offline smart home 💡hub!

Linux, Python, Security, and Open Source Software TIPS

  • 💡 Use the 'lsof' command to quickly identify the ports that a specific service is listening on within a Linux system @opensuse @fedora @climagic Example:SERVICE=sshd; lsof -i -P -n | grep $SERVICE | awk '/LISTEN/ {print $9}' | uniq#ZikTIPs #SysAdmins #Opensource
  • 🚀 If you're using Buildroot, check out my GitHub repo for patches! I've added support for new packages starting with Kea DHCP. 🔧💻 #Buildroot #KeaDHCP #DIY #embedded #Opensourcehttps://github.com/zikusooka/buildroot-patches
  • 💡 Use the following command to quickly check how much space you have left on your Linux filesystem@opensuse @fedora @debian #ZikTIPs #CLI #Opensource #linuxdf -h –output=avail /
  • 💡 If you have SELinux enabled on your Linux system, you can view the context of an object as follows @opensuse @fedora #ZikTIPS #Sysadmin #SELinux #CLI #OpenSUSE #LinuxFor a file:ls -Z [FILE] e.g.ls -Z /etc/selinux/configFor a process:ps -eZ | grep [PROCESS_NAME] e.g.ps -eZ | grep apache2
  • 💡Get the inode number of a file using this simple command line on Linux @opensuse @fedora @archlinux ls -i [FILENAME] e.g.ls -i /etc/fstab#ZikTIPs #CLI #Fedora #OpenSUSE #Debian #opensource
  • 💡 Display a list of all users on a Linux system using the following command @opensuse @fedora @ubuntu #ZikTIPs #CLI #Fedora #OpenSUSE #Ubuntu #opensourcegetent passwd | cut -d ":" -f1
  • 💡 Quickly inspect the contents of a systemd unit file in Linux using the following command #ZikTIPS #CLI #Fedora #Ubuntu #Opensource@opensuse @fedora @debian systemctl cat [UNIT] e.g.systemctl cat sshd.service
  • 💡Display the active WiFi connection using the following command in Linux #ZikTIPs #CLI #WiFi #Opensource@NetworkManager @opensuse @fedora @debian nmcli connection show –activeNOTE: Works on distributions that use #networkmanager
  • 💡️On a Linux system, you can retrieve logging information for a specific service within a designated date range #ZikTIPS #CLI #Systemd #Opensource @fedora @opensuse journalctl -u [UNIT] -S [DATE-START] -U [DATE-END] e.g. journalctl -u sshd -S 2024-10-04 -U 2024-10-12
  • Python 3.13 has been released! It includes a better interactive interpreter, improved error messages, mobile platform support & an experimental JIT compiler #programming #opensource https://docs.python.org/3.13/whatsnew/3.13.html
  • 🚀✨ Exciting news for smart home enthusiasts! Jambula OS (version 2024.10.0) now supports Home Assistant Core installs & upgrades! 🎉 @jambula @home_assistant @raspberrypi ⚙️ Jambula OS is a custom Linux operating system 🐧 designed specifically for SoC devices like the Raspberry Pi 5⬇️ You can download it here: https://github.com/zikusooka/Jambula-OS/ #JambulaOS #RaspberryPi #HomeAssistant #SmartHome #Embedded #DIY #Opensource
  • 💡And like others have mentioned: To quickly see if you are affected by this bug, use the following Linux command @fedora @opensuse @ubuntu systemctl status cups-browsedIf systemd unit is active, stop and disable as follows:sudo systemctl disable –now cups-browsed#ZikTIPs #opensource
  • Attention Systems Administrators: A vulnerability (CVE-2024-47176 …) has been identified in the CUPS package used in various Linux systems. Please refer to the following link for the necessary remediation steps: https://www.evilsocket.net/2024/09/26/Attacking-UNIX-systems-via-CUPS-Part-I/ Also @redhat has a response on this and how to check if you are affected: https://www.redhat.com/en/blog/red-hat-response-openprinting-cups-vulnerabilities#evilsocket #vulnerability #Cups #Printing #Sysadmin #cybersecurity #Opensource
  • 💡 Search for webcams on a Linux system using the following command line @fedora @opensuse #ZikTIPS #CLI #Multimedia #Video #Audio #Opensourcev4l2-ctl –list-devices
  • Excited to share the latest update for Jambula OS, a custom tailored Linux operating system designed for SoC devices like the Raspberry Pi 5!@jambulatv @jambulaOS @michaelgraafhttps://github.com/zikusooka/Jambula-OS🚀 This update of Jambula OS (Version 2024.8) simplifies setup for:- 🌐 A wireless (WiFi) access point i.e. Internet Hotspot- 🔊 A multi-room music/audio server & client- 📺 A Free-To-Air DVB-T2 TV server- 📹 A USB webcam video streaming server#JambulaOS #Raspberrypi #DIY #Opensource
  • 💡️ Display the actual target path of a symbolic link in Linux#ZikTIPs #CLI #Opensourcereadlink -f [LINK]
  • A cheaper version of the Raspberry Pi 5 board is here! @jambulaOS #raspberrypi5 #DIY #embedded #Linuxhttps://www.raspberrypi.com/news/2gb-raspberry-pi-5-on-sale-now-at-50/
  • 💡️Quickly change the bluetooth name advertised by your Linux device such as a raspberrypi @debian @opensuse @fedora bluetoothctl system-alias "NEW-NAME"#ZikTIPs #Bluetooth #Raspberrypi #Opensource
  • 💡Remove or replace multiple occurrences of text with a similar pattern using the command line in Linuxsed /PATTERN*//g [FILE_PATH]Example:sed /systemd-network*//g /opt/my script.sh#ZikTIPs #SysAdmin #CLI #Opensource #opensourcesoftware
  • INTRO: #Introduction #Fediverse #FediHire#Linux #MastodonI am Zik, the guy behind those Linux TIPs. I am passionate about open source software on Linux. I spend a great deal of time on the command line writing shell and python scripts. I am also a buildroot aficionado & maintain Jambula OS Linux.My core strength: Linux/UNIX server management. I am currently available for part time remote work if you need that type of support. Checkout my GitHub repositories at:https://github.com/zikusooka

How to install the latest Python 3 version on Linux using sources

Introduction

Python 3.11.0 was officially released on October 24 2022. However, most Linux distributions have not yet upgraded to the latest Python version i.e. Python 3.11.2 (released on February 8 2023). Please visit this page to see the most recent versions.

The jump from versions 3.10.X to 3.11.X brought with it significant changes and improvements to Python code. Among the improvements is that Python is now 10 – 60% faster than before. That’s a big and noticeable speed boost. So beyond the usual reasons for upgrades i.e. security etc, I really wanted this version on my Linux desktop as soon as the final release was made publicly available.

If you are like me and don’t like waiting for your favourite open-source program to be supported on your Linux distribution, here is how to install the latest Python 3 version on Linux using sources.

Before you begin, check the current version on your Linux system:

python  --version

Currently the version of Python on my Linux system is three (3) releases behind. So it is time for me to upgrade to the most recent version.

CAUTION: Due to the many dependencies on the currently installed Python common package, I highly recommend that you do not remove the existing version. Instead, we will install the latest version in an alternate location e.g. /usr/local

Prerequisites

Please ensure that your Linux system has the following packages installed:

On Ubuntu or Debian:

sudo apt-get install build-essential

sudo apt-get install autoconf automake gdb libffi-dev zlib1g-dev libssl-dev libncurses5-dev libgdbm-dev libnss3-dev libreadline-dev libsqlite3-dev

On Fedora or Rocky Linux:

sudo dnf groupinstall “Development Tools”

sudo dnf install openssl-devel libffi-devel bzip2-devel sqlite-devel

* You will also need wget which is generally included by default on most Linux distributions

Visit the Python downloads page for sources to get the direct link to latest Python source package. In this tutorial I will be using the XZ compressed source tarball i.e. Python-3.11.2.tar.xz

Download the latest Python package to a temporary directory:

wget  -c  -P /tmp  https://www.python.org/ftp/python/3.11.2/Python-3.11.2.tar.xz

Unpack the Python 3 tarball:

tar xvf /tmp/Python-3.11.2.tar.xz -C /usr/src

Compile and build Python:

cd  /usr/src/Python-3.11.2

./configure  --prefix=/usr/local  --enable-shared  --enable-optimizations  --with-system-expat  --with-system-ffi

IMPORTANT: Ensure the prefix i.e. ‘/usr/local’ you use is different from that used by your Linux distribution otherwise you will overwrite the default Python 3 installation!

Optional: You can make some of your modules a permanent part of the Python interpreter. To do so, simply modify the file: Modules/Setup.local before running make. To see my my local setup, see the appendix.

sudo  make

TIP: you can add “– j $(getconf _NPROCESSORS_ONLN)” to the make command in order to speed things up i.e. sudo make -j $(getconf _NPROCESSORS_ONLN)

sudo  make  altinstall

Add the following export command to your shell initialization file:

Using Bash shell:

echo  “export  LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib”  >>  ~/.bashrc

Then source the file for now:

source  ~/.bashrc

To verify if you now have the latest Python 3 (including pip installer) versions:

/usr/local/bin/python3.11 –version

/usr/local/bin/pip3.11 –version

Congratulations! You now have the latest Python 3 version on your Linux system.

NOTE: When your distribution eventually catches up, you can remove this installation by issuing the ‘make uninstall‘ command in the installation directory i.e. /usr/src/Python3.11

Appendix

Here’s my sample ./Modules/Setup.local file:

array -DPy_BUILD_CORE_MODULE arraymodule.c
_contextvars _contextvarsmodule.c
_struct -DPy_BUILD_CORE_MODULE _struct.c
_random _randommodule.c -DPy_BUILD_CORE_MODULE
_elementtree -I$(srcdir)/Modules/expat -DHAVE_EXPAT_CONFIG_H -DUSE_PYEXPAT_CAPI _elementtree.c
_pickle -DPy_BUILD_CORE_MODULE _pickle.c
_datetime _datetimemodule.c
_zoneinfo _zoneinfo.c -DPy_BUILD_CORE_MODULE
_bisect _bisectmodule.c
_asyncio _asynciomodule.c
_json -I$(srcdir)/Include/internal -DPy_BUILD_CORE_BUILTIN _json.c
unicodedata unicodedata.c -DPy_BUILD_CORE_BUILTIN
fcntl fcntlmodule.c
spwd spwdmodule.c
grp grpmodule.c
select selectmodule.c
mmap mmapmodule.c
_csv _csv.c
_socket socketmodule.c
termios termios.c
resource resource.c
_posixsubprocess  -DPy_BUILD_CORE_BUILTIN _posixsubprocess.c
audioop audioop.c
_md5 md5module.c
_sha1 sha1module.c
_sha256 sha256module.c -DPy_BUILD_CORE_BUILTIN
_sha512 sha512module.c -DPy_BUILD_CORE_BUILTIN
_sha3 _sha3/sha3module.c
_blake2 _blake2/blake2module.c _blake2/blake2b_impl.c _blake2/blake2s_impl.c
syslog syslogmodule.c
binascii binascii.c
zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz
pyexpat expat/xmlparse.c expat/xmlrole.c expat/xmltok.c pyexpat.c -I$(srcdir)/Modules/expat -DHAVE_EXPAT_CONFIG_H -DXML_POOR_ENTROPY -DUSE_PYEXPAT_CAPI
_multibytecodec cjkcodecs/multibytecodec.c

How to use Linux GNOME terminal like a Pro

For most users work is typically done in a web browser like Firefox or Chrome. (BTW, if you are not using Mozilla’s Firefox, I can not emphasize enough why you should switch to this opensource browser)
For advanced users i.e. IT admins, software developers, most of their time may be spent in a terminal and on Linux most often gnome terminal

Like regular users who prefer to open multiple tabs in a browser, using tabs in a terminal is necessary for an advanced user if they are to be productive. However, it can get pretty tedious and boring having to open up multiple terminal tabs in every time you start your Linux desktop

Using the command line tool gnome-terminal this process can be automated. This tool allows you to open multiple gnome-terminal tabs like a pro i.e. At desktop startup, open several & different tabs each with its own specified directory path or run command. You can even log into a remote system, if you have setup to allow passwordless SSH connections.

Below is a basic example of gnome-terminal command in action

gnome-terminal --maximize --geometry=80x24+200+200 --display=:0 --tab-with-profile=DAY -t Local --working-directory=/projects --tab-with-profile=NIGHT -t Remote -e "ssh -t jambula@REMOTE \"cd /opt; bash\""

I use this in a script which is activated by a custom keyboard shortcut to start my day

Why installing open source packages using sources is cool and how to start today

Until you start installing packages on Linux/UNIX systems using sources, you will always be very dependent on your distribution or vendors to stay up to date.

Installing from sources may not be for everyone, but I recommend it for novice and advanced Linux/UNIX users alike, as it offers tremendous benefits:

  1. Ability to fine tune the package according to your needs
  2. You almost always end up with a much faster application
  3. You get the latest security updates immediately
  4. You learn a whole lot

So how do you install from sources?

  • Download the package from URL upstream

The package may be in several forms: PACKAGE.tar.gz, PACKAGE.tar.bz2, PACKAGE.xz, or clone from a github repository i.e. git clone [URL]

  • Unpack the package inside your sources directory e.g. /usr/src:
    tar zxvf PACKAGE.tar.gz -C /usr/src
    tar jxvf PACKAGE.tar.bz2 -C /usr/src
    tar xvf PACKAGE.tar.xz -C /usr/src

  • IMPORTANT: Read the following two files if available: README (or README.md) and INSTALL. I can not stress how important it is to read the above files. The package
    maintainer will usually include notes on how to compile and install the package

  • Change to source directory of the package
    cd /usr/src/PACKAGE-VERSION/

  • Compile
    ./configure

  • Install
    make && make install

Thats it! If all went well especially during the make, you should be able to run your package. Sometimes, the configure command will specify that
a dependency is missing. You will need to install it before you proceed. This is why it is important that you read the README and INSTALL files.

How to add a printer in Linux using the command line (CLI)

Managing printers in Linux has become easier lately. With just a few clicks in your GNOME, KDE, UNITY, or other desktop, you could be printing away in just seconds. But what about the command line Interface? Here too, a simple command is all you need, and in a few steps your printer should be setup

Before you start, ensure that the CUPS package is installed on your Linux system and if not, install it using your package manager e.g. For Redhat based systems:

dnf install cups

Alternatively, you may download CUPS and PPD files direct from the CUPS website at: https//www.cups.org/

1. Find the Postscript Printer Description (PPD) file for your printer. Typically installed with the cups package and stored under: /usr/share/cups/model/. Also look under /usr/share/ppd/cupsfilters

2. Run the command lpinfo -l to get a list of available printers and drivers i.e. device-uri

3. Add your printer using the following command:

lpadmin -p “HP-LaserJet-CM3530-1” -D “Human Resources Department” -P /usr/share/ppd/cupsfilters/HP-Color_LaserJet_CM3530_MFP-PDF.ppd -E -v file:///dev/PRINTER_PATH

-v represents the device-uri as seen in step 3. For a detailed explanation of the options, type: man lpadmin

How to Migrate to Digital TV in Uganda – A consumer’s Experience

Are you still puzzled by Digital TV Migration? Are you wondering how to start watching Free-to-Air DTV broadcasts in your area? Help is here inform of a consumer’s experience. Julian Mwine has put together a seven minute video, explaining the process involved in migrating to Digital TV in Uganda. Keep in mind, despite the deadline being 4 months away, we are still in early stages.

How to stream FM Radio using the Command Line in Linux

With all the advancements in IT, one piece of technology has persisted and seems not ready to die yet: FM radio. Unlike its companion AM, FM radio continues to be the primary source of information and entertainment. For example, in the United States, FM radio is still alive, and is used by many as a discovery medium. Most people especially teenagers will tell you that they first heard a song on terrestrial FM radio, before they went on to streaming sites such as YouTube, Spotify etc. In Uganda, like elsewhere in Africa, expect traditional FM radio to continue being king of information. Our limited Internet infrastructure is still very limited to a small section of the population, speeds are still horrible, so on-line radio is still not an option for many.

As I work on my upcoming digital product, I debated a lot about whether to include FM radio as a feature on this device. With all the above said, there was no doubt, FM radio would quickly become one of the most requested for features. So I got down to playing, recording, and streaming Live FM radio using the Linux command line. The cool bit is that you can stream a live FM radio show to all your devices in the house or office. No need for you to buy a radio.

What you need:

a) Analog Video for Linux (V4L2) FM radio tuner. You can either use a USB stick or PCI-E based card.

b) Linux distribution – Am using Fedora 20. But any Linux distro will work, although you will need to adjust the install commands where necessary.

Available Linux CLI tools:

There are a whole lot of GUI based applications that you can use to play radio in Linux, For example Gnomeradio, Kradio, gradio etc. However, using the command line gives you much more flexibility, as the following commands illustrate. You can control an FM radio tuner using CLI tools like MPlayer (which is installed on most Linux distros), ivtv-radio, and fmtools. In this ‘how to,’ I use the latter, fmtools, which comes with a set of tools (fm and fmscan) for controlling V4l2 based tuners.

Installation:

1. Install fmtools

yum install fmtools (On Red-Hat based Distros such as Fedora, CentOS)

2. Install SoX

yum install sox (On Red-Hat based Distros such as Fedora, CentOS)

3. Install VLC

yum install vlc (On Red-Hat based Distros such as Fedora, CentOS)

FM Radio Commands

The basic arguments for the fm command line tool are:

fm -d [device] -T [time] [freq] [on|off] [percentage]

-d The radio device created by your USB or PCI based tuner
-T The duration of play
-q quiet | No verbose
[Freq] The radio channel
[on|off] Turn on or mute radio
[Volume] The desired volume

Tune and play FM 91.3

fm -q -d /dev/radio0 -T forever 91.3 100%

Mute:

fm -q -d /dev/radio0 off

Unmute:

fm -q -d /dev/radio0 on

Recording FM Radio

To record FM radio, use parec a utility that is packaged with pulseaudio, the default sound subsystem on most Linux distros.

1. First tune to the desired radio station as shown above.

2. Capture the audio:

parec -d alsa_output.pci-0000_01_01.0.analog-stereo.monitor | sox -t raw -r 43000 -e signed -L -b 16 -c 2 - /var/tmp/fmradio.wav

NOTE: You will need to change the variable -d i.e. output pulse device for your system. To find yours, just run the command:

pactl list | grep -A2 '^Source #' | grep 'Name: .*\.monitor$' | awk '{print $NF}' | tail -1

The recording will be stored at /var/tmp/fmradio.wav. You can change that to another location if you wish.

Stream FM Radio to other PCs or devices (such as smart phones)

Start the capture process as shown above, and proceed immediately to the stream command below:

vlc -I dummy -I http --daemon --no-video --no-sout-display-video --verbose 2 /var/tmp/fmradio.wav --sout #duplicate{dst=standard{access=http,mux=asf{title='JambulaRadio',author=FM-91.3-Radio-Kampala(Uganda),copyright=2015-2016-Joseph-Zikusooka-All-rights-reserved,comment=Broadcasting-Live-from-Kampala-Uganda,rating=PG14},dst=192.168.0.10:8090},dst=standard{access=http,mux=asf{title='FM-Radio',author=FM-91.3-Radio-Kampala(Uganda),copyright=2015-2016-Joseph-Zikusooka-All-rights-reserved,comment=Broadcasting-Live-from-Kampala-Uganda,rating=PG14},dst=172.16.0.1:8080}"}

NOTE: Here, I’m streaming on both wired and wireless LAN, and my machine IP addresses are 192.168.0.10, and 172.16.0.1 respectively. The http stream port is 8080. Change these to suit your environment.

If you are using a wired connection, use VLC on your client PC or mobile phone to access the stream as follows:

vlc http://192.168.0.10:8080

If on Wireless, use vlc on your client PC or mobile phone to access the stream as follows:

vlc http://172.16.0.1:8080

Enjoy!

Scroll to top