Joseph Zikusooka (ZIK)

Linux Systems Engineer specializing in open source software 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 technologist at 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

Tips

Tips – Primarily Linux tips and solutions

Easily convert from VirtualBox to KVM in Linux

KVM
I have been converting some of my old VirtualBox images to KVM, which is the virtualization standard in Linux.

Its really easy, although, if you run into booting issues of the converted image, the last tip here will save you some time.

To convert from VirtualBox to KVM, look for your VDI images.

qemu-img convert -f vdi -O qcow2 [VBOX-IMAGE.vdi] [KVM-IMAGE.qcow2]

e.g. qemu-img convert -f vdi -O qcow2 FreeBSD-7.2.vdi FreeBSD-7.2.qcow2

You can now import the converted image using virt-manager or the CLI tool virt-install.

In Virtual Machine Manager, go to Disk 1 >> Advanced options and change ‘Storage format’ to qcow2.

This prevents boot errors like ‘boot failed: not a bootable disk’ when you launch the VM.

How to create an encrypted USB drive in Linux using the command line

Recently, I was tasked to write a backup program for a small office. A key requirement was that the portable backup drive they are using needed to be encrypted since it would have to be ferried off site on a daily basis. The idea was that, if the drive fell in the ‘wrong hands’ during transportation, the client’s data would be secure. With encryption, I was able to meet this need.
I thought I would break the silence with a how-to on encryption using the Linux command line interface – not exciting but quite necessary these days.

Encrypting data in Linux is very simple, and I would highly recommend it for such things as USB flash and portable hard disks. Most Linux distributions come with an encryption tool called cryptsetup.
If you do not have it , install it using yum or apt-get depending on your package manager. For Red hat based distros, use

# yum install cryptsetup

As always, you need to backup your data before you proceed. I will assume you have already created a new partition on your device e.g. /dev/sdX1. If you need to partition, refer to the venerable ‘fdisk’ utility

Create the encrypted volume

# cryptsetup -v -y luksFormat /dev/sdX1
Confirm that you want to proceed by typing “YES”
Enter your passphrase when prompted. You will be asked to verify it
Once you have created the encrypted volume, you can proceed to format it

# cryptsetup luksOpen /dev/sdX1 mydata
# mkfs.ext3 /dev/mapper/mydata

Here you can choose other file formats such as FAT32, EXT4 etc

Create a mount point

# mkdir /mnt/mydata

Mount the new volume

# mount /dev/mapper/mydata /mnt/mydata
You can then write your data to the mounted and encrypted volume at /mnt/mydata

To close the volume

# umount /dev/mapper/mydata
# cryptsetup luksClose mydata

Note: if you are using a desktop such as GNOME, you will be prompted for a passphrase every time you insert the disk, so you do not have to mount the disk manually, but then again, we are talking about the command line here!

That’s it for now

Mobile SMS gateway server using Linux

Like many parts of Africa, SMS messages in Uganda continue to play a big role in the way people communicate. For the majority, the mobile phone is the first tech device and as such the use of SMS messages to send information in bulk and real time makes it ideal in fields such as health. As a Linux administrator, this is something you can do at little or no cost.

I thought, I would share these GSM SMS/WAP gateways available for Linux

1.Kannel: By far the most widely used open source software. It can be used to serve the established user base with SMS capable handsets as well as the early adopters with their WAP terminals. Learn more at:
Kannel
2.SMS Server Tools: SmsTools
3.PointSMS: an easy-to-use program that enables you build your own SMS gateway. Learn more at PontSMS

Setting up an SMS gateway using Linux is fairly easy, and if you use kannel for example, you will be able to send and receive bulk SMS messages in no time. I have tested Kannel with our local mobile operators like Uganda Telecom, and it works pretty well using your typical 3G modem dongles, like Huawei E220, and E173s.

If you are interested in instructions on how to install and configure the server… drop me a comment.

PulseAudio – How to control the volume of individual applications via CLI

Using the Gnome interface, its pretty easy to adjust the volume of running audio based applications i.e. Go to sound Preferences >> Applications Tab. When using the Command Line interface (CLI) on the other hand, Its not that straight forward.

At the command prompt, run the following command:
pactl list | grep -A16 ‘Sink Input’ | more

The above command will give you details of your running streams or in ‘pulseaudio speak’ Sink Inputs (go figure). Take note of the Index number of the Sink Input you wish to control.

To control the volume of your application:
To mute: pactl set-sink-input-mute [sink Index no.] 1
To unmute: pactl set-sink-input-mute [sink Index no.] 0
To set Volume: pactl set-sink-input-volume [sink Index no.] 65535 (0-65535)

Hauppauge WinTV MiniStick on Linux – Digital TV in Uganda

As Uganda prepares to migrate to digital TV broadcasts in 2012, I have been testing some of the pilot broadcasts out there. I’m using Linux i.e. Fedora 12 – Kernel version: 2.6.32.21-168.fc12.i686 and an off-the shelf USB Hauppauge WinTV MiniStick.

– The first major task is to get the DVB-T USB stick to be recognized.
– Open the terminal: run the command ‘tail -f /var/log/messages’

The first time you insert the USB Stick. It will not be recognized out of the box as shown in the following errors:

firmware: requesting sms1xxx-hcw-55xxx-dvbt-02.fw
firmware.sh[4212]: Cannot find firmware file ‘sms1xxx-hcw-55xxx-dvbt-02.fw

– Remove WinTV USB stick

– cd /lib/firmware/

– wget -c http://www.steventoth.net/linux/sms1xxx/sms1xxx-hcw-55xxx-dvbt-02.fw

– Plug in Stick again

– This time it is recognized and you’ll see the following in the log:

kernel: DVB: registering new adapter (Hauppauge WinTV MiniStick)
kernel: DVB: registering adapter 0 frontend 0 (Siano Mobile Digital MDTV Receiver)…

– OK, time to scan for some channels. I have whipped up a quick and dirty script that will allow you to scan for free view channels in your area.

– Download the script at: My DVB-T Scan Script
NOTE: For this script you need to first install w_scan utility i.e. In Fedora, yum -vy install w_scan

– Run the script i.e. sh vb_scan_ug.sh (You may need to first make it executable – chmod 755 vb_scan_ug.sh)

– After a successful run, the script will place your channels file to the appropriate location.

– Time to play. Open your favorite media application. I am using xine.
Run the command: xine dvb:// (You can also use the GUI – click on DVB)

Enjoy

Huawei E1752 USB Modem supported on Linux

Its been a while, but as always, am back with a linux tip especially for all users who are served by Orange telecommunication company. Here in Uganda, Orange recently started selling these USB 3G Modems from Huawei. These E1752 models are not automatically detected in stock linux distributions such Fedora, Ubuntu, etc.

The Fix is simple.

1.Make sure you install the packages for usb_modeswitch. In Fedora, at the command prompt type:
yum -vy install usb_modeswitch

2.Finally append the following text to: /etc/usb_modeswitch.conf
###################
## Huawei E1752 #
###################

DefaultVendor= 0x12d1
DefaultProduct= 0x1446

TargetVendor= 0x12d1
TargetProdct= 0x1001

MessageEndpoint= 0x01

MessageContent=
“55534243000000000000000000000011060000000000000000000000000000”

3.That’s it! Next time you plug that little thing in any usb port, it will detect it as a modem. Then you can proceed to setup your connection using your favorite tool. In Fedora, I use Network Manager

TIP: FM Radio sound using SAA713X based Tuner cards in Linux

During setup and configuration of the AExBox, a multimedia home entertainment and Automation box, I ran across an issue where no sound was emitted from an SAA7134 chipset based card in linux.

The solution is simple.

Use a either radio or fm (part of the fmtools package) to tune the card. For example, ‘fm -q -d /dev/radioX’ -T forever 94.8 65535′. Then using the command line, run ‘aplay /dev/dspX’ where X is the SAA7134 device no. of the tuner card. You can script this process for convenience.

Hope this helps you all home media center enthusiasts out there.

Scroll to top