June 26, 20233 yr 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?
October 13, 20241 yr 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 }
October 14, 20241 yr 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.
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.