cancel
Showing results for 
Search instead for 
Did you mean: 

How tho change hostname from the default = MACHINE

MKaas.1
Associate III

I have set :

hostname_pn-base-files = "new_host_name"

in my conf file.

This seems changing /etc/hostname in base-files image. However, there is log message telling:

"[   7.249795] systemd[1]: Set hostname to <stm32mp1-disco>."

Also, /etc/hosname contents is "stm32mp1-disco".

I can't find what other recipe/module is dealing with hostname settings.

1 ACCEPTED SOLUTION

Accepted Solutions

Hello @MKaas.1​ 

I agree with your modification related to hostname_pn-base-files = "new_host_name" in the conf file.

I guess there are some troubles with the dhcp service but I am not an expert on this topic so my piece of advice may be really poor.

We can see this line in the file /etc/dhcp/dhcp.client

request subnet-mask, broadcast-address, time-offset, routers,
       domain-name, domain-name-servers, host-name,
       netbios-name-servers, netbios-scope;

From my understanding, the term «host-name» implies to update the board hostname from the DHCP server. If the DHCP leasing is still active from a previous connection, it may explain the change of your hostname through the DCHP service.

To check this hypothesis, perhaps you could boot your board without any ethernet or wifi connections:

  • If the host name changes, it invalidates my hypothesis.
  • If the host name is the one you choose, it means you have a side-effect from the dhcp leasing. In that case, either purge the dhcp server or remove the request «host-name» in the file /etc/dhcp/dhcp.client.

Best regards,

--JM

View solution in original post

5 REPLIES 5
Olivier GALLIEN
ST Employee

Hi @MKaas.1​ ,

Sorry for late reply.

I found my side : meta-st/meta-st-stm32mp/conf/machine/stm32mp1-disco.conf:#@NAME: stm32mp1-disco

Hope it help

Olivier

Olivier GALLIEN
In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
MKaas.1
Associate III

That seems a comment to me. The file I mentioned: "/etc/hostname" carries the original hostname. That should be kept unchanged until boot. In common, recipes are not allowed touching files other recipes are producing, i.e. several recipes should not produce the same file. You can possibly cope that with PREFERRED_PROVIDER - just to select packets, but not files. Also, you could write a BBAPPEND recipe to replace the original file. So, I suppose that /etc/hostname is changed by some post-install script or BBAPPEND recipe that I can't find out.

Hello @MKaas.1​ 

I agree with your modification related to hostname_pn-base-files = "new_host_name" in the conf file.

I guess there are some troubles with the dhcp service but I am not an expert on this topic so my piece of advice may be really poor.

We can see this line in the file /etc/dhcp/dhcp.client

request subnet-mask, broadcast-address, time-offset, routers,
       domain-name, domain-name-servers, host-name,
       netbios-name-servers, netbios-scope;

From my understanding, the term «host-name» implies to update the board hostname from the DHCP server. If the DHCP leasing is still active from a previous connection, it may explain the change of your hostname through the DCHP service.

To check this hypothesis, perhaps you could boot your board without any ethernet or wifi connections:

  • If the host name changes, it invalidates my hypothesis.
  • If the host name is the one you choose, it means you have a side-effect from the dhcp leasing. In that case, either purge the dhcp server or remove the request «host-name» in the file /etc/dhcp/dhcp.client.

Best regards,

--JM

MKaas.1
Associate III

Hi @Jean-Marc B​ 

This can be true. I checked from st-image-core....tar.gz and there /etc/hostname was that, what I had defined. So, at least build time post installation scripts had not changed it. I'll write the image to SD card and try it out without Ethernet.

MKaas.1
Associate III

Yes, I can verify, that /etc/hostname did not change at boot when I booted first time Ethernet disconnected.

Thank you for your help