Sat, 26 Sep 2009
Splitting albums with cue files
Keywords: split cue flac mp3 linux ubuntu
In order to split a flac file of an entire album into its constituent parts:
$ sudo aptitude install cuetools shntool flac $ shnsplit -o flac -t '%a %n %t' -f *.cue *.flac
You can do something similar with other lossless formats.
To do the same with an mp3 file:
$ sudo aptitude install mp3split $ mp3split -c *.cue *.mp3
Obviously you'll need to be a little more specific if you have more than one album in a directory.
Mon, 09 Mar 2009
Keywords: linux ubuntu 8.10 intrepid ibex ATI Technologies Inc RV370 [Radeon X300SE] X300
And yet another of the things that broke when I upgraded Ubuntu to 8.10 was the 3D graphics acceleration. lspci identifies my card as
01:00.0 VGA compatible controller: ATI Technologies Inc RV370 5B60 [Radeon X300 (PCIE)] 01:00.1 Display controller: ATI Technologies Inc RV370 [Radeon X300SE]
The X log file (/var/log/Xorg.0.log) tells me:
(II) fglrx(0): driver needs X.org 1.4.x.y with x.y >= 99.906 (II) fglrx(0): detected X.org 7.4.2.0 (EE) fglrx(0): atiddxDriScreenInit failed, GPS not been initialized. (WW) fglrx(0): *********************************************** (WW) fglrx(0): * DRI initialization failed! * (WW) fglrx(0): * (maybe driver kernel module missing or bad) * (WW) fglrx(0): * 2D acceleraton available (MMIO) * (WW) fglrx(0): * no 3D acceleration available * (WW) fglrx(0): ********************************************* * $ glxinfo name of display: :0.0 X Error of failed request: BadRequest (invalid request code or no such operation) Major opcode of failed request: 159 (GLX) Minor opcode of failed request: 19 (X_GLXQueryServerString) Serial number of failed request: 10 Current serial number in output stream: 10 $
It seems this was finally fixed this year with Catalyst 9.2. In accordance with the instructions I downloaded the installer from AMD and then installed it:
# apt-get remove --purge xserver-xorg-video-radeon fglrx-kernel-source fglrx-modaliases
# sh ati-driver-installer-9.2-x86.x86_64.run --buildpkg Ubuntu/8.10
# dpkg -i xorg-driver-fglrx_8.582-0ubuntu1_i386.deb \
xorg-driver-fglrx-dev_8.582-0ubuntu1_i386.deb \
fglrx-amdcccle_8.582-0ubuntu1_i386.deb \
fglrx-modaliases_8.582-0ubuntu1_i386.deb \
libamdxvba1_8.582-0ubuntu1_i386.deb \
fglrx-kernel-source_8.582-0ubuntu1_i386.deb
I suppose it's only to be expected that after rebooting X wouldn't start. The X log file told me:
(II) LoadModule: "amdxmm"
(II) Loading /usr/lib/xorg/modules//amdxmm.so
(II) Module amdxmm: vendor="X.Org Foundation"
compiled for 1.4.99.906, module version = 1.0.0
ABI class: X.Org Server Extension, version 1.1
Backtrace:
0: /usr/X11R6/bin/X(xf86SigHandler+0x79) [0x80c3009]
1: [0xb7fde400]
2: /usr/lib/xorg/modules//amdxmm.so(amdxmmInit+0x245) [0xb61a4845]
3: /usr/lib/xorg/modules/drivers//fglrx_drv.so [0xb76a3bdc]
4: /usr/lib/xorg/modules/drivers//fglrx_drv.so(atiddxScreenInit+0x7b4) [0xb7699e94]
5: /usr/X11R6/bin/X(AddScreen+0x19f) [0x807137f]
6: /usr/X11R6/bin/X(InitOutput+0x206) [0x80aa536]
7: /usr/X11R6/bin/X(main+0x279) [0x8071b19]
8: /lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe5) [0xb7bdc685]
9: /usr/X11R6/bin/X [0x8071101]
Saw signal 11. Server aborting.
(II) Screen 0 shares mem & io resources
(II) Screen 1 shares mem & io resources
(EE) fglrx(0): === [swlDalHelperSetControllerConfigForRemap] === CWDDC ControllerSetConfig failed: 6 - 0
Wonderful. But easily fixed:
# mv /usr/lib/xorg/modules/amdxmm.so /usr/lib/xorg/modules/amdxmm.so.busted
Presumably, something's not going to work now, but at least it's better than it was, and 3D acceleraton works. I can even watch video.
For some, possibly unrelated, reason at this point the volume control knob on the keyboard stopped controlling the volume until I set the Default Mixer Track in System/Preferences/Sound to HDA Intel (Alsa mixer).
Mon, 05 Jan 2009
Getting ssh to work over wireless on HP 2133
Ssh over wireless hangs into and out of the HP 2133. Changing the MTU doesn't help. What does help is running:
iwpriv eth0 set_vlanmode 0
Wed, 03 Dec 2008
Keywords: linux ubuntu 8.10 intrepid ibex sane hp scanjet 5370C avision
Another of the things that broke when I upgraded Ubuntu to 8.10 was the scanning. To be fair, it had barely been working since the upgrade to 8.04, but with 8.10 scanimage just crashed. I debugged it a little and discovered that by uncommenting "option disable-calibration" in /etc/sane.d/avision.conf I could avoid the crash, but after scanning in one direction the scanner wouldn't return to its resting position.
Eventually, I decided that if I was going to fix the crash I'd have to build a debugging version of the code, and that if I was going to do that I should get the latest version available. It turns out that was in a CVS repository and was fairly easy to obtain and build:
cvs -z3 -d:pserver:anonymous@cvs.alioth.debian.org:/cvsroot/sane co sane-backends ./configure --sysconfdir=/etc --prefix=/usr/local/pkg/sane make make install
And BINGO! The crash was fixed, and I didn't had to change any code at all.
I still had the problem, which was also there in 8.04, that the preview in xsane has diagonal stripes. Do I decided to do away with xsane and replace it by a small shell script which I imaginatively named scan:
#!/bin/sh out=$1 shift LD_LIBRARY_PATH=/usr/local/pkg/sane/lib/sane:$LD_LIBRARY_PATH /usr/local/pkg/sane/bin/scanimage -d avision -v -p --resolution=300 "$@" > /tmp/out.pnm convert -quality 90 -verbose /tmp/out.pnm $out gimp $out
So now, when I scan album art, for example, (which is what I most commonly scan nowadays), I can just type scan front.jpg and the cover is scanned and thrown up in gimp for me to crop and save. This has been working well so far.
Tue, 02 Dec 2008
Keywords: linux ubuntu 8.10 intrepid ibex pulseaudio problems solution success multimedia keys volume
I recently upgraded my desktop box from Ubuntu 8.04 (Hardy Heron) to 8.10 (Intrepid Ibex). (I've written down the names so I can look them up when I need to. At least they seem to have settled on some sort of alphabetical system nowadays.)
Anyway, one of the things that broke during the process was sound. And for me it didn't just work, which is bad and wrong. So I searched the web and discovered that 8.10 is now using pulseaudio by default and that I wasn't alone with my sound problem, with many people claiming that pulseaudio just wasn't yet ready for primetime.
So I read up a little on pulseaudio, found out lots of things I didn't really want to know, tweaked all sorts of stuff and eventually got sound out of amarok, but not flash or any of the video players. And not after I had rebooted until I messed with things again. The "solution" involved killing pulseaudio and forcing things to use alsa or oss or something, and it also broke the remaining working multimedia buttons including the volume control, the rest already having been seen off by the upgrade.
Eventually, I really needed to hear something that was on flash, so I searched the web again, and came across a page on the ubuntu forum. I followed it, I set the resample-method to the highest quality, and everything just worked again.
Well, mostly.
Some of the tracks I played caused pulseaudio to crash. So I reduced the resample-method by one notch and things seem OK there so far. I got the volume and mute multimedia keys on my keyboard to work by setting the Default Mixer Track in System/Preferences/Sound to the appropriate "Playback: ALSA" device. I got the rest to work by running the Gnome Multimedia Key's script in the amarok script manager (the author must have been a greengrocer in a previous life).
Of course, the display, the scanner and other stuff were all just as broken as before. But that's another story.
(I'm not sure whether adding the new repositories is strictly necessary - no packages were installed from them - but I can't be bothered to mess with it any more.)
Fri, 18 Jan 2008
I don't often have to set up a new system, but every time I do I completely forget the very useful way that debian and ubuntu can save the set of installed packages and reinstall them later. So here it is for next time:
# dpkg --get-selections > /packages.lst # dpkg --set-selections < /packages.lst
Sat, 28 Apr 2007
Here's the steps I have taken to flash my wife's N800 and make it useful.
Flashing
From maemo.org,
- Get the linux flasher-3.0 and firmware image. Put them in the same directory on your linux box.
- Update: get the latest image.
- Switch off the N800, unplug the charger and connect the N800 to your linux machine with the USB cable.
- As root, or a user with permissions to access USB, run
./flasher-3.0 -F RX-34_2007SE_3.2007.10-7_PR_COMBINED_MR0_ARM.bin -f -R
- Update: run
./flasher-3.0 -F RX-34_2007SE_4.2007.26-8_PR_COMBINED_MR0_ARM.bin -f -R
- Wait for the message
Suitable USB device not found, waiting
- Switch on the N800 by either
- Plugging in the charger or
- Switching it on using the power button whist pressing the Home button
- The image should now flash and the N800 will reboot
Get root
In order to do anything interesting, you'll need root access. This involves adding a repository and installing a couple of applications. The N800 uses the debian packaging system, so this will be familiar to anyone who is used to debian or ubuntu.
- Add the repository
Catalog name Maemo Repository Web address http://repository.maemo.org/ Distribution bora Components free non-free
See http://maemo.org/maemowiki/MaemoReleasesRepositoriesDistros for more information.
- Install osso-xterm.
- Update: Also available here.
- Install becomeroot by clicking on http://eko.one.pl/maemo/dists/mistral/user/binary-armel/becomeroot_0.1-2_armel.deb in the browser on your N800.
- Start xterm. It's in the extras menu.
- run sudo gainroot
- set the root password
Red pill mode
Red pill mode is an (ex) easter egg providing access to some advanced features. Activate it by going to add a new application catalogue, setting the "Web Address" to "matrix" and pressing "Cancel".
See http://hildon-app-mgr.garage.maemo.org/redpill.html for more information.
Ssh
Install the ssh package.
- Update: Also available here.
Configure
Perform whatever configuration you would like. For example:
- Set the hostname - echo myn800 > /etc/hostname
- Set up hosts - scp myserver:/etc/hosts /etc
Add packages
Other useful packages can be found at http://maemo.org/downloads/, for example:
wget
Install by clicking on http://mg.pov.lt/770/wget.install
Start the server by running x11vnc.sh&
vnc
Download http://mike.saunby.googlepages.com/x11vnc_0.8-3_armel.deb from http://mike.saunby.googlepages.com/x11vncfornokia7702 and install it using dpkg -i x11vnc_0.8-3_armel.deb.
In order to get mouse clicks working properly, you will need to add the string " -extension XInputExtension" to the ARGS string in the file /etc/init.d/x-server. For me, that leaves line 5 as
ARGS="-mouse tslib -nozap -dpi $DISPLAY_DPI -wr -nolisten tcp -extension XInputExtension"
Then reboot.
Gizmo
Install http://download.gizmoproject.com/GizmoDownload/gizmo-project_2.0.0.56_N800_armel.deb from http://www.gizmoproject.com/download.php.
rsync
Install from http://maemo.org/downloads/product/grsync/. (Doesn't seem happy to install. Perhaps it's only for the 770 after all?)
Claws-mail
Install from http://maemo.org/downloads/product/claws-mail.
Canola
Install from http://openbossa.indt.org/canola/help.html. Reboot after the installation. To enable clicking on items, run
gconftool-2 -s -t bool /apps/canola/plugins/uicontainer/free_click true gconftool-2 -s -t bool /apps/canola/plugins/uifolder/free_click true
Boot off SD
Why might you want to do that? Well, you get your root filesystem somewhere where it's not going away, you can make it as large as you need and, as a bonus, not being a jffs2 filesystem it will probably seem about twice as fast.
Partition the SD card
I've seen instructions for doing this on the N800. It seems easier to me to just plug a card reader into your linux box and partition it that way.
Make the first partition FAT16(6) and the second linux(83).
fdisk /dev/sdb
Format the partitions
mkdosfs /dev/sdb1 mke2fs /dev/sdb2
On Ubuntu, removing and reinserting the card should be enough to create the required devices to run these commands.
Get GNU tar onto your N800
The busybox tar just won't cut it, so you'll need to get the GNU version onto your N800. However you do that, you'll need somewhere to put it, so first
mkdir /root/bin
You can get tar onto the N800 using the N800 by downloading the tar .deb file and extracting the tar binary:
apt-get -d install tar (you'll need to answer Y to the questions) mkdir /t dpkg -x /var/cache/apt/archives/tar*.deb /t mv /t/bin/tar /root/bin rm -r /t apt-get clean
Or you could do a similar thing on your linux box, getting the .deb from http://repository.maemo.org/pool/bora/free/binary/tar_1.14-2.1osso_armel.deb (or whatever the current version is) and scp it across. That particular tar_1.14-2.1osso_armel.deb is also available from my site.
Or just download the thing from my site.
Mount the rootfs
mkdir /mnt/rootfs mount -t jffs2 /dev/mtdblock4 /mnt/rootfs
Copy the rootfs
The rootfs needs to be copied to newly created partition. Again, this can be done directly on the N800, but it seems easier just to do it whilst the SD card is connected to the linux box. On the N800:
/root/bin/tar cf - -C /mnt/rootfs/ . | ssh -l user myserver tar xvf - -C /media/usbdisk-1
Enable dual booting
This part is possible due to the work of Frantisek Dufka.
Download the initfs_flasher and unzip it.
tar xvzf initfs_flasher.tgz cd initfs_flasher
Make sure the N800 has sufficient power, close all applications, disconnect from the network and open an xterm. Run the flasher
./initfs_flash
After the reboot, run
chroot /mnt/initfs cal-tool --set-root-device ask:mmc2
and reboot
shutdown -r now
Links
- http://europe.nokia.com/A4305062
- http://europe.nokia.com/A4305010
- http://maemo.org/maemowiki/HOWTO_FlashLatestNokiaImageWithLinux
- http://maemo.org/downloads/d3.php?f=flasher-3.0
- http://maemo.org/downloads/nokia_N800.php?f=RX-34_2007SE_3.2007.10-7_PR_COMBINED_MR0_ARM.bin
- http://schmots.blogspot.com/
- http://maemo.org/maemowiki/HowTo_EASILY_BecomeRoot
- http://hildon-app-mgr.garage.maemo.org/redpill.html
- http://maemo.org/maemowiki/HowTo_EASILY_Boot_From_MMC_card
- http://fanoush.wz.cz/maemo/#initfs
- http://fanoush.wz.cz/maemo/initfs_flasher.tgz
- http://www.informit.com/guides/content.asp?g=security&seqNum=249&rl=1
- http://mg.pov.lt/770/reflash-n800.html
Fri, 27 Apr 2007
- create the disk using the VMWare UI
- fdisk /dev/sdc (or sdb or whatever you have created)
- mkfs -t ext3 /dev/sdc1 (or sdc2 or whatever you have created)
- create the mount point(s)
- edit /etc/fstab
- mount -a
- df -h
Fri, 09 Feb 2007
Removing duplicate PATH entries
I was creating a little setup shell script to be sourced to set up an environment. It's the standard thing; set a few environment variables, play with the filesystem, start some things. Part of it adds directories to PATH and LD_LIBRARY_PATH.
Then I wondered about it being run more than once. I don't imagine great problems, but multiple entries in the PATH look ugly.
So I wrote this little function to clean up the PATH, or any other similar variable:
tidy () { echo -n $1 | perl -naF: -e 'print join ":", grep !$s{$_}++, @F' }
It can be called as:
export PATH=$(tidy $sw/bin:$PATH) export LD_LIBRARY_PATH=$(tidy $LD_LIBRARY_PATH:$sw/lib:$ORACLE_HOME/lib)
which seems to work well enough.
Sat, 23 Dec 2006
I wanted to mount a jffs2 filesystem on my linux box (Ubuntu). It's actually the filesystem from my Zaurus 5500. My first attempt was:
# mount -t jffs2 -o loop initrd.bin r
It turns out that that is the wrong thing to do, and it results in the message:
mount: wrong fs type, bad option, bad superblock on /dev/loop/0,
missing codepage or other error
In some cases useful info is found in syslog - try
dmesg | tail or so
and the following is in syslog:
Attempt to mount non-MTD device "/dev/loop/0" as JFFS2
It turns out that the correct incantation is something like:
Load the mtdram module to create a ramdisc of the correct size. The total_size and erase_size parameters are in KiB (1024 bytes), and you should try to be fairly accurate or make sure you have plenty of memory available. The filesystem I wanted to look at was 14680064 bytes, which is 14336 KiB.
# modprobe mtdram total_size=14336 erase_size=128
Check that worked OK:
# cat /proc/mtd dev: size erasesize name mtd0: 00e00000 00020000 "mtdram test device"
Then load the mtdblock module:
# modprobe mtdblock
Copy across the filesystem to the ramdisc:
# dd if=initrd.bin of=/dev/mtdblock0
Then do a loopback mount on the ramdisc:
# mount -t jffs2 /dev/mtdblock0 r
When you're done:
# umount r # modprobe -r mtdblock # modprobe -r mtdram