DaemonForums  

Go Back   DaemonForums > FreeBSD > FreeBSD Installation and Upgrading

FreeBSD Installation and Upgrading Installing and upgrading FreeBSD.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 21st November 2013
Jtf Jtf is offline
New User
 
Join Date: Nov 2013
Posts: 7
Thanked 0 Times in 0 Posts
Default FreeBSD won't boot after mounting root partition on OpenBSD

Hi all,

This is regarding a system that is dual booting FreeBSD and OpenBSD.
I have encountered a serious problem in which after mounting the root partition of my FreeBSD installation on OpenBSD (by accident), FreeBSD would not boot.

What I remembered doing in OpenBSD was trying to mount my usb partition (sd1i). I instead mounted sd0i which was my FreeBSD root partition and then I unmounted it. These where the commands on OpenBSD that I issued while doing that:

% # mount /dev/sd0i /mnt
% # cp –rf /mnt/
Pressed tab…
Saw the directory contents and realised that I mounted the wrong partition…
% # umount /dev/sd0i
And then mounted sd1i….

After that, I then tried to reboot to FreeBSD but the computer kept freezing up on this screen:

https://imagizer.imageshack.us/v2/51...0/853/q2z9.jpg

I have a feeling /boot/boot1 is the one that hanged but I'm not sure why and how to fix it. For dual booting, I am using FreeBSD’s /boot/boot0 boot manager.

The reason why I suspect mounting sd0i on OpenBSD to be the cause of the problem is because that was the operation I did to sd0i and that I was able to boot into FreeBSD previously before I booted into OpenBSD. I also don’t remember doing any operations involving partitions the last time I was on FreeBSD.

I tried googling for solutions to this but can’t find anyone with the same problem.


Something details that may be relevant:

FreeBSD 9.2 (generic kernel)

OpenBSD 5.4 (generic kernel)

ThinkPad T61 with a Seagate Momentus 5400.6 hard drive


Help would be appreciated. Thanks.

Last edited by Jtf; 21st November 2013 at 04:12 PM. Reason: Image is larger then 640x480
Reply With Quote
  #2   (View Single Post)  
Old 21st November 2013
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 3,435
Thanked 214 Times in 189 Posts
Default

First, hello, and welcome! Second, I'm sorry you had this problem. Third, I'm not a FreeBSD user, so my advice may either have already been tried, or ... be entirely useless to you.
  • Boot a FreeBSD system capable of running bsdlabel(8). This could be your installation media.
  • From the root shell, use bsdlabel(8) with the -B option, to install new bootblocks from /boot/boot.
Reply With Quote
  #3   (View Single Post)  
Old 21st November 2013
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 3,118
Thanked 182 Times in 149 Posts
Default

You could try booting a FreeBSD 9.2 installation CD/DVD or USB stick and see whether # gpart show shows any meaningful info. If it does you can mount your FreeBSD partition(s) on /tmp. If you succeed in mounting you should save or backup the data and configuration stuff before attempting to fix the booting issue.

For the commands to fix the booting see the Warren Block's http://www.wonkity.com/~wblock/docs/...d_standard_mbr and/or the EXAMPLES section of gpart(8).

From that manual page (9.2 version):
Code:
Create an MBR scheme on ada0, then create a 30GB-sized FreeBSD slice,
     mark it active and install the boot0 boot manager:

	   /sbin/gpart create -s MBR ada0
	   /sbin/gpart add -t freebsd -s 30G ada0
	   /sbin/gpart set -a active -i 1 ada0
	   /sbin/gpart bootcode -b /boot/boot0 ada0

     Now create a BSD scheme (BSD label) with space for up to 20 partitions:

	   /sbin/gpart create -s BSD -n 20 ada0s1

     Create a 1GB-sized UFS partition and a 4GB-sized swap partition:

	   /sbin/gpart add -t freebsd-ufs -s 1G ada0s1
	   /sbin/gpart add -t freebsd-swap -s 4G ada0s1

     Install bootstrap code for the BSD label:

	   /sbin/gpart bootcode -b /boot/boot ada0s1
Make sure you use the correct FreeBSD disk device name and slice designators
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump
Reply With Quote
  #4   (View Single Post)  
Old 21st November 2013
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 3,435
Thanked 214 Times in 189 Posts
Default

Much more detailed and helpful than my post, J65nko. Thank you.
Reply With Quote
  #5   (View Single Post)  
Old 22nd November 2013
Jtf Jtf is offline
New User
 
Join Date: Nov 2013
Posts: 7
Thanked 0 Times in 0 Posts
Default

Hi jggimi and J65nko

Thanks for the welcome and help.

I have backed up my data using a FreeBSD 9.0 live CD. The individual partitions are still visible in /dev/ and accessible via the live CD. Unfortunately, due to the fact that I access to a 100MB limit service at the moment, I won't be able to download a FreeBSD 9.2 image to reinstall the boot-code for now.

Once I download the image and tryout what you have suggested, I'll confirm whether it was successful or not.
Reply With Quote
  #6   (View Single Post)  
Old 23rd November 2013
Jtf Jtf is offline
New User
 
Join Date: Nov 2013
Posts: 7
Thanked 0 Times in 0 Posts
Default

Ok,

I was able to boot to a live USB of FreeBSD 9.2 and issue the following operations just as you said to reinstall boot0, boot1 and boot2:

# /sbin/gpart set -a active -i 1 ada0
active set on ada0s1
# /sbin/gpart bootcode -b /boot/boot0 ada0
bootcode written to ada0
# /sbin/gpart bootcode -b /boot/boot ada0s1
bootcode written to ada0s1

And then reboot, removed the liveUSB and tried to boot into my FreeBSD installation. But the booting still hangs on the same screen as before. The OpenBSD installation can still boot without problem.

I think both boot0 and boot1 are not the problem. I have a feeling that it could be something has changed with the partition such that boot1 or boot2 doesn't work?

I have to mention I encountered this problem 6 months before after doing the same thing and just reinstalled FreeBSD. But since it is occurring the second time, I want to solve this rather then just reinstalling again.
Reply With Quote
  #7   (View Single Post)  
Old 23rd November 2013
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 3,118
Thanked 182 Times in 149 Posts
Default

From the liveUSB what is the output of # gpart show -p?
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump
Reply With Quote
  #8   (View Single Post)  
Old 23rd November 2013
Jtf Jtf is offline
New User
 
Join Date: Nov 2013
Posts: 7
Thanked 0 Times in 0 Posts
Default

The output of # gpart show -p is shown in the attachment.
Attached Images
File Type: jpg bvfu.jpg (174.5 KB, 19 views)
Reply With Quote
  #9   (View Single Post)  
Old 24th November 2013
Jtf Jtf is offline
New User
 
Join Date: Nov 2013
Posts: 7
Thanked 0 Times in 0 Posts
Default

Hi jggimi,

Thanks for your help but I am short of time and since I have backed up all important data (including the configuration files and the pkgng database), I decided that reinstalling the system is the fastest way to get access to a working FreeBSD system.

I apologize for the last post in which I displayed the output of # gpart show -p in a picture rather then using CODE tags thus making it hard to read.
Reply With Quote
Old 24th November 2013
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 3,118
Thanked 182 Times in 149 Posts
Default

Considering the output of # gpart show -p, the device and slice name of those commands are correct.

There have been occasions in the past where I mounted a FreeBSD root, "a", partition under OpenBSD but that were only read-only mounts to copy things.

Now I wonder whether a # fsck of the FreeBSD root partition would have fixed it.
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump
Reply With Quote
Old 24th November 2013
Jtf Jtf is offline
New User
 
Join Date: Nov 2013
Posts: 7
Thanked 0 Times in 0 Posts
Default

Ok I did an fsck on ada0s1a (the root partition) and here was what appeared on my screen:
Code:
# /sbin/fsck_ufs /dev/ada0s1a
** /dev/ada0s1a

USE JOURNAL? [yn] y

Falied to read ROOTINO directory block 8272
UNEXPECTED SU+J INCONSISTENCY

FALLBACK TO FULL FSCK [yn] y

** Skipping journal, falling through to full fsck

** Last Mounted on /mnt
** Phase 1 - Check Blocks and Sizes

CANNOT READ BLK: 320
UNEXPECTED SOFT UPDATE INCONSISTENCY

CONTINUE? [yn] y

Segmentation fault
For comparison, I did an fsck on my /var partition (/dev/ada0s1e) and these were the results:

Code:
# /sbin/fsck_ufs /dev/ada0s1e
** /dev/ada0s1e

USE JOURNAL? [yn] y

** SU+J Recovering /dev/ada0s1e
** Reading 16777216 byte journal from inode 4

RECOVER [yn] y

** Building recovery table.
** Resolving unreferenced inode list
** Processing journal entries

WRITE CHANGES? [yn] y

**81 journal records in 7168 bytes for 36.16% utilization
**Freed 0 inodes (0 dirs) 0 blocks, and 0 frags.

***** FILE SYSTEM MARKED CLEAN *****
I did another fsck on my /usr partition (/dev/ada0s1g) and the output was the same as fscking the /var partition.

Last edited by Jtf; 24th November 2013 at 09:27 AM.
Reply With Quote
Old 24th November 2013
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 3,118
Thanked 182 Times in 149 Posts
Default

UFS journalling is a rather new feature that OpenBSD does not support.

It could be that the OpenBSD r/w mount of the FreeBSD UFS+J root partition messed up some file system data, causing the boot of this file system to fail.
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump
Reply With Quote
Old 19th March 2014
comet--berkeley comet--berkeley is offline
Old programmer/hacker
 
Join Date: Apr 2009
Posts: 85
Thanked 1 Time in 1 Post
Default

Quote:
Originally Posted by J65nko View Post
UFS journalling is a rather new feature that OpenBSD does not support.

It could be that the OpenBSD r/w mount of the FreeBSD UFS+J root partition messed up some file system data, causing the boot of this file system to fail.
This week I installed FreeBSD 10.0 on an amd64 box with OpenBSD and Linux all on different partitions.

There seems to be a difference between OpenBSD partitions and FreeBSD partitions.

The OpenBSD partitions seem to automatically allow room for the boot program, /usr/mdec/biosboot, but the FreeBSD partitions do not allow room for the boot program, /boot/boot...

The FreeBSD instructions were not helpful:

Quote:
Originally Posted by J65nko View Post
...
From that manual page (9.2 version):
Code:
... then create a 30GB-sized FreeBSD slice ...
  
     Now create a BSD scheme (BSD label) with space for up to 20 partitions:

	   /sbin/gpart create -s BSD -n 20 ada0s1

     Create a 1GB-sized UFS partition and a 4GB-sized swap partition:

	   /sbin/gpart add -t freebsd-ufs -s 1G ada0s1
	   /sbin/gpart add -t freebsd-swap -s 4G ada0s1

     Install bootstrap code for the BSD label:

	   /sbin/gpart bootcode -b /boot/boot ada0s1
Make sure you use the correct FreeBSD disk device name and slice designators
I found that when I followed these instruction, that the "gpart bootcode" command would clobber the first 8k of the freebsd-ufs partition and then it was not longer usable.

To correct it I allowed room for the /boot/boot code and skipped 16 sectors (8k) from the beginning of the slice for the partition a.

Code:
/sbin/gpart add -t freebsd-ufs -b 16 -s 1G ada0s1
/sbin/gpart add -t freebsd-swap      -s 4G ada0s1

/sbin/gpart bootcode -b /boot/boot ada0s1
(Side note: -s 1G seems too small for a whole FreeBSD installation I used -s 8G and filled it half way already.)
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Mounting a NetBSD partition from OpenBSD daemonfowl OpenBSD General 4 19th July 2012 12:03 PM
Boot in other partition dgiorgio OpenBSD Installation and Upgrading 13 20th June 2012 11:07 PM
Xtracting Data after Fragmentation / Block Count / Partition Problems on Boot IronForge OpenBSD Installation and Upgrading 3 16th December 2010 01:09 AM
HOWTO: mounting an USB device as normal non-root user in OpenBSD J65nko Guides 4 24th December 2008 01:43 AM
Mounting a FreeBSD UFS partition roddierod Solaris 1 7th August 2008 02:02 PM


All times are GMT. The time now is 11:34 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick