Subject: bug#76688: closed (Re: [bug#76688] [PATCH] services: network-manager: Handle existing configuration directory.)

From: [email-masked] (GNU bug Tracking System)
Date: Sun, 23 Mar 2025 17:34:02 +0000

Your bug report

#76688: [PATCH] services: network-manager: Handle existing configuration directory.

which was filed against the guix-patches package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
76688: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=76688
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: [bug#76688] [PATCH] services: network-manager: Handle existing configuration directory.
From: Vagrant Cascadian <[email-masked]>
To: Maxim Cournoyer <[email-masked]>
Cc: [email-masked], Arnaud Daby-Seesaram <[email-masked]>, 45mg <[email-masked]>
Date: Sun, 23 Mar 2025 10:33:05 -0700
List-Id: <debbugs-submit.debbugs.gnu.org>

On 2025-03-22, Vagrant Cascadian wrote:
> On 2025-03-22, Maxim Cournoyer wrote:
>> Vagrant Cascadian <[email-masked]> writes:
>>> I hit this bug as well, and it actually caused a boot failure, had to
>>> boot to an older generation to get things working again!
>>>
>>> Have not yet tried the patch, though it looks like it should fix this
>>> exact problem...
>
> I did get a chance to test the patch, and it worked to allow me to
> reconfigure multiple times and still be able to reboot into the new
> generation.

Given that the patch is a few weeks old, and it is a relatively new
feature, and not having it can trigger a boot failure, I went ahead and
pushed as a1e87abaa364f8391cfd1f49bb01876f7a730bfb services:
network-manager: Handle existing configuration directory.

live well,
  vagrant

Subject: [PATCH] services: network-manager: Handle existing configuration directory.
From: 45mg <[email-masked]>
To: [email-masked]
Cc: 45mg <[email-masked]>
Date: Sun, 2 Mar 2025 23:59:49 +0530
List-Id: <debbugs-submit.debbugs.gnu.org>

* gnu/services/networking.scm (network-manager-activation):
Handle the case where /etc/NetworkManager/conf.d already exists.

Change-Id: I7af4f4ad226eef28bd8667f0708525e77a6a50c8
---
Follow-up to 0caba8f5db48c15a2c3edae37e816654246fa986.

This issue only became apparent after pulling the above commit, changing my
system config to use the new extra-files field, and reconfiguring /twice/. This
sort of thing is why I now pull from a local fork and apply patches to it before
submitting them ;)

 gnu/services/networking.scm | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm
index 53840c2764..45efea330b 100644
--- a/gnu/services/networking.scm
+++ b/gnu/services/networking.scm
@@ -1271,7 +1271,18 @@ (define (network-manager-activation config)
                '((mkdir-p "/var/lib/misc"))
                '())
         #$@(if (pair? extra-configuration-files)  ;if non-empty
-               `((symlink
+               ;; If /etc/NetworkManager/conf.d is a symlink to a store file,
+               ;; delete it.
+               `((if (and (file-exists? "/etc/NetworkManager/conf.d")
+                          (store-file-name?
+                           (canonicalize-path "/etc/NetworkManager/conf.d")))
+                     (delete-file-recursively
+                      "/etc/NetworkManager/conf.d"))
+                 ;; If it exists but is not a symlink to a store file, then
+                 ;; this will fail with EEXIST; we leave this for the user to
+                 ;; handle, since they probably created the directory
+                 ;; themselves.
+                 (symlink
                   ,(file-union "network-manager-configuration-directory"
                                extra-configuration-files)
                   "/etc/NetworkManager/conf.d"))

base-commit: f9dcb84550b85aa816899b2106b1a5ae546167a3
-- 
2.48.1