Tag Archives: Debian

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?
RUN_AT_STARTUP="YES"</blockquote>

# nano /etc/init.d/deluged

#!/bin/sh
### BEGIN INIT INFO
# 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.
### END INIT INFO

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

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DESC="Deluge Daemon"
NAME1="deluged"
NAME2="deluge"
DAEMON1=/usr/bin/deluged
DAEMON1_ARGS="-d -L warning -l /var/log/deluge/deluged.log"             # Consult `man deluged` for more options
DAEMON2=/usr/bin/deluge-web
DAEMON2_ARGS="-L warning -l /var/log/deluge/web.log"               # Consult `man deluge-web` for more options
PIDFILE1=/var/run/$NAME1.pid
PIDFILE2=/var/run/$NAME2.pid
UMASK=022                     # Change this to 0 if running deluged as its own user
PKGNAME=deluged
SCRIPTNAME=/etc/init.d/$PKGNAME

# 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" ]
then
   log_warning_msg "Not starting $PKGNAME, edit /etc/default/$PKGNAME to start it."
   exit 0
fi

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

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

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

   is_alive $PIDFILE1
   RETVAL1="$?"

   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
       RETVAL1="$?"
   else
       is_alive $PIDFILE2
       RETVAL2="$?"
       [ "$RETVAL2" = "0" -a "$RETVAL1" = "0" ] && return 1
   fi

   is_alive $PIDFILE2
   RETVAL2="$?"

   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
        RETVAL2="$?"
   fi
   [ "$RETVAL1" = "0" -a "$RETVAL2" = "0" ] || return 2
}

#
# Function that stops the daemon/service
#
do_stop()
{
   # 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
   RETVAL2="$?"
   start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --user $DELUGED_USER --pidfile $PIDFILE1
   RETVAL1="$?"
   [ "$RETVAL1" = "2" -o "$RETVAL2" = "2" ] && return 2

   rm -f $PIDFILE1 $PIDFILE2

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

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

:

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

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

Logrotation

# nano /etc/logrotate.d/deluged
/var/log/deluge/*.log {
        weekly
        missingok
        rotate 7
        compress
        notifempty
        copytruncate
        create 600
}

Now to see that it all works

# invoke-rc.d deluged start

Reference
http://dev.deluge-torrent.org/wiki/UserGuide/InitScript/Ubuntu

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

localip 172.16.100.1
remoteip 172.16.100.200-250

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
nodefaultroute

to

# Debian: do not replace the default route
#nodefaultroute

and don’t forget to restart pptpd ;-)

Reference
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

Reference:
Using Hardware Devices

Softrock RX Ensemble II HF Receiver build and Quisk Config

Yesterday my Softrock RX Ensemble II HF Receiver arrived from Five Dash Inc. in the US within ten days and was very well packed. Any way like most grown men with a new toy I descided to take the day out and build it, the took me about 15 hours in total. The guide by WB5RVZ is comprehensive and easy enough to follow in a half dozen so steps. I also have a nice box for the Ensemble II RX coming from the KM5H store and it will make it to be a nice looking package.

Here are some pics from the build


Continue reading

SeaSDR_40 and Quisk

My SeaSDR_40 kit arrived from Italy. Last night I finished off building the kit together, the is rather easy to put together and the only real thing to watch out for is the toriod with the primary and secondary windings on it, to soldering it in correctly.

I also got the SeaSDR_40 working with Quisk by only having to make a couple minor alterations to the ~/.quisk_conf.py file.

near the top of the file I changed the hardware import

import quisk_hardware_model as quisk_hardware

to

import quisk_hardware_fixed as quisk_hardware

This will allow you to have frequency shown in Quisk based on the VFO of the SeaSDR_40.

To alter the VFO to that of the SeaSDR_40 change

fixed_vfo_freq = 7056000

to

fixed_vfo_freq = 7080500

All that is left for me to do is buy a metal box to mount the board into with some socket and connectors.

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

lsusb:


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

Reference:
http://forum.dug.net.pl/viewtopic.php?id=20461&p=1

[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.
auto_connect='y'

....

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

....

# 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
randomize_check_host='y'
....

Also I added to my root crontab for updates

# crontab -e

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

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

[Link] First “Squeeze”-based Debian Edu version released

The Debian Edu Team is pleased to announce the release of Debian Edu “Squeeze” 6.0.4+r0! Debian Edu (aka “Skolelinux”) is a Debian Pure Blend specifically targeted at schools and educational institutions, and provides a completely configured school network environment out of the box. It covers PXE installation, PXE booting for diskless machines, and setup for a school server, for stationary workstations, and for workstations that can be taken away from the school network. Several educational applications like Celestia, Dr. Geo, GCompris, GeoGebra, Kalzium, KGeography and Solfege are included in the default desktop setup.

Read full story

Nouveau GLX problems

Well switching from nVidia propietry drivers to the open source Nouveau drivers for nVidia GPU’s I found I had no 3D acceleration, and when running glxinfo etc I was getting

Error: couldn't find RGB GLX visual or fbconfig

And in Xorg.log.0 output file I was seeing

Failed to load module "glx" (loader failed, 7)

Turns out after stuffing around trying to find a solution, I did a search to find the package that held libglx.so and that was in the xserver-xorg-core. Well I reinstalled xserver-xorg-core and it fixed the problem and I now have 3D goodness :-)

# apt-get install --reinstall xserver-xorg-core