Delay service until after bootup

Can these be delayed to start after bootup?

19.722s [email protected]:00-0000:00:13.2-usb2-2\x2d4.service
12.514s [email protected]:00-0000:00:13.2-usb2-2\x2d5.service

HI fixit7,

is your printer already fully set-up? . :smiley:

Yes, printers are setup.

Then leave the printer powered off and only switch it on when needed, I personally don’t know of any other way myself!. Is it causing you a problem?, if so; which?. :smiley:

printer only comes on when needed.

I will accept the extra 32 secs of boot time.

Maybe try changing your software sources download location and updating again, it may solve the long boot time problem?.

:smiley:

My boot times are good.

systemd-analyze blame
18.165s [email protected]:00-0000:00:13.2-usb2-2\x2d5.service
11.164s [email protected]:00-0000:00:13.2-usb2-2\x2d4.service
9.361s dev-sda1.device
8.790s NetworkManager-wait-online.service
7.013s ModemManager.service
6.402s grub-common.service
6.135s [email protected]
5.516s accounts-daemon.service
5.485s apport.service
4.731s snapd.service
4.150s irqbalance.service
4.085s lightdm.service
3.868s speech-dispatcher.service
3.623s networking.service
3.473s systemd-user-sessions.service
3.473s pppd-dns.service
3.415s lm-sensors.service
3.411s gpu-manager.service
3.410s alsa-restore.service
3.407s rsyslog.service
3.407s tetrinetx.service
3.406s tor.service
3.365s avahi-daemon.service
3.116s NetworkManager.service
1.699s resolvconf.service
1.617s keyboard-setup.service
1.373s upower.service
1.361s systemd-modules-load.service
1.208s systemd-tmpfiles-setup-dev.service
1.061s polkitd.service
1.015s [email protected]

@fixit7 fixit7 So, it’s a systemD service that is triggered by udev.
Udev rule is in /lib/udev/rules.d

Can you give me the output of

ls /lib/udev/rules.d

Nevermind, found it after starting ubuntu mate 17.10 in a VM (no access to my computer right now).

[code]$ cat /lib/udev/rules.d/70-printers.rules

Low-level USB device add trigger

ACTION==“add”, SUBSYSTEM==“usb”, ENV{DEVTYPE}==“usb_device”, ENV{ID_USB_INTERFACES}==":0701??:", TAG+=“udev-configure-printer”, TAG+=“systemd”, PROGRAM="/bin/systemd-escape [email protected] %p", ENV{SYSTEMD_WANTS}+="%c"

Low-level USB device remove trigger

ACTION==“remove”, SUBSYSTEM==“usb”, ENV{DEVTYPE}==“usb_device”, ENV{ID_USB_INTERFACES}==":0701:*", RUN+=“udev-configure-printer remove %p”[/code]
That is the udev rule that runs when you add/attach a usb printer.

It is starting this systemd service:

[code]
$ cat /lib/systemd/system/[email protected]
[Unit]
Description=Automatic USB/Bluetooth printer setup (%i)
Requires=cups.socket
After=cups.socket

[Service]
#Type=simple
Type=forking
GuessMainPID=true
ExecStart=/lib/udev/udev-configure-printer add %I

This ExecStop would be useful to disable the print queue when ippusbxd

crashes or gets killed, but in the case that ippusbxd does not get started

at all during the process run by ExecStart (printer does not support

IPP-over-USB) ExecStop gets run immediately making a printer getting

disabled again right after it getting enabled or set up

ExecStop=/lib/udev/udev-configure-printer remove %I[/code]

It’s setting up the printers on boot.
Try to launch it 5 seconds after light display manager. Change After=cups.socket to

After=lightdm.service and add next to the end of /lib/systemd/system/udev-c[email protected]

[Install] WantedBy=graphical.target

If that doesn’t work I’m not sure what will.

2 Likes

I tried this but no change.

I really appreciate your help. I learned a lot.

[Unit]
Description=Automatic USB/Bluetooth printer setup (%i)

[Service]
After=lightdm.service
#Type=simple
Type=forking
GuessMainPID=true
ExecStart=/lib/udev/udev-configure-printer add %I
[Install]
WantedBy=graphical.target

Using this, boot reduced from 32 secs to 21 seconds.
Thanks so much.

[Unit]
Description=Automatic USB/Bluetooth printer setup (%i)
After=lightdm.service
[Service]
#Type=simple
Type=forking
GuessMainPID=true
WantedBy=graphical.target
ExecStart=/lib/udev/udev-configure-printer add %I

[email protected]:~$ systemd-analyze blame
14.228s [email protected]:00-0000:00:13.2-usb2-2\x2d5.service
9.955s NetworkManager-wait-online.service
9.494s grub-common.service
8.808s dev-sda1.device
7.255s networking.service
7.225s [email protected]:00-0000:00:13.2-usb2-2\x2d4.service
5.636s accounts-daemon.service

1 Like