Power & Source of Big Ideas

Change hostname on NanoPi2

Moderators: chensy, FATechsupport

Hello,

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?

Thanks
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.
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.

dave
Hi, editting "/etc/hostname" is a way to change the hostname. We did that this way on the NanoPi 2.
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?

Dave
Sorry this is a bug. We will fix it in our future versions.

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

Who is online

In total there are 25 users online :: 0 registered, 0 hidden and 25 guests (based on users active over the past 5 minutes)
Most users ever online was 5185 on Wed Jan 22, 2020 1:44 pm

Users browsing this forum: No registered users and 25 guests