View previous topic :: View next topic |
Author |
Message |
pyx n00b
Joined: 12 Apr 2024 Posts: 4
|
Posted: Fri Apr 12, 2024 10:14 pm Post subject: [Solved] Failed to set hostname, openrc |
|
|
Hi there, I've been encountered something weird with hostname lately.
I am using openrc-0.54.
For example, if I have:
/etc/hostname
/etc/conf.d/hostname
/etc/hosts
Code: | 127.0.0.1 tux localhost
::1 tux localhost
|
Service "hostname" is in boot runlevel.
Instead of setting the host name to "tux", what I got is 13 digits of hex number (looks like random number but fixed for individual machine) as host name.
"rc-status -s" shows service "hostname" had been started.
Running "rc-config restart hostname" will set the host name correctly afterwards.
I have service "connman" in default runlevel, but I doubt this is relevant.
This problem started show up about 1 or 2 years ago. I have 5 gentoo boxes with almost identical hostname configuration, only differ in the hostname value (with different names), 3 of them are like that, a newly installed one (last week) worked fine (correctly setting hostname) for a week, after a few update and reboot, had the same problem.
Does anyone have same experience?
Last edited by pyx on Tue Apr 16, 2024 12:56 am; edited 2 times in total |
|
Back to top |
|
|
grknight Retired Dev
Joined: 20 Feb 2015 Posts: 1920
|
Posted: Fri Apr 12, 2024 10:47 pm Post subject: |
|
|
This is most likely your DHCP provider setting a hostname on network starting. Not sure how to tell connman to bypass this. |
|
Back to top |
|
|
pyx n00b
Joined: 12 Apr 2024 Posts: 4
|
Posted: Fri Apr 12, 2024 11:07 pm Post subject: |
|
|
grknight wrote: | This is most likely your DHCP provider setting a hostname on network starting. Not sure how to tell connman to bypass this. |
Thank you. I will do some research on that.
Edit: confirmed, I removed service "connman" from runlevel default and the hostname is set correctly, now the problem becomes how do I bypass that like you said. BTW, service "display-manager" will crash if I removed "connman" from default runlevel. Will update if I fixed the problem. |
|
Back to top |
|
|
pyx n00b
Joined: 12 Apr 2024 Posts: 4
|
Posted: Fri Apr 12, 2024 11:36 pm Post subject: |
|
|
Fixed with a (possibly ugly) workaround, I made service "hostname" start after "connman", thus, added service "connman" to runlevel boot and service "hostname" to runlevel default.
Thank you again, grknight |
|
Back to top |
|
|
grknight Retired Dev
Joined: 20 Feb 2015 Posts: 1920
|
Posted: Sat Apr 13, 2024 12:40 am Post subject: |
|
|
A quick search shows that editing /etc/connman/main.conf with the following may fix your issue: Code: | [General]
AllowHostnameUpdates=false |
|
|
Back to top |
|
|
pyx n00b
Joined: 12 Apr 2024 Posts: 4
|
|
Back to top |
|
|
|