When solutions to problems just confuse and anoy

1 10 2007

I just spent 2 days trouble shooting my network connection (well actually I spent a majority of it playing and ignoring the problem but anyway). (Linux client beta testing for X³ is soon)

My system had been working fine for years without issues, then I swapped the harddrive for a slightly bigger one, I basically reinstalled Windows then booted to the Ubuntu LiveCD, made the ext3 partition and rsynced my Linux install across and fixed the fstab/grub entries. Then my internet under Linux just stopped working, but of course not right away because that would be explainable, it worked for a couple of boots, enough time for me to download the almost 1Gb worth of crap I need to make my Windows install actually usable (250mb SP2, 50mb nVidia drivers, 23Mb SoundMax audio drivers – which where a pain to find because they show up as a Intel ICH8 82801H in Linux and you need the drivers that are specific to your manufacture even though it the same chipset on everything, Firefox, Antivirus, VideoLan, putty, DaemonTools, Pidgin, 7-Zip, etc…), and people think Linux is hard to install? :/

After all that had downloaded, I rebooted to Windows and installed it. Then going back to Linux, no internet connection

Network worked fine under Windows.
At first I though it was DHCP/DNS problems, but setting the ip address manually didn’t help, it wouldn’t bind the ADSL modem or server. I considered the possibility that the kernel had been updated and just broken horribly or some other related package, but I booted off the LiveCD which I know works fine, set the IP manually and it wouldn’t work. Considered the possibility that I had somehow screwed my connection to work for windows only, but my other computer ran fine.

Spent ages swapping cables in case the wire was broken and Linux was somehow more picky about faulty cables and rebooting everything I could. Disabled all the dhcp/dns server/clients in case some weird network voodoo was happening.

Then strangely I noticed that the light on the router wasn’t lit while under Linux, but only under Linux, rebooting to windows it would magically light up.

ethtool reported it as link not found, so it didn’t appear that there was some magic command to make the interface spring back into life (I had already tried ifconfig up etc…).

Vaguely remembered having a similar problem once before, years ago when I got the mobo.
Pulled out the power out from the back of the computer (I had turned it off and rebooted many times).
Plugged it back it.

Like magic everything is working again :/

At best guess, when I installed the windows NIC driver (after downloading it from the working Linux connection) it strewed up the interface somehow that is only a problem in Linux and only completely loosing power manages to fully reset it (It had been stuck like it for about 4 days, with my turning it off overnight), it would explain why I remember something similar happing when I forst got it since I would have needed to install the NIC drivers then too. For reference the mobo is an Asus P5B with a “03:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 01)”. [EDIT: Looks like the problem is the wake on lan feature but it doesn’t happen every time I shutdown Windows like the article says it does, there does seem to be a solution though, http://gentoo-wiki.com/HARDWARE_RTL8168]

It also reminded me of several years before when I had a failing motherboard, firstly the CMOS kept loosing the setting even though I replaced the battery, so it required me to push F1 at boot to continue. But the USB keyboard wouldn’t work for some odd reason, so I tried a PS2 one. It worked but only if I pressed it very fast… until next reboot. Then the USB one worked, once again only if I pushed it very fast… then next reboot it was back to the PS2 and so on. So every boot I had the little ritual of furiously hitting the F1 keys simultaneously on two separate keyboard hoping that it would be detected (about ⅓ of the time it would need to be rebooted to try agian). once it got past POST everything including both keyboards worked without problems.

Advertisements




OpenWRT on D-Link DSL-G604t

8 07 2007

The default firmware for the router leaves a lot to be desired, dns is fairly painful with bugs such as IPv6 enabled systems returning 0.0.0.1 for IPv4 addresses (Its fixed in the newest Australia firmware release but I’m not sure about other countries). There was also a problem the system dying under heavy load such as BitTorrent or other P2P (also fixed) but there doesn’t seem to be anyway to link hostnames. static ips and MAC addresses together, there are some options such as reserved hosts which map MAC to ip, and another section that maps hostname to ip but these seem to override each other and the IP only seems to be for DHCP not DNS, You could manually edit /etc/hosts on the modem which will be wiped each reboot.

There is a good information on the router at Seattle wireless, including hardware info and the ADAM2 bootloader.

Firstly you need to find the IP address of the routers ADAM2 bootloader.

If you have a working router, you can telnet into it and cat /proc/ticfg/env

Its a good idea to save this information for later as things like the mtd layouts are handy to have. You want to find the ip address entry. There are a few defaults, 10.8.8.8 is common for the ones in Australia, mine is 169.254.87.1, which I believe is a failsafe address that probably started to be used when I accidentally wrote over the environment variables part of the mtd, fortunately its fairly bullet prof providing you don’t kill mtd2 (0x0 to 0x90010000) which is where the adam2 boot loader lives.

You need to grab the source code for OpenWrt from svn as there currently aren’t any ar7 releases.

There is a guide on the OpenWRT wiki, its important to read as I will be glossing over the details here.

Compiling is fairly painless, ‘make menuconfig’, choose options as shown in the guide and then ‘make’. This will make images in the bin directory. The only one thats important is the openwrt-ar7-2.4-squashfs.img file.

The guide recommends you checksum the image using TI’s GPL code. I;m not sure if this is actually required or not but I did it to be safe.

There is a adam2flash.pl file in scripts, however it doesn’t seem to be able to find the device, I tried it along time ago with the 2.4 OpenWRT and had a similar problem, manually modified the script to fix the error (i forget how) but then the script refused to flash as the mtd’s where different on the new Australian firmware.

Instead you need to manually upload the firmware with the ADAM2 ftp.

Firstly set your computers ip address to the same subnet as the ADAM2’s ip. Then ftp to the ip address and quickly unplug and replug the modem (your supposed to wait 10 seconds but under windows the interface will go down if the router is off for too long and ftp won’t work.

You should get the ADAM2 login screen, login with ‘adam2’ as user name and password.

You can see the mtd information with:
quote "GETENV mtd0"

Its a good idea to check them all. You will need to modify them for the firmware but don’t touch mtd2 as thats where the boot loader is and screwing it up will brick the router unless you happen to have a JTAG. Its a good idea to workout the partition ordering, its [mtd2]-[mtd1]-[mtd0]-[mtd3] with [mtd4] spanning across the memory of [mtd1] and [mtd0] combined. mtd2=bootloader, mtd1=kernel, mtd2=filesystem and mtd3=adam2-enviroment-variables (nuking this will make adam2 goto the failsafe defaults which will mean you might need to find the failsafe ip address).

You can then use quote "SETENV mtd4, 0x90010000,0x903f0000".

You need to open the openwrt-ar2-2.4-squashfs.img file in a hexeditor and find the memory location that contains the code ‘hsqs’, then add this to the location where the adam2 bootloader ends (0x90010000). This location is where the compressed filesystem is kept. From above you can see that the compressed fs is at mtd0, so the resulting number is where mtd1 ends and mtd0 starts. The rest of the coordinates are unchanged from the defaults.

You can then upload the image
binary
hash
debug
put openwrt.img "openwrt.img mtd4"
quote REBOOT

If ftp dies when attempting the put command, simply reconnect. You should see a bunch of # on the screen thanks to the hash command, so you can see everything is working well.

When you reboot, the modem should come up with the ip address 192.168.1.1, it might take quite along time to work though. I sugest you set your ip to an address on the subnet and leave ping running. When it responds to a ping it will still take quite a while for the servers to come up, you can keep trying to telnet to 192.168.1.1.

Since this is the first boot, it needs to generate a ssh key. You can see if its still generating the key with ‘top’, it should be a dropbearkey process using a lot of cpu also a firstboot process should be around. You also should set your password with ‘passwd’ to allow ssh and stop anyone logging in.

When you have done that and the key has been generated you can ‘reboot’.

Once again it will take several min to come back up.

Next edit /etc/ethers with vim and you static MAC entries in the form of:
00:AA:AA:AA:AA:AA 192.168.1.2

And edit /etc/hosts for the hostnames of the ip addresses.

Then you need rm /etc/resolv.conf as it is a link to an automatically generated file in /tmp. You need to add your isps nameservers to it. Also you need to add them to /etc/resolv.conf.auto so dnsmasq checks them for clients on the lan.

The TI ACX111 wireless interface needs firmware to be wget’d to /lib/firmware check ‘dmesg | grep acx’ to find out which files are actually needed, mine wanted tiacx111 and tiacx111c16.

You can either reboot or ‘rmmod acx; insmod acx’ to bring up the interface

I have yet to figure out how to get the wireless lan working as an access point, for some reason the /etc/config/wireless only works for 2 chipsets. iwconfig will work to bring up the wireless interface manually and it shows up on a scan but I was unable to authenticate with the access point, I’m not sure if its because there is more setup required or if the drivers are broken although its probably a config problem. For not I have gone back to official firmware but turned of the DNS/DHCP servers and setup a proper one on another system untill the OpenWRT branch is updated to support acx111 in the wireless configuration.