Categories
Command Line HowTo Linux Ubuntu

ERROR: Failed to build gem native extension.

While attempting to install a package from gem, I encountered this issue:

sudo gem install dashing
Building native extensions.  This could take a while...
ERROR:  Error installing dashing:
	ERROR: Failed to build gem native extension.

        /usr/bin/ruby1.9.1 extconf.rb
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError)
	from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
	from extconf.rb:2:in `
' Gem files will remain installed in /var/lib/gems/1.9.1/gems/eventmachine-1.2.3 for inspection. Results logged to /var/lib/gems/1.9.1/gems/eventmachine-1.2.3/ext/gem_make.out

Simply to solve this you just need to install ruby-dev packages on ubuntu:

sudo apt-get install ruby-dev
Categories
Uncategorized

Testing Failed: “Failed: error: SBT did not send a reply to our request, perhaps it was killed or failed to start”

Activator error “Failed: error: SBT did not send a reply to our request, perhaps it was killed or failed to start”.

This may be because SBT isn’t installed, SBT is a “simple build tool” for scala which isn’t packaged with the main binaries. You can download and install the latest SBT from the official page, installing it fixed the issue for me in Activator.

Categories
Linux Ubuntu Uncategorized

Linux Mint: “Could not download all repository indexes”

When running

sudo apt-get update

or attempting to update via the Update Manager in Linux Mint (13), I was fronted with the following error:

Failed to fetch http://packages.linuxmint.com/dists/deb ... tion-en_US Unable to connect to packages.linuxmint.com:http:
Failed to fetch http://packages.linuxmint.com/dists/deb ... slation-en Unable to connect to packages.linuxmint.com:http:
Failed to fetch http://packages.linuxmint.com/dists/deb ... tion-en_US Unable to connect to packages.linuxmint.com:http:
Failed to fetch http://packages.linuxmint.com/dists/deb ... slation-en Unable to connect to packages.linuxmint.com:http:
Failed to fetch http://packages.linuxmint.com/dists/deb ... tion-en_US Unable to connect to packages.linuxmint.com:http:
Failed to fetch http://packages.linuxmint.com/dists/deb ... slation-en Unable to connect to packages.linuxmint.com:http:
Some index files failed to download. They have been ignored, or old ones used instead.

This is caused by missing repositories which are either old, broken or currently down. In order to fix it, simply run:

sudo apt-get update fix-missing

If this option doesn’t work, try changing the repository mirrors with the following guide.

Categories
Linux Ubuntu

VirtualBox (4.26) USB Issue: “unable to enumerate USB device on port n”

After a couple of hours trying to get a USB device (USB-to-Serial FTDI) working in VirtualBox with OSX host and Ubuntu 12.10 guest and receiving an error message similar to the follow:

usb 6-3: new full speed USB device number 24 using ohci_hcd
usb 6-3: device not accepting address 24, error -110
hub 6-0:1.0: unable to enumerate USB device on port 2

It turns out, the issue lies with VirtualBox, when the machine is given more than 1 processor it fails to properly mount any USB device. The only fix I have found to work is to simply reduce the number of processors back to 1. Once it’s returned the USB devices work simply by mounting them the usual way, from the VirtualBox menu > Devices > USB Devices >.

If anyone find a better solution, be sure to comment below.

Categories
Raspberry Pi

Raspberry Pi – Web Server (lighttpd)

piweb

Over the weekend I’ve been playing around with the Raspberry Pi and lighttpd in order to get a little webserver running. lighttpd seemed to be a common choice, thanks to it’s simplicity and lightweightness (*possibly not a real word). There’s a plethora of examples of getting it up and running, which isn’t too difficult, most notably the one over at Penguin Tutor covers most everything. This gets you to the point where you have the webserver with mySql and php set up.

However, for me at least, this was only accessible from localhost, i.e I could only view the webserver on the Pi itself. After a few hours messing around, setting up a static ip on the router and making sure that port 80 was open on the router, and configuring lighttpd.conf, I realised that it was certainly a network issue. On further investigation, I discovered that iptables (the linux kernel firewall) was to blame. In order to get the server viewable from outside localhost, and also globally I needed to allow the port in iptables rules, which I did with the following command (ran on the Pi):

 sudo iptables -A INPUT -m state --state NEW -p tcp --dport 80 -j ACCEPT

Now, this command isn’t set in stone, after a reboot it’ll disappear. In order to save the configuration, once it’s working, just run the following commands:

Save the iptables to firewall.conf and place it in /etc/

 sudo iptables-save > firewall.conf
sudo cp firewall.conf /etc/firewall.conf
sudo rm firewall.conf

Now create a file in /etc/network/if-up.d/ called iptables:

sudo nano /etc/network/if-up.d/iptables

And add this content, this will load the iptables config file you saved earlier on boot:

#!/bin/sh
iptables-restore < /etc/firewall.conf

Save and exit (Ctrl+X then press Y and hit return)

Next, make the file executable:

sudo chmod +x /etc/network/if-up.d/iptables

Now you're done, it should be safe to reboot and the iptables will be loaded.

Categories
Command Line HowTo Linux Ubuntu

what(): Serial Port failed to open: open: Permission denied

what():  Serial Port failed to open: open: Permission denied

Trying to get access to your serial port without the need for running whatever program as sudo or root? You’re probably not in the dialout group, if that’s the case, here’s the fix:

First, check you aren’t in the group:

groups alex

This will list all the groups the user is in, here the user is called ‘alex’, just substitute that for your own username. If the output doesn’t contain the dialout group, keep going. If it does, you might have another issue which this isn’t likely to solve.

sudo gpasswd --add alex dialout

This command will add the user ‘alex’ to the ‘dialout’ group. Once that’s done you’ll need to logout and back in again for the effects to take place.

Categories
Fedora HowTo Linux Ubuntu

Team Fortress 2 Segmentation Fault – Steam for Linux

After getting invited to join the Steam Beta for Linux, (after weeks of using the bypass) I decided to get playing some TF2. After the long install and download I booted it up. The Value splash screen with the tap-guy loads and the menu begins to load, but once it has finished, the game closed and returned to my desktop.

So I tried again, but this time ran steam through terminal in order to get some error messages. The following is what I found to occur when the game crashed:

response: CrashID=bp-ca59d62f-9c2b-47e4-8cd9-9d0b02121212
/home/alex/Steam/SteamApps/username/Team Fortress 2/hl2.sh: line 72: 4811 Segmentation fault ${GAME_DEBUGGER} "${GAMEROOT}"/${GAMEEXE} "$@"
Game removed: AppID 440 "Team Fortress 2", ProcID 4811
saving roaming config store to 'sharedconfig.vdf'
roaming config store 2 saved successfully

To fix it, there’s a pretty simple solution. This is to add the option “-nojoy” to the launch options of the game:

  1. Right click Team Fortress 2 in the Library pane of Steam.
  2. Click “Properties”.
  3. Click “Set Launch Options”
  4. Add the following: -nojoy
  5. Hit OK and launch the game, everything should be working!

If you’re running Fedora, some folk have found another solution to this fix, if the previous doesn’t work:

sudo setsebool -P allow_execheap 1

Where it seems SELinux isn’t allowing the game to start for whatever reasons.

 

Categories
Arch Linux Command Line Linux Raspberry Pi Ubuntu

Setting up a static external IP address on a Raspberry Pi (For Free!)

If you’re planning on setting up your raspberry pi as a server or a project that’ll want you to access it from a static external IP address, here’s a really simple and quick way to get that up and running for free.

First off, this guide uses the free service from no-ip (www.no-ip.com), so you’ll want to head over there and register for that. (http://www.no-ip.com/newUser.php)

Done? Ok, great. Next you’ll want to create a new host, this can be found under the “Hosts/Redirects” page (this link should work if you’re logged in: https://www.no-ip.com/members/dns/)

Click “Add a Host”

Enter a name and choose one of the free domains from the drop down box (alternatively you are able to use an existing domain name or sub-domain if you have one.) There are some other settings, if you know what you’re doing go ahead and choose which you prefer but from those who just want to get this set up you can now click “Create Host” and you’re done.

Now, in order for this system to know what your pi’s current address is in order to assign it that domain address you need to install the client on the pi (thankfully, they have a Linux one!).

Download the latest version of their client – http://www.no-ip.com/downloads.php?page=linux

tar -zxvf noip-duc-linux.tar.gz
make
sudo make install

One there, you’ll be promted for your email and password for no-ip.com.
It will then show you have a host registered, just hit enter.
Then it will ask to update the host you made on the site “Do you wish to have host [somedescriptivename.no-ip.org] updated?[N] (y/N)”. Type “Y” then hit enter.
It’ll ask for an update interval, this can be left at 30.
Then it’ll ask if you want to “run something on successful update”, basically this allows a script to run if it gets a connection. Choose N and hit return.

That’s it, you should be done. Just test out the connection via SSH or ping and compare the IPs.

Categories
Command Line HowTo Linux Ubuntu

HowTo: Restore Your Default .bashrc File in Ubuntu

If you’ve managed to find yourself deleting, overwriting or generally messing up your profiles .bashrc file there’s a really easy way to fix it. A default version of the file can be found under “/etc/skel/.bashrc”, simply coping that over your profiles one (found in your home directory) will restore it to default. Make sure to also source the file if you want to continue using it under that terminal or close and re-open the terminal.

I managed to have a blank bashrc after upgrading Ubuntu with a separate /home partition, while deleting all the old config files I must have also removed this.

The following commands should do this for you, be sure to make a back up of your current .bashrc file too, just to be safe.

cp ~/.bashrc ~/.bashrc.bkup
cp /etc/skel/.bashrc ~/
source .bashrc

You should be now back to a default terminal experience and continue to customise it how you like!

Categories
HowTo Linux Ubuntu

mlbviewer 2012 Installation guide for Ubuntu (MLB.TV on Linux)

Download mlbviewer:

Go and grab the latest version from the sourceforge page below:

http://sourceforge.net/projects/mlbviewer/

Unrar:

tar -zxvf mlbviewer2012.tar.gz

It doesn’t require any installation but you will need a few extras and the easiest way to install them is shown below:

Download PyXML:

PyXML is an XML processing tool for python which this project uses, sometimes it can be tricky to install python modules so we’ll be using setuptools which you can get from the link below.

If you’re unsure of what version you need, open terminal and type “python”, this will show the version of python you’re running. Mine was 2.7.4 so I downloaded “setuptools-0.6c11-py2.7.egg” I would imagine yours would be similar.

http://pypi.python.org/pypi/setuptools#cygwin-mac-os-x-linux-other

Once you have it, run it (replacing the version you downloaded for the one here):

sudo sh setuptools-0.6c11-py2.7.egg

Now to install PyXML it’s as simple as running:

sudo easy_install pyxml

That’s it, you’re done.

Optional – Install MPLAYER2:

MPLAYER2 offers at lot of advantages over MPLAYER however we’re most interested in it because it offers better streaming support and handle stream rate switches (important if you enable adaptive streaming in nexdef mode).

sudo add-apt-repository ppa:motumedia/mplayer-daily
sudo apt-get update
sudo apt-get install mplayer2

(Thanks to – Web Upd8)

Optional – Install mlbhls (for nextdef | HD):

Instructions as per in REQUIREMENTS-2012.txt in the mlbviewer package.

You’ll also need some extra packages which aren’t stated:

sudo apt-get install libconfig-dev libcurl4-gnutls-dev
svn co https://mlbtv-hls-nexdef.googlecode.com/svn/branches/experimental mlbhls
cd mlbhls
make
sudo cp mlbhls /usr/bin

Once that’s done, you should be able to get the higher bitrate streams too!

Using mlbplayer:

Setup:

The first time you run mlbviewer it will generate a config file which you’ll need to enter your Premium MLB.TV account details in, running mlbviewer will tell you where this file is located:

python mlbviewer.py

Go edit the file and enter your email as the “user” and your password after “pass”.

Now re-run mlbviewer and it should start up!

python mlbviewer.py

Sit back and enjoy!