Purpose

Mainly documenting a few things I don't want to forget. Perhaps it's useful to others as well.

If you came here for FISHWORKS (which I'm pretty sure you didn't), click here

tisdag 3 april 2012

RAMdisk with spillover onto SSD

The normal way to do this is to just mount a tmpfs, then create swap on SSD.
I can't do that, because tmpfs doesn't support O_DIRECT.

PURPOSE
======
Create a small to medium area for fast temporary storage with the ability to grow "onto" slower media. In my case, it's for MySQL temporary tables.


REQUIREMENTS
============
* Some RAM to spare
* 2*160G SSDs (or whatever you can get your hands on, or even regular rotating drives).

USAGE
=====

First we'll create a 40G file on tmpfs and associate a loop device to that file:

1. Create the ramdisk-backed loopback file:
# dd if=/dev/zero of=/dev/shm/ramdisk bs=1M count=40000

2. Create the loop device:
# losetup -f /dev/shm/ramdisk

3. (Optional) Create a logical volume (this is only to get disk statistics from iostat and /proc/partitions):

# gdisk -l /dev/loop0
Disk /dev/loop0: 83886080 sectors, 40.0 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 0E9B6683-EB36-4EAF-8A54-2C04B3486E7E
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 83886046
Partitions will be aligned on 2048-sector boundaries

mysql> select 83886046-33;
+-------------+
| 83886046-33 |
+-------------+
|    83886013 |
+-------------+
1 row in set (0.00 sec)

# echo "0 83886013 linear /dev/loop0 34" | dmsetup -u $(uuidgen) create ramdisk



Then we'll need to configure the SSD:

1. Find the sector info from the SSD:
# gdisk -l /dev/sdc
Disk /dev/sdc: 311427072 sectors, 148.5 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): B9A305D6-4536-42DB-A0F9-8861168F4061
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 311427038

2. Use the numbers above, hash out 80% of the drive:
mysql> select ceil(311427038-33*0.8);
+------------------------+
| ceil(311427038-33*0.8) |
+------------------------+
|              311427012 |
+------------------------+
1 row in set (0.00 sec)

echo "0 311427012 linear /dev/sdc 34" | dmsetup -u $(uuidgen) create ssd


Result:

  ls -l /dev/mapper/
  total 0
  crw------- 1 root root  10, 63 Feb 25 21:48 control
  brw-rw---- 1 root disk 253,  1 Apr  1 09:03 ramdisk
  brw-rw---- 1 root disk 253,  2 Apr  1 09:03 ssd

Next: Create a linear RAID device on these drives, with the ramdisk in the "bottom":
  mdadm --create /dev/md0 --level=linear --raid-devices=2 --name rambacked /dev/mapper/ramdisk /dev/mapper/ssd

Remember I said the logical volumes were optional? You might as well have done this:
  mdadm --create /dev/md0 --level=linear --raid-devices=2 --name rambacked /dev/loop0 /dev/sdc1
 

Create a filesystem:
  mkfs.xfs -f -l lazy-count=1 -L rambacked /dev/md0

Mount it:
  mkdir /rambacked
  mount -o rw,noauto,noatime,nodiratime,logbufs=8,nobarrier /dev/md0 /rambacked

Now, write 100G to it, first 40G will be blazingly fast:
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 0  0      0 143745408  22648 53620368    0    0     0     7    0    0  0  0 100  0  0
 0  0      0 143745792  22648 53620380    0    0     0     0 1028  620  0  0 100  0  0
 0  0      0 143745904  22648 53620380    0    0     0     0 1007  514  0  0 100  0  0
 0  0      0 143745680  22648 53620380    0    0     0     0 1607  540  0  0 100  0  0
 0  0      0 143745680  22648 53620380    0    0     0     0 1096  530  0  0 100  0  0
 0  0      0 143746288  22656 53620372    0    0     0    68 1016  585  0  0 100  0  0
 0  0      0 143746288  22656 53620372    0    0     0     0 1008  525  0  0 100  0  0
 0  0      0 143746400  22656 53620380    0    0     0     0 1033  541  0  0 100  0  0
 1  1      0 143746272  22656 53620380    0    0    12 909984 1018 5932  0  1 98  1  0 <- starting dd write.
 2  0      0 143746528  22656 53620392    0    0     0 2995456 1027 18285  0  4 92  4  0
 1  1      0 143746528  22664 53620384    0    0     0 2945324 1013 17996  0  4 92  3  0
 2  0      0 143746656  22664 53620392    0    0     0 2930912 1028 17906  0  4 92  3  0
 1  0      0 143746528  22664 53620392    0    0    12 2932992 1006 17920  0  4 92  3  0
 1  1      0 143746208  22664 53620404    0    0     0 3002720 1608 18326  0  4 92  4  0 <- 3Gb/s direct io
 1  0      0 143746096  22664 53620404    0    0     0 2982210 1088 18202  0  4 92  4  0
 2  0      0 143745968  22672 53620396    0    0     0 2954616 1012 18076  0  5 92  3  0
 1  1      0 143746080  22672 53620404    0    0    12 2890080 1005 17667  0  5 92  3  0
 1  1      0 143746208  22672 53620416    0    0     0 2911584 1028 17802  0  4 92  4  0
 2  0      0 143746336  22672 53620416    0    0     0 2915680 1008 17807  0  5 92  2  0
 1  1      0 143746336  22672 53620416    0    0     0 2963936 1024 18124  0  5 92  3  0
 1  0      0 143746336  22680 53620408    0    0    12 2957816 1012 18104  0  4 92  3  0
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 2  1      0 143746464  22680 53620428    0    0     0 2944480 1019 18004  0  4 92  3  0
 2  0      0 143746448  22680 53620428    0    0     0 2908608 1013 17783  0  4 92  3  0
 1  1      0 143746576  22680 53620428    0    0    12 2943520 1642 18019  0  5 92  3  0
 1  1      0 143746576  22680 53620428    0    0     0 2912813 1077 17815  0  5 92  3  0
 1  1      0 143746688  22688 53620432    0    0     0 2882072 1010 17744  0  5 93  3  0
 0  1      0 143746688  22688 53620432    0    0     0 2149280 5857 12183  0  3 94  3  0 <- spills over on SSD.
 0  1      0 143746816  22688 53620444    0    0     0 265665 3368 1591  0  0 96  4  0
 0  1      0 143746816  22688 53620444    0    0     0 180416 2596 1223  0  0 96  4  0 <- now 100% on SSD device (see iostat output below)
 0  1      0 143746944  22688 53620444    0    0     0 170176 2522 1215  0  0 96  4  0
 0  1      0 143746816  22696 53620436    0    0     0 173240 2534 1228  0  0 96  4  0
 0  1      0 143746816  22696 53620444    0    0     0 171208 2536 1224  0  0 96  4  0
 0  1      0 143746816  22696 53620444    0    0     0 172236 2543 1208  0  0 96  4  0

iostat output:

Linux 2.6.18-274.el5 (staging-db-lv-2.staging.marinsw.net)     03/31/2012

Device:         rrqm/s   wrqm/s   r/s   w/s   rsec/s   wsec/s avgrq-sz avgqu-sz   await  svctm  %util
sdc               0.00     1.69  0.00  0.41     0.00    88.68   214.24     0.01   23.96   0.60   0.03
md0               0.00     0.00  0.00  1.23     0.00   282.16   229.89     0.00    0.00   0.00   0.00
dm-1              0.00     0.00  0.00  0.00     0.00     0.00     8.48     0.00    0.02   0.02   0.00

Device:         rrqm/s   wrqm/s   r/s   w/s   rsec/s   wsec/s avgrq-sz avgqu-sz   await  svctm  %util
sdc               0.00     0.00  0.00  0.00     0.00     0.00     0.00     0.00    0.00   0.00   0.00
md0               0.00     0.00  0.60 9592.20     4.80 2182758.40   227.54     0.00    0.00   0.00   0.00
dm-1              0.00     0.00  0.60 9592.20     4.80 2182758.40   227.54     1.25    0.13   0.03  25.5    <- 100% in RAM

Device:         rrqm/s   wrqm/s   r/s   w/s   rsec/s   wsec/s avgrq-sz avgqu-sz   await  svctm  %util
sdc               0.00     0.00  0.00  0.00     0.00     0.00     0.00     0.00    0.00   0.00   0.00
md0               0.00     0.00  0.60 25900.60     4.79 5893825.15   227.55     0.00    0.00   0.00   0.00
dm-1              0.00     0.00  0.60 25901.20     4.79 5893973.65   227.55     3.11    0.12   0.03  67.54  <- 26000 writes per second

Device:         rrqm/s   wrqm/s   r/s   w/s   rsec/s   wsec/s avgrq-sz avgqu-sz   await  svctm  %util
sdc               0.00     0.00  0.00  0.00     0.00     0.00     0.00     0.00    0.00   0.00   0.00
md0               0.00     0.00  1.20 25693.20     9.60 5846630.40   227.55     0.00    0.00   0.00   0.00
dm-1              0.00     0.00  1.20 25692.60     9.60 5846481.60   227.54     3.78    0.15   0.03  74.26

Device:         rrqm/s   wrqm/s   r/s   w/s   rsec/s   wsec/s avgrq-sz avgqu-sz   await  svctm  %util
sdc               0.00     0.00  0.00  0.00     0.00     0.00     0.00     0.00    0.00   0.00   0.00
md0               0.00     0.00  0.60 25683.40     4.80 5844178.00   227.54     0.00    0.00   0.00   0.00
dm-1              0.00     0.00  0.60 25683.40     4.80 5844178.00   227.54     3.20    0.12   0.03  66.98

Device:         rrqm/s   wrqm/s   r/s   w/s   rsec/s   wsec/s avgrq-sz avgqu-sz   await  svctm  %util
sdc               0.00     0.00  0.00 2230.20     0.00 507516.80   227.57     4.15    1.86   0.34  76.84   <- spilling over on SSD.
md0               0.00     0.00  0.00 7463.40     0.00 1698205.00   227.54     0.00    0.00   0.00   0.00
dm-1              0.00     0.00  0.00 5231.80     0.00 1190377.80   227.53     0.80    0.15   0.03  15.66

Device:         rrqm/s   wrqm/s   r/s   w/s   rsec/s   wsec/s avgrq-sz avgqu-sz   await  svctm  %util
sdc               0.00     0.00  0.00 1506.60     0.00 342835.20   227.56     5.13    3.41   0.65  98.64   <- almost exclusively on SSD.
md0               0.00     0.00  0.00 1507.80     0.00 342842.00   227.38     0.00    0.00   0.00   0.00
dm-1              0.00     0.00  0.00  1.20     0.00     6.80     5.67     0.00    0.00   0.00   0.00

Device:         rrqm/s   wrqm/s   r/s   w/s   rsec/s   wsec/s avgrq-sz avgqu-sz   await  svctm  %util
sdc               0.00     0.00  0.00 1508.00     0.00 343145.60   227.55     5.20    3.45   0.65  98.56   <- exclusively SSD.
md0               0.00     0.00  0.00 1508.40     0.00 343244.80   227.56     0.00    0.00   0.00   0.00
dm-1              0.00     0.00  0.00  0.00     0.00     0.00     0.00     0.00    0.00   0.00   0.00

Device:         rrqm/s   wrqm/s   r/s   w/s   rsec/s   wsec/s avgrq-sz avgqu-sz   await  svctm  %util
sdc               0.00     0.00  0.60 1506.00     4.80 342723.20   227.48     5.12    3.40   0.65  98.34   <- 1600 writes per second.
md0               0.00     0.00  0.60 1505.60     4.80 342432.20   227.35     0.00    0.00   0.00   0.00
dm-1              0.00     0.00  0.00  0.80     0.00     6.60     8.25     0.00    0.00   0.00   0.00

Useful? Maybe... if you have a use for a partition that's fast most of the time (as long as you don't go over a certain storage limit) but with the ability to spillover onto slower storage, this is it.

lördag 18 februari 2012

Telenor Mobilt Bredband

Number: *99***1# APN: internet.telenor.se Authentication methods: EAP, PAP, MSCHAPv2, MSCHAP (CHAP disabled)

tisdag 17 januari 2012

Mediatomb and Samsung TV

Either DLNA is shitty and too hard for everyone to get right, or Samsung is, I don't know, but to support the Samsung TV you need to add these custom headers to the mediatomb configuration:

måndag 24 oktober 2011

Live screencasting with ffmpeg, ffserver

Put this ffserver.conf file on your server:

 Port 8090  
 RTSPPort 5554  
 BindAddress 0.0.0.0  
 MaxHTTPConnections 500  
 MaxClients 200  
 # 8 Mbits  
 MaxBandwidth 8000  
 CustomLog -  
 NoDaemon  
 <Feed screencast.ffm>  
     File /tmp/screencast.ffm  
     FileMaxSize 30M  
     ACL allow 0.0.0.0 255.255.255.255  
 </Feed>  
 <Stream screencast.swf>  
  Feed screencast.ffm  
  Format swf  
  VideoCodec flv  
  VideoFrameRate 20  
  VideoBufferSize 80000  
  VideoBitRate 768  
  VideoQMin 1  
  VideoQMax 5  
  VideoSize 1376x768  
  PreRoll 0  
  StartSendOnKey  
  AudioBitRate 64  
  AudioChannels 2  
  AudioSampleRate 44100  
  AVOptionAudio flags +global_header  
 </Stream>  
 <Stream status.html>  
     Format status  
     ACL allow localhost  
     ACL allow 192.168.0.0 192.168.255.255  
 </Stream>  
 <Redirect index.html>  
     URL http://www.ffmpeg.org/  
 </Redirect>  

here's a shortcut screencast.sh file, run this on your desktop machine you're screencasting from:
 #!/bin/sh  
 ffmpeg -f x11grab -r 25 -s wxga -i :0.0 -f alsa -ac 2 -ar 44100 \  
  -i hw:PCH,0,0 http://server:8090/screencast.ffm  

Now, simply log on to your server, run ffserver -f ffserver.conf. Then run screencast.sh from your desktop.

You might need to change the input device, you can list them with arecord -l.
Also, replace 'server' with your server address, and check the input dimensions (-s wxga above) and the output dimensions (VideoSize in ffserver.conf) it's a bit tricky and doesn't match the input size to 100%, because the VideoSize dimensions need to be a multiple of 16.

söndag 23 oktober 2011

The Shitty Logitech Squeezebox Radio

Ok, not all shitty once it actually works, but there's a problem with it's software (drivers) or wireless hardware, atleast in combination with my Netgear router.

With WMM enabled, things are really shitty... The Squeezebox shows meta information and browsing the directories is almost not shitty. It's experiencing general slowness and lag. Response to Squeezeboxserver remote commands are kind of random. And audio just doesn't play at all... On one occasion I saw the "Buffering" message reach a staggering 2%. Wow, that's only 98% shitty!

So, turning off WMM (Wireless MultiMedia extension support) in the router seems to fix the issue.



I've never had a problem until now with this on any of the 10-20 devices that's ever been hooked up to my router.

I'm going to say it again, if you have a similar wireless issue on your Shitty Logitech Squeezebox Radio - turn of WMM in your router.

onsdag 14 september 2011

Nokia N900 headset white M+ lead broken

So, after some reading about why my N900 didn't detect my headset as a headset I opened it up and indeed, it was just as they said. The white M+ lead is torn off the solder. I didn't open the headset up until after I had my entire N900 torn apart on my lunch break. At least I got a shitload of dust and pocket lint out of it.




Update:

I now have tools to try to fix this thing.


So, I had 3 minutes left before leaving for the station and soldered the mofo back together and the headset now works!

Update: 2011-10-20: Soldering broke and cable came loose while on my trip to the States, so I resoldered it again today at the office.

tisdag 30 augusti 2011

Compaq Mini 730OE Broadcom BCM4312 Wireless flakyness

Symptoms: Can't connect... 4-way handshake timeout. deauthenticated by Reason: 15.

First of all you need the b43 firmware:

apt-get install firmware-b43-lpphy-installer

Then put this in /etc/modprobe.d/b43.conf:

options b43 pio=1 qos=0

tisdag 29 mars 2011

FreeBSD ZFS Benchmarks






Some sysbench results on a HP ProLiant DL320s with 10 disks.
HP Smart Array P400 controller with 256MB cache. Each physical disk is it's own logical drive.

I know there's not much data or background. I will add more information later.
The script i used on each pool/filesystem.

I also used another script to parse each fileio output file into something usable.

zfs synopsis for all pools:
zpool create tank MEMBERS
zfs -o recordsize=16K tank/sysbench

where MEMBERS were one of the following:
da1 da2 da3 da4 da5 da6 da7 da8 da9 da10

mirror da1 da10 mirror da2 da9 mirror da3 da8 mirror da4 da7 mirror da5 da6

raidz da1 da10 da2 da9 da3 raidz da4 da8 da5 da7 da6

raidz2 da1 da10 da2 da9 da3 raidz2 da4 da8 da5 da7 da6

mirror da1 da10 da2 mirror da3 da9 da4 mirror da5 da8 da6

I'm more used with benchmarking on Linux so I've yet to come up with a really good comparative benchmark method.

I plan to add 2 x Vertex 3 Pro SSDs as cache and 1 x Intel X25-E as log device and try on a bigger dataset, pre-warmup and after post-warmup to see if there's good benefits from the SSD drives. The machine has 1G ram today, tomorrow I will have 6 or 7G ram in it.

tisdag 14 december 2010

Nokia N900 Maemo key remap

Issue: The bar symbol is missing on the N900 keyboard:
bar symbol ("|"):
File: /usr/share/X11/xkb/symbols/nokia_vndr/rx-51

In section:
xkb_symbols "nordic_base" {

Change:
key { [ c, C, bar, sterling ] };

Issue: The N900/Maemo sends Keypad_Enter, not Enter. Causing various things to fail on a remote tmux ssh session:
.tmux.conf: bind -n KPEnter send-keys Enter

Thanks hakan. Source: http://www.madhacker.org/computerincar.htm

måndag 13 december 2010

Nokia N900 Maemo Telenor fMMS Settings

Nokia N900
Maemo 5
Version: 20.2010.36-2
fMMS 1.3.0

The fMMS Settings that work on my Nokia N900 with Swedish provider Telenor are:

Internet connection settings
Access point name: services.telenor.se
MMSC: http://mms/
User name:
Password:
HTTP proxy: 172.30.253.241
Port number: 8799

Network mode: Havoc

fredag 5 november 2010

Apache PHP TypesConfig and the Upload file security risk

Reading the Bacula Mailing List I stumbled upon an informative blog and happened to read one of the posts a bit more tentatively than the others:
How Apache PHPs setting exposes a security risk


Now, reading that Apache, when configured with AddType or AddHandler, will execute any file with ".php" anywhere in it's filename, I was a bit chocked.

First I verified it on my server which is a Debian Lenny with Apache2 and php5.

I created the files somewhere in my webroot:
1. foo.php
2. foo.php.bar

Both files execute by the php engine.

But it gets worse...

I then removed EVERYTHING regarding php from my Apache2 configuration and restarted the webserver - Obviously, I would get plain ascii source code output this time.

Continuing I readded "LoadModule php5_module /usr/lib/apache2/modules/libphp5.so".

What now? Both files still execute by the php engine! Even without AddType, AddHandler or SetHandler.

The PHP Manual talks about a solution to use instead of AddHandler:
http://se2.php.net/manual/en/install.unix.apache2.php

Action Point 8:
Tell Apache to parse certain extensions as PHP. For example, let's have Apache parse .php files as PHP. Instead of only using the Apache AddType directive, we want to avoid potentially dangerous uploads and created files such as exploit.php.jpg from being executed as PHP. Using this example, you could have any extension(s) parse as PHP by simply adding them. We'll add .php to demonstrate.
And it includes a snippet for a suggested practice:
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>
Now, atleast in my case this doesn't help since a simple LoadModule activates the awesomeness of *.php*.

This is, I found, due to the Apache TypesConfig directive.
Debian Apache include: "TypesConfig /etc/mime.types" if mod_mime is loaded.
Contrary to the Apache documentation on TypesConfig, the extensions in that file are not actually extensions.... they're substrings!

My solution:
/etc/apache2/conf.d/php-safer.conf:
<FilesMatch "[^(\.php)]$">
php_admin_flag engine off
</FilesMatch>

torsdag 9 september 2010

because a quiet mysql import is no fun

time pv -c -N gz /tmp/mysqldump.sql.gz | gunzip -c | pv -c -N unpacked | perl -pe 'print STDERR ($_) unless m/^INSERT/i' | mysql-main

...
unpacked: 611MB 0:02:20 [4.41MB/s] [ <=> ]
gz: 69.6MB 0:02:20 [ 469kB/s] [> ] 0% ETA 9:56:01
...

måndag 6 september 2010

tisdag 31 augusti 2010

Todays fulhack: On Call Diversion script for Nagios

A little concept hack that'll be used in Nagios to set diversion for the on call number as well as control who gets sms and when.

(c) 2010 Fulhack Industries

The divert method in this one is done through Telenor but it could just as well be through a GSM modem or a Nokia/Ericsson phone connected via USB.
https://minasidor.telenor.se/


tisdag 13 juli 2010

ircd-seven start scripts

ircd:

#!/bin/bash
#
# /etc/rc.d/init.d/ircd
#
# IRCd-seven
# Script to start and stop IRCd-seven
# Author: Mikael Fridh
#
# chkconfig: 2345 90 10
# description: IRCd-seven is an IRC daemon
# processname: ircd
# config: /usr/local/ircd/etc/ircd.conf

# Source function library.
. /etc/init.d/functions

# Defaults
IRCD_USER=ircd

# Pull in settings:
[ -f /etc/sysconfig/ircd ] && [ . /etc/sysconfig/ircd ]

start() {
echo -n "Starting ircd: "
daemon --check ircd --user ${IRCD_USER} /usr/local/ircd/bin/ircd
echo
touch /var/lock/subsys/ircd
return 0
}

stop() {
echo -n "Shutting down ircd: "
killproc ircd
echo
rm -f /var/lock/subsys/ircd
return 0
}

case "$1" in
start)
start
;;
stop)
stop
;;
status)
status ircd
;;
restart)
stop
start
;;
reload)
echo -n "Sending ircd the HUP signal ..."
killproc ircd "-HUP"
echo
;;
condrestart)
[ -f /var/lock/subsys/ircd ] && restart || :
;;
*)
echo "Usage: ircd {start|stop|status|reload|restart|condrestart}"
exit 1
;;
esac
exit $?

torsdag 1 juli 2010

Wrote an article (howto) on incorporating vmware view in Ubuntu LTSP

I wrote this a couple weeks ago;
http://help.ubuntu.com/community/UbuntuLTSP/VMWareViewVDI

In short; Allows you to create a thin client out of any commodity hardware PC, for use with a Vmware View Server.

LTSP is a really nice project... kudos to ThinStation, but I got way better performance out of VMWare View on Ubuntu than on ThinStation... mainly due to poor graphics driver support in ThinStation.

onsdag 21 april 2010

xorg.conf ModeLine for HP2159v

So I got a new Desktop Computer (Dell Precision 380) and a Monitor: HP2159v, a 21.5" Full-HD monitor, it's perfectly fine, nice picture quality. Downside - the only connector is VGA, no DVI, no HDMI. I'm happy with whatever I get since I've exclusively been using laptops for 6 years now.

This config got 1920x1080 resolution going for me:

Section "Monitor"
Identifier "HP2159v"
# 1920x1080 59.96 Hz (CVT 2.07M9) hsync: 67.16 kHz; pclk: 173.00 MHz
HorizSync 24.0 - 94.0
VertRefresh 50.0 - 76.0
Modeline "1920x1080" 173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync
EndSection

Section "Screen"
Identifier "Default Screen"
Monitor "HP2159v"
Device "Configured Video Device"
DefaultDepth 24
SubSection "Display"
Depth 24
Modes "1920x1080" "1024x768"
EndSubSection
EndSection

Section "Module"
Load "glx"
EndSection

Section "Device"
# nVidia Corporation NV41GL [Quadro FX 1400] (rev a2)
Identifier "Configured Video Device"
Driver "nvidia"
Option "NoLogo" "True"
EndSection

söndag 21 februari 2010

Stream sound from Windows to Linux with LiveInCode and PulseAudio

My OS's: Debian 5.0 Lenny / Windows Vista Home Premium.

Debian 5.0 (Lenny):
1. sudo apt-get install pulseaudio alsa-utils
2. sudo alsamixer -Dhw crank volume, unmute ...
3. pulseaudio --log-target=stderr
4. alsamixer -Dpulse crank, unmute ...


Windows Vista, configure Recording Mixer.:
1. Go to Recording Devices -> Recording.
2. Right click a free area in the recording device list -> mark "Show Disabled Devices"
3. Now enable "Stereo Mix".

Windows Vista, the Levels I chose for minimum distortion.
Click Properties on "Stereo Mix". Choose "Levels". Crank Stereo Mix to 100.
Set the Main output Level to 50.
Next, I jacked a headphone jack (3.5mm) into my laptops headphone outlet in order to physically mute it.

Windows Vista, software:
1. Install Cygwin.
2. Install LineInCode: http://liveincode.rm.pp.ru/
3. Put lineco.exe in your path for simplicity.
4. Launch cygwin, run linco.sh after putting the following in it:

linco.exe --flag-files -B 16 -C 2 -R 48000 | ssh mikaelf@host.internal.example.com "pacat --rate=48000 --playback"

Now all your audio is "routed" to your Linux Machine!
Note: I used SSH public keys for the ssh connection.

Next, wrap the linco.exe line in a while [ 1 ]; do linco ...; sleep 60; done to make it autorestarting in case you lose connection to your sound server.

Things to note:
You might be using 44.1Khz rate all over, make sure you adapt your settings and scripts so the rate matches on both hosts.

References:

torsdag 26 mars 2009

Ubuntu 8.10 Intrepid on Asus EeePC 901Go

So, got my Asus EeePC 901Go 3G and after reading alot of recent praise for Ubuntu on it (even Vanilla Ubuntu) I decided to go for that. I like to keep as close to upstream as possible.

CPU Model: Intel Atom N270
Chipset: Intel 945GSE


Preparing for Installation

ISO: http://se.releases.ubuntu.com/releases/8.10/ubuntu-8.10-desktop-i386.iso
Boot the Ubuntu Live CD and, or from an already installed Ubuntu, launch usb-creator.
Insert a pen drive, choose your CD or ISO and create the startup media.
Make sure you have a Wire connection or a Mobile Broadband sim card because your wireless network adapter will not work out of the box.

Installation

Insert the pen drive in your Eee, boot it by pressing Esc for BBS Popup Menu and choose to boot from pen drive.
Install Ubuntu as usual.

Issues
During installation I could not reach the "Next" icons with the mouse pointer. I blindly pressed Enter to get past the first few installation dialogues.
Note: I performed my first installation in Safe graphics mode and after that installation my Ubuntu only showed 800x600 resolution. Probably because it adds Driver "vesa" to xorg.conf

First boot
Log in and install software upgrades.

Wireless Support


* Download compat-wireless for kernels >= 2.6.27.

Follow the instructions to Build, Install, Unload, and Load (modprobe ath5k or reboot)

Hot Keys & OSD:
http://greg.geekmind.org/eee-control/

Other tweaks:

http://hehe2.net/linuxhowto/howto-your-perfect-ubuntu-on-your-perfect-eee-pc/