How to: Dell Inspiron 1525 repair

As the “computer guy” in the family from time to time a repair job will land on my doorstep. This was an older Dell Inspiron 1525 laptop that wasn’t booting anymore. This time it wasn’t some horrible virus that had eaten a system file, but the hard drive starting to fail (something I verified by booting a Live USB version of Ubuntu).

The very first thing you need to do at any sign of hard drive failure is run a complete backup. If you really care about some of the data, then I suggest you start with the bits you really care about (photos) and work your way outwards to a full backup. Don’t be shy about “wasting” backup drive space, this might be the last hour (or minutes) of functioning drive. I make this comment from experience watching a full backup stop due to total drive failure part way through the photo directories after successfully backing up a bunch of system files.

You can (as I have) try gddrescue or similar recover tools once you’ve done what you can with the drive in terms of backup. This might get you a little bit more data, but these tools are in my opinion last ditch efforts to salvage failing media. You can try the freezer trick, or even warming the drive up but don’t count on them working. It’s worth repeating: nothing beats regular backups – unless it’s automatic nightly incremental backups with off-site replication.

Replacing the failed drive is simply a matter of finding the manual, and buying a matching drive. If this were my personal system I’d be tempted to upgrade to a SSD, but there is still a big price difference. I booted from the Live USB Ubuntu for the first boot after install, this let me check the hardware was good to go and to peek at the SMART data. It was interesting to see that the SMART data says power cycles=4, I guess they really do test the drives at the factory.

Installing using the Dell Windows install disks went smoothly, the driver installation steps were annoying and kludgey feeling but not too horrible. Time then crawled to a stand still as I worked my way through the updates from Microsoft, one patch set at a time from 2008 (era of the install media) to present day. Many, many, many reboots later I had a clean install that was fully patched and ready to go back. If you find yourself having to do this more than once in a long while, consider using a more advanced technique.

Well, with the exception of the problem of a missing key. Amazingly the lack of the key didn’t prevent you from using it – the ‘T’ worked just fine, it just felt very wrong. I quick trip off to ebay and I was able to locate a suitable replacement. It turns out I needed a K26 type key, and that the same model had at least four variations. This website had a handy guide for selecting the type of key you needed.

Pictured above is what arrived in the mail. A rubber plunger, a plastic hinge and the key cap. First I needed to pop the hinge off of the key, the blade from my swiss army knife did the job worked well. Then I had to puzzle a bit over which way the hinge was supposed to go on the keyboard.

I hope the picture above helps others understand how it is supposed to fit on the keyboard – it was the image I had hoped to find on the internet when I was trying to figure it out. Some of the  youtube videos show using needle nose pliers to do the installation, I found that my fingernails did the job. One the hinge in on, simply plop the rubber plunger in the middle – large base down as pictured in the arrive in the mail shot. The key cap will just snap on when placed on top and pressed down – work the top first, then the bottom.

Replacing the missing key was very satisfying,  not very expensive and the improvement was both cosmetic and functional.

How To: Jenkins with Apache controlled authentication

For a change of pace, I was working with RHEL6 instead of Ubuntu and setting up a Jenkins CI server. I’ve used Jenkins aka Hudson previously, but this was my first time setting it up.

A lot of this is straight from the Jenkins wiki, which is detailed and helpful but at times cryptic. The default access mode of Jenkins is pretty much wide open, this is very handy for getting things done – but probably not what you want if there are a mix of people on the network, many whom you really don’t want to let do stuff like launch/configure your builds. As I had Apache already running and setting up authentication with Apache is relatively straight-forward, I figured the easy solution would be to hide Jenkins behind Apache.

Since Jenkins is a big wad of Java code that is offering up a web interface, we’ve effectively got two web servers running: Apache, and Jenkins (different ports). The solution we’ll use is a proxy on the Apache side and some firewall rules to prevent direct access to Jenkins, forcing people through the proxy and thus the authentication controlled by Apache.

Let’s start by checking to see if mod proxy is enabled. This is simply a matter of verifying if /etc/httpd/conf/httpd.conf has these two lines:

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so

In my case it was enabled so no work needed. Now we modify /etc/sysconfig/jenkins, at the end of the file we need to add some args to point at the path we want our Jenkins instance to be hosted at:

JENKINS_ARGS="--prefix=/jenkins"

Restart Jenkins (service jenkins restart) to have the changes picked up. You can test to see if it’s working on localhost:8080/jenkins. I tried, and failed to have this work for a nested path (ie: /path/to/jenkins), I suspect this is a Jenkins limitation but didn’t chase down the actual reason.

Next let’s create an Apache configuration file in /etc/httpd/conf.d/jenkins_proxy.conf with the following contents:

ProxyPass /jenkins http://localhost:8080/jenkins
ProxyPassReverse /jenkins http://localhost:8080/jenkins
ProxyRequests Off

# Local reverse proxy authorization override
# Most unix distribution deny proxy by default (ie /etc/apache2/mods-enabled/proxy.conf in Ubuntu)
Order deny,allow
Allow from all

We need to restart the web server (service httpd restart) to have these changes picked up. As this is RHEL6 and it is running with SELinux enabled, we also need to allow httpd (Apache) to do proxy connections:

# setsebool -P httpd_can_network_connect true

Now at this point you should be able to visit http://yoursite.com/jenkins, and see that our proxy configuration is working. This is cool, but people can still talk to it via http://yoursite.com:8080/jenkins which will bypass Apache.

We’ll be using iptables to accomplish this. As you can see my system was running iptables, but everything was permitted.

# iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT all -- anywhere anywhere

Chain FORWARD (policy ACCEPT)
target prot opt source destination

Chain OUTPUT (policy ACCEPT)
target prot opt source destination

Use ifconfig to figure out what your ethernet card is (the one where external packets will come from), in my case it was eth6. So we can simply instruct iptables to drop packets destined to 8080 from that source, allowing only internal traffic (ie: the proxy) to pass.

# iptables -A INPUT -p tcp -i eth6 --dport 8080 -j DROP

That’s it, now users are forced to come in the correct front door (Apache). To make the iptables change permanent:

#service iptables save

So now the Apache web server is seeing traffic to Jenkins and can perform authentication, this is simple enough to add to the Apache configuration file we created that defined the proxy (/etc/httpd/conf.d/jenkins_proxy.conf) – I’ll leave that one up to the reader to sort out.

How To: Spectroscope from common items

Ok, maybe it’s not very pretty – but it’s a science project you can put together in about 10 minutes once you’ve got the parts together AND those parts are likely things you’ve got around your home now. It was a long weekend and the kids and I were looking for something to make, this fit the bill and just maybe taught them a little bit about science (maybe I learned something too). The original article is a great reference, as usual I’ll repeat the steps here with my notes.

Parts list:

  1. Box – large enough for a CD
  2. CD, used or not
  3. Toilet paper tube
  4. Two razor blades
  5. Tape: scotch tape & silver foil tape (but masking + duct will work too)

For reference, in the picture at the top of the post – the bottom of the box is facing us, and the tube is coming out of the right side.

First we cut an oval hole for the paper tube in the right side. Choose a side, and use the CD as a guide – place it in the lower left corner and mark the center hole. Now use that as a guide to center the paper tube and mark the outside of the tube. Shift the tube left so it’s touching the center of the CD hole marking and mark the outside of the tube. You should have two outlines of the paper tube that you can make into an oval.

The next hole is for the razor blades, it goes on the side to the left of the oval hole. It should be 1/2 inch wide by 2 inches high – give or take a bit. It should the same height up the box as the tube hole (use the CD as a guide) but about 1/2 inch in from the edge. We’re going to cover this slot with the razor blades in a minute.

Now place the razor blades over the second hole and tape them in place. They should fully cover the hole and be spaced as closely together as possible, almost but not quite touching. It is important to have an even spacing top to bottom.

Orient the box as seen in the picture at the top of the post. Place the CD on the side of the box that is lying on the ground now, label side down. Shine a flashlight into the razor blade slit, and hold the tube in the oval at an angle. You may need to close the box to see this, but you should see a rainbow of sorts when you look through the tube at the CD.

Once you’ve got this basically aligned (and don’t sweat it too much), tape things in place. Use the foil tape to seal the box up to prevent any light leaks.

That’s it, we’ve built a spectrometer!

Above is a full spectrum resulting from sunlight. If you look carefully you’ll notice there are clouds as the razor blade slit (diffraction grating) also acts as a pinhole camera.

The pinhole effect is much more obvious in this photo which shows some trees blocking some of the light.

The image on the left is a normal 4′ fluorescent bulb, the one on the right is a T4 fluorescent bulb. The gas signature is pretty much identical.

The image on the left is a CFL bulb, exhibiting the basic fluorescent gas signature. The one on the right is a regular incandescent bulb, notice it is quite similar to sunlight.