Walter Zambotti Posted June 26, 2023 Posted June 26, 2023 I have multiple n2s and I don't want them all to be called odroidn2. What is the recommended way to change the hostname of an armbian system? 0 Quote
Solution mitu Posted June 26, 2023 Solution Posted June 26, 2023 Using hostnamectl Quote sudo hostnamectl hostname <new_hostname> 1 Quote
arman Posted October 13 Posted October 13 Found the actual codes executed in /usr/lib/armbian-config/jobs.sh, when you run sudo armbian-config Basically, it updates /etc/hostname, /etc/hosts Here is my wrapped function: change_hostname() { # modified from /usr/lib/armbian-config/jobs.sh # should be OK for debian as well(?) local hostname_current=$(cat /etc/hostname) if [[ -z $1 ]]; then echo "Current hostname: $hostname_current" else local hostname_new=$1 sudo sed -i "s/$hostname_current/$hostname_new/g" /etc/hosts sudo sed -i "s/$hostname_current/$hostname_new/g" /etc/hostname # Temporarily change the hostname for the current session sudo hostname "$hostname_new" sudo systemctl restart systemd-logind.service echo "Logout to make effective the new hostname: $hostname_new" fi } 1 Quote
Igor Posted October 14 Posted October 14 13 hours ago, arman said: sudo systemctl restart systemd-logind.service Will log you out automatically, at least when running desktop. In case one is running Google Chrome, this will lock it out This 10 years bug is still valid: https://askubuntu.com/questions/476918/google-chrome-wont-start-after-changing-hostname BTW. We are switching to armbian-config new generation soon and here this is done this way: https://github.com/armbian/configng/blob/main/lib/armbian-configng/config.ng.system.sh#L33-L38 If you have ideas for improvements, welcome. 0 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.