Subject: bug#31889: Filesystems must not depend on device mappings?

From: Taylan Kammer <[email-masked]>
Date: Thu, 21 Jun 2018 20:44:42 +0200

[email-masked] (Ludovic Courtès) writes:

> Hi!
>
> Taylan Ulrich "Bayırlı/Kammer" <[email-masked]> skribis:
>
>> If in my OS config I define some luks mappings, and define the
>> corresponding filesystems with dependencies on the mapped devices,
>> I get an error on 'guix system reconfigure'.
>>
>> Example:
>>
>>   (operating-system
>>     ...
>>     (mapped-devices
>>       (list (mapped-device ... (target "root"))))
>>     (file-systems
>>       (list (file-system (mount-point "/")
>>                          ...
>>                          (dependencies mapped-devices))))
>>     ...)
>>
>> This will yield an error like:
>>
>>   file-system-/ depends on device-mapping-root, which is not
>>   provided by any service
>
> Could you show the complete ‘mapped-devices’ and ‘file-systems’ fields,
> without ellipses?
>
> The message above suggests that “/” was not considered as
> needed-for-boot.
>
> Thanks,
> Ludo’.

Sorry, looks like my example was wrong.  Here is a problematic OS
declaration:

    (operating-system
     (host-name "guixsd")
     (timezone "Europe/Berlin")
     (locale "en_US.utf8")
     
     (bootloader
      (bootloader-configuration
       (bootloader grub-bootloader)
       (target "/dev/sda")))
     
     (mapped-devices
      (list (mapped-device
             (source (uuid "b3d059f8-1c4f-4569-88dd-5485825b4373"))
             (target "guixsd")
             (type luks-device-mapping))
            (mapped-device
             (source (uuid "550d9258-bbbb-488c-af27-6b1fefa190ee"))
             (target "home")
             (type luks-device-mapping))))
     
     (file-systems
      (append
       (list (file-system
              (device "/dev/mapper/guixsd")
              (mount-point "/")
              (type "ext4")
              (dependencies mapped-devices))
             (file-system
              (device "/dev/mapper/home")
              (mount-point "/home")
              (type "ext4")
              (dependencies mapped-devices)))
       %base-file-systems))
     
     (users
      (append
       (list (user-account
              (name "taylan")
              (comment "Taylan Kammer")
              (group "users")
              (supplementary-groups '("wheel" "netdev" "audio" "video"))
              (home-directory "/home/taylan")))
       %base-user-accounts))
     
     (packages %base-packages)
     (services %desktop-services)
     
     ;; Allow resolution of '.local' host names with mDNS.
     (name-service-switch %mdns-host-lookup-nss))

It results in the error message:

    guix system: error: service 'file-system-/home' requires
    'device-mapping-home', which is not provided by any service

(I also got that for '/' rather than '/home' at some point, but can't
remember under what conditions.)

It works when both '(dependencies mapped-devices)' clauses are simply
removed.

All in all I can't really figure out the logic behind the whole thing
and what exactly is expected.  I think the error reporting and relevant
section of the documentation may need some improvement.

Taylan