Re: [systemd-devel] Waiting for (transient) hostname configuration

2022-04-20 Thread Alessio Igor Bogani
Hi Lennart,

On Wed, 20 Apr 2022 at 16:47, Lennart Poettering  wrote:
[...]
> > I use systemd-networkd and systemd-networkd-wait-online is enabled but
> > unfortunately it doesn't work anyway.

If you don't mind I show you one of my Unit files:

[Unit]
Description=Tango Starter service
Requires=network-online.target nss-lookup.target
Wants=tangorc.service
After=network-online.target tangorc.service nss-lookup.target
Conflicts=shutdown.target
RequiresMountsFor=/runtime

[Service]
User=controls
Group=controls
# ExecStart=/usr/bin/Starter %H
ExecStart=/bin/sh -c 'sleep 1; exec /usr/bin/Starter `hostname`'
KillMode=process
RestartSec=5s
Restart=on-failure

[Install]
WantedBy=multi-user.target

> What doesn't work precisely?

The %H specifier in the commented ExecStart always returns
"localhost". The following ExecStart is my workaround to have the
hostname provided by DHCP (in the first version it was a while loop
but a sleep works anyway and make things less convoluted).

Ciao,
Alessio


Re: [systemd-devel] Waiting for (transient) hostname configuration

2022-04-20 Thread Alessio Igor Bogani
Hi Lennart,

On Tue, 19 Apr 2022 at 11:41, Lennart Poettering  wrote:
[...]
> the unit files are *loaded*, i.e. typically at earliest boot, long
> before they are actually *started*. Thus, if you change the hostname

I understand now. It was the evaluation time of the specifier that I
have missed. I have just realized that my question was dumb, sorry for
that.

[...]
> use. If you use systemd-networkd, then the
> sytemd-network-wait-online.service is what you want to use. If you
> enable that then network-online.target should be the point where DHCP
> is acquired and thus also the hostname in effect.

I use systemd-networkd and systemd-networkd-wait-online is enabled but
unfortunately it doesn't work anyway. I have also tried to request
systemd to execute systemd-hostnamed "Before = nss-lookup.target" (*)
without success.
I left the little shell script inside to ExecStart to solve my problem
waiting for a better solution.

Thanks Lennart for time, consideration and kindness.

Have a nice and safe day!

Ciao,
Alessio

(*) All my Units use "After = network-online.target nss-lookup.target"


[systemd-devel] Waiting for (transient) hostname configuration

2022-04-19 Thread Alessio Igor Bogani
Dear systemd developers,

Sorry for my very bad english.

We use the hostname provided by DHCP to start the right subset of our
applications on each of our machines (in other words the transient
hostname is used as predictable machine identifier).

Make it works on the ancient SysV is straightforward but I can't find
a (reasonable) way to achieve the same goal with systemd. We already
use both "Requires" and "After" with "network-online.target
nss-lookup.target" into our units but it isn't enough. When our units
start they obtain "localhost" from %H specifier. We don't find a way
to wait for (transient) hostname to be configured. The only solution
that it seems to work is to replace our binary in ExecStart with a
script which make a busy-loop until `hostname` output doesn't differ
from "localhost".

Is there a better way?

Thank you very much!

Ciao,
Alessio


[systemd-devel] Waiting for (transient) hostname configuration

2022-04-19 Thread Alessio Igor Bogani
Dear systemd developers,

Sorry for my very bad english.

We use the hostname provided by DHCP to start the right subset of our
applications on each of our machines (in other words the transient
hostname is used as predictable machine identifier).

Make it works on the ancient SysV is straightforward but I can't find
a (reasonable) way to achieve the same goal with systemd. We already
use both "Requires" and "After" with "network-online.target
nss-lookup.target" into our units but it isn't enough. When our units
start they obtain "localhost" from %H specifier. We don't find a way
to wait for (transient) hostname to be configured. The only solution
that it seems to work is to replace our binary in ExecStart with a
script which make a busy-loop until `hostname` output doesn't differ
from "localhost".

Is there a better way?

Thank you very much!

Ciao,
Alessio


[systemd-devel] Boot error on PowerPC

2016-07-13 Thread Alessio Igor Bogani
Dear systemd developers and maintainers,

I incurred in the following error during the boot on a PowerPC based
on MPC7410 cpu using systemd v230:

systemd[1]: Failed to insert module 'kdbus': Function not implemented
random: systemd urandom read with 94 bits of entropy available
systemd[1]: Mounting cgroup to /sys/fs/cgroup/devices of type cgroup
with options devices.
systemd[1]: Mounting cgroup to /sys/fs/cgroup/cpuset of type cgroup
with options cpuset.
systemd[1]: Mounting cgroup to /sys/fs/cgroup/cpu,cpuacct of type
cgroup with options cpu,cpuacct.
systemd[1]: Mounting cgroup to /sys/fs/cgroup/debug of type cgroup
with options debug.
systemd[1]: Mounting cgroup to /sys/fs/cgroup/net_cls of type cgroup
with options net_cls.
systemd[1]: Mounting cgroup to /sys/fs/cgroup/blkio of type cgroup
with options blkio.
systemd[1]: Mounting cgroup to /sys/fs/cgroup/memory of type cgroup
with options memory.
systemd[1]: Mounting cgroup to /sys/fs/cgroup/freezer of type cgroup
with options freezer.
systemd[1]: systemd 230 running in system mode. (-PAM -AUDIT -SELINUX
+IMA -APPARMOR +SMACK +SYSVINIT +UTMP -LIBCRYPTSETUP -GCRYPT +GNUTLS
+ACL +XZ -LZ4 -SECCOMP +BLKID -ELFUTILS +KMOD -IDN)
systemd[1]: No virtualization found in DMI
systemd[1]: No virtualization found in CPUID
systemd[1]: Virtualization XEN not found, /proc/xen/capabilities does not exist
systemd[1]: No virtualization found in /proc/device-tree/*
systemd[1]: No virtualization found in /proc/cpuinfo.
systemd[1]: This platform does not support /proc/sysinfo
systemd[1]: Found VM virtualization none
systemd[1]: Detected architecture ppc.

Welcome to system!

systemd[1]: No hostname configured.
systemd[1]: Set hostname to .
systemd[1]: Initializing machine ID from random generator.
systemd[1]: Using cgroup controller name=systemd. File system
hierarchy is at /sys/fs/cgroup/systemd.
systemd[1]: Installed release agent.
systemd[1]: Controller 'cpu' supported: no
systemd[1]: Controller 'cpuacct' supported: yes
systemd[1]: Controller 'io' supported: yes
systemd[1]: Controller 'blkio' supported: yes
systemd[1]: Controller 'memory' supported: no
systemd[1]: Controller 'devices' supported: yes
systemd[1]: Controller 'pids' supported: yes
systemd[1]: Set up TFD_TIMER_CANCEL_ON_SET timerfd.
systemd[1]: Enabling showing of status.
systemd[125]: Spawned
/lib/systemd/system-generators/systemd-hibernate-resume-generator as
126.
systemd[125]: Spawned
/lib/systemd/system-generators/systemd-getty-generator as 127.
systemd[125]: Spawned
/lib/systemd/system-generators/systemd-gpt-auto-generator as 128.
systemd-getty-generator[127]: Automatically adding serial getty for /dev/ttyS0.
systemd[125]: Spawned
/lib/systemd/system-generators/systemd-debug-generator as 129.
systemd[125]: Spawned
/lib/systemd/system-generators/systemd-rc-local-generator as 130.
systemd[125]: Spawned
/lib/systemd/system-generators/systemd-dbus1-generator as 131.
random: nonblocking pool is initialized
systemd[131]: Failed to execute
/lib/systemd/system-generators/systemd-dbus1-generator: Connection
reset by peer
systemd[125]: /lib/systemd/system-generators/systemd-system-update-generator
is empty (a mask).
systemd[125]: /lib/systemd/system-generators/systemd-sysv-generator is
empty (a mask).
systemd[125]: /lib/systemd/system-generators/systemd-fstab-generator
is empty (a mask).
systemd[125]: /lib/systemd/system-generators/systemd-hibernate-resume-generator
succeeded.
systemd[130]: Failed to execute
/lib/systemd/system-generators/systemd-rc-local-generator: Connection
reset by peer
systemd[129]: Failed to execute
/lib/systemd/system-generators/systemd-debug-generator: Exec format
error
Core dump to |/bin/false pipe failed
systemd[125]: /lib/systemd/system-generators/systemd-dbus1-generator
failed with error code 1.
systemd[125]: /lib/systemd/system-generators/systemd-gpt-auto-generator
failed with error code 127.
systemd[125]: /lib/systemd/system-generators/systemd-debug-generator
failed with error code 1.
systemd[125]: /lib/systemd/system-generators/systemd-rc-local-generator
failed with error code 1.
systemd[125]: /lib/systemd/system-generators/systemd-getty-generator
terminated by signal BUS.
systemd[1]: system-generators succeeded.
systemd[1]: Failed to stat /etc/systemd/system.control: Input/output error
systemd[1]: Failed to stat /etc/systemd/system: Input/output error
systemd[1]: Failed to stat /lib/systemd/system: Input/output error
systemd[1]: Failed to stat /usr/lib/systemd/system: Input/output error
systemd[1]: Looking for unit files in (higher priority first):
systemd[1]: /etc/systemd/system.control
systemd[1]: /run/systemd/transient
systemd[1]: /etc/systemd/system
systemd[1]: /run/systemd/system
systemd[1]: /lib/systemd/system
systemd[1]: /usr/lib/systemd/system
systemd[1]: Failed to open directory /etc/systemd/system.control,
ignoring: Input/output error
systemd[1]: Failed to open directory /etc/systemd/system, ignoring:
Input/output error
systemd[1]: Failed to open 

Re: [systemd-devel] systemd and hostname supplied by DHCP

2015-10-05 Thread Alessio Igor Bogani
Hi,

On 3 October 2015 at 15:34, Lennart Poettering  wrote:
[...]
> Well, we need some kind of policy framework in place there that allows
> the "systemd-networkd" user to set the hostname. If you disable
> PolicyKit you have none, and hence the permission is denied.

So I'll install polkit. The only downside is that polkit drag
Javascript interpreter in which isn't a typical package for an
embedded system due it's footprint but I suspect that I should live
with it.  :-)

Thanks David, LaƩrcio and Lennart!

Ciao,
Alessio
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] systemd and hostname supplied by DHCP

2015-10-02 Thread Alessio Igor Bogani
Hi,

On 29 September 2015 at 13:53, Alessio Igor Bogani
<alessioigorbog...@gmail.com> wrote:
> Hi David,
>
> On 28 September 2015 at 16:05, David Timothy Strauss
> <da...@davidstrauss.net> wrote:
>> On Mon, Sep 28, 2015 at 1:19 AM Alessio Igor Bogani
>> <alessioigorbog...@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@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] systemd and hostname supplied by DHCP

2015-09-29 Thread Alessio Igor Bogani
Hi David,

On 28 September 2015 at 16:05, David Timothy Strauss
<da...@davidstrauss.net> wrote:
> On Mon, Sep 28, 2015 at 1:19 AM Alessio Igor Bogani
> <alessioigorbog...@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.

This doesn't seem the case:

ssh root@gallinella
root@gallinella's password:
localhost:~# ping gallinella
PING gallinella.elettra.trieste.it (192.168.205.87) 56(84) bytes of data.
64 bytes from gallinella.elettra.trieste.it (192.168.205.87):
icmp_seq=1 ttl=64 time=0.255 ms
64 bytes from gallinella.elettra.trieste.it (192.168.205.87):
icmp_seq=2 ttl=64 time=0.237 ms
64 bytes from gallinella.elettra.trieste.it (192.168.205.87):
icmp_seq=3 ttl=64 time=0.218 ms
^C
--- gallinella.elettra.trieste.it ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 0.218/0.236/0.255/0.023 ms
localhost:~# cat /etc/resolv.conf
# This file is managed by systemd-resolved(8). Do not edit.
#
# Third party programs must not access this file directly, but
# only through the symlink at /etc/resolv.conf. To manage
# resolv.conf(5) in a different way, replace the symlink by a
# static file or a different symlink.

nameserver 140.105.4.3
nameserver 140.105.2.5
nameserver 140.105.8.3
search elettra.trieste.it
localhost:~# hostnamectl
   Static hostname: n/a
Transient hostname: localhost
 Icon name: computer
Machine ID: c3f437527c6e4f62a27ec7725dbdef6d
   Boot ID: d74e8174075b458ebe9105d93c83a029
  Operating System: FLOP pre0.5 (fido)
Kernel: Linux 3.14.39ltsi-rt37-yocto-preempt-rt
  Architecture: arm
localhost:~# journalctl -u systemd-networkd.service
-- Logs begin at Tue 2015-09-29 13:32:00 CEST, end at Tue 2015-09-29
13:33:54 CEST. --
Sep 29 13:32:07 localhost systemd[1]: Starting Network Service...
Sep 29 13:32:07 localhost systemd-networkd[231]: Enumeration completed
Sep 29 13:32:07 localhost systemd[1]: Started Network Service.
Sep 29 13:32:08 localhost systemd-networkd[231]: eth0:
eth0: could not bring up interface: Invalid argument
Sep 29 13:32:11 localhost systemd-networkd[231]: eth0:
gained carrier
Sep 29 13:32:11 localhost systemd-networkd[231]: eth0:
DHCPv4 address 192.168.205.87/24 via 192.168.205.1
Sep 29 13:32:11 localhost systemd-networkd[231]: eth0:
link configured
Sep 29 13:32:12 localhost systemd-networkd[231]: eth0:
Could not set hostname: No route to host

Thanks a lot anyway!

Saluti,
Alessio
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] systemd and hostname supplied by DHCP

2015-09-28 Thread Alessio Igor Bogani
Hi systemd developers and users,

The systemd 219 brought with Yocto "Fido" can't set hostname supplied
by DHCP on my Beaglebone:

eth0: eth0: could not bring up interface:
Invalid argument
eth0: gained carrier
eth0: DHCPv4 address 192.168.205.87/24 via 192.168.205.1
eth0: link configured
eth0: Could not set hostname: No route to host

How can I fix this error?

On my desktop machine (Arch Linux with systemd 225) I don't receive
that error message and both use the same DHCP server.

I dumped DHCP protocol to be user that DHCP contains the right
hostname for both machines.

Thank you very much.

Ciao,
Alessio
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel