Tag Archives: Howto

Installing Deluge under Debian Server

# apt-get install deluged deluge-web

Creating needed group and directories for logging
NOTE: change user to your user

# groupadd deluge
# usermod -aG deluge user
# mkdir -p /var/log/deluge/
# chmod -R 755 /var/log/deluge/
# chown -R root:deluge /var/log/deluge/

Creating autostart scripts

# nano /etc/default/deluged

# Configuration for /etc/init.d/deluged

# The init.d script will only run if this variable non-empty.
DELUGED_USER="user"             # !!!CHANGE THIS!!!!

# Should we run at startup?

# nano /etc/init.d/deluged

# Provides:          deluged
# Required-Start:    $local_fs $remote_fs
# Required-Stop:     $local_fs $remote_fs
# Should-Start:      $network
# Should-Stop:       $network
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Daemonized version of deluge and webui.
# Description:       Starts the deluge daemon with the user specified in
#                    /etc/default/deluged.

# Author: Adolfo R. Brandes 
# Updated by: Jean-Philippe "Orax" Roemer

DESC="Deluge Daemon"
DAEMON1_ARGS="-d -L warning -l /var/log/deluge/deluged.log"             # Consult `man deluged` for more options
DAEMON2_ARGS="-L warning -l /var/log/deluge/web.log"               # Consult `man deluge-web` for more options
UMASK=022                     # Change this to 0 if running deluged as its own user

# Exit if the package is not installed
[ -x "$DAEMON1" -a -x "$DAEMON2" ] || exit 0

# Read configuration variable file if it is present
[ -r /etc/default/$PKGNAME ] && . /etc/default/$PKGNAME

# Load the VERBOSE setting and other rcS variables
[ -f /etc/default/rcS ] && . /etc/default/rcS

# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. /lib/lsb/init-functions

if [ -z "$RUN_AT_STARTUP" -o "$RUN_AT_STARTUP" != "YES" ]
   log_warning_msg "Not starting $PKGNAME, edit /etc/default/$PKGNAME to start it."
   exit 0

if [ -z "$DELUGED_USER" ]
    log_warning_msg "Not starting $PKGNAME, DELUGED_USER not set in /etc/default/$PKGNAME."
    exit 0

# Function to verify if a pid is alive
   pid=`cat $1` > /dev/null 2>&1
   kill -0 $pid > /dev/null 2>&1
   return $?

# Function that starts the daemon/service
   # Return
   #   0 if daemon has been started
   #   1 if daemon was already running
   #   2 if daemon could not be started

   is_alive $PIDFILE1

   if [ $RETVAL1 != 0 ]; then
       rm -f $PIDFILE1
       start-stop-daemon --start --background --quiet --pidfile $PIDFILE1 --make-pidfile --\
exec $DAEMON1 --chuid $DELUGED_USER --user $DELUGED_USER --umask $UMASK -- $DAEMON1_ARGS
       is_alive $PIDFILE2
       [ "$RETVAL2" = "0" -a "$RETVAL1" = "0" ] && return 1

   is_alive $PIDFILE2

   if [ $RETVAL2 != 0 ]; then
        sleep 2
        rm -f $PIDFILE2
        start-stop-daemon --start --background --quiet --pidfile $PIDFILE2 --make-pidfile -\
-exec $DAEMON2 --chuid $DELUGED_USER --user $DELUGED_USER --umask $UMASK -- $DAEMON2_ARGS
   [ "$RETVAL1" = "0" -a "$RETVAL2" = "0" ] || return 2

# Function that stops the daemon/service
   # Return
   #   0 if daemon has been stopped
   #   1 if daemon was already stopped
   #   2 if daemon could not be stopped
   #   other if a failure occurred

   start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --user $DELUGED_USER --pidfile $PIDFILE2
   start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --user $DELUGED_USER --pidfile $PIDFILE1
   [ "$RETVAL1" = "2" -o "$RETVAL2" = "2" ] && return 2

   rm -f $PIDFILE1 $PIDFILE2

   [ "$RETVAL1" = "0" -a "$RETVAL2" = "0" ] && return 0 || return 1

case "$1" in
   [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME1"
   case "$?" in
      0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
      2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
   [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME1"
   case "$?" in
      0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
      2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
   log_daemon_msg "Restarting $DESC" "$NAME1"
   case "$?" in
      case "$?" in
         0) log_end_msg 0 ;;
         1) log_end_msg 1 ;; # Old process is still running
         *) log_end_msg 1 ;; # Failed to start
        # Failed to stop
      log_end_msg 1
   echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
   exit 3


Make the init.d script to be excutable and to run at startup

# chmod 755 /etc/init.d/deluged
# update-rc.d deluged defaults


# nano /etc/logrotate.d/deluged
/var/log/deluge/*.log {
        rotate 7
        create 600

Now to see that it all works

# invoke-rc.d deluged start


How to PPTPD (PopTop)

Below is a way to connect your clients like smartphone, laptop, etc to the Internets while you are out and about connecting to random WiFi networks etc like Mac Donalds, and to help protect yourself while on them unknown networks with unknown users

Install mppe kernel support

# modprobe ppp-compress-18

Install PPTPD

# apt-get install pptpd

Configure IP Address Range
Edit the file /etc/pptpd.conf for the IP address range


restart pptpd to activate changes

# invoke-rc.d pptpd restart

Adding users accounts
Edit the file /etc/ppp/chap-secrets

test_user * lamepassword *

The above will give you a working PPTPD where your able to connect to securely but you’ll most probably can’t connect to the outside network.

To allow you PPTP clients access to the big bad internet

Enable IPv4 forwarding

echo 1 > /proc/sys/net/ipv4/ip_forward

Finally configure your iptables

iptables -A INPUT -i ppp+ -j ACCEPT
iptables -A OUTPUT -o ppp+ -j ACCEPT
iptables -A POSTROUTING -t nat -o eth0 -j MASQUERADE
iptables -A POSTROUTING -t nat -o ppp+ -j MASQUERADE

If you want all traffic to go through the PPTP connection
Edit the file /etc/ppp/pptpd-options and change

# Debian: do not replace the default route


# Debian: do not replace the default route

and don’t forget to restart pptpd ;-)

Debian pptpd HOWTO
IP Chicken

udev rules for ADB

# nano /etc/udev/rules.d/51-android.rules

SUBSYSTEM=="usb", ATTR{idVendor}=="0502", MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTR{idVendor}=="0B05", MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTR{idVendor}=="413C", MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTR{idVendor}=="0489", MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTR{idVendor}=="091E", MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTR{idVendor}=="18D1", MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTR{idVendor}=="109B", MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTR{idVendor}=="0BB4", MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTR{idVendor}=="12D1", MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTR{idVendor}=="24E3", MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTR{idVendor}=="2116", MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTR{idVendor}=="0482", MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTR{idVendor}=="17EF", MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTR{idVendor}=="1004", MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTR{idVendor}=="22B8", MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTR{idVendor}=="0409", MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTR{idVendor}=="2080", MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTR{idVendor}=="0955", MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTR{idVendor}=="2257", MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTR{idVendor}=="10A9", MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTR{idVendor}=="1D4D", MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTR{idVendor}=="0471", MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTR{idVendor}=="04DA", MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTR{idVendor}=="05C6", MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTR{idVendor}=="1F53", MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTR{idVendor}=="04E8", MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTR{idVendor}=="04DD", MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTR{idVendor}=="0FCE", MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTR{idVendor}=="2340", MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTR{idVendor}=="0930", MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTR{idVendor}=="19D2", MODE="0666", GROUP="plugdev"

# chmod +x /etc/udev/rules.d/51-android.rules

Using Hardware Devices

ENE Technology, Inc. SD card reader (UB6250)

This is how I got the ENE UB6250 card reader working under Debian testing one my Acer Aspire One D255E


Bus 001 Device 005: ID 0cf2:6250 ENE Technology, Inc. SD card reader (UB6250)

This card reader uses the ums-eneub6250 module and needs firmware to operate correctly which is currently not included in the Debian firmware-linux or firmware-linux-nonfree packages.

The way I have gotten around the problem at the moment is to downloaded the Ubuntu linux-firmware package and extracted the deb package to copy the directory ene-ub6250 from the extracted directory /lib/firmware/ to /lib/firmware/ on my working system as I not wanted to install 40 odd megabyte of other firmware I not needed.

After moving the files over run the following and all should be ready to use
# depmod -ae
# update-initramfs -u


Yaesu FT-897D and double SSB problem

Last couple weeks I have a had a problem with my 897D doing double SSB on RX and TX. Last night I was looking around for a firmware update for the 897D to see if that might fix my problem as I have tried other things like full CPU reset on the rig etc.

Well I found the page below in my travels and it had reference to relay cleaning by hold down the UP and DWN keys and powering the rig ON will start the cleaning of the relays and display CLEANING RELAYS on the screen. The great news is that this little unknown trick to me has fixed my double SSB problem :-)


[How to] Prey 0.5.3 under Debian

Today I setup Prey 0.5.3 on my netbook running Debian testing.

# apt-get install prey

Here is what I modified in my ‘/etc/prey/config


# autoconnect feature, disabled by default until we are 200% sure it
# works flawlessly in all platforms. feel free to try it out though.


# you can get both of these from Prey's web service


# if you're having trouble getting requests across your firewall or proxy,
# you can try adding '-0' to make curl perform HTTP 1.0 requests
curl_options='-0 --compress'

# this option prepends a random number as a subdomain to the check URL on http mode
# makes it harder for other programs to block Prey so its a good idea to be on

Also I added to my root crontab for updates

# crontab -e

*/10 * * * * /usr/share/prey/prey.sh > /var/log/prey.log
now is

*/10 * * * * /usr/lib/prey/prey.sh > /var/log/prey.log

[How To] Compiling QSSTV 7.1 under Debian testing (wheezy)


QSSTV 7.1 is a program for receiving and transmitting SSTV and for receiving FAX. A lot of enhancement have been made since QSSTV version 5 and 6. It took me a while to come up with a new version due to my professional activities.
This is a beta version, and you can expect to find updates and bug fixes on a (not so) regular basis.

UPDATE Monday 21 May 10:49:52 CST 2012: QSSTV 7.1.7 is now available in the Debian repository for about a month now as of writing this

Getting the source:

wget http://users.telenet.be/on4qz/qsstv/downloads/qsstv_7.1.7.tgz

Installing the required software:

# apt-get install g++ libfftw3-dev qt4-qmake libqt4-dev hamlib-dev libasound2-dev


$ tar -xvzf qsstv_7.1.7tgz
$ cd qsstv_7.1.7
$ qmake-qt4
$ make

you can either run QSSTV from it current location or you can install it system wide by

# make install

The only problem I got with running QSSTV was it complaining about GTK+

$ ./qsstv 
QGtkStyle was unable to detect the current GTK+ theme.

But it can easily fixed by running

export GTK2_RC_FILES="$HOME/.gtkrc-2.0"

or you can just edit the Trolltech.conf file and change the line ‘style=GTK+‘ to ‘style=Cleanlooks

nano ~/.config/Trolltech.conf


[How To] Compiling WSPR under Debian testing (wheezy)


WSPR implements a protocol designed for probing potential propagation paths with low-power transmissions. Normal transmissions carry a station’s callsign, Maidenhead grid locator, and transmitter power in dBm. The program can decode signals with S/N as low as -28 dB in a 2500 Hz bandwidth. Stations with internet access can automatically upload their reception reports to a central database called WSPRnet, which includes a mapping facility.

Installing the required software:

# apt-get install subversion python2.7-dev python-numpy python-imaging-tk python-pmw libportaudio2 portaudio19-dev libsamplerate0-dev gfortran cl-fftw3

Getting the source:

$ svn co http://svn.berlios.de/svnroot/repos/wsjt/branches/wspr

Compiling WSPR:

$ cd wspr
$ ./configure
$ make

you can either run WSPR from it current location or you can install it system wide by

# make install

I got an error about port audio 19 when running configure, example:

This program needs portaudio v19 to compile.
Please use --with-portaudio-include-dir= and
 --with-portaudio-lib-dir= to set the paths.
configure: error: Please check error messages and install missing packages.

but that is easily fixed by running configure like this:

$ ./configure --with-portaudio-include-dir=/usr/include --with-portaudio-lib-dir=/usr/lib/x86_64-linux-gnu


Compile SD-PEX15022 (MCS9922) drivers for Debian

Recently I purchased a Syba SD-PEX15022 (MCS9922) PCI-e to Serial card for Amateur Radio radio control. Well the drivers that came on the CDRom would not compile and got heaps of errors, any ways after 30 mins or so of trolling the Internet for more update drivers which I found here and they compiled under the 3.0.0-1 kernel with no problems.

In case the drivers go a miss from the above ASIX link you can grab them from here:

UPDATE 2011-12-28
As of the release of the 3.1 Kernel this card now works out the box, so no need to compile the drivers for it if running kernel 3.1 onwards.

Doing ‘lspci -v‘ shows – note the ‘Kernel driver in use:‘. Also the port assignment has change from ‘/dev/ttyF0‘ etc, back to ‘/dev/ttyS0‘ etc.

04:00.0 Serial controller: NetMos Technology PCIe 9922 Multi-I/O Controller (prog-if 02 [16550])
        Subsystem: Device a000:1000
        Flags: bus master, fast devsel, latency 0, IRQ 17
        I/O ports at e880 [size=8]
        Memory at fbffd000 (32-bit, non-prefetchable) [size=4K]
        Memory at fbffc000 (32-bit, non-prefetchable) [size=4K]
        Capabilities: <access denied>
        Kernel driver in use: serial

04:00.1 Serial controller: NetMos Technology PCIe 9922 Multi-I/O Controller (prog-if 02 [16550])
        Subsystem: Device a000:1000
        Flags: bus master, fast devsel, latency 0, IRQ 18
        I/O ports at ec00 [size=8]
        Memory at fbfff000 (32-bit, non-prefetchable) [size=4K]
        Memory at fbffe000 (32-bit, non-prefetchable) [size=4K]
        Capabilities: <access denied>
        Kernel driver in use: serial