Ubuntu – Systemd-tmpfiles-setup.service takes too long ( 1hr ) on boot

bootsystemd

Extremely short version:

Ubuntu 18.04 takes 1h 6min 17.410s to startup/ boot. It seems that systemd-tmpfiles-setup.service takes 59min 24.321s and apt-daily-upgrade.service 4min 13.257s.

More specifically, when I run a specific bash/python script with a lot of open() and close(), the next time I boot Ubuntu it takes that long.

Using $ sudo apt-get update , $ sudo apt-get upgrade and $ sudo apt-get dist-upgrade before I close the computer, sometimes lowers significantly the booting duration ( from 3 to 40 minutes). Additionally purging temporary files from the privacy settings (Ubuntu settings tab) doesn't work either.

Is there something I could do?

The checks I did :

$ systemd-analyze

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

and

$ 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 user@1000.service
           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

and

$ 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

Info requested in the comments:

$ 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

Best Answer

There seems to be two main issues causing this delay to happen:

  • The first being apparmor interfering with permissions for some snap applications.
  • The second being as it seems your /tmp directory contains a very large number of files with mixed permissions.

To solve this you need to work in two steps. The first step is troubleshooting and confirming the cause for this issue and the second step is solving it.


Troubleshooting:

First, you need to disable the apparmor service. To do this, please run the following command in the terminal:

 sudo systemctl disable apparmor.service

Then, you need to clear your /tmp directory. To do this, please run the following command in the terminal:

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

If you get an error like bash: /usr/bin/sudo: Argument list too long, this means your /tmp directory contains more files than rm can handle at once because the size of the command exceeds the shell's ARG_MAX for Ubuntu ( 2MB ).

To overcome this please run the following command instead in the terminal:

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

If you get errors during this operation like No such file or directory., please ignore them as it is normal for files to be written and deleted constantly in the /tmp directory.

Finally, please reboot your system and see if boot time improves.


Solving:

If the boot time improves after the troubleshooting step, then you have isolated the issue to snap applications permissions and you need to fix this by either giving these problematic snap applications more access permissions or even better removing them using sudo snap remove APPLICATION_PACKAGE_NAME and installing the same .deb applications from Ubuntu repositories using sudo apt install APPLICATION_PACKAGE_NAME .

After this you need to re-enable the apparmor service. To do this, please run the following command in the terminal:

sudo systemctl enable apparmor.service

Finally, please reboot your system and verify it is fixed.