UBoot – Kurobox

Net Console
The net console is the U-Boot driver which uses the UDP protocol with a default port of 6666 to send the console output to and receive the console input from a remote computer. You need to run netcat on the remote computer to communicate with the U-Boot net console. The communication is bidirectional. Netcat will display on your screen the console output received from U-Boot and will send your keyboard input back to U-Boot.
If U-Boot cannot contact the remote computer, it switches the console to the serial port. To show that it changed the console, U-Boot makes the HDD LED blink with the pattern corresponding to the serial console (see The Reset Button below). The timeout period is 20 sec.
Minimal Console
U-Boot for the LinkStation is designed to allow some control over the boot process even in the absence of a console. For this, it uses the power button (the big button at the front) and the reset button (the small red button at the back).
Before installing U-Boot, when the LinkStation is switched on, the power LED starts blinking, the original boot loader starts executing and, very quickly, it starts booting the kernel from flash. If U-Boot is installed, the power LED will change from blinking quickly to blinking very slowly. The blink pattern is the same as the one used to indicate sleep mode in normal operation. When the power LED starts blinking slowly at boot, U-Boot has taken over and it is counting down the boot delay before booting the kernel. The default boot delay is 10 sec. From the moment when the power LED starts blinking slowly and for the duration of the boot delay, you can control the boot process with the power and reset buttons.
The Power Button
If you push the power button and keep it pressed for more than 1 sec, the boot process will stop and the LinkStation will wait for a command. A stopped boot process is indicated by the power LED being lit solid. The effect is the same a pressing ‘s’ on the console.
A long push of the power button acts as a toggle. If the boot delay count down is in progress, a long push of the power button stops the boot process. If the boot process is stopped (U-Boot is at the command prompt, even if you can’t see it), a long push of the power button restarts the boot process resetting the boot delay to its original value. The restart of the boot process is indicated by the power LED blinking slowly.
By default U-Boot supports three pre-configured boot commands:
  1. The first boot command will attempt to load and boot a file named boot/vmlinux.UBoot from the first hard disk partition, /dev/hda1. The file can be in any of the U-Boot bootable formats but uImage is the preferred format. If the file is missing or corrupted, U-Boot will fall back to booting the original kernel from flash. 
  2. The second boot command will boot the original kernel from flash.
    Please note that the original kernel for the LinkStation 1 / KuroBox standard has a bug in the function that calibrates the decrementer and it will stop for up to 180 sec during boot. This bug is not an U-Boot bug but a kernel bug which is uncovered by the fact that U-Boot activates the decrementer where the original boot loader does not.
    The original kernel for LinkStation HG / KuroBox HG does not suffer from the above problem. 
  3. The third boot command will attempt to boot in emergency mode (EM). It does this by passing the argument root=/dev/ram0 to the kernel.
    LinkStation / LinkStation HG owners should avoid booting in EM mode as the root password for this mode on the LinkStation is unknown.
    The original kernel for the LinkStation / KuroBox standard and for some of the earlier LinkStation HG / KuroBox HG models ignores the root argument. These models will boot normally from the on-board flash when the EM boot command is used. Read the section on EM mode if your LinkStation HG / KuroBox HG has a kernel that doesn’t boot in EM mode using this boot command. 
You can cycle through the boot commands with the power button.
To see which of the three commands U-Boot is going to execute, press the power button quickly. The HDD LED (the third from the top) will start blinking. The number of times the LED blinks, shows the number of the active boot command. For example, a pattern short on – short off – short on – long off, means that the boot command number 2 is active. U-Boot will repeat the blinking cycle for a total duration of about 5 sec counting from the moment the power button is released.
A short press of the power button while the HDD LED is blinking will advance the boot command to the next one.
Changing the boot command does not change the boot status. If the boot is stopped, it will not be restarted. If the boot is in progress, it will not be stopped but the boot delay will be reset to the original value.
The Reset Button
Two consoles are currently configured, the serial console and the net console. The first console is the serial console and the second console is the net console (nc). The net console is the default console.
The reset button can be used, similarly to the power button, to switch consoles. A press on the reset button (here, it doesn’t matter how long you keep the button pressed) displays the currently active console using the HDD LED. Repeatedly pressing the reset button while the HDD LED is blinking will toggle between the two consoles. The blinking pattern is different from the one showing the boot command. The pattern which shows that the second (net) console is active is short off – short on – short off – long on. U-Boot will repeat the blinking cycle for a total duration of about 5 sec counting from the moment the reset button is released.
Furthur information at http://www.linuxnotincluded.pwp.blueyonder.co.uk/linkstation/u-bootinstall.html

Kurobox Restore

**** Procedure to restore iNAS *****

Dis-assemble the Kurobox and place a new SSD / SATA drive

Start the machine and wait until power LED blinks

Hit start button twice this will take the machine to EM mode

Telnet using root and FTP using operator / operator

Make partitions as desired and copy following files
* debianlenny-
* devices.tar

There are available on iBackup

Uncompress the package and its done

Extend life-time on CF cards based file system

Extend Life-time on CF cards

I use Smoothwall on a VIA custom server with 4 NICs. This board can accomodate only CF cards.
One of my observation CF cards lasted just 5 to 7 months, had to carry on Smoothwall maintance for every 6 months.

After some googling worked out following modifications can increase the lifetime of CF cards

1. Move /tmp to RAM by editing /etc/fstab and adding following entry

tmpfs /tmp tmpfs  size=512000m,exec,nosuid 0 0

2.  Update file system to ext2 partition, since ext3 does journalling as-well which means high IO.
Edit fstab and modify partition type.

UUID=a9425b1d-3d67-40fc-b2a7-4a4f686d8be9 /                  ext3    defaults        1 2

3. Add additional option noatime

UUID=a9425b1d-3d67-40fc-b2a7-4a4f686d8be9 /                  ext2    errors=remount-ro,noatime        1 2

Setup a NFS server and client

HOWTO: Setup a NFS Server & Client

In this tutorial, outlines the steps involved in setting up a NFS server & client. Typically this will be used to mount shares on the network, could be user home directory when authenticating via LDAP or media server.
This guide assumes a Debian Server -hostname iNAS- is ready to be converted as a NFS server.
Setup NFS Server
1. Logon to iNAS using root
2. Install NFS server package

~# apt-get install nfs-kernel-server

3. Create shared directory

~# mkdir -p /share /share/pictures /share/music /share/movies

4. Export this directory on exports file, vi /etc/exports and add the following line

/media                *(rw,sync,no_subtree_check,no_root_squash)

5. Restart NFS Service

~# service nfs-kernel-server restart

Setup NFS Client

1. Install NFS client

~# apt-get install nfs-common

2. Add NFS mount on fstab; edit /etc/fstab and add following line

iNAS: /share           /media        nfs  defaults 0 0

3. Restart client machine to confirm auto-mount works or mount the /media directory

~# mount /media

4. Check if it worked using df command

Disable IPV6 in ubuntu

Here are few methods to disable IPV6 in UBUNTU

Edit Modprobe
You need to edit the aliases file using the following command

sudo vi  /etc/modprobe.d/aliases

Find the line: alias net-pf-10 ipv6
change to

alias net-pf-10 off

If the above change is not working you need to change the following one

alias net-pf-10 off ipv6

Save the file and reboot

Edit /etc/default/grub file

sudo vi  /etc/default/grub




GRUB_CMDLINE_LINUX_DEFAULT=”ipv6.disable=1 quiet splash”

Save and exit the file
Update the grub from the command line

sudo update-grub

Edit sysctl.conf

Edit sysctl.conf file

sudo vi /etc/sysctl.conf

Add following lines

# Disable IPV6
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1

 save and exit file

Setup a LDAP server

LDAP stands for Lightweight Directory Access Protocol. This allows to setup a centralized user, domain authentication.

I have defined my LDAP server as PDC – and would manage the domain pdc.local. This would be accessible from all machines under 192.168.0.X.


Pre-Setup – Linux Box preparation

* Create a 1GB VM Disk on a vSphere and download ubuntu LTS 10.04 mini ISO


* Choose all default options and install the base system – takes about 600MB
* Add few additional packages

    sudo apt-get install openssh-server slapd ldap-utils migrationtools

* Take a snapshot of VM incase a rollback is required

LDAP Server Configuration

1. Add schema files

sudo ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/ldap/schema/cosine.ldif
sudo ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/ldap/schema/nis.ldif
sudo ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/ldap/schema/inetorgperson.ldif

2. backend.domain.com.ldif

# Load dynamic backend modules
dn: cn=module,cn=config
objectClass: olcModuleList
cn: module
olcModulepath: /usr/lib/ldap
olcModuleload: back_hdb
# Database settings
dn: olcDatabase=hdb,cn=config
objectClass: olcDatabaseConfig
objectClass: olcHdbConfig
olcDatabase: {1}hdb
olcSuffix: dc=example,dc=com
olcDbDirectory: /var/lib/ldap
olcRootDN: cn=admin,dc=example,dc=com
olcRootPW: secret
olcDbConfig: set_cachesize 0 2097152 0
olcDbConfig: set_lk_max_objects 1500
olcDbConfig: set_lk_max_locks 1500
olcDbConfig: set_lk_max_lockers 1500
olcDbIndex: objectClass eq
olcLastMod: TRUE
olcDbCheckpoint: 512 30
olcAccess: to attrs=userPassword by dn=”cn=admin,dc=example,dc=com” write by anonymous auth by self write by * none
olcAccess: to attrs=shadowLastChange by self write by * read
olcAccess: to dn.base=”” by * read
olcAccess: to * by dn=”cn=admin,dc=example,dc=com” write by * read

sudo ldapadd -Y EXTERNAL -H ldapi:/// -f backend.example.com.ldif

3. Frontend directory population. Create a file frontend.example.com.ldif with following entries

# Create top-level object in domain
dn: dc=example,dc=com
objectClass: top
objectClass: dcObject
objectclass: organization
o: Example Organization
dc: Example
description: LDAP Example
# Admin user.
dn: cn=admin,dc=example,dc=com
objectClass: simpleSecurityObject
objectClass: organizationalRole
cn: admin
description: LDAP administrator
userPassword: secret
dn: ou=people,dc=example,dc=com
objectClass: organizationalUnit
ou: people
dn: ou=groups,dc=example,dc=com
objectClass: organizationalUnit
ou: groups
dn: uid=john,ou=people,dc=example,dc=com
objectClass: inetOrgPerson
objectClass: posixAccount
objectClass: shadowAccount
uid: john
sn: Doe
givenName: John
cn: John Doe
displayName: John Doe
uidNumber: 1000
gidNumber: 10000
userPassword: password
gecos: John Doe
loginShell: /bin/bash
homeDirectory: /home/john
shadowExpire: -1
shadowFlag: 0
shadowWarning: 7
shadowMin: 8
shadowMax: 999999
shadowLastChange: 10877
mail: john.doe@example.com
postalCode: 31000
l: Toulouse
o: Example
mobile: +33 (0)6 xx xx xx xx
homePhone: +33 (0)5 xx xx xx xx
title: System Administrator
initials: JD
dn: cn=example,ou=groups,dc=example,dc=com
objectClass: posixGroup
cn: example
gidNumber: 10000

sudo ldapadd -x -D cn=admin,dc=example,dc=com -W -f frontend.example.com.ldif

Centos on MAC Mini

This post is about my experiences installing CentOS 6.0 on Mac Mini ’07 model. Its an absolutely wonderful piece of hardware – 1.8Ghz, 2 G, 80GB. This had been running OSX for last 4 years and finally decided to move onto linux.

One of the problems with new OSX operating systems is they tend to run slower.

Steps to install:

1. Go to centos website and download 386 ISO ( i chose minimal edition can always install software and customize the environment)

This edition of mac mini runs on Core Duo chipset hence x86_64 is not supported.

2. Burn the ISO on a RW CD

3. Reboot the system and place the media on CD drive

4. Wait for a while until you see installer and follow the steps to install the application.

5. I chose to use the entire HD for linux, don’t plan to run osx on this anymore

6. create users etc and reboot system.

Smoothwall mods

Lots of goodies at http://code.google.com/p/swemods/

Install modcommander to get a web install interface.

Mods installed on my Smoothwall Server:

DHCP Lease
Enhanced DHCP mod
Smoothwall Backup