linux启动的时候,systemd耗费了大量的时间,求指导

启动讨论 grub/grub2/syslinux/grub4dos/Lilo
回复
chengshuyi
帖子: 20
注册时间: 2018-10-18 10:18
系统: ubuntu16

linux启动的时候,systemd耗费了大量的时间,求指导

#1

帖子 chengshuyi » 2019-06-05 8:35

从下面可以看到到网络初始化之前就几秒钟,到了systemd这个地方,时间太长了。从这里看貌似实在配置网络文件系统。

1. 本以为是要拷贝大量的文件到NFS,不过我看了下wireshark,网络量很小,到目前为止才2000个包。
2. 实在想不出什么原因了。。。

代码: 全选

[    1.193057] 9pnet: Installing 9P2000 support
[    1.197400] Key type dns_resolver registered
[    1.202518] registered taskstats version 1
[    1.214113] failed to find ocotp node
[    1.218805] cpu cpu0: registered imx8mq-cpufreq
[    1.224430] hctosys: unable to open rtc device (rtc0)
[    1.302921] Atheros 8031 ethernet 30be0000.ethernet-1:00: attached PHY driver [Atheros 8031 ethernet] (mii_bus:phy_addr=30be0000.ethernet-1:00, irq=POLL)
[    1.320673] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[    4.399202] fec 30be0000.ethernet eth0: Link is Up - 1Gbps/Full - flow control rx/tx
[    4.409566] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[    4.429555] IP-Config: Guessing netmask 255.255.255.0
[    4.434593] IP-Config: Complete:
[    4.437865]      device=eth0, hwaddr=00:04:9f:05:60:41, ipaddr=192.168.168.2, mask=255.255.255.0, gw=255.255.255.255
[    4.448198]      host=192.168.168.2, domain=, nis-domain=(none)
[    4.454065]      bootserver=255.255.255.255, rootserver=192.168.168.1, rootpath=
[    4.461919] ALSA device list:
[    4.464905]   No soundcards found.
[    4.508169] VFS: Mounted root (nfs4 filesystem) on device 0:16.
[    4.515506] devtmpfs: mounted
[    4.519226] Freeing unused kernel memory: 1280K
[    4.714825] random: fast init done
[    5.124958] systemd[1]: System time before build time, advancing clock.
[    5.193481] systemd[1]: systemd 237 running in system mode. (+PAM -AUDIT -SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP -LIBCRYPTSETUP -GCRYPT -GNUTLS +ACL +XZ -LZ4 -SECCOMP +BLKID -ELFUTILS +KMOD -ID)
[    5.214749] systemd[1]: Detected architecture arm64.
[   35.935099] systemd[1]: Set hostname to <imx8mqevk>.
[   66.793662] systemd[1]: File /lib/systemd/system/systemd-journald.service:35 configures an IP firewall (IPAddressDeny=any), but the local system does not support BPF/cgroup based firewalling.
[   66.810366] systemd[1]: Proceeding WITHOUT firewalling in effect! (This warning is only shown for the first loaded unit using IP firewalling.)
[   67.757761] random: systemd: uninitialized urandom read (16 bytes read)
[   67.764387] systemd[1]: Reached target Host and Network Name Lookups.
[   99.407098] random: systemd: uninitialized urandom read (16 bytes read)
[   99.413716] systemd[1]: Reached target Swap.
[  130.125630] random: systemd: uninitialized urandom read (16 bytes read)
[  130.132234] systemd[1]: Reached target Remote File Systems.
[  160.847094] random: systemd: uninitialized urandom read (16 bytes read)
[  160.855094] systemd[1]: Created slice User and Session Slice.
[  184.621634] random: crng init done
[  191.566470] systemd[1]: Created slice System Slice.
[  222.287379] systemd[1]: Listening on udev Kernel Socket.
[  253.007356] systemd[1]: Listening on /dev/initctl Compatibility Named Pipe.
[  283.727413] systemd[1]: Listening on Network Service Netlink Socket.
[  314.445795] systemd[1]: Started Forward Password Requests to Wall Directory Watch.
[  345.167865] systemd[1]: Created slice system-serial\x2dgetty.slice.
[  375.887393] systemd[1]: Listening on Syslog Socket.
[  406.607283] systemd[1]: Started Dispatch Password Requests to Console Directory Watch.
[  437.327372] systemd[1]: Listening on udev Control Socket.
[  468.047810] systemd[1]: Created slice system-getty.slice.
[  498.765661] systemd[1]: Reached target Paths.
[  529.485629] systemd[1]: Reached target Slices.
[  560.205898] systemd[1]: Listening on Journal Audit Socket.
[  590.927458] systemd[1]: Listening on Journal Socket.
[  621.663997] systemd[1]: Starting Load Kernel Modules...
[  621.828560] galcore: loading out-of-tree module taints kernel.
[  652.374129] systemd[1]: Starting Create list of required static device nodes for the current kernel...
[  683.088224] systemd[1]: Mounting POSIX Message Queue File System...
[  713.810014] systemd[1]: Mounting Huge Pages File System...
头像
astolia
论坛版主
帖子: 6445
注册时间: 2008-09-18 13:11

Re: linux启动的时候,systemd耗费了大量的时间,求指导

#2

帖子 astolia » 2019-06-05 11:45

你要等启动完毕后,再用 systemd-analyze blame 和 systemd-analyze critical-chain 看才知道是哪个卡住了
chengshuyi
帖子: 20
注册时间: 2018-10-18 10:18
系统: ubuntu16

Re: linux启动的时候,systemd耗费了大量的时间,求指导

#3

帖子 chengshuyi » 2019-06-06 20:22

astolia 写了: 2019-06-05 11:45 你要等启动完毕后,再用 systemd-analyze blame 和 systemd-analyze critical-chain 看才知道是哪个卡住了
进不了终端,运行完了,都没有显示输入密码的提示。不知道你发现没有,systemd每一个大概都消耗了30秒以及没有[ok] [fail]类似的输出,感觉像是一个定时任务,在30秒内没有完成或者返回状态,就判断没有完成或者完成。
头像
astolia
论坛版主
帖子: 6445
注册时间: 2008-09-18 13:11

Re: linux启动的时候,systemd耗费了大量的时间,求指导

#4

帖子 astolia » 2019-06-07 23:09

感觉你不知道systemd是个什么东西?
systemd本来就设计成并行启动,一些明显可以并行化的任务都要等个30秒才启动,本身就说明系统存在很大问题了。
不知道你这个系统是哪里来的,很可能并没有对你的板子进行过针对性的适配
chengshuyi
帖子: 20
注册时间: 2018-10-18 10:18
系统: ubuntu16

Re: linux启动的时候,systemd耗费了大量的时间,求指导

#5

帖子 chengshuyi » 2019-06-08 10:38

astolia 写了: 2019-06-07 23:09 感觉你不知道systemd是个什么东西?
systemd本来就设计成并行启动,一些明显可以并行化的任务都要等个30秒才启动,本身就说明系统存在很大问题了。
不知道你这个系统是哪里来的,很可能并没有对你的板子进行过针对性的适配
问题大概找到了,是串口的问题。因为status_printf里面使用了/dev/console。我在bootargs里面加上systemd.log_status=0。就可以正常启动。
但是可能串口问题,没有登录提示框出现。

我怀疑是不是/dev/console使用dma传输数据的,因为我是跑在hypervisor上面,只实现了虚拟串口,但是没有加dma功能。
回复