Monday 19 December 2011

SSH Tunnel command

Command to setup the tunnel
ssh -N -p 11000 remoteuser@remotecomputer.net -L 5901/localhost/5900

To view from Local computer
vncviewer 127.0.0.1:1

So the first command sets up the tunnel from the local machine to the remote computer using port 11000. The 5901 port on the local machine is forwarded to the 5900 port on the remote machine. Now when you use your local machine to connect to port 5901 on the localhost this allows you to connect to the vnc server on the remote machine via the port 11000 tunnel.

Thursday 24 November 2011

WRT54GL Hacking

Driver for SD card downloaded from here
mmc-v1.3.4-gpio2.tgz file

tar xzvf mmc-v1.3.4-gpio2.tgz
cp mmc-v1.3.4-gpio2/mmc-v1.3.4-gpio2/mmc /lib/modules/2.4.37.4
insmod mmc (comment: at this point check with dmesg if every thing is ok)
mkfs.ext3 dev/mmc/disc0/part1



opkg update update the package list
opkg install kmod-fs-ext3 install package ext3 filesystem
insmod ext3 activate the module ext3
lsmod List installed modules
mkdir /mmc create the directory /mmc
echo "0x9c" > /proc/diag/gpiomask Mask the gpio for the SD card and Wifi
insmod mmc Activate the module mmc (sd card driver)
mount /dev/mmc/disc0/part1 /mmc Mount the SD card to /mmc
grep /mnt /proc/mounts List the mounts to check SD card is mounted

Mounting to External Media
Mount root to SD Card

#!/bin/sh
. /etc/functions.sh
mount proc /proc -t
insmod diag
echo 0x9c > /proc/diag/gpiomask
insmod mmc
insmod ext2
mount -o rw /dev/mmc/disc0/disc /mnt
[ -x /mnt/sbin/init ] && {
. /bin/firstboot
pivot /mnt /mnt
}
exec /bin/busybox init


We have to format the thing:
opkg install e2fsprogs kmod-fs-ext2
mkfs.ext2 /dev/mmc/disc0/disc # See above for the correct partition path
mount -t ext2 /dev/mmc/disc0/disc /mnt/


Now we are going to copy over the root stuff
mkdir -p /tmp/root
mount -o bind /rom /tmp/root
cp /tmp/root/* /mnt -a
sync
umount /tmp/root
umount /mnt


Another way of mounting root to SD Card

rm /sbin/init Remove this file

File /sbin/init Create this file script is below

#!/bin/sh
echo "0x9c" > /proc/diag/gpiomask
insmod mmc
insmod ext2
boot_dev="/dev/mmc/disc0/part1"

sleep 15s
mount "$boot_dev" /mmc
[ -x /mmc/sbin/init ] && {
mount -o move /proc /mmc/proc && \
pivot_root /mmc /mmc/mmc && {
mount -o move /mmc/dev /dev
mount -o move /mmc/tmp /tmp
mount -o move /mmc/jffs2 /jffs2 2>&-
mount -o move /mmc/sys /sys 2>&-
}
}
exec /bin/busybox init


chmod a+x /sbin/init Make the file executable

reboot


df -h You should see that /dev/mmc/disc0/part1 is mounted to /

OpenWRT Website

OpenWRT Downloads

openwrt-brcm-2.4-squashfs.trx file This is a 2.4 Kernel



Flashing Firmware (This is a 2.4 Kernel)

Script to clean nvram settings


./nvram-clean.sh
nvram commit




sysupgrade /tmp/openwrt-brcm-2.4-squashfs.trx
or
mtd write /tmp/openwrt-brcm-2.4-squashfs.trx


The commands below allows the use of a tftp server to flash firmware by allowing a delay in the startup to access tftp

nvram set boot_wait=on
nvram set boot_time=10
nvram commit && reboot

Wednesday 2 November 2011

Failing SG31V2 Shuttle

After about three years of use the Shuttle I use at work was starting to fail. First I noticed that the Audio would become scratchy, clicky and noisy then the machine would freeze or reboot.
I found 3 swollen 1800uF 6.3V electrolytic capacitors on the Motherboard.

These I replaced with 1800uF 10V capacitors from Farnell or CPC (same company) and this seemed to fix some of the problems. I encountered reboot problems etc and loaded the Xsensors program and this showed the 5V supply was varying wildly. I replaced the PSU and this fixed all the problems yeehaa.

Vboxmanage Command

The Vboxmanage Command
I had difficulty trying to increase the size of a virtual hard drive on one of my Virtual machines, but it turned out that the command below was all that was needed to turn a 15GB HD into a 20GB HD easy :).

vboxmanage modifyhd ~/.VirtualBox/VDI/Windows\ XP.vdi --resize 20000

Footnote: I forgot to use a partitioning program to resize the partition and use the whole disk. I booted a Gparted Live CD in the VM and used it to grow the partition to its full size.

Monday 22 August 2011

PPC iMac Network Fault

A PPC iMac was brought in and it was found that dhcp was not working (it wasn't receiving an IP address from the server).

It did work if the IP address was set manually. On further investigation it was found from the system logs that all dhcp requests were being denied. So the firewall was modified to allow dhcp requests and this fixed the problem.

Setup Gamepad in Ubuntu




The USB Gamepad was plugged in and the command dmesg
shows the following.

[74836.932026] usb 5-1: new low speed USB device number 3 using uhci_hcd
[74837.348311] input: GreenAsia Inc. USB Joystick as /devices/pci0000:00/0000:00:1d.3/usb5/5-1/5-1:1.0/input/input7
[74837.348529] pantherlord 0003:0E8F:0003.0004: input,hidraw3: USB HID v1.10 Joystick [GreenAsia Inc. USB Joystick ] on usb-0000:00:1d.3-1/input0
[74837.348540] pantherlord 0003:0E8F:0003.0004: Force feedback for PantherLord/GreenAsia devices by Anssi Hannula
[335187.792075] usb 5-1: USB disconnect, device number 3
[335190.016042] usb 5-1: new low speed USB device number 4 using uhci_hcd
[335190.219466] input: GreenAsia Inc. USB Joystick as /devices/pci0000:00/0000:00:1d.3/usb5/5-1/5-1:1.0/input/input8
[335190.219646] pantherlord 0003:0E8F:0003.0005: input,hidraw3: USB HID v1.10 Joystick [GreenAsia Inc. USB Joystick ] on usb-0000:00:1d.3-1/input0
[335190.219657] pantherlord 0003:0E8F:0003.0005: Force feedback for PantherLord/GreenAsia devices by Anssi Hannula


The USB Devices were listed using lsusb giving the output

Bus 005 Device 004: ID 0e8f:0003 GreenAsia Inc. MaxFire Blaze2
Bus 005 Device 002: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 003: ID 045e:009d Microsoft Corp. Wireless Optical Desktop 3.0
Bus 004 Device 002: ID 045e:0023 Microsoft Corp. Trackball Optical
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 002: ID 046d:0840 Logitech, Inc. QuickCam Express
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 004: ID 0bda:0161 Realtek Semiconductor Corp. Mass Storage Device
Bus 001 Device 002: ID 4971:ce17 SimpleTech 1TB SimpleDrive II USB External Hard Drive
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub


A soft-link has to set using sudo ln -s /dev/input/js1 /dev/js1

The gamepad is calibrated using sudo jscal -c /dev/js1

It is now ready for use.

Thursday 11 August 2011

Using Rsync

Some quick rsync examples

rsync -av /memstick/ /mymaindisk/
This will rsync the memstick directory to mymaindisk directory preserving all aspects of the files with the archive switch and the verbose switch will show whats happening.

rsync -avz /memdisk/ me@myserver:/backupdir/
This will do rsync over ssh rather than scp, using -a archive switch -z switch this signifies use compression over the link.

Tuesday 9 August 2011

Ubuntu Server Screen Blank

Problem when rebooting Ubuntu 11.04 Server X86 after fresh install.
It caused the screen to be blank and a monitor message of overrange settings. This was traced to the setting of gfxmode=auto in the /boot/grub/grub.cfg file.

Note: you have to boot Ubuntu into rescue mode using the media CD/DVD/Memory Stick you used to install the system with.
From the command prompt make the /boot/grub/grub.cfg writable using chmod +w /boot/grub/grub.cfg command.
Now edit the file using vim /boot/grub/grub.cfg command.

The settings that worked for me were as follows gfxmode=1024x768 and with an entry gfxplayload=keep added directly after the gfxmode line.
After editing hit esc key then type wq and then hit enter this will write the file and quit vim.

Now reboot your system and hope it works.

What a mucking around to fix this stupid fault.

Information Source I used

Tuesday 5 July 2011

Add sudo to CentOS

Install the sudo package
# yum install sudo


Edit the sudo file by removing the # from the # %wheel ALL=(ALL) ALL to uncomment it.
# visudo


Save the changes and quit.
:wq


gpasswd -a username wheel

Change to sudo su.
sudo su -

Confirm that you can login with your username, then disable the root login.
passwd -l root

Tuesday 28 June 2011

TP-Link MR3220 Debricking

I bricked my MR3220 router with an OpenWRT firmware upload. I did manage to get it back by soldering a 4 pin header on its pcb to allow connection to its serial port. I used a Sparkfun FTDI Basic Breakout - 3.3V USB to serial port converter . I used minicom in Ubuntu 11.04 to communicate with the MR3220.
Photo showing the FTDI Basic Breakout - 3.3V USB to serial port converter.
MR3220 Debricking Procedure
Do this:
- Power off the router
- Connect the serial cable to the router and the computer
- Connect the Ethernet cable to the router and the computer
- Set the IP address of the NIC in your computer fixed at 192.168.1.27
- Start the tftpd server I used tftpgui and placed the firmware from the TP-Link website renamed to code.bin in the root directory of the tftp server as defined in its settings.
I used info obtained from OpenWRT Wiki and the procedure I used is below
- Start minicom with parameters 8 bit, no parity, one stop bit, 115200 baud, no flow control and no xon-xoff.
- Power the router on
- Boot messages will appear on the minicom terminal
- When the message "autoboot in 1 second .." appears quickly enter password tpl you will have to type quickly. This should interrupt the boot process and you should see the prompt:
ar7100>

To program the new image:
Erase the memory
ar7100> erase 0x9f020000 +0x3c0000
Load the new firmware
ar7100> tftpboot 0x81000000 code.bin
Copy memory bytes into flash memory
ar7100> cp.b 0x81000000 0x9f020000 0x3c0000
Boot kernel image from flash memory location
ar7100> bootm 0x9f020000

To transfer image via Kermit (Serial Port)
You set the router up to receive the file via Minicom using the following commands. Erase the memory
ar7100> erase 0x9f020000 +0x3c0000
Now load the binary file
loadb 0x81000000
Exit Minicom Ctrl A Z X Fire up Kermit:-
set line /dev/ttyUSB0
set speed 115200
set carrier-watch off
set handshake none
set flow-control none
robust
set file type bin
set file name lit
set rec pack 1000
set send pack 1000
set window 5
send openwrt-ar71xx-generic-tl-mr3220-v1-squashfs-factory.bin

Back to minicom:-
Copy memory bytes into flash memory
ar7100> cp.b 0x81000000 0x9f020000 0x3c0000
Boot kernel image from flash memory location
ar7100> bootm 0x9f020000
Photo of MR3220 showing the four pin header location and pin outs.

That's hopefully it and router should now work.
The router admin webpage is now on 192.168.1.254 , Note: I found that the password was still set to the password I had set when I first got the router and not the manufacturers default password as I expected with a reflash.

Monday 27 June 2011

Create a Video Using DeVeDe

DeVeDe is a CD/DVD creator package for Linux. In Ubuntu sudo apt-get install devede, this will install the package.
Run the program in Gnome by selecting Applications -> Sound & Video -> DeVeDe CD/DVD Creator.
In the program I chose Video DVD. Changed the title by right-clicking on Title. Add the video vob file from the mini DVD source. In the advanced options I chose "FMMpeg deinterlacing filter" as I found that using the default "Don't deinterlace" gave horrible comb effects when the video was playing. The final file created by DeVeDe is an iso file that can be burned on a DVD using K3b.

Thursday 12 May 2011

VirtualBox

Create a VM
VBoxManage –help


VBoxManage createvm --name "MyvmServer" --register
VBoxManage modifyvm "MyvmServer" --memory 256 --acpi on --boot1 dvd --nic1 bridged --bridgeadapter1 eth0
VBoxManage createhd --filename MyvmServer.vdi --size 10000 --register
VBoxManage storagectl "MyvmServer" --name "IDE Controller" --add ide
VBoxManage storageattach "MyvmServer" --storagectl "IDE Controller" --port 0 --device 0 --type hdd --medium MyvmServer.vdi
VBoxManage storageattach "MyvmServer" --storagectl "IDE Controller" --port 1 --device 0 --type dvddrive --medium /home/MyvmServer.iso


Start a VM with VboxHeadless
VBoxHeadless --startvm "MyvmServer"
VBoxManage controlvm "MyvmServer" poweroff
VBoxManage controlvm "MyvmServer" pause
VBoxManage controlvm "MyvmServer" reset
VBoxHeadless –help

Import an existing VM
VM with the name myvm that needs to be reused. A directory contains myvm in the VirtualBox directory. The myvm directory will contain the myvm.xml file. Copy the myvm directory (including the myvm.xml file) to the new Machines directory.
In addition copy the myvm.vdi file from the old VDI directory to the new one.
Register the imported VM:
VBoxManage registervm somedirectory/myvm/myvm.xml

Reference Page
The above link contains more info on VM's.

Wednesday 11 May 2011

Remove CentOS Xen

Install Standard Kernel
yum install kernel

Remove Xen Kernel
yum remove xen kernel-xen

Edit Grub to Select Correct Kernel
/boot/grub/grub.conf

Tuesday 8 March 2011

Wine Install IE7 Problems

Info from Wine HQ App Testing Info
To install use the commands below :
Install with "export WINEPREFIX=~/.wine_ie7" then "winetricks ie7"

1Password using Wine in Ubuntu

This program would not run properly in Ubuntu 10.10 it would not allow the creation of a 1Password folder but installing DirectX9 seems to have fixed this.

Wednesday 2 February 2011

Dell Poweredge 2950 Failure

Server failure
This server failed with the error "E171F PCIE Fatal Err B0 D3 F0" during power up. Upon inspection it was found that the 5/I PCIe SAS Controller card model no UCS-51 had a swollen electrolytic capacitor. This was replaced with one from an old PC motherboard, it had the same value (1500uF) and voltage rating (6.3v). After replacement the server booted and completed all it POST and began booting the OS. The server was soak tested and appeared to be operating fine. Hopefully saved an engineer call-out that probably would cost ~£500. By the way the machine was out of warranty. Below are pictures of the board and the repair.

Swollen Capacitor

Capacitor Repair
Supplemental Info A further 5 Dell servers came up with the same error and these were fixed by replacing the capacitors, bad batch of electrolytics.

Tuesday 25 January 2011

Sheevaplug Shenanigans




I was loaned this particular Sheevaplug V1.3 with ESATA by Alex Voss, many thanks Alex. I plan to install a large hard drive and use this to boot the Sheeva plug from and install standard Debian rather than the Ubuntu it is supplied with. It seems to be relatively easy but requires a custom Kernel.

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...