Blog Archive

Sunday, January 31, 2010

Automatic Login in linux

I think this should work for any Linux operating system using Gnome, I have tested on Debian and Ubuntu.

Well, automatic login will let you avoid to enter your login and password each time you turn on your PC, this could be insecure, but if your computer is physically secured it is Ok to enable this, that could make your booting more smooth.

How to do it?

On Gnome go to:

Systems->Administration->Login Window, you will be prompted for the administrator password, enter it and then select Security tab, once in there select Enable automatic login and select the user you want to be automatically logged in, each time you turn on your PC.

autologin_linux_ubuntu_debian_gnome

Thursday, January 28, 2010

reset root password MYSQL

 Resetting the Root Password of mysql on Windows Systems

Use the following procedure for resetting the password for any MySQL root accounts on Windows:

  1. Log on to your system as Administrator.

  2. Stop the MySQL server if it is running. For a server that is running as a Windows service, go to the Services manager:

    Start Menu -> Control Panel -> Administrative Tools -> Services

    Then find the MySQL service in the list, and stop it.

    If your server is not running as a service, you may need to use the Task Manager to force it to stop.

  3. Create a text file and place the following statements in it. Replace the password with the password that you want to use.

    UPDATE mysql.user SET Password=PASSWORD('MyNewPass') WHERE User='root';
    FLUSH PRIVILEGES;

    The UPDATE and FLUSH statements each must be written on a single line. The UPDATE statement resets the password for all existing root accounts, and the FLUSH statement tells the server to reload the grant tables into memory.

  4. Save the file. For this example, the file will be named C:\mysql-init.txt.

  5. Open a console window to get to the command prompt:

    Start Menu -> Run -> cmd
  6. Start the MySQL server with the special --init-file option:

    C:\> C:\mysql\bin\mysqld-nt --init-file=C:\mysql-init.txt

    If you installed MySQL to a location other than C:\mysql, adjust the command accordingly.

    The server executes the contents of the file named by the --init-file option at startup, changing each root account password.

    You can also add the --console option to the command if you want server output to appear in the console window rather than in a log file.

    If you installed MySQL using the MySQL Installation Wizard, you may need to specify a --defaults-file option:

    C:\> "C:\Program Files\MySQL\MySQL Server 5.0\bin\mysqld-nt.exe"
    --defaults-file="C:\Program Files\MySQL\MySQL Server 5.0\my.ini"
    --init-file=C:\mysql-init.txt

    The appropriate --defaults-file setting can be found using the Services Manager:

    Start Menu -> Control Panel -> Administrative Tools -> Services

    Find the MySQL service in the list, right-click on it, and choose the Properties option. The Path to executable field contains the --defaults-file setting.

  7. After the server has started successfully, delete C:\mysql-init.txt.

  8. Stop the MySQL server, then restart it in normal mode again. If you run the server as a service, start it from the Windows Services window. If you start the server manually, use whatever command you normally use.

You should now be able to connect to MySQL as root using the new password.

Resetting the Root Password on Unix Systems

MySQL Enterprise.  For expert advice on security-related issues, subscribe to the MySQL Enterprise Monitor. For more information, see http://www.mysql.com/products/enterprise/advisors.html.

Use the following procedure for resetting the password for any MySQL root accounts on Unix. The instructions assume that you will start the server so that it runs using the Unix login account that you normally use for running the server. For example, if you run the server using the mysql login account, you should log in as mysql before using the instructions. (Alternatively, you can log in as root, but in this case you must start mysqld with the --user=mysql option. If you start the server as root without using --user=mysql, the server may create root-owned files in the data directory, such as log files, and these may cause permission-related problems for future server startups. If that happens, you will need to either change the ownership of the files to mysql or remove them.)

  1. Log on to your system as the Unix mysql user that the mysqld server runs as.

  2. Locate the .pid file that contains the server's process ID. The exact location and name of this file depend on your distribution, host name, and configuration. Common locations are /var/lib/mysql/, /var/run/mysqld/, and /usr/local/mysql/data/. Generally, the file name has an extension of .pid and begins with either mysqld or your system's host name.

    You can stop the MySQL server by sending a normal kill (not kill -9) to the mysqld process, using the path name of the .pid file in the following command:

    shell> kill `cat /mysql-data-directory/host_name.pid`

    Note the use of backticks rather than forward quotes with the cat command; these cause the output of cat to be substituted into the kill command.

  3. Create a text file and place the following statements in it. Replace the password with the password that you want to use.

    UPDATE mysql.user SET Password=PASSWORD('MyNewPass') WHERE User='root';
    FLUSH PRIVILEGES;

    The UPDATE and FLUSH statements each must be written on a single line. The UPDATE statement resets the password for all existing root accounts, and the FLUSH statement tells the server to reload the grant tables into memory.

  4. Save the file. For this example, the file will be named /home/me/mysql-init. The file contains the password, so it should not be saved where it can be read by other users.

  5. Start the MySQL server with the special --init-file option:

    shell> mysqld_safe --init-file=/home/me/mysql-init &

    The server executes the contents of the file named by the --init-file option at startup, changing each root account password.

  6. After the server has started successfully, delete /home/me/mysql-init.

You should now be able to connect to MySQL as root using the new password.

Alternatively, on any platform, you can set the new password using the mysql client (but this approach is less secure):

  1. Stop mysqld and restart it with the --skip-grant-tables option.

  2. Connect to the mysqld server with this command:

    shell> mysql
  3. Issue the following statements in the mysql client. Replace the password with the password that you want to use.

    mysql> UPDATE mysql.user SET Password=PASSWORD('MyNewPass')
    -> WHERE User='root';
    mysql> FLUSH PRIVILEGES;

You should now be able to connect to MySQL as root using the new password.

install Linux / UNIX .tar.gz tarball files

How to install Linux / UNIX *.tar.gz tarball files

 tar.gz also known as tarball, an archive format for electronic data and software. Most Linux tarball contains a source code for software. If you are new to Linux I recommend using apt-get, rpm and yum command to install all binary packages.

Tarballs are a group of files in one file. Tarball files have the extension .tar.gz, .tgz or .tar.bz2. Most open source software use tarballs to distribute programs/source codes.

# 1: Uncompress tarball

To uncompress them, execute the following command(s) depending on the extension:
$ tar zxf file.tar.gz
$ tar zxf file.tgz
$ tar jxf file.tar.bz2
$ tar jxf file.tbz2

Now change directory
$ ls
$ cd path-to-software/

# 2: Build and install software

Generally you need to type 3 commands as follows for building and compiling software:
# ./configure
# make
# make install

Where,

  • ./configure will configure the software to ensure your system has the necessary functionality and libraries to successfully compile the package
  • make will compile all the source files into executable binaries.
  • Finally, make install will install the binaries and any supporting files into the appropriate locations.

Tuesday, January 26, 2010

Public_html webpage for each user in linux

Apache2: Activating User public_html Directories & Virtual Directories- Hosts- Domains under Ubuntu Linux for a Private LAN

Summary: Let the hacker beware

These pages describes how I activated the public_html user directories to be served up by the Apache web server and set up virtual directories, meaning fake domains. The audience is developers and home users who want to work on their websites at their desktop computers. I describe what has worked for me and some problems you might encounter using Ubuntu Linux 7.10 (Gutsy Gibbons) desktop software. I have no idea if this is applicable to the GUI-less server software. These are experiences I had using computers in my home. They may or may not work for you. I also don't know the distinctions between virtual hosts, virtual directories, and virtual domains.

Step 1: Installing Apache2 and php5

In a terminal (Applications...Accessories...Terminal), type everything after "$"

me@myhost$ sudo apt-get install apache2 php5

and press enter. Yeah, you need to be connected to the internet. You will be told you're getting some extra software packages with that order. Just say, "Yes, super-size me". The software php5 is not necessary, but at some point it will probably be useful to you if you are developing your own website. You can also use System...Admin...Synaptic Package Manager to install the software.

Test Step 1: When you install apache2 in Ubuntu linux, it is set to start automatically on each boot. You should be able to open a web browser and type in "http://localhost" and see the default apache directory. Click on the directory for the "It Works!" message. If you can't do this, don't proceed. One thing to check is that you have the IP 127.0.0.1 associated with "localhost" in the /etc/hosts file. You can also check this through the GUI System...Admin...Network...Hosts Tab.

Error - Gotcha if Any Reinstalls Done

Subtitled "Don't do what I have done". If you have a problem and decide to reinstall apache... just using "mark for reinstallation" or "reinstall" on the command line did NOT get me a fresh /etc/apache2 setup. I'm not sure which package all this stuff is in, but if you select all the titles with "apache2" in them and "completely remove", or "force remove", or "--purge", then you will be able to start anew again. Research "apt-get" for the right commands. Make sure you check the timestamp on the files in the /etc/apache2 directory when you THINK you have a new installation!

Step 2: Activating the User's public_html Directory with userdir

Background: Firstly, create a directory (folder) called "public_html" in your home directory, with your file browser, or:

me@myhost$ mkdir public_html

There are a couple of reasons to do this. When you have a web server shared by many people, like a shared-hosting ISP, it is necessary to give each user separate access to the "live" files. I have found that on a simple development machine, it is also easier to have your work all within your own home directory and not have to worry about permission and folders owned by the root user. What it gets you is the ability to access your websites in your home directory by a URL in the form http://localhost/~myhome. We can improve upon this with virtual directories, but first things first.

There are only two commands you need to enter to activate the User Directory feature, and then one command to reload the configuration files. The last command includes an absolute path, so it doesn't matter where you execute it from. The first two "ln" commands assume you are in the directory /etc/apache2/mods-enabled. What you need to do is create two symbolic links (soft links, symlinks) in the stated directory pointing to the corresponding module in /etc/apache2/mods-available (which is where they really live). So, if "$" is your prompt,

me@myhost$ cd /etc/apache2/mods-enabled
me@myhost$ sudo ln -s ../mods-available/userdir.conf userdir.conf
me@myhost$ sudo ln -s ../mods-available/userdir.load userdir.load
me@myhost$ sudo /etc/init.d/apache2 restart

On your home system, restarting apache will give you a warning "apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName" simply because you are at home and don't have a fully qualified domain name. No problemo.

Test Step 2: Open up a browser and type http://localhost/~myhome, where "myhome" is your username. For Debian and Ubuntu, your home directory is located within the "/home" directory. Apache should show the folders and files you have in your directory, or even display a web page if you have an "index.html" file in there. If you get sent to the internet or the default apache2 directory, something is wrong and you shouldn't go to the next step.

Step 3: Virtual Directories + Domains for PRIVATE LAN DEVELOPMENT SERVER

Background: There is a HUGE benefit to using virtual directories for the do-it-yourself website developer. You can create all of your development sites exactly the same as for your live web server. For example, if you have a site on a shared hosting environment that you do not have full control over, then the path "/" is the "top of the world" to your instance of the Apache sever. You cannot duplicate these paths using the "~user_name" address. Enter virtual directories, or fake little domains, for your desktop environment.

Part A - Networking: Okay, this is hardly networking so don't sweat it. There are no wires to get tangled, as everything happens within your own machine. The end result is that we need to modify the /etc/hosts file, which can be done through the administrative GUI, System...Administration...Network. Keep in mind there is always more than one way to achieve things. I am describing a method that uses a fixed IP for my server. You CAN do this even if your Linksys or other router is set to DHCP. It makes it much easier when you want to have other machines in your house access your server.

Note:Steps 1-4 below now have an expanded explanation on their own Linux Fixed IP Address page.

  1. Start the System...Admin...Network GUI and enter your password.
  2. Click on our Network connection in the "Connections" tab and then click the "Properties" button.
  3. Uncheck "roaming mode" and at "Configuration" choose "Static IP".
  4. You need to know what your network IPs are, but here are some typical examples. IP=192.168.1.xx (anything but 1), Subnet Mask=255.255.255.0, Gateway=192.168.1.1 (that is your Linksys or other router from your ISP).
  5. Click on the "Hosts" tab and click the "Add" button.
  6. Enter the 192.168.1.xx number in the IP box and ALL the virtual domains you want to use in the Aliases box (they should all point to the same server), separated by spaces. For example, I use "com" and "newcom" for my current site and a new version of my site.
  7. Click "Okay" and "Close". We are done with networking. Now we tell Apache what to do with the data.

Part B - Create Apache Virtual Directories: We will now be concerned with the directories in /etc/apache2 called "sites-available" and "sites-enabled" (you see a pattern here?). This is extremely easy to do if you know the trick that you really don't need most of the stuff in the "default" virtual directory file if you are just working in your home. The simplest thing is to just show you what I use. This will be a physical file in the "sites-available" section. Later we make links.

WARNING: Like I said at the top, these notes are for usage on a PRIVATE LAN, i.e., NOT the internet. Here you can read where someone sent me a apache virtual directories warning. If you try to use these notes on the internet, then you are an idiot and I cannot help you.

<VirtualHost *>

ServerName com

DocumentRoot /home/utree/public_html/com

</VirtualHost>

Dude! You cannot believe it is that easy if you ever looked at the "default" file in that directory. The pre-formatted code above is the content of a plain text file I can call anything I want, but will name it "com" so as to keep my sanity. "ServerName" is the name of the virtual directory, or "fake domain", that will allow you to enter "http://com" in your browser to see the site. The "DocumentRoot" is the absolute path to another file called "com" (not the one we just made, but a directory file). My username is "utree" because er, never mind why. Within utree's home directory, I have created a file called "public_html" where all my websites are. Each website has a directory within public_html, like "com", to keep all of the files for that website. I happen to keep the names consistent throughout, but that is not necessary. So the next file we create would be /etc/apache2/sites-available/newcom (you can use $sudo gedit to make it simple) and would look like this:

<VirtualHost *>

ServerName newcom

DocumentRoot /home/utree/public_html/newcom

</VirtualHost>

Follow this pattern for all of your virtual directories (fake domains).

Part C - Make Apache Virtual Directories Available: Luckily, there is really nothing new here. You follow an exactly analogous procedure to activate virtual directories that you did to activate User Directory modules. We create symbolic links within the directory /etc/apache2/sites-enabled to the sites in the "sites-available" directory.

me@myhost$ cd /etc/apache2/sites-enabled
me@myhost$ sudo ln -s ../sites-available/com com
me@myhost$ sudo ln -s ../sites-available/newcom newcom
me@myhost$ sudo /etc/init.d/apache2 restart

Test Step 3: Okay, by now I'm assuming you actually have some kind of a website you are working with and that the contents of it are within a directory, like "newcom", in your public_html folder. Open up a browser and try the address "http://newcom/" (I don't think you need the trailing slash). Apache should serve up the index.html file in that directory, or even the index.php file if you have PHP installed correctly. Note: If you don't see the file php5.conf in /etc/apache2/mods-enabled, then you don't have php installed correctly. Ready for extra credit?

Step 4: Configure a Client Machine for Virtual Directories

Case A - Linux: No problemo. We have done this already in Step 3, Part A, #5-7. I'm not going to paste the whole thing here. The objective is to modify /etc/hosts to relate the server's IP (you're glad it's fixed now, eh?) to ALL of the virtual domains you want to be able to use. The link goes to the GUI explanation, but it is as simple as adding a line to /etc/hosts in the form of "192.168.1.xx com newcom", where "xx" is the fixed IP of your web server (not your client) and "com newcom" are the virtual domains separated by spaces.

Case B - Windows: Not really that much harder, I just can't help you out as much. Currently, I have one Windows XP computer, but I'm not sure why I still have it, as I don't use it for anything any more. There are two files "hosts" and "lmhosts" kept in C:\windows\system32\drivers\etc. You set them up just like /etc/hosts under linux: one line for each IP and aliases, separated by spaces (e.g., 192.168.1.xx com newcom). The test I did seems to indicate you only need to set up the "hosts" files for web browser usage. I don't think it could hurt to keep them both up to date. Here are some notes on host files. I think I remember one time where only the Administrator could use the file, but this seems too silly to be true. It's worth a try if you have problems...


Step 5: Configuring PHP

Remarks: If you use the Debian or Ubuntu package managers, you are ready to go "out of the box" for just about everything. I'll list a couple of tweaks that might be applicable to a home server development environment. None of this is required if you only intend to use static HTML pages.

Setting the include_path: This is probably the most common thing you would want to do. I think the includes path is commented out of the original php.ini file. For a time I used an absolute path for this variable and it made the multiple websites NOT be completely the same as on-line. The simple trick is to use only relative paths and keep all of your includes in a directory of the same name on all of your sites. It is NOT the same physical directory, just the same name. "inc" seems to be a common standard. Here are the steps:

  1. Open a text editor as root ($sudo gedit) and open the file /etc/php5/apache2/php.ini.
  2. Go to the section "Paths and Directories", around line 476 in 2007-12.
  3. Copy the following:

    include_path=".:/inc:./inc:../inc:../../inc:../../../inc:../../../../inc"

  4. Optional: Or, if you are using shared resources, like PEAR:

    include_path=".:/inc:./inc:../inc:../../inc:../../../inc:../../../../inc:/usr/share/php"

  5. Create a blank line under the line that says "Unix", and paste in your include_path value. There should be only one without a semi-colon (comment) symbol.
  6. Here is the restart apache command again:

    $sudo /etc/init.d/apache2 restart

  7. If your site is "deeper" than I have the path set up for, then first rethink your site. Second, you can just extend the line with another colon and a ../../../../../inc entry.
  8. Note for shared Web Hosting: If you use a shared server,  I haven't found a work around. I put a php.ini file in each directory containing that one line from #3:

Enable PHP for .html Files: You might have migrated an existing .html page to PHP and want it processed by the PHP interpreter. I use a generic extension of ".file" for everything that is not an index page so that it is totally generic and I can change technologies in the future without changing the file name. To set it up:

  1. Open a text editor as root ($sudo gedit) and open the file /etc/apache2/mods-available/php5.conf
  2. Add the extensions you want to the line that starts off "AddType application/x-httpd-php" (e.g., .php .html .htm .file) separated by spaces.

    AddType application/x-httpd-php .php .html .htm .file

  3. ORYou may need to use this wording now. I don't know why it may have changed.

    AddHandler application/x-httpd-php .php .html .htm .file

  4. Here is the restart apache command again:

    $sudo /etc/init.d/apache2 restart

Seeing PHP As Text & The "phtml" Error: Okay, let me put on my Captain Obvious hat and say, "You don't have PHP configured correctly". I can think of 2 or 3 things to do for apache2 and php5:

  • Make sure you that the file /etc/apache2/mods-available/php5.conf exists. If not, you don't have a chance.
  • See the note on the first page about reinstalling apache and php.
  • If you make changes, it can't hurt to restart the server (you know, $sudo /etc/init.d/apache2 restart). You can also go to System...Administration... Services and (un)check the Web Server box.

Epilogue: Good Luck, I hope some of this is useful, but remember it may not work for you. Always make backups of files you are changing. I collected all this information after making lots of mistakes over a few years. Thanks to the Free Software community for posting all the information in various places. I can't say what information came from where. Recycle, rinse, repeat.

E-mail Alert on Root SSH Login

Want to be notified instantly when someone logs into your server as root? No problem, check out this nice tutorial on email notification for root logins. Keeping track of who logs into your server and when is very important, especially when you're dealing with the super user account. We recommend that you use an email address not hosted on the server your sending the alert from.

So lets get started!

1. Login to your server and su to root, I know the irony!

2. cd /root

3. pico .bashrc

4. Scroll to the end of the file then add the following:
echo 'ALERT - Root Shell Access (YourserverName) on:' `date` `who` | mail -s "Alert: Root Access from `who | cut -d'(' -f2 | cut -d')' -f1`" you@yourdomain.com

Replace YourServerName with the handle for your actual server
Replace you@yourdomain.com with your actual email address

5. Crtl + X then Y

Now logout of SSH, close the connection and log back in! You should receive an email address of the root login alert a few minutes afterwards.

Make pendrive bootable compatible NTLDR or BOOTMGR

1. Connect your USB Flash Drive to your computer Format USB drive

2. To Format USB Flash Drive Go to My Computer -> Right click on USB drive and select Format from context menu.

Format USB Drive

3. Now go to Start Menu->run->cmd (Open Command Prompt) and Type following command

convert i: /fs:ntfs (Where "I" is your USB drive latter)

Convert USB Flash Drive FAT32 to NTFS

4. Type Start->run->cmd

Now dir to directory where you have extracted MBRWiz and run following commands

mbrwiz /list (note down disk number of your USB Pen drive)

mbrwiz /disk=X /active=1 (X is Disk Number of your USB Drive)

exit

MBRWiz

5. Now open another command window and type following command

J: (Drive letter of Windows 7 iso mounted with demon tool)

CD boot

bootsect /nt60 Y: (Y is drive letter of your USB drive ) It makes compatible with BOOTMGR (vista/Win7)

bootsect /nt52 Y: (Y is drive letter of your USB drive ) It makes compatible with NTLDR (win 98/XP)

Update BOOTMGR for USB Pen Drive

Sunday, January 24, 2010

Internal Error 2908 dot net framework

Internal Error 2908 in dot net framework 1.1

Issue: .NET Framework 1.1 would not install.

I would get a message saying "Internal Error 2908″.

Internal Error 2908. {7D4B5591-4C80-42BB-B0E5-F2C0CEE02C1A}
Internal Error 2908. {9922FCCE-8CAF-4A22-AA39-DA835B6C608A}
Internal Error 2908. {67A0ABEE-0FA1-461F-A1FF-0C3E59C8FC6D}
Internal Error 2908. {FF766460-2F2B-4ADE-8E9B-781040797C80}
Error 1935.An error occurred during the installation of assembly

Fix:
I had .NET 1.1 installed before. Part of it remained on the system. I had to manually delete this file /rename this file:
C:\Windows\System32\mscoree.dll

Cause: .NET uses the MSCOREE.DLL file to see if .NET is already installed.


Thursday, January 21, 2010

Repair XP by recovery Console

Most of us have seen it at one time or another; perhaps on our own PC, the PC of a loved one, or perhaps a PC at your place of employment. The system spends weeks or months operating in a smooth fashion, taking you to the far reaches of the wide, wibbly web, and after one particularly late evening of browsing and gaming, you shut your PC off and go to bed. Millions of people across the globe do just this every night, but a few of us have turned our PCs on the next day not to the standard Windows XP loading screen, but instead this dreaded error:

Windows could not start because the following file is missing or corrupt:

\\WINDOWS\\SYSTEM32\\CONFIG\\SYSTEM

You can attempt to repair this file by starting Windows Setup
using the original Setup CD-ROM.

Select 'R' at the first screen to start repair.

Which renders your PC inaccessible from the standard boot procedures of Windows XP. You try safe mode, to no avail. You're particularly savvy and try issuing the FIXBOOT and FIXMBR commands in the Windows recovery console, but after each reboot, you're merely greeted with the same obnoxious and terrifying blue screen of death that's preventing you from accessing your precious data.

Perhaps you've also seen these error screens:

Windows NT could not start because the below file is missing or corrupt:

X:\\WINNT\\System32\\Ntoskrnl.exe
_________________

Windows NT could not start because the below file is missing or corrupt:

X:\\WINNT\\System32\\HAL.dll
_________________

NTLDR is Missing
Press any key to restart
_________________

Invalid boot.ini
Press any key to restart

Allow me to build tension by prefacing the end-all/be-all solution with my background: Having worked for the now-incorporated Geek Squad branch of Best Buy Corporation for the better part of eight months, I have seen dozens upon dozens of systems come through our department with any one of these errors, brought in by customers who are afraid they did something, have a virus, or are in jeopardy of losing their data. Prior to my discovery of an invaluable sequence of commands, our standard procedure was to hook the afflicted drive to an external enclosure, back up a customer's data and then restore the PC with the customer's restore discs or an identical copy of Windows with the customer's OEM license key. If the customer wasn't keen on the applicable charges for the data backup, we informed them of the potential risks for a Windows repair installation (Let's face it, they don't always work right), had them sign a waiver, and we did our best.

Neither of these procedures are cheap in the realm of commercial PC repair, nor do they inspire a tremendous level of confidence in the technician or the hopeful client.

In an effort to expedite our repair time and retain the sanity of myself and other technicians, I received permission to undertake a case study on a variety of PCs currently in service that exhibited any of the aforementioned symptoms, and I took it upon myself to find a better solution. After crawling through the MSKB, Experts Exchange, MSDN and sundry websites all extolling the virtues of a solution to these problems, I only found one that worked, and it has been reliably serving me for the better part of two weeks on seventeen PCs to date.

The process is simple: Get to the Windows Recovery Console for your particular Windows installation, navigate to the root letter of your installation (C: in most cases), issue eight commands, and reboot. The cornerstone of this process is a command called "BOOTCFG /Rebuild" which is a complete diagnostic of the operating system loaded into the recovery console; the purpose of the command is to remove/replace/repair any system files that were preventing the operating system from loading correctly. Amongst the files it fixes are:

  • Windows Hardware Abstraction Layer (HAL)
  • Corrupt registry hives (\\WINDOWS\\SYSTEM32\\CONFIG\\xxxxxx)
  • Invalid BOOT.INI files
  • A corrupt NTOSKRNL.EXE
  • A missing NT Loader (NTLDR)

The command process may apply to other types of blue screens or Hive/HAL/INI/EXE/DLL-related stop errors, but I have not had the luxury of computers in this type of disrepair. The process I am about to outline is virtually harmless, and if you feel you may be able to correct your PC's boot-time blue screens and stop errors with the sequence, feel free to try.

Let us now begin with a step-by-step instruction for correcting these issues.

Getting to the Windows Recovery Console

  1. Insert your Windows XP CD into your CD and assure that your CD-ROM drive is capable of booting the CD. Configuring your computer to boot from CD is outside of the scope of this document, but if you are having trouble, consult Google for assistance.
  2. Once you have booted from CD, do not select the option that states: "Press F2 to initiate the Automated System Recovery (ASR) tool." You're going to proceed until you see the following screen, at which point you will press the "R" key to enter the recovery console:
xp_src_welcome
  • After you have selected the appropriate option from step two, you will be prompted to select a valid Windows installation (Typically number "1″). Select the installation number, (As mentioned, "1″ in most cases), and hit enter. If there is an administrator password for the administrator account, enter it and hit enter. You will be greeted with this screen, which indicates a recovery console at the ready:
xp_src_console

  • There are eight commands you must enter in sequence to repair any of the issues I noted in the opening of this guide. I will introduce them here, and then show the results graphically in the next six steps. These commands are as follows:
    • C: CD ..
    • C: ATTRIB -H C:\\boot.ini
    • C:ATTRIB -S C:\\boot.ini
    • C:ATRIB -R C:\\boot.ini
    • C: del boot.ini
    • C: BOOTCFG /Rebuild
    • C: CHKDSK /R /F
    • C: FIXBOOT
  • To "Go up a directory" in computing is to revert back to the directory above the current folder you're operating in. If, for example, I'm in the C:WINDOWSSYSTEM32 directory, and I want to get at a file in the WINDOWS directory, I would merely type CD .. and I would be taken out of the SYSTEM32 folder and up one level to WINDOWS. We're going to do the same thing here from the WINDOWS folder to get to the basic root of C:
xp_src_recurse

Now that we are at C: we can begin the process of repairing the operating system
and that begins with modifying the attributes of the BOOT.INI file. Briefly, BOOT.INI controls what operating systems the Windows boot process can see, how to load them, and where they're located on your disk. We're going to make sure the file is no longer hidden from our prying eyes, remove the flag that sets it as an undeletable system file, and remove the flag that sets it as a file we can only read, but not write to. To do this, we will issue three commands in this step:

  • C:ATTRIB -H C:\\BOOT.INI
  • C:ATTRIB -R C:\\BOOT.INI
  • C:ATTRIB -S C:\\BOOT.INI

to remove the Hidden, System and Read Only flags.

xp_src_attributes

Now that we've modified the attributes for the BOOT.INI file, it's up for deletion. The syntax for it is simple: { DEL | FILE NAME }, e.g., C:DEL BOOT.INI deletes the BOOT.INI file.

xp_src_delete

Now for the most important step of our process, the BOOTCFG /REBUILD command which searches for pre-existing installations of Windows XP and rebuilds sundry essential components of the Windows operating system, recompiles the BOOT.INI file and corrects a litany of common Windows errors. It is very important that you do one or both of the following two things: First, every Windows XP owner must use /FASTDETECT as an OS Load Option when the rebuild process is finalizing. Secondly, if you are the owner of a CPU featuring Intel's XD or AMD's NX buffer overflow protection, you must also use /NOEXECUTE=OPTIN as an OS Load Option. I will demonstrate both commands for the purpose of this guide, but do not set NOEXECUTE as a load option if you do not own one of these CPUs. For the "Enter Load Identifier" portion of this command, you should enter the name of the operating system you have installed. If, for example, you are using Windows XP Home, you could type "Microsoft Windows XP Home Edition" for the identifier. This gives the process some authenticity, if you're keen on being a perfectionist.

xp_src_rebuild

This step verifies the integrity of the hard drive containing the Windows XP installation. While this step is not an essential function in our process, it's still good to be sure that the drive is physically capable of running windows, in that it contains no bad sectors or other corruptions that might be the culprit. No screenshot necessary here! Just type CHKDSK /R /F at the C:> prompt. Let it proceed; it could take in excess of 30 minutes on slower computers, when this is finished move on to the seventh and final step.

This last step also requires no screenshot. When you are at the C:> prompt,
simply type FIXBOOT. This writes a new boot sector to the hard drive and cleans up all the loose ends we created by rebuilding the BOOT.INI file and the system files. When the Windows Recovery Console asks you if you are "Sure you want to write a new bootsector to the partition C: ?" just hit "Y," then enter to confirm your decision.

Results and Wrap-Up

It's time to reboot your PC by typing EXIT in the Windows Recovery Console and confirming the command with a stroke of the enter key. With any luck, your PC will boot successfully into Windows XP as if your various DLL, Hive, EXE and NTLDR errors never existed. You've just saved yourself from many hours of work, frustration, potential data loss and shelling out your hard-earned greenbacks at a brick'n'mortar operation.



Wednesday, January 20, 2010

Install windows 7 from pen drive or usb drive

Here is a small and working tutorial to install windows 7 from a bootable USB or Pendrive. These days most of them have a USB or Pendrive. So why don't you try this trick. Earlier i have posted on How to Install vista from a Pendrive. Installing Windows 7 using a pendrive is very much faster than that from DVD/CD. You just need to follow some small steps to do this. You can keep this pendrive/USB drive for future installation of Windows 7. If you are a beginner or dont want to get messed up by typing in all commands, here is a Free Utility To Create A Bootable USB To Install Windows 7, Vista & Server 2008. This tool will help you to automate the process of bootable pendrive's and you can install windows 7 from pendrive easily. If not you can follow this guide to install windows 7 from a pendrive.

Win7Logo


Make sure you have a Pendrive or USB drive with a minimum of 4 GB space and you have the Windows 7 installation DVD. This tutorial is best suited if you have a Windows 7 DVD with you else you need to change it (This Steps are For windows Vista or higher For xp follow next steps)

  1. Format the Pendrive or USB drive in NTFS format first.
  2. From the start menu right click on the command prompt and select "Run as administrator".
  3. Now type the following commands (Press enter key after each command).
  4. diskpart. This is to open the disk partition program.
  5. Now to show the list of drives type list disk.
  6. You can see disk's listed there. Note down the disk number of your pendrive eg. Disk .
  7. Now type SELECT DISK X (where X is the number you noted down for the pendrive from step 5)
  8. Now type CLEAN.
  9. Now type the following commands by pressing enter after each one.
  10. CREATE PARTITION PRIMARY
  11. SELECT PARTITION 1 (Assuming your pendrive/ USB drive is 1).
  12. ACTIVE
  13. FORMAT FS=NTFS
  14. ASSIGN
  15. EXIT(Now the disk partition program will exit). Now we need to give some more commands.
  16. Now insert the Windows 7 Installation DVD and to your DVD drive.
  17. Here i am assuming DVD drive as G and Pendrive as I.(Change it accordingly).
  18. Now type G:CD BOOT
  19. Now type this command BOOTSECT.EXE/NT60 I: to update your USB drive with bootmgr code.
  20. Finally copy all the contents from the Windows 7 DVD to your Pendrive. Make sure you don't cause any errors.
  21. Plug / Insert your pendrive to your PC and restart the system.
  22. Now Enter the Bios system accordingly by pressing the key delete.(This may vary some times it will be F2 or F12. It depends on the type of your system. Any how during the start up your system will display which key to press to enter the Bios).
  23. Now select the USB/ Pendrive as the first boot driver.(Set the first boot priority to USB drive.).
  24. Now save the settings in Bios and restart and you will be able to Install Windows 7 using that pendrive.


For windows XP here's the Tip (it is exclusively available on this blog and verified by tendydon)


First of all you need two tools

1.MBRwiz.exe download here use appropriate version of your OS

2.boosect.exe it can be found inside "boot" folder of windows 7 disk


STEPS

  1. Connect your USB Flash Drive to your computer Format USB drive
  2. To Format USB Flash Drive Go to My Compter -> Right click on USB drive and select Format from context menu. By the way it is better to use HP USB Format tool
  3. Copy mbrwiz.exe, bootsect.exe to a folder in a drive. I have make a folder "usb" in c:\ and pasted there.
  4. Type Start->run->cmd
  5. type cd c:\usb (its the folder that you have mbrwiz.exe abd bootsect.exe)
  6. type mbrwiz /list (note down disk number of your USB Pen drive)
  7. type mbrwiz /disk=X /active=1 (X is Disk Number of your USB Drive)
  8. Above steps makes your pendrive bootable only.Now you need to activate it
  9. type bootsect /nt60 Y: (I assume your pendrive is Y:)
  10. The above step make pendrive Bootmgr compatible.If you are interested more about making other compatible follow me here
  11. Now copy all the files from windows 7 disk to your pendrive.
  12. Restart your computer Make your bios to bootable with pendrive or use MobaLive USB to test
  13. Hurray,no 13th step !! you have done,Go on and install windows7


For Noobs there is another tool

Although you can refer our how to install Windows 7 from USB guide to do the same, this tool simplifies the job. Here are the five simple steps that you need to follow to create a bootable USB flash drive to install Windows 7 from USB device:

Note: You need a USB flash drive with a minimum of 4 GB of free space. And also please backup your data from USB first.

1. Download Windows 7 USB/DVD Tool and install it.

2. Run the program, browse to your Windows 7 ISO image using the Browse button.

3. In this step, you need to select your media type. As we are here to create a bootable USB, simply click on USB device button.

4. Select your USB flash drive from the drop down box and click on Begin copying button.

5. The Windows 7 USB/DVD tool will take a few minutes to complete the procedure.

6. You are done. Reboot you machine and start installing Windows 7 .


Tuesday, January 19, 2010

gunzip a file in linux


Create a .tar.gz file from a folder:
tar czf /path/to/output/folder/filename.tar.gz /path/to/folder

Extract a .tar.gz file:
gunzip -c /path/to/folder/filename.tar.gz

View a list of all files in a .tar.gz archive:
gunzip -c /path/to/folder/filename.tar.gz | tar -tvf -

Extract a single file from a .tar.gz file:
gunzip -c /path/to/folder/filename.tar.gz | tar -xvf - path/within/archive/filename.php

Monday, January 18, 2010

Install xp through pendrive or usbdrive

Installing Windows XP on the Asus EEE pc or any other  using a single USB flash drive.


Please note this tutorial works on all computers not just the Asus EEE PC.
To complete this tutorial you need a 32bit version of Windows XP or Windows Vista installed on your home PC.

What you'll need:
PeToUSB.zip

USBprep.zip

BOOTsect.zip

Special Note: If you use the program Nlite be sure to keep the manual installation files as the USB_prep8 script relies on these files.

Extract the files in Bootsect.zip
The next step is to extract USB_prep8 and PeToUSB.
Next copy the PeToUSB executable into the USB_prep8 folder.
Inside of the USB_prep8 folder double click the executable named usb_prep8.cmd.

The window that opens will look like this:



Press any key to continue

You next window will look like this:
These settings are preconfigured for you all you need to do now is click start.
Once the format is complete DO NOT close the window just leave everything as it is and open a command prompt from your start menu (type cmd in the search bar or run box depending on your version of windows.).

Inside of the command windows go to the directory you have bootsect.exe saved.
(use the cd directoryname command to switch folders)

Now type "bootsect.exe /nt52 R:" NOTE R: is the drive letter for my USB stick if yours is different you need to change it accordingly. What this part does is write the correct boot sector to your USB stick, this allows your PC to boot from the USB stick without it nothing works.
Please note: When running the bootsect.exe command you cannot have any windows open displaying the content of your USB stick, if you have a window open bootsect.exe will be unable to lock the drive and write the bootsector correctly.

If all went well you should see "Bootcode was successfully updated on all targeted volumes."

Now you can close this command prompt (don't close the usbprep8 one by mistake) and the petousb window.

You window you see now should look like this:

If it doesn't try pressing enter.

Now you need to enter the correct information for numbers 1-3.
Press 1 and then enter. A folder browse window will open for you to browse to the location of you XP setup files (aka your cdrom drive with xp cd in)
Press 2 and enter a letter not currently assigned to a drive on your PC
Press 3 and enter the drive letter of your USB stick
Press 4 to start the process.

The script will ask you if its ok to format drive T:. This is just a temp drive the program creates to cache the windows installation files. Press Y then enter.

Once it's done formating press enter to continue again, you can now see the program copying files to the temp drive it created. Once this is done press enter to continue again.

Next you will see a box pop up asking you to copy the files to USB drive yes/no you want to click yes.

Once the script has completed copy files a popup window asking if you would like to USB drive to be preferred boot drive U: select YES on this window.

Now select yes to unmount the virtual drive.

Ok we are done the hard part, close the usbprep8 window.

Now make sure your EEE pc is configured with USB as the primary boot device.
Insert your USB drive and boot up the EEE.

On the startup menu you have two options, select option number 2 for text mode setup.

From this point on it is just like any other windows XP installation delete/recreate the primary partition on your EEE pc and format it using NTFS. Make sure you delete ALL partitions and recreate a single partition or you will get the hal.dll error message.

Once the text mode portion of setup is complete it will boot into the GUI mode (you can press enter after the reboot if your too excited to wait the 30 seconds)

Once the GUI portion of setup is complete you will again have to boot into GUI mode this will complete the XP installation and you will end up at you XP desktop. It is very important that you DO NOT REMOVE THE USB STICK before this point. Once you can see your start menu it is safe to remove the usb stick and reboot your pc to make sure everything worked.

This method has advantages over all current no cdrom methods of installing XP to the EEE. You do not have to copy setup files in DOS to the SSD and install from there. It gives you access to the recovery console by booting into text mode setup, and it gives you the ability to run repair installations of XP if you have problems later on.

Friday, January 15, 2010

Google OS in windows

The following tutorial enables the average computer user to run gOS Linux from within Windows without rebooting. gOS can be run from a folder on your Windows PC or from a folder on your USB flash drive or other portable device. Keep in mind that there is currently no persistence feature being utilized in this tutorial. The installation acts just like the Live CD and the gOS operating system is being emulated using Qemu, a virtual machine emulation software. Qemu emulation makes for a great and easy way to test out a Linux distro without modifying the host computers hardware.

gOS Default Desktop Screenshot

gOS running from Windows using Qemu

Distribution Home Page: thinkgos.com

Quemu Home Page: Qemu.org

Minimum Flash Drive Capacity: 1GB

Persistent Feature: No

Basic essentials for running a Qemu emulated gOS:

  • Windows host PC (Vista or XP)
  • QgOS.exe
  • gOS ISO
  • Optional (1GB+ USB flash drive)

How to run gOS from Windows without rebooting:

  1. Download and launch QgOS.exe, a QgOS folder is created
  2. Download the gOS ISO and place the ISO in your QgOS folder
  3. Click the QgOS.bat file to start the gOS operating system

Qemu commands to use while running gOS:

Click anywhere within the Qemu Window to use gOs

Press Ctrl+Alt to switch to and from the Host desktop

Press Ctrl+Alt+F to toggle full screen on or off

Press Ctrl+Alt+2 to switch to the Qemu Monitor (and type help for command list)

Press Ctrl+Alt+1 to switch from Qemu Monitor back to Linux

Adding Recovery console in boot menu

If you like to mess with your Windows XP installation, try different things and occasionally crashed your system, you have probably had to use the Recovery Console. However in order to use the Recovery Console you have to insert Windows XP setup disk, wait until all the drivers are loaded and the setup process begins, before you can go into the Recovery Console.

You can make your life easier by installing the Recovery Console directly on your hard drive, so it will be available to you even without the setup disk.

In order to install the Recovery Console on your hard drive follow these simple steps:

  • Insert your Windows XP setup disk.
  • Go to Start->Run and Type [CDRom_Drive_letter]:\ i386\winnt32.exe /cmdcons and click OK

This will start the setup program for the Recovery Console. After the setup has complete you'll have another boot option on your system, that will take you directly to the recovery console

Friday, January 8, 2010

Test Usb boot without restarting Computer

Test bootable USB drive without restarting your computer

Just like how you can boot a computer using a bootable CD,you can also boot a computer using a bootable USB drive.Bootable USB drive works exactly like a bootable CD.You can load the live Desktop,install the distro on your computer etc.The loading of the live desktop and the installation of a distro is much faster when a bootable USB Drive is used instead of a bootable CD.

Configuring and Tweaking a bootable USB drive is much easier than modifying a bootable ISO or a bootable CD.

Creating a Bootable USB drive.

Each and every USB drive can be easily made bootable.The bootablity of the USB drive depends solely on the motherboard and the boot order of the target computer.
Unetbootin is a free tool which can be used to create bootable USB drives of popular Linux based distros like Ubuntu from the bootable iso image file.Most bootable software like BartPE, have an option to create a bootable USB drive.Pendrivelinux.com has detailed guides and tutorials on creating bootable USB drives of Linux Distros.
So creating a bootable USB drive is not very hard.

Booting a Virtual Machine from a Physical USB Drive?


But Virtualbox,VmWare and Microsoft Virtual PC do not directly support booting a Virtual machine from a Physical USB Drive.
Only Qemu supports booting from a Physical USB Drive.

UPDATE:You can now Boot your USB Drive in VirtualBox:Read it here

MobaLiveUSB

The developers of MobaLiveCD have created an extremely useful and simple tool to test a bootable USB drive within Windows without restarting your computer.
It uses the Qemu engine to boot a Virtual Machine from a Physical Drive.This tool is also useful for people whose motherboards do not support booting from your USB drive.
All you have to do is
1. Download MobaLiveUSB from here: http://mobalivecd.mobatek.net/MobaLiveUSB_0.1.exe

2. Copy the EXE file to somewhere in your USB flash drive

3. Run MobaLiveUSB from your USB flash drive.

Thats it.Your USB drive will now boot in a Qemu Virtual Machine.

This screenshot shows the contents of a bootable Ubuntu USB Drive created using Unetbootin.

Note:MobaLiveUSB is still in testing phase.It has not yet been officialy released to the Public.You can follow its development here http://www.911cd.net/forums/lofiversion/index.php/t22273.html


Read more: http://agnipulse.com/2009/07/test-bootable-usb-drive-without-restarting-your-computer/#ixzz0c1EHWZKF

usb boot in virtual box

Boot your USB Drive in VirtualBox

source

The GUI of VirtualBox does not have an option to boot a USB drive (Physical Drive) in a virtual machine.

However you can attach a physical drive to a virtual machine using a command line tool that is bundled with Virtual Box.You can then boot your virtual machine from the attached Physical drive.


In this article I will show you how you can boot a bootable usb drive in Virtual Machine created by VirtualBox.You can easily test bootable USB drives within Windows and without restarting using this method.

Warning:Do not Attach your Primary hard disk to your Virtual Machine and Boot it in the Virtual machine

Download and install Virtual Box from here http://www.virtualbox.org/wiki/Downloads

Attaching a Physical Disk to a Virtual Machine

Section 9.10 in the VirtualBox manual contains all the details required to attach a physical disk to a virtual machine.Using the vboxmanage.exe tool you can create a tiny vmdk file which points to your real USB drive (Physical Drive/Disk).You can attach this tiny vmdk to your virtual machine.A vmdk file is a virtual hard disk file which can be used with VirtualBox and VMWare.

The vboxmanage.exe tool is bundled with VirtualBox.You don't have to download it separately

Open Command Prompt

Navigate to your Virtual Box installation Directory.

cd c:\"Program Files"\Sun\"xVM VirtualBox"

Type the following command and press enter
Syntax of the command
VBoxManage internalcommands createrawvmdk -filename path\to\usb.vmdk -rawdisk \\.\PhysicalDrive1 -register
Example
VBoxManage internalcommands createrawvmdk -filename c:\Users\Agni\.VirtualBox\VDI\usb.vmdk -rawdisk \\.\PhysicalDrive1 -register

You have to replace path\to\usb.vmdk with the path to your VDI folder(Where all your virtual hard disks are stored).If you want to save your usb.vmdk in different location,then you will have to add the usb.vmdk file manually in the GUI.This is because the register switch only registers the virtual hard disks stored in the User 's VDI folder .

In windows your 1st Hard Disk will be \\.\PhysicalDrive0.Your 2nd Hard disk will be \\.\PhysicalDrive1.

To find the correct number for your USB Drive

Right Click on My Computer-Manage-Disk Management

Here you can find the correct disk number of your USB Drive

Drive Number of the Physical Drive

Drive Number of the Physical Drive

You will have to replace \\.\PhysicalDrive1 with the correct drive number.

In this case there was only 1 hard disk and 1 USB disk.So the USB drive is referred by \\.\PhysicalDrive1

In linux you have to replace \\.\PhysicalDrive1 with the correct /dev/sda reference.

Now you should have a tiny vmdk file.You can start your Virtual Machine with this tiny vmdk and boot from it.

  1. Start VirtualBox.
  2. Create a new Machine or Select an Existing Machine.
  3. Settings-Hard Disk-Add-Select usb.vmdk
  4. Make sure that usb.vmdk is your Primary Master.


  5. System-Boot Order.Set your Hard Disk as the first boot device.

    Boot Order

  6. Now start your Virtual Machine.

Your virtual machine will boot from your bootable physical hard disk.


Followers