* bug#22962: Something keeps overwriting /etc/hosts
@ 2016-03-09 20:42 Danny Milosavljevic
2016-03-09 23:28 ` Danny Milosavljevic
0 siblings, 1 reply; 4+ messages in thread
From: Danny Milosavljevic @ 2016-03-09 20:42 UTC (permalink / raw)
To: 22962
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#22962: Something keeps overwriting /etc/hosts
2016-03-09 20:42 bug#22962: Something keeps overwriting /etc/hosts Danny Milosavljevic
@ 2016-03-09 23:28 ` Danny Milosavljevic
2016-03-10 1:43 ` Leo Famulari
0 siblings, 1 reply; 4+ messages in thread
From: Danny Milosavljevic @ 2016-03-09 23:28 UTC (permalink / raw)
To: 22962
If I make it immutable, I get the following message on guix system reconfigure ... :
guix system: error: copy-file: Permission denied: "/etc/hosts"
Aha!
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#22962: Something keeps overwriting /etc/hosts
2016-03-09 23:28 ` Danny Milosavljevic
@ 2016-03-10 1:43 ` Leo Famulari
2016-03-10 8:39 ` Alex Kost
0 siblings, 1 reply; 4+ messages in thread
From: Leo Famulari @ 2016-03-10 1:43 UTC (permalink / raw)
To: Danny Milosavljevic; +Cc: 22962
On Thu, Mar 10, 2016 at 12:28:11AM +0100, Danny Milosavljevic wrote:
> If I make it immutable, I get the following message on guix system reconfigure ... :
>
> guix system: error: copy-file: Permission denied: "/etc/hosts"
>
> Aha!
I think that on GuixSD, the hosts file is generated from the system
configuration, specifically the 'hosts-file' field, which is mentioned
in section 7.2.2 Operating System Reference [0].
I assume that the resulting file is recreated each time you reconfigure.
In that case, you'd want to leave the file /etc/hosts alone, and make
your changes in the operating system configuration.
I say "I think" and "I assume" because I haven't actually used
'hosts-file' yet, nor have I looked at that part of the code.
Does that help?
[0]
https://www.gnu.org/software/guix/manual/guix.html#operating_002dsystem-Reference
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#22962: Something keeps overwriting /etc/hosts
2016-03-10 1:43 ` Leo Famulari
@ 2016-03-10 8:39 ` Alex Kost
0 siblings, 0 replies; 4+ messages in thread
From: Alex Kost @ 2016-03-10 8:39 UTC (permalink / raw)
To: Leo Famulari; +Cc: 22962
Leo Famulari (2016-03-10 04:43 +0300) wrote:
> On Thu, Mar 10, 2016 at 12:28:11AM +0100, Danny Milosavljevic wrote:
>> If I make it immutable, I get the following message on guix system reconfigure ... :
>>
>> guix system: error: copy-file: Permission denied: "/etc/hosts"
>>
>> Aha!
>
> I think that on GuixSD, the hosts file is generated from the system
> configuration, specifically the 'hosts-file' field, which is mentioned
> in section 7.2.2 Operating System Reference [0].
>
> I assume that the resulting file is recreated each time you reconfigure.
>
> In that case, you'd want to leave the file /etc/hosts alone, and make
> your changes in the operating system configuration.
>
> I say "I think" and "I assume" because I haven't actually used
> 'hosts-file' yet, nor have I looked at that part of the code.
You are absolutely right! On GuixSD, to modify /etc/hosts a user need
to adjust his/her system config.
Danny, you can keep your hosts file wherever you want, let's say
"~/my-config/hosts"; and you can add this line to your operating-system
declaration:
(hosts-file (local-file (string-append (getenv "HOME")
"/my-config/hosts")))
After reconfiguring your system, this file will be put into the store,
and /etc/hosts will have the same contents after reboot.
Moreover, every time you change this file and make a new system, a new
version of "hosts" will be put to the store. So if you boot into some
old system, it will be booted with the hosts file that was used at that
time (as you can see, every system in /var/guix/profiles, has its own
"etc/hosts").
--
Alex
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-03-10 8:39 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-09 20:42 bug#22962: Something keeps overwriting /etc/hosts Danny Milosavljevic
2016-03-09 23:28 ` Danny Milosavljevic
2016-03-10 1:43 ` Leo Famulari
2016-03-10 8:39 ` Alex Kost
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).