Speed up boot time Lubuntu, change target order

Lubuntu stuck waiting tons of services to load before Graphic User Interface ready for user to work. Any one know how to Re-arrange order of systemd target to let heavy load of some network.target have to follow graphical.target. It’s mean I want GUI ready for use as fast as possible and then do something in background. (I do something to make boot faster but no warranty that it’s won’t break your system, I work in mine, go to the end of this post).
As Lubuntu 22.04 I’m using. It have to wait “network.target network-online.target NetworkManager-wait-online.service network.service networkd-dispatcher.service” for minutes and about 30second look at black screen with only mouse pointer before pretty desktop appear which is ready for using. NetworkManager-wait-online.service network.service is one of worst thing I have ever seen, it may do nothing but always delay my boot time. I hope we have an easy way to make network start only after user GUI ready. Yes, everything seen on screen and then wait some seconds seen wifi icon rotating for connecting is good in my opinion.
And some slow startup guys like mysql.service, postgres.service should have a way to start only after GUI is completely ready to use. I see they always add WantedBy=multi-user.target which make GUI have to way 30s-60s for them to start, that’s terrible feeling for user to view black screen for some thing can be easily fixed. I don’t know how to make them start after GUI. So I use systemctl disable these service and mannually systemctl enable them when I need to use.

Some thing help me at least boot faster

  • Disable some Network Service. You may need run systemctl start NetworkManager to use wifi, ethernet,… You must know it can break your system! If you don’t want to lost time fixed some error don’t do this.
#!/usr/bin/env bash
# NetworkManager.service
# ModemManager.service
# polkit.service
# don't need to make a .sh file, just copy from "for i ... done" to your terminal and hit enter.
for i in network.target network-online.target  NetworkManager-wait-online.service network.service networkd-dispatcher.service ; do 
sudo systemctl disable $i
sudo systemctl mask $i
done
# to undo
#!/usr/bin/env bash
for i in network.target network-online.target  NetworkManager-wait-online.service network.service networkd-dispatcher.service ; do 
sudo systemctl unmask $i
sudo systemctl enable $i
done
  • udisks2 service, it waits for a “ghost” 20 sceonds before doing something ???
sudo systemctl disable udisks2
# after disable, graphical.target call it, and it start only 1 second ???
# when I run systemctl status udisks2, I saw it failed to load mraid blah blah. And I install sudo apt install libblockdev-mdraid2 for it.
  • I also disable some service I don’t want them to delay my boot
# disable mysql
# use sudo if you  don't want reenter password dialog ask you everytime
sudo systemctl disable mysql
# to undo: enable mysql
sudo systemctl enable mysql
  • I also want fix phpsessionclean.timer slow my boot xx seconds
sudo systemctl edit --full phpsessionclean.timer
then change **Persistent=false**, press **Ctrl+S** to save, **Ctrl+X** to exit.
may protect it run at boot (if its contrains passed at boot it fires when you're booting :((()
to undo change it back to true. You may add a line start with # to  save it old value like:
# original Persistent is true
and if you have trouble you can easily rollback.

But one more times I hope we can re-arrange systemd startup target order user friendly. And make Lubuntu more fit normal user wish. GUI as fast as possible. Boot like a flash :dash: :dash: :dash:. And then do something background, don’t make us wait blank screen or even Plymouth useless.

This thread may be of interest: