Changes

Jump to: navigation, search

XELK-AN-008: How to use systemd on an Embedded system

3,414 bytes added, 12:40, 20 September 2019
systemd-analyze
=== critical-chain ===
[[File:Systemd-analyze-critical-chain.png|800px]]
 
== Logging ==
 
Systemd has its own logging process called <code>journal</code> avoiding to start the ''syslog'' daemon. For the status information it is possible to use <code>journalctl</code>.
 
journalctl -f
 
for displaying the new log messages (similar to <code>tail -f /var/log/messages</code>)
 
journalctl -p
 
with '''-p''' parameter is it possible to set the log ''severity'' :
 
{| class="wikitable"
|-
! Value !! Severity !! Keyword
|-
| 0 || Emergency || emerg
|-
| 1 || Alert || alert
|-
| 2|| Critical || crit
|-
| 3|| Error || err
|-
| 4|| Warning || warning
|-
| 5|| Notice || notice
|-
| 6|| Information || info
|-
| 7|| Debug || debug
|}
 
journalctl --since ''<time>''
 
with different keywords like:
 
<pre>
root@imx6qxelk:/home# journalctl --since "20 min ago"
-- Logs begin at Wed 2019-06-26 13:22:41 UTC, end at Mon 2019-07-08 13:22:01 UTC. --
Jul 08 13:11:54 imx6qxelk kernel: ERROR: v4l2 capture: slave not found!
Jul 08 13:11:54 imx6qxelk kernel: ERROR: v4l2 capture: slave not found!
Jul 08 13:11:54 imx6qxelk kernel[551]: [ 3157.796945] ERROR: v4l2 capture: slave not found!
Jul 08 13:11:54 imx6qxelk kernel[551]: [ 3157.801690] ERROR: v4l2 capture: slave not found!
Jul 08 13:11:54 imx6qxelk kernel: ERROR: v4l2 capture: slave not found!
Jul 08 13:11:54 imx6qxelk kernel: ERROR: v4l2 capture: slave not found!
Jul 08 13:11:54 imx6qxelk kernel[551]: [ 3157.859371] ERROR: v4l2 capture: slave not found!
Jul 08 13:11:54 imx6qxelk kernel[551]: [ 3157.864406] ERROR: v4l2 capture: slave not found!
</pre>
 
 
journalctl -u ''<unit_name>''
 
for displaying the log related to a specific ''Unit'':
 
<pre>
root@imx6qxelk:/home# journalctl -u systemd-networkd
-- Logs begin at Wed 2019-06-26 13:22:41 UTC, end at Mon 2019-07-08 13:25:01 UTC. --
Jul 05 11:02:13 imx6qxelk systemd-networkd[572]: Enumeration completed
Jul 05 11:02:13 imx6qxelk systemd-networkd[572]: eth0: IPv6 enabled for interface: Success
Jul 05 11:02:15 imx6qxelk systemd-networkd[572]: eth0: Gained carrier
Jul 05 11:02:16 imx6qxelk systemd-networkd[572]: eth0: Gained IPv6LL
Jul 05 11:02:29 imx6qxelk systemd-networkd[572]: eth0: Configured
</pre>
 
journalctl /dev/''<node_name>''
 
for displaying the log related to a specific <code>/dev</code> device:
 
<pre>
root@imx6qxelk:~# journalctl /dev/fb0
-- Logs begin at Wed 2019-06-26 13:22:41 UTC, end at Thu 2019-07-11 09:07:01 UTC. --
Jun 26 13:22:41 imx6qxelk kernel: mxc_sdc_fb fb@0: registered mxc display driver ldb
Jun 26 13:22:41 imx6qxelk kernel: mxc_sdc_fb fb@0: using reserved memory region at 0x8e000000, size 2 MiB
Jun 26 13:22:41 imx6qxelk kernel: mxc_sdc_fb fb@0: assigned reserved memory node splashscreen
Jun 26 13:22:41 imx6qxelk kernel: mxc_sdc_fb fb@0: using memory region 0x8e000000 0x8e1fffff
</pre>
 
journalctl _UID=''<uid>''
 
for displaying the log related to a user_id:
 
<pre>
root@imx6qxelk:~# id messagebus
uid=995(messagebus) gid=993(messagebus) groups=993(messagebus)
root@imx6qxelk:~# journalctl _UID=993
-- Logs begin at Wed 2019-06-26 13:22:41 UTC, end at Thu 2019-07-11 09:14:01 UTC. --
Jul 10 14:42:48 imx6qxelk systemd-timesyncd[423]: Network configuration changed, trying to establish connection.
Jul 10 14:43:02 imx6qxelk systemd-timesyncd[423]: Network configuration changed, trying to establish connection.
Jul 11 07:38:31 imx6qxelk systemd-timesyncd[423]: Synchronized to time server 216.239.35.8:123 (time3.google.com).
</pre>
== Network Configuration ==
8,154
edits

Navigation menu