Hello World

Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.

Quick Start

Create a new post

1
$ hexo new "My New Post"

More info: Writing

Run server

1
$ hexo server

More info: Server

Generate static files

1
$ hexo generate

More info: Generating

Deploy to remote sites

1
$ hexo deploy

More info: Deployment

Tar and compress a directory in Linux

The following will tar and compress the contents of a directory

1
tar czf file.tar.gz input\_directory

The same can be extracted with tar but indicating compression .

1
tar xzvf file.tar.gz output_directory

Server Migration Bear With Me

I’m in the process of migrating servers please bear with me incase somethings do not work as they should.

Mount a USB Drive in Raspberry Pi With Read/Write Access- Linux

Because I tend to forget this is a simple way of mount a USB drive in Raspbian. Remember we are working with FAT/FAT32 formatted drive and permissions are handled differently in the case of a FAT drive permissions are not supported . First we need to find out how the system views our drive and partitions .

1
2
pi@raspberrypi:/mnt/usb $ ls /dev/sd\*
/dev/sda /dev/sda1

Create a mount point for the drive .

1
sudo mkdir /mnt/usb

Now that we know our drive is /dev/sda and the partition is /dev/sda1 we can proceed to mount . By making use of umask=000 we allow read, write and execute for all .

1
sudo mount /dev/sda1 /mnt/usb -o umask=000

Once mounted you can view the newly mounted drive and start writing to it .

1
2
3
4
5
6
7
8
9
10
11
pi@raspberrypi:/mnt/usb $ df -h

Filesystem Size Used Avail Use% Mounted on
/dev/root 15G 11G 3.7G 75% /
devtmpfs 459M 0 459M 0% /dev
tmpfs 463M 4.0K 463M 1% /dev/shm
tmpfs 463M 7.1M 456M 2% /run
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 463M 0 463M 0% /sys/fs/cgroup
/dev/mmcblk0p1 63M 21M 43M 34% /boot
/dev/sda1 30G 16K 30G 1% /mnt/usb

Linux - Zero Out All Available Free Space

Because I tend to forget. This is a simple way to zero out all free space on a drive all that is needed is PV and administrative privileges . If PV is not installed on the system you can install it via your package manager .

1
sudo apt-get install pv

We will be directing all /dev/zero output to a file in the target drive we wish to zero-out . Once all free space is occupied in the target drive the operation will stop by itself .

1
sudo pv /dev/zero > /mnt/usb/delete.me

Sample output .

1
2
pi@raspberrypi:~ $ sudo pv /dev/zero > /mnt/usb/delete.me
202MiB 0:00:06 \[6.56MiB/s\] \[ <=>

Remove the resulting file .

1
rm delete.me

Join multiple MP3s into a single file with Mp3Wrap

Mp3Wrap is a simple tool all we need to do is indicate a filename for the resulting file followed by all the MP3 files to be joined by Mp3Wrap. Mp3Wrap can be easily installed from the Ubuntu repository using apt-get.

1
sudo apt-get install mp3wrap

Explanation of command to be executed:

  • output.mp3 - this is the name of the resulting file create by Mp3Wrap
  • 1.mp3, 2.mp3 - and so on… this is where you would list all files to be joined by Mp3Wrap

The resulting file will end with *_MP3WRAP.mp3.

1
2
3
4
5
6
7
8
9
10
11
 mp3wrap output.mp3 1.mp3 2.mp3

Mp3Wrap Version 0.5 (2003/Jan/16). See README and COPYING for more!
Written and copyrights by Matteo Trotta - THIS SOFTWARE COMES WITH ABSOLUTELY NO WARRANTY! USE AT YOUR OWN RISK!

50 % --> Wrapping 1.mp3 ... OK
100 % --> Wrapping 2.mp3 ... OK

Calculating CRC, please wait... OK

output\_MP3WRAP.mp3 has been created successfully!

Use mp3splt to dewrap file; download at http://mp3splt.sourceforge.net!

Dump1090-mutability enabling "Distance from Site"

By default Dump1090 interface will not display the distance between an aircraft and the site this can be easily corrected by editing a single file and providing the latitude and longitude where the receiver(yours) is located. The file in question can be located for Dump1090-mutability at

1
/etc/default/dump1090-mutability

Before we can start editing the configuration file first we need to obtain the latitude and longitude of the site as I assume you don’t know this information I suggest using Google Maps to obtain it. Visit google.com/maps search for the address where the receiver is located. Once you find the site(address) right click on the location to display the menu and select What’s here? Near the bottom of the window you should see the latitude and longitude of the site displayed. Copy this information exactly the way it appears. My installation runs on a Raspberry Pi 2, log in to the system where Dump1090 runs and with enough permission look for and edit the following parameters LAT= latitude, LON=longitude this are the parameters well be adding the latitude and longitude information to.

1
sudo nano /etc/default/dump1090-mutability
1
2
3
\# If set, supplies a reference location for local position decoding.
LAT="35.084005"
LON="-106.643967"

We are almost done now just reboot dump1090.

1
sudo service dump1090-mutability restart

Dump1090-mutability should start reporting the distance.

Mikrotik RouterOS - Change SSH Default Port Number

From the RouterOS command line move to /ip service and issue the print command this will display port numbers for various services and which of those services are currently enabled. I will also cover how to disable the services if you wish, the output below is from a recent RouterOS install.

1
2
3
4
5
6
7
8
9
10
11
12
[admin@MikroTik] /ip service> print

Flags: X - disabled, I - invalid
# NAME PORT ADDRESS CERTIFICATE
0 telnet 23
1 ftp 21
2 www 80
3 ssh 22
4 XI www-ssl 443 none
5 api 8728
6 winbox 8291
7 api-ssl 8729

From /ip service set the new SSH port number. Pick a number you like or you can use the following list https://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers.

1
[admin@MikroTik] /ip service> set ssh port=2987

The change takes effectively immediately.

Disable a Service

Disabling a service is equally easy just type disable followed by the service name. It’s always a good idea to disable unused services. Below I’ve disable three different services.

1
[admin@MikroTik] /ip service> disable telnet
1
[admin@MikroTik] /ip service> disable ftp
1
[admin@MikroTik] /ip service> disable winbox

Issue the print command to verify the port change, note that certain services have a X in front of them indicating the service has been disabled.

1
2
3
4
5
6
7
8
9
10
11
12
[admin@MikroTik] /ip service> print

Flags: X - disabled, I - invalid
# NAME PORT ADDRESS CERTIFICATE
0 XI telnet 23
1 XI ftp 21
2 www 80
3 ssh 2484
4 XI www-ssl 443 none
5 api 8728
6 XI winbox 8291
7 api-ssl 8729 none

Raspberry Pi - Dump1090-Mutability and PiAware

I’ve been running a PiAware installation for the last couple of months but after a reinstall I notice some problems specifically with dump1090 provided by the PiAware installation instructions. After searching on various forums I decided to give dump1090-mutability a fork of dump1090 a try and can report great success which is why I decided to list the steps needed to configure dump1090-mutability in a Raspbian install. Current set-up: Raspbian Jessie Lite on a Raspberry Pi 2 + RTL2832U.

Prepare Raspbian

1
sudo apt-get update
1
sudo apt-get upgrade

Dump1090 Mutability Install

Download the necessary .deb from GitHub.

1
wget https://github.com/mutability/mutability-repo/releases/download/v0.1.0/mutability-repo\_0.1.0\_armhf.deb

Install the downloaded .deb. Notice the version number.

1
sudo dpkg -i mutability-repo\_0.1.0\_armhf.deb

Once again update the installation.

1
sudo apt-get update

The GPG key provided with mutability-repo_0.1.0_armhf.deb expired which will result in an error every time you run apt-get we can fix the source for the error.

W: GPG error: http://repo.mutability.co.uk wheezy InRelease: The following signatures were invalid: KEYEXPIRED 1451307476 KEYEXPIRED 1451307476 KEYEXPIRED 1451307476

Now re-install mutability-repo this will pull the latest version with a valid signature.

1
sudo apt-get install mutability-repo

Install dump1090-mutability the version from the repository at the time of this writing was dump1090-mutability v1.14.

1
sudo apt-get install dump1090-mutability

Install the web server.

1
sudo apt-get install lighttpd

Enable module.

1
sudo lighty-enable-mod dump1090

Reload web server for changes to take effect.

1
sudo service lighttpd force-reload

Or you can reboot the entire installation which is why I recommend.

1
sudo reboot

On a web browser and enter the IP address for your Raspberry Pi followed by /dump1090.

1
http://your\_ip\_address/dump1090/

dump1090

PiAware Install

For the latest version of PiAware check the FlightAware page. At the time of this writing the current version was piaware_2.1-5.

1
wget http://flightaware.com/adsb/piaware/files/piaware\_2.1-5\_armhf.deb

Install the downloaded package.

1
sudo dpkg -i piaware\_2.1-5\_armhf.deb

You will receive multiple errors regarding missing dependencies let apt-get install the missing dependencies.

1
sudo apt-get install -fy

Auto-update the PiAware Software.

1
sudo piaware-config -autoUpdate 1 -manualUpdate 1

Connect To FlightAware

Connect the PiAware install to flightAware by providing user credentials.

1
sudo piaware-config -user your\_username -password

Restart PiAware.

1
sudo /etc/init.d/piaware restart

View the status of the install.

1
2
3
4
5
6
7
8
9
sudo piaware-status

dump1090 is not running.
faup1090 is running.
piaware is running.
dump1090-mutabi is listening for connections on port 30005.
faup1090 is connected to port 30005.
piaware is connected to FlightAware.
dump1090-mutabi is producing data on port 30005.

The new install should start feeding data back to FlightAware.

Raspbian - Dump1090 Not Running

I came across a problem that only seems happen on PiAwawre self installs where Dump1090 will not run.

1
2
3
4
5
6
7
8
9
10
 sudo piaware-status

dump1090 is not running.
faup1090 is not running.
piaware is running.
no program appears to be listening for connections on port 30005.
faup1090 is NOT connected to port 30005.
piaware is connected to FlightAware.
got 'couldn't open socket: connection refused'
maybe dump1090 is NOT producing data on port 30005.

Troubleshooting steps included the following: I tried adding the password again maybe I made a mistake but it didn’t fix the problem.

1
sudo piaware-config -user username -password

I know the my RTL is recognized by Raspbian.

1
2
3
4
5
6
7
8
9
lsusb

Bus 001 Device 011: ID 0cf3:9271 Atheros Communications, Inc. AR9271 802.11n
Bus 001 Device 010: ID 0bda:2832 Realtek Semiconductor Corp. RTL2832U DVB-T
Bus 001 Device 009: ID 05dc:a762 Lexar Media, Inc.
Bus 001 Device 013: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Tried to Restart PiAware.

1
sudo /etc/init.d/piaware restart

And looked for any helpful output.

1
cat /tmp/piaware.out

On a forum there was a suggestion about blacklisting a module.

1
sudo nano /etc/modprobe.d/rtlsdr.conf

Add the line below to .conf.

1
blacklist dvb\_usb\_rtl28xxu

After making the changes reboot abd run the piaware-status command hopefully your output will change.

1
2
3
4
5
6
7
8
9
 sudo piaware-status

dump1090 is running.
faup1090 is running.
piaware is running.
dump1090 is listening for connections on port 30005.
faup1090 is connected to port 30005.
piaware is connected to FlightAware.
dump1090 is producing data on port 30005.

https://opendesignengine.net/news/53 http://discussions.flightaware.com/ads-b-flight-tracking-f21/help-no-ads-b-data-program-is-serving-port-30005-t35812.html