ARN

Linux to the rescue! How Ubuntu can help a computer in distress

When disaster strikes your Windows PC, an Ubuntu live drive has all the tools you need to save the day.

This may sound like sacrilege, but it's not: Ubuntu Linux can be useful even if you're a hardcore Windows user.

That's because there's no way to boot a full Windows system from a USB stick to troubleshoot your PC--well, not without an Enterprise version of Windows and Windows To Go--but anyone can make a free Ubuntu USB drive, CD, or DVD. A Ubuntu live drive can be used as a digital Swiss army knife to troubleshoot all sorts of problems with any PC, whether you need to recover files from a failing computer, diagnose hardware problems, perform a deep virus scan from outside Windows, or even reset a forgotten Windows password.

We'll be getting our hands dirty with some Linux terminal commands here, but don't worry--the Linux terminal won't bite. You can even copy-paste most of these commands directly into the terminal.

Create Ubuntu Live media

To get started, you'll need a Linux live USB drive, CD, or DVD. You can use any Linux distribution for this, but we're focusing on Ubuntu to simplify things.

Visit Ubuntu's website and download Ubuntu Desktop-- we used 12.04 LTS for this, but any available version will do. Download the Universal USB Installer tool, then select your USB drive and the ISO file and the tool will create a bootable USB drive. You can also burn the ISO file to a CD or DVD, but those spinning discs will run slower than a USB drive.

Just insert the live drive into a computer and reboot. It should boot straight into Ubuntu; if it doesn't, you'll need to change the boot order in your computer's BIOS. Once you're in, the troubleshooting begins.

Recover files from a failing drive

We've all been there. Your PC may not boot, Windows may be showing errors and blue-screening, or--even worse--you may hear that dreaded mechanical hard drive clicking.

Even if you can't boot Windows, there's a good chance you can read the drive from within Linux and recover some files before the hard drive dies completely. Or, if the Windows system is corrupted and the drive itself is fine, you can recover all of the files from outside Windows.

There's no Linux terminal involved here. Just click the folder icon on Ubuntu's launcher to open the file manager. You'll see your Windows drive under Devices in the sidebar; click it and you'll see your Windows file system. If you have multiple partitions or hard drives, you'll see multiple devices here.

Connect an external drive or USB stick to your computer and it will appear under Devices, too. Copy and paste the files you want to back up from the Windows system to your external drive, just as you would on Windows. You could even fire up a web browser and upload the files directly to Dropbox or another cloud storage service, or open the Brasero Disc Burner application included with Ubuntu to burn them to disc.

Reset your Windows password

Ubuntu can also edit your Windows user account passwords, which is great if you've forgotten your Windows password. We tested this on a modern Windows 8.1 Update system and it worked perfectly. We'll be modifying the Administrator account here--after you unlock it and clear its password, you can log into Windows as Administrator and reset your other passwords.

Open a terminal by clicking the Ubuntu logo in the top-left corner of the launcher, typing Terminal, and pressing Enter. Run the following commands to install the password-changing utility you'll need. (If you've already run the first two commands, you don't need to run them again--just run the third one here.)

sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) universe"

sudo apt-get update

sudo apt-get install chntpw

Be sure to open the file manager from the launcher and click your Windows drive under Devices to view its contents if you haven't yet. This will "mount" the drive and make it available in the terminal.

Next, start typing the following command into the terminal, but do not press Enter:

cd /media/

Now, press the Tab key twice. You'll see an alphanumeric label that corresponds to your hard drive. Type the first few characters and press Tab again to automatically fill the label in. Now type /Windows/System32/config so you end up with a command that looks like the following, and then finally press Enter:

cd /media/9A72A08872A06AA9/Windows/System32/config

Run the following command and press Enter to start modifying the Administrator account. SAM is the name of the Windows system file containing the hashed user account passwords.

sudo chntpw SAM

If your Administrator account is locked--and it is by default--type 4 at the prompt and press Enter to unlock it. Type y at the confirmation prompt and press Enter to confirm.

You'll have to run the sudo chntpw SAM command again to get back into the program. Type 1 and press Enter at the prompt to clear the Administrator's password and make it blank. Type y at the prompt and press Enter to confirm again. Important: Do not use the change password option here, as it could cause problems.

You can now log into Windows with the username Administrator and a blank password. From there, you can open the Control Panel and reset other user account passwords. (Worried about other people doing this to your Windows system? Set a BIOS password to ensure they can't boot to removable media and mess around with it.)

Scan for malware

Rootkits are a nasty type of malware that burrow deep into Windows and start at boot-up, pulling strings in the background so they're invisible to antivirus programs and hidden even from the Windows Task Manager. Even if you have bog-standard malware, it's often easier to remove malware from outside Windows. Antivirus companies often make dedicated antivirus boot discs you can use to scan your system from outside Windows, but you can do this all from within Ubuntu.

We'll use ClamAV here because it's open source and easily installable on Ubuntu. It isn't the only option, though; you may also want to look at commercial antiviruses likeĀ AVG Free for Linux or BitDefender for Unices.

To install ClamAV, open the terminal and copy-paste or type each of the following commands into the terminal in order, pressing Enter after each. (Again, if you've already run the first two commands performing another task, you don't need to run them again--just start at the third.)

sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) universe"

sudo apt-get update

sudo apt-get install clamtk

Type y and press Enter to confirm the installation.

Next, run the following command to update your virus definitions:

sudo freshclam

You can now run the clamtk command in the terminal or open ClamTk from your list of installed applications. Be sure to click the Preferences button and enable the "Scan all files and directories in a directory" option after you do.

To actually scan your Windows drive for malware, click the Scan option on the menu at the top of ClamAV's screen and select Recursive Scan. Select your Windows drive in the sidebar and click OK. ClamTk should scan every file on your Windows drive with the ClamAV antivirus engine.

Give your hard drive a check-up

Ubuntu can also check for hardware-related issues.

The SMART hard drive status system allows a failing hard drive to warn you before it goes down in flames. To check a drive's SMART status from Ubuntu, click the Ubuntu logo icon at the top-left corner of your screen, search for "Disk Utility" and press Enter. Select your Windows drive and look next to SMART Status to see the drive's health status. You can click the SMART Data button to see more details and perform self-tests.

SMART isn't perfect. A drive may be failing and reporting that everything is fine even as it grinds to a halt. Another drive may report a serious problem and continue working fine for months. But, if you see a serious warning, you should get your files off the drive and replace it as soon as possible.

Test your RAM

Ubuntu comes with the popular memtest86+ memory-testing utility built-in. This utility will write data to your computer's RAM, read it back, and check if it's correct. If your RAM has a problem, memtest86+ will notice when the RAM returns different data. In normal computer use, these problems can lead to application crashes, file corruption, and even the dreaded blue screen of death.

This utility must be chosen at boot, so you'll have to restart your computer if you're already at the Ubuntu desktop. When Ubuntu starts booting, repeatedly press Escape and you'll see the normally hidden boot menu. Select the Test Memory option here to launch memtest86+.

Give memtest86+ some time alone with your computer after it begins. After a single successful batch of tests, known as a pass, you'll see the message "Pass complete, no errors, press Esc to exit." You can exit memtest86+ after the message appears or allow it to perform multiple passes. If you see an error, you likely need to replace one or more of the RAM sticks in your PC.

But wait, there's more!

Even though you're not installing it on your hard drive, that itty-bitty Ubuntu live drive is a full Linux system, so there's a lot you can do with it. Even if you boot it on a computer infected with a petri dish of Windows malware, it will be secure and isolated from any problems with the Windows software. PCWorld's Ubuntu guide for displaced Windows users has much more background information if you want to learn more about the operating system's ins and outs.