What do I do if my Linux Server / Workstation does not boot?

Posted on in Categories , , , , , , last updated January 8, 2008

Q. I’m using Debian Linux and CentOS operating system. My question is what do I do if my server refused to boot? How do I troubleshoot the problem?

A. Usually most Linux distribution provides rescue mode. It allows to access to disk partition and you are allowed to solve the problem.

To use the rescue mode of the install CD, follow these steps:
a) Boot from 1st CD / DVD media

b) Enter rescue at the prompt. (use ‘dd rescue‘ if you need to load the SCSI driver)

c) You will get at a shell prompt. Now you can reinstall boot loader or check disk for errors and so on.

Please note that Linux distributions such as Mandriva or Ubuntu Linux offers menu based troubleshooting options. See our previous articles for detailed instructions:

OpenBSD set up default boot time by modifying boot.conf file

Posted on in Categories last updated September 19, 2007

Q. I’m using OpenBSD as VPS os (guest os) under VMWARE server. However OpenBSD pauses for a few seconds to give me a chance to provide parameters to the kernel at boot> prompt. I’d like to force boot loader to wait for 30 seconds instead of default timeout. How do I setup bootloader timeout?

A. OpenBSD uses boot program. The main purpose of this program is to load the system kernel while dealing with the downfalls of the PC BIOS architecture. This program acts as an enhanced boot monitor for PC systems, pro viding a common interface for the kernel to start from. By default, boot attempts to load the kernel executable /bsd. If it fails to find the kernel and no alternative kernel image has been specified, the system will be unable to boot.

/etc/boot.conf file and timeout parameter

/etc/boot.conf is configuration file for bootloader. Open file using text editor:
$ sudo vi /etc/boot.conf
Append / modify timeout parameter as follows:
set timeout 30
Save and close the file. Above line set the 30 second pause at boot-time.

How to uninstall GRUB

Posted on in Categories , , last updated December 7, 2007

Q. How do I uninstall GRUB? I need to uninstall everything before sending this hard disk to someone including GRUB. All I need to keep is windows XP.

A. GNU GRUB (“GRUB” for short) is a boot loader package from the GNU Project. GRUB is the reference implementation of the Multiboot Specification, which allows a user to have several different operating systems on their computer at once, and to choose which one to run when the computer starts.

You can overwrite MBR with standard dd command. You can also use old good MS-DOS fdisk command to overwrite MBR.

Using MS-DOS/Windows 9x boot disk

In order to remove the GRUB bootloader from a Linux and Windows XP machine, boot with a Windows 9x startup disk or CD and execute the MS-DOS command:
fdisk /mbr

Using Windows XP boot disk

Boot computer using Windows XP (Windows 2000) setup disc / CD / DVD. Next, type the following commands:
# fixmbr
# exit

Using Linux

You can also use dd command from Linux itself (it removes partition table):
# dd if=/dev/null of=/dev/sdX bs=512 count=1

Just remove MBR, without the partition table (see comment below):
# dd if=/dev/null of=/dev/sdX bs=446 count=1

Replace /dev/hdX with your actual device name such as /dev/hda. Use fdisk -l command to find out device name:
# fdisk -lOutput:

Disk /dev/sda: 251.0 GB, 251000193024 bytes
255 heads, 63 sectors/track, 30515 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14       30384   243955057+  83  Linux
/dev/sda3           30385       30515     1052257+  82  Linux swap

Linux reset forgotten root password

Posted on in Categories , , , , last updated September 19, 2007

Q. I forgot my root password, how can I get into my system?

A. You can reset forgotten root password under Linux by booting system into single user mode or emergency mode (also known as rescue mode).

My boot loader is GRUB (see LILO boot loader below)

)Following is the procedure to reset root password if you are using GRUB as a boot loader:

  1. Select the kernel
  2. Press the e key to edit the entry
  3. Select second line (the line starting with the word kernel)
  4. Press the e key to edit kernel entry so that you can append single user mode
  5. Append the letter S (or word Single) to the end of the (kernel) line
  6. Press ENTER key
  7. Now press the b key to boot the Linux kernel into single user mode
  8. At prompt type passwd command to reset password:

You need to mount at least / and other partitions:
# mount -t proc proc /proc
# mount -o remount,rw /

Change the root password, enter:
# passwd
Finally reboot system:
# sync
# reboot

My boot loader is LILO

At LILO boot loader type linux single and press [ENTER] key:
Boot: linux single
When you get the # prompt you will need to type passwd root to reset password:
# passwd
Reboot system:
# sync
# reboot

See also: