Audiotek
Posts: 14
Joined: Wed Feb 18, 2015 1:02 am

Can't Change /etc/network/interfaces file

Mon Mar 06, 2017 4:45 am

I'm trying to change the config on /etc/network/interfaces using nano but no matter what I do it doesn't save the file when I reboot. It's on a Raspberry Pi 2 using Screenly OSE and I need the Pi to go on DHCP All I have in the file is

generated by Screenly Network Manager
auto lo
iface lo inet loopback

I tried to change the loopback to dhcp with the following code

Code: Select all

iface eth0 inet dhcp
CTRL+X , Y, ENTER

and reboot

ifconfig I get the old DHCP address when I did the initial setup weeks ago. The Pi doesn't seem to be able to get a new dhcp lease and not sure why the old IP address keep showing up and no matter what I change on the /etc/network/interfaces it doesn't save it


What could be wrong?

User avatar
DougieLawson
Posts: 40188
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Can't Change /etc/network/interfaces file

Mon Mar 06, 2017 7:56 am

If things are not getting stored on your SDCard you're either a) exiting the editor incorrectly (try using sudo leafpad in an LXTerminal window), b) you're not using sudo when you need to edit a system file or c) worst case your SDCard has reached end-of-life and has switched to read-only mode.
Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All fake doctors are on my foes list.

Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

drgeoff
Posts: 11239
Joined: Wed Jan 25, 2012 6:39 pm

Re: Can't Change /etc/network/interfaces file

Mon Mar 06, 2017 9:48 am

You need to have root privilege to edit that file.

Code: Select all

sudo nano /etc/network/interfaces
Quis custodiet ipsos custodes?

Audiotek
Posts: 14
Joined: Wed Feb 18, 2015 1:02 am

Re: Can't Change /etc/network/interfaces file

Mon Mar 06, 2017 7:55 pm

Hi Thanks for the reply! I forgot to mention I use sudo otherwise I get a permission denied error.

Also I can see # of lines written so it sees the lines but can't seem to save.

I installed the whole thing on a different micro SD card and I get the same default settings

auto lo
iface lo inet loopback


And that's it nothing else.

With ifconfig I get a dhcp address

Isn't loopback supposed to be 127.0.0.1?

What is the loopback used in that circumstance?

And what should I be seeing when on dhcp when editing /etc/network/interfaces ?

Thanks

User avatar
DougieLawson
Posts: 40188
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Can't Change /etc/network/interfaces file

Mon Mar 06, 2017 9:33 pm

Why are you trying to change the interfaces file? Read the first few lines with ahead -6 /etc/network/interfaces command.

Code: Select all

pi@viking /mnt $ head -6 /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)

# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'

# Include files from /etc/network/interfaces.d:
pi@viking /mnt $
Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All fake doctors are on my foes list.

Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Audiotek
Posts: 14
Joined: Wed Feb 18, 2015 1:02 am

Re: Can't Change /etc/network/interfaces file

Mon Mar 06, 2017 9:57 pm

I'd like to know why I get local loopback

Shouldn't I get something like this in the /etc/network/interfaces file?

auto eth0
iface eth0 inet dhcp

User avatar
rpdom
Posts: 17719
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Can't Change /etc/network/interfaces file

Mon Mar 06, 2017 10:11 pm

Audiotek wrote:I'd like to know why I get local loopback
What do you mean? You always have a lo loopback interface. Things will break if you don't.
Shouldn't I get something like this in the /etc/network/interfaces file?

auto eth0
iface eth0 inet dhcp
Your /etc/network/interfaces should look like this

Code: Select all

# interfaces(5) file used by ifup(8) and ifdown(8)

# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'

# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

auto lo
iface lo inet loopback

iface eth0 inet manual

allow-hotplug wlan0
iface wlan0 inet manual
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

allow-hotplug wlan1
iface wlan1 inet manual
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

User avatar
DougieLawson
Posts: 40188
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Can't Change /etc/network/interfaces file

Mon Mar 06, 2017 10:12 pm

/etc/network/interfaces on Raspbian Jessie should look like

Code: Select all

# interfaces(5) file used by ifup(8) and ifdown(8)

# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'

# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

auto lo
iface lo inet loopback

iface eth0 inet manual

allow-hotplug wlan0
iface wlan0 inet manual
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

allow-hotplug wlan1
iface wlan1 inet manual
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
DO NOT change it.
Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All fake doctors are on my foes list.

Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Return to “Troubleshooting”