Category Archives: Linux

[SOLVED] How to fix the error “locale: Cannot set LC_CTYPE to default locale: No such file or directory” when “ssh”ing from Mac OS X

This happens because ssh sends a LANG environment variable. If we configure ssh to stop sending the variable, the error should be fixed.

sudo nano /etc/ssh/ssh_config

Look for line:

   SendEnv LANG LC_*

And uncomment it so that it looks like:

#   SendEnv LANG LC_*

If you still see the error, generate the locales on the machine you are connecting to, which looks like the following:

sudo locale-gen en_US en_US.UTF-8
sudo dpkg-reconfigure locales

[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

Compile:

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:

./sbagen.bin

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:

cd
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
cd mt7601/src
make

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:

ifconfig

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

Sources:
https://github.com/Shareed2k/osmc_mt7601_driver
https://osmc.tv/help/wiki/kernel-sources

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] Get the Fedora 16 wallpaper for Fedora 15

Fedora 16 Alpha is coming out soon and they have selected Fedora 16 wallpaper. Here is how I installed it in Fedora 15:

cd /tmp
wget http://kojipkgs.fedoraproject.org/packages/verne-backgrounds/15.91.0/1.fc16/noarch/verne-backgrounds-single-15.91.0-1.fc16.noarch.rpm
wget http://kojipkgs.fedoraproject.org/packages/verne-backgrounds/15.91.0/1.fc16/noarch/verne-backgrounds-15.91.0-1.fc16.noarch.rpm
rpm -i verne-backgrounds-single-15.91.0-1.fc16.noarch.rpm
rpm -i verne-backgrounds-15.91.0-1.fc16.noarch.rpm

Then, select the new wallpaper in background settings.

[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
./autogen.sh
./configure --prefix=/usr
make
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.
Enable GPaste with gnome-tweak-tool

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).
Select Gnome on Login Screen, Ubuntu 11.10 Oneiric Ocelot

[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.