Reduce boot time openSUSE

Hello everyone,
My laptop is Acer Aspire TimelineX 4820TG, CPU Intel Core i5 240M 2.4Ghz, RAM 4GB with Windows 7 Home Premium SP1 x64 (sda3) dual boot with openSUSE 13.1 x64 KDE (sd4). Everything work fine, but I feel that openSUSE boot too slow.
I follow theses guide: https://lizards.opensuse.org/2012/07/26/optimizing-a-boot-time-aka-2-second-boot/ and https://lizards.opensuse.org/2012/07/31/optimizing-a-boot-time-aka-2-second-boot-part-2/
and have the result (previos boot time is nearly a minute):

Startup finished in 9.975s (kernel) + 29.619s (userspace) = 39.595s

I didn’t follow all step of below guides, I just disable some unnecessary for me (network.service, SUSEfirewall…) and this is my active service:

      11.883s dkms_autoinstaller.service
          3.532s systemd-readahead-replay.service
          3.322s systemd-readahead-collect.service
          2.054s systemd-remount-fs.service
          1.654s dev-mqueue.mount
          1.580s dev-hugepages.mount
          1.498s sys-kernel-debug.mount
          1.423s systemd-udev-root-symlink.service
          1.342s cycle.service
          1.235s kmod-static-nodes.service
          1.172s rpcbind.service
          1.107s xdm.service
          1.033s vboxdrv.service
          1.008s ModemManager.service
          1.005s systemd-logind.service
           840ms wpa_supplicant.service
           838ms avahi-daemon.service
           828ms tlp.service
           788ms NetworkManager.service
           762ms rsyslog.service
           758ms systemd-random-seed.service
           746ms ntp.service
           683ms accounts-daemon.service
           640ms var-lock.mount
           423ms nfs.service
           385ms nfsserver.service
           379ms systemd-vconsole-setup.service
           294ms systemd-modules-load.service
           272ms systemd-tmpfiles-setup.service
           247ms apparmor.service
           194ms user@483.service
           139ms sshd.service
           139ms rc-local.service
           130ms systemd-udev-trigger.service
           102ms alsa-restore.service
            89ms systemd-sysctl.service
            45ms rtkit-daemon.service                                                         
            44ms systemd-tmpfiles-setup-dev.service                                           
            36ms udisks2.service                                                              
            25ms user@1000.service                                                            
            23ms user@0.service                                                               
            14ms polkit.service                                                               
             8ms upower.service                                                               
             7ms systemd-journal-flush.service                                                
             7ms systemd-update-utmp.service                                                  
             6ms iscsi.service                                                                
             5ms systemd-backlight@acpi_video0.service
             4ms systemd-user-sessions.service
             2ms sys-fs-fuse-connections.mount
             2ms var-run.mount
             2ms systemd-update-utmp-runlevel.service
             2ms systemd-udevd.service
             1ms systemd-readahead-done.service

I also remove some package (plymouth, splashy). Here is output of
ls -lh /boot/vmlinuz-* /boot/initrd-*

-rw------- 1 root root 6.2M Jul  9 09:36 /boot/initrd-3.11.10-11-desktop
-rw------- 1 root root 6.2M Jul  9 09:36 /boot/initrd-3.11.10-17-desktop
-rw-r--r-- 1 root root 5.0M May 12 23:47 /boot/vmlinuz-3.11.10-11-desktop
-rw-r--r-- 1 root root 5.0M Jun 18 03:15 /boot/vmlinuz-3.11.10-17-desktop

rpm -qf /lib/mkinitrd/scripts/setup-* | sort -u

cifs-utils-6.2-1.1.x86_64
cryptsetup-mkinitrd-0_201307311719-2.1.2.x86_64
device-mapper-1.02.78-0.14.1.2.x86_64
dmraid-1.0.0.rc16-25.1.2.x86_64
kpartx-0.4.9-11.4.1.x86_64
lvm2-2.02.98-0.28.18.1.x86_64
mdadm-3.3-4.8.1.x86_64
mkinitrd-2.8.1-2.1.x86_64
multipath-tools-0.4.9-11.4.1.x86_64
nfs-client-1.2.8-4.13.1.x86_64
open-iscsi-2.0.873-2.8.1.x86_64
ucode-intel-20130906-6.2.x86_64

My bootchart http://www.mediafire.com/download/kjd6pu536354vh7/ana.svg

Additional information: I installed powertop and TLP. I added all suggestions of powertop to /etc/boot.local and also turn off ATI card by vga_switcheroo. Moreover, in remained services, if I disable any service (such as dkms_autoinstaller) then next boot the time period of other services increase, even make the boot time longer. I don’t know why.

Anyone help me!
Thanks a lot!

P/S: sorry for my bad English.

Hi
What rotational speed is the hard drive in your system, or is it an ssd? What SATA interface is it using/capable of?


journalctl -xb --no-pager|grep SATA

Here is my output:

Jul 10 00:56:00 linux-n1t6 kernel: ahci 0000:00:1f.2: AHCI 0001.0300 32 slots 4 ports 3 Gbps 0x3 impl SATA mode
Jul 10 00:56:00 linux-n1t6 kernel: ata1: SATA max UDMA/133 abar m2048@0xdc505000 port 0xdc505100 irq 41
Jul 10 00:56:00 linux-n1t6 kernel: ata2: SATA max UDMA/133 abar m2048@0xdc505000 port 0xdc505180 irq 41
Jul 10 00:56:00 linux-n1t6 kernel: ata1: SATA link up 3.0 Gbps (SStatus 123 SControl 300)
Jul 10 00:56:00 linux-n1t6 kernel: ata2: SATA link up 1.5 Gbps (SStatus 113 SControl 300)

My HDD rotation speed is 5400 rpm.

Also, my partition table:

Disk /dev/sda: 500.1 GB, 500107862016 bytes, 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x5ff60c4b

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048    29362175    14680064   27  Hidden NTFS WinRE
/dev/sda2   *    29364224   148094975    59365376    7  HPFS/NTFS/exFAT
/dev/sda3       148094976   203077631    27491328   83  Linux
/dev/sda4       203077665   976771071   386846703+   f  W95 Ext'd (LBA)
/dev/sda5       203077728   966449151   381685712    7  HPFS/NTFS/exFAT
/dev/sda6       966451200   976771071     5159936    b  W95 FAT3

Sorry I give the wrong information, openSUSE is on sda3 while Windows on sda2.
As you see, I didn’t create or use any swap. I don’t know whether swappiness is affected boot time.

My new outputs (after disabling auto_dkmsinstaller, others services increase their load time, even the kernel!):

systemd-analyze

Startup finished in 10.198s (kernel) + 21.953s (userspace) = 32.152s
        

systemd-analyze blame

  6.324s systemd-remount-fs.service
          3.306s NetworkManager.service
          2.861s systemd-readahead-replay.service
          2.678s systemd-readahead-collect.service
          2.483s xdm.service                                                                  
          1.986s rpcbind.service                                                              
          1.807s vboxdrv.service                                                              
          1.314s dev-mqueue.mount                                                             
          1.296s kmod-static-nodes.service                                                    
          1.272s nfsserver.service                                                            
          1.251s dev-hugepages.mount
          1.202s tlp.service
          1.187s sys-kernel-debug.mount
          1.123s systemd-udev-root-symlink.service
          1.061s cycle.service
           813ms rc-local.service
           756ms ModemManager.service
           739ms systemd-random-seed.service
           709ms rsyslog.service
           678ms var-lock.mount
           644ms systemd-vconsole-setup.service
           469ms systemd-tmpfiles-setup.service
           323ms ntp.service
           313ms nfs.service
           296ms systemd-modules-load.service
           286ms alsa-restore.service
           243ms apparmor.service
           222ms systemd-backlight@acpi_video1.service
           158ms systemd-backlight@acpi_video0.service
           147ms user@483.service
           129ms systemd-udev-trigger.service
            88ms systemd-sysctl.service
            81ms avahi-daemon.service
            80ms sshd.service
            77ms wpa_supplicant.service
            70ms systemd-logind.service
            54ms user@0.service
            46ms rtkit-daemon.service
            43ms systemd-tmpfiles-setup-dev.service
            40ms udisks2.service
            32ms user@1000.service
            14ms polkit.service
             8ms accounts-daemon.service
             7ms upower.service
             6ms systemd-update-utmp.service
             6ms iscsi.service
             5ms NetworkManager-wait-online.service
             4ms systemd-journal-flush.service
             3ms systemd-user-sessions.service
             3ms systemd-readahead-done.service
             2ms var-run.mount
             2ms sys-fs-fuse-connections.mount
             2ms systemd-update-utmp-runlevel.service
             2ms systemd-udevd.service

Bootchart http://www.mediafire.com/download/qzwhkaw3jz8q448/analysis.svg

Hi
Probably with a 5400rpm disk @ 3Gbps maybe is about as good as it gets. On dual boot with windows I always put windows at the end of the disk via a manual install from a windows dvd…

With my HP 4430s (dual core 1.9Ghz cpu) with a 320GB 7200rpm @ 6Gbps and booting into GNOME, systemd-analyze shows around 20-22 seconds. With an SSD it runs around 10-15 seconds…

I don’t know exactly but my friend can reduce to around 20-25 sec (same laptop model). Sadly, he switched to Linux Mint for months ago.
That windows partition is from manufacturer, not mine.
Thanks!

Hi!

I would say that a boot time of about 30-40 seconds is quite OK with a 5400 RPM hard disk.

My desktop PC with a core-i5 2500 (3.3 GHz) and a 7200 RPM hard disk takes about the same time.

Windows may be faster - at the cost of some tricks like a hidden sleep state, with the data backed up on the hard disk.
But that in turn could result in loss of data, since other versions of windows, or Linux, can not access the data stored in such special files needed for that task.

If you would like to really speed up booting, do purchase a SSD, and install openSUSE (or at least the root or ‘/’ partition of it) on that device.

Good luck
Mike

On 07/09/2014 03:46 PM, ratzi wrote:
>
> nvkhoi;2653172 Wrote:
>> I don’t know exactly but my friend can reduce to around 20-25 sec (same
>> laptop model). Sadly, he switched to Linux Mint for months ago.
>> That windows partition is from manufacturer, not mine.
>> Thanks!
>
> Hi!
>
> I would say that a boot time of about 30-40 seconds is quite OK with a
> 5400 RPM hard disk.
>
> My desktop PC with a core-i5 2500 (3.3 GHz) and a 7200 RPM hard disk
> takes about the same time.
>
> Windows may be faster - at the cost of some tricks like a hidden sleep
> state, with the data backed up on the hard disk.
> But that in turn could result in loss of data, since other versions of
> windows, or Linux, can not access the data stored in such special files
> needed for that task.
>
> If you would like to really speed up booting, do purchase a SSD, and
> install openSUSE (or at least the root or ‘/’ partition of it) on that
> device.

I am wondering why reducing boot time is such a priority. With Windows, where
you boot several times a day, I can see why it is important. Most of the time, I
reboot Linux only every two or 3 days on my laptop. My other machines are
rebooted only when openSUSE releases a new kernel. When it comes time to reboot,
I go get a cup of coffee, and I have little concern for how long it takes.

My area often has power cut.
When battery run out, I have to turn off my laptop (I don’t have any swap to hibernate; moreover, hibernation seem not work stably on my laptop since discrete card).
Of course, I want to back to work as fast as possible.

It is weird, when I enable some service (readahead-replay and readahead-collect), the boot time reduce significantly??!

nvkhoi@linux-n1t6:~> systemd-analyze
Startup finished in 8.077s (kernel) + 19.108s (userspace) = 27.186s
nvkhoi@linux-n1t6:~> systemd-analyze blame
          5.837s systemd-udevd.service
          4.645s systemd-random-seed.service
          2.793s systemd-readahead-replay.service
          2.626s systemd-readahead-collect.service
          1.806s xdm.service
          1.696s NetworkManager.service
          1.592s rtkit-daemon.service
          1.312s dev-mqueue.mount
          1.248s dev-hugepages.mount
          1.185s sys-kernel-debug.mount
          1.122s systemd-udev-root-symlink.service
          1.080s kmod-static-nodes.service
          1.059s cycle.service
          1.040s rpcbind.service
           953ms vboxdrv.service
           810ms rc-local.service
           758ms alsa-restore.service
           690ms avahi-daemon.service
           682ms ModemManager.service
           625ms rsyslog.service
           542ms tlp.service
           539ms apparmor.service
           456ms systemd-tmpfiles-setup.service
           438ms systemd-remount-fs.service
           417ms systemd-vconsole-setup.service
           356ms nfs.service
           342ms nfsserver.service
           310ms ntp.service
           302ms user@483.service
           232ms systemd-modules-load.service
           232ms systemd-backlight@acpi_video0.service
           224ms wpa_supplicant.service
           214ms systemd-logind.service
           172ms systemd-udev-trigger.service
           132ms systemd-sysctl.service
            87ms systemd-tmpfiles-setup-dev.service
            58ms user@0.service
            43ms polkit.service                                                               
            40ms udisks2.service                                                              
            35ms user@1000.service                                                            
            12ms accounts-daemon.service                                                      
            11ms sshd.service                                                                 
             6ms upower.service                                                               
             6ms systemd-update-utmp.service
             5ms systemd-journal-flush.service
             4ms systemd-user-sessions.service
             4ms NetworkManager-wait-online.service
             3ms sys-fs-fuse-connections.mount
             3ms var-lock.mount
             2ms var-run.mount
             2ms systemd-update-utmp-runlevel.service
             2ms systemd-backlight@acpi_video1.service
             1ms systemd-readahead-done.service

Both of those services should be enabled by default, their impact will be much greater once you’ve booted a few times.

To understand what they do;
http://www.freedesktop.org/software/systemd/man/systemd-readahead-replay.service.html

Thanks! It’s really helpful.
Can you recommend the value for these options?
systemd-readahead understands the following options:
–files-max=
Maximum number of files to read ahead. Only valid for thes collect command.
–file-size-max=
Maximum size of files in bytes to read ahead. Only valid for the collect and replay commands.
–timeout=
Maximum time in microseconds to spend collecting data. Only valid for the collect command.

Everything now work fine, the workspace just turn around 15 sec. However, the kernel increase to 10 sec.
But it is better.
Thank all.

Mod please close topic.

Hi nvkhoi!

You seem to want to extend the time that you’re able to work, right?

One way would be to get an additional external battery pack.

Besides reducing boot time, another possibility could be to reduce power consumption.

There is a tool, named ‘powertop’, that can be installed from the official openSUSE repos,
and that may help you to save power and extend the time of the usage of your laptop.

In the repos of openSUSE 13.1 the provided version of that tool is 2.4-2.1.2.
However, there seems to be a newer version of it (2.6.x).

Use that tool with care, in order to not render your system unusable.

Good luck
Mike

Thanks!
I installed tlp and powertop already. I see the increase on battery life. They’re very useful, but I want to disable my Optical Drive (at least I didn’t use it for a year) but I can’t find the answer. I already asked in hardware box (in this forum) but no one answer Disable optical drive and wireless card - Hardware - openSUSE Forums

Well You really don’t need to disable the DVD since it only pulls significant power when used. So if you relly don’t use it and want to save the small trickle it might use remove it. Put a piece of tape over the hole then you will get maybe one more minute on a charge.