Recovering from lost root password in OpenBSD

Want to recover a lost root password in OpenBSD, type boot -s at the boot prompt in OpenBSD hit enter when prompted for shell and enter vt220 as the TERM.

boot> boot -s
Enter pathname of shell or RETURN for sh:
Enter Terminal: vt220

Next run an fsck on the root filesystem and mount it read-write. If you have a seperate /usr filesystem then you should also mount it read-write. Finally run the passwd command to change the password.

# fsck /
# mount -uw /
# passwd
Posted in FLOSS | Tagged , | Leave a comment

Creating and Using MS DOS Virtual Machine in QEMU

Create a disk image of desired size. I chose 50 MB

$ dd if=/dev/zero of=msdos622.img bs=1k count=0 seek=50000

Next boot from the DOS boot media. I had a bootable CD image.

$ qemu -hda msdos622.img -cdrom DOS6.22_bootdisk.iso -boot d

From the DOS prompt, create a partition on drive C using fdisk

A:\> fdisk

After the partition is created the machine will be rebooted. Once you get the DOS prompt back format the drive C and make it bootable:

A:\> format c: /s

The /s option of format command transfers the system to the drive.

Next create a directory DOS in C:\ and copy all the utilities into it:

A:\> mkdir c:\dos
A:\> copy *.* c:\dos

DOS is ready to be used. Now in order to transfer your old games and programs, you need to mount it as loopback device in linux. There is one problem with this. Since the image file has a partition table in it, when I tried to mount it, I got the following errors:

$ sudo mount msdos622.img /mnt -o loop -t msdos
mount: wrong fs type, bad option, bad superblock on /dev/loop0,
       missing codepage or helper program, or other error
       In some cases useful info is found in syslog - try
       dmesg | tail  or so

To work this around we need to calculate the offset size of the partition using the fidisk -ul command:

$ fdisk -ul msdos622.img
You must set cylinders.
You can do this from the extra functions menu.

Disk msdos622.img: 0 MB, 0 bytes
16 heads, 63 sectors/track, 0 cylinders, total 0 sectors
Units = sectors of 1 * 512 = 512 bytes
Disk identifier: 0x00000000

       Device Boot      Start         End      Blocks   Id  System
msdos622.img1   *          63       98783       49360+   6  FAT16

To calculate the offset we need to multiply the starting block (63 in our case) by 512. If the image has multiple partitions then the same approach can be used and each partition can be individually mounted on a separate mount point.

$ sudo mount -o loop,offset=32256 msdos622.img /mnt
$ ls /mnt
command.com  dos  drvspace.bin    io.sys    msdos.sys

Now you can copy your old dos games and other files to /mnt.

Posted in FLOSS | Tagged , , | Leave a comment

Creating and Using MS DOS Virtual Machine in QEMU

Being an old DOS user, sometimes there is an urge to go back to college days and recall how we used to do various things in DOS. Using dbase III, in a DOS environment reminds me of some of the great times I used to had in college as a student and later when I started my carrier as a Trainer.

Today’s Virtualization technology had made it possible to run a DOS environment. Read on to find out how did I manage to set-up a MS-DOS VM using QEMU. Oh by the way I damaged my copy of WordStart 4 and Lotus 123 for DOS, if you happen to have one and don’t mind sharing please upload it to a public place and send me a link.

Create a disk image of desired size. I chose 50 MB

$ dd if=/dev/zero of=msdos622.img bs=1k count=0 seek=50000

Next boot from the DOS boot media. I had a bootable CD image.

$ qemu -hda msdos622.img -cdrom DOS6.22_bootdisk.iso -boot d

From the DOS prompt, create a partition on drive C using fdisk

A:\> fdisk

After the partition is created the machine will be rebooted. Once you get the DOS prompt back format the drive C and make it bootable:

A:\> format c: /s

The /s option of format command transfers the system to the drive.

Next create a directory DOS in C:\ and copy all the utilities into it:

A:\> mkdir c:\dos
A:\> copy *.* c:\dos

DOS is ready to be used. Now in order to transfer your old games and programs, you need to mount it as loopback device in linux. There is one problem with this. Since the image file has a partition table in it, when I tried to mount it, I got the following errors:

$ sudo mount msdos622.img /mnt -o loop -t msdos
  mount: wrong fs type, bad option, bad superblock on /dev/loop0,
  missing codepage or helper program, or other error
  In some cases useful info is found in syslog - try
  dmesg | tail  or so

To work this around we need to calculate the offset size of the partition using the fidisk -ul command:

$ fdisk -ul msdos622.img
You must set cylinders.
You can do this from the extra functions menu.

Disk msdos622.img: 0 MB, 0 bytes
16 heads, 63 sectors/track, 0 cylinders, total 0 sectors
Units = sectors of 1 * 512 = 512 bytes
Disk identifier: 0x00000000

Device Boot      Start         End      Blocks   Id  System
msdos622.img1   *          63       98783       49360+   6  FAT16

To calculate the offset we need to multiply the starting block (63 in our case) by 512. If the image has multiple partitions then the same approach can be used and each partition can be individually mounted on a seperate mount point.

$ sudo mount -o loop,offset=32256 msdos622.img /mnt
$ ls /mnt
command.com dos  drvspace.bin    io.sys    msdos.sys

Now you can copy your old dos games and other files to /mnt.

Posted in FLOSS | Tagged , , | Leave a comment

Changing the Hostname of a Solaris System

On Solaris 10 the value in the /etc/nodename file is sufficient for setting the hostname of the system.
The hostname of a solaris system needs a change in the following files. So replace the old hostname with the new one in these file. Do not try to comment out as this may lead to some boot time errors.

  • /etc/nodename
  • /etc/hosts
  • /etc/hostname.*
  • /etc/net/*/hosts
  • /etc/inet/ipnodes (Solaris 10 or later)

In order to change the hostname and nodename for the current session run:

uname -S new_hostname

Next change the savecore-dir (Solaris 7 or later)

dumpadm -s /var/crash/`uname -n`

Finally restart the syslog service to log messages using the new hostname.

Courtsey – http://www.princeton.edu/~unix/Solaris/troubleshoot/hostname-change.html

Posted in Solaris/AIX/HP-UX | Tagged | Leave a comment

Solaris10 on VirtualBox

I installed Solaris10 11/06 on VirtualBox 1.5.6 OSE. The first problem immediately after installation I faced was that of mouse not being captured by virtual machine. So I open a terminal window and start the vold and then ran the volcheck command.

/etc/init.d/volmgt start
volcheck

The mouse started working after this. The reason for this I guess is because I did not had the mouse inside the virtual machine while booting. I need to confirm this.

Moving the home directory of root from / to /root:

Changing the home directory of root using “usermod” command does not work as the root user is logged in. So edit the /etc/passwd file and change root’s home directory to /root. Logout and login again. After that remove all the /.* files and /Desktop directory.

vi /etc/passwd
rm -rf /.*pwd
rm -rf /Desktop

Installing third-party tools

Next I need to install third party tools in the virtual machine. I downloaded the “pkg-get” as:

pkgadd -d http://www.blastwave.org/pkg_get-3.8.4-SunOS5.8-all-CSW.pkg

Next I downloaded the static version of the wget utility using mozilla from http://www.blastwave.org/wget-i386.bin and renamed it as wget.
Next I put the directory containing the wget utility and the /opt/csw/bin directory in default PATH. The first thing installed was wget itself, so that I can get rid of the static version.

pkg-get install wget

Patch check advanced is a utility which I installed next to apply patches to the operating system.

pkg-get install pca

The gnupg program was needed to verify the signatures on the catalogue files. This can be installed as:

pkg-get install gnupg

To install the gpg key of the blastwave repository use the following commands:

wget --output-document=/tmp/gpg.key http://www.blastwave.org/mirrors.php
gpg --import /tmp/gpg.key
Posted in Solaris/AIX/HP-UX | Tagged , , | Leave a comment