add a comment
The pictures are great – my only question is how he dreamed up the idea…
add a comment
Lecturing: how to deal with difficult questions.
Hitachi S-4200 user guide in English January 29, 2009Posted by vicky in Microscopy.
add a comment
Comprehensive-looking user guide to Hitachi S-4200 FEG-SEM. Very useful to those of us who only have a copy of the manual in Japanese!!
Changing default settings of spacing around formulae in OpenOffice January 21, 2009Posted by Vicky in Uncategorized.
add a comment
Full address of your webpage August 7, 2008Posted by Vicky in Webdeveloping.
add a comment
For a print version of your webpage, it’s very useful to be able to include the full address of your page somewhere so that peple who print it out know where it has come from.
Simplified a bit from the Web Hosting Articles page:
// determine the domain using HTTP_HOST
$domain = $_SERVER['HTTP_HOST'];
//determine the URI using REQUEST_URI
$theuri = $_SERVER['REQUEST_URI'];
// concatenate to give the full URL
$url = "http://" . $domain . $theuri;
Save the above as ‘whereami.php’, then it can be included in another page using:
<?php include 'whereami.php'; ?>
If you give this script its own css class, “whereami”, then if you make different css style-sheets for the print and the screen version of the page, you can hide the URL on the screen version by adding this line in your “screen” stylesheet:
and just have it appear when you print by leaving this line out of the “print” stylesheet. See the Added Bytes article on printer friendly pages for advice on this.
Recovering from a Windows crash using Knoppix (or, “Things I Never Thought I Would Need to Know”) August 1, 2008Posted by Vicky in Computing.
Tags: computing crash windows linux
(This is very long, for which I apologise, but I suppose that anyone who is in need of this advice will probably appreciate detailed instructions. For anyone else, I suggest skipping down to the section on “Preparing Knoppix CD” and burning a Knoppix CD now just in case you may need it some day. It’s really useful if you do!)
On a seemingly ordinary Friday I suddenly found myself faced with the blue screen of death (TM), followed by a computer that just wouldn’t boot back up again whatever I tried to do… it took me almost a week of research before I finally got it up and running again! All of the info that I used to sort it out is there on the internet (thanks, Google search and all the kind people who have posted advice on various webpages and forums!) but I couldn’t find anywhere with all the info in the same place, so I’m writing this in the hope that it might be useful if you encounter the same problem. I’ve included plenty of references and strongly suggest that you read them as well as this blog post before proceeding.
DISCLAIMER AND WARNING: This method worked on my computer (running English Windows XP service pack 2). I have not tested it on any other computer so I cannot guarantee that it will work on yours. Some of the procedures are risky (see warnings below) and should not be attempted unless you have fully investigated the source of your problem, understand what you are doing and are willing to take the risk. I am offering this advice in the hope that it might help someone who but accept absolutely no responsibility for any damage that might occur as a result of following it. You have been warned!
So, bossy bit over, on with the show…
My ZoneAlarm firewall had been behaving rather oddly and had suddenly started showing a message when I started up the computer, saying ‘ZoneAlarm is initializing… Please stand by’ rather than starting up straightaway. I searched the internet for info on this and found advice suggesting that I should uninstall and reinstall. I went to Control Panel > Add and Remove Programs and clicked Uninstall under the ZA entry. All seemed well for a few moments and then the system froze. After a few more seconds, a blue screen with a message on it briefly appeared before the system attempted to reboot itself. It got as far as the BIOS screen but then just showed the boot screen and didn’t advance from there, even though I waited a long time. Eventually I pressed the Off switch and tried again. This time I got the screen saying that I had previously shut down uncleanly, and a list of boot options including Safe Mode, Last Known Good and Normal. I tried all of these but to no avail – the computer wouldn’t boot up. Aaarrggghhh!
I then remembered that (a) when I had a Linux-Windows dual boot system I could access the Windows files using Linux and (b) that somewhere I had a version of Linux that would boot from CD, that I had recorded some time ago just to try it out… A quick search of the internet revealed that lots of other people had already realised the potential of Knoppix Linux-on-CD for rescuing stricken Windows systems. At the very least, it should be possible to use it to copy my data from the internal hard drive to an external USB one… four years’ worth of photos were among the things at stake and no, I hadn’t backed most of them up… 🙂
Using Knoppix I was able to discover that the registry files had all disappeared(!!), copy my data to an external USB hard disk and finally restore the registry from a backup.
Part 1: Diagnosis, data retrieval and backup
1. CD-R or CD-RW
2. External hard drive (ideally empty and definitely not containing any data that isn’t backed up elsewhere) with sufficient capacity to back up all data on hard drive.
3. Another computer with (a) broadband internet (b) CD-writer and software capable of writing ISO images and (c) USB connection
Since the internal hard drive is being opened as read-only, the main risk in this part is to the external hard drive, which is being used to record the data. As mentioned above, don’t use an external drive containing any important data that isn’t backed up elsewhere. Windows 2000 and XP (don’t know about other versions) use the NTFS file system. The support for reading from and writing to this type of filesystem in the current version of Knoppix (v. 5) is good but apparently not perfect, so there is some risk of corruption when writing data to a disk with this format. Knoppix does support the FAT32 format well so if you can format the external drive as FAT32, there should be no risk in copying to it. The Wikipedia entry on the Captive NTFS system gives some details.
1. Preparing Knoppix CD.
a. Download the Knoppix distribution from the nearest mirror site.
b. If you don’t already have CD-writing software capable of writing ISO images to CD, download a program such as CDBurnerXP Pro (free, Windows 2000+). Insert a completely blank CD-R or CD-RW into the drive (CDBurnerXP Pro is also able to erase CD-RWs) and from the File menu, select “Write Disc from ISO file”. Use the “…” button to select the ISO file for Knoppix, click OK and wait.
(c. Windows does not seem to want to eject the CD even when it has finished recording, but you can remedy this by clicking on the icon for the CD in Explorer and selecting Explore. Once you have done this, Windows seems happy to eject the CD.)
2. Data rescue
This is very nicely documented on the page “Computer First Aid Using Knoppix” by Cedric Shock and Susan Sullivan. (Those instructions are based on Knoppix 3.7 and the current version is 5.0 so there are slight differences, but they are mostly to do with the visual appearance of the Knoppix windows.)
a. Power up computer. It will start its futile attempt to get into Windows.
b. Insert Knoppix CD and press CTRL+ALT+DEL to reboot into Linux (NB for this to work, you need to have your boot sequence set up so that the system will always try to boot from CD before booting from the hard drive. This was already the case for mine. If it is not like this in your case, you can change it when you first switch on. (A message appears saying ‘Press <some key or other> to change boot sequence/order’.) Modify this to put the CD above the HDD in priority and reboot.
d. A welcome screen should appear with a prompt “boot:”. Press Return. Lots of messages appear saying that various things are starting up, and a weird spacey voice will come out of the computer also informing you of the same fact.
e. Once Linux has got started, click on the ‘hda1’ icon to mount the hard drive(*). If you crashed out and the Windows system has been shut down uncleanly, Linux may give a message ‘volume is dirty. forced to continue’. However, unless the problem is due to HD failure, the HD should still open. If it doesn’t, there is a way to force it using shell commands. Open a terminal using the icon that looks like a black screen (on the bottom of the Knoppix desktop window) and enter the following command:
mount -t ntfs -o rw /dev/hda1 /media/hda1
(see info on Knoppix forum.
* For those unfamiliar with the terminology, ‘mounting’ the drive means to establish a connection between it and the Linux operating system so the contents can be read. By default in Knoppix, drives are mounted as read-only.
f. connect external hard drive (I have already said this twice but you should first back up any important data from the external drive just in case anything should go wrong). Some kind of a window should appear asking you what you wish to do. Click on the option for opening the drive and looking at the files.
g. Right-click on the icon for the external drive and select ‘change read/write mode’. Click yes when the warning message appears.
h. Copy your files across to the external drive: drag the folder icon from hda1 to the appropriate place on sda5 (or whatever it is called) and select ‘copy to’ in the menu. You can also create new folders in the external hard drive using the right-click manu and selecting ‘create new’. Remember that depending on how (or whether!) you organise your system, some important files may be hidden deep in the ‘Documents and Settings’ folder in places like ‘My Documents’, ‘Desktop’ and ‘Application Data’. It’s probably best to copy the whole of this folder onto your external HD, and then sort through it later, deleting the junk and extracting the useful stuff, when you know your data is safe.
i. Right-click on the icon for the external hard drive, click on ‘change read/write mode’ and set to read-only.
j. Right-click again on the external drive and select “unmount”. Do the same for the internal hard drive. Remove the external hard drive.
k. If possible, check the integrity of the data on the external USB drive using another computer. Once this is done, wrap the external drive in several layers of cotton wool and store it on a velvet cushion in a very safe place.
The initial panic should now be over – you have managed to get into your unbootable computer and back up your data. Now it’s time to start finding out what is the problem with the computer and trying to fix it.
a. If the hard drive could be opened using Knoppix – even if it was flagged as ‘dirty’ – then the problem is probably not one of disk failure, but rather of corruption of some important system files. According to my (non-exhaustive) research on this subject, serious system failure resulting in unbootability can result from the absence/corruption of several system files including:
i. Boot.ini: this is the first file that Windows looks for, and should be in the root (usually C:/) directory. It is a plain text file so you can easily try to open it in Knoppix to determine whether or not it is corrupt. In my case, there was nothing wrong with this file, but if you are concerned about it, see these instructions, which give an example of a typical non-corrupt boot.ini file and instructions on how to repair a corrupt one. Further info on boot.ini can be found here
ii. NTLDR: This is the file (in Windows XP at least) which looks for boot.ini to find out what to load. If it is missing or corrupted then Windows won’t work. There is some info here.
iii. Registry: the folder WINDOWS/system32/config is supposed to contain the files belonging to the Windows registry – important info on the software, device drivers, user accounts etc. In my case it was completely empty – arrgh! The advice below pertains to this case.
iv. Possibly others. I am not an expert on the way the Windows system works, and I don’t know which other files are critical. If all the files above are present and correct but your system isn’t working, I suggest searching the internet for advice. If it has happened to you, it’s quite probable that it has happened to someone else before and that they have been kind enough to write up their experience on the internet.
b. Knoppix has a lot of useful software included. If your Stricken Computer is connected to the internet, you can use the Firefox or Konqueror browsers to search for useful information. Nothing is stored permanently on the hard drive by Knoppix, so the Bookmarks in Firefox only last until the end of your current session with Knoppix. If you want to bookmark any pages for future reference, I recommend making a del.icio.us account (http://delicious.com/) if you don’t have one already. (Signing up requires an email address, so you will also need a webmail account to pick up the registration email.) Tagging and sharing useful pages in del.icio.us also helps other people to find them more easily 🙂
c. When you have finished this part, click on the Knoppix icon at the bottom left and select Log Off.
A window with a cute picture of a sleepy dragon will appear! Click on the ‘shut down’ icon. The system will shut down and again a weird voice will come out of the computer informing you of the fact (very embarrassing if you are in an office with other people – please Mr. Knopper, I think Knoppix is utterly fantastic, but could you make the next version silently fantastic?). At the end, the CD drive will automatically open so you can remove the CD. However, you may wish to put it straight back in, because the system still isn’t a great deal of use without it at the moment 🙂 The system will still shut down even if you put the CD back in, and it will be ready for the next part of the operation.
Part 2: Restoring Windows Registry
This bit is only relevant if it is the registry that is missing or corrupt – see 3.a.iii above. Otherwise – Google.
Another bright red WARNING AND DISCLAIMER to fill you with trepidation:
This is a last-resort type of fix and carries some risks to the data integrity of the hard drive. You should only attempt it if (a) you have already backed up everything you want to keep from the hard drive (b) you are sure that it is the registry, rather than something else, that’s the problem and (c) you would rather do something risky than reinstall Windows because you have customised so many things.
a. Start up the computer with the Knoppix CD in the drive and wait for it to boot up.
b. Mount the hard drive.
c. Right-click on the icon for the hard drive and click ‘change read/write permissions’. It should come up with a box asking ‘do you really want to change to write mode?’ or something similar. However, if the Windows system has been shut down uncleanly (which it probably has, otherwise you wouldn’t be reading this!) then open a console window and type
su (super user – gives you permission to do scary technical stuff)
mount -t ntfs -o rw /dev/hda1 /media/hda1 (forces the drive to mount)
ntfsfix /dev/hda1 (fixes errors in the NTFS file system)
Then mount the drive and set it as read/write.
d. You could try unmounting the hard drive, getting out of Linux and trying to boot up Windows at this point. This blog gives some instances of ntfsfix alone sorting out corrupted NTFS systems. However, in my case, it didn’t work and it seemed that the registry really was gone, not just invisible. If you just get unbootable Windows, you will need to go through steps (a)-(c) again.
e. Rename the folder “WINDOWS/system32/config” to something else and create a new folder called ‘config’ in the same directory.
f. I firstly did the fix recommended by Microsoft which involves copying files over from “c:\windows\repair\” (although I did it in Linux rather than the Recovery Console because my Windows XP CD with the recovery console on appeared to be on the opposite side of the world from me.) If you do this and then boot up (but see below before doing this), you will get a system that works but doesn’t have your settings, account info, device drivers or any of the system restore points (see below). The display will probably look rather odd because it is using a very basic graphics driver rather than the one suited to your screen. I mention this because I don’t know whether it’s necessary to pass through this stage before going on to the fix below or not. I suspect not but I don’t want to experiment now that everything is working again!
g. System volume information and system restore points: Windows makes a backup of the state of the registry and other important files before certain major changes are made to the system (e.g. installation of certain software). The point of this is to allow the user to restore the system to an earlier point if something goes wrong. You can also set a restore point manually using “Accessories > System Tools > System Restore” at any time. The restore points are saved in C:\System Volume Information. If you use the detailed file view in the Konqueror file manager, it will very helpfully tell you the date on which the files were modified. It is best to select the last-but-one set of files, since the last one may well be a record of the system when it had the problem. The references here (BroadcastNewsroom – non-Knoppix) and here (Myles Eftos’s blog – using Knoppix) explain about the System Volume Information contents and the Lunarsoft Wiki has comprehensive information on the contents of the System Volume Information – read the section “Registry hives and their locations”. (No, I don’t know why they are called hives.) Carefully copy the files as described in the Lunarsoft Wiki page. Do not overwrite existing files but instead rename them before inserting the new files. This creates a backup in case anything goes wrong.
h. Once finished, change the permission on the hard disk to read-only using the right-click menu.
i. Unmount the hard disk, also using the right-click menu.
j. Close down Linux and reboot, removing the CD so that it will try to boot from Windows.
k. Wait. And wait some more. The Windows system will take a very long time to boot up this first time. Even if you think it isn’t doing anything, still wait. It will probably get to a point where some kind of different screen comes up, and then it reboots itself. Don’t worry. It is trying to figure out ‘where am I, and what’s going on?’ :0
If you have a hard disk indicator on the computer (a little light in the shape of a stack of disks) and it is flashing, then things are happening and you shouldn’t worry.
l. Eventually, your normal Windows welcome screen and desktop should appear. Hoorah, hoorah!
m. However, your system is still unstable at this point, and if you try to do anything fancy it might crash all over again. (Believe me, I tried and it did and I had to go through the whole rigmarole of copying all those hives again. Don’t try it.) We have only restored the registry and not the full components of the System Restore so the registry does not correspond exactly to the other bits of restore data. Do a proper System Restore using “Accessories > System Tools > System Restore” (Windows article on this). Reboot. Now it should, finally, be stable and back to its original state!
If the crash occurred while uninstalling ZoneAlarm, this program might be in some kind of “half-installed” state and need to be removed before it can be reinstalled. Follow the procedure on the ZA user forum but do it in Safe Mode: firstly reboot and press F8 while booting up to get a list of different boot modes and select Safe Mode from the menu. This seems to avoid a catastrophic loss of registry data even if there is a temporary crash.
A short rant addressed to those in the government and elsewhere who deal with our personal data on a daily basis:
It took me, a determined non-expert, less than a week to get into my ‘inaccessible’ Windows computer and replace important system files. I never needed to use the administrator password. How long would it take a determined cyber-criminal to get into your password-“protected” laptop with our important and confidential data on it? DO NOT, I beg you, leave important data lying around on laptops in places where they could be stolen and DO NOT trust in computers. Data stored on computers is not safe. Rant over.