Tuesday, 31 July 2012

PXE Boot a Dban image from an Ubuntu Server




 Dhcp Offers from Ubuntu Server to Compute Nodes
****Note**** exercise extreme care with these notes I have made as you can boot and wipe any computer capable of net booting without any keyboard input on the private network if the machine in question is set to net-boot. 
I ACCEPT NO RESPONSIBILITY FOR ANY ERRORS OR OMISSIONS , YOU HAVE BEEN WARNED!


The object of this blog entry was to remind me how to securely erase a cluster of headless compute nodes connected to a head node using a Dban image pxe booted from the head node.

I installed Ubuntu 12.04 Server on the head node. The Head Node's eth0 was connected via Ethernet switches to the compute nodes on a private network in the range 192.168.1.0 and eth1 was connected to the public network and it was set to receive an IP address via dhcp.

Installation Requirements for the Head Node:-
Install an internet super server, tftp server, dhcp server and syslinux a boot loader.
 The command to do this is :-
sudo apt-get -y install inetutils-inetd tftpd-hpa dhcp3-server syslinux

 You have to extract some files from a Darik's Boot 'n' Nuke image:-
sudo mkdir /media/iso
sudo mount -o loop /the/path/to/dBanfile.iso /media/iso

In the directory /var/lib/tftpboot place the following files dban.bzi from the /media/iso directory and the file pxelinux.0 from the /usr/lib/syslinux/ directory. Also place the remaining files from the iso image in /var/lib/tftpboot/pxelinux.cfg

 Set the entries in the file named default in the directory /var/lib/tftpboot/pxelinux.cfg

PROMPT 0
DEFAULT quick

With prompt set to 0 there is no pause and the default setting is quick it can be autonuke dban dod dod3pass dodshort gutman ops2 paranoid prng or zero.
This means when it is run it goes straight to quick wipe so exercise extreme care when doing this as you can boot and wipe anything on the private network if the machine in question is set to netboot. I set it to 0 as all the compute nodes were headless and keyboardless so I could not have a pause for keyboard input.

The settings in the file /etc/dhcp/dhcpd.conf  I required for the dhcp server are as follows :-
ddns-update-style none;
option domain-name "home.local";
option domain-name-servers 192.168.1.1;
default-lease-time 86400;
max-lease-time 604880;
option time-offset -18000;
authoritative;
log-facility local7;
allow booting;
allow bootp;
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.10 192.168.1.100;
filename "pxelinux.0";
option root-path "/var/lib/tftpboot";
next-server 192.168.1.1;
}



In the tftp config file /etc/default/tftpd-hpa I required the following :-


RUN_DAEMON="yes"
TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/var/lib/tftpboot"
TFTP_ADDRESS="0.0.0.0:69"
TFTP_OPTIONS=""


The other dhcp config file /etc/default/isc-dhcp-server
should contain :-
INTERFACES="eth0"

 The ethernet settings file /etc/network/interfaces
should contain :-
 auto lo
iface lo inet loopback

# This is the private network
# Its static ip address
iface eth0 inet static
address 192.168.1.1
netmask 255.255.255.0
auto eth0
# The public network interface

# It uses dhcp
auto eth1
iface eth1 inet dhcp


Note you will have to ensure that the compute nodes' bios is set to pxe boot on eth0 if that is the interface you are using. Once the Ubuntu Head Node is booted use tail -f /var/log/syslog to track the progress of the compute nodes dhcp ip addresses being served as they are booted.

This really saved me time when I had to securely erase a large number of machines before they were decommissioned and sent for recycling :).

Friday, 27 July 2012

Repair a Faulty D-Link DGS-1024D Gigabit Switch


Always take extreme care when servicing electrical equipment eg HOT Solder,  Soldering Irons, MAINS Voltage and High DC Voltage can all be dangerous or worse. I am NOT responsible for any errors or omissions or for your errors or inability to understand and operate safely in this environment YMMV.
 

This Switch had flickering Link and Act LED's and no LED self test when first switched on. I took the case apart by removing 4 screws from the top of the case and 3 screws from the bottom front of the case. I found one bulging 1000uF 6.3V capacitor C67. I removed C67 and C68 and tested them with the ESR meter see photos below, both had problems one was open circuit and the other was low in value and high ESR. I replaced them with High Temperature Low ESR Capacitors. After replacement the switch went through a proper self-test with the LED's switching sequentially etc when powered up.
Low Value Capacitor
Open Circuit Capacitor
Replaced Capacitors

It was working fine after this, however the fans also needed replacement as well because one was seized and the other very noisy. I gave it an extended test for a time and it showed no signs of failure so not bad for a quick look inside the case and some soldering.
The bulging capacitor is a common fault in electronic equipment so it pays to examine all electrolytic capacitors on faulty equipment.

Monday, 18 June 2012

Edimax 3G-6210n Linux

I opened the case of the device and noted a number of unused pads that pointed to being a serial port connector. I used a USB to serial Sparkfun FTDI Basic 3v3 board and connected its rx tx and gnd pins to the pins on the 3G-6210n board. Note pin 1 on the 3G-6210n board is signified by a white silk screen square on the empty 4 pin connector rectangle, see my photos.

FTDI board goes to 3G-6210n Pins
GND goes to pin 3
TX goes to pin 2
RX goes to pin 4
I used my Ubuntu 12.04 machine and connected the Sparkfun FTDI board to one of the USB ports. I checked using the command dmesg and found the device was defined as /dev/ttyUSB0. I started minicom a terminal program using the command minicom -D /dev/ttyUSB0.
I set the Com port to 38400 baud 8N1 = 8 bits, no parity and 1 stop bit. No hardware or software flow control is selected on minicom.
I then powered on the 3G-6210n and boot messages appeared on the terminal window of minicom. It definitely is running Linux see messages below while it booted. Initial things I noticed 32MB RAM, 4MB Flash, 200MHz Processor

U-Boot 1.1.4 (Oct  9 2009 - 17:38:59)

U-Boot code: 00000000 -> 00019528  BSS: -> 0001E478
CPU Clock: 200 MHz
1.8V Vdd Output: 1.793
2.5V Vdd Output: 2.531
RAM Configuration:
Bank #0: 00000000 32 MB
Flash Manufacturer: MXIC
Flash Device: MXLV320CB(4MB)
Flash:  4 MB
*** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
Hit any key to stop autoboot:  0
## Starting application at 0x10040000 ...
Uncompressing Linux................................................................................... done, booting the kern.
Linux version 2.6.16-star (root@vance.localdomain) (gcc version 3.4.6) #1412 Fri Jun 11 17:05:56 CST 2010
CPU: FA526id(wb) [66015261] revision 1 (ARMv4)
Machine: STAR STR9100
Memory policy: ECC disabled, Data cache writeback
CPU0: D VIVT write-back cache
CPU0: I cache: 16384 bytes, associativity 2, 16 byte lines, 512 sets
CPU0: D cache: 16384 bytes, associativity 2, 16 byte lines, 512 sets
CPU clock at 200MHz
AHB clock at 100MHz
APB clock at 50MHz
Built 1 zonelists
Kernel command line: root=/dev/mtdblock3
PID hash table entries: 256 (order: 8, 4096 bytes)
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
Memory: 32MB = 32MB total
Memory: 29788KB available (2252K code, 251K data, 100K init)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
NET: Registered protocol family 16
PCI clock at 33M
PCI: bus0: Fast back to back transfers disabled
PCI Bridge found
PCI map irq: 00:00.00 slot 0, pin 1, irq: 0
SCSI subsystem initialized
usbcore: registered new driver usbfs
usbcore: registered new driver hub
Bluetooth: Core ver 2.8
NET: Registered protocol family 31
Bluetooth: HCI device and connection manager initialized
Bluetooth: HCI socket layer initialized
squashfs: version 3.4 (2008/08/26) Phillip Lougher
Initializing Cryptographic API
io scheduler noop registered
io scheduler deadline registered (default)
***********Init LED Driver*****************
Init GPIO Interrupt
***********Init LED Driver Finishing*****************
LED & GPIO & LAN Status Driver LED_VERSION
GPIO interrupt handler install ok.
Serial: 8250/16550 driver $Revision: 1.90 $ 1 ports, IRQ sharing disabled
serial8250: ttyS0 at MMIO 0x78000000 (irq = 10) is a 16550A
VLAN0_VLAN_TAG: 0
PPP generic driver version 2.4.2
PPP BSD Compression module registered
PPP MPPE Compression module registered
NET: Registered protocol family 24
rdm_major = 254
Uniform Multi-Platform E-IDE driver Revision: 7.00alpha2
ide: Assuming 33MHz system bus speed for PIO modes; override with idebus=xx
STR9100 NOR Flash: Found 1 x16 devices at 0x0 in 16-bit bank
 Amd/Fujitsu Extended Query Table at 0x0040
number of CFI chips: 1
cfi_cmdset_0002: Disabling erase-suspend-program due to code brokenness.
Creating 5 MTD partitions on "STR9100 NOR Flash":
0x00000000-0x00040000 : "ARMBOOT"
0x00040000-0x001a0000 : "Linux Kernel1"
0x001a0000-0x003e0000 : "ROOT FS1"
0x003e0000-0x00400000 : "Configs"
0x00040000-0x003e0000 : "Upgrade"
block2mtd: version $Revision: 1.30 $
usbmon: debugfs is not available
str9100-ehci str9100-ehci: str9100-ehci
str9100-ehci str9100-ehci: new USB bus registered, assigned bus number 1
str9100-ehci str9100-ehci: irq 24, io mem 0xcc000000
str9100-ehci str9100-ehci: USB 0.0 started, EHCI 1.00, driver 10 Dec 2004
usb usb1: Product: str9100-ehci
usb usb1: Manufacturer: Linux 2.6.16-star ehci_hcd
usb usb1: SerialNumber: str9100-ehci
usb usb1: configuration #1 chosen from 1 choice
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 2 ports detected
ohci_hcd: 2005 April 22 USB 1.1 'Open' Host Controller (OHCI) Driver (STR9100)
str9100-ohci str9100-ohci: str9100-ohci
str9100-ohci str9100-ohci: new USB bus registered, assigned bus number 2
str9100-ohci str9100-ohci: irq 23, io mem 0xc4000000
usb usb2: Product: str9100-ohci
usb usb2: Manufacturer: Linux 2.6.16-star ohci_hcd
usb usb2: SerialNumber: str9100-ohci
usb usb2: configuration #1 chosen from 1 choice
hub 2-0:1.0: USB hub found
hub 2-0:1.0: 2 ports detected
usb 1-1: new high speed USB device using str9100-ehci and address 2
Bluetooth: HCI USB driver ver 2.9
usb 1-1: Product: 802.11 n WLAN
usb 1-1: Manufacturer: Ralink
usb 1-1: SerialNumber: 1.0
usb 1-1: configuration #1 chosen from 1 choice
usbcore: registered new driver hci_usb
u32 classifier
    Perfomance counters on
Netfilter messages via NETLINK v0.30.
NET: Registered protocol family 2
IP route cache hash table entries: 512 (order: -1, 2048 bytes)
TCP established hash table entries: 2048 (order: 1, 8192 bytes)
TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
TCP: Hash tables configured (established 2048 bind 2048)
TCP reno registered
ip_conntrack version 2.4 (256 buckets, 2048 max) - 240 bytes per conntrack
ctnetlink v0.90: registering with nfnetlink.
ip_tables: (C) 2000-2006 Netfilter Core Team
ipt_recent v0.3.1: Stephen Frost .  http://snowman.net/projects/ipt_recent/
ClusterIP Version 0.8 loaded successfully
arp_tables: (C) 2002 David S. Miller
TCP bic registered
NET: Registered protocol family 1
NET: Registered protocol family 17
Bluetooth: L2CAP ver 2.8
Bluetooth: L2CAP socket layer initialized
Bluetooth: BNEP (Ethernet Emulation) ver 1.2
Bluetooth: BNEP filters: protocol multicast
VFS: Mounted root (squashfs filesystem) readonly.

Wednesday, 6 June 2012

MR3220 OpenWRT Extroot installation

The TP-Link has OpenWRT installed using either tftp or via the serial port using Kermit. Install the packages for using USB as storage on OpenWRT.

opkg update
opkg install kmod-usb-core kmod-usb-uhci kmod-usb-storage kmod-usb2 kmod-fs-ext4
reboot -f
mkdir /usb
mount /dev/sda1 /usb
mkdir /tmp/root
mount -o bind / /tmp/root
cp /tmp/root/* /usb -a
umount /tmp/root
umount /usb

Now edit the /etc/config/fstab file and add the following.
config mount
option target /usb
option device /dev/sda1
option fstype ext2
option options rw,sync
option enabled 1
option enabled_fsck 1
option is_rootfs 1

Rocks cluster Compute nodes ask for password

I mucked about for ages trying to fix this and came upon this ... Rocks Cluster on Google Groups
The very last bit of advice
Check or restart autofs in frontend
worked.
The actual command used is rocks run host 'service autofs restart'

Monday, 7 May 2012

Unbrick Samsung I9000 using Micro USB JIG

I unbricked my Samsung i9000 Galaxy S using a Micro USB Plug and 2 x 100K resistors. It was showing the classic bricked phone to computer with exclamation mark triangle in the middle :(.


From what I've read everyone uses a 301K resistor between the ground and the next closest pin to the ground, but it worked for me with 200K total resistance.
I used the connector from one of those cheap kits that allow you to charge most mobiles and stripped down the Micro USB's shroud (see photo).
I plugged it in making sure the phone was switched off. I then performed the get into download mode (Volume down button Home Button and Power button pressed together) this should then show the yellow download mode. This will allow one to recover the phone.

Tuesday, 3 April 2012

OpenWRT and the TP Link WR841N

The WR841N has no USB port on the case but USB is available on the PCB if you can solder and don't mind a bit of work to get it going. I had a problem getting the USB connection I made to the WR841N PCB working. I tried various flavours of patched firmware with no success, however on the OpenWRT Forum someone mentioned just use the TP Link MR3420 firmware. This I did and it worked straight away, smiles all round. I then got extroot to a 2GB memory stick working, this allowed me to add more packages. I added a USB hub to allow the connection of a USB webcam.

Defender 300tdi Lucas 10AS Alarm Immobiliser (Spider) Problems

We have a 1997 Landrover Defender 300tdi that has given immobiliser problems intermittently. I had initially fixed the fuel solenoid as we w...