From owner-freebsd-current@FreeBSD.ORG Thu Oct 18 15:20:23 2012 Return-Path: Delivered-To: freebsd-current@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 892C5CA8; Thu, 18 Oct 2012 15:20:23 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 999848FC14; Thu, 18 Oct 2012 15:20:22 +0000 (UTC) Received: from odyssey.starpoint.kiev.ua (alpha-e.starpoint.kiev.ua [212.40.38.101]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id SAA20157; Thu, 18 Oct 2012 18:20:19 +0300 (EEST) (envelope-from avg@FreeBSD.org) Message-ID: <50801E32.80309@FreeBSD.org> Date: Thu, 18 Oct 2012 18:20:18 +0300 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:16.0) Gecko/20121014 Thunderbird/16.0.1 MIME-Version: 1.0 To: Alexander Yerenkow Subject: Re: A little question about safe mode References: <507FB6C7.50402@FreeBSD.org> <507FEC7F.4030306@FreeBSD.org> In-Reply-To: X-Enigmail-Version: 1.4.5 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: freebsd-current X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Oct 2012 15:20:23 -0000 on 18/10/2012 16:50 Alexander Yerenkow said the following: > > > 2012/10/18 Andriy Gapon > > > on 18/10/2012 12:11 Alexander Yerenkow said the following: > > 2012/10/18 Andriy Gapon > >> > > > > > > First, I see "safe mode" mentioned in the subject, but nowhere in the > body of > > the message? So, what's up with the safe mode? :-) > > > > > > The single mode of course, which is forced :) Mistype, sorry. > > I missed this part - what do you mean by "forced"? > You can send the screenshots (as links). > > > Here are screenshots, step-by step. > http://imageshack.us/photo/my-images/407/sc1y.png/ > http://imageshack.us/photo/my-images/90/sc2xs.png/ > http://imageshack.us/photo/my-images/713/sc3y.png/ > http://imageshack.us/photo/my-images/213/sc4h.png/ I am curious would happen if you tried "mount -uw /" again... Note how mount(8) with no options first reported ada0s1a on / (...) and later /dev/ada0s1a on / (...) I think that the above information also explains why rc.d/root failed with the following diagnostic: mount: ada0s1a: No such file or directory Mounting root filesystem rw failed, startup aborted Here is a simple explanation without going into details. When the kernel is about to mount a root filesystem, it first mounts devfs at / and also creates /dev symlink to /. Because of this, both device names with /dev/ "prefix" and device names without it can be correctly resolved without any additional magic. E.g., at mountroot prompt you can specify either ufs:ada0s1a or ufs:/dev/ada0s1a and both should work. The problem, is that the device name will get recorded in the mount structures verbatim. Later, after the kernel has mounted the real root filesystem it also moves devfs to its proper /dev place. So only full paths correctly work from that point on. I am not sure if mount(8) is supposed to prepend "/dev/" if I use a command line like this: mount ada5s3e /some/path But it definitely does not do any prepending if "ada0s1a" is already recorded in f_mntfromname. My guess is that the easiest way to avoid this ambiguity and the confusion that it causes (like the problem you described above) is to prepend "/dev/", if it's missing, right in vfs_mountroot.c before calling kernel_mount(). In any case, this issue should be very rare in practice. -- Andriy Gapon