Slow boot to run systemd unit

Hi,

I’m running a systemd unit to configure and bring up the CAN interfaces. There is a big delay before my systemd unit gets run. What could be causing this? I hope to run my application as a systemd unit as well, and it needs to boot as fast as possible. See the dmesg output below.

Thanks,
Felix

$ cat /etc/nv_tegra_release
# R32 (release), REVISION: 7.5, GCID: 36557527, BOARD: t186ref, EABI: aarch64, DATE: Tue Jun 11 23:18:04 UTC 2024
8.580154] [11-18 04:33:28.557] wl_notify_connect_status: wl_bss_connect_done succeeded with 5a:07:7d:0e:7e:98
[    8.586890] [11-18 04:33:28.564] dhd_dump_eapol_4way_message: ifidx: 0 ETHER_TYPE_802_1X [RX] : M1 of 4way
[    8.597070]  wl_bss_connect_done :
[    8.597072] Report connect result - connection succeeded
[    8.600246] [11-18 04:33:28.577] dhd_dump_eapol_4way_message: ifidx: 0 ETHER_TYPE_802_1X [TX] : M2 of 4way
[    8.605736] [11-18 04:33:28.582] dhd_dump_eapol_4way_message: ifidx: 0 ETHER_TYPE_802_1X [RX] : M3 of 4way
[    8.606879] [11-18 04:33:28.584] dhd_dump_eapol_4way_message: ifidx: 0 ETHER_TYPE_802_1X [TX] : M4 of 4way
[    8.626510] [11-18 04:33:28.603] wl_notify_connect_status: wl_bss_connect_done succeeded with 5a:07:7d:0e:7e:98
[    8.628497] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
[    8.655783] dhd_ndo_add_ip: ndo ip addr add failed, ret = -23
[    8.655793] dhd_inet6_work_handler: Adding host ip for NDO failed -23
[    8.697995] ifidx:0 DHCP - REQUEST [TX]
[    9.858801] ifidx:0 DHCP - ACK [RX]
[   10.132486] dhd_ndo_add_ip: ndo ip addr add failed, ret = -23
[   10.132498] dhd_inet6_work_handler: Adding host ip for NDO failed -23
[   10.133250] dhd_ndo_add_ip: ndo ip addr add failed, ret = -23
[   10.133260] dhd_inet6_work_handler: Adding host ip for NDO failed -23
[   31.901396] spmic-ldo0: disabling
[   31.901773] spmic-ldo1: disabling
[   31.902016] en-vdd-sd: disabling
[   31.902027] en-vdd-cam: disabling
[   31.902040] vdd-usb0-5v: disabling
[   31.902051] vdd-usb1-5v: disabling
[   31.902066] en-vdd-disp-3v3: disabling
[   31.902076] en-mdm-pwr-3v7: disabling
[   31.902086] en-vdd-disp-1v8: disabling
[   31.902096] en-vdd-cam-hv-2v8: disabling
[   31.902105] en-vdd-cam-1v2: disabling
[   31.902116] vdd-fan: disabling
[   31.902125] vdd-3v3: disabling
[   31.902137] en-vdd-vcm-2v8: disabling
[   31.902149] vdd-sys-bl: disabling
[   31.902159] en-vdd-sys: disabling
[  123.238784] Bridge firewalling registered
[  123.255932] nf_conntrack version 0.5.0 (65536 buckets, 262144 max)
[  123.356165] Netfilter messages via NETLINK v0.30.
[  123.358149] ctnetlink v0.93: registering with nfnetlink.
[  123.462801] IPv6: ADDRCONF(NETDEV_UP): docker0: link is not ready
[  123.743838] mttcan c310000.mttcan can0: Bitrate set
[  123.753924] mttcan_controller_config: ctrlmode 0
[  123.753948] mttcan c310000.mttcan can0: Bitrate set
[  123.754050] IPv6: ADDRCONF(NETDEV_UP): can0: link is not ready
[  123.764576] mttcan c320000.mttcan can1: Bitrate set

Could I stop some of this?

systemd-analyze blame
      2min 205ms systemd-networkd-wait-online.service
         31.175s apt-daily.service
          2.808s dev-mmcblk0p1.device
          1.566s dev-zram1.device
          1.560s dev-zram0.device
          1.484s dev-zram3.device
          1.469s dev-zram2.device
          1.270s networkd-dispatcher.service
          1.246s apt-daily-upgrade.service
          1.206s snapd.service
          1.178s nv-l4t-usb-device-mode.service

Hi felix76,

Are you using the devkit or custom board for TX2?

How do you perform this?
Please share your script/services and the steps to setup.

Have you also checked /var/log/syslog to check what causes it loading late?

Hi Kevin,
Official Devkit carrier board.

It seems like I can ssh and start a session before the systemd runs my can-bus-start.service. Perhaps I have it misconfigured. I want it to start as soon as possible so I can then start another service running my application.

There is a lot of syslog in the attached file.
syslog.txt (229.3 KB)

$ cat /etc/systemd/system/can-bus-start.service
[Unit]
Description=Bring up can0 and can1
After=multi-user.target

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/sbin/ip link set can0 type can bitrate 500000 restart-ms 100 ; /sbin/ifconfig can0 up ; /sbin/ip link set can1 type can bitrate 500000 restart-ms 100 ; /sbin/ifconfig can1 up
ExecReload=/sbin/ifconfig can0 down ; /sbin/ifconfig can1 down ; /sbin/ip link set can0 type can bitrate 500000 restart-ms 100 ; /sbin/ifconfig can0 up ; /sbin/ip link set can1 type can bitrate 500000 restart-ms 100 ; /sbin/ifconfig can1 up
ExecStop=/sbin/ifconfig can0 down ; /sbin/ifconfig can1 down

[Install]
WantedBy=multi-user.target
$ systemctl status can-bus-start
* can-bus-start.service - Bring up can0 and can1
   Loaded: loaded (/etc/systemd/system/can-bus-start.service; enabled; vendor preset: enabled)
   Active: active (exited) since Tue 2024-11-19 09:42:35 NZDT; 27min ago
  Process: 6314 ExecStart=/sbin/ifconfig can1 up (code=exited, status=0/SUCCESS)
  Process: 6267 ExecStart=/sbin/ip link set can1 type can bitrate 500000 restart-ms 100 (code=exited, status=0/SUCCESS)
  Process: 6263 ExecStart=/sbin/ifconfig can0 up (code=exited, status=0/SUCCESS)
  Process: 6250 ExecStart=/sbin/ip link set can0 type can bitrate 500000 restart-ms 100 (code=exited, status=0/SUCCESS)
 Main PID: 6314 (code=exited, status=0/SUCCESS)

Nov 19 09:42:35 sampextx2 systemd[1]: Starting Bring up can0 and can1...
Nov 19 09:42:35 sampextx2 systemd[1]: Started Bring up can0 and can1.

I am running a samba share and the tx2 is connected to wifi. Perhaps I could start my can bus config on a different target? Sorry, I’m new to all this stuff!

$ systemd-analyze critical-chain
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.

graphical.target @2min 1.271s
`-multi-user.target @2min 1.267s
  `-smbd.service @2min 1.099s +168ms
    `-nmbd.service @2min 793ms +303ms
      `-network-online.target @2min 773ms
        `-network.target @1.840s
          `-NetworkManager.service @1.087s +752ms
            `-dbus.service @952ms
              `-basic.target @772ms
                `-sockets.target @772ms
                  `-snapd.socket @765ms +6ms
                    `-sysinit.target @761ms
                      `-sys-fs-fuse-connections.mount @4.833s +11ms
                        `-systemd-modules-load.service @300ms +181ms
                          `-systemd-journald.socket @264ms
                            `-system.slice @261ms
                              `--.slice @257ms

I made the can-bus-start.service start after network.target and it still works so that gets around waiting for the network to come online. It is still a bit strange that it takes about 2 minutes to get the network online, but probably not an issue for me.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.