From owner-freebsd-bugs@FreeBSD.ORG Wed Nov 28 04:20:02 2007 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AA94616A468 for ; Wed, 28 Nov 2007 04:20:02 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 9B31A13C465 for ; Wed, 28 Nov 2007 04:20:02 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.2/8.14.2) with ESMTP id lAS4K2xI054441 for ; Wed, 28 Nov 2007 04:20:02 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.2/8.14.1/Submit) id lAS4K2Ig054440; Wed, 28 Nov 2007 04:20:02 GMT (envelope-from gnats) Date: Wed, 28 Nov 2007 04:20:02 GMT Message-Id: <200711280420.lAS4K2Ig054440@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: Bruce Evans Cc: Subject: Re: misc/118160: unable to mount / rw while booting 7.0-BETA3 X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Bruce Evans List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Nov 2007 04:20:02 -0000 The following reply was made to PR bin/118160; it has been noted by GNATS. From: Bruce Evans To: Yuri Cc: Bruce Evans , Yuri , freebsd-gnats-submit@freebsd.org, freebsd-bugs@freebsd.org Subject: Re: misc/118160: unable to mount / rw while booting 7.0-BETA3 Date: Wed, 28 Nov 2007 15:19:12 +1100 (EST) On Tue, 27 Nov 2007, Yuri wrote: >>> While booting log says: >>> Starting file system checks: >>> >>> mount: : Operation not permitted. >> >> This is probably a secondary problem. You apparently have the root device >> mounted on "" or something like that. >> What does mount shouw for the root device? >> > No, when I get to shell after this failure during the normal boot process > mount shows: > /dev/ad12s1c / (ufs,local,read-only) > swapinfo shows that swap volume is /dev/ad12s1b Using the 'c' partition is normally an error. Here it is a very large error. ad12s1b overlaps ad12s1c, so if swap on ad12s1b is actually used then it will normally clobber the file system on ad12s1c. It might be possible to make the clobbering harmless, e.g., by putting ad12s1b at the end of ad12s1c and not using all of ad12s1c for the file system, but this is harder to configure than a normal configuration and is supposed to be disallowed. > ... > Also I found that swapon and mount are related in my case. Once swapon is done > I can't remount root as r/w. And vice versa, when mount -uw is done swapon > returns EPERM. > > This happens when I boot as single user. When I do swapon consecutive > 'mount -uw ' fails. When I do 'mount -uw' consecutive swapon fails. > So I don't have swap at all since this command failed during boot. This misbehaviour seems to be a result of the disallowment not being complete. Mounted file systems normally have exclusive write access to their device. However, for early root mounts, while the mount is only r/o, exclusive write access is given up so that fsck can work. There seems to be no exclusivity at all, so swapon on a different but overlapping device is granted write access. Then while swapon is on, it holds exclusive write access and r/w mounts of root are denied (correctly except for the wrong errno and other misleading things in the error message). Also, after the root mount becomes r/w, swapon fails (correctly except for the wrong errno). Bruce