Feb 112015
 

Right, so I had a bunch of old Neoware CA19 thin clients that I decided to re-use. Neoware CA19 is low power device with VIA Esther 400Mhz CPU, 256MB RAM, VIA Chrome chipset based graphics card and 128MB build-in flash storage device.

My main requirement was to connect users to Thinlinc server – so ThinLinc client was a must, RDP or NX clients as an option. I tried Thinstation project but failed miserably mainly due to lack of support for this hardware in newest version. After experimenting a bit further I eventually came up with different solution.

neoware-debian

Essentially we PXE boot Neowares with Debian and take advantage of Linux capability to use NFS-mounted root device. Once booted we autologin user kiosk, start Fluxbox, and start Thinlinc in –loop mode. Easy.

I won’t be covering DHCP/TFTP/NFS server configuration as there are plenty of resources for that. Lets assume you have got this part ready, Linux installed and relevant services running.

So let get the ball rolling on your server:

mkdir -p /srv/nfsroot
debootstrap --arch=i386 squeeze /srv/nfsroot http://ftp.uk.debian.org/debian
echo "/srv/nfsroot 192.168.1.0/24(ro,no_root_squash,no_subtree_check)" >> /etc/exports
exportfs -rav
chroot /srv/nfsroot

CA19 has a rather old single core CPU hence decision to choose i386 branch with 486 kernel. Also, I use Debian Squeeze because support for Openchrome graphics driver has been dropped in Wheezy (correct me via comment if I’m wrong). But Squeeze is perfectly fine for my intended purpose

Now inside chroot we install bits and bobs we need.

apt-get update
apt-get install initramfs-tools linux-image-486
aptitude install fluxbox xserver-xorg xserver-xorg-video-openchrome xauth x11-utils x11-xkb-utils x11-xserver-utils xfonts-base xfonts-utils xinit xserver-common
wget thinlinc-client_4.3.0-4538_i386.deb from Cendio server
dpkg -i thinlinc-client_4.3.0-4538_i386.deb
sed 's/BOOT=local/BOOT=nfs/' -i /etc/initramfs-tools/initramfs.conf
echo aufs >> /etc/initramfs-tools/modules

vim /etc/initramfs-tools/scripts/init-bottom/aufs

fill with:

modprobe aufs
mkdir /ro /rw /aufs
mount -t tmpfs tmpfs /rw -o noatime,mode=0755
mount --move $rootmnt /ro
mount -t aufs aufs /aufs -o noatime,dirs=/rw:/ro=ro
mkdir -p /aufs/rw /aufs/ro
mount --move /ro /aufs/ro
mount --move /rw /aufs/rw
mount --move /aufs /root
exit 0

Next step:

chmod +x /etc/initramfs-tools/scripts/init-bottom/aufs
update-initramfs -u -k all

Adduser kiosk, use /etc/inittab to autologin user kiosk. Mine looks like that:

# 1:2345:respawn:/sbin/getty 38400 tty1
1:2345:respawn:/bin/login -f kiosk /dev/tty1 2>&1
2:23:respawn:/sbin/getty 38400 tty2
#3:23:respawn:/sbin/getty 38400 tty3 # one extra console is enough.
#4:23:respawn:/sbin/getty 38400 tty4 # or we can disable extra consoles whatsoever
#5:23:respawn:/sbin/getty 38400 tty5
#6:23:respawn:/sbin/getty 38400 tty6

Next, edit /home/kiosk/.profile and add line with

startx

Make sure Fluxbox is a default window manager

update-alternatives --config x-window-manager

Use /home/kiosk/.fluxbox/startup to start your app, with line like this:

/opt/thinlinc/bin/tlclient --loop your.thinlinc.server.com

otherwise ekhmm well, fully blown fluxbox will start, making it a lightweight workstation – whatever rocks your boat really.

I added ~kiosk/.thinlinc directory, with ~kiosk/.thinlinc/known_hosts populated with my server’s key to avoid being asked for it every time.

Set root password (passwd) and exit chroot.

One other modification I needed was bringing up loopback on start, otherwise Thinlinc client refused to connect with some weird error. So edit /srv/nfsroot/etc/network/interfaces to make it look like that:

auto lo
iface lo inet loopback

We are ready to boot Neoware CA19 with its new operating system!

Copy kernel and initramfs to TFTP directory

cp /srv/nfsroot/boot/vmlinuz-2.6.32-5-486 /srv/tftp/debianNFS/
cp /srv/nfsroot/boot/initrd.img-2.6.32-5-486 /srv/tftp/debianNFS/

My pxe configuration, yeah you’re right – it is based on Thinstation

vim /srv/tftp/pxelinux.cfg/default

DEFAULT diag/vesamenu.c32
PROMPT 0
MENU TITLE Linux Boot Menu
MENU BACKGROUND ts_bg.jpg
MENU COLOR TITLE 1 #ffffff #000000 std
MENU COLOR SEL 0 #ffffff #444444 std
MENU COLOR TABMSG 0 #999933 #000000 std
MENU COLOR UNSEL 0 #aaaaaa

LABEL ts
TIMEOUT 30
MENU LABEL ThinClient
KERNEL debianNFS/vmlinuz-2.6.32-5-486
APPEND ro initrd=debianNFS/initrd.img-2.6.32-5-486 root=/dev/nfs ip=dhcp nfsroot=192.168.1.1:/srv/nfsroot vga=34F
# quiet splash

Also, it would be shame not to use internal 128MB flash device so once Neoware is booted switch to ALT-F2, login as root, wipe sda device and reformat as swap. Make sure you do it on Neoware and not on your server! 🙂

fdisk /dev/sda
d #delete
n # new primary
t 82 # type is swap
w

and then

mkswap /dev/sda1

At the same time, once logged in on Neoware console it would be good to generate xorg.conf matching this hardware so run

Xorg -config

and copy resulting file back to NFS server

scp xorg.conf-new root@nfsserver:/srv/nfsroot/etc/X11/xorg.conf

Having a proper xorg.conf will speed up boot process a bit as X server won’t be wasting time for probing and guessing values – profit!

We want activate swap on boot so back on server edit /srv/nfsroot/etc/fstab and add

/dev/sda1 none swap discard 0 0

After restart “top” under ALT-F2 should show us 128MB swap available.

Finally, lets prepare Neoware device, enter BIOS and set under

- Advanced BIOS Features
First Boot Device - Disabled
Second Boot Device - Disabled
- Advanced Chipset Features
VGA share Memory size 64MB
- Integrated peripherals / VIA OnChip PCI Device
Onboard LAN Boot ROM - Enabled

That’s it. Boot time, from pressing power button to Thinlinc login screen is approx 50 seconds on old and crap 100Mbps switch. I could probably optimise that and shorten even further but hey, 50sec is good enough for me! Memory usage with Thinlinc session running is approx 150MB so roughly 50MB (plus 128MB swap) still free – some room for adding more functionality should we need it.

So here we are, Neowares are back in action in my labs. And instead of purchasing new PCs money saved can go into beefing up my servers! How cool is that?


Jan 052015
 

I’ve been experiencing problems with Dell running Centos 6 and Bacula 5.2, hooked up to Quantum Scalar i40 tape library with two LTO5 drives. Server has two HBAs, first used with server disks (PERC-310mini) and second LSI SAS2008 with external SAS port connected to tape library. More info about this setup in this post.

Problem: basically, after each server reboot autochanger device was missing.

After spending endless hours I end up with some workaround. Its not ideal, well to be honest its a dirty hack so if there is a better way of doing I would very much appreciate you dropping a quick comment!

So if you can’t find tape library changer under centos 6 with a quantum scalar i40 then read on…

But first, random picture from my library, it seems like she’s showing to her pal a funny cat picture on her phone.

insta-20

Background: Autochanger is being managed via one of the drives, this is called Control Path and being set once via autochanger web interface.

From time to time Quantum Scalar i40 autochanger is not getting detected after server reboot. In order to detect it we need to rescan SCSI bus.

Lets say tape drives are on controller 0, channel 0, with ID 0 LUN 0 and ID 1 LUN 0

root@abc-jamno:~ # lsscsi
[0:0:0:0]    tape    HP       Ultrium 5-SCSI   Z64Z  /dev/st0 
[0:0:1:0]    tape    HP       Ultrium 5-SCSI   Z64Z  /dev/st1 
[1:0:32:0]   enclosu DP       BP12G+           1.00  -       
[1:2:0:0]    disk    DELL     PERC H310        2.12  /dev/sda

in which case we can find controller (aka Control Path) connected on LUN 1 of one of the drives – but it is not being detected by OS for some reason! This is a bit that puzzles me. I suspect that this is due to my Host Bus Adapters getting different IDs after reboot, i.e. sometimes PERC gets detected as 0 and sometimes SAS2008 gets it – quoted example shows the later case.

root@abc-jamno:~ # echo 0 0 1 >  /sys/class/scsi_host/host0/scan
root@abc-jamno:~ # echo 0 1 1 >  /sys/class/scsi_host/host0/scan

root@abc-jamno:~ # lsscsi
[0:0:0:0]    tape    HP       Ultrium 5-SCSI   Z64Z  /dev/st0 
[0:0:1:0]    tape    HP       Ultrium 5-SCSI   Z64Z  /dev/st1 
[0:0:1:1]    mediumx QUANTUM  Scalar i40-i80   153G  /dev/sch0
[1:0:32:0]   enclosu DP       BP12G+           1.00  -       
[1:2:0:0]    disk    DELL     PERC H310        2.12  /dev/sda 

Solution: aka dirty hack, upon reboot we grep logs to check SCSI id of tapes and use that to rescan bus on tape drive SCSI id but changing LUN +1. Can be used to write init script that starts just before bacula-sd starts, I guess…

This one liner will generate commands we need:

grep tape /var/log/messages*|cut -d" " -f7|awk -F: '{print "echo "$2" "$3" "1 " > /sys/class/scsi_host/host"$1"/scan"}'

double check those lines and and run them.

Restart bacula storage daemon

service bacula-sd restart

Useful commands:

cat /proc/scsi/sg/device_hdr /proc/scsi/sg/devices
host	chan	id	lun	type	opens	qdepth	busy	online
0	0	0	0	1	1	254	0	1
0	0	1	0	1	1	254	0	1
1	0	32	0	13	1	256	0	1
1	2	0	0	0	1	256	0	1
0	0	1	1	8	1	254	1	1

root@abc-jamno:~ # sg_scan
/dev/sg0: scsi0 channel=0 id=32 lun=0
/dev/sg1: scsi0 channel=2 id=0 lun=0
/dev/sg2: scsi1 channel=0 id=5 lun=0
/dev/sg3: scsi1 channel=0 id=7 lun=0
/dev/sg4: scsi1 channel=0 id=7 lun=1

tapeinfo -f /dev/sg2

Source:
How do I rescan the SCSI bus to add or remove a SCSI device without rebooting the computer

https://access.redhat.com/site/solutions/3941

I know more about SCSI now that I ever wished to know.