Frankie's Blog
Finally managed to get the netbook onto my rsnapshot backup scheme. As I talked about in this post, there are issues trying to backup machines with rsnapshot that use WOL or are wireless netbooks that are sometimes on and sometimes not.
So, I wrote a script that constantly polls for a machine and backs it up if it is one the network (detailed in the linked post above).
But now... a new challenge. This netbook runs windows... and it is wireless so WOL is not really an option... AND.. it is XP home edition, so the samba sharing is not really what I would like. This means I need a rsync server on the windows netbook.
Downloaded and installed cwrsync server. Read through the documentation and this by itself just looks like a gigantic security hole, especially for a travelling netbook. So, I also installed copssh, an ssh server for windows, and then did the following:
Step 1: Install copssh and cwrsync server Step 2: Configure cwrsync to only allow hosts "127.0.0.1" which is localhost Step 3: Configure ssh keys for key based login Step 4: Change copssh to run on non-standard ssh port Step 5: Configure .ssh/config to specify the username and port to use when connecting Step 6: Modify the rsnapshot script I presented in the linked post to open up an ssh tunnel before running rsnapshot, and then to kill the tunnel afterwards Step 7: Create an rsnapshot configuration file but specify the host as "localhost" since the tunnel will provide the mechanism to the netbook
Ultimately, this seems to work pretty nice. When I catch the netbook powered on and on the network, and it hasn't been backed up recently, I back it up through an encrypted ssh tunnel. The rsync is protected by the windows firewall and the host blocking line. The ssh server is protected by running on a non-standard port, by having the nonstandard port firewall entry in Windows restricted to the two hosts I might ssh from, and using key based login. Lastly, all the transmitted info is encrypted.
For those interested, here is the mods to the previous script I presented:
rsnapshot_wrapper_some_machine.csh: ... previous script stuff ...
ping -qnc 1 some_machine > /dev/null if ($?) then # If it has been more than a couple of days, alert the admin if ( $time_since_last_success > $warn_secs ) then echo "some_machine failed. Consider manual run" echo "some_machine failed. Consider manual run" >>/var/log/rsnapshot else echo "some_machine not awake. Exiting..." >> /var/log/rsnapshot endif else echo "Found some_machine... Attempting backup..." >> /var/log/rsnapshot cd -
# Kill any old zombie tunnels ps ax |grep "ssh" |grep "somehost |awk '{print $1}' |xargs -i kill {}
# Establish the tunnel ssh -f -N -L 873:localhost:873 user@some_machine
# Run the rsnapshot job rsnapshot -c /etc/rsnapshot.conf.some_machine $1
# Kill the tunnel ps ax |grep "ssh" |grep "somehost" |awk '{print $1}' |xargs -i kill {}
... rest of script ...
Seems to be working! Labels: house, ideas, linux, programming
I love Android, but I'm also very excited about this phone. I may consider switching if it comes to T-Mobile!!
You gotta love competition.
http://www.engadget.com/2009/08/27/nokia-n900-running-maemo-5-officially-500-in-october/ Labels: Android, happy, linux
I really like my T-Mobile G1 Google phone. It has been working really well for me. I'm making this post from it :) Labels: Android, Google, happy, linux
On the computing front, got around to trying a couple of things.
A while back, I set up some simple software to use talk to X10 plugs from the computer so that I could schedule things (such as the Christmas tree turning on and off). I detailed it on this project page.
But now that my windows machines on all hibernate and use power saving features, the only machine that is on all the time is my linux server. I needed to move over the scheduling to the linux machine with some simple cron jobs.
And with this small software called BottleRocket, this was super easy. Now, turning on the Christmas tree (device a1) is as simple as:
> /usr/local/bin/br a1 on
Awesome. Next up is to fix another issue caused by my windows machines constantly hibernating. Backups. My current backup solution uses a really sweet piece of software called rsnapshot which uses a backup concept of rsync combined with hard links for super fast and super efficient backups. The only problem is, if the machines aren't on, then the backups fail. I have some of them using Wake-On-Lan (WOL) so that I can wake them up before I back them up, but if one machines takes a long time to backup, then the others could go back to sleep. Also, I have one machine which does not support WOL. So, I started looking into BackupPC. This is a very highly rated backup system that is open source and very useful in enterprise environments. It supports the same concept as rsnapshot (rsync and hard links to de-duplicate data), but it also is set up to find machines when they are available on the network and back them up, which is what I need. Long story longer, I fought with this ALL weekend. I actually got everything working with BackupPC. It does what I needed. But, the last part of my backup solution that I need is access to the snapshots so that I can duplicate it to an external hard drive when we evacuate for a hurricane, or just for archival. This is where the BackupPC finally convinced me to go back to rsnapshot. BackupPC mangles the filenames in the backups. They have a reason for it: it is so they can differentiate between backed up files and their own attrib files. Plus, since their access to the data is supposed to be through the website, this should be a non-issue. But for me, I don't even need the website. I'm the only one at home accessing backups. Also, in a lab environment, it is nice to let people mount the backup volume as read only and have access to it. With the file name mangling that BackupPC does, this does not work. So, after an entire weekend of configuring, messing, trying, and testing, I decided to go back to rsnapshot, which of course left me with my original problem. So, I had to add some wrappers around rsnapshot to make it smart. For the machine that doesn't support WOL, I needed to do something exactly like BackupPC. That is, I need to run a job often and check and see if the machine is available on the network. If it is, and it has been a while since it was backed up, then it needs to get backed up. If it isn't online, or if it was backed up recently, then it needs to get skipped. In case anyone is interested, here is the csh wrapper script I am using in a hourly cron job to accomplish this. Since it is being run from cron, anything printed to stdout will get mailed to the system administrator email. So, if I detect that it hasn't been backed up in quite a while, I alert the administrator. (NOTE: The script needs a little cleaning... a few of the items in here should be in configurable variables, such as the log file to append to and the machine name. Apologies.) rsnapshot_wrapper_some_machine.csh:#!/bin/csh -f
if $1 == "" then echo "usage: $0 " exit endif
########################################## # # # some_machine # # # ##########################################
set current_time_string = `date` echo " " >> /var/log/rsnapshot echo " some_machine $1 attempt at $current_time_string" >> /var/log/rsnapshot
if (-f /var/log/rsnapshot_some_machine_last) then set last_success=`cat /var/log/rsnapshot_some_machine_last` else set last_success=0 endif
set current_time=`date +%s` @ threshhold_secs = 60 * 60 * 23 @ warn_secs = 60 * 60 * 72 @ time_since_last_success = $current_time - $last_success
if ( $time_since_last_success > $threshhold_secs ) then # Wake up machine echo "Waking up some_machine..." >> /var/log/rsnapshot wakeonlan 00:00:00:00:00:00 >> /dev/null echo "Sleeping ..." >> /var/log/rsnapshot sleep 35 echo "Done sleeping. Attemping to find via ping..." >> /var/log/rsnapshot ping -qnc 1 some_machine > /dev/null if ($?) then # If it has been more than a couple of days, alert the admin if ( $time_since_last_success > $warn_secs ) then echo "some_machine failed. Consider manual run" echo "some_machine failed. Consider manual run" >>/var/log/rsnapshot else echo "some_machine not awake. Exiting..." >> /var/log/rsnapshot endif else echo "Found ping. Attemping to automount..." >> /var/log/rsnapshot cd /misc/some_machine/ touch foo echo "Found automount... Attempting backup..." >> /var/log/rsnapshot cd -
# Run the rsnapshot job rsnapshot -c /etc/rsnapshot.conf.some_machine $1
# Save the successful backup time date +%s > /var/log/rsnapshot_some_machine_last
set current_time_string = `date` echo "some_machine $1 done - $current_time_string" >>/var/log/rsnapshot endif else echo "Not enough time has passed for some_machine." >> /var/log/rsnapshot endif
Seems to be working. I'm a little less stressed now. Labels: linux, power usage, programming
Worked on trying to get a couple of my windows machines go to sleep when not being used and have the file server automatically wake them up when doing backups or virus scans. Hopefully this will save considerable power. Figured out how to get automount to work for the samba shares (mainly just setting up /etc/auto.misc). My only problem now is that my rsnapshot backup utility lets me run a script before running the entire backup, but not before each host. Changed my preexec script this morning to not only wake up the machines, but to also cd into the directories so that rsnapshot would see them as existing. Hopefully this will work better tonight.
I'm also having problems with my Dell Dimension 9150 staying asleep. I guess I'll just have to keep fiddling with settings.
Also, made my way into the garage for a bit to try and set up the old software for P.E.A.R.T. from long ago. Let's just say we weren't exactly creating a commecial software product!! After I get the software working, I still need to get a drum set, and a bunch of mic stands. Labels: house, linux, peart
I installed Ubuntu Gutsy Tribe 5 (an alpha release) on my ASUS G2S. Things all seem to be working except the NVIDIA driver. Actually, it looks like the NVIDIA driver is working, but I just can't get the xorg.conf settings correct. Not sure what the problem is. For now, I fell back to running the VESA driver at 1920x1200.
Wow that's a big resolution. It really hits home when you start typing in a terminal :)
Sound seems to work. Also, wireless is detected and is working, but for some reason, my encryption key is not being accepted for my WEP encrypted wireless network. I haven't tried my network without encryption yet, so I don't know if this is a Ubuntu software problem, a configuration problem, or a wireless driver problem. It does detect the wireless networks though, so it seems like the wireless driver is working.
If anyone gets their G2S running with the NVIDIA proprietary driver, please let me know. Labels: ASUS G2S, linux, Ubuntu
ok, i fixed the clock problem... turns out I had to run tzconfig as root instead of running tzselect. Labels: home theater, htpc, linux, mythTV
I have been building/tinkering with a HTPC in my house for a few months now. My initial goal was to get a really nice mythTV setup in the house, but I have come to realize how young mythTV and linux drivers are (when it comes to HDTV that is... many of the regular tuners work much better since you can actually do decoding on the card and the hardware issues are much more familiar to developers).
After trying a few different mythTV setups on various OSes, I ran with mythTV on a xubuntu install for a while. I eventually punted, installed windows XP, and tried out the new open source contender for windows, Media Portal. I believe this project is from the same guy who started the XBMC (Xbox Media Center) project, which I absolutely love.
I tried Media Portal for a while, but it only detected one of my tuners (I am using a Kworld ATSC 110 and an Avermedia a180 - both HDTV tuners). Also, after watching TV playback for a while, it would freeze. The advantages of having windows drivers was obvious though: the performance was much better and CPU usage much lower. I wish it would have worked better.
My next thought was to buy an OEM copy of Windows Media Center Edition. I have heard good things about it and it would be nice to have this integrate seamlessly with other computers in the house, especially once Vista rolls around. But, then something changed my short-term plans... the Saints are playing in the NFC championship!!! The friggin' Saints!!! I needed something ready so I can watch the game on my big screen, and since Media Portal had the lockup issues, that was out of the question. The game will be played on Fox, which is one of the channels that the mythTV setup played well, so I decided to go back to the mythTV setup temporarily so I could watch the game.
I decided to try KnoppMyth for the second time. I had tried it once in the past and it was a nightmare for me. Of course, at that time, I knew nothing about the driver support for my tuners and nothing about mythTV. This time around, things were different. I managed to get things working pretty well and now some of my previous mythTV issues are gone as well!!! Maybe I will stick with mythTV a little longer.
To get things working in KnoppMyth (I am using the R5E50 release), I did have to do some work. First off, my first tuner was getting detected as a "V-Stream Studio TV Terminator"!!!
dmesg output:
saa7133[0]: subsystem: 1461:1044, board: V-Stream Studio TV Terminator [card=65,insmod option]
After quite a bit of digging, I noticed that one of the init scripts, /etc/init.d/KnoppMyth-tv, was calling a script way down at the bottom called "/usr/local/bin/tvterm.sh". Looking at that script, I saw: /usr/local/bin/tvterm.sh:
#!/bin/bash lspci | grep SAA7133/SAA7135 > /tmp/tvterm if [ ! -s /tmp/tvterm ]; then exit else echo -e "\033[1mSetting up Studio TV Terminator.\033[0m" rmmod saa7134 &> /dev/null modprobe saa7134 card=65 fi
Well, duh! The script greps lspci output for 7133/7135 chipsets and then assumes it is a Studio TV Terminator card!! At least I guess you could say the script is appropriately named though, as it did terminate my tv experience. :) To fix, I simply commented out the call to tvterm in the KnoppMyth-tv init script. Then, I set up an init script to call "modprobe saa7134-dvb". I did some other stuff in there that is probably unnecessary, but here it is (I put it in /etc/init.d, then ran update-rc.d to include it as an init script): /etc/init.d/saa7134-dvb-install.sh:
#! /bin/sh
echo "In my saa7134 installer script ..."
echo "Loading module saa7134 ..." modprobe saa7134
echo "Running depmod -a" depmod -a
echo "Loading module saa7134-dvb ..." modprobe saa7134-dvb
Next, I had to get my xorg.conf set up for my projector. I got the modeline setting for my InFocus SP-4805 projector off the web, but after putting it in, I was getting the wrong screensize even though the projector was reporting an 854x480 resolution. Finally, I fixed it by removing 800x600 as an option in the screen section. Now, my "Monitor" and "Screen" sections in my xorg.conf look like this: /etc/X11/xorg.conf:
... Section "Monitor" Identifier "SDM-M51D" Option "VendorName" "Infocus SP4805" Option "ModelName" "Generic Autodetecting Monitor" Option "NoDDC" "1" Option "IgnoreEDID" "true" Option "UseEdidFreqs" "false" Option "DPMS" "false" HorizSync 25 - 80.0 VertRefresh 50.0 - 85.0 Modeline "848x480" 37.293 848 936 984 1104 480 508 509 563 +hsync +vsync EndSection
Section "Screen" Identifier "Default Screen" Device "Generic Video Card" Monitor "SDM-M51D" DefaultDepth 24 SubSection "Display" Depth 1 Modes "848x480" "720x400" "640x480" EndSubSection SubSection "Display" Depth 4 Modes "848x480" "720x400" "640x480" EndSubSection SubSection "Display" Depth 8 Modes "848x480" "720x400" "640x480" EndSubSection SubSection "Display" Depth 15 Modes "848x480" "720x400" "640x480" EndSubSection SubSection "Display" Depth 16 Modes "848x480" "720x400" "640x480" EndSubSection SubSection "Display" Depth 24 Modes "848x480" "720x400" "640x480" #Modes "720x400" "640x480" EndSubSection EndSection ...
After that, things are working pretty well. I believe I am all set up for the big Saints game at least. I still have a problem with my clock setting. I cannot understand why after all these years it is still as hard and complicated as it is to set the darned time on a linux box. If anyone is having any problems with their KWorld ATSC 110 or the AverMedia a180, let me know and I can see if I can help. Also, if anyone has gotten their Kworld remote to work, please pass the info along. I hear there is a kernel patch floating around to enable support for it, but I am hesitant to try patching the kernel right now since things are working. Labels: home theater, htpc, linux, mythTV
Archives
Last Modified: 02.05.10
|