Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not set hostname: Permission denied #16656

Closed
kaizen1 opened this issue Aug 3, 2020 · 7 comments
Closed

Could not set hostname: Permission denied #16656

kaizen1 opened this issue Aug 3, 2020 · 7 comments
Labels
hostname needs-reporter-feedback ❓ There's an unanswered question, the reporter needs to answer network

Comments

@kaizen1
Copy link

kaizen1 commented Aug 3, 2020

systemd 245 (245.4-4ubuntu3.2)
OS: Ubuntu 20.04 minimal Google Cloud image

Expected behaviour you didn't see

I would expect systemd-networkd to set the hostname

Unexpected behaviour you saw

hostname could not be set due to permission error.

Steps to reproduce the problem
Reboot the VM
Run sudo systemctl status systemd-networkd

Get:

● systemd-networkd.service - Network Service
Loaded: loaded (/lib/systemd/system/systemd-networkd.service; enabled; vendor preset: enabled)
Active: active (running) since Mon 2020-08-03 17:25:10 UTC; 5min ago
TriggeredBy: ● systemd-networkd.socket
Docs: man:systemd-networkd.service(8)
Main PID: 606 (systemd-network)
Status: "Processing requests..."
Tasks: 1 (limit: 2010)
Memory: 1.4M
CGroup: /system.slice/systemd-networkd.service
└─606 /lib/systemd/systemd-networkd

systemd[1]: Starting Network Service...
systemd-networkd[606]: Enumeration completed
systemd[1]: Started Network Service.
systemd-networkd[606]: ens4: DHCPv4 address 10.142.0.11/32 via 10.142.0.1
systemd-networkd[606]: Could not set hostname: Permission denied

@yuwata
Copy link
Member

yuwata commented Aug 5, 2020

Are systemd-hostnamed and polkit installed? networkd itself does not set hostname, but set it through hostnamed.

@yuwata
Copy link
Member

yuwata commented Aug 5, 2020

Not sure, but maybe related to #13501.

@yuwata yuwata added the needs-reporter-feedback ❓ There's an unanswered question, the reporter needs to answer label Aug 5, 2020
@kaizen1
Copy link
Author

kaizen1 commented Aug 5, 2020

Is this correct? Or should it be active? Seems odd. It's a fresh GCP VM image. Ubuntu 20.04 minimal. よろしくお願い

More Info:
libpolkit-gobject-1-0:
Installed: 0.105-26ubuntu1

After seeing the below status. I manually started systemd-hostnamed.
Then rebooted. Then I see systemd-hostnamed is Active: active (running), but I still get:
systemd-networkd[213]: Could not set hostname: Permission denied

● systemd-hostnamed.service - Hostname Service
Loaded: loaded (/lib/systemd/system/systemd-hostnamed.service; static; vendor preset: enabled)
Active: inactive (dead)
Docs: man:systemd-hostnamed.service(8)
man:hostname(5)
man:machine-info(5)
https://www.freedesktop.org/wiki/Software/systemd/hostnamed

Aug 05 12:23:57 vm1 systemd[1]: Starting Hostname Service...
Aug 05 12:23:57 vm1 systemd[1]: Started Hostname Service.
Aug 05 12:24:27 vm1 systemd[1]: systemd-hostnamed.service: Succeeded.
Aug 05 12:28:09 vm1 systemd[1]: Starting Hostname Service...
Aug 05 12:28:09 vm1 systemd[1]: Started Hostname Service.
Aug 05 12:28:42 vm1 systemd[1]: systemd-hostnamed.service: Succeeded.

@yuwata
Copy link
Member

yuwata commented Aug 5, 2020

libpolkit-gobject-1-0

Is this only installed package related to polkit? I do not know the exact name of polkit package in Ubuntu. But libpolkit-gobject-1-0 seems not relevant. Please install polkit.

Or should it be active?

No. It is not necessary to enable and start hostnamed. It is automatically started when hostname change is requested (e.g., by hostnamectl or networkd).

@yuwata
Copy link
Member

yuwata commented Aug 5, 2020

Ah, maybe policykit.
https://packages.ubuntu.com/focal/policykit-1

@kaizen1
Copy link
Author

kaizen1 commented Aug 5, 2020

sudo apt install policykit-1
No more permissions error from: sudo systemctl status systemd-networkd
Thank you @yuwata !
どうもどうも!

@yuwata
Copy link
Member

yuwata commented Aug 5, 2020

どういたしまして。

@yuwata yuwata closed this as completed Aug 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hostname needs-reporter-feedback ❓ There's an unanswered question, the reporter needs to answer network
Development

No branches or pull requests

2 participants