From mboxrd@z Thu Jan 1 00:00:00 1970 From: Guillaume Le Vaillant Subject: bug#38435: BTRFS open_ctree failed Date: Sat, 30 Nov 2019 17:01:08 +0100 Message-ID: <87sgm5nykb.fsf@yamatai> References: <20191130144539.218179f0@riseup.net> <87tv6lo1pk.fsf@yamatai> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:54915) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ib5C7-0007Nm-1U for bug-guix@gnu.org; Sat, 30 Nov 2019 11:02:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ib5C5-0006vW-T4 for bug-guix@gnu.org; Sat, 30 Nov 2019 11:02:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:57369) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ib5C5-0006vS-Pd for bug-guix@gnu.org; Sat, 30 Nov 2019 11:02:01 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ib5C5-0004fV-Ns for bug-guix@gnu.org; Sat, 30 Nov 2019 11:02:01 -0500 Sender: "Debbugs-submit" Resent-Message-ID: In-reply-to: <87tv6lo1pk.fsf@yamatai> List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: "bug-Guix" To: 38435@debbugs.gnu.org Guillaume Le Vaillant skribis: > raingloom skribis: > >> This is what I get after a recent `guix system reconfigure` : >> Scanning for Btrfs filesystems >> [ 2.342790] BTRFS error (device sda1): open_ctree failed >> >> Previous profiles work, I haven't modified anything about my config.scm >> between them. >> >> [...] >> >> >> Contents of /etc/profile.scm: >> >> [...] >> >> (file-systems (cons* (file-system >> (device (file-system-label "GUIX")) >> (mount-point "/") >> (options "lazytime,compress") >> (type "btrfs")) >> ;(file-system >> ; (device (uuid "1234-ABCD" 'fat)) >> ; (mount-point "/boot/efi") >> ; (type "vfat")) >> %base-file-systems)) >> > > I just tried adding the 'lazytime' option to my root file system, and > I got the same error as you when booting. Could you try removing it and > see if it works? > > Until recently, the options declared in 'file-system' records were > always ignored when mounting the root file system. Now they are taken > into consideration, and I think it reveals a bug in the way file systems > are mounted. If some options like 'lazytime' or 'defaults' are declared > in a 'file-system' record (root file system or not), mounting it fails. > However some other options like 'compress' or 'autodefrag' work fine. > > I suspect Guix adds some options by default when trying to mount file > systems, and maybe we end up with conflicting options or doubled options > that cause problems. Apparently, Guix uses the 'mount' system call directly to mount file systems (c.f. 'guix/build/syscalls.scm'), and passes all the options declared in the 'file-system' records in the 'data' argument. However the man page for mount(2) indicates: --8<---------------cut here---------------start------------->8--- int mount(const char *source, const char *target, const char *filesystemtype, unsigned long mountflags, const void *data); [...] The data argument is interpreted by the different filesystems. Typically it is a string of comma-separated options understood by this filesystem. See mount(8) for details of the options available for each filesystem type. --8<---------------cut here---------------end--------------->8--- If I understand correcly, the generic options (e.g. 'lazytime') must be passed in 'mountflags', and the options specific to the file system (e.g. 'compress') must be passed in 'data'. This would mean that before calling the 'mount' system call, we must remove the generic options from the 'options' variable (which is then passed in 'data'), and add their corresponding flags to the 'flags' variable (which is then passed in 'mountflags'). What do you think?