Saturday, April 27, 2013

Ubuntu 12.04.02 on Dell Inspiron 1520

I installed from a USB stick. I kept a /home partition I had from a previous installation. I have 2GB RAM so I made a 2048 MB swap partition.

The ethernet card was recognized when running from the USB stick but not after booting into installed system (lspci listed it but ifconfig did not). I removed bcmw-kernel-source and rebooted, and the ethernet worked. I installed firmware-b43-installer, and rebooted. At this point I may have use Additional Drivers to install b43 drivers. Or I did something with b43-fwcutter. In any case, my wireless works now.

When calling suspend with the lid open, the screen goes to a terminal with a flashing cursor and then comes back to the login screen. When I close the lid, the machine honestly sleeps, so go figure.

Hibernate worked when using pm-suspend. I enabled hibernation according to standard documentation (here).

Thursday, April 18, 2013

OpenBox status bar

I wanted a simple status bar on OpenBox. I ended up using conky with the following .conkyrc:


# window
own_window yes
own_window_class Conky
own_window_type desktop
own_window_transparent yes
alignment top_middle

# stop flickering
double_buffer yes

# size
gap_x 0
gap_y 0
minimum_size 1265 20
#maximum_width 400
text_buffer_size 512

border_width 1
cpu_avg_samples 2
default_color white
default_outline_color white
default_shade_color white
draw_borders no
draw_graph_borders yes
draw_outline no
draw_shades no
use_xft yes
xftfont Inconsolata:size=12
net_avg_samples 2
no_buffers yes
out_to_console no
out_to_stderr no
extra_newline no
stippled_borders 0
update_interval 1.0
uppercase no
use_spacer none
show_graph_scale no
show_graph_range no

TEXT
${color grey}net:${if_existing /sys/class/net/eth0/operstate up}${color}eth0$else${if_existing /sys/class/net/wlan0/operstate up}$color${exec /home/my_name/scripts/network_stat.py name} ${exec /home/my_name/scripts/network_stat.py strength}${color grey}%${else}none$endif$endif $alignc${color grey}cpu:$color$cpu${color grey}%  ram:$color$memperc${color grey}%  bat:$color$battery_percent${color grey}%  vol:$color${execpi 1 /home/my_name/scripts/volume.sh}  ${color grey}${if_mpd_playing}${execpi 1 mpc | awk 'NR==2 {print $1}' | sed 's/[^a-Z]//g'}${else}not playing${endif} $alignr$alignc${time %a %d %b} $color${time %H:%M}

I made my own scripts network_stat.py to report the wireless connection and quality from iwconfig and and volume.sh to report the un/muted status and volume from amixer get Master.

I adjusted OpenBox using obconf to create a 20 px upper margin so that no program window overlays the conky panel.

Printing duplex pdfs

After I got printing on my Arch machine working, I had trouble getting pdf's to print duplex from lpr. I tried changing the Duplex option in lpoptions and the default settings for the printer in CUPS, all to no good result. I could get duplex pdf's printed using chrome or evince.

Instead I used pdftops to make a postscript file, which I can lpr in duplex just fine.

Mosh for a compute cluster

Mosh is an awesome tool for folks who repeatedly ssh to one machine. In an ideal world, you can keep stay logged in to the machine even as your computer’s internet connection turns on and off. Mosh does exactly this. I keep one terminal window open with mosh; whenever my computer reconnects to the internet, it automatically restarts the ssh session right where it left off, with no password entry or anything.

I wanted to use Mosh to connect to my computing cluster, but some dependencies were missing. It was a little confusing to get them set up, so I give the play-by-play here. First I got protobuf:

cd ~
mkdir src && cd src
wget https://protobuf.googlecode.com/files/protobuf-2.5.0.tar.gz
tar xvzf protobuf-2.5.0.tar.gz
cd protobuf-2.5.0
./autogen.sh
./configure --prefix=/home/my_name/local
make
make install

Then I got mosh:

cd ~/src
git clone https://github.com/keithw/mosh
cd mosh
./autogen.sh
PKG_CONFIG_PATH=/home/my_name/local/lib/pkgconfig ./configure --prefix=/home/my_name/local
make
make install

If I don't specify the package config path, I get a message:
No package 'protobuf' found

Don't be so sure that your home folder is in /home/your_name on every cluster! Just do a quick pwd to make sure you know where you are. The package config path must be absolute.

Then I can use mosh to log into the cluster:
mosh cluster_name server='LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/my_name/local/lib /home/my_name/local/bin/mosh-server'

Without specifying the library path, I get an error:
error while loading shared libraries: libprotobuf.so.8: cannot open shared object file: No such file or directory

Tuesday, April 9, 2013

Mounting an SD card

My camera uses an SD card. To mount it, I needed dosfstools. I used dmesg | tail to find out which device the card was assigned to (/dev/mmblksomething). To mount, I needed to specify the filesystem (FAT16, so "vfat" from dosfstools) and the first partition on the device (/dev/mmblksomethingp1):

sudo mount /dev/mmblksomethingp1 /mnt/sd -t vfat