# Boot fails at "Trying to mount root"



## ccc (Mar 16, 2012)

*H*i

I've tried to upgrade my *F*reeBSD 7.4 to 8.2 according to:

http://www.freebsd.org/releases/8.2R/announce.html

using freebsd-update: 
	
	



```
# freebsd-update upgrade -r 8.2-RELEASE
```
 and it was crashing with "core dump".

Now I cannot start and get this message: 
	
	



```
Trying to mount root from ufs dev ad0s1a
added: not found
```

The system is just "read only".

If I try *fsck -f*, I get the error 
	
	



```
fsck_ufs for /dev/ad0s1a in /sbin:/usr/sbin:  no such file or directory
```

How to rescue it?


----------



## SirDice (Mar 16, 2012)

Are you dropped to single user mode or are you stuck in the bootloader?


----------



## jb_fvwm2 (Mar 16, 2012)

ada0s1a?  Not enough information to know the commands available at the prompt there, nor your current mounted filesystems if any at the error messages. Maybe posting more context (the post before this one also does not have enough information.) At any rate, it should be easy, but not simple (multiple steps and posts here...)


----------



## ccc (Mar 19, 2012)

After restart, my freeBSD goes to the single user mode automatically and I get these messages on the screen:


----------



## jb_fvwm2 (Mar 20, 2012)

Might be easy to fix, but with commands such as:

```
mount -t ufs -o rw /dev/ad0s1a # 
fsck_ffs -y /dev/ad0s1a   # etc (the other stuff in [FILE]/etc/fstab[/FILE]
edit /etc/fstab   # modify it maybe after fsck_ffs for any corrected devices
```
Of course there's other stuff I've forgotten or do not know enough to suggest simply from memory... such as the terse "not found" might refer to ad0s1a now existing with another name in /dev, maybe change to it and look around...


----------



## wblock@ (Mar 20, 2012)

Do the fsck before mounting anything r/w:
`# fsck -y -t ufs`


----------



## ccc (Mar 22, 2012)

fsck or /sbin/fsck doesn't work!


```
fsck_ufs for /dev/ad0s1a in /sbin:/usr/sbin:  no such file or directory
```


----------



## wblock@ (Mar 22, 2012)

`# /rescue/fsck -y -t ufs`

If that doesn't work, boot from an mfsBSD CD and run it from there.


----------



## ccc (Mar 22, 2012)

wblock@ said:
			
		

> `# /rescue/fsck -y -t ufs`
> 
> If that doesn't work, boot from an mfsBSD CD and run it from there.



Thanks but which command should I run from mfsbsd boot CD, if I run `/rescue/fsck -y -t ufs` nothing happens.
Should I mount first?


----------



## wblock@ (Mar 23, 2012)

Do not mount any of the filesystems.  -t ufs tells fsck(8) to look at /etc/fstab and check all the UFS filesystems listed there.  But the mfsBSD CD doesn't have entries for your disk, so refer to the filesystems by device:

```
# fsck -y /dev/ad0s1a
# fsck -y /dev/ad0s1d
# fsck -y /dev/ad0s1e
# fsck -y /dev/ad0s1f
```


----------



## ccc (Mar 23, 2012)

Thanks, but cannot find /dev/ad0s1a and don't know how to identify the file system.


----------



## jb_fvwm2 (Mar 23, 2012)

```
fsck_ffs -y /dev/ad0s1a
```
 I found that that command would work on a thumbdrive [1] where fsck gives the same error as your linked file above.  Unsure about the ada0s1a OR ada1s1a OR ad0s1a etc, additionally sometimes 
	
	



```
#cd /dev
#ls
```
 before the fsck_ffs  sometimes worked better (if I recall). 

...
[1] In that regard, I've taped it to one of the thumbdrives for reference.


----------



## wblock@ (Mar 23, 2012)

ccc said:
			
		

> Thx, but cannot find /dev/ad0s1a and don't know howto identify the file system.



Please show the output of
`# ls /dev/ad*`


----------



## ccc (Mar 23, 2012)

Thx, it works now using fsck_ffs instead of fsck command:

```
mfsbsd# ls /dev/ad*
/dev/ad0	/dev/ad0s1a	/dev/ad0s1d	/dev/ad0s1f
/dev/ad0s1	/dev/ad0s1b	/dev/ad0s1e
mfsbsd# [color="Red"][B]fsck -y /dev/ad0s1a
fsck: Could not determine filesystem type[/B][/color]
mfsbsd# [B]fsck_ffs -y /dev/ad0s1a
** /dev/ad0s1a
** Last Mounted on /
** Phase 1 - Check Blocks and Sizes
** Phase 2 - Check Pathnames
** Phase 3 - Check Connectivity
** Phase 4 - Check Reference Counts
** Phase 5 - Check Cyl groups
3818 files, 135068 used, 2342011 free (811 frags, 292650 blocks, 0.0% fragmentation)

***** FILE SYSTEM IS CLEAN *****[/B]
```


----------



## ccc (Mar 23, 2012)

I've successfully cleaned all drives:

/dev/ad0s1a
/dev/ad0s1d
/dev/ad0s1e
/dev/ad0s1f

but my *F*reeBSD won't boot and still goes by itself into single user mode.
Any idea howto solve this problem?


----------



## jb_fvwm2 (Mar 23, 2012)

More details about the boot--default menu? Deselect firewire in BIOS? No USB attached?


----------



## ccc (Mar 23, 2012)

jb_fvwm2 said:
			
		

> More details about the boot--default menu? Deselect firewire in BIOS? No USB attached?



Boot menu looks normal, default, standard. No firewire and no USB attached. Is there any repair option in the setup CD?


----------



## jb_fvwm2 (Mar 23, 2012)

Usually it shows a reason if it (without the CD, just the install) goes to single-user. Errors shown that way? (For instance, I have to boot v9 with default rather than what used to be choice #2 , acpi disabled).


----------



## ccc (Mar 23, 2012)

jb_fvwm2 said:
			
		

> Usually it shows a reason if it (without the cd, just the install) goes to single-user. Errors shown that way? (For instance, I have to boot v9 with default rather than what used to be choice #2 , acpi disabled).



To boot with "acpi disabled" didn't help. 
BTW I get these error messages after restart:


----------



## ccc (Mar 23, 2012)

BTW knows anyone why the "boot" command doesn't work in single user mode?


----------



## jb_fvwm2 (Mar 24, 2012)

You are already booted, though not in the way you'd expect.  If you can *fsck_ffs* every filesystem, you may be able to load your normal shell #csh #or... maybe after a *mount -va* ... From your attached image above, what about running *fsck_ffs* on the likely instances in /dev ?


----------



## ccc (Mar 24, 2012)

jb_fvwm2 said:
			
		

> You are already booted, though not in the way you'd expect.  If you can *fsck_ffs* every filesystem, you may be able to load your normal shell #csh #or... maybe after a *mount -va* ... From your attached image above, what about running *fsck_ffs* on the likely instances in /dev ?



I've done what you suggested, but still goes into single user mode.


----------



## idle (Mar 25, 2012)

After checking all of the FS's, enter [CMD=""]exit[/CMD].


----------



## ccc (Mar 25, 2012)

idle said:
			
		

> After checking all of the FS's, enter [CMD=""]exit[/CMD].



Yep and didn't help.


----------



## wblock@ (Mar 25, 2012)

The errors say that it can't find swapon(8), which should be in /sbin.  So somehow /etc/fstab is wrong, or possibly there's more than one drive and the wrong one is being mounted, or this is not a standard FreeBSD system.  Or the disk just picked this time to grow some bad sectors.


----------



## ccc (Mar 25, 2012)

My /etc/fstab and don't know what's wrong:
	
	



```
# Device		Mountpoint	FStype	Options		Dump	Pass#
/dev/ad0s1b		none		swap	sw		0	0
/dev/ad0s1a		/		ufs	rw		1	1
/dev/ad0s1f		/tmp		ufs	rw		2	2
/dev/ad0s1e		/usr		ufs	rw		2	2
/dev/ad0s1d		/var		ufs	rw		2	2
/dev/acd0		/cdrom		cd9660	ro,noauto	0	0
/dev/fd0                /floppy         msdos   rw,noauto       0       0
linproc                 /compat/linux/proc/  linprocfs  rw      0       0
```


----------



## jb_fvwm2 (Mar 25, 2012)

```
mount -va
```
 Not clear if you are able to do that after the fsck_ffs and start your normal shell? (yet). See anything strange in

```
dmesg -a | less
```
 ??


----------



## wblock@ (Mar 26, 2012)

Looks like partitions a and f are backwards.  If that's the case:
`# mount /dev/ad0s1d /var`
`# mount /dev/ad0s1e /tmp`
`# mount /dev/ad0s1f /usr`

Then edit /etc/fstab to make it permanent.


----------



## wblock@ (Mar 26, 2012)

There's a typo in my post, the partitions *e* and f are backwards.

Here is what it most it probably was:

```
# Device		Mountpoint	FStype	Options		Dump	Pass#
/dev/ad0s1b		none		swap	sw		0	0
/dev/ad0s1a		/		ufs	rw		1	1
/dev/ad0s1e		/tmp		ufs	rw		2	2
/dev/ad0s1f		/usr		ufs	rw		2	2
/dev/ad0s1d		/var		ufs	rw		2	2
```


----------



## ccc (Mar 26, 2012)

wblock@ said:
			
		

> There's a typo in my post, the partitions *e* and f are backwards.
> 
> Here is what it most it probably was:
> 
> ...



I've changed in /etc/fstab, but still get the same error: 
	
	



```
swapon: not found.
```


----------



## Chris_H (Mar 27, 2012)

Greetings,

This might prove to be a nice temporary solution. It will at least provide a system stable enough to mount, and thereby permit using the installed system to rediscover/fix the original swap slice: www.freebsd.org/doc/handbook/adding-swap-space.html. See section *12.14.3 Swapfiles*. This should prove to be your safest/least intrusive option to create an interim swapfile.

Best wishes.


----------



## wblock@ (Mar 27, 2012)

It's not the lack of a swap partition, it's the actual swapon(8) binary that's not being found.  And that should be in /sbin.  Something is very wrong, but I've never used binary upgrades and don't know what could go wrong.


----------



## Chris_H (Mar 27, 2012)

Ahh, I didn't get that from the thread. I guess he might be able to hijack a copy from the install/live DVD/CD, and simply rename the copy in his /sbin (assuming it's there), then copy the DVD version to /sbin: [cmd=""]reboot -s && fsck -f; reboot && cross fingers[/cmd]


----------



## ccc (Apr 5, 2012)

Using FreeSBIE, I've copied the whole /sbin and /usr/bin directory from other *F*reeBSD 8.2 machine, without overwriting the existing files and now it seems to start/work well. 
Time for a cold beer...


----------

