[solved] tipp for always super fast booting : dietpi-boot.service type=forking !!!

Hello,

I constantly experienced slow booting > 50 secs when no network is available.

I solved this issue in many little ways, but the main breakthrough was that I changed the type of dietpi-boot.service.

/etc/systemd/system/dietpi-boot.service now contains :

[Service]
Type=forking
RemainAfterExit=yes
StandardOutput=tty

The “type=forking” is important, so it will not wait forever for the network, or if it will, it will do so in the background.
Previously, there was a “type=oneshot” there.

This improved system performance heavily :

root@DietPi:~# systemd-analyze blame

          4.368s dietpi-boot.service
          1.209s dietpi-preboot.service
           574ms dev-mmcblk0p2.device
           427ms systemd-logind.service
           377ms systemd-udev-trigger.service
           327ms keyboard-setup.service
           278ms dietpi-ramdisk.service
           225ms user@1000.service
           220ms var-swap.swap
           212ms networking.service
           132ms dietpi-ramlog.service
           128ms systemd-journald.service
            92ms alsa-restore.service
            90ms ssh.service
            75ms systemd-udevd.service

Before this, the service needed more than 30 seconds without network.

Only caveat : If you plugin your network cable later, you will notice that the vsftpd has not started up. Never mind that.

So, my pro-tip to the developers : Speed up booting and change the type of your systemd service to “forking” !!!

Edit the file as described above. After editing it, do a “systemctl daemon-reload” and reboot.

Hi,

this is as expected because your system is waiting on a valid network connection as well as the time sync to be completed. However you could bypass both checks. Just go to /DietPi/dietpi.txt and set the following 2 lines to 0.

# Delay boot until network is established: 0=disabled | 1=10 second wait max (default) | 2=infinite wait
CONFIG_BOOT_WAIT_FOR_NETWORK=0

# Network time sync: 0=disabled | 1=boot only | 2=boot + daily | 3=boot + hourly | 4=Daemon + Drift
CONFIG_NTP_MODE=0

Now your system should boot quite fast as it doesn’t care about valid network connection or time sync.

For testing purposes, I tried your suggested “workaround” but it doesn’t has any impact on startup timing on my Demo VM.

Original Settings

root@DietPiVM1:~# systemd-analyze blame
         31.651s dietpi-boot.service

changed to Type=forking

root@DietPiVM1:~# systemd-analyze blame
         31.453s dietpi-boot.service

For me the main benefit is coming from switching off the NTP time sync

root@DietPiVM1:~# systemd-analyze blame
          2.882s dietpi-boot.service
1 Like

…on my Demo VM.

Your demo VM is not a real machine!!!
Test it on a real machine and you will experience the same speedup !

Nope. It did not change anything on my RPi3B+ as well. Doesn’t matter if this is a real physical device or VM.

root@DietPi3:~# cat /etc/systemd/system/dietpi-boot.service|grep Type
#Type=oneshot
Type=forking
root@DietPi3:~# systemd-analyze blame
         32.243s dietpi-boot.service
          1.228s dietpi-preboot.service

Did you do a “systemctl daemon-reload” ?

Yes I did, but did not change anything.