Wednesday, December 28, 2011

Fedora 15 installation notes

These are some notes for my Fedora 15 setup.  Not very interesting, just a reminder of the steps I need to perform to get a fresh system up and running.


  1. read release notes
  2. read bug list
  3. install Software Development packages
  4. set network proxy (if installing at corp)
  5. enable network card - activate on boot
  6. edit /boot/grub/menu.lst
  7. add xterm to task bar, change default profile to unlimited, 9pt font
  8. add System Monitor to taskbar, change prefs to all monitors
  9. add my user to sudoers "su -", then edit /etc/sudoers
  10. download and install VMware Player "sudo sh VMwarePlayer.bundle"
  11. setup ntlmaps (if installing at corp), point firefox to use localhost:5865
  12. add free/non-free repos
  13. setup Google yum repo, download Chrome
  14. setup Google as default home page in Firefox
  15. install cinelerra dependencies
  16. download cinMonty
  17. compile cinMonty ( --disable-mmx/make install)
  18. update VMware Tools
  19. remove nouveau (rpm -e xorg-x11-drv-nouveau --nodeps, nouveau.modeset=0 rdblacklist=nouveau in grub, yum install kmod-nvidia)
  20. install NVidia driver
  21. install rdesktop, setup sessions
  22. setup .bashrc with aliases
  23. install iptraf, mplayer, libcurl, iotop, ImageMagick, xfce4, xfce4 power, session and window managers
  24. run update
  25. System -> Sessions and Startup -> Auto save session on logout
  26. install system-config-lvm
That will provide for a decent base Fedora system.

Tuesday, December 27, 2011

scary awk magic

AWK is quite a powerful program that can do all sorts of gymnastics with structured text files.  Here's one example.

Say you have a file with four columns (depicted below) delimited by tabs:
-an id field
-a JSON string of dates
-another JSON string of values associated to those dates
-a last column that has the total of those values in column 3

Source File
6237    [20111102,20111103,20111104,20111105,20111106,20111107,20111108,20111109,20111110,20111111,20111112,20111113,20111114,20111115,20111116,20111117,20111118,20111119,20111120,20111121,20111122,20111123,20111124,20111125,20111126,20111127,20111128,20111129,20111130,20111201,20111202,20111203,20111204,20111205,20111206,20111207,20111208,20111209,20111210,20111211,20111212,20111213,20111214,20111215,20111216]  [286,291,276,274,339,424,428,408,458,401,354,398,543,571,631,581,515,516,571,721,768,943,960,917,899,941,1168,1274,1256,1527,1472,1315,1323,1741,1826,1958,1988,1760,1662,1770,2088,2117,2325,2588,2214]    47786
6237    [20111102,20111103,20111104,20111105,20111106,20111107,20111108,20111109,20111110,20111111,20111112,20111113,20111114,20111115,20111116,20111117,20111118,20111119,20111120,20111121,20111122,20111123,20111124,20111125,20111126,20111127,20111128,20111129,20111130,20111201,20111202,20111203,20111204,20111205,20111206,20111207,20111208,20111209,20111210,20111211,20111212,20111213,20111214,20111215,20111216]  [286,291,276,274,339,424,428,408,458,401,354,398,543,571,631,581,515,516,571,721,768,943,960,917,899,941,1168,1274,1256,1527,1472,1315,1323,1741,1826,1958,1988,1760,1662,1770,2088,2117,2325,2588,2214]    47786
6237    [20111102,20111103,20111104,20111105,20111106,20111107,20111109,20111110,20111111,20111112,20111113,20111114,20111115,20111116,20111117,20111118,20111119,20111120,20111121,20111122,20111123,20111124,20111125,20111126,20111127,20111128,20111129,20111130]       [286,291,276,274,339,424,408,458,401,354,398,543,571,631,581,515,516,571,721,768,943,960,917,899,941,1168,1274,1256]        17684
6237    [20111102,20111103,20111104,20111105,20111106,20111107,20111108,20111109,20111110,20111111,20111112,20111113,20111114,20111115,20111116,20111117,20111118,20111119,20111120,20111121,20111122,20111123,20111124,20111125,20111126,20111127,20111128,20111129,20111130,20111201,20111202,20111203,20111204,20111205,20111206]        [286,291,276,274,339,424,428,408,458,401,354,398,543,571,631,581,515,516,571,721,768,943,960,917,899,941,1168,1274,1256,1527,1472,1315,1323,1741,1826]      27316
10778   [20111102,20111103,20111104,20111105,20111106,20111107,20111108,20111109,20111110,20111111,20111112,20111113,20111114,20111115,20111116,20111117,20111118,20111119,20111120,20111121,20111122,20111123,20111124,20111125,20111126,20111127,20111128,20111129,20111130,20111201,20111202,20111203,20111204,20111205,20111206]        [48,47,37,41,49,35,49,47,59,46,37,41,39,67,60,59,45,39,44,58,62,47,62,56,70,55,57,53,35,59,57,42,45,61,63]  1771
10778   [20111102,20111103,20111104,20111105,20111106,20111107,20111109,20111110,20111111,20111112,20111113,20111114,20111115,20111116,20111117,20111118,20111119,20111120,20111121,20111122,20111123,20111124,20111125,20111126,20111127,20111128,20111129,20111130]       [48,47,37,41,49,35,47,59,46,37,41,39,67,60,59,45,39,44,58,62,47,62,56,70,55,57,53,35]   1395
10778   [20111102,20111103,20111104,20111105,20111106,20111107,20111108,20111109,20111110,20111111,20111112,20111113,20111114,20111115,20111116,20111117,20111118,20111119,20111120,20111121,20111122,20111123,20111124,20111125,20111126,20111127,20111128,20111129,20111130,20111201,20111202,20111203,20111204,20111205,20111206,20111207,20111208,20111209,20111210,20111211,20111212,20111213,20111214,20111215,20111216]  [48,47,37,41,49,35,49,47,59,46,37,41,39,67,60,59,45,39,44,58,62,47,62,56,70,55,57,53,35,59,57,42,45,61,63,55,10633,51,41,36,37,62,41,53,45] 12825

The Goal
Notice that the row id's repeat a variable number of times.  My task was to use the first column as an index, and only take the last line in the file related to that index.

The Solution
The solution looks something hideous like this:
awk -F"\t" 'NR!=1 {a[$1]; b[$1]=$2 ; c[$1]=$3; d[$1]=$4} \
END{OFS="\t";for (i in a) printf("%s\t%s\t%s\t%s\n", i, b[i], c[i], d[i])}' \

Breaking it apart into separate lines helps a bit (the backslash allows you to enter the pieces of the command on multiple lines in a Linux terminal window):
awk -F"\t"\
'NR!=1 {a[$1]; b[$1]=$2 ; c[$1]=$3; d[$1]=$4} \
for (i in a)\ 
printf("%s\t%s\t%s\t%s\n", i, b[i], c[i], d[i])}'|\

Let's take this apart piece by piece to see what it means.

awk -F"\t" start awk and use the tab delimiter to separate out the columns
NR!=1 read in all but the first record
a an array of values called a
a[$1] assign values to array named a, the values are to be found in the first column ($1) of the data file
b[$1]=$2 for the array b, at the index of $1, assign value of the second column ($2) of the data file
c[$1]=$3 for the array c, at the index of $1, assign value of the third column ($3) of the data file
d[$1]=$4 for the array d, at the index of $1, assign value of the fourth column ($4) of the data file
END do the following at the last
OFS="\t" output field separator is a tab
for (i in a) for each value in the array a, do the following
print.. print the current value for i (the index, the first column)
print the last value for the second column at index i: b[i]
print the last value for the third column at index i: c[i]
print the last value for the fourth column at index i: d[i]

Final Output
Now when I run the program, I get this for the output:
6237    [20111102,20111103,20111104,20111105,20111106,20111107,20111108,20111109,20111110,20111111,20111112,20111113,20111114,20111115,20111116,20111117,20111118,20111119,20111120,20111121,20111122,20111123,20111124,20111125,20111126,20111127,20111128,20111129,20111130,20111201,20111202,20111203,20111204,20111205,20111206]        [286,291,276,274,339,424,428,408,458,401,354,398,543,571,631,581,515,516,571,721,768,943,960,917,899,941,1168,1274,1256,1527,1472,1315,1323,1741,1826]      27316
10778   [20111102,20111103,20111104,20111105,20111106,20111107,20111108,20111109,20111110,20111111,20111112,20111113,20111114,20111115,20111116,20111117,20111118,20111119,20111120,20111121,20111122,20111123,20111124,20111125,20111126,20111127,20111128,20111129,20111130,20111201,20111202,20111203,20111204,20111205,20111206,20111207,20111208,20111209,20111210,20111211,20111212,20111213,20111214,20111215,20111216]  [48,47,37,41,49,35,49,47,59,46,37,41,39,67,60,59,45,39,44,58,62,47,62,56,70,55,57,53,35,59,57,42,45,61,63,55,10633,51,41,36,37,62,41,53,45] 12825

Note there are only two lines now instead of seven and that I only have the last two instances of the value indexed in column one.

And that's some funky AWK magic.


Saturday, October 29, 2011

xfce4 irritations

In order to monitor the state of my RAID set, I needed to install the 3ware software pieces, especially the GUI.  The install documentation from 3ware is poor.  So I thought I'd create my own by taking some screenshots.  I was going to take screenshots using my window manager's screenshot program.  Unfortunately, ALT-PRINT did not work in XFCE.

I'm running XFCE instead of GNOME 3 because of GNOME 3's vertical workspace changing behavior.  You see, I edit video in Cinelerra and have the Program timeline, Resource and Viewer windows in one monitor and the Compositor in the right monitor.  Also, I use NVidia drivers in Twinview mode.  So for this video editing layout, I need the old GNOME2 horizontal workspaces.  GNOME3 breaks up the left and right monitor when you switch workspaces and you can only switch workspace vertically using CTRL-ALT-Up/Down.  Dumb.

Anyway, ALT-PRINT did not work in XFCE.  Reading here said it might have been a problem with multiple lines in .config/xfce4/xfconf/xfce-perchannel-xml/xfce4-keyboard-shortcuts.xml

Reviewing that file, indeed I find multiple lines referencing the same keys (some under a "default" section, some lines under a "custom" section).  So I edited the file to remove the duplicate references and saved only those with my custom keyboard shortcuts.  My edits to get xfce-screenshooter to bind with both PrtScn and Alt-PrtScn ended looking like this:
      <property name="Print" type="string" value="xfce4-screenshooter -f"/>
      <property name="&lt;Alt&gt;Print" type="string" value="xfce4-screenshooter -w"/>

After removing the multiple entries for the Print key and restarting XFCE, I had my keyboard shortcuts back!  Yay!

Also, while reading that article, I noticed another user had a secondary problem that I had where the logout button for Xfce doesn't have the startup/shutdown option.  So here, it look like the problem might have been with xfce4-session.  I noticed I didn't have this program installed, so I installed it.  And now, I am happily running with a proper logout window:

Lastly, you can also customize what is displayed in the Log Out dialog using syntax like this:
xfconf-query -c xfce4-session -np '/shutdown/ShowSuspend' -t 'bool' -s 'false'

This edits the settings in this file:

So you see, this is why Linux is a pain in the ass.  You want to do something simple and basic stuff like screenshotting and shutdown/restart and power management is not installed by default or doesn't work.



Friday, July 01, 2011

301 permanent redirect using IIS

Here's a quick post describing how to place a 301 permanent redirect on a Microsoft IIS web server; specifically IIS6. On a Microsoft server, you can do a HTTP 301 Permanent Redirect two ways by using:
  • Javascript or Visual Basic code within your ASP page or
  • server administrative tools (the IIS management server console, iis.msc)
This is different from a Linux box, where you can use not only code or Apache to do the 301, but you can also take advantage of the .htaccess file for redirects.

Since the page I was trying to redirect was an HTML page, I wasn't able to put in any VB or Javascript code to perform the redirect. If I was using an ASP page, I could use some VB code like this:
< %@ Language=VBScript %>
< %
Response.Status=”301 Moved Permanently”
Response.AddHeader “Location”,

Instead, I used the IIS management console to edit the attributes of the file to permanently redirect the destination location of the file. In the example below, I have right-clicked on the Properties of a web resource available to IIS (a file under the wwwroot), have input my other blog "" as the destination URL and checked "a permanent redirection for this resource."

Lo and behold, this works..I am redirected to the proper location (shown below). However, when I use Firebug to inspect how the server is doing the redirects, I find that Firebug shows a "301 error" for the response code:

To confirm that it wasn't Firebug misinterpreting the response from the server, I used this site to confirm the response code:
Using the internetofficer site's redirect checker, I found that the redirect checker showed the same response from the IIS server. So Firebug wasn't reporting incorrect information.

Finally, after a bit of googling, it seems that the "301 error" is just the way that the IIS server responds to the 301 permanent redirection setting. This is confusing, non-standard terminology, as it caused me to think that I had implemented the redirect incorrectly. Perhaps Microsoft will fix this in the future.

anyway..Happy 4th of July!

Wednesday, April 27, 2011

s3cmd through a proxy

For those who use Amazon's EC2/S3 cloud.
sodo@linux-8u67:~/Downloads/s3cmd-1.0.0> ./s3cmd --configure

Enter new values or accept defaults in brackets with Enter.
Refer to user manual for detailed description of all options.

Access key and Secret key are your identifiers for Amazon S3
Access Key: enter accesskey
Secret Key: enter secretkey

Encryption password is used to protect your files from reading
by unauthorized persons while in transfer to S3
Encryption password:
Path to GPG program [/usr/bin/gpg]:

When using secure HTTPS protocol all communication with Amazon S3
servers is protected from 3rd party eavesdropping. This method is
slower than plain HTTP and can't be used if you're behind a proxy
Use HTTPS protocol [No]:

On some networks all internet access must go through a HTTP proxy.
Try setting it here if you can't conect to S3 directly
HTTP Proxy server name [http-proxy]:
HTTP Proxy server port [8888]:

New settings:
 Access Key: enter accesskey
 Secret Key: enter secretkey 
 Encryption password:
 Path to GPG program: /usr/bin/gpg
 Use HTTPS protocol: False
 HTTP Proxy server name: http-proxy
 HTTP Proxy server port: 8888

Test access with supplied credentials? [Y/n] y
Please wait...
Success. Your access key and secret key worked fine :-)

Now verifying that encryption works...
Not configured. Never mind.

Save settings? [y/N] y
Configuration saved to '/home/sodo/.s3cfg'

sodo@linux-8u67:~/Downloads/s3cmd-1.0.0> ./s3cmd ls
2011-04-05 19:03  s3://testbucket
2011-03-26 04:42  s3://trendtop

Yay! It works.

Also, I received this error message from YaST2 using SuSE Enterprise Linux 11 64-bit 11.1:
Problem: nothing provides python(abi) = 2.6 needed by s3cmd-1.0.0-4.1.i586

Resolution: install manually from


Sunday, April 17, 2011

resizing a linux partition using Parted Magic

I was running out of space on the root filesystem of my OpenSuSE 11.4 virtual machine. I needed a few extra gig, so I wanted to enlarge the root filesystem from 18GB to 22GB:
sfrase@linux-8u67:~> df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 18G 14G 4G 22% /
devtmpfs 372M 88K 372M 1% /dev
tmpfs 372M 1.1M 371M 1% /dev/shm
Thinking I could use Gparted, I stumbled upon something even easier..the Parted Magic OS. Parted Magic is a compilation of open source partitioning utilities in one smooth-looking OS in bootable iso format. The bootable iso is about 160MB and is available here:

I had to do a few things to get the filesystem resized.
1) resized the virtual disk that VMware uses
2) booted the VM with the Parted Magic ISO in the virtual CD of the VM
3) ran GParted and expanded my filesystem
4) rebooted the system to see the expanded disk

I'll show you the steps in depth below:

In VMware Player settings, select the hard disk, click the Utilities link and press "Expand":

Specify a new maximum disk size:

After VMware resizes the virtual disk, I got a success message:

I mounted the ISO in the virtual CD drive:

Next, I booted the virtual machine. I pressed ESC (escape) while the vm is booting to display the boot menu:

I highlighted CDROM and press enter to start booting the Parted Magic iso:

Parted Magic has a really nice interface. Love the system monitors on the desktop!

Next, I double-clicked the icon labeled "partition editor". This is Gparted, the GNOME partition manager:

I double-clicked the filesystem I wanted to resize. In order to expand the size of the filesystem, I pulled the right tab in the graphic from its current position all the way to the right.

I clicked the resize button and saw the change I made:

I clicked Apply to confirm the changes:

It took a minute or two to resize the filesystem:

I checked out the steps the resize performs by clicking the little twisty:

Once resized, I rebooted the machine:

Now my disk has the extra 4GB of space that I needed! Hooray!
sfrase@linux-8u67:~> df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 22G 14G 8G 22% /
devtmpfs 372M 88K 372M 1% /dev
tmpfs 372M 1.1M 371M 1% /dev/shm

You can also shrink filesystems. For instance, I wanted to reduce the size of my root partition from 38GB to 7GB. Again, I used GParted and PartedMagic CD for the task.

Here's the Resize screen after I dragged the right arrow almost to the area on the filesystem that is used, as indicated by the yellow color:

Here's the screen while the job is in progress:

Once finished you'll see a message "All operations successfully completed." The job took about five minutes to complete.

So far, I've used GParted on ext3 and ext4 filesystems without issue.

Please, don't forget to donate a few dollars to the nice folks who compiled this very useful set of utilities.


Monday, April 11, 2011

weblogic 6.1 nastiness

I had to resurrect an old WebLogic 6.1 system today. Ooof! A conversion from IIS5 to IIS6. Went through quite a bit of h3ll.

1) Under Control Panel -> System -> Advanced -> Performance -> Data Execution Prevention had to be enabled for the specific WebLogic and java processes:

Otherwise, I'd get errors in the Application Event Log and to the desktop.

See more here:

2) In IIS, the WebLogic ISAPI filter priority was set to *Unknown*. I resolved with help from Vivek's post here:
-otherwise, IIS would hang

3) In IIS, the WebLogic DLLs need to be configured as Web Service Extensions and set to a status of Allowed

4) In IIS, unknown ISAPI extensions need to be Allowed
-otherwise, I'd get 404s from .wlforward

5) In IIS, the website needs to be run in IIS5 isolation mode
-otherwise, IIS would hang

6) The iisproxy.ini file needed to be copied to c:\weblogic
-otherwise, I'd get an HTTP 500 from .wlforward

7) Faulting application w3wp.exe, version 6.0.3790.3959, faulting module iisforward.dll
-caused by dll memory corruption trying to access Physical Address Extension memory
-resolved by adding /nopae to boot.ini


Friday, April 08, 2011

rdp: ERROR: recv: Connection reset by peer

Strangely, the RDP (rdesktop) sessions to my Windows Servers were timing out within five minutes. I'd get an error like this:
Autoselected keyboard map en-us
ERROR: recv: Connection reset by peer

The Terminal Services Configuation on the destination server were set to timeout after an hour. So something was definetly amiss. Even more weird, when I exited GNOME and logged onto Enlightenment, the problem went away. So that meant the problem was with my window environment. Reading up here:

To fix the problem, one guy had to change his keyboard in GNOME:

I changed my keyboard from Unknown to Microsoft Natural Keyboard Pro, restarted GNOME and voila..problem gone!

I love it when a plan comes together!

Saturday, April 02, 2011

what window manager am I running?

Recently, I've installed quite a few new Linux distributions as virtual machines. They all use different window managers and it is difficult to tell what window manager I have installed. The "wmctrl" program clears this fog. Run the command like this:
sodo@linux-nie4:~> wmctrl -m
Name: Metacity
Class: N/A
Window manager's "showing the desktop" mode: OFF

Et voila! You have the name of your window manager. Also, you could grep your process list for a known window manager like metacity or compiz like so:
sodo@linux-nie4:~> pidof metacity
sodo@linux-nie4:~> ps -ef | grep metacity
sodo 5134 4984 0 10:36 ? 00:00:01 /usr/bin/metacity
sodo 30798 5467 0 11:35 pts/0 00:00:00 grep metacity

Also, it might be helpful to know your X session setup. This can be determined by looking at your environment variables:
sodo@linux-nie4:~> printenv | egrep 'MANAGER|SESSION' | sort

A KDE Example
sodo@linux-z6tw:~> printenv | egrep 'MANAGER|SESSION' | sort

sfrase@linux-z6tw:~> wmctrl -m
Name: KWin
Class: kwin
PID: 11247
Window manager's "showing the desktop" mode: OFF


Wednesday, March 23, 2011

git behind a proxy

This gentleman's technique worked for me:

In short..
* Plop the connect and proxy files somewhere
* Edit proxy to point to connect and reference your proxy
* Export the GIT_PROXY_COMMAND environment variable

To use like so:
[sodo@computer ~]$ export GIT_PROXY_COMMAND=/home/sodo/proxy
[sodo@computer ~]$ git clone git://
Cloning into trendingtopics...
remote: Counting objects: 2794, done.
remote: Compressing objects: 100% (860/860), done.
remote: Total 2794 (delta 1853), reused 2792 (delta 1853)
Receiving objects: 100% (2794/2794), 475.10 KiB, done.
Resolving deltas: 100% (1853/1853), done.

Tuesday, March 15, 2011

running ntp on linux in windows environment

Here's a quick entry I'm writing because I can't remember the few ntp commands to get time sync running on my Fedora box in my company's predominantly Windows environment.

Configure /etc/ntp.conf
Let's add a single time server to our /etc/ntp.conf file:
# For more information about this file, see the man pages
# ntp.conf(5), ntp_acc(5), ntp_auth(5), ntp_clock(5), ntp_misc(5), ntp_mon(5).

driftfile /var/lib/ntp/drift

# Permit time synchronization with our time source, but do not
# permit the source to query or modify the service on this system.
restrict default kod nomodify notrap nopeer noquery
restrict -6 default kod nomodify notrap nopeer noquery

# Permit all access over the loopback interface. This could
# be tightened as well, but to do so would effect some of
# the administrative functions.
restrict -6 ::1

# Hosts on local network are less restricted.
#restrict mask nomodify notrap

# Use public servers from the project.
# Please consider joining the pool (
server timeserv.corpdomain

# Undisciplined Local Clock. This is a fake driver intended for backup
# and when no outside source of synchronized time is available.
#server # local clock
#fudge stratum 10

# Enable public key cryptography.

includefile /etc/ntp/crypto/pw

# Key file containing the keys and key identifiers used when operating
# with symmetric key cryptography.
keys /etc/ntp/keys

Is the ntp daemon currently running on my box?
From the output of ntpq and the service command, I'd say no:
[sodo@computer ~]$ ntpq
ntpq> peers
ntpq: read: Connection refused
ntpq> assoc
ntpq: read: Connection refused
[sodo@computer ~]$ service --status-all | grep ntp
ntpd is stopped

Start up ntpd!
First, we'll configure ntpd to start at the various multiuser levels:
[sodo@computer ~]$ sudo chkconfig --list | grep ntp
ntpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
[sodo@computer ~]$ sudo chkconfig --levels 2345 ntpd on
[sodo@computer ~]$ sudo chkconfig --list | grep ntp
ntpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off

Then, we'll start 'er up!
[sodo@computer ~]$ sudo service ntpd start
Starting ntpd: [ OK ]

Once started, we'll wait about ten minutes and then check ntpq to see if the ntpq is talking to the time server we configured in /etc/ntp.conf:
[sodo@computer ~]$ ntpq
ntpq> peers
remote refid st t when poll reach delay offset jitter
*timeserve.corpdomain 5 u 71 128 377 0.448 19.236 24.240

ntpq> assoc

ind assid status conf reach auth condition last_event cnt
1 4341 967a yes yes none sys.peer sys_peer 7

Sweet! Looks like we're sync'd up!

Sunday, February 27, 2011

open sound control using touchOSC

Open Sound Control is a very cool technology, sort of an updated MIDI. With TouchOSC, you can send OSC messages over the network via WIFI to control OSC-aware softwares, like music recording software. I'm controlling the GForce Oddity software synth within Reaper in the video below.

Recording the audio/video from the mac to Cinelerra on my Linux box was a bit of a pain and took some work:
1) on mac: esd -public -promiscuous -bind mac -trust -tcp
2) on mac: esdrec -s mac | esdcat -s ogre
3) on linux:
gnome-sound-settings: hw
analog stereo output + digital stereo input
digital stereo output + digital stereo input (best for recording)
-input from microphone line in (for voice only) on Mackie Alt3-4
-input from mac monitor of m-audio digital stereo (null device)
-both if both are on Mackie Alt3-4

Alt 3-4 -> ch1/ch2 line in on M-Audio MobilePre

pavucontrol dialog settings
-output device: MobilePre analog speakers
-playback: null device from esound server created above
-record monitor (once Audacity/Cinelerra record monitor enabled):

If you'd like to download the Oddity layout and the Osculator settings, here they are:
Oddity Ipad Touch OSC Layout
Osculator Settings for the Above

More detail on ESD/PulseAudio here:

Wednesday, February 23, 2011

PulseAudio: streaming iTunes from the mac to linux

After beating my head against a wall for the past three days, I finally overcame my mental block and was able to get audio streaming from iTunes to my Linux box. This was to help facilitate the production of a video that will be the subject of my next post.

For this project though, I had to jump through a good number of hoops to get the streaming going. The side benefit was that the project allowed me to educate myself on the benefits of PulseAudio, which I had previously believed to be a piece of crap that only served to bollucks your workstation's audio. Now that I have a better understanding of PulseAudio, I've changed my mind.

Here's an article on why you might want to care about PulseAudio.

Still, the implementation of audio streaming over the network using PulseAudio is somewhat programmer-centric and thus, it is not easy. The faint of heart might choose to simplify their lives and buy one of these Apple AirPort Express with Air Tunes.

This post will give an overview of the tools used to stream audio from a Mac running the Enlightment Sound Daemon (ESD) sound server to any PC running PulseAudio. I'll include links to the more detailed resources, rather than repeating information already available on the web.

Here's an overly simplified signal chain of what's happening to make this work.

On the Mac
iTunes -> Soundflower audio driver -> eSound daemon -> Linux box

On the Linux box
audio stream from Mac -> PulseAudio -> ALSA -> PC's audio interface -> speakers

It's a bit of a funky setup, over-explained semi-coherently here:
and here:

The Process
On the Mac
Prerequisites: iTunes and esound macport
1) install Soundflower, the audio driver that ESD will use
2) setup an ESD sound server using ESD and open a network connection for the Linux box
3) format and forward the sound onto the Linux box

On the Linux box
Prerequisites: pulseaudio, paprefs(pa prefs), pavucontrol(pa volume control), pulseaudio-utils
4) make sure paprefs is setup properly
5) start pulseaudio
6) verify that data is being sent over the network

Detailed Steps
On the Mac
1) install Soundflower and select Soundflower 2ch as your System Prefs -> Sound -> Output and Input
Best explained here:

For debugging purposes, enter the commands below in separate terminals. In both cases, if the commands execute correctly, the command prompt should not return to you.

2) setup an audio server using the Enlightment Sound daemon (ESD) and open a port for your Linux box to connect to. To do this, open a terminal and run a command similar to this:
mac:~ sodo$ esd -tcp -bind [mac]:16001 -public -promiscuous -trust
- accepting connections on port 16001

3) format and forward the sound to the Linux box (make sure PA is running on the Linux box first):
esdrec -s [mac]:16001 esdcat -s [linux]

On the Linux box
4) make sure paprefs is setup properly
There's more detail at this link, but here are the prefs you want to set:

5) start (or kill and restart) pulseaudio
[sodo@ogre ~]$ pulseaudio -k
[sodo@ogre ~]$ pulseaudio --start
[sodo@ogre ~]$ ps -ef grep pulse
sodo 3860 1 0 00:06 ? 00:00:01 /usr/bin/pulseaudio --start --log-target=syslog
sodo 3862 3860 0 00:06 ? 00:00:00 /usr/libexec/pulse/gconf-helper
sodo 5298 5045 0 00:09 pts/4 00:00:00 grep pulse

Here are some other notes regarding pacmd, the command line interface to PulseAudio.

pacmd list-modules
>>> [sodo@ogre ~]$ pacmd list-modules
Welcome to PulseAudio! Use "help" for usage information.
>>> 23 module(s) loaded.
index: 4
used: 1
load once: no
properties: = "Lennart Poettering"
module.description = "ALSA Card"
module.version = "0.9.21"

pacmd list-sinks
[sodo@ogre ~]$ pacmd list-sinks
Welcome to PulseAudio! Use "help" for usage information.
>>> 1 sink(s) available.
* index: 0
state: RUNNING

Once you've verified the daemon is up, look for a sound source in the PulseAudio Volume Control app, Playback tab:

I'm not sure why the stream from the mac is listed as null.

6) verify that data is being sent over the network
First, I look at netstat. Netstat is telling me that my Linux box (.8) on port 16001 has an established connection to my Mac (.12) on port 62356:
[sodo@ogre ~]$ netstat -na grep \.12

Most likely, the Linux box initiated the connection from 16001 and the Mac responded back by opening port 62356. I am not sure how ESD works in this regard either, as the ports identified on the ESD command line would suggest that the Mac should have port 16001 open and not the Linux box. Weirdness.

And make sure access to port 16001 is not disabled on the bloody firewall, either local on each box or a remote firewall between the machines!  I use an exclamation point here because this got me twice when I was setting this whole thing up:

Also, I use iptraf to show me the volume of my network traffic. Here we see the lion's share of data is coming from .12 (my Mac) and .8 (my Linux box) is shuttling a lot less data. Observed over time, I see that the Linux box sends about 1% of the audio stream's data quantity simply to manage the connection:

Lastly, you could take a look at the files PulseAudio keeps open by looking at TCP port 16001:
[sodo@ogre ~]$ lsof -i TCP:16001
pulseaudi 3860 sfrase 30u IPv6 48581 0t0 TCP *:16001 (LISTEN)
pulseaudi 3860 sfrase 31u IPv4 48582 0t0 TCP *:16001 (LISTEN)
pulseaudi 3860 sfrase 36u IPv4 49374 0t0 TCP ogre:16001->mac:50314 (ESTABLISHED)

PulseAudio is quite cool. I think it works a bit more consistently if you have two machines with PulseAudio on both ends. I've tried this and it works very well. Here's an article on how to stream music between two computers using only PulseAudio:

Of course, I needed to stream from the Mac and there is no port of PulseAudio for the Mac. Still good stuff this PulseAudio, once you understand more about it.

Example of this working

Update 2012/12/03
After upgrading both my Fedora box from F15 to F17 and upgrading my Mac from Leopard to Lion, pulseaudio streaming broke.  I had to do the following:
1) on the mac, download and install the latest version of SoundFlower (reboot necessary)
2) on the linux box, download and install pulseaudio-module-zeroconf (above and beyond the normal pulseaudio installation)
3) on the linux box, make sure iptables is turned off (just for testing purposes..reenable with an exception for port 16001).  On Fedora 17, this would be:
systemctl stop iptables.service

Updated Process
Also, I streamlined my process for getting this to work.  Try the below steps in this same order:
1) on the mac, make sure both input and output is set to SoundFlower (2CH)
2) on the mac, stream eSound to a public port, like so:
esd -tcp -bind ::0
3) on linux, make sure pulseaudio is running and that paprefs is set (as above)
4) on the mac, open an eSound stream to the Linux box
esdrec -s ::0 | esdcat -s
5) you should then see a nice volume control named "null" appear under the Playback tab in the PulseAudio volume control (pavucontrol)

Good luck!

Other References
PulseAudio Sink, Streams, Clients

How to: AirTunes without AirPort

network audio between mac and linux 1&2

Remote sound playback through a Nokia 770

Using the PulseAudio sink

PulseAudio Wiki

Linux: exporting audio and video

burning an iso to cd using cdrecord

The past few years, as Linux distributions get larger, I've been burning more DVDs than CDs. So my CD burning chops have lapsed. I recently wanted to fire up a Live version of Fedora 14 for some PulseAudio experiments, so I downloaded the ISO which came CD-sized.

*** Update 3/4/2013 ***
I used Brasero on my Fedora 17 and that burned a copy of Clonezilla quite nicely.  Hooray!  Of course, my clone didn't work, but that's another story.
*** end update ***

First, for convenience sake, I burned the first F12 Live CD using my Macbook's Disk Utility. But when I plopped the CD into my desktop, the boot never finished and the DVD player kept humming for about 45 minutes. Something definitely wrong there. Testing on a second PC yielded the same result.

Researching Google, I found that other people had similar problems if the application they burned the CD with burned the CD at too fast a rate. This causes the laser in the DVDs to have difficulty reading the source data. Guess I'll have to reburn that bad boy. I tossed that CD out and thought I'd give Linux tools a try. I didn't know this next stage was going to turn into a two-hour extravaganza.

Burning an ISO in Linux is Easy, No?
Starting from scratch on my Fedora 12 box, I popped in a blank CD and good old Nautilus CD/DVD creator pops up:

I dragged and dropped the ISO onto the blank CD:

Selected "Burn contents"

And POOF..nautilus immediately craps out with a buffer error in dmesg:
[ 78.116252] Buffer I/O error on device sr0, logical block 0

OK, so I guess I won't use that. Next, I try Brasero:

Same result. OK. So let me try cdrecord, from the CDR toolset. Things seems to go well and then ba-BANG:
wodim: Cannot fixate disk

What the? Thinking the media was bad, I yanked it out and put a new CD in the drive. Same result. OK, this is getting tiresome. Time to Google:

Surfing around does not yield much usable information; however, one post hinted at a drive or BIOS issue. I rebooted and checked the BIOS..nothing far from standard there. So I figured I'd run cdrecord again using the -dummy switch that means "do everything the burn will do, except turn off the laser." So I did this, again using another CD. If you're counting, that's three.

I first ran a scanbus:
[sodo@computer ~]$ cdrecord -scanbus
200) 'HL-DT-ST' 'DVD+-RW GH50N ' 'B103' Removable CD-ROM
201) *
202) *
203) *
204) *
205) *
206) *
207) *

Then I ran cdrecord with the dummy parameter:
[sodo@computer ~]$ cdrecord -v -tao driveropts=burnfree -dummy -dev=2,0,0 Downloads/Fedora-14-i686-Live-Desktop.iso
TOC Type: 1 = CD-ROM

wodim: Operation not permitted.
Warning: Cannot raise RLIMIT_MEMLOCK limits.

scsidev: '2,0,0'

scsibus: 2 target: 0 lun: 0

WARNING: the deprecated pseudo SCSI syntax found as device specification.

Support for that may cease in the future versions of wodim. For now,
the device will be mapped to a block device file where possible.
Run "wodim --devices" for details.
Linux sg driver version: 3.5.27

Wodim version: 1.1.11
Driveropts: 'burnfree'
SCSI buffer size: 64512
Device type : Removable CD-ROM

Version : 5
Response Format: 2

Capabilities :
Vendor_info : 'HL-DT-ST'
Identification : 'DVD+-RW GH50N '

Revision : 'B103'

Device seems to be: Generic mmc2 DVD-R/DVD-RW.

Current: 0x0009 (CD-R)

Profile: 0x0012 (DVD-RAM)

Profile: 0x0011 (DVD-R sequential recording)
Profile: 0x0015 (DVD-R/DL sequential recording)
Profile: 0x0016 (DVD-R/DL layer jump recording)

Profile: 0x0014 (DVD-RW sequential recording)
Profile: 0x0013 (DVD-RW restricted overwrite)
Profile: 0x001A (DVD+RW)
Profile: 0x001B (DVD+R)
Profile: 0x002B (DVD+R/DL)
Profile: 0x0010 (DVD-ROM)
Profile: 0x0009 (CD-R) (current)
Profile: 0x000A (CD-RW) Profile: 0x0008 (CD-ROM)
Profile: 0x0002 (Removable disk)

Using generic SCSI-3/mmc CD-R/CD-RW driver (mmc_cdr).


Supported modes: TAO PACKET SAO SAO/R96P SAO/R96R RAW/R96R

Drive buf size : 1053696 = 1029 KB

Beginning DMA speed test. Set CDR_NODMATEST environment variable if device
communication breaks or freezes immediately after that.
Drive DMA Speed: 16168 kB/s 91x CD 11x DVD

FIFO size : 4194304 = 4096 KB

Track 01: data 686 MB

Total size: 787 MB (78:03.12) = 351234 sectors

Lout start: 788 MB (78:05/09) = 351234 sectors
Current Secsize: 2048

ATIP info from disk:

Indicated writing power: 5 Is not unrestricted Is not erasable Disk sub type: Medium Type A, high Beta category (A+) (3) ATIP start of lead in: -11634 (97:26/66)
ATIP start of lead out: 359846 (79:59/71)
Disk type: Short strategy type (Phthalocyanine or similar)

Manuf. index: 3

Manufacturer: CMC Magnetics Corporation

Blocks total: 359846 Blocks current: 359846 Blocks remaining: 8612
Speed set to 8468 KB/s

Starting to write CD/DVD at speed 48.0 in dummy TAO mode for single session.

Last chance to quit, starting dummy write in 0 seconds. Operation starts.

Waiting for reader process to fill input buffer ... input buffer ready.

Starting new track at sector: 0

Track 01: 686 of 686 MB written (fifo 100%) [buf 91%] 49.9x.

Track 01: Total bytes read/written: 719323136/719323136 (351232 sectors).
Writing time: 143.394s

Average write speed 32.7x.
Min drive buffer fill was 87%


WARNING: Some drives don't like fixation in dummy mode.

Fixating time: 22.123s

wodim: fifo had 11331 puts and 11331 gets.

wodim: fifo was 0 times empty and 6563 times full, min fill was 85%

OK! So this time, the "fake" burn worked! That's promising. I then ran the "real" burn (same command without the -dummy parameter) and prayed that it would work:
[sodo@computer ~]$ cdrecord -v -tao driveropts=burnfree -dev=2,0,0 Downloads/Fedora-14-i686-Live-Desktop.iso
Starting to write CD/DVD at speed 48.0 in real TAO mode for single session.

Last chance to quit, starting real write in 0 seconds. Operation starts.
Waiting for reader process to fill input buffer ... input buffer ready.

Performing OPC...

Starting new track at sector: 0

Track 01: 686 of 686 MB written (fifo 100%) [buf 91%] 49.7x.

Track 01: Total bytes read/written: 719323136/719323136 (351232 sectors).

Writing time: 149.247s

Average write speed 31.4x.
Min drive buffer fill was 87%


Fixating time: 22.165s

wodim: fifo had 11331 puts and 11331 gets.

wodim: fifo was 0 times empty and 6552 times full, min fill was 84%.

Ho HO! It worked!! Fabulous. But why?

It seems I made two changes that could have an effect:
1) I rebooted the computer
2) I used a different disc

My bet is on #2. But if you think differently, let me know. I'm just glad to having a working process for burning ISOs to a CD!


Tuesday, February 08, 2011

fun (?) with Enlightenment window manager

As much as I'm used to it, I've finally bored of Metacity, the default window manager in Fedora. Metacity is very nice if you live in the Windows world from 9-5 like I do..the keybindings are very similar. So I decided to upgrade..

For the past three days, I've spent a good amount of time with Enlightenment, a visually striking, light(-er)weight window manager for Linux (and other OSs). The initial install was simple, as Enlightenment is in Fedora's repos:
[sodo@computer ~]$ sudo yum info enlightenment
[sudo] password for sodo:
Loaded plugins: presto, refresh-packagekit
Installed Packages
Name : enlightenment
Arch : x86_64
Version : 0.16.999.050
Release : 5.fc12
Size : 10 M
Repo : installed
From repo : fedora
Summary : Highly optimized and extensible desktop shell
License : MIT
Description : Enlightenment 0.17 is desktop shell based on Enlightenment Foundation
: Libraries. It's highly optimized and provides extensive theming capabilities.
: A Desktop shell means it's a window manager plus a file manager, plus
: configuration utilitys all in one. It works reasonably fast even on old and low
: range computers, providing eye-candy environment.

As a new user, I've found the documentation and resources for Enlightenment to be difficult to navigate. The best source for a new user is to visit the Wiki and choose "User Guides":

Module Installation
Also, module installation is buried in the Wiki:

Update 2011/02/12
I've since installed from source to give me the latest and greatest. The source install was relatively painless downloading the latest E packages from here:

Install the sources in this order:

For each of the sources, after extracting the source code via "tar xvfz ", run:
sudo make install

The only occasional problem that I had was a missing library here and there, like liblua. I resolved this by installing the -devel package. A second problem I encountered was that I needed to set:
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
***end update***

Enlightenment is very cool, very pretty, but it takes quite a bit of getting used to especially if you're coming from the world of Metacity.

I think I like it, but the jury is out due to all the configuration I've had to do.

A battle, as always
So here are a few of the problems I encountered, and some workarounds:
1) ALT-PrntScreen didn't work

I had to rebind the PrtScn key to gnome-screenshot, the default Gnome screen capture program.

Binding keys
The key bindings interface in Enlightenment is a little funky. You get there by clicking on the desktop, go to Settings, Settings Panel, Input category, Key Bindings:

The left part of the screen is the key and the right hand side shows the Action you want to perform. In my case, ALT+Print was not in the list, so I first had to Add Binding. Then I needed to bind the key to an action, which was to Launch a Command:
/usr/bin/gnome-screenshot -w

The -w parameter screencaps a single window. If you leave off the -w parameter, your entire desktop will be screencapped to a PNG file. Once I created this key binding, all was well and I was able to capture screens again.

2) ALT-space to maximize/restore windows was not bound to anything

Again, I had to bind this command to a Window:State:

The nice thing about the Maximize window state is that it toggles between Maximize and Restore (or Unmaximize in the Enlightenment world).

3) Icons for some of the programs I selected for my Icon Bar were missing:

I had to go and find individual icons by right-clicking on the space in the icon bar, select Change Icon Properties, select Icon, and navigate to the following directory:

You can also find icons in any of the sized directories; for example:

I had to do this for Google Chrome, gnome-terminal, vmware player and my nvidia settings. I'm surprised that Enlightenment did not automatically find these for some of the more popular programs.

4) the Shelf's icon bar seems to start programs in their own environment separate from your user environment

I found this out because when I started Google Chrome in Enlightenment, Google Chrome no longer respected any of my proxy settings. The workaround was to create a simple shell script that exports my proxy environment variables and starts Chrome:
[sodo@computer ~]$ cat
export http_proxy=http://http-proxy:8080/
export https_proxy=http://http-proxy:8080/
export no_proxy=localhost,
/opt/google/chrome/google-chrome &

I then put that script in the Executable section of the icon. Don't forget the ampersand on the end of the command. If you don't have it, you may see an Enlightenment dialog popup saying something like "Enlightenment was unable to run the application..the app failed to start" when exiting out of the app.

5) The "Remember" feature: remember size, position and settings of a windowed program (in this case, gnome-terminal) plain ol' just doesn't work. Haven't got a workaround for this yet.

Other bothersome things I have yet to fix
1) it is meant as a convenience, but it is irritating when the cursor jumps to the Save dialog
* this was corrected via Settings -> Settings Panel -> Windows -> Window Focus -> Advanced -> uncheck "Slide pointer to a new focused window"

2) desktop switches to the adjacent one when your mouse is next to a desktop's far edge
* this was corrected via Settings -> Settings Panel -> Input -> Edge Bindings and removing the binding for the Right Edge. Erg!!

3) ctrl-shift left or right does not select text, it brings you to the adjacent desktop
* ARGH..still no fix

4) clicking on an application does not make the applications in front of the clicked application disappear..erg!
* this was corrected via Settings -> Settings Panel -> Windows -> Window Focus -> "Click Window to Focus".

5) I miss the GNOME system monitor panel widget. Weep.

It's always a tough row to hoe in the Linux world..nothing great or tasty or beautiful comes without some work.

Keep you posted..

E User Guide
good info on features and keybindings of Metacity:
Feel free to drop me a line or ask me a question.