How to change hostname on torizon

Hi, I need to change device hostname in my apalis imx8 running torizon core. I test Linux hostname command and It works but when I reboot my device I Lost It.

Best regards

Hi @delta,

the hostname command is effective only until the next reboot. In order to make a permanent change, you need to edit /etc/hostname, as stated in the manual from hostname (you can run man hostname on your computer if you’re using Linux):

       When called with one argument or with the --file option, the commands set the host name or the  NIS/YP  do‐
       main  name.  hostname uses the sethostname(2) function, while all of the three domainname, ypdomainname and
       nisdomainname use setdomainname(2).  Note, that this  is  effective  only  until  the  next  reboot.   Edit
       /etc/hostname for permanent change.

Best regards,

Thanks @hfranco.tx for your answer, I use sudo hostnamectl set-hostname NAME and it works fine.

1 Like