Random Notes‎ > ‎

SolusVM: saving /etc/network/interfaces from being overwritten

posted Jul 19, 2014, 8:58 AM by William Shallum   [ updated Jul 19, 2014, 9:00 AM ]
I have a VPS running Ubuntu 12.04. The VPS host running SolusVM overwrites the /etc/network/interfaces config file (and probably other files) whenever "reboot" is done from the control panel. I am not too pleased with this as I have customized it.

There are of course valid reasons for changing the network configuration. Initial setup is one of those reasons. I don't think it should be done on every "reboot" command.

Here's what I did to fix it:

Create /etc/init/networking.override and replace the pre-start with a script. Don't forget to copy the previous pre-start command (mkdir -p /run/network) into the script:

pre-start script
  mkdir -p /run/network
  mv /etc/network/interfaces /etc/network/interfaces.atboot
  cp -p /etc/network/interfaces.good /etc/network/interfaces
  mv /etc/resolv.conf /etc/resolv.conf.atboot
  cp -p /etc/resolv.conf.good /etc/resolv.conf
end script

This happens before networking is set up with ifup. I think this is preferable to setting the files to be immutable because there's no telling how the host scripts will react when it finds an immutable file. Don't forget to add a comment to the files saying you need to edit the *.good files as well.

References:
Comments