[systemd-devel] systemd and hostname supplied by DHCP

Laércio de Sousa laerciosousa at sme-mogidascruzes.sp.gov.br
Fri Oct 2 05:20:27 PDT 2015


Some guys set the following config in /etc/polkit-1/rules.d:

polkit.addRule(function(action, subject) {
    if (action.id == "org.freedesktop.hostname1.set-hostname" &&
subject.user == "systemd-network") {
      return polkit.Result.YES;
    }
});

Alternatively, I use the following config in
/etc/polkit/localauthority/50-local.d of my Debian Jessie installation (I
failed to make it apply polkit rules):

[Allow systemd-networkd to set transient hostname from DHCP]
Identity=unix-user:systemd-network
Action=org.freedesktop.hostname1.set-hostname
ResultAny=yes
ResultInactive=yes
ResultActive=yes

Good luck!

2015-10-02 9:00 GMT-03:00 Alessio Igor Bogani <alessioigorbogani at gmail.com>:

> Hi,
>
> On 29 September 2015 at 13:53, Alessio Igor Bogani
> <alessioigorbogani at gmail.com> wrote:
> > Hi David,
> >
> > On 28 September 2015 at 16:05, David Timothy Strauss
> > <david at davidstrauss.net> wrote:
> >> On Mon, Sep 28, 2015 at 1:19 AM Alessio Igor Bogani
> >> <alessioigorbogani at gmail.com> wrote:
> > [...]
> >>> The systemd 219 brought with Yocto "Fido" can't set hostname supplied
> >>> by DHCP on my Beaglebone:
> > [...]
> >> "Could not set hostname: No route to host" sounds like systemd is
> trying to
> >> resolve and ping the provided hostname. But, it's failing, and so
> systemd is
> >> deciding that it's not a usable hostname. Doesn't seem related to the
> DHCP
> >> protocol implementation at all.
>
> If I enable debug:
> Oct 02 08:10:43 localhost systemd-networkd[277]: Got message
> type=error sender=:1.4 destination=:1.2 object=n/a interface=n/a
> member=n/a cookie=5 reply_cookie=12 error=The name
> org.freedesktop.PolicyKit1 was not provided by any .service files
> Oct 02 08:10:43 localhost systemd-networkd[277]: eth0: Could not set
> hostname: No route to host
>
> Evidently Yocto builds systemd enabling polkit without provides it. So
> I added it and an additional polkit's rule
> (https://bugs.freedesktop.org/show_bug.cgi?id=81626) and my Beaglebone
> retrieve and set host-name correctly.
>
> I would prefer avoid PolicyKit. Moreover in the systemd 219's README
> PolicyKit is stated as optional (line 141). So I have rebuild systemd
> disabling policykit explicitly and it doesn't work:
>
> Oct 02 13:35:10 localhost systemd-networkd[235]: Got message
> type=error sender=:1.4 destination=:1.2 object=n/a interface=n/a
> member=n/a cookie=4 reply_cookie=12 error=Permission denied
> Oct 02 13:35:10 localhost systemd-networkd[235]: eth0            :
> Could not set hostname: Permission denied
>
> Do you have any tips?
>
> Thank in advance!
>
> Ciao,
> Alessio
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel
>



-- 
*Laércio de Sousa*
*Orientador de Informática*
*Escola Municipal "Professor Eulálio Gruppi"*
*Rua Ismael da Silva Mello, 559, Mogi Moderno*
*Mogi das Cruzes - SPCEP 08717-390*
Telefone: (11) 4726-8313
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20151002/56c3d47a/attachment-0001.html>


More information about the systemd-devel mailing list