systemd-tmpfiles-setup.service 启动时间过长(1 小时)

systemd-tmpfiles-setup.service 启动时间过长(1 小时)

极短版本:

Ubuntu 18.04 启动/引导需要 1 小时 6 分钟 17.410 秒。看来 systemd-tmpfiles-setup.service 需要 59 分钟 24.321 秒,apt-daily-upgrade.service 需要 4 分钟 13.257 秒。

进一步来说,当我运行包含大量 open() 和 close() 的特定 bash/python 脚本时,下次启动 Ubuntu 时需要那么长时间。

在关闭计算机之前使用$ sudo apt-get update,有时会显著缩短启动时间(从 3 分钟到 40 分钟)。此外,从隐私设置(Ubuntu 设置选项卡)中清除临时文件也不起作用。$ sudo apt-get upgrade$ sudo apt-get dist-upgrade

我能做些什么吗?

我做的检查:

$ systemd-analyze

Startup finished in 5.752s (kernel) + 1h 6min 11.657s (userspace) = 1h 6min 17.410s

$ systemd-analyze blame
   59min 24.321s systemd-tmpfiles-setup.service
    4min 13.257s apt-daily-upgrade.service
    1min 55.790s apt-daily.service
         22.109s plymouth-quit-wait.service
         17.100s systemd-journal-flush.service
         14.060s dev-sda5.device
          9.434s NetworkManager-wait-online.service
          7.650s apparmor.service
          7.415s dev-loop16.device
          6.926s dev-loop17.device
          6.817s plymouth-read-write.service
          6.687s dev-loop23.device
          6.647s dev-loop6.device
          6.572s dev-loop9.device
          6.500s networkd-dispatcher.service
          6.282s dev-loop21.device
          6.210s dev-loop18.device
          6.072s dev-loop19.device
          6.042s dev-loop22.device
          6.008s dev-loop14.device
          5.913s dev-loop11.device
          5.811s dev-loop8.device
          5.236s snapd.service
          4.965s dev-loop12.device
          4.916s dev-loop7.device
          4.848s dev-loop20.device
          4.761s dev-loop15.device
          4.663s dev-loop10.device
          4.643s dev-loop5.device
          4.624s dev-loop13.device
          4.429s dev-loop2.device
          3.962s dev-loop4.device
          3.718s systemd-rfkill.service
          3.518s NetworkManager.service
          3.126s systemd-tmpfiles-clean.service
          2.858s systemd-logind.service
          2.816s dev-loop3.device
          2.524s systemd-udevd.service
          2.487s udisks2.service
          2.474s thermald.service
          2.470s dev-loop1.device
          2.325s systemd-sysctl.service
          2.124s dev-loop0.device
          2.016s snap-core18-1074.mount
          1.929s ModemManager.service
          1.890s accounts-daemon.service
          1.787s snap-core18-1066.mount
          1.688s snap-code-13.mount
          1.520s snap-gnome\x2d3\x2d28\x2d1804-71.mount
          1.336s snap-gnome\x2dcharacters-292.mount
          1.235s snap-gnome\x2d3\x2d26\x2d1604-88.mount
          1.176s snap-sublime\x2dtext-58.mount
          1.110s snap-gnome\x2d3\x2d28\x2d1804-67.mount
          1.084s systemd-update-utmp.service
          1.075s systemd-modules-load.service
          1.052s snap-code-12.mount
          1.035s fwupd.service
          1.021s systemd-tmpfiles-setup-dev.service
          1.013s snap-core-7270.mount
           962ms motd-news.service
           957ms networking.service
           956ms snap-gnome\x2dcalculator-406.mount
           951ms snap-sublime\x2dtext-67.mount
           877ms snap-gtk\x2dcommon\x2dthemes-1198.mount
           849ms gpu-manager.service
           829ms grub-common.service
           827ms snap-gnome\x2dcharacters-296.mount
           810ms snap-gnome\x2dlogs-45.mount
           796ms iio-sensor-proxy.service
           793ms keyboard-setup.service
           760ms snap-gnome\x2dsystem\x2dmonitor-100.mount
           746ms packagekit.service
           740ms dns-clean.service
           722ms plymouth-start.service
           717ms wpa_supplicant.service
           681ms systemd-backlight@backlight:intel_backlight.service
           635ms snap-gimp-165.mount
           632ms avahi-daemon.service
           620ms swapfile.swap
           618ms snap-gnome\x2d3\x2d26\x2d1604-90.mount
           542ms snap-gnome\x2dsystem\x2dmonitor-95.mount
           541ms console-setup.service
           479ms colord.service
           454ms ufw.service
           445ms polkit.service
           439ms systemd-journald.service
           424ms systemd-random-seed.service
           350ms snap-gimp-189.mount
           337ms [email protected]
           334ms snap-gtk\x2dcommon\x2dthemes-1313.mount
           321ms snap-gnome\x2dcalculator-260.mount
           307ms rsyslog.service
           306ms snap-gnome\x2dlogs-61.mount
           276ms snapd.seeded.service
           224ms sys-kernel-debug.mount
           223ms kmod-static-nodes.service
           203ms apport.service
           195ms snap-core-7396.mount
           185ms systemd-remount-fs.service
           172ms upower.service
           148ms gdm.service
            75ms bolt.service
            63ms systemd-udev-trigger.service
            58ms dev-hugepages.mount
            35ms systemd-resolved.service
            35ms systemd-timesyncd.service
            30ms speech-dispatcher.service
            26ms bluetooth.service
            24ms alsa-restore.service
            16ms setvtrgb.service
            12ms kerneloops.service
            12ms ureadahead-stop.service
             9ms systemd-update-utmp-runlevel.service
             8ms pppd-dns.service
             7ms dev-mqueue.mount
             6ms rtkit-daemon.service
             6ms systemd-user-sessions.service
             2ms sys-fs-fuse-connections.mount
             2ms sys-kernel-config.mount

$ 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 @1h 15.288s
└─multi-user.target @1h 15.288s
  └─snap-gnome\x2dcalculator-260.mount @5.932s +321ms
    └─local-fs-pre.target @3.729s
      └─systemd-tmpfiles-setup-dev.service @2.707s +1.021s
        └─kmod-static-nodes.service @2.482s +223ms
          └─systemd-journald.socket @2.480s
            └─system.slice @2.480s
              └─-.slice @2.451s

评论中请求的信息:

$ cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sda5 during installation
UUID=b2cc2a52-5889-4b01-aaf1-e6f2ca48f613 /               ext4    errors=remount-ro 0       1
/swapfile                                 none            swap    sw              0       0
$ uname -a
Linux lamphs-HP-EliteBook-8570p 5.0.0-25-generic #26~18.04.1-Ubuntu SMP Thu Aug 1 13:51:02 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
$ cat /var/log/syslog | egrep 'mount|tmp|tmp.mount'
Aug 20 14:22:47 lamphs-HP-EliteBook-8570p systemd[1]: proc-sys-fs-binfmt_misc.automount: Got automount request for /proc/sys/fs/binfmt_misc, triggered by 10066 (trash-empty)
Aug 20 14:29:17 lamphs-HP-EliteBook-8570p kernel: [11629.859977] audit: type=1400 audit(1566300557.543:60): apparmor="ALLOWED" operation="connect" profile="libreoffice-oopslash" name="/tmp/OSL_PIPE_1000_SingleOfficeIPC_304d4fd6a8ef56641e5aea4945e2ca8" pid=20336 comm="oosplash" requested_mask="wr" denied_mask="wr" fsuid=1000 ouid=1000
Aug 20 14:29:17 lamphs-HP-EliteBook-8570p kernel: [11629.859983] audit: type=1400 audit(1566300557.543:61): apparmor="ALLOWED" operation="file_perm" profile="libreoffice-oopslash" name="/tmp/OSL_PIPE_1000_SingleOfficeIPC_304d4fd6a8ef56641e5aea4945e2ca8" pid=20336 comm="oosplash" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
Aug 20 14:29:17 lamphs-HP-EliteBook-8570p kernel: [11629.859985] audit: type=1400 audit(1566300557.543:62): apparmor="ALLOWED" operation="file_perm" profile="libreoffice-oopslash" name="/tmp/OSL_PIPE_1000_SingleOfficeIPC_304d4fd6a8ef56641e5aea4945e2ca8" pid=20336 comm="oosplash" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
Aug 20 14:29:19 lamphs-HP-EliteBook-8570p kernel: [11631.341734] audit: type=1400 audit(1566300559.027:63): apparmor="ALLOWED" operation="file_perm" profile="libreoffice-oopslash" name="/tmp/OSL_PIPE_1000_SingleOfficeIPC_304d4fd6a8ef56641e5aea4945e2ca8" pid=20336 comm="oosplash" requested_mask="w" denied_mask="w" fsuid=1000 ouid=1000
Aug 20 14:30:28 lamphs-HP-EliteBook-8570p kernel: [11701.042099] audit: type=1400 audit(1566300628.730:71): apparmor="ALLOWED" operation="connect" profile="libreoffice-oopslash" name="/tmp/OSL_PIPE_1000_SingleOfficeIPC_304d4fd6a8ef56641e5aea4945e2ca8" pid=20412 comm="oosplash" requested_mask="wr" denied_mask="wr" fsuid=1000 ouid=1000
Aug 20 14:30:28 lamphs-HP-EliteBook-8570p kernel: [11701.042106] audit: type=1400 audit(1566300628.730:72): apparmor="ALLOWED" operation="file_perm" profile="libreoffice-oopslash" name="/tmp/OSL_PIPE_1000_SingleOfficeIPC_304d4fd6a8ef56641e5aea4945e2ca8" pid=20412 comm="oosplash" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
Aug 20 14:30:28 lamphs-HP-EliteBook-8570p kernel: [11701.042111] audit: type=1400 audit(1566300628.730:73): apparmor="ALLOWED" operation="file_perm" profile="libreoffice-oopslash" name="/tmp/OSL_PIPE_1000_SingleOfficeIPC_304d4fd6a8ef56641e5aea4945e2ca8" pid=20412 comm="oosplash" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
Aug 20 14:30:28 lamphs-HP-EliteBook-8570p kernel: [11701.042214] audit: type=1400 audit(1566300628.730:74): apparmor="ALLOWED" operation="file_perm" profile="libreoffice-oopslash" name="/tmp/OSL_PIPE_1000_SingleOfficeIPC_304d4fd6a8ef56641e5aea4945e2ca8" pid=20412 comm="oosplash" requested_mask="w" denied_mask="w" fsuid=1000 ouid=1000
Aug 20 14:30:28 lamphs-HP-EliteBook-8570p kernel: [11701.042217] audit: type=1400 audit(1566300628.730:75): apparmor="ALLOWED" operation="file_perm" profile="libreoffice-oopslash" name="/tmp/OSL_PIPE_1000_SingleOfficeIPC_304d4fd6a8ef56641e5aea4945e2ca8" pid=20412 comm="oosplash" requested_mask="w" denied_mask="w" fsuid=1000 ouid=1000
Aug 20 15:15:21 lamphs-HP-EliteBook-8570p kernel: [14393.793242] audit: type=1400 audit(1566303321.531:94): apparmor="ALLOWED" operation="connect" profile="libreoffice-oopslash" name="/tmp/OSL_PIPE_1000_SingleOfficeIPC_304d4fd6a8ef56641e5aea4945e2ca8" pid=19817 comm="oosplash" requested_mask="wr" denied_mask="wr" fsuid=1000 ouid=1000
Aug 20 15:15:21 lamphs-HP-EliteBook-8570p kernel: [14393.793252] audit: type=1400 audit(1566303321.531:95): apparmor="ALLOWED" operation="file_perm" profile="libreoffice-oopslash" name="/tmp/OSL_PIPE_1000_SingleOfficeIPC_304d4fd6a8ef56641e5aea4945e2ca8" pid=19817 comm="oosplash" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
Aug 20 15:15:21 lamphs-HP-EliteBook-8570p kernel: [14393.793257] audit: type=1400 audit(1566303321.531:96): apparmor="ALLOWED" operation="file_perm" profile="libreoffice-oopslash" name="/tmp/OSL_PIPE_1000_SingleOfficeIPC_304d4fd6a8ef56641e5aea4945e2ca8" pid=19817 comm="oosplash" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
Aug 20 15:15:21 lamphs-HP-EliteBook-8570p kernel: [14393.793344] audit: type=1400 audit(1566303321.531:97): apparmor="ALLOWED" operation="file_perm" profile="libreoffice-oopslash" name="/tmp/OSL_PIPE_1000_SingleOfficeIPC_304d4fd6a8ef56641e5aea4945e2ca8" pid=19817 comm="oosplash" requested_mask="w" denied_mask="w" fsuid=1000 ouid=1000
Aug 20 15:15:21 lamphs-HP-EliteBook-8570p kernel: [14393.793406] audit: type=1400 audit(1566303321.531:98): apparmor="ALLOWED" operation="file_perm" profile="libreoffice-oopslash" name="/tmp/OSL_PIPE_1000_SingleOfficeIPC_304d4fd6a8ef56641e5aea4945e2ca8" pid=19817 comm="oosplash" requested_mask="w" denied_mask="w" fsuid=1000 ouid=1000
Aug 20 15:46:07 lamphs-HP-EliteBook-8570p kernel: [16239.319662] audit: type=1400 audit(1566305167.126:111): apparmor="DENIED" operation="open" profile="snap.gimp.gimp" name="/proc/8734/mountinfo" pid=8734 comm="gmain" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
Aug 20 15:46:07 lamphs-HP-EliteBook-8570p kernel: [16239.319773] audit: type=1400 audit(1566305167.126:113): apparmor="DENIED" operation="open" profile="snap.gimp.gimp" name="/proc/8734/mountinfo" pid=8734 comm="gimp" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
Aug 20 15:46:07 lamphs-HP-EliteBook-8570p kernel: [16239.319789] audit: type=1400 audit(1566305167.126:114): apparmor="DENIED" operation="open" profile="snap.gimp.gimp" name="/proc/8734/mounts" pid=8734 comm="gimp" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
Aug 20 15:46:07 lamphs-HP-EliteBook-8570p gimp[8734]: Error creating IO channel for /proc/self/mountinfo: Permission denied (g-file-error-quark, 2)
Aug 20 16:09:17 lamphs-HP-EliteBook-8570p kernel: [17630.099124] audit: type=1400 audit(1566306557.891:116): apparmor="DENIED" operation="open" profile="snap.gimp.gimp" name="/proc/8734/mountinfo" pid=8734 comm="gmain" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
Aug 20 16:09:17 lamphs-HP-EliteBook-8570p kernel: [17630.099289] audit: type=1400 audit(1566306557.891:118): apparmor="DENIED" operation="open" profile="snap.gimp.gimp" name="/proc/8734/mountinfo" pid=8734 comm="gimp" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
Aug 20 16:09:17 lamphs-HP-EliteBook-8570p kernel: [17630.099314] audit: type=1400 audit(1566306557.891:119): apparmor="DENIED" operation="open" profile="snap.gimp.gimp" name="/proc/8734/mounts" pid=8734 comm="gimp" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
Aug 20 16:09:18 lamphs-HP-EliteBook-8570p gimp[8734]: Error creating IO channel for /proc/self/mountinfo: Permission denied (g-file-error-quark, 2)
Aug 20 16:09:18 lamphs-HP-EliteBook-8570p kernel: [17630.446018] audit: type=1400 audit(1566306558.239:120): apparmor="DENIED" operation="open" profile="snap.gimp.gimp" name="/proc/8734/mountinfo" pid=8734 comm="gimp" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
Aug 20 16:09:18 lamphs-HP-EliteBook-8570p kernel: [17630.446023] audit: type=1400 audit(1566306558.239:121): apparmor="DENIED" operation="open" profile="snap.gimp.gimp" name="/proc/8734/mounts" pid=8734 comm="gimp" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
Aug 20 16:09:18 lamphs-HP-EliteBook-8570p kernel: [17630.543608] audit: type=1400 audit(1566306558.335:122): apparmor="DENIED" operation="open" profile="snap.gimp.gimp" name="/proc/8734/mountinfo" pid=8734 comm="gimp" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
Aug 20 16:09:18 lamphs-HP-EliteBook-8570p kernel: [17630.543616] audit: type=1400 audit(1566306558.335:123): apparmor="DENIED" operation="open" profile="snap.gimp.gimp" name="/proc/8734/mounts" pid=8734 comm="gimp" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
Aug 20 16:09:46 lamphs-HP-EliteBook-8570p kernel: [17659.179421] audit: type=1400 audit(1566306586.974:124): apparmor="DENIED" operation="open" profile="snap.gimp.gimp" name="/proc/8734/mountinfo" pid=8734 comm="gimp" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
Aug 20 16:09:46 lamphs-HP-EliteBook-8570p kernel: [17659.179435] audit: type=1400 audit(1566306586.974:125): apparmor="DENIED" operation="open" profile="snap.gimp.gimp" name="/proc/8734/mounts" pid=8734 comm="gimp" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
Aug 20 16:18:38 lamphs-HP-EliteBook-8570p kernel: [18190.929157] audit: type=1400 audit(1566307118.708:126): apparmor="DENIED" operation="open" profile="snap.gimp.gimp" name="/proc/8734/mountinfo" pid=8734 comm="gmain" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
Aug 20 16:18:38 lamphs-HP-EliteBook-8570p kernel: [18190.929283] audit: type=1400 audit(1566307118.708:128): apparmor="DENIED" operation="open" profile="snap.gimp.gimp" name="/proc/8734/mountinfo" pid=8734 comm="gimp" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
Aug 20 16:18:38 lamphs-HP-EliteBook-8570p kernel: [18190.929312] audit: type=1400 audit(1566307118.708:129): apparmor="DENIED" operation="open" profile="snap.gimp.gimp" name="/proc/8734/mounts" pid=8734 comm="gimp" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
Aug 20 16:18:38 lamphs-HP-EliteBook-8570p kernel: [18190.963135] audit: type=1400 audit(1566307118.740:130): apparmor="DENIED" operation="open" profile="snap.gimp.gimp" name="/proc/8734/mountinfo" pid=8734 comm="gimp" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
Aug 20 16:18:38 lamphs-HP-EliteBook-8570p kernel: [18190.963152] audit: type=1400 audit(1566307118.740:131): apparmor="DENIED" operation="open" profile="snap.gimp.gimp" name="/proc/8734/mounts" pid=8734 comm="gimp" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
Aug 20 16:18:38 lamphs-HP-EliteBook-8570p kernel: [18190.972809] audit: type=1400 audit(1566307118.752:132): apparmor="DENIED" operation="open" profile="snap.gimp.gimp" name="/proc/8734/mountinfo" pid=8734 comm="gimp" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
Aug 20 16:18:38 lamphs-HP-EliteBook-8570p kernel: [18190.972823] audit: type=1400 audit(1566307118.752:133): apparmor="DENIED" operation="open" profile="snap.gimp.gimp" name="/proc/8734/mounts" pid=8734 comm="gimp" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
Aug 20 16:18:39 lamphs-HP-EliteBook-8570p gimp[8734]: Error creating IO channel for /proc/self/mountinfo: Permission denied (g-file-error-quark, 2)
Aug 20 16:18:45 lamphs-HP-EliteBook-8570p kernel: [18198.116249] audit: type=1400 audit(1566307125.892:134): apparmor="DENIED" operation="open" profile="snap.gimp.gimp" name="/proc/8734/mountinfo" pid=8734 comm="gimp" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
Aug 20 16:18:45 lamphs-HP-EliteBook-8570p kernel: [18198.116257] audit: type=1400 audit(1566307125.892:135): apparmor="DENIED" operation="open" profile="snap.gimp.gimp" name="/proc/8734/mounts" pid=8734 comm="gimp" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
Aug 20 16:19:11 lamphs-HP-EliteBook-8570p gimp[8734]: Error creating IO channel for /proc/self/mountinfo: Permission denied (g-file-error-quark, 2)
Aug 20 16:19:11 lamphs-HP-EliteBook-8570p kernel: [18223.410051] audit: type=1400 audit(1566307151.187:136): apparmor="DENIED" operation="open" profile="snap.gimp.gimp" name="/proc/8734/mountinfo" pid=8734 comm="gmain" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
Aug 20 16:19:11 lamphs-HP-EliteBook-8570p kernel: [18223.410785] audit: type=1400 audit(1566307151.187:138): apparmor="DENIED" operation="open" profile="snap.gimp.gimp" name="/proc/8734/mountinfo" pid=8734 comm="gimp" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
Aug 20 16:19:11 lamphs-HP-EliteBook-8570p kernel: [18223.410800] audit: type=1400 audit(1566307151.187:139): apparmor="DENIED" operation="open" profile="snap.gimp.gimp" name="/proc/8734/mounts" pid=8734 comm="gimp" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
Aug 20 16:19:11 lamphs-HP-EliteBook-8570p kernel: [18223.445146] audit: type=1400 audit(1566307151.223:140): apparmor="DENIED" operation="open" profile="snap.gimp.gimp" name="/proc/8734/mountinfo" pid=8734 comm="gimp" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
Aug 20 16:19:11 lamphs-HP-EliteBook-8570p kernel: [18223.445175] audit: type=1400 audit(1566307151.223:141): apparmor="DENIED" operation="open" profile="snap.gimp.gimp" name="/proc/8734/mounts" pid=8734 comm="gimp" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
Aug 20 16:19:11 lamphs-HP-EliteBook-8570p kernel: [18223.455862] audit: type=1400 audit(1566307151.231:142): apparmor="DENIED" operation="open" profile="snap.gimp.gimp" name="/proc/8734/mountinfo" pid=8734 comm="gimp" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
Aug 20 16:19:11 lamphs-HP-EliteBook-8570p kernel: [18223.455878] audit: type=1400 audit(1566307151.231:143): apparmor="DENIED" operation="open" profile="snap.gimp.gimp" name="/proc/8734/mounts" pid=8734 comm="gimp" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
Aug 20 16:19:21 lamphs-HP-EliteBook-8570p kernel: [18233.635445] audit: type=1400 audit(1566307161.411:144): apparmor="DENIED" operation="open" profile="snap.gimp.gimp" name="/proc/8734/mountinfo" pid=8734 comm="gimp" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
Aug 20 16:19:21 lamphs-HP-EliteBook-8570p kernel: [18233.635450] audit: type=1400 audit(1566307161.411:145): apparmor="DENIED" operation="open" profile="snap.gimp.gimp" name="/proc/8734/mounts" pid=8734 comm="gimp" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
Aug 20 16:32:53 lamphs-HP-EliteBook-8570p systemd[1]: Created slice system-clean\x2dmount\x2dpoint.slice.
Aug 20 16:32:53 lamphs-HP-EliteBook-8570p systemd[1]: Started Clean the /media/lamphs/FAD2A1E5D2A1A5FB mount point.
Aug 20 16:36:35 lamphs-HP-EliteBook-8570p kernel: [19267.794488] audit: type=1400 audit(1566308195.573:205): apparmor="DENIED" operation="open" profile="snap.gimp.gimp" name="/proc/17107/mountinfo" pid=17107 comm="gmain" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
Aug 20 16:36:35 lamphs-HP-EliteBook-8570p kernel: [19267.794870] audit: type=1400 audit(1566308195.573:207): apparmor="DENIED" operation="open" profile="snap.gimp.gimp" name="/proc/17107/mountinfo" pid=17107 comm="gimp" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
Aug 20 16:36:35 lamphs-HP-EliteBook-8570p kernel: [19267.794892] audit: type=1400 audit(1566308195.573:208): apparmor="DENIED" operation="open" profile="snap.gimp.gimp" name="/proc/17107/mounts" pid=17107 comm="gimp" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
Aug 20 16:36:35 lamphs-HP-EliteBook-8570p kernel: [19267.895490] audit: type=1400 audit(1566308195.673:209): apparmor="DENIED" operation="open" profile="snap.gimp.gimp" name="/proc/17107/mountinfo" pid=17107 comm="gimp" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
Aug 20 16:36:35 lamphs-HP-EliteBook-8570p kernel: [19267.895529] audit: type=1400 audit(1566308195.677:210): apparmor="DENIED" operation="open" profile="snap.gimp.gimp" name="/proc/17107/mounts" pid=17107 comm="gimp" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
Aug 20 16:36:35 lamphs-HP-EliteBook-8570p kernel: [19267.907264] audit: type=1400 audit(1566308195.685:211): apparmor="DENIED" operation="open" profile="snap.gimp.gimp" name="/proc/17107/mountinfo" pid=17107 comm="gimp" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
Aug 20 16:36:35 lamphs-HP-EliteBook-8570p kernel: [19267.907269] audit: type=1400 audit(1566308195.685:212): apparmor="DENIED" operation="open" profile="snap.gimp.gimp" name="/proc/17107/mounts" pid=17107 comm="gimp" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
Aug 20 16:36:35 lamphs-HP-EliteBook-8570p gimp[17107]: Error creating IO channel for /proc/self/mountinfo: Permission denied (g-file-error-quark, 2)
Aug 20 16:36:48 lamphs-HP-EliteBook-8570p kernel: [19280.551084] audit: type=1400 audit(1566308208.329:213): apparmor="DENIED" operation="open" profile="snap.gimp.gimp" name="/proc/17107/mountinfo" pid=17107 comm="gimp" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
Aug 20 16:36:48 lamphs-HP-EliteBook-8570p kernel: [19280.551089] audit: type=1400 audit(1566308208.329:214): apparmor="DENIED" operation="open" profile="snap.gimp.gimp" name="/proc/17107/mounts" pid=17107 comm="gimp" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
Aug 20 17:12:13 lamphs-HP-EliteBook-8570p kernel: [21405.514477] audit: type=1400 audit(1566310333.341:279): apparmor="ALLOWED" operation="connect" profile="libreoffice-oopslash" name="/tmp/OSL_PIPE_1000_SingleOfficeIPC_304d4fd6a8ef56641e5aea4945e2ca8" pid=26573 comm="oosplash" requested_mask="wr" denied_mask="wr" fsuid=1000 ouid=1000
Aug 20 17:12:13 lamphs-HP-EliteBook-8570p kernel: [21405.514483] audit: type=1400 audit(1566310333.341:280): apparmor="ALLOWED" operation="file_perm" profile="libreoffice-oopslash" name="/tmp/OSL_PIPE_1000_SingleOfficeIPC_304d4fd6a8ef56641e5aea4945e2ca8" pid=26573 comm="oosplash" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
Aug 20 17:12:13 lamphs-HP-EliteBook-8570p kernel: [21405.514486] audit: type=1400 audit(1566310333.341:281): apparmor="ALLOWED" operation="file_perm" profile="libreoffice-oopslash" name="/tmp/OSL_PIPE_1000_SingleOfficeIPC_304d4fd6a8ef56641e5aea4945e2ca8" pid=26573 comm="oosplash" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
Aug 20 17:12:13 lamphs-HP-EliteBook-8570p kernel: [21405.514527] audit: type=1400 audit(1566310333.341:282): apparmor="ALLOWED" operation="file_perm" profile="libreoffice-oopslash" name="/tmp/OSL_PIPE_1000_SingleOfficeIPC_304d4fd6a8ef56641e5aea4945e2ca8" pid=26573 comm="oosplash" requested_mask="w" denied_mask="w" fsuid=1000 ouid=1000
Aug 20 17:12:13 lamphs-HP-EliteBook-8570p kernel: [21405.514530] audit: type=1400 audit(1566310333.341:283): apparmor="ALLOWED" operation="file_perm" profile="libreoffice-oopslash" name="/tmp/OSL_PIPE_1000_SingleOfficeIPC_304d4fd6a8ef56641e5aea4945e2ca8" pid=26573 comm="oosplash" requested_mask="w" denied_mask="w" fsuid=1000 ouid=1000
Aug 20 18:00:43 lamphs-HP-EliteBook-8570p gsd-housekeepin[1786]: Failed to enumerate children of /var/tmp/systemd-private-38fa4dafcfb447cdbd10c2c88d877c93-bolt.service-M2SMGL: Error opening directory '/var/tmp/systemd-private-38fa4dafcfb447cdbd10c2c88d877c93-bolt.service-M2SMGL': Permission denied

答案1

造成这种延迟的主要问题似乎有两个:

  • 第一个是apparmor干扰某些 snap 应用程序的权限
  • 第二个看起来您的/tmp目录包含大量具有混合权限的文件

要解决这个问题,您需要分两步进行。第一步是排除故障并确认问题原因,第二步是解决问题。


故障排除:

首先,您需要禁用 apparmor 服务。为此,请在终端中运行以下命令:

 sudo systemctl disable apparmor.service

然后,您需要清除/tmp目录。为此,请在终端中运行以下命令:

sudo rm -rf /tmp/{*,.??*}

如果您收到类似的错误bash: /usr/bin/sudo: Argument list too long,这意味着您的/tmp目录包含的文件数超出了rm可以同时处理的数量,因为命令的大小超出了ARG_MAXUbuntu 的 shell 的大小( 2MB )。

为了解决这个问题,请在终端中运行以下命令:

sudo find /tmp/{*,.??*} -exec rm -rf {} \;

如果在此操作过程中出现类似错误No such file or directory.,请忽略它们,因为在目录中不断写入和删除文件是正常的/tmp

最后,请重新启动系统并查看启动时间是否改善。


解决:

如果在执行故障排除步骤后启动时间有所改善,则说明问题已经排除snap 应用程序权限您需要通过为这些有问题的 snap 应用程序提供更多访问权限,或者更好地使用从 Ubuntu 存储库中删除它们sudo snap remove APPLICATION_PACKAGE_NAME并使用安装相同的应用程序来解决此问题。.debsudo apt install APPLICATION_PACKAGE_NAME

此后,您需要重新启用 apparmor 服务。为此,请在终端中运行以下命令:

sudo systemctl enable apparmor.service

最后,请重新启动系统并验证是否已修复。

相关内容