* Edits to `etc/resolv.conf` being overwritten @ 2021-04-02 1:36 Bone Baboon 2021-04-02 4:57 ` Jérémy Korwin-Zmijowski 2021-04-02 7:43 ` phil 0 siblings, 2 replies; 14+ messages in thread From: Bone Baboon @ 2021-04-02 1:36 UTC (permalink / raw) To: help-guix Any suggestion on how to stop my edits of `etc/resolv.conf` from being overwritten? `/etc/resolv.conf` is being overwritten removing changes I save to it. My edits to `etc/resolv.conf` specify some name servers. Some time after my edits are saved the file is completely rewritten to it's original contents before I made my edits. The original contents include nameserver, domain and search for my internet service provider's DNS. When I run `sudo herd status` it outputs: ``` Started: + console-font-tty1 + console-font-tty2 + console-font-tty3 + console-font-tty4 + console-font-tty5 + console-font-tty6 + dbus-system + elogind + file-system-/dev/pts + file-system-/dev/shm + file-system-/gnu/store + file-system-/run/systemd + file-system-/run/user + file-system-/sys/firmware/efi/efivars + file-system-/sys/fs/cgroup + file-system-/sys/fs/cgroup/blkio + file-system-/sys/fs/cgroup/cpu + file-system-/sys/fs/cgroup/cpuacct + file-system-/sys/fs/cgroup/cpuset + file-system-/sys/fs/cgroup/devices + file-system-/sys/fs/cgroup/elogind + file-system-/sys/fs/cgroup/freezer + file-system-/sys/fs/cgroup/memory + file-system-/sys/fs/cgroup/perf_event + file-system-/sys/fs/cgroup/pids + file-system-/sys/kernel/debug + file-systems + guix-daemon + loopback + mcron + nscd + root + root-file-system + swap-/swapfile + syslogd + term-tty1 + term-tty2 + term-tty3 + term-tty4 + term-tty5 + term-tty6 + udev + urandom-seed + user-file-systems + user-processes + virtual-terminal Stopped: - term-auto One-shot: * host-name * sysctl * user-homes ``` ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Edits to `etc/resolv.conf` being overwritten 2021-04-02 1:36 Edits to `etc/resolv.conf` being overwritten Bone Baboon @ 2021-04-02 4:57 ` Jérémy Korwin-Zmijowski 2021-04-02 7:43 ` phil 1 sibling, 0 replies; 14+ messages in thread From: Jérémy Korwin-Zmijowski @ 2021-04-02 4:57 UTC (permalink / raw) To: help-guix, Bone Baboon Hey Bone ! If I am right: you have to set the content of /etc/resolv.conf in your system configuration file. Anytime you reconfigure the system this file is regenerated based on your system configuration. Jérémy -- Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté. ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Edits to `etc/resolv.conf` being overwritten 2021-04-02 1:36 Edits to `etc/resolv.conf` being overwritten Bone Baboon 2021-04-02 4:57 ` Jérémy Korwin-Zmijowski @ 2021-04-02 7:43 ` phil 2021-04-02 13:08 ` Bone Baboon 1 sibling, 1 reply; 14+ messages in thread From: phil @ 2021-04-02 7:43 UTC (permalink / raw) To: help-guix, Bone Baboon I found when using GuixSD with Gnome that the network manager would periodically overwrite my DNS changes made directly to resolv.conf. If you experience this issue it should leave a comment on the first line. I was able to make it work by changing it through Gnome's Settings GUI, rather than editing the file myself. Even then I have to disable and re-enable the network interface for the new settings to take effect. -----Original Message----- From: Bone Baboon <bone.baboon@disroot.org> To: help-guix@gnu.org Sent: Fri, 02 Apr 2021 2:37 Subject: Edits to `etc/resolv.conf` being overwritten Any suggestion on how to stop my edits of `etc/resolv.conf` from being overwritten? `/etc/resolv.conf` is being overwritten removing changes I save to it. My edits to `etc/resolv.conf` specify some name servers. Some time after my edits are saved the file is completely rewritten to it's original contents before I made my edits. The original contents include nameserver, domain and search for my internet service provider's DNS. When I run `sudo herd status` it outputs: ``` Started: + console-font-tty1 + console-font-tty2 + console-font-tty3 + console-font-tty4 + console-font-tty5 + console-font-tty6 + dbus-system + elogind + file-system-/dev/pts + file-system-/dev/shm + file-system-/gnu/store + file-system-/run/systemd + file-system-/run/user + file-system-/sys/firmware/efi/efivars + file-system-/sys/fs/cgroup + file-system-/sys/fs/cgroup/blkio + file-system-/sys/fs/cgroup/cpu + file-system-/sys/fs/cgroup/cpuacct + file-system-/sys/fs/cgroup/cpuset + file-system-/sys/fs/cgroup/devices + file-system-/sys/fs/cgroup/elogind + file-system-/sys/fs/cgroup/freezer + file-system-/sys/fs/cgroup/memory + file-system-/sys/fs/cgroup/perf_event + file-system-/sys/fs/cgroup/pids + file-system-/sys/kernel/debug + file-systems + guix-daemon + loopback + mcron + nscd + root + root-file-system + swap-/swapfile + syslogd + term-tty1 + term-tty2 + term-tty3 + term-tty4 + term-tty5 + term-tty6 + udev + urandom-seed + user-file-systems + user-processes + virtual-terminal Stopped: - term-auto One-shot: * host-name * sysctl * user-homes ``` ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Edits to `etc/resolv.conf` being overwritten 2021-04-02 7:43 ` phil @ 2021-04-02 13:08 ` Bone Baboon 2021-04-02 16:07 ` Gary Johnson 0 siblings, 1 reply; 14+ messages in thread From: Bone Baboon @ 2021-04-02 13:08 UTC (permalink / raw) To: phil; +Cc: help-guix In this case I am not using Gnome or NetworkManager. There are no comment on the first line of `resolv.conf`. I am connecting to the internet using `wpa_supplicant` and `dhclient`. phil@beadling.co.uk writes: > I found when using GuixSD with Gnome that the network manager would > periodically overwrite my DNS changes made directly to resolv.conf. > > If you experience this issue it should leave a comment on the first line. > > I was able to make it work by changing it through Gnome's Settings > GUI, rather than editing the file myself. Even then I have to disable > and re-enable the network interface for the new settings to take > effect. > > -----Original Message----- > From: Bone Baboon <bone.baboon@disroot.org> > To: help-guix@gnu.org > Sent: Fri, 02 Apr 2021 2:37 > Subject: Edits to `etc/resolv.conf` being overwritten > > Any suggestion on how to stop my edits of `etc/resolv.conf` from being > overwritten? > > `/etc/resolv.conf` is being overwritten removing changes I save to it. > My edits to `etc/resolv.conf` specify some name servers. Some time > after my edits are saved the file is completely rewritten to it's > original contents before I made my edits. The original contents include > nameserver, domain and search for my internet service provider's DNS. ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Edits to `etc/resolv.conf` being overwritten 2021-04-02 13:08 ` Bone Baboon @ 2021-04-02 16:07 ` Gary Johnson 2021-04-06 21:41 ` Bone Baboon 0 siblings, 1 reply; 14+ messages in thread From: Gary Johnson @ 2021-04-02 16:07 UTC (permalink / raw) To: Bone Baboon; +Cc: phil, help-guix Bone Baboon <bone.baboon@disroot.org> writes: >> Any suggestion on how to stop my edits of `etc/resolv.conf` from being >> overwritten? >> >> `/etc/resolv.conf` is being overwritten removing changes I save to it. >> My edits to `etc/resolv.conf` specify some name servers. Some time >> after my edits are saved the file is completely rewritten to it's >> original contents before I made my edits. The original contents include >> nameserver, domain and search for my internet service provider's DNS. When running Guix System, your OS configuration is meant to be fully derived from evaluating your `operating-system` definition. This means, in particular, that you should not manually edit any files outside of your home directories (i.e., /root and /home/*). This includes, of course, any files under /etc. Instead, any custom changes that you want to see under /etc need to be included in your `operating-system` definition. The way to do this depends on the change you want to make. For example, if you want to edit /etc/sudoers, you should include this field in your `operating-system` definition (on the same level as `packages`, `services`, and so on): (sudoers-file (plain-file "sudoers" my-sudoers)) Then remember to define `my-sudoers` somewhere above the `operating-system` form. Here's an example: (define my-sudoers "root ALL=(ALL) ALL %wheel ALL=(ALL) ALL ") Similarly, if you want to modify /etc/hosts, you add this to `operating-system`: (hosts-file (plain-file "hosts" (string-append (local-host-aliases host-name) my-host-aliases))) And again define my-host-aliases somewhere above `operating-system`: (define my-host-aliases " # Some Servers 123.123.123.100 foo 123.123.123.101 bar 123.123.123.102 baz ") Most other files under /etc are managed by different services. You should review the "Guix Services" section of the info pages to find the appropriate service for whatever files you want to modify. As of today, I'm not aware of a Guix service that modifies /etc/resolv.conf other than the network-manager-service-type (which is what I use on my system). However, if you are not using NetworkManager and want to manually set the values in /etc/resolv.conf such that they persist across calls to `guix system reconfigure`, you should add this form to the `services` list in your `operating-system` definition: (simple-service 'resolv-service etc-service-type `(("resolv.conf" ,(plain-file "resolv.conf" my-resolv.conf)))) And finally remember to define `my-resolv.conf` above `operating-system`: (define my-resolv.conf "# Generated by Guix! nameserver 255.255.255.1 nameserver ffff:ffff:ffff::1 ") Have fun and happy hacking! Gary -- GPG Key ID: 7BC158ED Use `gpg --search-keys lambdatronic' to find me Protect yourself from surveillance: https://emailselfdefense.fsf.org ======================================================================= () ascii ribbon campaign - against html e-mail /\ www.asciiribbon.org - against proprietary attachments Why is HTML email a security nightmare? See https://useplaintext.email/ Please avoid sending me MS-Office attachments. See http://www.gnu.org/philosophy/no-word-attachments.html ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Edits to `etc/resolv.conf` being overwritten 2021-04-02 16:07 ` Gary Johnson @ 2021-04-06 21:41 ` Bone Baboon 2021-04-07 14:34 ` Gary Johnson 0 siblings, 1 reply; 14+ messages in thread From: Bone Baboon @ 2021-04-06 21:41 UTC (permalink / raw) To: Gary Johnson; +Cc: help-guix Thank you for the explanation and detailed examples. I now have my system configuration providing the contents of `/etc/resolv.conf` with a service. However the contents of `/etc/resolv.conf` is still being overwritten with entries for my internet service provider's DNS. After some testing it appears to be happening when I run this command `sudo dhclient <wireless-interface>`. I also appreciate the `hosts-file` example you shared as I am thinking about using `https://github.com/StevenBlack/hosts` as a block list. In this case the contents of `my-host-aliases` would be very large. With Guile how would I have the definition of `my-host-aliases` in it's own file and import and use it in my system configuration? Gary Johnson writes: > When running Guix System, your OS configuration is meant to be fully > derived from evaluating your `operating-system` definition. This > means, in particular, that you should not manually edit any files > outside of your home directories (i.e., /root and /home/*). This > includes, of course, any files under /etc. > > Instead, any custom changes that you want to see under /etc need to be > included in your `operating-system` definition. The way to do this > depends on the change you want to make. > > For example, if you want to edit /etc/sudoers, you should include this > field in your `operating-system` definition (on the same level as > `packages`, `services`, and so on): > > (sudoers-file (plain-file "sudoers" my-sudoers)) > > Then remember to define `my-sudoers` somewhere above the > `operating-system` form. Here's an example: > > (define my-sudoers > "root ALL=(ALL) ALL > %wheel ALL=(ALL) ALL > ") > > Similarly, if you want to modify /etc/hosts, you add this to `operating-system`: > > (hosts-file (plain-file "hosts" > (string-append (local-host-aliases host-name) > my-host-aliases))) > > And again define my-host-aliases somewhere above `operating-system`: > > (define my-host-aliases > " > # Some Servers > 123.123.123.100 foo > 123.123.123.101 bar > 123.123.123.102 baz > ") > > Most other files under /etc are managed by different services. You > should review the "Guix Services" section of the info pages to find > the appropriate service for whatever files you want to modify. > > As of today, I'm not aware of a Guix service that modifies > /etc/resolv.conf other than the network-manager-service-type (which is > what I use on my system). > > However, if you are not using NetworkManager and want to manually set > the values in /etc/resolv.conf such that they persist across calls to > `guix system reconfigure`, you should add this form to the `services` > list in your `operating-system` definition: > > (simple-service 'resolv-service > etc-service-type > `(("resolv.conf" ,(plain-file "resolv.conf" my-resolv.conf)))) > > And finally remember to define `my-resolv.conf` above `operating-system`: > > (define my-resolv.conf > "# Generated by Guix! > nameserver 255.255.255.1 > nameserver ffff:ffff:ffff::1 > ") ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Edits to `etc/resolv.conf` being overwritten 2021-04-06 21:41 ` Bone Baboon @ 2021-04-07 14:34 ` Gary Johnson 2021-04-08 19:07 ` Bone Baboon 0 siblings, 1 reply; 14+ messages in thread From: Gary Johnson @ 2021-04-07 14:34 UTC (permalink / raw) To: Bone Baboon; +Cc: help-guix Bone Baboon <bone.baboon@disroot.org> writes: > Thank you for the explanation and detailed examples. > > I now have my system configuration providing the contents of > `/etc/resolv.conf` with a service. > > However the contents of `/etc/resolv.conf` is still being overwritten > with entries for my internet service provider's DNS. After some testing > it appears to be happening when I run this command `sudo dhclient > <wireless-interface>`. That's unfortunate to hear. Perhaps you could check out the network-manager-service-type? I believe it includes a parameter that lets you tell NetworkManager not to overwrite /etc/resolv.conf. The command-line interface for NetworkManager is called nmtui. This is what I use on my machine. > I also appreciate the `hosts-file` example you shared as I am thinking > about using `https://github.com/StevenBlack/hosts` as a block list. In > this case the contents of `my-host-aliases` would be very large. With > Guile how would I have the definition of `my-host-aliases` in it's own > file and import and use it in my system configuration? (use-modules (ice-9 rdelim)) (define my-host-aliases (with-input-from-file "/path/to/your/file" (lambda () (read-delimited "")))) Happy hacking, Gary -- GPG Key ID: 7BC158ED Use `gpg --search-keys lambdatronic' to find me Protect yourself from surveillance: https://emailselfdefense.fsf.org ======================================================================= () ascii ribbon campaign - against html e-mail /\ www.asciiribbon.org - against proprietary attachments Why is HTML email a security nightmare? See https://useplaintext.email/ Please avoid sending me MS-Office attachments. See http://www.gnu.org/philosophy/no-word-attachments.html ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Edits to `etc/resolv.conf` being overwritten 2021-04-07 14:34 ` Gary Johnson @ 2021-04-08 19:07 ` Bone Baboon 2021-04-08 19:17 ` Vincent Legoll 2021-04-09 3:22 ` Vladimir Sedach 0 siblings, 2 replies; 14+ messages in thread From: Bone Baboon @ 2021-04-08 19:07 UTC (permalink / raw) To: Gary Johnson; +Cc: help-guix Gary Johnson writes: > That's unfortunate to hear. Perhaps you could check out the > network-manager-service-type? I believe it includes a parameter that > lets you tell NetworkManager not to overwrite /etc/resolv.conf. The > command-line interface for NetworkManager is called nmtui. This is what > I use on my machine. I do not have NetworkManager installed and am not using `network-manager-service-type`. There is no NetworkManager service listed when I run `sudo herd status`. The commands I am using to connect to the internet are: ``` sudo ip link set <wireless-interface> up sudo wpa_supplicant -Dnl80211 -i<wireless-interface> -c/path/to/wpa/config.conf -B sudo dhclient <wireless-interface> ``` It is almost like `sudo dhclient <wireless-interface>` is taking instruction from the router (provided by my internet service provider) to overwrite `/etc/resolv.conf` to the DNS of my internet service provider. > (use-modules (ice-9 rdelim)) > > (define my-host-aliases (with-input-from-file "/path/to/your/file" > (lambda () (read-delimited "")))) Thank you for sharing this. It works for me. ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Edits to `etc/resolv.conf` being overwritten 2021-04-08 19:07 ` Bone Baboon @ 2021-04-08 19:17 ` Vincent Legoll 2021-04-10 3:40 ` Bone Baboon 2021-04-09 3:22 ` Vladimir Sedach 1 sibling, 1 reply; 14+ messages in thread From: Vincent Legoll @ 2021-04-08 19:17 UTC (permalink / raw) To: Bone Baboon; +Cc: help-guix Hello, On Thu, Apr 8, 2021 at 9:08 PM Bone Baboon <bone.baboon@disroot.org> wrote: > It is almost like `sudo dhclient <wireless-interface>` is taking > instruction from the router (provided by my internet service provider) > to overwrite `/etc/resolv.conf` to the DNS of my internet service > provider. I'd try the "-R" command line option without giving "domain-name-servers" See details in the dhclient's man page -- Vincent Legoll ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Edits to `etc/resolv.conf` being overwritten 2021-04-08 19:17 ` Vincent Legoll @ 2021-04-10 3:40 ` Bone Baboon 2021-04-10 9:23 ` Vincent Legoll 0 siblings, 1 reply; 14+ messages in thread From: Bone Baboon @ 2021-04-10 3:40 UTC (permalink / raw) To: Vincent Legoll; +Cc: help-guix Vincent Legoll writes: > I'd try the "-R" command line option without giving "domain-name-servers" > > See details in the dhclient's man page Thank you for the suggestion. Reading dhclient's man page it looks like `-R` is related to IPV6. I have IPV6 disabled. When I try running `sudo dhclient -R <wireless-interface>` no IP address is assigned to the interface. ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Edits to `etc/resolv.conf` being overwritten 2021-04-10 3:40 ` Bone Baboon @ 2021-04-10 9:23 ` Vincent Legoll 2021-04-10 19:50 ` Bone Baboon 0 siblings, 1 reply; 14+ messages in thread From: Vincent Legoll @ 2021-04-10 9:23 UTC (permalink / raw) To: Bone Baboon; +Cc: help-guix Hello, On Sat, Apr 10, 2021 at 5:40 AM Bone Baboon <bone.baboon@disroot.org> wrote: > Vincent Legoll writes: > > I'd try the "-R" command line option without giving "domain-name-servers" > > > > See details in the dhclient's man page > > Thank you for the suggestion. Reading dhclient's man page it looks like > `-R` is related to IPV6. I have IPV6 disabled. Sorry, I just looked at the first hit for "dhclient man", which is not the same as what "man dhclient" gives on guix (and on others distros also) :facepalm: I'm not seeing mention of IPv6 in "-R" text from : https://linux.die.net/man/8/dhclient But you're right that this was a wrong suggestion. Let me try again : Have a look at the "LEASE REQUIREMENTS AND REQUESTS" section from man dhclient.conf, you should be able to make it *NOT* require "name-servers"... Hopefully this time, the suggestion will be right... -- Vincent Legoll ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Edits to `etc/resolv.conf` being overwritten 2021-04-10 9:23 ` Vincent Legoll @ 2021-04-10 19:50 ` Bone Baboon 0 siblings, 0 replies; 14+ messages in thread From: Bone Baboon @ 2021-04-10 19:50 UTC (permalink / raw) To: Vincent Legoll; +Cc: help-guix Vincent Legoll writes: > Have a look at the "LEASE REQUIREMENTS AND REQUESTS" > section from man dhclient.conf, you should be able to make > it *NOT* require "name-servers"... Thanks you for this helpful suggestion. After looking at the section you pointed out in man page for dhclient.conf I have come up with something that stops `sudo dhclient <wireless-interface>` from overwriting `/etc/resolv.conf`. This approach also allows the system configuration to manage the contents of `/etc/resolv.conf` which is an improvement over using `chattr +i /etc/resolv.conf` which did not. Relevant sections of system configuration are: At the top level outside the `operating-system` definition. ``` (define dhclient-configuration "request subnet-mask, broadcast-address, time-offsets, routers, host-name; ") ``` Note: These were deliberately excluded from `request`: `domain-name`, `domain-name-servers`, `name-servers` and `domain-search`. A service in the services definition. ``` (simple-service 'dhclient-service etc-service-type `(("dhclient.conf", (plain-file "dhclient.conf" dhclient-configuration)))) ``` ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Edits to `etc/resolv.conf` being overwritten 2021-04-08 19:07 ` Bone Baboon 2021-04-08 19:17 ` Vincent Legoll @ 2021-04-09 3:22 ` Vladimir Sedach 2021-04-10 3:28 ` Bone Baboon 1 sibling, 1 reply; 14+ messages in thread From: Vladimir Sedach @ 2021-04-09 3:22 UTC (permalink / raw) To: Bone Baboon; +Cc: help-guix Bone Baboon <bone.baboon@disroot.org> writes: > It is almost like `sudo dhclient <wireless-interface>` is taking > instruction from the router (provided by my internet service provider) > to overwrite `/etc/resolv.conf` to the DNS of my internet service > provider. That is in fact what dhclient does. There is a list of workarounds on Debian Wiki: https://wiki.debian.org/resolv.conf I use the file attribute one on my Debian system. The ideal solution is to re-implement dhclient in Guile, and make it a configurable alternative to dhcp-client-service-type. That would be a lot of work though. -- Vladimir Sedach Software engineering services in Los Angeles https://oneofus.la ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Edits to `etc/resolv.conf` being overwritten 2021-04-09 3:22 ` Vladimir Sedach @ 2021-04-10 3:28 ` Bone Baboon 0 siblings, 0 replies; 14+ messages in thread From: Bone Baboon @ 2021-04-10 3:28 UTC (permalink / raw) To: Vladimir Sedach; +Cc: help-guix Vladimir Sedach writes: > That is in fact what dhclient does. There is a list of workarounds on > Debian Wiki: > > https://wiki.debian.org/resolv.conf > > I use the file attribute one on my Debian system. > > The ideal solution is to re-implement dhclient in Guile, and make it > a configurable alternative to dhcp-client-service-type. That would be > a lot of work though. Thank you for sharing that link. I tried the methods mentioned and the one that worked for me was to use `chattr +i /etc/resolv.conf`. Using this approach required me to stop having my system configuration manage the contents of `/etc/resolv.conf`. ^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2021-04-10 19:51 UTC | newest] Thread overview: 14+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2021-04-02 1:36 Edits to `etc/resolv.conf` being overwritten Bone Baboon 2021-04-02 4:57 ` Jérémy Korwin-Zmijowski 2021-04-02 7:43 ` phil 2021-04-02 13:08 ` Bone Baboon 2021-04-02 16:07 ` Gary Johnson 2021-04-06 21:41 ` Bone Baboon 2021-04-07 14:34 ` Gary Johnson 2021-04-08 19:07 ` Bone Baboon 2021-04-08 19:17 ` Vincent Legoll 2021-04-10 3:40 ` Bone Baboon 2021-04-10 9:23 ` Vincent Legoll 2021-04-10 19:50 ` Bone Baboon 2021-04-09 3:22 ` Vladimir Sedach 2021-04-10 3:28 ` Bone Baboon
Code repositories for project(s) associated with this external index https://git.savannah.gnu.org/cgit/guix.git This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.