From owner-freebsd-questions@FreeBSD.ORG Wed May 14 09:05:31 2003 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8E13337B404 for ; Wed, 14 May 2003 09:05:31 -0700 (PDT) Received: from babyruth.hotpop.com (babyruth.hotpop.com [204.57.55.14]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3BD8543F75 for ; Wed, 14 May 2003 09:05:30 -0700 (PDT) (envelope-from teilhk@Phreaker.net) Received: from phreaker.net (kubrick.hotpop.com [204.57.55.16]) by babyruth.hotpop.com (Postfix) with SMTP id 9D48D229B4F for ; Wed, 14 May 2003 16:05:25 +0000 (UTC) Received: from dsl-200-67-187-121.prodigy.net.mx (dsl-200-67-187-121.prodigy.net.mx [200.67.187.121]) by smtp-1.hotpop.com (Postfix) with ESMTP id 1A1781A00A5; Wed, 14 May 2003 16:05:19 +0000 (UTC) From: Teilhard Knight To: Matthew Seaman , FreeBSD In-Reply-To: <20030514093825.GB64005@happy-idiot-talk.infracaninophile.co.uk> References: <1052896702.3300.17.camel@arlette.love.dad> <20030514093825.GB64005@happy-idiot-talk.infracaninophile.co.uk> Content-Type: text/plain Organization: Message-Id: <1052928350.3342.20.camel@arlette.love.dad> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.4-1.1mdk Date: 14 May 2003 11:05:50 -0500 Content-Transfer-Encoding: 7bit X-HotPOP: ----------------------------------------------- Sent By HotPOP.com FREE Email Get your FREE POP email at www.HotPOP.com ----------------------------------------------- Subject: Re: About my problem X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 May 2003 16:05:32 -0000 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: > > > > mount using filesystem > > > > eg. ufs:/dev/da0s1a > > > > ? List valid disk boot devices > > > > 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?