Categories
Computers Linux Music

Transcoding FLAC to MP3

Having my entire record collection in a fully lossless format with properly scanned cover art has taken some time. Now that it is done I sometimes want to use the music in players that do not support FLAC or where I want to keep down the size of the files.

I have tried a number of existing solutions but none of them worked the way I wanted. Since I keep my music on a headless server I wanted a non-GUI solution. Also, since my main playing environment is based on Slimserver there are a number of features that give other players some headache – one such thing is that many of my genre tags contain multiple genres, separated by semicolon. I also wanted the tagged file to include the cover art and to work on both Windows Media Player and iTunes.

My current solution is based on a Bash script (attached) and includes the following features:

  • Incremental transcoding so it doesn’t have to run through the entire library (which may well take weeks)
  • Ability to skip a certain folder – in my case I have skipped the compilations for now since iTunes makes it messy otherwise
  • Fixes filenames so that they don’t include any non-ASCII characters

To run the script a rather updated Linux version is needed. I first started writing the script on Ubuntu 6.06 (Dapper) but realised after a while that the reason that I just couldn’t get the Unicode characters in the tags to work was not due to me but some bug in the id3lib. Currently I am running this on Ubuntu 7.10 (Gutsy).

Attachments

Categories
Computers Linux

Upgrade Thinkpad BIOS from Ubuntu

OK, so you have installed Ubuntu or another version of GNU/Linux on your Thinkpad and realise that you need to upgrade your BIOS. The files are available on Lenovo’s web site to create a bootable diskette. The problem is that the application is for Windows.

Not to worry. Just download the BIOS update application, extract the diskette image and use it to create an ISO file that you can then burn to a bootable CD.

> wget ftp://ftp.software.ibm.com/pc/pccbbs/mobiles/spsuiv69.exe
> cabextract spsuiv69.exe
> mkisofs -b IVUJ11US.IMG  -o biosboot.iso IVUJ11US.IMG

Then just burn the file biosboot.iso using your favourite ISO burner. Boot from the CD and follow the on-screen instructions.

Please note that, while this worked for me, I take no responsibility for what happens. There is always the risk of BIOS upgrades going wrong, turning the computer into an expensive paper weight.

Categories
Computers Linux

Install Ubuntu 7.04 on Thinkpad A20p

When installing Ubuntu 7.04 Feisty Fawn on a Thinkpad A20p the display is a mess. In addition power management does not work which means that it is not possible to make the computer go into standby when the lid is closed. This article explains how to fix both issues.

To fix the display, you will need to break out of the desktop (Alt+Ctrl+F1) so that you can see what you are doing. Log on and get root privileges (sudo su) to be able to write the changes below.

Edit xorg.conf (nano -w /etc/X11/xorg.conf) and add the following (the existing Monitor section can be kept):

Section "Monitor"
Identifier      "Monitor0"
VendorName      "IBM"
ModelName       "ITSX93"
HorizSync       30-100
VertRefresh     50-100
ModeLine        "1400x1050" 122.00 1400 1464 1784 1912 \ 
                1050 1052 1064 1090 -HSync -VSync
EndSection

N.B. There should be no line breaks in text after ModeLine.

Then change the reference to “Default Monitor” under the Screen section to Monitor0. Save the file with Ctrl+X Ctrl+Y. The setting will take effect when the system (or X-windows) is restarted.

The next issue was with the power management. The BIOS in the A20p is from before 2000 which is the cut-off year for ACPI support in Ubuntu 7.04. The computer has ACPI support but the kernel needs to be forced to load it. This is done by changing the boot options. To make the change persistent, edit the file /boot/grub/menu.lst.

nano -w /boot/grub/menu.lst
kernel /boot/vmlinuz-2.6.20-16-generic root=UUID=\ 12345678-1234-1234-1234-000000000000 \ ro quiet splash acpi=force

Reboot to make all changes take effect.

Categories
Computers Linux

Use Ubuntu Live CD to backup partitions

After having run Windows Vista Ultimate unactivated for some time I decided it was time to install it properly and take a full backup of the system drive at intermediate steps along the way to be able to back-track later.

I could have used the built-in Volume Shadow Copy service, perhaps together with DriveImage XML. I did try that and even made a slipstreamed boot CD using Bart PE to be able to restore the system.

However, I wanted a little more control and the potential of being able to boot off a USB stick when restoring. I also wanted to backup to and restore from a network based NAS (in my case a DNS-323). Besides, Volume Shadow Copy is only available on Windows Vista Business and Windows Vista Ultimate whereas this method will work for virtually any system.

For the time being I have settled on the following process.

a) Download and burn the Ubuntu 7.04 desktop CD and use it to boot your computer

b) Start a terminal window and change to root

  > sudo su

c) Add repositories by adding /etc/apt/sources.list and uncommenting the two lines for universe repositories.

  > nano -w /etc/apt/sources.list

d) Update the sources and install partimage and smbfs (answer yes when requested)

  > apt-get update
  > apt-get install partimage
  > apt-get install smbfs

e) Mount the NAS over the network using the samba file system driver.

  > mkdir /mnt/backup
  > mount -t smbfs -o username:[login] //[ip]/[share] /mnt/backup

Replace the parts within square brackets with whatever is appropriate in your case.

f) Run partimage and select the partition to save and the filename where the image should be placed (somewhere below /mnt/backup where the network NAS share is mounted).

  > partimage
Categories
Computers Linux

Install Bind on ClarkConnect Home 3.1

ClarkConnect is a nice Linux distribution for a home server and it is especially suitable for a computer sitting in a closet without a display as the web based GUI makes it a snap to configure it (even if you, like me, after a while tend to do all the maintenance through a SSH console connection).

Many people that use ClarkConnect will probably want to use it to host their own sites. At least I did and I quickly realised the limitations of the included caching DNS server (dnsmasq). It is very well for supporting local users that want to access Internet access but it is no good for holding your master DNS information. After some trouble I managed to switch the included dnsmasq to the full-blown ICS BIND implementation.

While I initially did this for ClarkConnect Home 3.1 and later upgraded my server to 3.2 it should work for ClarkConnect Home 3.2 as well.

I assume that you have a standard installation of ClarkConnect Home 3.1/3.2 and have learned how to get a SSH connection to your server.

Note that I have used RPM files to install as I didn't have the development packages installed at the time I did this. If you want to compile Bind yourself then that is of course possible.

  1. Ensure that the caching DNS server (dnsmasq) is disabled from within the web GUI of ClarkConnect so that it does not start when the server boots.
  2. Download the RPM files from http://www.isc.org/index.pl?/sw/bind/. Use the link for Red Hat RPMs under Documents/References. Select RHEL-4 -> 9.3.2-4_EL4 -> i386 and download all the files to a temporary folder on your server.
  3. Update the existing components of ClarkConnect by issuing
    rpm -Fvh bind-libs-9.3.2-4_EL4.i386.rpm
    rpm -Fvh bind-utils-9.3.2-4_EL4.i386.rpm
    

    You can also put those two files in a directory and run “rpm -Fvh *.rpm”

  4. Put all other files except bind-sdb-9.3.2-4_EL4.i386.rpm in another temporary directory and issue the command “rpm -Fvh *.rpm” from within that directory.
  5. The installation will put a default configuration file at /etc/named.conf. Edit it so that it looks something like this (replace the domain for your domain)
    // Default named.conf generated by install of bind-9.3.1-1
    options {
            directory "/var/named";
            dump-file "/var/named/data/cache_dump.db";
            statistics-file "/var/named/data/named_stats.txt";
    };
    include "/etc/rndc.key";
    zone "example.com" in {
            file "master/example.com";
            type master;
            allow-transfer { any; };
    };
    
  6. Create a folder for primary DNS zones:
    mkdir /var/named/chroot/var/named/master
    
  7. Add a zone file for your domain. My file (/var/named/chroot/var/named/master/example.com) looks like this:
    $TTL 2d
    @               IN SOA          dns.example.com. postmaster.example.com. (
                                    2005082502      ; serial
                                    3h              ; refresh
                                    1h              ; retry
                                    2d              ; expiry
                                    1h )            ; minimum
    example.com.    IN NS           dns.example.com.
    example.com.    IN MX           10 mail.example.com.
    www             IN A            10.11.12.13
    mail            IN A            10.11.12.13
    dns             IN A            10.11.12.13
    
  8. After changing the zone file you should restart the DNS server by issuing “/etc/init.d/named restart”. Run “tail /var/log/messages” to make sure that the daemon could read your zone file correctly. Use nslookup from another computer to verify that the server can resolve names for the domain.
  9. Put a soft link in /etc/rc3.d to the file /etc/init.d/named to make the daemon start automatically when the server is booted
    ln -s /etc/init.d/named /etc/rc3.d/S12named
    
Categories
Computers Linux Windows

Linux screen resolution issues in Virtual PC

Virtual PC is great for setting up testbeds but the support for Linux is less than optimal. When installing standard Linux distributions under Virtual PC it may be impossible to set the resolution to anything higher than 800×600 or even to get any image at all.

Edit the sections for Monitor, Device and Screen in the file /etc/X11/xorg.conf to look like this:

Section "Monitor"
    Identifier  "Monitor0"     VendorName  "Monitor Vendor"     ModelName    "General Laptop Display Panel 1280x768"     HorizSync    31.5 - 90.0     VertRefresh  59.0 - 75.0     Option     "dpms" EndSection
Section "Device"
    Identifier  "Videocard0"
    Driver      "vesa"
    VendorName  "Videocard vendor"
    BoardName   "VESA driver (generic)"
    VideoRam    8192
EndSection
Section "Screen"
    Identifier "Screen0"
    Device     "Videocard0"
    Monitor    "Monitor0"
    DefaultDepth     16
    SubSection "Display"
        Viewport   0 0
        Depth     16
        Modes    "1280x768" "1024x768" "800x600" "640x480"
    EndSubSection
EndSection

The above works for Fedora Core 5 under Virtual PC 5.3.582.27. If you are unable to get any image then boot from the rescue CD and use 'nano' or 'vi' to edit the file.

css.php