Category Archives: Linux

Ubuntu Server 14.04 (Trusty Tahr) – Quick Headless Transmission Setup

ubuntu-server-logo

This is a quick post with a brief explanation of how to set up transmission on Ubuntu Server (currently 14.04 (Trusty Tahr)).

First make sure your repositories are up-to-date:

sudo apt-get update

Install transmission:

sudo apt-get install transmission-cli transmission-common transmission-daemon

Check to make sure that the transmission-daemon is not running – if it is it will overwrite any configuration changes that we make later:

sudo service transmission-daemon stop

Locate the transmission-daemon settings file:

sudo find / -iname settings.json

Two locations are found for this file:

/etc/transmission-daemon/settings.json
 /var/lib/transmission-daemon/info/settings.json

We will edit /etc/transmission-daemon/settings.json:

sudo nano /etc/transmission-daemon/settings.json

The changes that I made to settings.json are in red. You will need to provide your own settings to configure your setup:

"download-dir": "your-download-location",
"incomplete-dir": "your-download-location",
"rpc-password": "password",
"rpc-username": "username",
"rpc-whitelist": "127.0.0.1,192.168.0.*",
  • download-dir and incomplete-dir are directories where complete and incomplete torrents are stored. They do not have to be different directories.
  • rpc-password and rpc-username are the username and password for web access administration.
  • rpc-whitelist defines access to transmission. Localhost (127.0.0.1) is defined by default. I added ,192.268.0.* to allow any machine on my LAN access.

Start the transmission-daemon:

sudo service transmission-daemon start

Verify that everything is working by opening a broswer and pointing it to http://server-ip:9091.

Sources:

https://forum.transmissionbt.com/viewtopic.php?f=8&t=8361

http://www.webupd8.org/2009/12/setting-up-transmission-remote-gui-in.html

Ubuntu Server 14.4 (Trusty Tahr) – add-apt-repository: command not found

ubuntu-server-logo

The last time I encountered the add-apt-repository: command not found error I was using Ubuntu Server 12.4 Lucid. The solution then was to install python-software-properties as follows:

sudo apt-get install python-software-properties

 

This did not resolve the issue on my minimal virtual machine installation on Trusty so I installed apt-file – which is an apt package searching utility:

sudo apt-get install apt-file

 

Update apt-file:

apt-file update

 

Finally use apt-file to search for the add-apt-repository package:

apt-file search add-apt-repository

 

As you can see add-apt-repository is in software-properties-common:

software-properties-common: /usr/bin/add-apt-repository
software-properties-common: /usr/share/man/man1/add-apt-repository.1.gz

 

After installing software-properties-common I was able to use add-apt-repository without any further issue:

sudo apt-get install software-properties-common

Ubuntu 14.04 (Trusty Tahr) x86 – Minor Installation Issues

ubuntu-logo

I experienced two issues trying to install Ubuntu 14.04 x86 on my old laptop today:

  • ubi-partman crashed (I clicked Continue)
  • Installation hung Getting the time from a network time server

I encountered these issues booting from DVD and then clicking on the Install Ubuntu button in the installer.

Fortunately I did not encounter either of these issues when I rebooted and then clicked Try Ubuntu in the installer and then installed Ubuntu from the Live DVD session.

 

 

Ubuntu 12.04 (Precise) – Could not apply the stored configuration for monitors

ubuntu-logo

Booting in to a clean installation of Ubuntu 12.04 (Precise) with VMWare Tools installed I get a Could not apply the stored configuration for monitors error:

Could not apply the stored configuration for monitors.

Could not apply the stored configuration for monitors.

The solution is to remove monitors.xml from /home/<username>/.config.

To do this I opened a Terminal and changed the directory to .config:

cd .config

I backed-up and then deleted monitors.xml:

cp monitors.xml monitors.bak
rm monitors.xml

I rebooted for good measure – now VMWare Tools adjusts my resolution without errors.

Source:  http://askubuntu.com/questions/67337/how-do-i-get-rid-of-this-monitor-error

Ubuntu – Teamviewer 8 – lsb_release crashed with IOError in getstatusoutput(): [Errno 10] No child processes

ubuntu-logo

I installed Teamviewer 8 on Ubuntu 12.04 (Precise) today and started getting frequent random internal error messages.

ubuntu-internal-error

Sorry, Ubuntu 12.04 has experienced an internal error.

I did not capture all of the details but this portion led me to a solution when I searched for it:

lsb_release crashed with IOError in getstatusoutput(): [Errno 10] No child processes

To fix the error first open the Terminal.

Next change directory to /opt/teamviewer8/tv_bin/script:

cd /opt/teamviewer8/tv_bin/script

Make a backup copy of tvw_main:

sudo cp tvw_main tvw_main.bak

Open tvw_main in the nano text editor:

sudo nano tvw_main

Edit the file as per the screenshot below:

teamviewer-tvw_main

  • comment out lsb_release -a
  • comment out lsb_release -ds > “$WINEPREFIX/drive_c/distrelease”

After make_path “$WINEPREFIX/drive_c” make a new line and paste the following:

cat /etc/lsb-release | grep DESCRIPTION | cut -f2 -d= | sed 's/\"//g' >     "$WINEPREFIX/drive_c/distrelease"

Save tvw_main and exit nano – Ctrl + O, Enter, Ctrl +X.

Source: https://bugs.launchpad.net/ubuntu/+source/lsb/+bug/1094218

Notepad ++ Unix Shell Scripts and the ‘No such file or directory’ error on Ubuntu Server

ubuntu-server-logo

I first encountered this issue a long time ago and forgot to document it – so now I had to resolve it again.

I’m running Notepad ++ on Windows and using WinSCP to transfer bash scripts to Ubuntu Server. My script is saved as an Unix script file (*.sh, *.bsh) in Notepad++ and WinSCP is set to transfer files in binary mode.

When I run the script on Ubuntu Server I get the following error:

: No such file or directory

I could see the problem in Notepad++ and in nano on Ubuntu Server when I wanted to save the file – the file was formatted for Dos\Windows.

dos-windows

Notepad ++ document format set to Dos\Windows

dos-format

Nano saving .sh as Dos Format

The fix is to change the formatting to UNIX. In Notepad ++ click Edit, EOL Conversion and UNIX and save the file.

Easy when you remember how!

FreeNAS 8 – Hang During Post on HP Microserver N40L

Microserver NAS

Today I decided to reboot FreeNAS 8 on my HP Microserver because the speed of transfers from my PC to FreeNAS had dropped to around 30 MB/s and were stalling regularly.

2.5 Gb file copy from Windows 8 (SSD) to FreeNAS 8.x (Mirror)

2.5 Gb file copy from Windows 8 (SSD) to FreeNAS 8.x (Mirror)

I logged into FreeNAS to take a look and could not see anything obviously amiss and so rebooted.

Unfortunately I had to unexpectedly deal with the deal with the following issues:

This is a FreeNAS data disk and can not boot system. System halted

and,

Auto-detecting USB Mass Storage Devices...
Device #01:

In the former instance FreeNAS was trying to boot from a zpool (data) drive and in the latter could not successfully detect the USB jump drive that contained my FreeNAS installation.

With the latter error my Microserver would take an eternity to get into the BIOS (the BIOS did correctly identify my jump drive as the device to boot though).

Clearly it was time to install FreeNAS to a new jump drive.

  • download the latest FreeNAS 64 bit disk image and extract it using 7zip
  • use Win32DiskImager to copy the extracted FreeNAS image onto a new jump drive (minimum size 4Gb)

I used a spare Lexar Firefly jump drive that I had lying around because it is small and easy to insert into the usb port on the Microserver motherboard.

When I logged into FreeNAS again I had to change the admin password. I then uploaded my previous saved configuration and rebooted.

Always take a couple of minutes to save your FreeNAS config (you never know when you might need it).

With this done I just had to deal with the warning that my zpools were using an older version of ZFS (15) than was currently running (28). Time to enable SSH so that we can do a little command line work and upgrade my zpools.

Select Control Services under Services in the left hand pane and then enable SSH. Then click the spanner icon to open the SSH Settings window and check Login as Root with password and click OK.

freenas ssh

Next open Putty (or a similar tool) and remote into FreeNAS as root (using your Admin password).

I used the following commands to upgrade my zpools:

Note: it is recommended to back-up your data before performing an upgrade and it is not recommended to upgrade zpools if they are not healthy.

zpool status
zpool upgrade <pool-name>

With the pool upgrade complete I made sure that I turned off SSH access.

Now that all of that is out of the way my file transfers are back to normal again. I still want to investigate the dips that I experience during file transfers, but the impact is not so great that it is a really pressing concern.

freenas 2

My main take-away from this is to make sure that I keep my config backed-up and always have a spare jump drive to replace a failed one. It happened to me much sooner than I thought it would!

2013 Potential Hardware for vSphere Home Nanolab and NAS Refresh

hardware-logo

My current VMware vSphere white-box will be 5 years old in August. It has an AMD Athlon X2 BE-2400 Brisbane @2.3GHz and 8Gb of RAM – and these days 8Gb of RAM is just not enough.

The hardware for my NAS is more recent – a HP Microsever N40L with 6Gb of RAM, running FreeNAS 8.x.

The cpubenchmark score for my vSphere box is 1333 – the score for the N40L is 979.

While I still need to look at the performance of ZFS on the N40L (it is OK but not exactly where I would like it to be) I know that a lot more CPU is not desperately needed for new vSphere hardware (but it would be nice).

I have been considering the Intel NUC (Next Unit of Computing) as an alternative to having a tower PC to run vSphere for a while now. It maxes out at 16Gb of RAM and it really shines in terms of its power efficiency (13-27 watts) and diminutive size (4″ x 4″). The i3 -3217U DC3217IYE NUC (Ivy Bridge architecture) is the current NUC that I have my eye on.

The Intel i3 NUC

The Intel i3 NUC

The issue with the NUC though is storage – I can either install an msata SSD in the NUC or use shared storage on my NAS (or both). I would like to use local storage on the NUC for speed and back up VMs to my NAS – the cost of SSDs will limit my local storage capacity though.

The next generation of NUCs are based on the Haswell architecture and include Core i5 (Horse Canyon) and i7 (Skull Canyon) CPUs. The i5-3427U offering (cpu benchmark: 3580) is of interest to me here as it includes Intel vPro remote management capabilities.

This still leaves us with the 3rd generation of NUCs (also Haswell) which have an on-board sata and sata power connector – these are slated to arrive in Q3 2013.

3rd Gen Intel NUC

3rd Gen Intel NUC

The other option for a diminutive vSphere box is the Gigabtye take on the NUC called Brix. It looks like Gigabyte plans to offer Intel (i3 – i7) CPUs and AMD Kabini (E1-2100, E1-2500 & E2-3000 dual core, and A4-5000 quad core) CPUs.

I think it will be worth keeping an eye on the Brix offerings to see where they differ from the NUC. The key areas for me will be efficiency, pricing and storage – what if Brix offers a 2.5 or 3.5″ internal drive bay, for example? I imagine that the AMD offerings will be cheaper than the Intel NUC – but we will have to wait and see.

On the home NAS side of things HP very recently updated their Microserver (Gen 8) with Celeron and Pentium models:

  • Intel® Celeron® G1610T (2 core, 2.3 GHz, 2MB, 35W)
  • Intel® Pentium® G2020T (2 core, 2.5 GHz, 3MB, 35W)

This does potentially make the Microserver a better vSphere candidate too, especially as the supported RAM has been upped to 16Gb.

The other good news is the built in iLO support, dual gigabit NICs and USB 3.0 ports (as seen on the beta unit, at least):

HP Microserver (Gen 8) rear panel - courtesy of

HP Microserver (Gen 8) rear panel – courtesy of blog.themonsta.id.au

So I’ll be keeping an eye on the new generation of Microserver too. The additional CPU and RAM are quite welcome (especially for ZFS). I am also keen to know the power consumption for these machines as a whole.

Either way with both the NUC and the Microserver I can build a power efficient and much smaller lab.

If I can score a couple of NUCs and another Microserver by the end of the year, I will be a happy man!

Ubuntu Server – Installing Tiny Tiny RSS

ubuntu-server-logo

I have been using Gregarius as my web-based RSS aggregator for quite some time now but have wanted to try Tiny Tiny RSS for a while.

Now that WebUpd8 have created a PPA (Personal Package Archives) for Tiny Tiny RSS I really had no excuse for not installing it.

Note: I am installing Tiny Tiny RSS on Ubuntu Server 12.04. PPAs have been available for Ubuntu since Ubuntu 9.10 – so this will not work on prior editions of Ubuntu Server.

The first step is to update our repositories and install Apache and MySQL:

sudo apt-get update
sudo apt-get install mysql-server mysql-client apache2 libapache2-mod-php5

When prompted enter a password for your MySQL root user:

MySQL Password

Confirm your MySQL password:

Confirm MySQL Password

Now that we have our prerequisites installed we can add the Tiny Tiny RSS PPA.

Note: On a minimal virtual machine installation of Ubuntu Server we need to install the  python-software-properties package to be able to add a PPA:

sudo apt-get install python-software-properties

Add the Tiny Tiny RSS PPA:

sudo add-apt-repository ppa:webupd8team/tt-rss
sudo apt-get update
sudo apt-get install tt-rss

Set Apache as the Tiny Tiny RSS web server:

tt-rss apache

Set the URL for the Tiny Tiny RSS installation – for a local install on my LAN i used http://localhost/tt-rss/:

tt-rss url

Select Yes for database configuration:

tt-rss database config

Confirm MySQL as the database for Tiny Tiny RSS:

tt-rss database mysql

Enter your root MySQL password:

tt-rss root mysql password

Enter a password for Tiny Tiny RSS to register with MySQL – a random password will be generated if left blank:

tt-rss application password

Confirm your application password:

tt-rss confirm application password

Next we need to use nano to edit some configuration files.

First we need to edit our server address in /etc/tt-rss/config.php:

sudo nano /etc/tt-rss/config.php

Find the line  define('SELF_URL_PATH', 'http://yourserver/tt-rss/'); and change it to  define('SELF_URL_PATH', 'http://localhost/tt-rss/'); (as per the server address that we set previously):

tt-rss config.php

Press Ctrl + O then Enter to save the changes to config.php and then Ctrl +X to exit nano.

To get Tiny Tiny RSS to update feeds we need to edit /etc/default/tt-rss:

sudo nano /etc/default/tt-rss

Change DISABLED=1 to DISABLED=0 to allow the Tiny Tiny RSS daemon to be started:

tt-rss tt-rss

Press Ctrl + O then Enter to save the changes to config.php and then Ctrl +X to exit nano.

Start the Tiny Tiny RSS service:

sudo service tt-rss start

Obtain the IP address of your Ubuntu Server installation:

ipconfig

tt-rss ifconfig

Open a browser on another machine and navigate to your Tiny Tiny RSS URL:

tt-rss login

Login with the username: admin and the password: password.

Click Actions, Preferences and Users to change your admin password and add users. You can import feeds under the Feeds tab or click Exit Preferences and then Actions, Subscribe to feed to add feeds manually.

Source: http://www.webupd8.org/2013/05/tiny-tiny-rss-ubuntu-ppa-google-reader.html

Ubuntu – Change Hostname Permanently Using the Command Line

ubuntu-logo

On Ubuntu the hostname is stored in both the /etc/hosts and /etc/hostname files. There are several ways that we can change the hostname in these files.

1. Manually Edit the hostname

We can manually edit these files using a basic text editor like nano:

sudo nano /etc/hosts
sudo nano /etc/hostname

In /etc/hostname simply overwrite the existing hostname with a new one. In /etc/hosts you will find the hostname on the line beginning 127.0.0.1 – overwrite only the hostname with the new one, and then reboot.

Editing /etc/hosts using nano

Editing /etc/hosts using nano

sudo reboot

2. Use sed to change the hostname

Another way to achieve the same goal is to use the sed command to replace the existing hostname with a new one.

For example, my Ubuntu Server has the default hostname of ‘ubuntu’.

Use the hostname command to check what your hostname is.

With sed we can look for our hostname (in /etc/hosts and /etc/hostname) and then replace it with the desired new-hostname:

sudo sed -i 's/ubuntu/new-hostname/g' /etc/hosts
sudo sed -i 's/ubuntu/new-hostname/g' /etc/hostname

Reboot:

sudo reboot

3. Write a Bash Script

It’s always handy to have a script to do things – so here is a quick bash script that I put together that uses sed to change the hostname and then reboot:

#!/bin/bash
#Assign existing hostname to $hostn
hostn=$(cat /etc/hostname)

#Display existing hostname
echo "Existing hostname is $hostn"

#Ask for new hostname $newhost
echo "Enter new hostname: "
read newhost

#change hostname in /etc/hosts & /etc/hostname
sudo sed -i "s/$hostn/$newhost/g" /etc/hosts
sudo sed -i "s/$hostn/$newhost/g" /etc/hostname

#display new hostname
echo "Your new hostname is $newhost"

#Press a key to reboot
read -s -n 1 -p "Press any key to reboot"
sudo reboot