We have moved to a new Sailfish OS Forum. Please start new discussions there.
5

/etc/hostname is not honored

asked 2016-07-01 18:03:13 +0200

00prometheus gravatar image

updated 2016-07-01 18:05:01 +0200

After a reboot, my phone won't honor the hostname in /etc/hostname:

nemo@localhost:~ $ cat /etc/hostname 
droplet
nemo@localhost:~ $ hostname
localhost
nemo@localhost:~ $

Any ideas?

I am running 2.0.0.10 on a Fairphone 2.

edit retag flag offensive close delete

Comments

Did you reboot after editing the file?

pichlo ( 2016-07-01 19:11:30 +0200 )edit

2 Answers

Sort by » oldest newest most voted
3

answered 2016-07-01 21:21:35 +0200

Thaodan gravatar image

This this [1] bug, the hostname is set in /init.rc which prevents systemd from setting the hostname on boot. Remove the line in init.rc and everything is fine.

[1] https://bugs.nemomobile.org/show_bug.cgi?id=875

edit flag offensive delete publish link more

Comments

Android? No wonder I could not reproduce it. No Android on my Jolla. I get me coat.

(Yes, I saw Fairpfone in OP's post but did not think it was relevant.)

pichlo ( 2016-07-02 00:29:34 +0200 )edit

Jolla Phone has nearly the same part of Android, you could even edit /init.rc and add the same line that produces this error.

Thaodan ( 2016-07-02 00:35:06 +0200 )edit

Couldn't find any occurrence of "hostname" in my /etc/init.rc file. (Jolla phone, Taalojärvi, no Android)

objectifnul ( 2016-07-02 10:49:54 +0200 )edit

@objectifnul: the file is in /init.rc

Thaodan ( 2016-07-02 15:43:11 +0200 )edit

I can confirm that the suggested fix works (Sailfish OS 2.0.0.10 (alpha1) on Fairphone 2). I commented out hostname localhost and domainname localdomain in /init.rc, and now the hostname configured in /etc/hostname is used after reboot.

@Thaodan: I also wrote the wrong file name here, but couldn't edit the comment, so re-posting as new instead.

luen ( 2016-07-02 15:48:20 +0200 )edit
0

answered 2016-07-01 19:18:32 +0200

objectifnul gravatar image

updated 2016-07-01 19:21:58 +0200

Did you try the hostname command in fingerterm? (You must be root to modify the host name)

edit flag offensive delete publish link more

Comments

I can't remember the details but I remember there was some problem with the hostname command. Something silly like it did not survive a reboot or something like that. So I edited the /etc/hostname file, rebooted and hey presto - problem solved. Hence my question to the OP.

pichlo ( 2016-07-01 19:27:57 +0200 )edit

In my experience (Taalojärvi), the hostname <pick_a_name> command is actually working (check the fingerterm prompt string after terminal is closed then relaunched), but does not modify the /etc/hostname file.

OTOH, manually editing /etc/hostname has no effect, even after reboot.

Weird.

objectifnul ( 2016-07-01 19:35:53 +0200 )edit

hostname command seems not to work correct on fairphone2 port. I do set hostname with 'hostname fp2' and set hostname in /etc/hostname but after reboot the hostname is localhost again.

gabs5807 ( 2016-07-01 20:07:51 +0200 )edit

Yes, setting the hostname with the hostname command works temporarily, but the name is gone again after rebooting.

00prometheus ( 2016-07-07 03:59:37 +0200 )edit
Login/Signup to Answer

Question tools

Follow
2 followers

Stats

Asked: 2016-07-01 18:03:13 +0200

Seen: 521 times

Last updated: Jul 01 '16