About my problem

Teilhard Knight teilhk at Phreaker.net
Wed May 14 09:05:32 PDT 2003


On Wed, 2003-05-14 at 04:38, Matthew Seaman wrote: 
> On Wed, May 14, 2003 at 02:18:22AM -0500, Teilhard Knight wrote:
> > For those who do not know what I am talking about, this is what is
> > happening to me:
> > 
> > 
> > I have compiled my kernel. Everything seems to be all right, 
> > except that on boot it cannot mount root.
> > 
> > It displays: "mounting root from ufs:ad2s2a", and a failure message.
> > 
> > Now, I am left at boot with an inquire for a manual root filesystem
> > specification., like this:
> > 
> > <fstype><device> mount <device> using filesystem <fstype>
> > 
> > eg. ufs:/dev/da0s1a
> > 
> > ? List valid disk boot devices
> > 
> > <empty line> abort manual imput
> > 
> > mountroot>
> > 
> > 
> > The HD where FreeBSD is installed is ad2 in my previous kernel and in
> > this new one it is ad1. I have now found out that this is the source of
> > the problem. I checked the partition table, and the slices are called
> > ad2s2a --> ad2s2g. If this is the case, no way I can mount root on a
> > disk called ad1 with those slices.
> > 
> > So, I'll pose a different question. Do you know of a possible way I can
> > make my new kernel to spot my HD as ad2? To me this is the only solution
> > possible.
> 
> Hmmm... It's not impossible to recover from the situation you're in
> without having to do anything unaesthetic, like re-installing.  It is,
> however, fairly tricky and requires use of some quite unfriendly
> commands.
> 
> Your aim is simply to edit /etc/fstab and change all references to ad2
> over to ad1.  Since the fstab is not correct for your current machine,
> you can't boot to multiuser mode.  You can, however, boot to single
> user mode with the root partition you tell the kernel as above.  After
> power-on, interrupt the 10 second count down, and at the boot loader
> prompt type:
> 
>     set root_disk_unit=1
>     boot /kernel -s
> 
> This should get you to the single user prompt, but with the root
> partition mounted read-only.  In order to remount the root partition
> read-write, you need to do two things.  First, run fsck(8) to clean up
> the file system and then run mount(8).  Catch22 is that both of those
> commands will use /etc/fstab as a database of filesystems to work on,
> unless you take care to avoid that.  Assuming that your root partition
> is on /dev/ad1s1a, run:
> 
>     # fsck /dev/ad1s1a
>     # mount -u -o rw -t ufs /dev/ad1s1a /
> 
> (Basically, you need to supply all required arguments to mount(8), to
> stop it going to /etc/fstab to try and look them up.)
> 
> Now you've got the root partition mounted read-write, you can edit the
> /etc/fstab file.  The tricky bit is that you only have the commands in
> /bin available to do the editing with (assuming that you've used the
> usual /, /usr partition layout).  That means that you now have to get
> down and dirty with ed(1) -- the Unix editor of last resort.  This
> command was originally designed for use on a teletype printer, so it
> doesn't show you a listing of the whole file and let you navigate
> around it in a natural way.  The command syntax is a bit intimidating
> to the uninitiated too.  You can see the ed(1) man page at
> 
>     http://www.freebsd.org/cgi/man.cgi?query=ed&apropos=0&sektion=0&manpath=FreeBSD+4.7-stable&format=html
> 
> Try this:
> 
> Nb. You type the lines marked '<--' in the ed session.
> 
>     # cd /etc
>     # cp fstab fstab.bak
>     # ed fstab
>     448                            (--> ed outputs the size of the file here)
>                                    (<-- hit return, to get the ? prompt)
>     ?                              (--> ed output)
>     ,s/ad2/ad1/g                   (<-- substitute 'ad1' for 'ad2' everywhere)
>     ,w                             (<-- write out the changed file)
>     448                            (--> ed tells you the modified file size)
>     q                              (<-- quit ed)
>     # cat fstab
> 
> Check the new contents of the fstab file for sanity.  If you're happy,
> then try and fsck and mount all your filesystems:
> 
>     # fsck -p
>     # mount -a
> 
> If that works satisfactorily, you're done, and you can just type
> 
>     # reboot
> 
> and the system *should* come up smoothly.




Thank you, Matthew. I tried as you said, but I couldn't pass the first
step. I got the message: "cannot boot /kernel, kernel module already
loaded" Of course I tried "kernel" and other variants. If I typed
"unload" and then what you said, I ended up with the prompt for the
manual file system feed. But I could boot with a kernel back up I had
and I made the modifications to the fstab file with a regular editor. My
doubt was that the slices still were called ads2s2a, etc., but I
supposed that that could change with the changes in the fstab file. I
knew that if something went wrong, I could not boot anymore from my back
up kernel, but I would get to the same request for a hand-input
filesystem and I would only had to specify ad2s2a. Well, nothing worked.
I cannot boot now. It seems to me that the utility to specify by hand
the filesystem either doesn't work or that I have a deeper problem here.
I am now tempted to get done with 4.8 and try 5.0. What do you think?


By the way, I tried the repair console, and just the first feel of it
made me step back.


Teilhard Knight
The Extraterrestrial

Who ate my sandwich?




More information about the freebsd-questions mailing list