有时开机和关机很慢

有时开机和关机很慢

系统似乎在启动和关闭的某个时刻卡住了。这是 Xubuntu 16.04。我想知道是什么原因导致这种缓慢。你能在日志中找到相关信息吗?有一些巨大的日志文件:

LC_ALL=C ls -Slr --si | tail -n 15

输出

-rw-rw-r-- 1 root              utmp  94k Aug 20 00:52 wtmp
-rw-r--r-- 1 root              root 105k Apr 29 13:20 dpkg.log.4.gz
-rw-r----- 1 syslog            adm  126k Aug 11 15:50 syslog.7.gz
-rw-r----- 1 syslog            adm  126k Aug 20 01:17 auth.log
-rw-r----- 1 syslog            adm  145k Aug 15 13:35 syslog.6.gz
-rw-r--r-- 1 root              root 177k May 16 18:21 boot.log
-rw-rw-r-- 1 root              utmp 293k Aug 17 00:21 lastlog
-rw-r--r-- 1 root              root 325k Aug 19 17:55 dpkg.log
-rw-r----- 1 syslog            adm  503k Aug 15 13:33 kern.log.1
-rw-r----- 1 syslog            adm  1.8M Aug 20 00:56 syslog.1
-rw-r----- 1 syslog            adm   23M Aug 19 17:17 syslog.2.gz
-rw-r----- 1 syslog            adm   29M Aug 18 08:57 syslog.3.gz
-rw-r----- 1 syslog            adm   30M Aug 16 09:06 syslog.5.gz
-rw-r----- 1 syslog            adm  111M Aug 17 08:43 syslog.4.gz
-rw-r----- 1 syslog            adm  3.4G Aug 20 01:22 kern.log

tail -55 /var/log/kern.log

输出

Aug 21 11:58:13 jarnos-3000-C200 NetworkManager[2253]: <info>  [1471769893.7132] device (wlp3s0): Activation: (wifi) connection 'jarnos-g' has security, and secrets exist.  No new secrets needed.
Aug 21 11:58:13 jarnos-3000-C200 NetworkManager[2253]: <info>  [1471769893.7146] Config: added 'ssid' value 'jarnos-g'
Aug 21 11:58:13 jarnos-3000-C200 NetworkManager[2253]: <info>  [1471769893.7152] Config: added 'scan_ssid' value '1'
Aug 21 11:58:13 jarnos-3000-C200 NetworkManager[2253]: <info>  [1471769893.7158] Config: added 'key_mgmt' value 'WPA-PSK'
Aug 21 11:58:13 jarnos-3000-C200 NetworkManager[2253]: <info>  [1471769893.7165] Config: added 'auth_alg' value 'OPEN'
Aug 21 11:58:13 jarnos-3000-C200 NetworkManager[2253]: <info>  [1471769893.7169] Config: added 'psk' value '<omitted>'
Aug 21 11:58:13 jarnos-3000-C200 NetworkManager[2253]: <info>  [1471769893.7254] sup-iface[0xbcf770,wlp3s0]: config: set interface ap_scan to 1
Aug 21 11:58:13 jarnos-3000-C200 NetworkManager[2253]: <info>  [1471769893.7579] device (wlp3s0): supplicant interface state: inactive -> scanning
Aug 21 11:58:16 jarnos-3000-C200 kernel: [   31.820883] wlp3s0: authenticate with dc:ee:06:95:dc:35
Aug 21 11:58:16 jarnos-3000-C200 kernel: [   31.826426] wlp3s0: send auth to dc:ee:06:95:dc:35 (try 1/3)
Aug 21 11:58:16 jarnos-3000-C200 NetworkManager[2253]: <info>  [1471769896.8940] device (wlp3s0): supplicant interface state: scanning -> authenticating
Aug 21 11:58:16 jarnos-3000-C200 kernel: [   31.829337] wlp3s0: authenticated
Aug 21 11:58:16 jarnos-3000-C200 kernel: [   31.832172] wlp3s0: associate with dc:ee:06:95:dc:35 (try 1/3)
Aug 21 11:58:16 jarnos-3000-C200 NetworkManager[2253]: <info>  [1471769896.9014] device (wlp3s0): supplicant interface state: authenticating -> associating
Aug 21 11:58:16 jarnos-3000-C200 kernel: [   31.837510] wlp3s0: RX AssocResp from dc:ee:06:95:dc:35 (capab=0x1411 status=0 aid=1)
Aug 21 11:58:16 jarnos-3000-C200 kernel: [   31.838865] wlp3s0: associated
Aug 21 11:58:16 jarnos-3000-C200 kernel: [   31.838936] IPv6: ADDRCONF(NETDEV_CHANGE): wlp3s0: link becomes ready
Aug 21 11:58:16 jarnos-3000-C200 NetworkManager[2253]: <info>  [1471769896.9109] device (wlp3s0): supplicant interface state: associating -> associated
Aug 21 11:58:17 jarnos-3000-C200 NetworkManager[2253]: <info>  [1471769897.0706] device (wlp3s0): supplicant interface state: associated -> 4-way handshake
Aug 21 11:58:17 jarnos-3000-C200 NetworkManager[2253]: <info>  [1471769897.1881] device (wlp3s0): supplicant interface state: 4-way handshake -> completed
Aug 21 11:58:17 jarnos-3000-C200 NetworkManager[2253]: <info>  [1471769897.1882] device (wlp3s0): Activation: (wifi) Stage 2 of 5 (Device Configure) successful.  Connected to wireless network 'jarnos-g'.
Aug 21 11:58:17 jarnos-3000-C200 NetworkManager[2253]: <info>  [1471769897.1883] device (wlp3s0): state change: config -> ip-config (reason 'none') [50 70 0]
Aug 21 11:58:17 jarnos-3000-C200 NetworkManager[2253]: <info>  [1471769897.1916] dhcp4 (wlp3s0): activation: beginning transaction (timeout in 45 seconds)
Aug 21 11:58:17 jarnos-3000-C200 NetworkManager[2253]: <info>  [1471769897.1960] dhcp4 (wlp3s0): dhclient started with pid 2991
Aug 21 11:58:19 jarnos-3000-C200 NetworkManager[2253]: <info>  [1471769899.0710] dhcp6 (wlp3s0): activation: beginning transaction (timeout in 45 seconds)
Aug 21 11:58:19 jarnos-3000-C200 NetworkManager[2253]: <info>  [1471769899.0744] dhcp6 (wlp3s0): dhclient started with pid 3050
Aug 21 11:58:19 jarnos-3000-C200 NetworkManager[2253]: <info>  [1471769899.7838]   valid_lft 7200
Aug 21 11:58:19 jarnos-3000-C200 NetworkManager[2253]: <info>  [1471769899.7838]   preferred_lft 3600
Aug 21 11:58:19 jarnos-3000-C200 NetworkManager[2253]: <info>  [1471769899.7839]   address 2001:999:20:2495:dcee:695:dc35:3
Aug 21 11:58:19 jarnos-3000-C200 NetworkManager[2253]: <info>  [1471769899.7839]   nameserver 'fe80::deee:6ff:fe95:dc35'
Aug 21 11:58:19 jarnos-3000-C200 NetworkManager[2253]: <info>  [1471769899.7840] dhcp6 (wlp3s0): state changed unknown -> bound, event ID="de:02:e9:d5|1471769899"
Aug 21 11:58:19 jarnos-3000-C200 NetworkManager[2253]: <info>  [1471769899.7932] device (wlp3s0): state change: ip-config -> ip-check (reason 'none') [70 80 0]
Aug 21 11:58:19 jarnos-3000-C200 NetworkManager[2253]: <info>  [1471769899.8108] device (wlp3s0): state change: ip-check -> secondaries (reason 'none') [80 90 0]
Aug 21 11:58:19 jarnos-3000-C200 NetworkManager[2253]: <info>  [1471769899.8114] device (wlp3s0): state change: secondaries -> activated (reason 'none') [90 100 0]
Aug 21 11:58:19 jarnos-3000-C200 NetworkManager[2253]: <info>  [1471769899.8116] manager: NetworkManager state is now CONNECTED_LOCAL
Aug 21 11:58:19 jarnos-3000-C200 NetworkManager[2253]: <info>  [1471769899.8223] manager: NetworkManager state is now CONNECTED_GLOBAL
Aug 21 11:58:19 jarnos-3000-C200 NetworkManager[2253]: <info>  [1471769899.8253] policy: set 'jarnos-g' (wlp3s0) as default for IPv6 routing and DNS
Aug 21 11:58:19 jarnos-3000-C200 NetworkManager[2253]: <info>  [1471769899.8302] DNS: starting dnsmasq...
Aug 21 11:58:19 jarnos-3000-C200 NetworkManager[2253]: <warn>  [1471769899.8403] dnsmasq[0xb9a340]: dnsmasq not found on the bus. The nameserver update will be sent when dnsmasq appears
Aug 21 11:58:19 jarnos-3000-C200 NetworkManager[2253]: <info>  [1471769899.8411] dns-mgr: Writing DNS information to /sbin/resolvconf
Aug 21 11:58:20 jarnos-3000-C200 NetworkManager[2253]: <info>  [1471769900.0405] device (wlp3s0): Activation: successful, device activated.
Aug 21 11:58:20 jarnos-3000-C200 NetworkManager[2253]: <info>  [1471769900.0627] dnsmasq[0xb9a340]: dnsmasq appeared as :1.53
Aug 21 11:58:20 jarnos-3000-C200 NetworkManager[2253]: <info>  [1471769900.0636] dns-mgr: Writing DNS information to /sbin/resolvconf
Aug 21 11:58:20 jarnos-3000-C200 NetworkManager[2253]: <info>  [1471769900.2825]   address 192.168.100.11
Aug 21 11:58:20 jarnos-3000-C200 NetworkManager[2253]: <info>  [1471769900.2831]   plen 24 (255.255.255.0)
Aug 21 11:58:20 jarnos-3000-C200 NetworkManager[2253]: <info>  [1471769900.2836]   gateway 192.168.100.1
Aug 21 11:58:20 jarnos-3000-C200 NetworkManager[2253]: <info>  [1471769900.2841]   server identifier 192.168.100.1
Aug 21 11:58:20 jarnos-3000-C200 NetworkManager[2253]: <info>  [1471769900.2845]   lease time 86400
Aug 21 11:58:20 jarnos-3000-C200 NetworkManager[2253]: <info>  [1471769900.2849]   nameserver '192.168.100.1'
Aug 21 11:58:20 jarnos-3000-C200 NetworkManager[2253]: <info>  [1471769900.2853]   nameserver '192.168.100.1'
Aug 21 11:58:20 jarnos-3000-C200 NetworkManager[2253]: <info>  [1471769900.2853] dhcp4 (wlp3s0): state changed unknown -> bound
Aug 21 11:58:20 jarnos-3000-C200 NetworkManager[2253]: <info>  [1471769900.2969] policy: set 'jarnos-g' (wlp3s0) as default for IPv4 routing and DNS
Aug 21 11:58:20 jarnos-3000-C200 NetworkManager[2253]: <info>  [1471769900.2978] dns-mgr: Writing DNS information to /sbin/resolvconf
Aug 21 11:59:16 jarnos-3000-C200 kernel: [   92.000422] logitech-hidpp-device 0003:046D:4024.0004: HID++ 2.0 device connected.
Aug 21 12:00:03 jarnos-3000-C200 kernel: [  139.302544] perf interrupt took too long (2526 > 2500), lowering kernel.perf_event_max_sample_rate to 50000

我尝试启动一些较旧的内核,它显示:“dev-mapper-cryptswap.device 的启动作业正在运行(18 分 10 秒 / 无限制)”,并且时间一直在流逝。

答案1

首先,看起来你已经启用了日志记录级别info,它告诉NetworkManager向日志中喷出大量消息,这可能是你的多千兆 kern.log 的原因……这是正常的配置文件

cat  /etc/NetworkManager/NetworkManager.conf

[main]
plugins=ifupdown,keyfile,ofono
dns=dnsmasq

[ifupdown]
managed=false

按照http://linux.die.net/man/5/networkmanager.conf 只需删除上述配置文件的部分[logging]即可

[logging]
level=INFO

如果你的 NetworkManager.conf 确实包含上述​​内容INFO

只要上述INFO日志记录处于活动状态,如果不进行大量的 grapping,日志就很难读取,因此请按照以下方法修剪日志文件

sudo -i
> /var/log/kern.log  # this line is correct the > says empty that file
exit

以上操作会清空文件但不删除它,因此文件描述符保持完整,写入过程可以继续进行

完成上述更改配置文件并清空文件后重新启动...日志设置得太高可能会减慢你的机器速度

相关内容