Griffin

From Oh Mad Lab
Jump to navigation Jump to search

Giffin - A remote dial-up server

TODO

  • Resolve last boot error

Server Specifications

Brand Model Description Link Price
Died during shipping (Thanks AL!) AMD BE-2400 / ADH2400IAA5DO Athlon 64 X2, Brisbane, 1.25V, 45W, 2.3GHz, 2x512KB L2 Cache, Socket AM2 Dual-Core Manufacture
Purchased
$39.99
AMD Athlon II X4 610e / AD610EHDGMBOX Athlon II X4, Propus, 2.4GHz, L1 4x128KB, L2 4x512KB, 45nm, 64 bit, 45W, 0.775-1.25V Manufacture
Purchased
$115.99
ASUS M3A78-EM AMD AM2+/AM2, HDMI, FSB:2600MHz HT (5200 MT/s)
North Bridge:AMD 780G, South Bridge:AMD SB700
4+1 Phase Power Design
Manufacture
Purchased
$78.99
Kingston HyperX / KHX6400D2/2G 2x2GB 240-Pin DDR2 SDRAM DDR2 800 (PC2 6400), CL5, 5-5-5-15, 2v Manufacture
Purchased
$47.98
Dead as of 11/2012 Seagate Barracuda 7200.11 / ST31500341AS 1.5TB 7200 RPM 32MB Cache SATA 3.0Gb/s
Firmware: CC1H
P/N:9JU308-302
Date Code: 09377
Manufacture
Purchased
$129.99
Mushkin Enhanced Callisto Deluxe / MKNSSDCL120GB-DX Internal Solid State Drive (SSD)
2.5", 120GB, MLC, SATA II, SandForce
Read up to 285MB/s, Write up to 275MB/s
MTBF of 2,000,000 hours
Manufacture
Purchased
$101.88
Seagate Barracuda Green / ST2000DL003 SATA 6.0Gb/s, 2TB, 5900 RPM, 64MB Manufacture
Purchased
$81.18
LG GH22NP20 2MB Cache, IDE, Black, DVD/CD-ROM Burner Purchased $21.99
Arctic Cooling Freezer 64 Pro 92mm, 900-2200 RPM (PWM), 40 CFM Manufacture
Purchased
$29.99
Actiontec PM560LKI Hardware Modem, Rev:A00, V.90/K56Flex 56Kbps, PCI, Data/Fax, Lucent/Agere Venus Chipset, Onboard Controller Manufacture Purchased $14.99 + $5.00 shipping
D-Link DFE-500TX PCI, ProFAST 10/100 Ethernet Adapter Manufacture
Ebay
$4.99
SeaSonic Super Silencer ATX, 400W, PFC:Active, Efficiency:80% Purchased $75.00
Rosewill R901-P BK 3x120mm Fan, .7mm SECC Steel, 9x5.25" Drive Bays, ATX Mid Tower Manufacture
Purchased
$59.99
Generic CACP01HMF Hard Drive Mounting Kit 3.5" to 5.25" bay adapter brackets Purchased $17.39/5

Hardware Configuration

  • I removed the 3.5" bay as it was bulky and blocked air flow. It was replaced with simple 3.5" to 5.25" bay adapters.
  • Both PCI slots are filled. Bottom PCI slot is the Actiontec PM560LKI modem. Top PCI slot is the D-Link DEF-500TX NIC.
  • Top fan was unplugged as it was determined to not help cooling as power supply cables were blocking airflow. It added 3 watts as measured by the kill-a-watt.
  • LG GH22NP20 DVD burner was placed on the top drive bay.
  • Memory was placed in the first two slots leaving two open slots.
  • The smart fan from the 3.5" bay that I removed was reclaimed and swapped for the rear fan. With this swap, I can now see the fan's RPMs.
  • All cables were tied off and tested to ensure they won't touch and fans or heat sinks.
  • Died with no warning!Seagate ST31500341AS hard drive was placed in the 3rd from the bottom bay with the 3.5" to 5.25" adapters.
  • OS Drive: MKNSSDCL120GB-DX (Serial # MKN1247A0000148853) hard drive was placed in the 3rd from the bottom bay with the 3.5" to 5.25" adapters.
  • DATA Drive: ST2000DL003 (Serial # 5YD3452G) hard drive was placed in the bottom bay with the 3.5" to 5.25" adapters.

BIOS Configuration

  • BIOS was upgraded to version 1602 build date 3/27/09, and I tweaked the following settings in the BIOS:
 Main->Legacy Diskette A: Disabled
 Advanced->Chipset->Internal Graphics->Primary Video Controller: IGFX-GFX0-GPP-PCI
 Advanced->Chipset->Internal Graphics->UMA Fram Buffer Size: 64MB
 Power->APM Configuration->Restore on AC Power Loss: Always On
 Boot->Boot Device Priority->1st Boot Device: SATA
 Boot->Boot Device Priority->2nd Boot Device: CDROM
 Boot->Boot Device Priority->3rd Boot Device: Disabled
 Boot->Boot Settings Configuration->Full Screen Logo: Disabled
 Tools->Express Gate: Disabled

*NOTE* DO NOT DISABLE THE "Memory Hole Remapping" AS YOU WILL LOSE 1GB OF RAM
*NOTE* IGFX = Internal Graphics (aka on board), GFX0 = PCIEx16, GPP = PCIEx1, PCI = PCI

Boot Up Errors

  • I installed AMD64 Debian 6.0.7 / Squeeze and I deselected the "desktop" packages as I want to run headless.

Error 1

  • I was seeing the following error at boot up:
 Your BIOS doesn't leave a aperture memory hole
 Please enable the IOMMU option in the BIOS setup
 This costs you 64 MB of RAM
  • To fix the above message, I added "iommu=noagp,noaperture" to the kernel line. Based on some research and a bunch of googling, it appears this issue is somewhat related to the fact that I don't have an AGP card. Either way, the two values for the iommu kernel parameter mean the following:
 noagp = Don't initialize the AGP driver and use full aperture.
 noaperture = Ask the IOMMU not to touch the aperture for AGP.

Error 2

  • I was also seeing the following error at boot up:
 PCI: Not using MMCONFIG.
  • To fix the above message, I added "pci=nommconf" to the kernel line. Based on some research I understand that the "pci=nommconf" parameter tells the kernel to ignore mmconfig when identifying PCI devices, thus it will use other methods to identify PCI devices such as the BIOS or direct querying. With that said, I checked the all the pci devices with "lspci -v" and they all appear to be detected properly with the "pci-nommconf" parameter.

Error 1 & 2 Solution

  • Tweaks to fix the above boot errors is as follows:
 vim /etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="quiet iommu=noagp,noaperture pci=nommconf"
 update-grub

Error 3

  • I then saw the following error:
 Error: Driver 'pcspkr' is already registered, aborting...

Error 3 Solution

  • To fix the above error, I blacklisted snd-pcsp to avoid the conflict during boot, as such:
 vim /etc/modprobe.d/blacklist.conf
  #FLC# Getting rid of error at boot about 'pcspkr'
  blacklist snd-pcsp

Initial Configuration

  • I installed the following packages:
 aptitude install htop rsync ssh
  • Configured sshd to deny remote root login
 vim /etc/ssh/sshd_config
  • Find and change "PermitRootLogin yes" to "PermitRootLogin no", as such:
 PermitRootLogin no

Configuring dial-in server / mgetty / ppp

Server Settings

  • I installed the following packages:
 aptitude install mgetty ppp
  • Querying modem info:
 dmesg | grep "irq = `lspci  | grep Communication | awk '{print $1}' | xargs -n1 -i lspci -v -s {} | grep IRQ | awk -FIRQ\  '{print $2}'`"
 lspci  | grep Communication | awk '{print $1}' | xargs -n1 -i lspci -v -s {} | grep IRQ | awk -FIRQ\  '{print $2}' | xargs -n1 -i grep {} /proc/tty/driver/serial
 cat /proc/interrupts
 cat /proc/tty/driver/serial
  • I determined the modem was on /dev/ttyS1, so I modified initab and uncommented the last line and changed it to ttyS1
 vim /etc/inittab 
T3:23:respawn:/sbin/mgetty -x0 -s 57600 ttyS1
  • Added nasty gram in issue.mgetty
 vim /etc/issue.mgetty
-------------------------
Private server, stay out!
------------------------- 
  • Configured PPP, I changed the /AutoPPP/ line as shown below:

vim /etc/mgetty/login.config

/AutoPPP/ -     a_ppp   /usr/sbin/pppd auth -chap +pap 192.168.0.3:192.168.0.4 login auth debug proxyarp

*NOTE* The first IP is the servers (different from eth) and the second IP is the clients (dial-up)
*NOTE* If I want, I can disable non PAP logins (aka terminals) by changing "/bin/login @" to "/bin/false"

  • Changed the default speed for mgetty
 vim /etc/mgetty/mgetty.config
speed 57600
  • Allowed ppp users
 vim /etc/ppp/pap-secrets
  • Find the section called "Every regular user can use PPP and has to use passwords from /etc/passwd" and change to the following (replace username with actual username, left out here for obvious reaons):
"username"       *       ""      *
  • In order to get routing working, I needed to create the following files:
 vim /etc/ppp/ip-up.local
#!/bin/bash
/bin/echo 1 > /proc/sys/net/ipv4/ip_forward
exit 0
 vim /etc/ppp/ip-down.local
#!/bin/bash
/bin/echo 0 > /proc/sys/net/ipv4/ip_forward
exit 0
 chmod +x /etc/ppp/ip-up.local
 chmod +x /etc/ppp/ip-down.local
 reboot
  • At this point, I can either use a terminal program, such as minicom, to login or I can use ppp

Client Settings

*NOTE* This is *NOT* done on griffin. This is was performed on my lappie that I used as a client to connect to griffen. It's documented here for completeness.
*NOTE* I tried gnome-ppp, but it didn't like my modem for some reason and I didn't care to mess with it at the time as I prefer command line utilities for ease of use via ssh

  • I tested with minicom for fun, then move on to setting up ppp, as such:
 aptitude install ppp pppconfig
  • Configure ppp connection
 pppconfig
  1. Choose "Create Create a connection"
  2. Give it a name, I gave it flc
  3. Choose "Dynamic Use dynamic DNS"
  4. Choose "PAP Peer Authentication Protocol"
  5. Give it the username you defined while editing "pap-secrets" from up above
  6. Password of the usernames account
  7. I left the speed as the default of 115200
  8. I left the default value of "Tone"
  9. Enter the proper phone # of the dial-up server
  10. I selected, no and defined the modem as /dev/ttyUSB0 as I was using my Belkin USB->Serial adapter to a USR Modem
  11. Select "Finished Write files and return to main menu."
  12. Select OK, then "Quit Exit the utility"
  • Now everything was set to connect:
 pon flc
  • I tested ssh into the server's IP 192.168.0.103 and it worked, likewise I tried pinging a server on the network and it responded. I had to set my resolv.conf manually and once I did I was able to, slowly, browse the Internet.
  • To disconnect, use:
 poff flc
  • For logging info, use:
 plog

Headless VirtualBox

  • Get and installed virtual box (not ose as it currently doesn't support RDP for management, which I didn't see any other way to manage as I'm running completely headless)
 wget http://download.virtualbox.org/virtualbox/4.2.10/virtualbox-4.2_4.2.10-84104~Debian~squeeze_amd64.deb
 dpkg -i virtualbox-4.2_4.2.10-84104~Debian~squeeze_amd64.deb
  • Virtual Box wanted some extra packages
 aptitude install libcurl3-gnutls libgl1-mesa-glx libgl1 libpng12-0 libpython2.6 libqt4-network libqt4-opengl libqtcore4 libqtgui4 libsdl1.2debian libxcursor1 libxinerama1 libxmu6 libxt6
  • Setting up the VM
 VBoxManage list vms
 VBoxManage createvm -name "WindowsXP" -register
 VBoxManage modifyvm "WindowsXP" -memory "512MB" -acpi on -nic1 nat
 VBoxManage createhd --filename /share/vm/Windows\ XP\ VM.vdi -size 10240 -register
 VBoxManage modifyvm "WindowsXP" -hda /share/vm/Windows\ XP\ VM.vdi 
 VBoxManage modifyvm "WindowsXP" -dvd /share/Windows.iso 
 VBoxHeadless -startvm "WindowsXP"
  • Remove attached CD
 VBoxManage modifyvm "WindowsXP" -dvd none
  • Port forwarding
 VBoxManage setextradata "<VM NAME>" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/<DESCRIPTIVE NAME>/Protocol" <PROTOCOL>
 VBoxManage setextradata "<VM NAME>" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/<DESCRIPTIVE NAME>/HostPort" <LOCAL/HOST PORT> 
 VBoxManage setextradata "<VM NAME>" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/<DESCRIPTIVE NAME>/GuestPort" <VM/GUEST PORT> 
Example: 
 VBoxManage setextradata "WindowsXP" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/RDP/Protocol" TCP
 VBoxManage setextradata "WindowsXP" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/RDP/HostPort" 13389
 VBoxManage setextradata "WindowsXP" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/RDP/GuestPort" 3389

Windows Guests

  • You need to install the guest additions, mount as such: (then in the guest, go to the dvd and install)
 VBoxManage modifyvm "WindowsXP" -dvd /usr/share/virtualbox/VBoxGuestAdditions.iso

Samba

  • I installed samba to share some miscellaneous files.
 aptitude install samba
 mkdir /share/<some_dir_here_I_aint_tellin>
 chown -R <my_user_account>:<my_group> /share
 vim /etc/samba/smb.conf
  • I changed following options:
   workgroup = asgard
   socket options = TCP_NODELAY
  • I added following options:
   security = user
   guest account = <my_user_account>
  • Add a samba user

UPDATE I changed the "security = user" from above to "security = share" to get Windows to properly mount and then I needed to add a samba user as such:

   smbpasswd -a ohayden
  • I then added the following share:
[share]
   path = /share/<some_dir_here_I_aint_tellin>
   available = yes
   browseable = yes
   public = yes
   writable = no
   guest ok  = yes
   directory mask = 0775

Plex Media Server

 echo "deb http://shell.ninthgate.se/packages/debian squeeze main" | tee -a /etc/apt/sources.list.d/plexmediaserver.list
 aptitude install curl
 curl http://shell.ninthgate.se/packages/shell-ninthgate-se-keyring.key | apt-key add -
 aptitude update
 aptitude install plexmediaserver

nzbget

  • Download latest source from here and push to /share/nzbget/
  • Extract files
cd /share/nzbget
tar zxvf nzbget-11.0.tar.gz
cd nzbget-11.0/
  • Install missing dependencies
su
aptitude install libpar2-0 libpar2-0-dev libxml2-dev libncurses5-dev libsigc++-2.0-dev libssl-dev zlib1g-dev unrar par2
CTRL+D

NOTE: Don't use unrar-free! Sorry but it has a ton of trouble extracting files, where as the proprietary version "just works" (tm)!

  • Compile
./configure

NOTE: It complained about libpar2 not having supplied patches, so I installed libpar2 from source

libpar2

  • Download latest source from here and push to /share/libpar2/
  • Extract files
cd /share/libpar2
tar zxvf libpar2-0.2.tar.gz
cd libpar2-0.2/
cp /share/nzbget/nzbget-11.0/libpar2-0.2-* ./
patch < libpar2-0.2-bugfixes.patch
patch < libpar2-0.2-cancel.patch
./configure
make
su
make install
  • Back to nzbget
cd /share/nzbget/nzbget-11.0/
make
su
make install
  • Setup
  • Copied nzbget configuration file from previous install into /etc folder
  • Startup
vim /etc/init.d/nzbget
#!/bin/sh
# Start/stop the NZBget daemon.
#
case "$1" in
start)   echo -n "Start services: NZBget"
   /usr/local/bin/nzbget -D
   ;;
stop)   echo -n "Stop services: NZBget"
   /usr/local/bin/nzbget -Q
   ;;
restart)
   $0 stop
   $0 start
        ;;
*)   echo "Usage: $0 start|stop|restart"
        exit 1
        ;;
esac
exit 0
chmod 755 /etc/init.d/nzbget
update-rc.d nzbget defaults
/etc/init.d/nzbget start

Sickbeard

Used to track tv shows...

* Written in python and also uses cheetah
* Download source from here https://github.com/midgetspy/Sick-Beard/
aptitude install python-cheetah

CouchPotato

Used to track movies...

aptitude install unzip
wget https://github.com/RuudBurger/CouchPotatoServer/archive/master.zip
unzip master.zip
mv CouchPotatoServer-master/ couchpotato
cd couchpotato
python CouchPotato.py --quiet --daemon

Power Backup

STOPPED HERE ON NEW GRIFFIN CONFIG
STOPPED HERE ON NEW GRIFFIN CONFIG
STOPPED HERE ON NEW GRIFFIN CONFIG
STOPPED HERE ON NEW GRIFFIN CONFIG
STOPPED HERE ON NEW GRIFFIN CONFIG

  • I install the apcupsd package and configured it to call the email_power.sh script below to keep me informed of power outages. Don't forget to have apcupsd load at init.

Final Touch Ups

  • Since this server is going to be 1725+ miles away, I figured it would be best if I ran a burn in test with memtest86+. Why memtest86+ over memtest86? According to wikipedia, the latest version of memtest86 has issues with computer having 4GB of RAM. From wikipedia: "The 3.5 version is known to fail on some (or many, or most) computers with 4 gb of installed memory (the failure results in a spontaneous system reboot soon after the program starts running). The MemTest86+ 2.11 version does not exhibit this behavior."
 apt-get install memtest86+
 cat /usr/share/doc/memtest86+/examples/grub-menu.lst >> /boot/grub/menu.lst
  • Clean up the memtest86+ entry
 vim /boot/grub/menu.lst
  • I ran memtest86+ for 32.5 hours and it had 19 passes all with success. Initial watt usage is about 90 watts.

  • Installed a few more utilities for monitoring and power saving
 apt-get install lm-sensors hddtemp hdparm powertop ethtool
  • Installed even more utilities
 apt-get install screen iputils-arping bwm-ng iftop
  • Added the following to /etc/crontab
 */5  *  * * *   root    /sbin/flc/setip.sh
 0  0    * * *   root    /sbin/flc/setdatetime.sh > /dev/null
 0  2    * * 1   root    /share/backups/backup.sh

/sbin/flc/setip.sh

Private use only - Not documented here.

/sbin/flc/setdatetime.sh

Cheap way of fixing date / time without using a NTP client.

 #!/bin/sh
 # Date-Time by Frank Cardoza (Who needs NTP Client... blah!)
 rdate time.mit.edu &
 rdate tick.greyware.com &
 rdate utcnist.colorado.edu &

/sbin/flc/email_power.sh

The backup of the backups script...

#!/bin/sh

tHostName=`uname -n`
tEmailFrom="$tHostName@crancho.com"

# SEND WARNING EMAIL
echo From: $tHostName > /tmp/err.log
echo To: MY_NAME_HERE >> /tmp/err.log
echo Subject: Power Warning on `date "+%m/%d/%y %l:%M %p"` >> /tmp/err.log
echo "" >> /tmp/err.log
/sbin/apcaccess status >> /tmp/err.log
cat /tmp/err.log | sendmail -f$tEmailFrom -sMAIL_PROVIDER_HERE EMAIL@ADDRESS.HERE

/share/backups/backup.sh

Backup script to archive other backups. Can't have too many remote backups, right?!?!

backupDir="/share/backups"

###############################################################################
# GATHER BACKUPS TO LATEST
###############################################################################

# SYNC THE LATEST DIRECTORY FROM BACKUP SOURCES
syncSuccess=0
$backupDir/synclatest.sh &>/tmp/backup.log && syncSuccess=1

# CHECK FOR AN ERROR DURING THE SYNC: ON ERROR, ALERT AND STOP
if [ $syncSuccess -eq 0 ]; then
   echo -en "From: Backup Archiver <barchiver@griffin.crancho.com>\nTo: MY_NAME_HERE\nSubject: Failure during archival backup\n\n" > /tmp/.backup.mail
   echo -en "Log:\n" >> /tmp/.backup.mail
   echo "---------------------------------------------" >> /tmp/.backup.mail
   cat /tmp/backup.log >> /tmp/.backup.mail
   echo "---------------------------------------------" >> /tmp/.backup.mail
   cat /tmp/.backup.mail | sendmail -farchiver@griffin.crancho.com -sMAIL_PROVIDER_HERE EMAIL@ADDRESS.HERE
   exit 0
fi

###############################################################################
# ROTATE ARCHIVES
###############################################################################
# IF EXISTS, THEN DELETE THE OLDEST BACKUP
if [ -d $backupDir/archive.52 ]; then
   rm -rf
fi

# LOOP THROUGH 51 TO 1 AND ROTATION DIRECTORIES
for index in $(seq 51 -1 1)
do
   # IF EXISTS, THEN MOVE DOWN ONE
   if [ -d $backupDir/archive.$index ]; then
      mv $backupDir/archive.$index $backupDir/archive.$((index + 1))
   fi
done

# HARD LINK LATEST BACKUP TO FIRST ROTATION
cp -al $backupDir/latest /share/backups/archive.1

/share/backups/synclatest.sh

IPAddress_DROW=$( wget -q -nv -O - URL_TO_GET_DROWS_IP_ADDRESS_HERE | cut -d "-" -f 2 | tr -d " " )

cd /share/backups/

mkdir -p /share/backups/latest/dreamhost/
mkdir -p  /share/backups/latest/drow/jailflc
mkdir -p  /share/backups/latest/drow/jailkfc

# Get dreamhost data
echo "Getting dreamhost data..."
rsync -avz -e"ssh -i ./crancho.key" --delete-during --delete-excluded --progress --stats --exclude='/logs/' USER_NAME_HERE@crancho.com:~/* /share/backups/latest/dreamhost/

# Knock DROW
echo "Knocking drow ($IPAddress_DROW)..."
#knock -v $IPAddress_DROW KNOCK_PORTS_HERE
sleep 5
#knock -v $IPAddress_DROW KNOCK_PORTS_HERE
sleep 5
# Get jailflc from DROW
echo "Getting drow data..."
rsync -avz -e"ssh -i ./jailflc.key" --delete-during --delete-excluded --progress --stats USER_NAME_HERE@$IPAddress_DROW:./backup/ /share/backups/latest/drow/jailflc/

# Knock DROW
echo "Knocking drow ($IPAddress_DROW)..."
#knock -v $IPAddress_DROW KNOCK_PORTS_HERE
sleep 5
#knock -v $IPAddress_DROW KNOCK_PORTS_HERE
sleep 5
# Get jailkfc from DROW
echo "Getting drow data..."
rsync -avz -e"ssh -i ./jailkfc.key" --delete-during --delete-excluded --progress --stats USER_NAME_HERE@$IPAddress_DROW:./backup/ /share/backups/latest/drow/jailkfc/

Movie Script

This is used for Al to easily move movies he's seen to the old folder.

  • Install tiny/turbo/throttling HTTP server
 apt-get install thttpd
  • Remove the users directory as it's not needed
 cd /var/www
 rm -r users
  • Create a dummy index.htm to avoid directory listings
 echo I see you\! > index.htm
  • Create the cgi-bin directory
 mkdir cgi-bin
  • Create a dummy index.htm to avoid directory listings
 cd cgi-bin
 echo I see you\! > index.htm
  • Added my el cheapo movie script
 vim movies.cgi
#!/usr/bin/perl -w

$tPath = "/share/movies";

print "Content-type: text/html\n\n<br>";

sub escape
{
  my $str = shift || '';
  $str =~ s/([^\w.-])/sprintf("%%%02X",ord($1))/eg;
  $str;
}

if (($ENV{'REQUEST_METHOD'} eq 'GET') && ($ENV{'QUERY_STRING'} ne ""))
{
  @pairs = split(/&/, $ENV{'QUERY_STRING'});
  foreach $pair (@pairs)
  {
    ($name, $value) = split(/=/, $pair);
    $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
    #print "$name = $value<br>";
    if ($name eq "move")
    {
      if( -d "$tPath/$value")
      {
        system "mv \"$tPath/$value\" \"$tPath/old/\"";
      }
    }
  }
}

print "<script language=JavaScript>";
print "function CheckMove(tFile){";
print "if (confirm('Are you sure you want to move ' + tFile + '?'))";
print "{ document.location = '/cgi-bin/movies.cgi?move=' + tFile }";
print "}</script>";

opendir(DIR, $tPath);
@files = grep(/\.*$/,readdir(DIR));
closedir(DIR);

foreach $file (@files)
{
  if( -d "$tPath/$file")
  {
    if ($file ne 'new' && $file ne 'old' && $file ne '.' && $file ne '..')
    {
      $esc_file = escape($file);
      print "<a href='javascript:CheckMove(\"$esc_file\")'>[MOVE]</a> $file<br>";
    }
  }
}
  • Modified thttpd config
 vim /etc/thttpd/thttpd.conf
  • I changed following options:
 #FLC#choot
 nochoot
 #FLC#user=www-data
 user=ohayden
  • I restarted thttpd to have the new settings take affect
 /etc/init.d/thttpd restart

NOTE: Setting nochoot and changing to user to my account is a major security risk. However, this is minimized as it's only served on the local lan and is closely monitored. Please DO NOT do the above if you provided wan access, otherwise you're begging to get hacked deservedly so.

QoS

This was removed as I decided to use siren (Linksys WRTSL54GS) as the QoS manager to keep it identical to my California setup.

  • Install QoS scripts to shape traffic for VOIP
 apt-get install wondershaper
  • Another version of wondershaper:
 wget http://www.ruwenzori.net/code/wondershaper/wondershaper.jml
  • TODO -- Sort through these Notes:
run a speed test

test with:
  wondershaper eth0 <down> <up>

commands:
  set:   wondershaper eth0 <down> <up>
  clear: wondershaper clear eth0
  info:  wondershaper eth0
modified:
  set:   wondershaper eth0 <down> <up>
  clear: ??
  info:  wondershaper eth0 status


vim /etx/network/interfaces
* Add:
up /usr/sbin/wondershaper eth0 <down> <up>
down /usr/sbin/wondershaper clear eth0

Misc Info

  • Rear serial port:
 /dev/ttyS0, UART: 16550A, Port: 0x03f8, IRQ: 4
  • PCI Modem:
 /dev/ttyS1, UART: 16550A, Port: 0xe800, IRQ: 20
  • In sensors:
    • Fan 1 = CPU fan
    • Fan 3 = Rear case fan
  • Temperature:
    • Sides off:
      • Idle M/B Temp: 30 to 35
      • Idle CPU Temp: 32 to 39
      • Idle H/D Temp: 36 to 37
    • Enclosed:
      • Idle M/B Temp: up to 37
      • Idle CPU Temp: up to 40
      • Idle H/D Temp: up to 39
  • Power Usage:
    • Boot: 60 to 95 watts
    • Idle: 52 to 62 watts

Reclaiming Disk Space

Reserved blocks is defaulted to 5% on ext3, which is a bit high for newer drives nowadays. I pushed mine back to 1% to reclaim a bit of space with the following command

tune2fs -m 1 /dev/sda1

Power Saving

  • Ran sensors-detect for lm-sensors
  • Ran pwmconfig for fancontrol, but it seems to cause the fan to stay at full blast so I deleted the /etc/fancontrol configuration file. I suspect it's conflicting with the BIOS as it appears to want to control the fan. I did figure out that playing with /sys/class/hwmon/hwmon1/device/pwm1 would slow down or speed up the fan by echoing 1 to 255 respectively.
# Enabled for the HDA controller; power down after 10 seconds:
echo 10 > /sys/module/snd_hda_intel/parameters/power_save
# Power down hard drive after 5 minutes:
hdparm -S 60 /dev/sda
# Up kernel caching to 15 seconds:
echo 1500 > /proc/sys/vm/dirty_writeback_centisecs
# Enable laptop mode:
echo 5 > /proc/sys/vm/laptop_mode
# Enable SATA ALPM link power management:
echo min_power > /sys/class/scsi_host/host0/link_power_management_policy
# Enable noatime on filesystem:
mount -o remount,noatime /

NOTE: After testing with a kill-a-watt for a week, the power savings was negligible so I opted not to implement them for now. The only thing I ended up doing was leave one case fan off.

Installing ffmpeg from Source

Install Required Packages

aptitude install libdc1394-22-dev libgsm1-dev libvorbis-dev  nasm

lame

cd /share/ffmpeg
wget http://downloads.sourceforge.net/project/lame/lame/3.98.4/lame-3.98.4.tar.gz
tar xzvf lame-3.98.4.tar.gz
cd lame-3.98.4
./configure --enable-nasm --disable-shared
make
make install

libtheora

cd /share/ffmpeg
wget http://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.gz
tar xzvf libtheora-1.1.1.tar.gz
cd libtheora-1.1.1
./configure
make
make install

x264

cd /share/ffmpeg
wget ftp://ftp.videolan.org/pub/x264/snapshots/last_x264.tar.bz2
tar -jxvf last_x264.tar.bz2
./configure
make
make install

ffmpeg

NOTE: Removed the following: --enable-swscaler --enable-libfaac --enable-libopencore-amrnb --enable-libx264 --enable-libmp3lame

cd /share/ffmpeg
wget http://ffmpeg.org/releases/ffmpeg-0.8.tar.gz
tar zxvf ffmpeg-0.8.tar.gz 
cd ffmpeg-0.8/
./configure --disable-mmx --enable-nonfree --enable-libvorbis --enable-libtheora --enable-shared --disable-static --enable-pthreads --disable-stripping --enable-libdc1394 --enable-libgsm --enable-gpl --enable-postproc --enable-x11grab --enable-version3 --prefix=/usr
make
make install

Unresolved issue

Boot error as follows:

[    2.870742] ata1: SATA max UDMA/133 abar m1024@0xfbaff800 port 0xfbaff900 irq 22
[    2.870746] ata2: SATA max UDMA/133 abar m1024@0xfbaff800 port 0xfbaff980 irq 22
[    2.870749] ata3: SATA max UDMA/133 abar m1024@0xfbaff800 port 0xfbaffa00 irq 22
[    2.870753] ata4: SATA max UDMA/133 abar m1024@0xfbaff800 port 0xfbaffa80 irq 22
[    3.375977] ata1: softreset failed (device not ready)
[    3.375977] ata1: failed due to HW bug, retry pmp=0
[    3.547975] ata1: SATA link up 3.0 Gbps (SStatus 123 SControl 300)
[    3.575976] ata1.00: HPA detected: current 2930277168, native 18446744072344861488
[    3.575976] ata1.00: ATA-8: ST31500341AS, CC1H, max UDMA/133
[    3.575976] ata1.00: 2930277168 sectors, multi 16: LBA48 NCQ (depth 31/32)
[    3.615972] ata1.00: configured for UDMA/133

I tried the following:

  • Add all_generic_ide to kernel line in /boot/grub/menu.lst with no change in error.

I found the following: http://kerneltrap.org/mailarchive/git-commits-head/2008/6/14/2122314, but I haven't tried it.


New 6TB Drive

 parted -a optimal /dev/sda
 mklabel gpt
 mkpart primary ext4 1 -1
 quit
 mkfs.ext4 /dev/sda1
 mkdir /share/mount
 mount /dev/sda1 /share/store
 lsblk -io NAME,SIZE,TYPE,MOUNTPOINT,MODEL,UUID
  • Take note of UUID
 vim /etc/fstab
  • Add the following (UUID was 543c0747-6c25-4934-a3b5-29b3c191cab7):
 # 6TB Drive
 UUID=543c0747-6c25-4934-a3b5-29b3c191cab7 /share/store ext4 errors=remount-ro 0 1