Is it possible to start snapd.service after boot finishes?
snapd.service
takes a relatively long time to run at boot, so to speed up booting can I instead start the service after booting is finished?
here is the result of systemd-analyze blame
:
> systemd-analyze blame Sal 14 Ara 2021 14:58:50
29.098s plymouth-quit-wait.service >
17.111s dev-sda3.device >
16.480s snapd.service >
13.185s networkd-dispatcher.service >
11.886s udisks2.service >
8.401s accounts-daemon.service >
7.103s dev-loop3.device >
6.743s dev-loop22.device >
6.652s dev-loop15.device >
6.520s systemd-journal-flush.service >
6.420s dev-loop2.device >
6.385s dev-loop6.device >
6.367s avahi-daemon.service >
6.360s bluetooth.service >
6.356s NetworkManager.service >
6.307s polkit.service >
6.256s dev-loop1.device >
6.121s dev-loop13.device >
6.060s dev-loop21.device >
5.793s switcheroo-control.service >
5.786s thermald.service >
5.783s systemd-logind.service >
5.779s wpa_supplicant.service >
5.608s gpu-manager.service >
5.573s dev-loop17.device >
5.570s dev-loop9.device >
5.476s ModemManager.service >
5.262s dev-loop20.device >
5.243s dev-loop18.device >
5.104s dev-loop16.device >
5.049s dev-loop12.device >
5.035s dev-loop14.device >
4.958s dev-loop19.device >
4.730s dev-loop10.device >
4.539s plymouth-read-write.service >
4.410s dev-loop11.device >
4.209s dev-loop8.device >
3.959s zebra.service >
3.860s systemd-sysctl.service >
3.811s dev-loop4.device >
3.642s dev-loop7.device >
3.591s apport.service >
3.566s dev-loop5.device >
3.121s rsyslog.service >
3.119s e2scrub_reap.service >
3.075s snap-bare-5.mount >
2.958s dev-loop0.device >
2.799s snap-code-82.mount >
2.692s snap-code-83.mount >
2.678s snap-core-11798.mount >
2.610s snap-core-11993.mount >
2.499s gdm.service >
2.319s snap-core18-2246.mount >
2.179s tlp.service >
2.055s snap-core18-2253.mount >
2.039s fwupd.service >
2.009s virtualbox.service >
1.893s systemd-udevd.service >
1.774s systemd-tmpfiles-setup.service >
1.750s apparmor.service >
1.745s systemd-resolved.service >
1.692s secureboot-db.service >
1.633s colord.service >
1.434s snap-core20-1242.mount >
1.367s snap-core20-1270.mount >
1.344s ssh.service >
1.305s snap-gnome\x2d3\x2d34\x2d1804-72.mount >
1.270s packagekit.service >
1.270s snap-gnome\x2d3\x2d34\x2d1804-77.mount >
1.262s snapd.apparmor.service >
1.242s systemd-fsck@dev-disk-by\x2duuid-92804264\x2dc37f\x2d48cb\x2d8ec5\x2d49bc5be832fa>
1.234s systemd-tmpfiles-setup-dev.service >
1.183s systemd-random-seed.service >
1.143s nvidia-persistenced.service >
1.138s systemd-modules-load.service >
1.015s snap-gnome\x2d3\x2d38\x2d2004-76.mount >
967ms systemd-fsck@dev-disk-by\x2duuid-90BC\x2dAD77.service >
966ms upower.service >
957ms snap-gnome\x2d3\x2d38\x2d2004-87.mount >
943ms snap-gtk\x2dcommon\x2dthemes-1506.mount >
897ms snap-gtk\x2dcommon\x2dthemes-1519.mount >
802ms [email protected]
and the results of systemd-analyze critical-chain
:
> systemd-analyze critical-chain 33.4s Sal 14 Ara 2021 14:59:39
The time when unit became active or started is printed after the "@" character.
The time the unit took to start is printed after the "+" character.
graphical.target @1min 6.867s
└─multi-user.target @1min 6.867s
└─snapd.seeded.service @48.059s +747ms
└─snapd.service @31.576s +16.480s
└─basic.target @30.982s
└─sockets.target @30.981s
└─snapd.socket @30.980s +1ms
└─sysinit.target @30.880s
└─snapd.apparmor.service @28.087s +1.262s
└─apparmor.service @26.334s +1.750s
└─local-fs.target @26.332s
└─run-user-1000-gvfs.mount @53.006s
└─run-user-1000.mount @44.989s
└─swap.target @24.765s
└─dev-disk-by\x2duuid-de61f134\x2d705a\x2d4c98\x2d89f7\x2d04a0b>
└─dev-disk-by\x2duuid-de61f134\x2d705a\x2d4c98\x2d89f7\x2d04a>
I am using Ubuntu 20.04 with the following specs:
> lshw Sal 14 Ara 2021 18:21:47
WARNING: you should run this program as super-user.
hasan-nitro-an515-43
description: Computer
width: 64 bits
capabilities: smp vsyscall32
*-core
description: Motherboard
physical id: 0
*-memory
description: System memory
physical id: 0
size: 14GiB
*-cpu
product: AMD Ryzen 7 3750H with Radeon Vega Mobile Gfx
vendor: Advanced Micro Devices [AMD]
physical id: 1
bus info: cpu@0
size: 1352MHz
capacity: 2300MHz
width: 64 bits
capabilities: fpu fpu_exception wp vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp x86-64 constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb hw_pstate sme ssbd sev ibpb vmmcall sev_es fsgsbase bmi1 avx2 smep bmi2 rdseed adx smap clflushopt sha_ni xsaveopt xsavec xgetbv1 xsaves clzero irperf xsaveerptr arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif overflow_recov succor smca cpufreq
*-pci:0
description: Host bridge
product: Raven/Raven2 Root Complex
vendor: Advanced Micro Devices, Inc. [AMD]
physical id: 100
bus info: pci@0000:00:00.0
version: 00
width: 32 bits
clock: 33MHz
*-generic UNCLAIMED
description: IOMMU
product: Raven/Raven2 IOMMU
vendor: Advanced Micro Devices, Inc. [AMD]
physical id: 0.2
bus info: pci@0000:00:00.2
version: 00
width: 32 bits
clock: 33MHz
capabilities: cap_list
configuration: latency=0
*-pci:0
description: PCI bridge
product: Raven/Raven2 PCIe GPP Bridge [6:0]
vendor: Advanced Micro Devices, Inc. [AMD]
physical id: 1.1
bus info: pci@0000:00:01.1
version: 00
width: 32 bits
clock: 33MHz
capabilities: pci normal_decode bus_master cap_list
configuration: driver=pcieport
resources: irq:26 ioport:3000(size=4096) memory:c1000000-c1ffffff ioport:90000000(size=301989888)
*-display
description: 3D controller
product: TU117M [GeForce GTX 1650 Mobile / Max-Q]
vendor: NVIDIA Corporation
physical id: 0
bus info: pci@0000:01:00.0
version: a1
width: 64 bits
clock: 33MHz
capabilities: bus_master cap_list
configuration: driver=nvidia latency=0
resources: irq:75 memory:c1000000-c1ffffff memory:90000000-9fffffff memory:a0000000-a1ffffff ioport:3000(size=128)
*-pci:1
description: PCI bridge
product: Raven/Raven2 PCIe GPP Bridge [6:0]
vendor: Advanced Micro Devices, Inc. [AMD]
physical id: 1.2
bus info: pci@0000:00:01.2
version: 00
width: 32 bits
clock: 33MHz
capabilities: pci normal_decode bus_master cap_list
configuration: driver=pcieport
resources: irq:27 memory:c2800000-c28fffff
*-storage
description: Non-Volatile memory controller
product: BC501 NVMe Solid State Drive 512GB
vendor: SK hynix
physical id: 0
bus info: pci@0000:02:00.0
version: 00
width: 64 bits
clock: 33MHz
capabilities: storage nvm_express bus_master cap_list
configuration: driver=nvme latency=0
resources: irq:44 memory:c2800000-c2803fff
*-nvme0
description: NVMe device
product: HFM256GDJTNG-8310A
physical id: 0
logical name: /dev/nvme0
version: 80002C00
serial: CY9CN00101150CE4Y
configuration: nqn=nqn.2014.08.org.nvmexpress:1c5c1c5cCY9CN00101150CE4Y HFM256GDJTNG-8310A state=live
*-namespace
description: NVMe namespace
physical id: 1
logical name: /dev/nvme0n1
*-pci:2
description: PCI bridge
product: Raven/Raven2 PCIe GPP Bridge [6:0]
vendor: Advanced Micro Devices, Inc. [AMD]
physical id: 1.6
bus info: pci@0000:00:01.6
version: 00
width: 32 bits
clock: 33MHz
capabilities: pci normal_decode bus_master cap_list
configuration: driver=pcieport
resources: irq:28 ioport:2000(size=4096) memory:c2700000-c27fffff
*-network
description: Ethernet interface
product: RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
vendor: Realtek Semiconductor Co., Ltd.
physical id: 0
bus info: pci@0000:03:00.0
logical name: enp3s0
version: 25
serial: 08:97:98:8f:fa:bf
width: 64 bits
clock: 33MHz
capabilities: cap_list ethernet physical
configuration: broadcast=yes driver=r8169 latency=0 multicast=yes
resources: irq:34 ioport:2000(size=256) memory:c2704000-c2704fff memory:c2700000-c2703fff
*-pci:3
description: PCI bridge
product: Raven/Raven2 PCIe GPP Bridge [6:0]
vendor: Advanced Micro Devices, Inc. [AMD]
physical id: 1.7
bus info: pci@0000:00:01.7
version: 00
width: 32 bits
clock: 33MHz
capabilities: pci normal_decode bus_master cap_list
configuration: driver=pcieport
resources: irq:29 memory:c2000000-c21fffff
*-network
description: Wireless interface
product: QCA6174 802.11ac Wireless Network Adapter
vendor: Qualcomm Atheros
physical id: 0
bus info: pci@0000:04:00.0
logical name: wlp4s0
version: 32
serial: e4:aa:ea:50:6c:87
width: 64 bits
clock: 33MHz
capabilities: bus_master cap_list ethernet physical wireless
configuration: broadcast=yes driver=ath10k_pci driverversion=5.11.0-41-generic firmware=WLAN.RM.4.4.1-00140-QCARMSWPZ-1 ip=192.168.1.46 latency=0 link=yes multicast=yes wireless=IEEE 802.11
resources: irq:79 memory:c2000000-c21fffff
*-pci:4
description: PCI bridge
product: Raven/Raven2 Internal PCIe GPP Bridge 0 to Bus A
vendor: Advanced Micro Devices, Inc. [AMD]
physical id: 8.1
bus info: pci@0000:00:08.1
version: 00
width: 32 bits
clock: 33MHz
capabilities: pci normal_decode bus_master cap_list
configuration: driver=pcieport
resources: irq:30 ioport:1000(size=4096) memory:c2300000-c26fffff ioport:b0000000(size=270532608)
*-display
description: VGA compatible controller
product: Picasso
vendor: Advanced Micro Devices, Inc. [AMD/ATI]
physical id: 0
bus info: pci@0000:05:00.0
version: c1
width: 64 bits
clock: 33MHz
capabilities: vga_controller bus_master cap_list
configuration: driver=amdgpu latency=0
resources: irq:43 memory:b0000000-bfffffff memory:c0000000-c01fffff ioport:1000(size=256) memory:c2600000-c267ffff
*-multimedia:0
description: Audio device
product: Raven/Raven2/Fenghuang HDMI/DP Audio Controller
vendor: Advanced Micro Devices, Inc. [AMD/ATI]
physical id: 0.1
bus info: pci@0000:05:00.1
version: 00
width: 32 bits
clock: 33MHz
capabilities: bus_master cap_list
configuration: driver=snd_hda_intel latency=0
resources: irq:82 memory:c2688000-c268bfff
*-generic
description: Encryption controller
product: Family 17h (Models 10h-1fh) Platform Security Processor
vendor: Advanced Micro Devices, Inc. [AMD]
physical id: 0.2
bus info: pci@0000:05:00.2
version: 00
width: 32 bits
clock: 33MHz
capabilities: bus_master cap_list
configuration: driver=ccp latency=0
resources: irq:71 memory:c2500000-c25fffff memory:c268c000-c268dfff
*-usb:0
description: USB controller
product: Raven USB 3.1
vendor: Advanced Micro Devices, Inc. [AMD]
physical id: 0.3
bus info: pci@0000:05:00.3
version: 00
width: 64 bits
clock: 33MHz
capabilities: xhci cap_list
configuration: driver=xhci_hcd latency=0
resources: irq:33 memory:c2400000-c24fffff
*-usb:1
description: USB controller
product: Raven USB 3.1
vendor: Advanced Micro Devices, Inc. [AMD]
physical id: 0.4
bus info: pci@0000:05:00.4
version: 00
width: 64 bits
clock: 33MHz
capabilities: xhci bus_master cap_list
configuration: driver=xhci_hcd latency=0
resources: irq:43 memory:c2300000-c23fffff
*-multimedia:1
description: Audio device
product: Family 17h (Models 10h-1fh) HD Audio Controller
vendor: Advanced Micro Devices, Inc. [AMD]
physical id: 0.6
bus info: pci@0000:05:00.6
version: 00
width: 32 bits
clock: 33MHz
capabilities: bus_master cap_list
configuration: driver=snd_hda_intel latency=0
resources: irq:45 memory:c2680000-c2687fff
*-pci:5
description: PCI bridge
product: Raven/Raven2 Internal PCIe GPP Bridge 0 to Bus B
vendor: Advanced Micro Devices, Inc. [AMD]
physical id: 8.2
bus info: pci@0000:00:08.2
version: 00
width: 32 bits
clock: 33MHz
capabilities: pci normal_decode bus_master cap_list
configuration: driver=pcieport
resources: irq:31 memory:c2200000-c22fffff
*-sata
description: SATA controller
product: FCH SATA Controller [AHCI mode]
vendor: Advanced Micro Devices, Inc. [AMD]
physical id: 0
bus info: pci@0000:06:00.0
version: 61
width: 32 bits
clock: 33MHz
capabilities: sata ahci_1.0 bus_master cap_list
configuration: driver=ahci latency=0
resources: irq:72 memory:c2200000-c22007ff
*-serial
description: SMBus
product: FCH SMBus Controller
vendor: Advanced Micro Devices, Inc. [AMD]
physical id: 14
bus info: pci@0000:00:14.0
version: 61
width: 32 bits
clock: 66MHz
configuration: driver=piix4_smbus latency=0
resources: irq:0
*-isa
description: ISA bridge
product: FCH LPC Bridge
vendor: Advanced Micro Devices, Inc. [AMD]
physical id: 14.3
bus info: pci@0000:00:14.3
version: 51
width: 32 bits
clock: 66MHz
capabilities: isa bus_master
configuration: latency=0
*-pci:1
description: Host bridge
product: Family 17h (Models 00h-1fh) PCIe Dummy Host Bridge
vendor: Advanced Micro Devices, Inc. [AMD]
physical id: 101
bus info: pci@0000:00:01.0
version: 00
width: 32 bits
clock: 33MHz
*-pci:2
description: Host bridge
product: Family 17h (Models 00h-1fh) PCIe Dummy Host Bridge
vendor: Advanced Micro Devices, Inc. [AMD]
physical id: 102
bus info: pci@0000:00:08.0
version: 00
width: 32 bits
clock: 33MHz
*-pci:3
description: Host bridge
product: Raven/Raven2 Device 24: Function 0
vendor: Advanced Micro Devices, Inc. [AMD]
physical id: 103
bus info: pci@0000:00:18.0
version: 00
width: 32 bits
clock: 33MHz
*-pci:4
description: Host bridge
product: Raven/Raven2 Device 24: Function 1
vendor: Advanced Micro Devices, Inc. [AMD]
physical id: 104
bus info: pci@0000:00:18.1
version: 00
width: 32 bits
clock: 33MHz
*-pci:5
description: Host bridge
product: Raven/Raven2 Device 24: Function 2
vendor: Advanced Micro Devices, Inc. [AMD]
physical id: 105
bus info: pci@0000:00:18.2
version: 00
width: 32 bits
clock: 33MHz
*-pci:6
description: Host bridge
product: Raven/Raven2 Device 24: Function 3
vendor: Advanced Micro Devices, Inc. [AMD]
physical id: 106
bus info: pci@0000:00:18.3
version: 00
width: 32 bits
clock: 33MHz
configuration: driver=k10temp
resources: irq:0
*-pci:7
description: Host bridge
product: Raven/Raven2 Device 24: Function 4
vendor: Advanced Micro Devices, Inc. [AMD]
physical id: 107
bus info: pci@0000:00:18.4
version: 00
width: 32 bits
clock: 33MHz
*-pci:8
description: Host bridge
product: Raven/Raven2 Device 24: Function 5
vendor: Advanced Micro Devices, Inc. [AMD]
physical id: 108
bus info: pci@0000:00:18.5
version: 00
width: 32 bits
clock: 33MHz
*-pci:9
description: Host bridge
product: Raven/Raven2 Device 24: Function 6
vendor: Advanced Micro Devices, Inc. [AMD]
physical id: 109
bus info: pci@0000:00:18.6
version: 00
width: 32 bits
clock: 33MHz
*-pci:10
description: Host bridge
product: Raven/Raven2 Device 24: Function 7
vendor: Advanced Micro Devices, Inc. [AMD]
physical id: 10a
bus info: pci@0000:00:18.7
version: 00
width: 32 bits
clock: 33MHz
*-pnp00:00
product: PnP device PNP0c02
physical id: 2
capabilities: pnp
configuration: driver=system
*-pnp00:01
product: PnP device PNP0b00
physical id: 3
capabilities: pnp
configuration: driver=rtc_cmos
*-pnp00:02
product: PnP device FUJ7401
physical id: 4
capabilities: pnp
configuration: driver=i8042 kbd
*-pnp00:03
product: PnP device PNP0c02
physical id: 5
capabilities: pnp
configuration: driver=system
*-pnp00:04
product: PnP device PNP0c01
physical id: 6
capabilities: pnp
configuration: driver=system
WARNING: output may be incomplete or inaccurate, you should run this program as super-user
Solution 1:
You indeed could delay the startup of snapd. After startup, you then would be unable to start snap applications until the daemon has loaded. However, you will at most shave off less than half of a second of your startup time.