How to speed up boot time if run headless?
Hello,
are there ways to speed up the boot time of the Pi using the Raspbian image when operated headless? I ask since I use my Pi as a web radio player and the boot up time is quite long for this purpose.
Regards
gaias
are there ways to speed up the boot time of the Pi using the Raspbian image when operated headless? I ask since I use my Pi as a web radio player and the boot up time is quite long for this purpose.
Regards
gaias
Re: How to peed up boot time if run headless?
1) Overclocking it will improve boot time from the point at which the governor is switched to ondemand, although this occurs quite late in the boot process so isn't likely to reduce the overall boot time by very much.
2) Overclocking AND enabling force_turbo ensures the overclock is effective throughout the entire boot process and will significantly reduce boot time. However, if you need to over volt to achieve a stable overclock, this will void your warranty.
3) Removing unnecessary services will also reduce boot time. I run the following commands to remove desktop related programmes and services from a stock Raspbian install:
My 1GHz 512MB overclocked and force_turbo=1 Pi, with a Class 10 SDHC, all desktop cruft removed, will boot headless Raspbian in approximately 38 seconds, start to finish.
2) Overclocking AND enabling force_turbo ensures the overclock is effective throughout the entire boot process and will significantly reduce boot time. However, if you need to over volt to achieve a stable overclock, this will void your warranty.
3) Removing unnecessary services will also reduce boot time. I run the following commands to remove desktop related programmes and services from a stock Raspbian install:
Code: Select all
sudo apt-get -y purge libx11-6 libgtk-3-common xkb-data lxde-icon-theme raspberrypi-artwork penguinspuzzle
# Needed by omxplayer so add back...
apt-get -y install libfreetype6
Re: How to peed up boot time if run headless?
Thanks especially for the tip to uninstall services (and the names of the packages)! Could there be anymore services I can uninstall if I only need to run mpd+mpc on the machine?
Re: How to peed up boot time if run headless?
Bump. Interested in hearing more about this.
Does anyone know of any other services we can scrap from the boot sequence? I only need to run a simple python script on a headless pi.
Cheers.
Does anyone know of any other services we can scrap from the boot sequence? I only need to run a simple python script on a headless pi.
Cheers.
Re: How to peed up boot time if run headless?
It depends on what else is needed for this script(loging, internet connection, time from ntp, kernel modules ...).Does anyone know of any other services we can scrap from the boot sequence? I only need to run a simple python script on a headless pi.
I can recommend installing rcconf - Debian Runlevel Configuration tool.
Uncheck unnecessary services, confirm new configuration with OK and reboot. In Your case fake-hwclock, ntp, udev, ssh should work.
I was using RPi for playing internet radio using moc, just with alsa-utils, ssh, udev enabled, accurate time unnecessary, so no ntp and fake-hwclock.
CPU@700MHz SDHC class4 card boots to command promt in 14 seconds.
You can add kernel option quiet to /boot/cmdline.txt. Because of slow TTY, printing less info can save some time.
Adding kernel option fastboot, not recomended, because disables filesystem check, but can save few seconds.
Re: How to peed up boot time if run headless?
Sandisk UHS-I SD Card - 95MBps - boots a Pi faster than you walk back to the sofa to relogin with Putty!
Re: How to peed up boot time if run headless?
High speed raspian tweaks:
1. overclock
2. tune kernel:
http://rpitc.blogspot.com/p/docs.html
3. tune system:
4. check services (I didn't see much to stop) using and be sure to read the man page first
5. get a fast SDHC card http://www.amazon.com/Transcend-Class-F ... 003VNKNF0/
6. rebuild kernel with patches TO DO
1. overclock
2. tune kernel:
http://rpitc.blogspot.com/p/docs.html
Code: Select all
/boot/cmdline.txt
dwc_otg.lpm_enable=0 root=/dev/mmcblk0p2 rootfstype=ext4 rootflags=commit=120,data=writeback elevator=deadline noatime nodiratime data=writeback rootwait quiet
Code: Select all
/etc/sysctl.conf:
vm.dirty_background_ratio = 20
vm.dirty_expire_centisecs = 0
vm.dirty_ratio = 80
vm.dirty_writeback_centisecs = 1200
vm.overcommit_ratio = 2
vm.laptop_mode = 5
vm.swappiness = 10
Code: Select all
sysv-rc-conf
5. get a fast SDHC card http://www.amazon.com/Transcend-Class-F ... 003VNKNF0/
6. rebuild kernel with patches TO DO
Re: How to peed up boot time if run headless?
People are offering a lot of performance tips but I'm concerned there's a bigger picture here.
Being headless has no impact on boot time.
My Pi, which is headless (not that that matters), can reboot in literally about ten seconds. When I knock the cable out accidentally, it's back online before putty drops a session.
I'm curious as to where yours is lagging. Some possible suggestions:
Being headless has no impact on boot time.
My Pi, which is headless (not that that matters), can reboot in literally about ten seconds. When I knock the cable out accidentally, it's back online before putty drops a session.
I'm curious as to where yours is lagging. Some possible suggestions:
- You don't have a NIC connected, but the interface is configured to look for a DHCP server
You are running Apache or a mail client without working DNS
The web radio software takes a long time to start
Re: How to peed up boot time if run headless?
How do you measure boot time? 10 secs sounds unbelievable. Mine is closer to 30 secs. But we should agree how to measure it.
Re: How to peed up boot time if run headless?
In my case it's a mental estimate of how long it takes to start responding it pings.shuckle wrote:How do you measure boot time? 10 secs sounds unbelievable. Mine is closer to 30 secs. But we should agree how to measure it.
It's certainly possible that it takes longer, and certainly possible that some services are still on their way up at that time.
Even if it was 30 seconds though, it's significantly faster than most desktops, which brings me to the question of how long does it take the original poster to start his pi?
If he says "four minutes" it's all a moot point - something would be wrong.
Re: How to speed up boot time if run headless?
Hi all, how do we know which file Pi will execute during boot ? ie /etc/rc.local only print "My IP address is ...", what else it will execute ? ie if i install MySQL server and it auto-start, but im not sure which file do call it.
Re: How to speed up boot time if run headless?
Have a look in /etc/rc1.d 2.d 3.d etc etc and you will see symlinks that starts with either a S or a KNarf03 wrote:Hi all, how do we know which file Pi will execute during boot ? ie /etc/rc.local only print "My IP address is ...", what else it will execute ? ie if i install MySQL server and it auto-start, but im not sure which file do call it.
Symlinks that start with an S means that the program linked starts at that runlevel
Symlinks that start with a K means that the program will stop at that runlevel
My Blog - http://www.sirlagz.net
Visit my blog for Tips, Tricks, Guides and More !
WiFi Issues ? Have a look at this post ! http://www.raspberrypi.org/phpBB3/viewtopic.php?f=28&t=44044
Visit my blog for Tips, Tricks, Guides and More !
WiFi Issues ? Have a look at this post ! http://www.raspberrypi.org/phpBB3/viewtopic.php?f=28&t=44044
-
- Posts: 47
- Joined: Fri Jun 22, 2012 8:51 am
Re: How to speed up boot time if run headless?
I don't have any numbers to put to it, but it's almost universally true that linux boot times are IO-bound. Faster storage will give you faster boots.
This seems to be borne out by other comments here - people with a class 10 SDHC card have 10 seconds boots, people with a rotten class 2 SD card have 30 or 40 second boots.
The speed difference is not trivial - the 'class' number is actually a transfer rate for writes in MB/s. A class 10 card is five times faster than a class 2 card.
So the biggest difference you can make is to shell out $25 on a high performance SDHC card.
The other tip on here I'd agree with is making the kernel shut up during boot - the default log level seems to be 7 - 'shout about everything' level. Try adding 'loglevel=1' or 'quiet' to cmdline.txt. Or turn off the serial console in cmdline.txt. By default, the kernel dumps several kB of text on the console during boot, which probably adds a couple of seconds.
This seems to be borne out by other comments here - people with a class 10 SDHC card have 10 seconds boots, people with a rotten class 2 SD card have 30 or 40 second boots.
The speed difference is not trivial - the 'class' number is actually a transfer rate for writes in MB/s. A class 10 card is five times faster than a class 2 card.
So the biggest difference you can make is to shell out $25 on a high performance SDHC card.
The other tip on here I'd agree with is making the kernel shut up during boot - the default log level seems to be 7 - 'shout about everything' level. Try adding 'loglevel=1' or 'quiet' to cmdline.txt. Or turn off the serial console in cmdline.txt. By default, the kernel dumps several kB of text on the console during boot, which probably adds a couple of seconds.
Re: How to speed up boot time if run headless?
The fastest way to boot is to build yourself an initird ramdisk. That way you can be up in 5 seconds
Check out berryboot as an example of how quick it is to boot linux
Gordon
Check out berryboot as an example of how quick it is to boot linux
Gordon
Gordon Hollingworth PhD
Raspberry Pi - Chief Product Officer
Raspberry Pi - Chief Product Officer
Re: How to speed up boot time if run headless?
I tested different ways to improve boot time and noticed the following:
Adding noatime nodiratime to /boot/cmdline.txt improved about 0.1 sec
Adding quiet to /boot/cmdline.txt improved about 1.0 sec
Overclocking improved about 0.1 sec
Total improvment with all these settings was about 1.1 secs
(Removing connected keyboard improved about 0.2 sec)
Now my raspberry boots about in 18 seconds.I am measuring it like this:
For comparison:
What timings can you get? And any ideas how to improve?
Any easy ways to utilize that initrd ramdisk? getting form 18 secs to 5 secs sounds almost unbelievable.
Adding noatime nodiratime to /boot/cmdline.txt improved about 0.1 sec
Adding quiet to /boot/cmdline.txt improved about 1.0 sec
Overclocking improved about 0.1 sec
Total improvment with all these settings was about 1.1 secs
(Removing connected keyboard improved about 0.2 sec)
Now my raspberry boots about in 18 seconds.I am measuring it like this:
Code: Select all
$ dmesg | grep full-duplex
[ 18.245983] smsc95xx 1-1.1:1.0: eth0: link up, 100Mbps, full-duplex, lpa 0x45E1
Code: Select all
$ dmesg | grep led0
[ 3.963521] Registered led device: led0
Any easy ways to utilize that initrd ramdisk? getting form 18 secs to 5 secs sounds almost unbelievable.
Re: How to speed up boot time if run headless?
Did you try "initial_turbo=30" and see what effect that has? It should mean the Pi is overclocked from the very beginning, rather than the overclock kicking in near the end of the boot sequence.shuckle wrote:I tested different ways to improve boot time and noticed the following:
Adding noatime nodiratime to /boot/cmdline.txt improved about 0.1 sec
Adding quiet to /boot/cmdline.txt improved about 1.0 sec
Overclocking improved about 0.1 sec
Total improvment with all these settings was about 1.1 secs
Re: How to speed up boot time if run headless?
Yes, i tried it. It had no effect. I think it does something else than what it seems to imply...
Re: How to speed up boot time if run headless?
turn off or decrease the system log level, its set to log EVERYTHING, and on sd card speed is really noticeable
Re: How to speed up boot time if run headless?
I know it's an old topic, but I think there might be some interesting info in these slides for some hardcore tweaking: http://www.slideshare.net/andrewmurraympc/elce-the
This is not raspberry PI and a very specific use case, but he managed to get power-to-UI time from 19 seconds to 0.77 seconds!
This is not raspberry PI and a very specific use case, but he managed to get power-to-UI time from 19 seconds to 0.77 seconds!
Re: How to speed up boot time if run headless?
I set loglevel=0 to /boot/cmdline.txt, but that did not cause any effects to anywhere. I am surprised. How should it be done then?aaa801 wrote:turn off or decrease the system log level, its set to log EVERYTHING, and on sd card speed is really noticeable
Re: How to speed up boot time if run headless?
http://linux.die.net/man/5/syslog.confshuckle wrote:I set loglevel=0 to /boot/cmdline.txt, but that did not cause any effects to anywhere. I am surprised. How should it be done then?aaa801 wrote:turn off or decrease the system log level, its set to log EVERYTHING, and on sd card speed is really noticeable
Re: How to speed up boot time if run headless?
Did you reboot after changing the log level? the new setting will not take effect until after reboot. but sync first:
sync
reboot
sync
reboot
FORUM TIP: To view someone's posting history, sign in, click on their user name, then on "Search User's Posts." || Running ArchLinuxArm on Model 2B and 512MB Model B
-
- Posts: 4277
- Joined: Sun Jan 15, 2012 1:11 pm
Re: How to speed up boot time if run headless?
I have not had good luck with (trying to shut up the messages by) changing the "loglevel" thing, either.
I think it is one of those things that only works if the various bits and pieces of the kernel that generate output "play by the rules" - that is, recognize the loglevel setting. My experience is that some drivers don't do this.
I think it is one of those things that only works if the various bits and pieces of the kernel that generate output "play by the rules" - that is, recognize the loglevel setting. My experience is that some drivers don't do this.
And some folks need to stop being fanboys and see the forest behind the trees.
(One of the best lines I've seen on this board lately)
(One of the best lines I've seen on this board lately)
Re: How to speed up boot time if run headless?
Yes, i did. I am testing booting speed, so this comes automatically and often.sdjf wrote:Did you reboot after changing the log level? the new setting will not take effect until after reboot. but sync first:
sync
reboot
-
- Posts: 1
- Joined: Sat Sep 14, 2013 3:29 pm
Re: How to speed up boot time if run headless?
Would it help on the boottime by changing the sysvinit to systemd. On a regular computer you'll gain a lot of boot time improvement. i have seen netbooks go from 2minuts in boottime to 30sec. 
