Some files such as /etc/hosts get overwritten every time the NAS (AS6604T) gets rebooted.
I've looked around a bit, couldn't find where that "clean" hosts file is, or by what process, workflow, it gets overwritten.
Anyone has an idea on this ? Oh.. if there are other files that get the same treatment that you're aware of, please be kind enough to let me know of your discoveries
--Jeff
AS6604T overwriting some files at boot time
-
- Posts: 24
- youtube meble na wymiar Warszawa
- Joined: Sun Jun 13, 2021 3:44 am
- father.mande
- Posts: 1818
- Joined: Sat Sep 12, 2015 2:55 am
- Location: La Rochelle (France)
Re: AS6604T overwriting some files at boot time
Hi,
As I know :
... hosts file is generated from /etc/nas.conf (real Path : /volume0/etc/nas.conf ) at boot time
... hostname file is in built in ADM with "astorus" value
So :
... to modify host name (/etc/hosts) , change using the WebUI the hostname (nas.conf is modified), or run automatically a script at boot time (some solution exist in this forum) and use /bin/hostname to update the file name, remember to restart services using the host name ... best is to change it only using the WebUI ... to avoid problems
... to add list of hosts, dns name, etc. to the host, as I know the only solution is to prepare the complement to add to /etc/hosts in a file and as before, using a script at boot end (or in the starting script of your App.) concatenate the actual hosts file and your addition (a simple cat >> is enough
... if you need to change the hostname file (builtin) do : /bin/hostname > /etc/hostname : to update from "astorus" to the real name (same at end of boot)
Due to the fact that initial file are rebuilt at boot, in case of problem a simple boot restore the situation ... so run test "manually" before adding auto-run script and keep a possibility of escaping ...
Philippe.
As I know :
... hosts file is generated from /etc/nas.conf (real Path : /volume0/etc/nas.conf ) at boot time
... hostname file is in built in ADM with "astorus" value
So :
... to modify host name (/etc/hosts) , change using the WebUI the hostname (nas.conf is modified), or run automatically a script at boot time (some solution exist in this forum) and use /bin/hostname to update the file name, remember to restart services using the host name ... best is to change it only using the WebUI ... to avoid problems
... to add list of hosts, dns name, etc. to the host, as I know the only solution is to prepare the complement to add to /etc/hosts in a file and as before, using a script at boot end (or in the starting script of your App.) concatenate the actual hosts file and your addition (a simple cat >> is enough
... if you need to change the hostname file (builtin) do : /bin/hostname > /etc/hostname : to update from "astorus" to the real name (same at end of boot)
Due to the fact that initial file are rebuilt at boot, in case of problem a simple boot restore the situation ... so run test "manually" before adding auto-run script and keep a possibility of escaping ...
Philippe.
AS6602T / AS5202T /AS5002T / AS1002T / FS6706T
-
- Posts: 24
- Joined: Sun Jun 13, 2021 3:44 am
Re: AS6604T overwriting some files at boot time
Bonsoir, Philippe, thanks for the fast reply.
I've looked at nas.conf, nothing there needs changing from me. You did point me to a solution I already use on Docker:
Most of my entrypoints in a Dockerfile look like this:
A heavy-handed way to ensure that my hosts files are just like I want them. I could do something along those lines in the NAS crontab (with a @reboot time), provided that crontab does not get overwritten at every reboot.
I could have a line in the crontab such as
Here, again, I hilight my issue: I'm sure I can find workarounds many of the persistency issues I find, but I'd wish to find where the script/config of that "files rebuilding process" is located. In other words: so far I know that /etc/hosts is overwritten, but from just 2 paragraphs above, I've now got doubts about the crontabs, too
Those are prerequisites to my end-goal, have prod/dev environment where I could develop ADM packages for my own use, and of course, the community...
That, and fixing my custom cert/rootCA issue.
I've just migrated last month from Synology to here. So far I like it
Regards,
--JFG
I've looked at nas.conf, nothing there needs changing from me. You did point me to a solution I already use on Docker:
Most of my entrypoints in a Dockerfile look like this:
Code: Select all
ENTRYPOINT [ "/bin/sh", "-c", "cat /root/hosts.extra >> /etc/hosts && exec /usr/bin/supervisord" ]
I could have a line in the crontab such as
Code: Select all
@reboot cat $SOURCEFILE >> /etc/hosts
Those are prerequisites to my end-goal, have prod/dev environment where I could develop ADM packages for my own use, and of course, the community...
That, and fixing my custom cert/rootCA issue.
I've just migrated last month from Synology to here. So far I like it
Regards,
--JFG
father.mande wrote:Hi,
As I know :
... hosts file is generated from /etc/nas.conf (real Path : /volume0/etc/nas.conf ) at boot time
... hostname file is in built in ADM with "astorus" value
So :
... to modify host name (/etc/hosts) , change using the WebUI the hostname (nas.conf is modified), or run automatically a script at boot time (some solution exist in this forum) and use /bin/hostname to update the file name, remember to restart services using the host name ... best is to change it only using the WebUI ... to avoid problems
... to add list of hosts, dns name, etc. to the host, as I know the only solution is to prepare the complement to add to /etc/hosts in a file and as before, using a script at boot end (or in the starting script of your App.) concatenate the actual hosts file and your addition (a simple cat >> is enough
... if you need to change the hostname file (builtin) do : /bin/hostname > /etc/hostname : to update from "astorus" to the real name (same at end of boot)
Due to the fact that initial file are rebuilt at boot, in case of problem a simple boot restore the situation ... so run test "manually" before adding auto-run script and keep a possibility of escaping ...
Philippe.
-
- Posts: 24
- Joined: Sun Jun 13, 2021 3:44 am
Re: AS6604T overwriting some files at boot time
...and it worked:
Code: Select all
root@nas:/volume1/.@root # crontab -l |grep hosts;tail -10 /etc/hosts
* * * * * /bin/cat /volume1/Docker/mounts/nginx/data/artifacts/hosts.extra >> /etc/hosts
10.1.1.11 elk elk.famillegratton.net #ssh=8922
10.2.1.1 oslo oslo.famillegratton.net #Ubuntu 21.04
10.3.1.1 bergen bergen.famillegratton.net #Fedora32
# VMs: Infra
#10.5.9.1 rpmbuilder #CentOS 8
#10.5.9.2 debbuilder #Debian 10
#10.5.9.3 dockerbuilder #Debian 10