Subject: [bug#73494] [PATCH v6 2/3] services: cleanup: Bind mount /var/run to /run.

From: Maxim Cournoyer <[email-masked]>
Date: Thu, 08 May 2025 14:58:14 +0900

Hi Ludovic,

Ludovic Courtès <[email-masked]> writes:

[...]

>> @@ -662,17 +667,17 @@ (define (cleanup-gexp _)
>>                        "/lib/locale"))
>>             (setlocale LC_CTYPE "en_US.utf8")
>>             (delete-file-recursively "/tmp")
>> -           (delete-file-recursively "/var/run")
>> -           (delete-file-recursively "/run")
>>  
>>             ;; Note: The second argument to 'mkdir' is and'ed with umask,
>>             ;; hence the 'chmod' calls.
>>             (mkdir "/tmp" #o1777)
>>             (chmod "/tmp" #o1777)
>> -           (mkdir "/var/run" #o755)
>> -           (chmod "/var/run" #o755)
>> -           (mkdir "/run" #o755)
>> -           (chmod "/var/run" #o755))))))
>> +
>> +           ;; XXX: It'd be cleaner if we could simply register
>> +           ;; %runtime-variable-data/bind-mount in %base-file-systems, that
>> +           ;; fails with: 'statfs-raw: No such file or directory' when
>> +           ;; checking for "/run".
>> +           (mount-file-system %runtime-variable-data/bind-mount #:root "/"))))))
>
> Could you try to get a backtrace or something?
>
> ‘statfs-raw’ is the C primitive used by the statically-linked Guile in
> the initrd, so before shepherd is spawned.  Normally, upon error, you
> get a Guile prompt where you can type “,bt” for a backtrace.

I think perhaps it could be because the file-system 'dependencies' field
is not honored in the early boot? /run mount be mounted as tmpfs before
we can bind mount /var/run to it.

I'm not sure though, so I'll have to try what you suggest.

-- 
Thanks,
Maxim