[HOWTO] Install sbagen in Ubuntu 14.04 Trusty Tahr

SBaGen is a Binaural beat generator. For more info, visit the official SBaGen Website.

It is available for Linux, Windows and Mac. For Ubuntu, it is not available in any official repos or ppas so we need to compile it from source. Here is how you can do that.

Make sure you have multiverse repository enabled. You may have it already enabled. Open Software & Sources to check if “Software restricted by copyright or legal issues (multiverse)” is checked.

Then, install the required packages before compiling:

sudo apt-get update
sudo apt-get install libvorbisidec-dev libmad0-dev mlocate -y
sudo updatedb

Download sbagen source code and extract it:

mkdir ~/sbagen
cd ~/sbagen
wget http://uazu.net/sbagen/sbagen-1.4.5.tgz
tar xzvf sbagen-1.4.5.tgz


cd ~/sbagen/sbagen-1.4.5
LIBS=$(locate libmad.a | grep /libmad.a)
LIBS="$LIBS $(locate libvorbisidec.a | grep /libvorbisidec.a)"
cc -DMP3_DECODE -DT_LINUX -Wall -O3 -s sbagen.c $LIBS -o sbagen.bin -lm -lpthread

If you see no errors, the code must be compiled. You should be able to run it by typing the following:


If you see an output like the following, then it is installed successfully:

SBaGen - Sequenced Binaural Beat Generator, version 1.4.5
Copyright (c) 1999-2011 Jim Peters, http://uazu.net/, all rights 
  reserved, released under the GNU GPL v2.  See file COPYING.

Usage: sbagen [options] seq-file ...
       sbagen [options] -i tone-specs ...
       sbagen [options] -p pre-programmed-sequence-specs ...

For full usage help, type 'sbagen -h'.  For latest version see
http://uazu.net/sbagen/ or http://sbagen.sf.net/

If you try to run an sbg file however:

./sbagen.bin examples/basics/prog-chakras-1.sbg

you will most probably receive an error:

Can't open /dev/dsp, errno 2

To fix this, we will run it with OSS emulation using padsp:

padsp ./sbagen.bin examples/basics/prog-chakras-1.sbg

So, we will create a simple wrapper so that it is always run with padsp and install it such that it is available in path:

echo padsp sbagen.bin \"\$@\" > sbagen
chmod +x sbagen
sudo cp sbagen.bin /usr/local/bin/
sudo cp sbagen /usr/local/bin/

Now, you can simply run:

sbagen examples/basics/prog-chakras-1.sbg

Hope it works. Post a comment if you encounter any issues.

How to compile mt7801u for OSMC

Note: This may already be fixed with latest version of OSMC.
Note: My device was not detected in Raspberry Pi Model B (older model) because apparently, it can’t provide enough power to it. It does work with powered USB hub though.

I have a USB Network Hub (WiFi 360) from a Chinese manufacturer. It is detected as “Bus 001 Device 005: ID 148f:760b Ralink Technology, Corp.”. To get it working, I had to go through the following:

First, I sshed into the machine (you can do it with ssh command from *nix machines or Putty tool from Windows machine). The default credentials are osmc/osmc.

Then I installed usbutils to use lsusb.

sudo apt-get update
sudo apt-get upgrade
sudo apt-get -y install usbutils

Then I used lsusb to confirm that the USB WiFi Dongle is connected properly. I also ran ifconfig to check if it is already detected.

Then I installed git, gcc, make and build-essential:

sudo apt-get install git gcc make build-essential -y

Then I installed kernel headers:

set -- $(cat /proc/cmdline) && for x in "$@"; do case "$x" in osmcdev=*) sudo apt-get update && sudo apt-get install -y "${x#osmcdev=}-headers-$(uname -r)"; ;; esac; done

And then kernel source (which is ~100M so might take some time depending on your internet connection):

set -- $(cat /proc/cmdline) && for x in "$@"; do case "$x" in osmcdev=*) sudo apt-get update && sudo apt-get install -y "${x#osmcdev=}-source-$(uname -r)"; ;; esac; done

Then I fetched the source for driver:

git clone https://github.com/porjo/mt7601.git

Then I prepared kernel source for compilation:

cd /usr/src
set -- $(cat /proc/cmdline) && for x in "$@"; do case "$x" in osmcdev=*) sudo tar xjvf /usr/src/"${x#osmcdev=}-source-$(uname -r).tar.bz2"; ;; esac; done
set -- $(cat /proc/cmdline) && for x in "$@"; do case "$x" in osmcdev=*) cd /usr/src/"${x#osmcdev=}-source-$(uname -r)"; ;; esac; done
sudo make mrproper
set -- $(cat /proc/cmdline) && for x in "$@"; do case "$x" in osmcdev=*) sudo cp /boot/config-"$(uname -r)" .config; ;; esac; done
sudo cp .config .config.org
sudo make modules_prepare
set -- $(cat /proc/cmdline) && for x in "$@"; do case "$x" in osmcdev=*) sudo cp /usr/src/"${x#osmcdev=}-headers-$(uname -r)"/Module.symvers ./; ;; esac; done
set -- $(cat /proc/cmdline) && for x in "$@"; do case "$x" in osmcdev=*) sudo ln -s /usr/src/"${x#osmcdev=}-source-$(uname -r)"/ /lib/modules/"$(uname -r)"/build; ;; esac; done

Then I built the driver:

cd mt7601/src

It took some time (around 20 minutes on a Raspberry Pi 1 B+) and a lot of warnings were shown but apparently they were safe to ignore.

Finally, I installed it:

sudo mkdir -p /etc/Wireless/RT2870STA
sudo cp RT2870STA.dat /etc/Wireless/RT2870STA
sudo cp os/linux/mt7601Usta.ko /lib/modules/"$(uname -r)"/kernel/drivers/net/wireless/

Then I rebooted:

sudo reboot; exit

After reboot, I reconnected ssh and I could see the new interface ra1 when running ifconfig:


If you update your system and if it again stops detecting the device, you should follow the same instructions again.


Booting Ubuntu 12.04 from external disk connected to USB 3.0

I have a Ubuntu 12.04 install on an external HDD. On my Dell Laptop, I tried to boot into 12.04 by connecting the USB 3.0 compatible external HDD to USB 3.0 port but it wouldn’t show the grub (v2.00-7ubuntu11) boot screen. A rather silly workaround helped, however. I connected it first to a USB 2.0 port so that the grub screen loaded. Then, I disconnected the HDD and reconnected it to USB 3.0 port and voila. I don’t know if it’s the BIOS or grub (or both?) but this is what I’m going to do from now on. 🙂

[HOWTO] Install GPaste clipboard manager in Ubuntu 11.10 Oneiric Ocelot (Gnome-Shell)

I am a programmer and I can’t do without a clipboard manager. If you have never used a clipboard manager before, you don’t know what a great tool you are missing. GPaste is an excellent clipboard tool for Gnome-Shell, however it is neither available in Ubuntu repository, nor in any PPA (as of now). Here is how you can compile it. Open up the terminal and get going.

Install Dependencies

sudo apt-get install libgtk-3-dev libglib2.0-dev intltool automake autoconf valac git libdee-dev gnome-tweak-tool

Download Source

cd; git clone https://github.com/Keruspe/GPaste.git

Compile and Install

cd;cd GPaste
./configure --prefix=/usr
sudo make install

Restart Gnome-Shell
To restart, press Alt+F2, enter ‘r’ (without quotes) and press enter.

Enable GPaste Extension
To enable extension, open up Alt+F2>gnome-tweak-tool (or Activities>Applications>Other>Advanced Settings) and enable GPaste under Shell Extensions.

You should now see GPaste icon in the top panel. However, it may give the following error message:

(Couldn’t connect to GPaste daemon)

For this, add the GPaste daemon in startup as “gpaste –daemon” in StartUP applications and reboot.

[HOWTO] Enable Maximize, Minimize buttons on the title bar in Gnome 3 Gnome-Shell (Ubuntu 11.10 Oneiric Ocelot)

I have just installed Gnome 3 in Ubuntu 11.10 Onieric Ocelot. In Gnome-Shell interface, there are no title bar controls for minimize, maximize/restore. To enable them, open up the terminal and type in (or copy/paste) the following command:

gconftool-2 --set /desktop/gnome/shell/windows/button_layout --type string close,minimize,maximize:

Now, press Alt+F2, type in “r” without quotes and press enter. This will reload Gnome-Shell and the changes will come into effect.

Note: The above will set the buttons in left side as in Ubuntu default theme (or Mac OS X). To place them in the right (like Gnome 2 default, Windows), use the following command instead:

gconftool-2 --set /desktop/gnome/shell/windows/button_layout --type string :minimize,maximize,close

Hope this helps.

[HOWTO] Install Gnome-Shell (Gnome 3) in Ubuntu 11.10 Oneiric Ocelot

I have installed Ubuntu 11.10 Oneiric Ocelot on my laptop. I had been using Ubuntu 11.04 Natty Narwhal on it and since I use this PC for work, I was reluctant in installing Gnome-Shell from PPA. But since Gnome-Shell is available in official repositories, I decided to give it a go. To install, just open Ubuntu Software Center, search for Gnome-Shell and click “Install”. After installation is complete, log out and when logging back in, select Gnome (see screenshot below).

[SOLVED] “Warning: Could not find package list for PPA: ppa:some/ppa” while trying to use ppa-purge in Ubuntu

When trying to purge Gnome3 PPA, I had to cancel the ppa-purge process and when I tried to run the same, I got the following message:

Updating packages lists
PPA to be removed: gnome3-team gnome3
Warning: Could not find package list for PPA: gnome3-team gnome3

I had to add the PPA again to be able to successfully run ppa-purge. For example, if your ppa is ppa:gnome3-team/gnome3, you should run the following:

apt-add-repository ppa:gnome3-team/gnome3

Then you should be able to run ppa-purge again.

Note: In my case, I also got the following error after adding the PPA again:

E: Type ‘ain’ is not known on line 3 in source list /etc/apt/sources.list.d/gnome3-team-gnome3-natty.list
E: The list of sources could not be read.
Warning: apt-get update failed for some reason
PPA to be removed: gnome3-team gnome3
Warning: Could not find package list for PPA: gnome3-team gnome3

This seems to be some bug. I had to manually edit /etc/apt/sources.list.d/gnome3-team-gnome3-natty.list and remove the line containing ‘ain’. This should not be required in your case.

If this does not work, you should check if the PPA exists at all and if you have packages installed from that PPA.

[SOLVED] Netbeans svn error “Duplicate extensions not allowed, OPTIONS request failed on ‘path'”

I have installed sun-java-jre/jdk on my Ubuntu and Fedora. I am using svn for my project and have been running it well with my old Fedora 15 installation on my old PC. However, recently I installed Fedora on my other machine and installed Netbeans 7.0.1 on top of sun-java. Fedora did not handle graphics very well, so I installed Ubuntu alongside as well. But every time I tried to access subversion functionality from Netbeans, I got the following error:

org.tigris.subversion.javahl.ClientException: java.io.IOException: Duplicate extensions not allowed
OPTIONS request failed on ‘/relative/path/to/some/project/directory’

This happened in both of my newer installations, Fedora 15 and Ubuntu 11.04, both with Netbeans 7.0.1. I tried several things but all in vain. Finally, when searching for installed Java related packages in my old machine (where subversion always worked), I found the required package. The cryptic error message will simply stop appearing and Netbeans subversion will start working after the installation of svn client adapter for Netbeans. Here is how you can do it from the terminal:

For Fedora:

su -c 'yum install netbeans-svnclientadapter'

For Ubuntu:

sudo apt-get install libnb-svnclientadapter-java

Hope this helps.

[SOLVED] Blank dark screen after installing ATI Proprietary Drivers (fglrx) in Ubuntu 11.04 Natty Narwhal

Having video and sound issues with Fedora 15, I decided to try out Natty on my HP Pavilion G4 1009tx. Surprisingly, sound and 3D effects ran great with Intel onboard graphics so I installed it onto the Hard drive. In all excitement, I decided to try out proprietary ATI drivers for the switchable dedicated AMD Radeon HD 6470M graphics. However, when I rebooted, it would not boot. It seems that plymouth crashes and system ends up with a black screen. So, I decided to remove fglrx and keep on using Intel card but it seems that I can’t even boot into recovery mode. So, I had to remove fglrx and make the system usable again using the Live CD and chroot. Here is how I did it.

Note: If you are trying to get the fglrx to work, you should look somewhere else. I just removed fglrx and decided not to use it (for now at least).

First, I booted into the Live Ubuntu Desktop. Then, I opened the terminal and created a directory for mounting everything:

sudo mkdir /mnt/root

Then I mounted the root partition.

sudo mount /dev/sda7 /mnt/root

Please note that my installation’s root partition is /dev/sda7. In your case, it can be something else. Since I have a separate home partition (/dev/sda8), I mounted it too, just in case. You can skip this if you don’t have a dedicated home partition.

sudo mount /dev/sda8 /mnt/root/home

You should also mount other drives if you have dedicated partitions for other directories (for /boot perhaps?).

Then, I mounted other required directories.

sudo mount -o bind /dev /mnt/root/dev
sudo mount -o bind /proc /mnt/root/proc
sudo mount -o bind /sys /mnt/root/sys

Then, I chrooted to the mounted root:

sudo chroot /mnt/root

Now, I got into the root of my installed Ubuntu. Then I just had to run the following to remove fglrx:

apt-get remove fglrx

(ignore this, see UPDATE 2 below)
After upgrading xserver-xorg-video-all, xserver-xorg-video-ati and xserver-xorg-video-radeon, the screen went blank again after reboot. So, I had to downgrade the packages by downloading from repos. Here is how you can do it too (I have included the packages in an archive which you can download here, please note that you need an active Internet connection for the following):

cd /tmp
tar xzvf ˜/Downloads/xserver-ati-old.tar.gz
dpkg -i xserver-xorg-video-radeon_6.14.0-0ubuntu4_i386.deb xserver-xorg-video-ati_6.14.0-0ubuntu4_i386.deb xserver-xorg-video-all_1%3a7.6+4ubuntu3_i386.deb

This blank screen issue would still reappear once in a while and the laptop would get very hot over prolonged usage, so I decided to go for a slightly different solution. I removedxserver-xorg-video-radeon and xserver-xorg-video-ati, blacklisted the radeon module and disabled it via vgaswitcheroo. Here is how I did it:
Remove ATI Radeon drivers:

apt-get remove xserver-xorg-video-ati xserver-xorg-video-radeon

Blacklist kernel module:
To disable kernel module, I opened the file /etc/modeprobe.d/blacklist.conf and add a line ‘blacklist radeon’. You can use nano to do this:

nano /etc/modprobe.d/blacklist.conf

Ctrl+O to save and Ctrl+X to exit nano.
Re-enable kernel module after startup and switch the card off:
To do this, I just added two lines before the line ‘exit 0’ in /etc/rc.local (you can use nano for this too) so that the file looks like the following:

#!/bin/sh -e
# rc.local
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
# In order to enable or disable this script just change the execution
# bits.
# By default this script does nothing.

modprobe radeon
chown USERNAME /sys/kernel/debug/vgaswitcheroo/switch
echo OFF > /sys/kernel/debug/vgaswitcheroo/switch

exit 0

In the file above, USERNAME is my login username. Don’t forget to replace USERNAME with your username before saving the file. (If you are not sure what your username is, just do this: ls /home/, you should see it in the name of the directory.)

When done, I just exited from the chrooted environment:


Then, I unmounted everything:

sudo umount -a

(You’ll see some error messages, like device is busy, just ignore them)

Now, I am able to boot into the installed Ubuntu again. Hope this helps.

[SOLVED] No package ‘gtk+-3.0’ found

If you are trying to compile a gtk-3 application and if you don’t have development package installed here is the error you can get:

configure: error: Package requirements (gtk+-3.0 >= 3.0.0) were not met:

No package ‘gtk+-3.0’ found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables GTK_CFLAGS
and GTK_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.

If you encounter this error in Fedora, you should install gtk3-devel. In terminal, type in the following:

su -c 'yum install gtk3-devel'

If you encounter this in Ubuntu, you should install libgtk-3-dev. To do so, type in the following in terminal:

sudo apt-get install libgtk-3-dev

Hope this helps.