Friday, March 19, 2010

MythTV for Dummies

What is MythTV?

If you are reading this you probably know, but if you don't . ... well it is a kind of a TivO and a home-media center combined in one. Think of it as a replacement for your PVR box, except with the right hardware, you can watch your recordings or live TV from any TV (or computer) in the house. All the channel changing and recording of programs is done by one computer, and you can watch everything (recordings and live tv) from any computer in your house.

Whereas there are a lot of very good guides out there for installing MythTV, there seems to be no bulletproof guide out there. This is most likely because everyone has a different setup, and MythTV attempts to support all the hardware out there.

Well, then why MythTV for dummies? I will attempt in this article, when it is to dispell a lot of misinformation, and provide guidance on how I installed it on a server (in my case a linux Server running ubuntu 9.10). With this I can watch TV or recording from any of your PCs or MACs in the house, or from any TV connected to a "Myth FrontEnd".

Stay tuned.

Note: Due to a business trip to Germany, I won't be able to write this up until I get back, some time in mid-may. Sorry about that.

Thursday, March 18, 2010

Scanning from my Macs over the network

My Ubuntu Server (running Karmic Koala 9.10) is connected to a usb scanner.

I wanted to be able to scan from any Mac on the same network. It was pretty easy to set up.

Server Side Setup (on the Ubuntu Linux machine)
  • Plugged in my CanoScan LIDE 25 into my linux box.
  • Made sure I could use it by selecting Applications, Graphics, then Xsane Image Scanner
  • Worked fine.
The next step was to make the scanner accessible over the network. I used this article. It worked for me without a hitch.

The server is set up. Now time to set up the Macs

On the Mac(s)

On the Mac computer that you want to use the scanner, download and install all the following packages (the binaries, not the SDK) from here . Choose the appropriate one for your version of Mac OS X.

gettext
libusb
SANE Backends
SANE Preference Pane
TWAIN SANE Interface

Open up System Preferences, and select SANE




In the SANE Pref Pane, Make sure "net" is selected. I deselected everything else too.


Click on the "configure" dot in the column beside it.

This should open up /usr/local/etc/sane.d/net.conf. At the bottom of this file, put in the IP of your linux server.


Open up image capture (Finder, Applications, Image Capture).

A pop up should come up telling you there is no image capture device connected. Doesn't matter.

Select Devices, Browse Devices. You should see SANE show up under TWAIN Data Sources. Select Use TWAIN UI.


Happy scanning!

Problems

Look at the FAQ section of the "Twain Sane Interface" webpage.

If you are not able to use the scanner with Image Capture, it probably has something to do with what is in the file: /Library/Image Capture/TWAIN Data Sources/SANE.ds/Contents/Info.plist, on your MAC.

I was able to find my device's id's in here but you may not. In this case I would add them.

To find the device id's, on the server:
aleem@sidi-desktop:~$ lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 003: ID 04a9:2220 Canon, Inc. CanoScan LIDE 25
Bus 003 Device 002: ID 03f0:0d17 Hewlett-Packard LaserJet 1012
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

Make sure there is an entry for this device on the Mac in the file /Library/Image Capture/TWAIN Data Sources/SANE.ds/Contents/Info.plist. In my case the relevant section looks like this:
<dict>
<key>device type</key>
<string>scanner</string>
<key>product</key>
<string>0x2220</string>
<key>vendor</key>
<string>0x04a9</string>
</dict>

Monday, March 15, 2010

Perfect Coffee?

OK so we all know how to make an espresso in an espresso machine, or make coffee in a french press. But do you ever wonder what the right amount of coffee to use is? Or what you can do to make a perfect coffee?

Ever heard of a "pour-over coffee" or a "siphon"?

I found this site and followed the instructions. Worked out pretty well for me.

Setting up a Time Machine server on Ubuntu 9.10 or 10.04

After looking at several websites, most notably kremalicious, bob's notepad, I finally figured out the easiest way to set up my Ubuntu 9.10 server as a time machine server today. The older methods no longer apply when using netatalk 2.0.5.

This new easy way uses the latest netatalk 2.0.5 which has a new option called the "timemachine" option (options:tm). Unlike previous versions, this version does not need to be recompiled with "ssl" support because it is using a new library (uams_dhx2). This library allows me to login from both my Mac computers running 10.5.8 and 10.6.2.
aleem@sidi-desktop:~$ ps -ef | grep afpd
root 25883 1 0 01:38 ? 00:00:00 /usr/sbin/afpd -U uams_dhx2.so,uams_clrtxt.so -g nobody -c 50 -n sidi-desktop
Here is how to do it.

Install and Configure Netatalk

If you are using Ubuntu 9.10, like I am, then you need to get and install the following 3 packages from packages.debian.org, in this order. Ignore the message from the package installer that tells you there is an older version in the repository that is recommended.

libdb4.8
libgcrypt11
netatalk2.0.5

If you are using Ubuntu 10.04, just open up synaptic package manager, and download/install the netatalk package. Its that simple.

That's basically it. Keep the files /etc/default/netatalk, /etc/netatalk/afpd.conf, as the defaults. The only file that has to be changed is /etc/netatalk/AppleVolumes.default. My files look like this. (important bits shown):

/etc/default/netatalk:

Notice that #AFPD_UAMLIST is commented out (default)
Notice that
AFPD_RUN=yes
# specify this if you don't want dhx and dhx2
# available options: uams_guest.so, uams_clrtxt.so,
# uams_dhx.so, uams_dhx2.so,
# uams_randnum.so
#AFPD_UAMLIST="-U uams_dhx2.so,uams_clrtxt.so"

# Change this to set the id of the guest user
AFPD_GUEST=nobody
# Set which daemons to run (papd is dependent upon atalkd):
ATALKD_RUN=no

PAPD_RUN=no

CNID_METAD_RUN=no

AFPD_RUN=yes

TIMELORD_RUN=no
A2BOOT_RUN=no
/etc/netatalk/afpd.conf:

Leave the last line commented out (which is how it is if you didn't touch anything).
Basically everything in this file is commented out
# - -transall -uamlist uams_dhx.so,uams_dhx2.so -nosavepassword
/etc/netatak/AppleVolumes.default:

In my case, I created a brand new partition called /TimeMachine on my Ubuntu linux server. You can specify any directory on your linux box as long as everyone has read/write permissions on it.
# By default all users have access to their home directories.
#~/ "Home Directory"
/TimeMachine "TimeMachine" options:tm
You can replace /TimeMachine with a directory in your home drive, example :
/home/aleem/TimeMachine "TimeMachine" options:tm
The important bit here is the "options:tm" part. Other than that, nothing else needs to be speicified.

Also make sure everyone has read/write permissions to the directory you are sharing:
aleem@sidi-desktop:/$ ls -la | grep TimeM
drwxrwxrwx
10 root root 4096 2010-03-15 13:43 TimeMachine
In order to have read/write permissions to the directory you need to do:
aleem@sidi-dekstop:/$ sudo chmod a+rw /TimeMachine
(or /home/aleem/TimeMachine, whatever you decided was your directory)

In case you're interested, the filesystem on which my TimeMachine directory lies is formatted ext3.

After modifying this file (AppleVolumes.default), just restart netatalk:
aleem@sidi-dekstop:/$ sudo /etc/init.d/netatalk restart
You should see the apfd daemon running at this point:
aleem@sidi-desktop:/$ ps -ef | grep afpd
root 25883 1 0 01:38 ? 00:00:00 /usr/sbin/afpd -U uams_dhx2.so,uams_clrtxt.so -g nobody -c 50 -n sidi-desktop
If all is good at this point, you should be able to go on any mac on your network and connect to the directory that you shared.

Do this by opening a finder window and selecting "Go, Connect to Server...". Under "Server Address" you should put in the IP of your linux server:

In my case:

Server Address: afp://192.168.2.11

Finder should ask you to login. Use any login name for a valid user on your linux box. This is the username/password you use to log into your ubuntu session.

If everything worked out well, you should be seeing the contents of your empty TimeMachine directory on your mac. Check to see you can create a file in this directory (to make sure you have read/write permissions).

If you were not able to log in, (your Mac told you your username/password were wrong, or something else happened) look in /var/log/daemon.log on your linux server. There are often very useful debug messages at the bottom of this file.

Configure Avahi

The next step is to make the share just show up on the side of your MAC finder windows under "SHARED", so that you don't have to go and select "Go, Connect to Server..." as we did above.

If all your packages are up to date on Ubuntu 9.10, avahi is already installed. All you have to do is create a file called /etc/avahi/services/afpd.service with the contents.

(taken straight out of this article)
aleem@sidi-desktop:/etc/avahi/services$ sudo gedit afpd.service
<service-group>
<name replace-wildcards="yes">%h</name>
<service>
<type>_afpovertcp._tcp</type>
<port>548</port>
</service>
<service>
<type>_device-info._tcp</type>
<port>0</port>
<txt-record>model=Xserve</txt-record>
</service>
</service-group>
At this point, no need to restart avahi, your server should automatically pop up on the left hand side of your Mac Finder window. In my case it's called "sidi-desktop".


Make your Mac Use Network Volumes for Time Machine Backups

At some point it was important to run this command on your Mac using Terminal (Applications, Utilities, Terminal). However with the "options:tm" specified above, this is no longer necessary.
[aleems-mac-mini: ~] aleem% defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1
(no longer need to type this in Terminal)
Open up Time Machine Preferences on your Mac and Select your TimeMachine volume to back up

So that's it! Nothing more. Now you can go to your Time Machine settings on the Mac, and your TimeMachine share should show up. If it doesn't make sure it is mounted in finder (i.e. it appears with an eject symbol next to it on the left side of the finder window under SHARED)


Have fun backing things up.