Wednesday, May 29, 2013

5.3 amd64 X200: Upgrading OpenBSD using USB Flashdrive.

Hey,

This is related to Creating USB Flashdrive installer. I posted previously. I have another OpenBSD machine in my office, not that the company requires it but as it's my machine, I installed whatever I want. The machine is still on 5.2, so this is a good chance to test my shiny USB Flashdrive installer.

If your machine is just like mine, which support USB Booting, I just boot from USB Flashdrive. Bolded is my input.

Welcome to the OpenBSD/amd64 5.3 installation program.
(I)nstall, (U)pgrade or (S)hell?
u

Available disks are: sd0 sd1.
Which disk is the root disk? ('?' for details) [sd0]
?
sd0: ST9160823AS (149.1G)
sd1: DataTraveler 2.0 (1.9G)


As you can see it asked for the root disk. Which is the disk I want to upgrade. I choose ? to check which device is for my primary disk and which is for the USB Flashdrive. As you can see, sd1 is my Kingston DataTraveler USB Flashdrive. So then I just press ENTER for the default choice [sd0] for the root disk.

Let's upgrade the sets!
Location of sets? (cd disk ftp http or 'done') [cd]
disk

Remember the sets are in the USB Flashdrive so I need to set the location correctly. So I choose disk.

Is the disk partition already mounted? [no] ENTER
Available disks are: sd0 sd1.
Which one contains the upgrade media? (or 'done') [sd1]
ENTER
  a:        1228768             64        4.2BSD    2048    16384    1
  i:        2658867        1228863        MSDOS
Available sd1 partitions are: a i.
Which one has the upgrade sets? (or 'done') [a]
Enter
Pathname to the sets? (or 'done') [5.3/amd64] 5.3

The sd1 is not mounted, so I need to answer accordingly. I then choose sd1 and then the a partition (remember sd1a is for OpenBSD, sd1i is for MSDOS). My 5.3 sets is in sd1a/5.3/ so I just input the directory name 5.3.

Select sets by entering a set name, a file name pattern or 'all'. De-select sets by prepending a '-' to the set name, file name pattern or 'all'. Selected sets are labelled '[X]'.

Now I can see the list of sets I have in the 5.3 directory. Continue to upgrade as usual. After it's upgraded, I rebooted the machine to change the timezone, then mount the USB Flashdrive again to do sysmerge. The usual stuff.

Installation via USB Flashdrive is FAST! Later.

Wednesday, May 22, 2013

5.3 AMD64 X200: Upgrading, the OpenBSD way.

Hi,

Remember 5.1 AMD64: Following -current & Radeon 6.14.3 installation?. Well, I have an apology to make.

The correct way to upgrade is:

1) Copy bsd* and *tgz files for upgrade.
2) Copy the bsd.rd to / .
3) Reboot, then boot> boot bsd.rd . Proceed with upgrade.
4) sysmerge.
5) Upgrade packages.

As you can see, sysmerge should be after upgrading, not before as I've posted previously. Sorry bout that. Yes I used my method from 5.0 until 5.3 without any issue but it's not the official way. It might break the upgrade process.

So, from now on, I will follow the official way.

Friday, May 17, 2013

5.3 AMD64 X200: Creating USB Flashdrive installer.

Heyya,

I've been thinking about some sort of installation method without using CDs. As OpenBSD release new version every 6 month, burning CDs for new ISO is just wasting CD. Currently I still hang on with my 5.0 installation CD and have all the installation files of 5.1 to 5.3 in an external drive. So, if my X200 went crazy, I need to install 5.0 then upgrade all the way to 5.3.

I thought of creating another partition in my X200, just to hold installation files. It will be something like an OS Recovery partition. It's a nice idea to play with, but then Recovery Partition is useless if my hard disk have hardware issue.

So I thought of using a thumbdrive as OpenBSD installation media. Good thing is, I can just update the OpenBSD version on the thumbdrive when new version is released.

I have a Kingston DataTraveler 2.0 USB thumbdrive, 2Gb capacity. 2Gb for OpenBSD installation media is too much, so I think of creating 2 partition on it, 600Mb for OpenBSD installer + all the installation files and the rest for normal thumbdrive usage (FAT32 filesystem).

After searching for relevant informations, this is how I did it. First, I need to clear the thumbdrive. The thumbdrive I want to use is identified as sd1 so yours might be different. Do take note as you don't want to wipe the wrong drive. So I booted my X200 into 5.3, then get to the console. I plugged in my thumbdrive and proceed with this command (bold is my input):

$ sudo fdisk -iy sd1
Writing MBR at offset 0.


Then I proceed to edit the thumbdrive's slice (partition) using fdisk.

$ sudo fdisk -e sd1
Enter 'help' for information


You can check your thumbdrive's slice but mine have 4 (0 to 3) with number 3 for OpenBSD. So I edit the slice's information for OpenBSD part.

fdisk: 1> e 3
            Starting         Ending         LBA Info:
 #: id      C   H   S -      C   H   S [       start:        size ]
-------------------------------------------------------------------------------
*3: A6      0   1   2 -    241 254  63 [          64:     3887666 ] OpenBSD     Partition id ('0' to disable) [0 - FF]: [A6] (? for help) ENTER
Do you wish to edit in CHS mode? [n] ENTER
Partition offset: [64] ENTER
Partition size: [3887666] 600m


Take note that I didn't use the CHS mode. For the OpenBSD slice, it's ok. But I need to use the CHS mode for the FAT32 slice or else I won't get the 2 partitions I needed.

fdisk: 1> e 0
            Starting         Ending         LBA Info:
 #: id      C   H   S -      C   H   S [       start:        size ]
-------------------------------------------------------------------------------
 0: 00      0   0   0 -      0   0   0 [           0:           0 ] unused     
Partition id ('0' to disable) [0 - FF]: [0] (? for help) 0B
Do you wish to edit in CHS mode? [n] y
BIOS Starting cylinder [0 - 241]: [0] 76
BIOS Starting head [0 - 254]: [0] 125
BIOS Starting sector [1 - 63]: [1] 49
BIOS Ending cylinder [0 - 241]: [0] 241
BIOS Ending head [0 - 254]: [0] 254
BIOS Ending sector [1 - 63]: [1] 63


As you can see, slicing the FAT32 part is a bit tricky. I need to verify my OpenBSD's slice CHS information (Ending) and adjust the FAT32 CHS informations (Starting - Ending) accordingly. As you can see, my OpenBSD's CHS ended at 241 - 254 - 63 so I used that info as Starting CHS detail for the FAT32 slice. The Ending part should be the maximum of the CHS available.

Now I flag the OpenBSD slice to make it active.

fdisk:*1> flag 3
Partition 3 marked active.

Then quit and save changes.

fdisk:*1> quit

That was only the slicing part. In Window's world it's called partitioning. But now I need to partition the OpenBSD slice created. For this I need to use disklabel.

$ sudo disklabel -E sd1
Label editor (enter '?' for help at any prompt)
> a
partition: [a] ENTER
offset: [64] ENTER
size: [1228799] *
FS type: [4.2BSD] ENTER
Rounding size to bsize (32 sectors): 1228768

As the thumbdrive will just be an installation media, no need to create SWAP or any other partition. To confirm, I need the partition info.

> p m
OpenBSD area: 64-1228864; size: 600.0M; free: 0.0M
#                size           offset  fstype [fsize bsize  cpg]
  a:           600.0M               64  4.2BSD   2048 16384    1
  c:          1906.0M                0  unused                  
  i:          1298.3M          1228863   MSDOS

Looks good. Remember that sd1a is the a (OpenBSD) partition and sd1i is for the FAT32. Now quit and save changes.

> q
Write new label?: [y] ENTER

Sliced and partitioned, the thumbdrive is ready to be formatted. I use newfs.

$ sudo newfs /dev/rsd1a
$ sudo newfs /dev/rsd1i

It might take a while depending on how big your thumbdrive's capacity is. When done, I mount the OpenBSD's slice sd1a.

$ sudo mount /dev/sd1a /mnt

Then I copy my X200's /boot file to that thumbdrive.

$ sudo cp /boot /mnt

After that I make the slice bootable.

$ sudo /usr/mdec/installboot -v /mnt/boot /usr/mdec/biosboot sd1

Then I need to create a folder named 5.3 and copy all 5.3 installation files (bsd* & *tgz) into it.

$ sudo mkdir /mnt/5.3

Then I need to create an etc folder, create a boot.conf file inside it.

$ sudo mkdir /mnt/etc
$ sudo touch /mnt/etc/boot.conf

Edit /mnt/etc/boot.conf and add:

set image /5.3/bsd.rd

Finally, I unmount the thumbdrive, reboot to test. The bsd.rd got booted nicely but I haven't tested the installation or upgrade procedure. Didn't want to mess with my current installation. If you tried this, do comment on how it goes. Later.

Update: Here's my experience on Upgrading OpenBSD using USB Flashdrive that I've created above.

Saturday, May 04, 2013

5.3 amd64 X200: Update to 5.3 but biosboot have problem! Ahhh!

Hola,

I updated my X200 to 5.3 last night, using the bsd.rd upgrade method. The usual stuff.

But when I reboot my X200, it's stuck at:

Loading...

That's all. Tried downloading the bsd, bsd.rd and bsd.mp file and do the upgrade process again, still with the same issue. Tried repairing the installboot

# cp /usr/mdec/boot /boot
# /usr/mdec/installboot -n -v /boot /usr/mdec/biosboot sd0


But then still I just can see the Loading... screen. Ahhh! Currently I'm logging in to my X200 using my old 5.0 install cd.

To do that, just boot the laptop using CD, when I see the boot> title:

boot> boot hd0a:/bsd

So basically the upgrade is ok, but the /boot have issue. Ahhh!


[Update 04/05/2013]

I wrote to misc@ and thanks to Dawe who replied, I managed to solve the issue.

By looking at the changelist, there's many changes in 5.3. Including biosboot(8) and installboot(8). But I didn't quite see the exact connection with the problem I had. So Dawe pointed me to the same problem faced by him, and solved via creating a new openbsd.pbr so Win7's bootloader can boot OpenBSD properly.

I tested that, and so, it does work as advertised. So, problem solved.