Speeding up boot time and the necessary commands
-
Pi Model: Zero
Power Supply used: Samsung original adaptive charger
RetroPie Version Used: 4.7.1
Built From: Raspberry pi imagerI want to speed up my booting time (its about 30 seconds now), and according to older posts I understand I need to cancel the wait for wifi, bluetooth and to stop ssh.
The thing is I don't know the commands to do this in the way that doesn't cancel the option completely only postpones it to after boot time (I know it's possible with wifi and bluetooth. Is it also possible with SSH?). Also, if anyone has more tips on how to speed up booting time, it would be highly appreciated.Thanks in advance!
-
Stopping SSH will not decrease the boot time. You can disable the 'Wait for network at boot' option from Raspi-Config, found under RetroPie in EmulationStation, if you don't want to wait for the network activation to delay the boot.
Other means to decrease the boot time:
- stop or disable other non-important services (or ones that you don't use) by using
sudo systemctl disable <service_name>
. See an example on how to do tha here. - if you don't change your ROM list often, you can enable the 'Parse Metadata Only' option in EmulationStation, it will speed up considerably EmulationStation's start. This means EmulationStation will not scan for new ROMs on start-up, if you add new ROMs to your installation, you need to disable this option and then restart EmulationStation so the new games are added.
- stop or disable other non-important services (or ones that you don't use) by using
-
@mitu
Thanks for your help! I will try these as soon as I get home!
I do have a question about using thedisable
command. Does that mean it will stop using said service at all or only that it would load after startup? -
@hairdyeguy Disabling a service is exactly that - it disables the service completely, it will not be started at all.
-
@mitu I don't mind disabling bluetooth since I currently don't use it, but I do need wifi and SSH (I don't know about other services because I still don't know many of them hence I don't know if they're important).
Isn't there a way to wait after boot? -
Isn't there a way to wait after boot?
Not sure what you mean by that. What for what ?
Did you disable the 'Wait for Network connection' at boot from Raspi-Config ? This will speed up the boot by not waiting for the Wi-Fi/SSH initialization.
-
@mitu said in Speeding up boot time and the necessary commands:
Not sure what you mean by that. What for what ?
I meant set service to load after boot (like with the wifi. I don't know if it works with other services)
@mitu That I did, though somehow it raised the booting time from 45 seconds to 47 seconds (about 6 seconds for kernel and 41 seconds for userspace). I have yet to disable bluetooth (plan on doing it now), and as for other services, I have no idea what they do, so I don't know if I should disable them.
-
I meant set service to load after boot (like with the wifi. I don't know if it works with other services)
I don't think there is a configuration for each service to do that, but each one is bound by its configuration and it may wait in turn for other service to complete.
I have no idea what they do, so I don't know if I should disable them.
Take a backup of your image and experiment by disabling one service at a time. If you've used
systemd-analyze
, you can see which service takes the longest to start and you can start by picking one of the outliers.Post the output of
systemd-analyze blame
andsystemd-analyze critical-chain
and then we can advise. -
@mitu Actually when I used
systemd-analyze
the only output was this: -
@mitu
This is thesystemd-analyze blame
output https://pastebin.com/VBgpGu8E
And this is thesystemd-analyze critical-chain
output https://pastebin.com/K3T50phv -
Try disabling the file shares (Samba) services, which take a long time to start
sudo systemctl disable smbd.service sudo systemctl disable nmbd.service
You'll not be able to use file shares to transfer ROMs though, but you can use SFTP/SSH instead.
You may disable the
triggerhappy
service also, assuming you don't use for something like GPIO inputs or anything else. -
@mitu
How can I transfer files via putty? The documentation only shows samba services.
Though I don't mind also transferring by plugging the sd card into my laptop.What
triggerhappy
does? Technically I'm going to put the pi in a freeplay zero kit which requires pins, but I think the kit has its own image and I can always turn in back on.
(I'm sorry I'm blabbering on, I'm new to this and to Linux so I worry that I made mistakes in my logic)
EDIT: oh, is it better to change things via ssh or is it better to edit the files on the sd card via laptop? I still haven't figured out how to paste commands into the putty terminal so long lines are tiring -
@hairdyeguy said in Speeding up boot time and the necessary commands:
How can I transfer files via putty? The documentation only shows samba services.
Use WinSCP for file transfers. While technically you can use Putty's equivalent (
pscp
), it's easier with WinSCP.What triggerhappy does? Technically I'm going to put the pi in a freeplay zero kit which requires pins, but I think the kit has its own image and I can always turn in back on.
Not familiar with their image, they might not use it. triggerhappy is a service that listens for input from various sources (keyboard/gamepad) and can execute scripts. Out of the box it doesn't have anything configured, but it's installed if you need to use it. I think it's safe to disable it.
-
@hairdyeguy said in Speeding up boot time and the necessary commands:
EDIT: oh, is it better to change things via ssh or is it better to edit the files on the sd card via laptop? I still haven't figured out how to paste commands into the putty terminal so long lines are tiring
Shift + Insert copies the current clipboard text to the Putty command line session. You can paste with Right Click only if configured, but not sure if it's the default.
-
I’m also interested in this for my GPi Case. Going to give this a shot later as well. Thanks @mitu and @HairDyeGuy.
-
@mitu
Tried it along side to disabeling bluetooth and rainbow splash screen + inserting the quiet flag to kernel. Booting time is now 28 seconds!
Are there more things you'd recommend?EDIT:
@mitu said in Speeding up boot time and the necessary commands:Shift + Insert copies the current clipboard text
Tried it but it didn't work
-
@hairdyeguy said in Speeding up boot time and the necessary commands:
Tried it along side to disabeling bluetooth and rainbow splash screen + inserting the quiet flag to kernel. Booting time is now 28 seconds!
Are there more things you'd recommend?The EmulationStation settings I mentioned in my first post - they should speed up dramatically the front-end startup.
Other services that are not strictly needed -
raspi-config
(?),hciuart
(which you don't need if you disabled Bluetooth),rpi-eeprom-update
(the Pi zero doesn't have an EEPROM).
You can also disable the swap service (dphys-swapfile
) and test, but the Pi 0 has limited memory and swap may be useful if you want to install from source or run other things.I'm not sure why the
dev-mmcblk0p2.device
takes so long, maybe the sdcard is not so fast (?).There may be other - more radical - options
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.