As per:
http://dietpi.com/phpbb/viewtopic.php?f=11&t=920&p=4205#p4205
Script fails if file /etc/dhcpcd.conf does not exist:
Critical: Unable to locate configuration file to set static IPv4 address!
https://github.com/pivpn/pivpn/blob/master/auto_install/install.sh#L331-L345
Generating the file resolves the issue and allows installation script to complete sucessfully:
echo 1 > /etc/dhcpcd.conf
Should be good now. Can you test it again? (BTW, thanks for the great bug report!)
for the jessie images that file already exists as it is used by the system and is how you would set a static ip. there are other parameters in there, it isn't just a blank file we use. creating a blank file lets the script continue but it was failing because we surely expected that file to be there. on dietpi will the intstaller correctly set a static IP? I'd imagine since it doesn't use that file, yet that is where we define the static IP, then we probably don't create a static IP on diet pi correctly? Sorry i'm not familiar with diet pi.
ok, i'm going to revert this and commit a different fix.
for one, where you have touched the file is after it would fail. the setStaticIPv4 function is called first, then setDHCPCD.
Regardless, manually just touching this file to create it is wrong. Like I said, it's a file generated by a package (system in my experience).
every system i've been on (debian based) has this file already. My assumption is that DietPi gets its name by being slimmed down maybe derivative of debian. Hence the dhcpcd package isn't there. I'll add that to the dependency list to install which will ensure /etc/dhcpcd.conf exists.
Furthering this thought and to head off future issues, @Fourdee does DietPi have 'tar' out of the box or no?
everything merged from test so this should be fixed now.
@0-kaladin
I'd imagine since it doesn't use that file, yet that is where we define the static IP, then we probably don't create a static IP on diet pi correctly? Sorry i'm not familiar with diet pi.
DietPi currently uses solely /etc/network/interfaces for networking configuration: https://github.com/Fourdee/DietPi/blob/master/dietpi/conf/network_interfaces
As for static IP being applied, i'll need to check on RPi and get back to you. Ran a quick test install on Odroid C2 (jessie), but not supported for static IP in your script currently, i get this message: https://github.com/pivpn/pivpn/blob/master/auto_install/install.sh#L258-L262
@Fourdee does DietPi have 'tar' out of the box or no?
Yes
everything merged from test so this should be fixed now.
Yep, works a treat, thank you 馃憤
@0-kaladin
i'll need to check on RPi and get back to you.
/etc/dhcpcd.conf appears to overrides settings contained in /etc/network/interfaces. Static IP set in PiVPN is applied.
/etc/network/interfaces is still active. 2 active connections are set during boot. I was able to ping both IP addresses from another system on LAN.
root@DietPi:~# cat /etc/network/interfaces
#/etc/network/interfaces
#Please use DietPi-Config to modify network settings.
# Local
auto lo
iface lo inet loopback
# Ethernet
allow-hotplug eth0
iface eth0 inet static
address 192.168.0.191
netmask 255.255.255.0
gateway 192.168.0.1
dns-nameservers 8.8.8.8 8.8.4.4
...................
root@DietPi:~# cat /etc/dhcpcd.conf
..........................
# A hook script is provided to lookup the hostname if not set by the DHCP
# server, but it should not be run by default.
nohook lookup-hostname
interface eth0
static ip_address=192.168.0.104/24
static routers=192.168.0.1
static domain_name_servers=8.8.8.8
Perfect then! except I do have a known little bug where I'm only writing 1 of the 2 dns servers. will have to fix that one day.