Re: [systemd-devel] : How to modify systemd so that the NTP function is disabled when systemd is first started?

2020-04-22 Thread www



hi Michal and Kevin,


We applied systemd to embedded Linux, so we often need to update/flash the 
whole system.  When we select disable time synchronization function, the 
embedded system will use the time itself. After we update the system and 
restart it, we need the time synchronization function is disabled. During the 
whole startup process, there is no automatic time synchronization, and the 
previous time is used. Because automatic time synchronization may change its 
original time. (Because the time of the system itself may be different from 
that of NTP time.) 


There is a timesyncd.conf file under the system,can the system automatically 
turn off the time synchronization function by modifying this file? 
In this way, when updating, I can save this file to solve this problem.




thanks,
Byron








At 2020-04-17 19:44:48, "Michał Zegan"  wrote:
>I am not quite sure what you mean, but... generally these are symlinks
>in /etc/systemd/system/multi-user.target.wants/ so you could delete them
>manually if your intention is to make the actual os image with this
>disabled from the start...
>
>W dniu 17.04.2020 o 12:10, www pisze:
>> 
>> I mean that this configuration can be preserved, even after I update the
>> system, this function can be saved.
>> 
>> thanks,
>> Byron
>> 
>> 
>> 
>> 
>> At 2020-04-17 18:06:15, "Kevin P. Fleming"  wrote:
>>>Both of those changes will stop the service from being started, even
>>>when the system is rebooted. You don't need to run these commands
>>>every time, running them one time will change the system configuration
>>>and the service will no longer be started.
>>>
>>>On Fri, Apr 17, 2020 at 2:52 AM www  wrote:

 hi Kevin ,

 Thank you very much for you help. But how can I save this way of closing 
 time synchronization by command after system boot up? After I update the 
 system, the first time I start it, time synchronization is still enabled 
 by default. It's not appropriate if I close it alone every time. So when I 
 need it start every time, this function is off.


 thanks,
 Byron





 At 2020-04-16 18:28:30, "Kevin P. Fleming"  wrote:
 >There is no need to modify systemd.
 >
 >$ systemctl disable systemd-timesyncd
 >
 >That command will stop the systemd-timesyncd service from being
 >started. It may also be necessary to mask it:
 >
 >$ systemctl mask systemd-timesyncd
 >
 >On Thu, Apr 16, 2020 at 6:22 AM www  wrote:
 >>
 >> Dear all,
 >>
 >> I want to ask a question,How to modify systemd so that the NTP function 
 >> is disabled when systemd is first started?
 >>
 >>  The default state of systend is to synchronize time from NTP. We can 
 >> use timedatectl command to disable NTP synchronize time. But if I flash 
 >> the system, the NTP  synchronize time function will auto enable.  so I 
 >> want modify the systemd and disable NTP synchronize time in default 
 >> state.
 >>
 >> thanks,
 >> Byron
 >>
 >>
 >>
 >>
 >> ___
 >> systemd-devel mailing list
 >> systemd-devel@lists.freedesktop.org
 >> https://lists.freedesktop.org/mailman/listinfo/systemd-devel




>> 
>> 
>> 
>>  
>> 
>> 
>> ___
>> systemd-devel mailing list
>> systemd-devel@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/systemd-devel
>> 
>
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] network-online.target time

2020-04-22 Thread Peter Morrow
Hi Folks,

I'm trying to optimise our boot process and have started to look at
the time it takes for the network to come up (a single interface to be
routable) when using systemd-networkd:

root@HOST:/# systemd-analyze critical-chain network-online.target --no-
pager
The time after the unit is active or started is printed after the "@"
character.
The time the unit takes to start is printed after the "+" character.


network-online.target @4.144s
└─systemd-networkd-wait-online.service @615ms +3.527s
  └─systemd-networkd.service @582ms +30ms
└─systemd-tmpfiles-setup.service @315ms +63ms
  └─local-fs.target @314ms
root@HOST:/#

So, here systemd-networkd-wait-online.service seems to run for 3.5s -
I had initially though this is due to the RTT for DHCP but in doing a
packet capture for DHCP this isn't the case:

me@DHCP-SERVER:~$ sudo tshark -i eth0 -f "(ether src 28:16:a8:fd:53:77
|| ether dst 28:16:a8:fd:53:77) && (port 67 || port 68)"
Running as user "root" and group "root". This could be dangerous.
Capturing on 'eth0'
1 0.0  0.0.0.0 → 255.255.255.255 DHCP 333 DHCP
Discover - Transaction ID 0x5c9e3cd0
2 0.000157300  192.168.3.3 → 192.168.3.16 DHCP 373 DHCP Offer-
Transaction ID 0x5c9e3cd0
3 0.000695601  0.0.0.0 → 255.255.255.255 DHCP 345 DHCP Request
 - Transaction ID 0x5c9e3cd0
4 0.000771901  192.168.3.3 → 192.168.3.16 DHCP 373 DHCP ACK  -
Transaction ID 0x5c9e3cd0

So, that's 700us from discover to ack.

We have 3 network interfaces, only enP8p1s0f0np0 is of use to us:

root@HOST:/# networkctl status -a --no-pager
● 1: lo
   Link File: /usr/lib/systemd/network/99-default.link
Network File: n/a
Type: loopback
   State: carrier (unmanaged)
 Address: 127.0.0.1
  ::1


● 2: enP8p1s0f0np0
   Link File: /usr/lib/systemd/network/99-default.link
Network File: /etc/systemd/network/wired.network
Type: ether
   State: routable (configured)
Path: platform-6040.pcie-pci-0008:01:00.0
  Driver: bnxt_en
  HW Address: 28:16:a8:fd:53:77
 Address: 192.168.3.16
  2001:db8:0:1:2a16:a8ff:fefd:5377
  fe80::2a16:a8ff:fefd:5377
 Gateway: 192.168.3.1
  fe80::7683:efff:fed4:935
 DNS: 10.50.10.50
  10.50.50.50
 NTP: 10.222.184.12
Connected To: localhost on port Ethernet31/1


● 3: enP8p1s0f1np0
   Link File: /usr/lib/systemd/network/99-default.link
Network File: n/a
Type: ether
   State: off (unmanaged)
Path: platform-6040.pcie-pci-0008:01:00.1
  Driver: bnxt_en
  HW Address: 00:10:18:ad:05:01
root@HOST:/#

Networking configuration looks like this:

root@HOST:/# cat /etc/systemd/network/wired.network
[Match]
Name=eth* en*

[Network]
DHCP=v4
root@HOST:/# cat /etc/systemd/network/
blacklist_interfaces.network  wired.network
root@HOST:/# cat /etc/systemd/network/blacklist_interfaces.network
[Match]
Name=enP8p1s0f1*

[Network]
DHCP=no
LinkLocalAddressing=no
IPv6AcceptRA=false

[Link]
RequiredForOnline=no
Unmanaged=yes
root@HOST:/#

Our version is:

root@HOST:/# systemctl --version
systemd 239
+PAM +AUDIT +SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP
+LIBCRYPTSETUP -GCRYPT -GNUTLS -ACL +XZ -LZ4 -SECCOMP +BLKID -ELFUTILS
+KMOD -IDN2 -IDN -PCRE2 default-hierarchy=unified
root@HOST:/#

I've had a look at
https://github.com/systemd/systemd/blob/v239/src/network/wait-online/wait-online.c
and it really doesn't do much other than wait for the operational
state to be "routable".

Can anyone offer any suggestions for where I should look to try to
speed things up here?

Thanks!
Peter.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [systemd-level]: how to set property to read only in systemd?

2020-04-22 Thread www



Thank you very much for your help。


thanks,
Byron











At 2020-04-21 20:53:02, "Lennart Poettering"  wrote:
>On Di, 21.04.20 19:54, www (ouyangxua...@163.com) wrote:
>
>> hi Lennart,
>>
>>
>> I mean the DBUS property.
>>
>> root@demoboard:/# busctl set-property org.freedesktop.DBus 
>> /org/freedesktop/DBus org.freedesktop.DBus Features as 1 x
>>
>> Cannot set read-only property -- the default
>>
>>
>>
>>
>> root@demoboard:/# busctl set-property com.sugon.sensors.DISCRETE 
>> /com/sugon/sensors/HDD/HDD4_Status xyz.openbmc_project.Sensor.DiscreteAll 
>> FanDeviceInserted b true  -- new add
>>
>> root@demoboard:/#
>>
>>
>>
>> I want the property on Dbus is read only. Just can modify by the
>> special method and cannot  modify the property directly. How can I
>> change it like this?
>
>Is "com.sugon.sensors.DISCRETE" a service you implemented yourself?
>With the sd-bus API?
>
>In sd-bus you define a writable property in a vtable with the
>SD_BUS_WRITABLE_PROPERTY() macro, and a read-only one with
>SD_BUS_PROPERTY().
>
>But not sure I grok your question properly.
>
>Lennart
>
>--
>Lennart Poettering, Berlin
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel