[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Edits to `etc/resolv.conf` being overwritten
From: |
Bone Baboon |
Subject: |
Re: Edits to `etc/resolv.conf` being overwritten |
Date: |
Tue, 06 Apr 2021 17:41:33 -0400 |
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
> ")
- Edits to `etc/resolv.conf` being overwritten, Bone Baboon, 2021/04/01
- Re: Edits to `etc/resolv.conf` being overwritten, Jérémy Korwin-Zmijowski, 2021/04/02
- Re: Edits to `etc/resolv.conf` being overwritten, phil, 2021/04/02
- Re: Edits to `etc/resolv.conf` being overwritten, Bone Baboon, 2021/04/02
- Re: Edits to `etc/resolv.conf` being overwritten, Gary Johnson, 2021/04/02
- Re: Edits to `etc/resolv.conf` being overwritten,
Bone Baboon <=
- Re: Edits to `etc/resolv.conf` being overwritten, Gary Johnson, 2021/04/07
- Re: Edits to `etc/resolv.conf` being overwritten, Bone Baboon, 2021/04/08
- Re: Edits to `etc/resolv.conf` being overwritten, Vincent Legoll, 2021/04/08
- Re: Edits to `etc/resolv.conf` being overwritten, Bone Baboon, 2021/04/09
- Re: Edits to `etc/resolv.conf` being overwritten, Vincent Legoll, 2021/04/10
- Re: Edits to `etc/resolv.conf` being overwritten, Bone Baboon, 2021/04/10
- Re: Edits to `etc/resolv.conf` being overwritten, Vladimir Sedach, 2021/04/08
- Re: Edits to `etc/resolv.conf` being overwritten, Bone Baboon, 2021/04/09