# ROOT MOUNT ERROR (in dual boot configuration)



## adcat (Jan 5, 2011)

Hi All,

I installed FreeBSD after installing Windows 7, and now when I try to boot FreeBSD it says


```
Trying to mount root from ufs:/dev/label/rootfs0
ROOT MOUNT ERROR:
If you have invalid mount options, reboot, and first try the following from the loader prompt:
  set vfs.root.mountfrom.options=rw

Loader variables:
vfs.root.mountfrom=ufs:/dev/label/rootfs0
vfs.root.mountfrom.options=rw,noatime

Manual root filesystem specification:
<fstype>:<device> Mount <device> using filesystem <fstype>
                               eg. ufs:/dev/da0s1a
                               eg. cd9660:/dev/acd0
                               This is equivalent to: mount -t cd9660 /dev/acd0 /

?                             List valid disk boot devices
```

When I type ?, I get:

```
List of GEOM managed disk devices:
cd0  ntfs/Silver  ad2s1  ad2  acd0
```

So when I use the syntax:
[CMD="mountroot>"]ufs:/dev/ad2[/CMD]
or
[CMD="mountroot>"]ufs:/dev/label/ad2[/CMD]
I can't mount any of the above listed GEOM devices.

I also tried [cmd=]set vfs.root.mountfrom.options=rw[/cmd] at the loader prompt like it suggests but no luck.  Booting to any other option like single user mode or safe mode doesn't work either.  I'm using the FreeBSD bootloader by the way if that helps.

When this problem happened the first time, I reinstalled FreeBSD and it has happened again, I've never been able to boot to FreeBSD.  When I installed FreeBSD, it installed to ada1s3, but this isn't listed when I type ?.  I tried:
[CMD="mountroot>"]ufs:/dev/ada1s3[/CMD]
and
[CMD="mountroot>"]ufs:/dev/label/ada1s3[/CMD]
just for kicks, but no luck.

Please help!


----------



## wblock@ (Jan 5, 2011)

Windows 7 may have seen the FreeBSD boot manager and "repaired" it.

EasyBCD is, IMO, the easiest way to deal with dual-boot Vista/7 installs.


----------



## adcat (Jan 6, 2011)

EasyBCD has no effect on the FreeBSD bootloader whatsoever, it simply loads the FreeBSD bootloader when the FreeBSD partition is selected.  I do not believe Windows 7 has done anything to it, I tried to boot to FreeBSD directly after installing it.  This is FreeBSD 8.0 by the way.

Can someone tell me how to empirically determine which partition to boot to, the syntax to manually boot it at the mountroot prompt, and how my fstab file needs to be changed to fix this problem?  I can escape to the loader command prompt successfully, but I don't know what to do there.  I typed "lsdev" to see all the listed disks and partitions.  It lists the FreeBSD partitions as disk0s3a (FFS), disk0s3b (swap), disk0s3d (FFS), disk0s3e (FFS).  I can't figure out how to boot any of these partitions.  Is FFS the same as ufs as far as the loader is concerned?  I've tried
[CMD="mountroot>"]ufs:/dev/disk0s3a[/CMD]
[CMD="mountroot>"]ufs:/dev/label/disk0s3a[/CMD]
[CMD="mountroot>"]ufs:/dev/0s3a[/CMD]
etc, etc, with no luck.

It's no problem for me to boot to a livecd and mount the FreeBSD partition to muck around with the files, but I have no idea what to do there, it's all trial and error.


----------



## wblock@ (Jan 6, 2011)

Vista/7 BCD does not play well with others; this is why I suggested EasyBCD.

There's a clue to the device problem in the device names.  ada1 is AHCI.  Yet the prompt shows ad2.  I can only guess that you loaded the ahci module before the install, but forgot to set it up to be loaded routinely.  So you would enter

```
ufs:/dev/ad2s1a
```

But that's listed in the devices, and you said you tried them all, so I thought it didn't work.

There are label references in a couple of places, but they're to devices, not filesystems.  UFS filesystem labels show up in /dev/ufs/.  If the labels were created correctly--with newfs(8) or tunefs(8), you should be able to use

```
ufs:/dev/ufs/rootfs0
```


----------



## adcat (Jan 7, 2011)

Thanks for baring with me, wblock, I'm still fairly new to BSD systems.  It seems that setup and configuration is the most difficult part, despite the installation guides that are provided.  

Neither of your above commands worked.  How did you come up with ad2s1a?  My hard drive is located on a SATA III port, where AHCI is the controller mode in the bios.  I don't remember doing anything with AHCI during the installation of FreeBSD (perhaps that's the problem, but I thought it loaded the recommended settings based on my drive configuration).  

During boot I spotted:


> atapci0: AHCI called from vendor specific driver



I later escaped to the loader prompt and typed "lsmod" to get the list of loaded modules, one of them is:


> 0x1186000: /boot/kernel/ahci.ko (elf obj module, 0xb0b8)
> modules: ahci.1


Is this not the module that should be loading routinely for my drive?

Thanks again for your help.


----------



## wblock@ (Jan 7, 2011)

adcat said:
			
		

> How did you come up with ad2s1a?



It's in your output in message #1.  ad2 is the drive, s1 is the first DOS-type partition ("s" is for slice, the name FreeBSD uses for those), and a is the first FreeBSD partition on that slice.  If you installed to the second slice/partition of a drive, it would be s2a, and so on.  Can you verify if there were any other non-FreeBSD partitions (slices) on the drive you used?



> My hard drive is located on a SATA III port, where AHCI is the controller mode in the bios.  I don't remember doing anything with AHCI during the installation of FreeBSD (perhaps that's the problem, but I thought it loaded the recommended settings based on my drive configuration).



Possibly sysinstall loads ahci when it sees one of those drives.  It does need to be loaded to use the device adaN.

If the BIOS is not set to AHCI or the achi module is not loaded, the same drive would appear as an "ad" device, and the drive number would likely not match.  What happened with your installation I don't know, but if everything is correct, using ? at the mountroot prompt should show some adaN devices.  N may have changed for some reason, particularly if you connected or disconnected drives in the meantime.

So what to do now... well, boot the system, try the ?, and see if the device names have changed.  Based on message #3, I'm thinking it should actually be ufs:/dev/ada0s3a or maybe ufs:/dev/ad0s3a.

Additional: /etc/fstab will still be wrong, so only / will be mounted.  Then you can
`# mount /dev/ada0s3d /var`
`# mount /dev/ada0s3e /tmp`
`# mount /dev/ada0s3f /usr`

and edit /etc/fstab so the device naming is correct.

After all that, see Moving A FreeBSD System To AHCI And Labeled Filesystems to label the filesystems and never have this problem again.


----------



## adcat (Jan 8, 2011)

I've been working on this for 15+ hours since your last post and it's getting very frustrating.  I had a detailed report to submit, but when I hit submit it told me I had been logged out, and now it's lost.  x(



> If you installed to the second slice/partition of a drive, it would be s2a, and so on. Can you verify if there were any other non-FreeBSD partitions (slices) on the drive you used?


Yes, well, a third re-install has verified ada1s1 and ada1s2 which are both ntfs partitions used by Windows 7.  ada1s3a,b,d,e are used by FreeBSD similar to my report from post #3.  My 3rd install has resulted in the same problem.  Typing lsdev at the loader prompt shows an output in the format that I reported in post #3, and confirms the file system types in each partition. 

NOTE: I did the 3rd re-install after all of the steps below, which results in the same mount error.  The 3rd time I used custom partitioning, specifically choosing ada1s3, which has resulted in the same partition layout as before.



> try the ?, and see if the device names have changed. Based on message #3, I'm thinking it should actually be ufs:/dev/ada0s3a or maybe ufs:/dev/ad0s3a.


They did not change, and these commands did not work.
The device names did not change, and these commands didn't work.  I booted up a livecd of PC-BSD (FreeBSD v8.0 with KDE, 64-bit OS in my situation. This is also my install media - the PCBSD forums have proven less helpful) and I mounted the ufs partitions.  I took a peak in /media/disk/dev and found 4 directories and a file called "md1".  A directory called "pts" was the only directory containing a file, called, "5" (a character-device).  "ufs" was not one of the 4 directories, neither was "label".  There were no volume labels to be found, manual mounting would never have worked it seems.  

Where does it get the list of GEOM managed devices?  Things like "ad2" and "acd0" were not listed in /dev on the mounted partition, but they were present on /dev in the livecd.



> After all that, see Moving A FreeBSD System To AHCI And Labeled Filesystems to label the filesystems and never have this problem again.


Now, navigating to /dev (the /dev of the livecd) showed all of the device labels, including ada1s3a,b,d,e.  I proceeded to unmount the ufs partitions and followed the instructions in your above links.  I rebooted (to the livecd) before editing the fstab file like it suggests, to find that the volume labels had been changed correctly, but instead of creating the "ufs" directory on the /media/disk/dev path, it was now listed in /dev of the livecd.  I learned that you cannot simply copy them from one location to the other either, the process attempts to copy gigabytes of the file system rather than size-less labels.  

I continued to edit the fstab file accordingly to the instructions, but it still failed to boot just the same.  Is there some "chroot" trick I can try to generate the labels correctly from the livecd?  I attempted it but I lost paths to needed binary files.  

On a side note, at boot-up, there's an error that reads something like,

```
acd0: ILLEGAL REQUEST, operation not permitted!
```
I believe it's always been there, but I've just now taken notice of it.  If I'm not using an install cd, then acd0 shouldn't be coming up at boot-time right?



Is it too much to ask to be able to boot up my system, oh great BSD daemon, Beastie?


----------



## wblock@ (Jan 8, 2011)

adcat said:
			
		

> Now, navigating to /dev (the /dev of the livecd) showed all of the device labels, including ada1s3a,b,d,e.



To be precise, those are device or slice or partition names, not labels.



> I proceeded to unmount the ufs partitions and followed the instructions in your above links.  I rebooted (to the livecd) before editing the fstab file like it suggests, to find that the volume labels had been changed correctly, but instead of creating the "ufs" directory on the /media/disk/dev path, it was now listed in /dev of the livecd.



This is good news.  First, /dev is a dynamic device directory.  It's created by the operating system based on whatever hardware it finds.  It lives in memory, not on a disk.



> I continued to edit the fstab file accordingly to the instructions, but it still failed to boot just the same.



The fstab that needs to be edited is the one on /dev/ada1s3a.  Or, as a label, (assuming it's been labeled as "rootfs") /dev/ufs/rootfs.

So you're almost there.  Boot with your liveCD.  Make sure the labels all exist:

```
% ls /dev/ufs
rootfs	tmpfs	usrfs	varfs
% ls /dev/label
swap
```

Mount the "rootfs" partition so it can be edited:
`# mkdir /tmp/myrootfs`
`# mount /dev/ufs/rootfs /tmp/myrootfs`

Then, finally, edit /tmp/myrootfs/etc/fstab with vi or ee or whatever.  Save changes and reboot.



> I believe it's always been there, but I've just now taken notice of it.  If I'm not using an install cd, then acd0 shouldn't be coming up at boot-time right?



/dev/acd0 is the device.  Like the other stuff in /dev, it's created dynamically at startup based on what hardware is found.  I see an "error" for my CD devices because they don't have any CDs loaded.  It's more of an annoying warning.


----------



## adcat (Jan 9, 2011)

Well, much to my frustration, I'm sorry to report that it did not work.  It gives the same error, except now with the /dev/ufs/rootfs path that I gave it in fstab.  Typing ?, lists the very same devices mentioned in post #1.

With the fresh, non-booting, installation, we see from booting to the livecd that:

```
% ls /dev/ufs
ROOTFS
% ls /dev/label
rootfs0 swap0 var0 usr0
```
(The fstab file correctly points to /dev/label at this time)  Then, I followed your instructions in the link you supplied on creating labels, followed by your instructions in the last post on correctly editing fstab.  It did not boot.  After booting to the livecd I noticed:

```
% ls /dev/ufs
ROOTFS rootfs varfs usrfs
% ls /dev/label
swap rootfs0 var0 usr0
```
I tried "glabel destroy <name>" and "glabel clear <name>" to get rid of the old duplicates
but it doesn't work.  Are these old duplicates keeping me from booting?  I'm not sure what to do with them.

This is my current fstab file, the only thing I've changed are the device paths as per the instructions you gave me:

```
# Device          Mountpoint              FStype          Options Dump Pass
/dev/ufs/rootfs   /                       ufs             rw,noatime      1       1
/dev/label/swap   none                    swap            sw              0       0
/dev/ufs/var      /var                    ufs             rw,noatime      1       1
/dev/ufs/usr      /usr                    ufs             rw,noatime      1       1
procfs            /proc                   procfs          rw              0       0
linprocfs         /compat/linux/proc      linprocfs       rw              0       0
tmpfs             /tmp                    tmpfs           rw,mode=1777    0       0
```

x(


----------



## Faggot_Fredrikson (Jan 9, 2011)

*Same problem except BEFORE INSTALLATION*

I have a similiar problem, except I get the following prompt before being able to install BSD:


```
GEOM: ad6: partition 2 does not start on a track boundary
GEOM: ad6: partition 2 does not end on a track boundary
GEOM: ad6: partition 1 does not start on a track boundary
GEOM: ad6: partition 1 does not end on a track boundary

Loader variables:
vfs.root.mountfrom=
vfs.root.mountfrom.options=

Manual root filesystem specification:
<fstype>:<device> Mount <device> using filesystem <fstype>
                               eg. ufs:/dev/da0s1a
                               eg. cd9660:/dev/acd0
                               This is equivalent to: mount -t cd9660 /dev/acd0 /

?                             List valid disk boot devices
mountroot>
```

Typing "?" results in this:

```
List of GEOM managed disk devices:
  ntfs/System  Reserved  ad6s2  ad6s1  ad6  iso9660/FreeBSD_Install acd0
```


Otherwise I'm in a similiar situation; I have Windows7 installed on my disk, and I want to install FreeBSD on the same disk for dualbooting.
However, when I put the FreeBSD_Install CD into the CD drive and restart my computer, I get to the boot screen of FreeBSD, from where I can select the default option or go to loader prompt etc.

So being the noob I am, I try the default option, hoping that it would start the installer (it's called sysinstall, right?), and I see the bootloader doing it's thing, figuring out the devices on my computer.

Then it just comes to the screen seen above in the code-block. This happens before I am able to install anything or before the installer program is started.

To me it seems weird that the bootloader tries to find a mountable root system, when I haven't even installed anything but Windows7. Notice that my view is a bit different than that of OP's, namely the "Loader Variables" are empty in my view.

I have tried all the disk devices listed by "?", even though it seems futile when I know I don't have freebsd installed yet. I tried them by typing [cmd=]ufs:/dev/foo[/cmd] and i tried [cmd=]ufs:foo[/cmd] and just "foo", etc.

I believe "ad6s2" & "ad6s1" are the partitions which hold my Windows7-installation, though I'm not sure.


Any ideas what to do? Do I need to do some configuring in the "boot loader prompt" so it would try to run sysinstall instead of looking for a mountable root system?


I am a total unix noob, so detailed instructions would be greatly appreciated.

Some related specs:
CPU: Intel i3 540
Mobo: GIGABYTE GA-H55N-USB3
Harddisk is SATA2 and has two existing partitions, "System Reserved" and "C: SYSTEM", both which are for Windows7, and then it has couple hundred gigs of unallocated space.
The installation disk I'm using is for FreeBSD 8.1-RELEASE and from the relnotes.txt on the installation disk I can see this for a more accurate version I believe:

```
$FreeBSD: src/release/doc/en_US.ISO8859-1/relnotes/article.sgml,v
   1.1101.2.6.2.2 2010/07/17 00:12:41 hrs Exp $
```


----------



## wblock@ (Jan 9, 2011)

adcat said:
			
		

> Are these old duplicates keeping me from booting?  I'm not sure what to do with them.



I don't think they're a problem.  Should also add that this is definitely not a stock FreeBSD install.  Probably PC-BSD, but I don't know.  Please verify.

Given that ada1 isn't shown in the boot list, I still would point to a missing ahci module.  The installer (not sysinstall) loaded it, but didn't set the installed system to load it.  Again using your liveCD, mount /dev/ufs/rootfs and edit /boot/loader.conf, adding

```
ahci_load="YES"
```



> This is my current fstab file, the only thing I've changed are the device paths as per the instructions you gave me:
> 
> ```
> # Device          Mountpoint              FStype          Options Dump Pass
> ...



Definitely not a stock FreeBSD fstab, and several problems in there (bolded sections to highlight problems or just differences from stock).  Let me rewrite that:

```
# Device                Mountpoint      FStype  Options         Dump    Pass#
/dev/label/swap         none            swap    sw              0       0
/dev/ufs/rootfs         /               ufs     rw              1       1
/dev/ufs/varfs          /var            ufs     rw              2       2
/dev/ufs/tmpfs          /tmp            ufs     rw              2       2
/dev/ufs/usrfs          /usr            ufs     rw              2       2
linproc                 /compat/linux/proc      linprocfs       rw      0       0
proc                    /proc           procfs  rw              0       0
```


----------



## wblock@ (Jan 9, 2011)

Really? You want me to quote that? said:
			
		

> I have a similiar problem, except I get the following prompt before being able to install BSD:
> 
> 
> ```
> ...


----------



## adcat (Jan 10, 2011)

wblock said:
			
		

> I don't think they're a problem.  Should also add that this is definitely not a stock FreeBSD install.  Probably PC-BSD, but I don't know.  Please verify.


Sorry, I casually mentioned that in post #7.  Yes, this is PC-BSD 64-bit, and I've tried 8.0 and 8.2-beta now with the same effect.  I've just created a thread in their forum here: http://forums.pcbsd.org/showthread.php?p=85036#post85036



> Given that ada1 isn't shown in the boot list, I still would point to a missing ahci module.  The installer (not sysinstall) loaded it, but didn't set the installed system to load it.  Again using your liveCD, mount /dev/ufs/rootfs and edit /boot/loader.conf, adding
> 
> ```
> ahci_load="YES"
> ```


Yes, I've been checking that since it's mentioned in your instructions on labeling filesystems.  It's never been set to "NO" in fact, since I've been checking the file.




> Definitely not a stock FreeBSD fstab, and several problems in there (bolded sections to highlight problems or just differences from stock).  Let me rewrite that:
> 
> ```
> # Device                Mountpoint      FStype  Options         Dump    Pass#
> ...


Ok, I'll give this a try and report back.



> Why it's not finding that, I don't know. Windows 7 has made things more interesting by starting to use GPT partitions. An external USB CD drive can complicate things, and that's a motherboard with USB3.


Interesting note, I'm also using a motherboard with USB3 and SATA-3.  I have a USB mouse attached, 2 hard drives attached on SATA-3 ports, one more attached on a SATA-2 port.  

In 8.2-beta, I have the option of installing with GPT, listed as "dedicated disk full install".  I was leery of enabling anything that said "full install" when the disk contains another OS. 

If it helps, my system specs are:
Intel i7 980x processor
MSI Big Bang-XPower motherboard
XFX HD-485X-ZNFC Radeon HD 4850 video card
16GB DDR3 2000 ram
(cd/dvd drive is a SATA-attached Samsung with LightScribe support, if that matters)


----------



## adcat (Jan 13, 2011)

OK, I'm about to turn this back over as a FreeBSD bug.  You can follow my above listed link to see what was tried.  Here was my latest reply:



> Alright, let me start by saying that I think there is a serious hardware issue with either PCBSD or FreeBSD, likely FreeBSD I suppose.  I can't blame the hardware because Windows 7 still works fine.  Now, read below.
> 
> 
> 
> ...


----------



## adcat (Jan 15, 2011)

Alright, I've posted this in the PC-BSD forum but I'll post it here too.  The issue is that the ahci_load option is set to "NO" by default in FreeBSD, whereas it is set to "YES" in PC-BSD by default.  The module itself was causing the problem, so disabling it fixed the issue.

Here is what I posted in the PC-BSD forum, feel free to comment on it or reply to it here.  I'm setting this thread to solved since the issue seems to lie with the fact that PC-BSD auto-enables the feature and FreeBSD doesn't (that I know of).


> Alright, the problem is definitely with the ahci module.  I've tried just a straight install of FreeBSD 8.2 RC1 and PCBSD 8.2 RC1, and they both work if:
> 
> 
> ```
> ...


----------

