networked day to day technical issues

27Mar/112

Running Linux on Sparc hardware

I have a SunFire V210 laying around, which i bought in order to learn Solaris and get accustomed to it's hardware platform.

Now i need to move a personal project from it's current server to another one and i though that i might put to use the Sun server to use. It turns out that not that many people run Linux on the Sparc architecture and some things that i expected to work (like software raid) turned out to be complicated to set up.

Linux Distribution - basically you have two options if you're looking for an up to date and maintained distro: Debian or Gentoo . When i first installed this server (few months ago) Squeeze was not out and because i was looking for something which has newer software i decided to go with Gentoo despite the fact that i don't like compiling everything over and over and over again.

Linux Software Raid - there isn't a good place to find relevant information so i had to read a lot through discussion lists, forums and blogs until i got it working as expected ; after i finished my setup Debian Squeeze was released and the installer does help a lot.

The boot loader - SILO (Sparc Improved Boot Loader) works ok and despide the name resemblance, it's not related to LILO.

The setup: I learned the hard way that your first partition , in my case /, should not start at cylinder 0 but at cylinder 1 because otherwise the bootloader code will get overwritten if you set up the first partition as "Linux raid autodetect" type . I have set up so i don't need a initrd in order to boot (i don't remember where i read that my Kernel/Silo combination was not capable of loading the initrd) so this meant that /dev/md0 (first partition , raid 1) had to have it's metadata of type 0.90 in order for the kernel to be capable to automount / assemble the raid 1 array for / 's filesystem
This is how my partition table looks (btw take care to setup the disk with Sun disk label or otherwise it's won't work at all):

root@server:~# uname -a
Linux server 2.6.32-5-sparc64-smp #1 SMP Tue Mar 8 01:00:11 UTC 2011 sparc64 GNU/Linux
root@server:~# fdisk -l /dev/sda
 
Disk /dev/sda (Sun disk label): 64 heads, 32 sectors, 34732 cylinders
Units = cylinders of 2048 * 512 bytes
 
   Device Flag    Start       End    Blocks   Id  System
/dev/sda1             1      1024   1047552   fd  Linux raid autodetect
/dev/sda2          1024      5120   4194304   fd  Linux raid autodetect
/dev/sda3             0     34732  35565568    5  Whole disk
/dev/sda4          5120      7168   2097152   fd  Linux raid autodetect
/dev/sda5          7168      9216   2097152   fd  Linux raid autodetect
/dev/sda6          9217     34732  26127360   fd  Linux raid autodetect
root@server:~# mdadm -D /dev/md0
/dev/md0:
        Version : 0.90
  Creation Time : Mon Nov 22 18:00:47 2010
     Raid Level : raid1
     Array Size : 1047488 (1023.11 MiB 1072.63 MB)
  Used Dev Size : 1047488 (1023.11 MiB 1072.63 MB)
   Raid Devices : 2
  Total Devices : 2
Preferred Minor : 0
    Persistence : Superblock is persistent
 
    Update Time : Sun Mar 27 15:44:02 2011
          State : clean
 Active Devices : 2
Working Devices : 2
 Failed Devices : 0
  Spare Devices : 0
 
           UUID : f49fb46a:dc205157:9e871d23:2d4b1db2
         Events : 0.266
 
    Number   Major   Minor   RaidDevice State
       0       8       17        0      active sync   /dev/sdb1
       1       8        1        1      active sync   /dev/sda1

Once this was fixed i set up raid 1 and LVM for the rest of the OS.

It all went smooth until recently i needed to install on it SOLR and discovered that Sun's JRE does not run on Linux on Sparc hardware. I spent half a day trying to get Icedtea/OpenJDK working on Gentoo and ended up with a circular dependency . I remebered that in the meantime Debian Squeeze was released so i checked that it had OpenJDK packages and installed it.

Debian Squeeze - the installer has the option of setting up for you Software Raid, which is very very helpful when compared to Gentoo where of course i had to do all by hand. The OpenJDK package installed fine and SOLR seems to be working. Time will tell if i will stumble upon some feature which OpenJDK does not support and SOLR goes bananas.

root@server:~# java -version
java version "1.6.0_18"
OpenJDK Runtime Environment (IcedTea6 1.8.3) (6b18-1.8.3-2+squeeze1)
OpenJDK Client VM (build 16.0-b13, mixed mode)

Weird hardware bug i stumbled upon: when shutting down the system which i used to connect via the serial console to the Sun server, it somehow sends a "break" command or something which has the same effect: the OS is paused and the console shows the ok> prompt. Workaround was to first disconnect the serial console.

  • Nice post, I am trying to do exactly the same… I have a Sun Netra X1 with two same HDs and I am trying to install Debian squeeze sparc with RAID1. Unfortunately, the installer somehow doesn’t let me create the first partition with the type “physical RAID volume” for usage after with MD. Do you have any ideas what’s wrong with my installer? Also I was wondering if you did create a /boot partition outside MD, or is this not required?

  • admin

    i have no idea why the installer doesn’t let you, but you could do this manually with Fdisk before starting the installer’s partitioning. Be sure that partition 1 starts at cylinder 1 and not 0 .
    I don’t have /boot on a separate partition, outside as i wanted redundancy in case a disk dies (and it has).
    I have pasted below a fdisk -l , /proc/mdstat (you can see i have one dead disk) and fstab from my system. I hope it helps.

    root@cl1dom0:~# fdisk -l /dev/sdb

    Disk /dev/sdb (Sun disk label): 64 heads, 32 sectors, 34732 cylinders
    Units = cylinders of 2048 * 512 bytes

    Device Flag Start End Blocks Id System
    /dev/sdb1 1 1024 1047552 fd Linux raid autodetect
    /dev/sdb2 1024 5120 4194304 fd Linux raid autodetect
    /dev/sdb3 0 34732 35565568 5 Whole disk
    /dev/sdb4 5120 7168 2097152 fd Linux raid autodetect
    /dev/sdb5 7168 9216 2097152 fd Linux raid autodetect
    /dev/sdb6 9217 34732 26127360 fd Linux raid autodetect
    root@cl1dom0:~# cat /proc/mdstat
    Personalities : [raid1]
    md128 : active raid1 sda6[0](F) sdb6[1]
    26126264 blocks super 1.2 [2/1] [_U]

    md3 : active raid1 sdb5[1]
    2096116 blocks super 1.2 [2/1] [_U]

    md2 : active (auto-read-only) raid1 sda4[2] sdb4[1]
    2096116 blocks super 1.2 [2/2] [UU]

    md1 : active raid1 sdb2[1]
    4193268 blocks super 1.2 [2/1] [_U]

    md0 : active raid1 sdb1[0]
    1047488 blocks [2/1] [U_]

    unused devices:
    root@cl1dom0:~# cat /etc/fstab
    # /etc/fstab: static file system information.
    #
    # Use ‘blkid’ to print the universally unique identifier for a
    # device; this may be used with UUID= as a more robust way to name devices
    # that works even if disks are added and removed. See fstab(5).
    #
    # proc /proc proc defaults 0 0
    # / was on /dev/md0 during installation
    UUID=4cc20ff2-e843-412d-b779-be2d777aaf60 / ext3 errors=remount-ro 0 1
    # /usr was on /dev/md1 during installation
    UUID=ed4f7cdd-9539-480d-9e4d-f3e765b9eba3 /usr ext4 defaults 0 2
    # /var was on /dev/md3 during installation
    UUID=b456fc59-2ebb-4ab6-b416-0a7509192003 /var ext4 defaults 0 2
    # swap was on /dev/md2 during installation
    UUID=7b104652-ac11-4c2f-9174-87111c9c1d79 none swap sw 0 0
    # /srv
    UUID=8699ff41-9d50-4a69-b2a8-9857ed937e60 /srv ext4 defaults 0 2