From mboxrd@z Thu Jan 1 00:00:00 1970 From: Maxim Cournoyer Subject: bug#33517: Problem booting when using btrfs subvolume for /gnu/store Date: Fri, 06 Sep 2019 10:16:10 +0900 Message-ID: <878sr2xm05.fsf@gmail.com> References: <87mupva8j5.fsf@cbaines.net> <20190126235945.GP9163@krustig.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:58797) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i62s3-0003S9-FS for bug-guix@gnu.org; Thu, 05 Sep 2019 21:17:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i62s2-00081l-6A for bug-guix@gnu.org; Thu, 05 Sep 2019 21:17:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:55688) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i62s1-00081T-VB for bug-guix@gnu.org; Thu, 05 Sep 2019 21:17:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1i62s1-0002M4-Nt for bug-guix@gnu.org; Thu, 05 Sep 2019 21:17:01 -0400 Sender: "Debbugs-submit" Resent-Message-ID: In-Reply-To: <20190126235945.GP9163@krustig.localdomain> (Svante v. Erichsen's message of "Sun, 27 Jan 2019 00:59:45 +0100") 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: "Svante v. Erichsen" Cc: 33517@debbugs.gnu.org Hello, "Svante v. Erichsen" writes: > The subvolume and the mount point are independent issues. > > For example, I have a subvolume named @ as root volume: > > (file-system > (device "/dev/mapper/hd") > (mount-point "/") > (type "btrfs") > (options "compress=3Dlzo,ssd,subvol=3D@")) > > It also appears that the subvolume name must be prepended to the path as = if it > just was an ordinary directory (grub.cfg): > > =E2=80=A6 > linux /@/gnu/store/=E2=80=A6 > =E2=80=A6 > > I could not yet confirm this from documentation, but it works like that f= or me. > (I semi-manually edit the generated grub.cfg currently.) > > So, additionally to stripping the mount point, the subvolume needs to be > prepended (grub.scm): > > (let ((kernel (prepend-subvol device-subvol > (strip-mount-point device-mount-point > kernel))) > (initrd (prepend-subvol device-subvol > (strip-mount-point device-mount-point > initrd)))) > =E2=80=A6) > > This would mean that the menu-entry structure needs the subvol informatio= n. > However, I wouldn't want to parse this from the options field in the file= -system > entry, so I'd propose allowing a list there, maybe like this: > > (file-system > (device "/dev/mapper/hd") > (mount-point "/") > (type "btrfs") > (options '(("compress" . "lzo") > "ssd" > ("subvol" . "@")))) > > On the other hand, it might be surprising that declaring the options like= this > would work for subvols, while using a string doesn't, especially when som= e older > documentation/blogs/gists is still hanging around on the internet, so may= be it > would be necessary to parse the options anyway (to this list structure). > > I'm lacking experience in guix and guile, so making this work and submit = a patch > will take me some time. > > Do you think this is sensible? I had not seen this issue before implementing the solution, but it seems we've reached the same conclusion in that the entries of initrd and kernel of the Grub configuration need to be prepended with the subvolume name in order for Grub to successfully boot from a subvolume. My implementation differs a bit in that the subvolume name to be used in the Grub config is parsed from the kernel argument "rootflags=3D" value; the reasoning being that you'd have to specify it there anyway for the kernel to mount the root partition correctly (for non-root partitions, fstab (file-system fields) can take care of it alone). If anyone wants to give it a try, it's available to review here: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D37305. Maxim