# Reducing boot times



## dennylin93 (Jul 11, 2009)

It takes a few minutes to boot FreeBSD, and I'm wondering if it's possible to reduce the boot time to under 1 minute (some articles on the Internet show that Fedora 11 is capable of this). I'm running GNOME for my desktop, but I might switch to KDE/Openbox/Fluxbox in the near future.


----------



## mk (Jul 11, 2009)

1) what hardware you have?
2) what version of freebsd you have?
3) how did you configured - kernel,services etc..
4) do you start Xorg with xdm/gdm 
5) when you boot - the system is stopping every time after "configuring syscons: blanktime" ?
for to be able to troubleshoot something, you need as much as possible information.


----------



## dennylin93 (Jul 11, 2009)

Hardware:
Intel Pentium D 3.4 Ghz, 2 GB of RAM, HDD: SATA 250 GB. Only 100 GB is used for FreeBSD though.

FreeBSD:
Running 7.2-RELEASE-p2

System:
My kernel is a custom one. Mainly took out the debug options, RAID controllers, unused NICs, FireWire, etc. I added ACCEPT_FILTER_HTTP, ACCEPT_FILTER_DATA, QUOTA, if_bridge, PF & ALTQ support. Only PF is used though.

In /etc/rc.conf, I've got lpd, linux, abi, usbd, hald, dbus, gdm, pf, fusefs, clamav, and postfix enabled while sendmail is disabled. 2 NTFS and 1 FAT32 drives are mounted as well as procfs and linprocfs.

/etc/make.conf (also excluded some unused modules):

```
CFLAGS= -O -fno-strict-aliasing -pipe
```

/etc/src.conf:

```
WITHOUT_BLUETOOTH= yes 
WITHOUT_GAMES= yes 
WITHOUT_HTML= yes 
WITHOUT_IPFILTER= yes 

WITHOUT_GSSAPI= yes 
WITHOUT_KERBEROS= yes 
WITHOUT_RCMDS= yes 

WITHOUT_IPX= yes 
WITHOUT_I4B= yes 
WITHOUT_ATM= yes 
WITHOUT_RCMDS= yes 
WITHOUT_SENDMAIL= yes
```

GDM:
Starting gdm by putting it in /etc/rc.conf

The system doesn't pause while going through the whole booting process. Haven't seen any errors yet as well. Just wondering if there's a way to make it boot faster.

Edit: Forgot to add the output of `$ kldstat`.

```
1   21 0xc0400000 591534   kernel
 2    1 0xc0992000 1a148    snd_hda.ko
 3    3 0xc09ad000 4a3b8    sound.ko
 4    1 0xc09f8000 4ec4     snd_ad1816.ko
 5    1 0xc09fd000 5354     sem.ko
 6    1 0xc0a03000 2d0e0    vboxdrv.ko
 7    1 0xc0a31000 75b904   nvidia.ko
 8    3 0xc118d000 29b54    linux.ko
 9    1 0xc11b7000 6a44c    acpi.ko
10    1 0xc5e2e000 7000     linprocfs.ko
11    1 0xc61b6000 e000     fuse.ko
```


----------



## SirDice (Jul 11, 2009)

dennylin93 said:
			
		

> Just wondering if there's a way to make it boot faster.


Nope. Not really. Unless you disable a bunch of stuff you're starting now. But you probably need those :e


----------



## richardpl (Jul 11, 2009)

Few minutes? Does it happens with GENERIC too?
remove CFLAGS.


----------



## dennylin93 (Jul 12, 2009)

Roughly 2 minutes since the computer is started till GNOME is ready. I guess it doesn't make much difference though.


----------



## phoenix (Jul 13, 2009)

Disable gdm, and then time how long it takes to boot to a console login prompt.  I'm guessing the longest part of the boot will be loading X, loading GNOME, loading the desktop, etc.  If that's the case, there's really nothing you can do.

On my home desktop (P4 3.0 GHz w/2 GB RAM), it takes about the same amount of time to boot to the text console, as it does to load X and KDE afterwards.


----------



## Bunyan (Aug 31, 2009)

How could I disable *gdm* at startup? I don't find any documentation on my system.
*gdm* really annoys me.


----------



## dennylin93 (Aug 31, 2009)

Don't add gdm_enable="YES" to /etc/rc.conf, and it won't start.

See The X Window System for more information.


----------



## Bunyan (Aug 31, 2009)

/etc/rc.conf was easy. If I found any hints about gdm in /etc/rc.conf I wouldn't 
post about such a trifle. I have built *xfce4* with *gdm* support.
I run 
	
	



```
/usr/local/sbin/gdm-stop
```
 to stop this thing.

Well,I added 
	
	



```
gdm_enable="NO"
```
 and after reboot it worked, without any error message. Hm, funny.


----------



## SirDice (Aug 31, 2009)

You may have gnome_enable="YES" on your /etc/rc.conf. Gnome_enable implies hald_enable, dbus_enable, avahi_enable and gdm_enable.


----------



## Bunyan (Aug 31, 2009)

Yes, I have gnome_enable="YES" in /etc/rc.conf. Is it useful as long as I don't use GNOME?


----------



## Beastie (Aug 31, 2009)

This loads everything GNOME needs to run, including D-BUS and HAL (if I'm not mistaken), so remove or comment this line out and add lines for D-BUS and HAL instead:

```
dbus_enable="YES"
hald_enable="YES"
```


----------



## Bunyan (Aug 31, 2009)

No, you're not mistaken. I use GNOME apps and libs. Is that option (gnome_enable=YES) required?


----------



## dennylin93 (Aug 31, 2009)

No, it isn't required. It is just equivalent to:

```
dbus_enable="YES"
hald_enable="YES"
avahi_daemon_enable="YES"
avahi_dnsconfd_enable="YES"
gdm_enable="YES"
```


----------



## phoenix (Aug 31, 2009)

gnome_enable is just a convenience variable for those using the full-blown GNOME desktop.  It saves those people a bit of typing.  

For those not using GNOME, you need to enter each of the separate variables for HAL, d-bus, avahi, etc.


----------



## Antti (Sep 1, 2009)

I guess that disabling services is not a good solution.
We need parallelization of kernel device detection and boot procedures.
And maybe some services can start in parallel.


----------



## avilla@ (Sep 1, 2009)

Antti said:
			
		

> And maybe some services can start in parallel.



good idea. i wanted to try this, and here's a patch (attached) for /etc/rc (made with FreeBSD 8-STABLE): i was able to drop 20 seconds starting eight services (kdm4 and apache22 among them) in background. it shouldn't fail, unless some local services require other local services (i didn't take care of it)

i think i'll file a pr: implementing this in rcorder shouldn't be difficult, and would make possible to start even more processes in background


----------



## avilla@ (Sep 1, 2009)

xzhayon said:
			
		

> i think i'll file a pr: implementing this in rcorder shouldn't be difficult, and would make possible to start even more processes in background



http://www.freebsd.org/cgi/query-pr.cgi?pr=conf/138460


----------

