Page 1 of 1

Change hostname on NanoPi2

Posted: Thu Jan 21, 2016 5:29 pm
by wittend

I have a couple of NanoPi2's and I have been struggling to change the hostname of each in a way that will persist across reboots. This is a familiar problem to users across a lot of Linux distros over the years, and I think that I have tried all of the well known tricks to fix it.

I've used the hostname command, edited /etc/hostname, edited other .conf files, used various commands for older and newer init and startup setups - they either do nothing or just don't stick across reboot. I've messed around with my dhcp settings.

What magical words or acts will get the 'FreindlyARM' string out of my command prompt and de-confuse my DHCP server?


Re: Change hostname on NanoPi2

Posted: Fri Jan 22, 2016 3:42 am
by davef
Is doing a sync after modifying the file one of the well-known tricks :)

Some distros mount etc as volatile so people couldn't change stuff in /etc. I don't think is the case with the NanoPi2. I notice that nameserver is modified by the operating system. Hopefully hostname is NOT hidden away somewhere and gets rewritten to hostname at every boot.

Re: Change hostname on NanoPi2

Posted: Sun Jan 24, 2016 8:40 pm
by wittend
I don't know, I'll have to try that.

I was suspecting something of that sort, but edits to the /etc/hostname file do persist. But other stuff may get uncrunched to RAM on boot. I'll post whatever I find.

I was hoping that someone would actually know. Lots of stuff keeps changing, causing confusion to an old geezer like me.


Re: Change hostname on NanoPi2

Posted: Mon Jan 25, 2016 1:45 am
by FATechsupport
Hi, editting "/etc/hostname" is a way to change the hostname. We did that this way on the NanoPi 2.

Re: Change hostname on NanoPi2

Posted: Sun Feb 14, 2016 10:13 pm
by wittend
I find it odd but this does not work for me.

I do the following:

1) Login using SSH as root
2) Edit /etc/hostname - enter "NP2-0"
3) sync
4) reboot

Then I:

1) Login using SSH as root
2) Type hostname - The nanoPi responds: "FriendlyARM"
3) check /etc/hostname - it still contains "NP2-0"

I have tried other tricks related to DHCP, etc., but none will get rid of "FriendlyARM"

What is going on?


Re: Change hostname on NanoPi2

Posted: Wed Feb 17, 2016 10:13 am
by FATechsupport
Sorry this is a bug. We will fix it in our future versions.

You may try editing this file "/etc/rc.local"