Help me decrease my boot time

Hello, everyone.
My system takes longer than a minute to boot. There are some things I tried to decrease (like clean up journalctl) but I don’t want to excessively fiddle and break something, so I’d like your advice on what to get rid of and how to do it correctly. What can I do to reduce boot time as much as possible without reinstalling?
Here is my boot.svg > https:// svgur . com/i/UWc.svg)
(Removed snap already)
I reduced journalctl size from 1GB to 48 MB, but journal flush still takes plenty of time for some reason.
I don’t understand why fsck needs to check / at every boot. Will something happen to my drive if I stop it from checking all the time?
It also takes longer for Plasma to fully load now. It shows a black screen for some time before the wallpaper appears.

Thanks for your help.

Hi @lupeux,

To more accurately see what causes the delay, please post the output of,

systemd-analyze blame

And for a more accurate log of what happens at boot time, please post the output of:

journalctl -b

This’ll be the boot messages for the current boot.

But in general I think long boot times are caused by faulty hard drives. At least that’s my experience. fsck does not add much boot time, except in the case of a faulty hard drive, I think. Mine doesn’t even add 5 seconds. It won’t do your drive harm if you disable it, but keeping it enable can’t do harm either.

P.S.: I’ll be off shortly and won’t be able to reply, but that information will then help someone else help you.

OK!
This is the latest boot.

17.353s systemd-fsck@dev-disk-by\x2duuid-e61000c1\x2dffa8\x2d4129\x2da2d9\x2d785dcb8a9c4f.service
 7.644s lvm2-monitor.service                                                                     
 5.108s dev-sdb5.device                                                                          
 4.265s polkit.service                                                                           
 2.516s avahi-daemon.service                                                                     
 2.512s bluetooth.service                                                                        
 2.505s NetworkManager.service                                                                   
 2.490s systemd-logind.service                                                                   
 2.163s ldconfig.service                                                                         
 2.091s laptop-mode.service                                                                      
 1.831s systemd-modules-load.service                                                             
 1.540s systemd-sysusers.service                                                                 
 1.509s ModemManager.service                                                                     
 1.229s systemd-journal-flush.service                                                            
 1.122s systemd-tmpfiles-setup.service                                                           
  977ms udisks2.service                                                                          
  910ms modprobe@drm.service                                                                     
  792ms user@1000.service                                                                        
  709ms systemd-udevd.service                                                                    
  678ms systemd-fsck@dev-disk-by\x2duuid-AD7B\x2dC0A1.service                                    
  606ms upower.service                                                                           
  519ms rtkit-daemon.service                                                                     
  480ms boot-efi.mount                                                                           
  455ms systemd-tmpfiles-setup-dev.service                                                       
  378ms systemd-random-seed.service                                                              
  341ms systemd-journal-catalog-update.service                                                   
  331ms modprobe@fuse.service                                                                    
  306ms systemd-timesyncd.service                                                                
  281ms dev-disk-by\x2duuid-5032bc5d\x2d954f\x2d4c6a\x2db7b0\x2d6bd03412902b.swap                
  273ms systemd-backlight@backlight:amdgpu_bl0.service                                           
  245ms systemd-backlight@backlight:acpi_video0.service                                          
  245ms systemd-backlight@backlight:acpi_video1.service                                          
  231ms systemd-tmpfiles-clean.service                                                           
  220ms wpa_supplicant.service                                                                   
  209ms systemd-binfmt.service                                                                   
  191ms home.mount                                                                               
  179ms systemd-journald.service                                                                 
  148ms systemd-udev-trigger.service                                                             
  127ms dev-hugepages.mount                                                                      
  126ms dev-mqueue.mount                                                                         
  124ms sys-kernel-debug.mount                                                                   
  123ms sys-kernel-tracing.mount                                                                 
  122ms kmod-static-nodes.service                                                                
  120ms modprobe@configfs.service                                                                
   99ms systemd-sysctl.service                                                                   
   71ms systemd-user-sessions.service                                                            
   61ms linux-module-cleanup.service                                                             
   57ms systemd-update-utmp.service                                                              
   50ms systemd-remount-fs.service                                                               
   38ms sys-kernel-config.mount                                                                  
   29ms systemd-rfkill.service                                                                   
   27ms alsa-restore.service                                                                     
   23ms systemd-update-done.service                                                              
   19ms user-runtime-dir@1000.service                                                            
    4ms tmp.mount                                                                                
    3ms sys-fs-fuse-connections.mount                                                            
    3ms proc-sys-fs-binfmt_misc.mount                                                            

The boot journal is really long and won’t fit here.
I posted it somewhere else.

Boot time got about 30s shorter since I uninstalled some things yesterday. My hard drive has been working well, I think.

/dev/sdb8 was in a dirty state and that flag got removed - it’s a fat filesystem, no idea whether that qualifies as having been fixed
/dev/sdb7 was force checked because it contained errors

that is both not supposed to happen. Something caused this.

I’d never ever disable the fsck feature …

and
baloo
the file indexer
has crashed
… look for how to clear it’s database and then re-start the indexing process
or disable it altogether if you don’t need the features it provides

ModemManager can probably be disabled - not sure whether that gains you a significant time improvement

Looking through your boot log I see this:

Feb 27 15:17:01 jupiter kernel: ata2: hard resetting link
Feb 27 15:17:01 jupiter kernel: ata2: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
Feb 27 15:17:01 jupiter kernel: ata2.00: configured for UDMA/133
Feb 27 15:17:01 jupiter kernel: ata2: EH complete
Feb 27 15:17:01 jupiter kernel: ata2.00: exception Emask 0x10 SAct 0x8087003f SErr 0x400000 action 0x6 frozen
Feb 27 15:17:01 jupiter kernel: ata2.00: irq_stat 0x08000008, interface fatal error
Feb 27 15:17:01 jupiter kernel: ata2: SError: { Handshk }
Feb 27 15:17:01 jupiter kernel: ata2.00: failed command: WRITE FPDMA QUEUED
Feb 27 15:17:01 jupiter kernel: ata2.00: cmd 61/08:00:00:65:56/00:00:23:00:00/40 tag 0 ncq dma 4096 out
res 40/00:94:98:6b:56/00:00:23:00:00/40 Emask 0x10 (ATA bus error)

If installed use smartctl --all /dev/sdb to get a readout on the health of the disk, I would be worried about these kinds of errors. use smartctl --help to get some more options, there is a test option,

1 Like

Here’s output for both drives. I also ran a short test but it gave no results. That FPDMA error was present for years, but it didn’t get in the way and I remember not finding anything good on the internet. It also got silenced at boot after an update, so I ended up ignoring it…

sudo smartctl --all /dev/sdb
smartctl 7.2 2020-12-30 r5155 [x86_64-linux-5.4.89-1-MANJARO] (local build)
Copyright (C) 2002-20, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Family:     OCZ/Toshiba Trion SSDs
Device Model:     TOSHIBA Q300
Serial Number:    Y5BB6205KNSX
LU WWN Device Id: 5 00080d c003395ab
Firmware Version: SAFM11.2
User Capacity:    240,057,409,536 bytes [240 GB]
Sector Size:      512 bytes logical/physical
Rotation Rate:    Solid State Device
Form Factor:      2.5 inches
TRIM Command:     Available, deterministic, zeroed
Device is:        In smartctl database [for details use: -P show]
ATA Version is:   ACS-2 (minor revision not indicated)
SATA Version is:  SATA 3.1, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is:    Sun Feb 28 13:12:44 2021 +04
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

General SMART Values:
Offline data collection status:  (0x00) Offline data collection activity
                                        was never started.
                                        Auto Offline Data Collection: Disabled.
Self-test execution status:      (   0) The previous self-test routine completed
                                        without error or no self-test has ever 
                                        been run.
Total time to complete Offline 
data collection:                (   30) seconds.
Offline data collection
capabilities:                    (0x79) SMART execute Offline immediate.
                                        No Auto Offline data collection support.
                                        Suspend Offline collection upon new
                                        command.
                                        Offline surface scan supported.
                                        Self-test supported.
                                        Conveyance Self-test supported.
                                        Selective Self-test supported.
SMART capabilities:            (0x0003) Saves SMART data before entering
                                        power-saving mode.
                                        Supports SMART auto save timer.
Error logging capability:        (0x01) Error logging supported.
                                        General Purpose Logging supported.
Short self-test routine 
recommended polling time:        (   1) minutes.
Extended self-test routine
recommended polling time:        (   2) minutes.
Conveyance self-test routine
recommended polling time:        (   3) minutes.

SMART Attributes Data Structure revision number: 16
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  9 Power_On_Hours          0x0012   100   100   000    Old_age   Always       -       13792
 12 Power_Cycle_Count       0x0012   100   100   000    Old_age   Always       -       8871
167 SSD_Protect_Mode        0x0022   100   100   000    Old_age   Always       -       0
168 SATA_PHY_Error_Count    0x0012   100   100   000    Old_age   Always       -       2
169 Bad_Block_Count         0x0003   100   100   010    Pre-fail  Always       -       0
173 Erase_Count             0x0012   197   197   000    Old_age   Always       -       0
192 Unexpect_Power_Loss_Ct  0x0012   100   100   000    Old_age   Always       -       523
194 Temperature_Celsius     0x0023   072   050   030    Pre-fail  Always       -       28 (Min/Max 8/50)

SMART Error Log Version: 1
No Errors Logged

SMART Self-test log structure revision number 1
Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
# 1  Short offline       Completed without error       00%     13413         -

SMART Selective self-test log data structure revision number 1
 SPAN  MIN_LBA  MAX_LBA  CURRENT_TEST_STATUS
    1        0        0  Not_testing
    2        0        0  Not_testing
    3        0        0  Not_testing
    4        0        0  Not_testing
    5        0        0  Not_testing
Selective self-test flags (0x0):
  After scanning selected spans, do NOT read-scan remainder of disk.
If Selective self-test is pending on power-up, resume after 0 minute delay.
#############################
sudo smartctl --all /dev/sda
smartctl 7.2 2020-12-30 r5155 [x86_64-linux-5.4.89-1-MANJARO] (local build)
Copyright (C) 2002-20, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Family:     Western Digital Blue Mobile
Device Model:     WDC WD10JPVX-60JC3T0
Serial Number:    WD-WXN1E265JVRN
LU WWN Device Id: 5 0014ee 606fe2d14
Firmware Version: 01.01A01
User Capacity:    1,000,204,886,016 bytes [1.00 TB]
Sector Sizes:     512 bytes logical, 4096 bytes physical
Rotation Rate:    5400 rpm
Form Factor:      2.5 inches
Device is:        In smartctl database [for details use: -P show]
ATA Version is:   ACS-2 (minor revision not indicated)
SATA Version is:  SATA 3.0, 6.0 Gb/s (current: 3.0 Gb/s)
Local Time is:    Sun Feb 28 13:15:33 2021 +04
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

General SMART Values:
Offline data collection status:  (0x00) Offline data collection activity
                                        was never started.
                                        Auto Offline Data Collection: Disabled.
Self-test execution status:      (   0) The previous self-test routine completed
                                        without error or no self-test has ever 
                                        been run.
Total time to complete Offline 
data collection:                (17640) seconds.
Offline data collection
capabilities:                    (0x51) SMART execute Offline immediate.
                                        No Auto Offline data collection support.
                                        Suspend Offline collection upon new
                                        command.
                                        No Offline surface scan supported.
                                        Self-test supported.
                                        No Conveyance Self-test supported.
                                        Selective Self-test supported.
SMART capabilities:            (0x0003) Saves SMART data before entering
                                        power-saving mode.
                                        Supports SMART auto save timer.
Error logging capability:        (0x01) Error logging supported.
                                        General Purpose Logging supported.
Short self-test routine 
recommended polling time:        (   2) minutes.
Extended self-test routine
recommended polling time:        ( 198) minutes.
SCT capabilities:              (0x703d) SCT Status supported.
                                        SCT Error Recovery Control supported.
                                        SCT Feature Control supported.
                                        SCT Data Table supported.

SMART Attributes Data Structure revision number: 16
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  1 Raw_Read_Error_Rate     0x002f   200   200   051    Pre-fail  Always       -       0
  3 Spin_Up_Time            0x0027   199   180   021    Pre-fail  Always       -       1041
  4 Start_Stop_Count        0x0032   078   078   000    Old_age   Always       -       22936
  5 Reallocated_Sector_Ct   0x0033   200   200   140    Pre-fail  Always       -       0
  7 Seek_Error_Rate         0x002f   200   200   051    Pre-fail  Always       -       0
  9 Power_On_Hours          0x0032   082   082   000    Old_age   Always       -       13646
 10 Spin_Retry_Count        0x0033   100   100   051    Pre-fail  Always       -       0
 11 Calibration_Retry_Count 0x0032   100   100   000    Old_age   Always       -       0
 12 Power_Cycle_Count       0x0032   091   091   000    Old_age   Always       -       9055
183 Runtime_Bad_Block       0x0032   001   001   000    Old_age   Always       -       2631
184 End-to-End_Error        0x0033   100   100   097    Pre-fail  Always       -       0
187 Reported_Uncorrect      0x0032   100   100   000    Old_age   Always       -       0
188 Command_Timeout         0x0032   030   001   000    Old_age   Always       -       65535
190 Airflow_Temperature_Cel 0x0022   071   059   040    Old_age   Always       -       29 (Min/Max 28/29)
191 G-Sense_Error_Rate      0x0032   001   001   000    Old_age   Always       -       166
192 Power-Off_Retract_Count 0x0032   200   200   000    Old_age   Always       -       744
193 Load_Cycle_Count        0x0032   106   106   000    Old_age   Always       -       283766
194 Temperature_Celsius     0x0022   118   106   000    Old_age   Always       -       29
196 Reallocated_Event_Count 0x0032   200   200   000    Old_age   Always       -       0
197 Current_Pending_Sector  0x0032   200   200   000    Old_age   Always       -       0
198 Offline_Uncorrectable   0x0030   100   253   000    Old_age   Offline      -       0
199 UDMA_CRC_Error_Count    0x0032   200   200   000    Old_age   Always       -       845
200 Multi_Zone_Error_Rate   0x0009   100   253   051    Pre-fail  Offline      -       0

SMART Error Log Version: 1
No Errors Logged

SMART Self-test log structure revision number 1
Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
# 1  Extended offline    Aborted by host               90%         4         -
# 2  Short offline       Aborted by host               90%         4         -

SMART Selective self-test log data structure revision number 1
 SPAN  MIN_LBA  MAX_LBA  CURRENT_TEST_STATUS
    1        0        0  Not_testing
    2        0        0  Not_testing
    3        0        0  Not_testing
    4        0        0  Not_testing
    5        0        0  Not_testing
Selective self-test flags (0x0):
  After scanning selected spans, do NOT read-scan remainder of disk.
If Selective self-test is pending on power-up, resume after 0 minute delay.
`

If it has been there for years and does not bother you then ignoring it is :+1:

I’ve found a review from (May 2020) of this specific disk that has a benchmark test with speeds and claims to be a unbiased site. These are the speeds you should be able to reproduce. If you run Gnome you can use disks to benchmark your disk (select partition, click advanced tools, select Benchmark partion) and get a idea where you are in terms of performances compared to the benchmark test. That way you know if there is a disk issue or a configuration/drive/defect issue.

The drive has been on for 13792 hours thats ~560 consecutive days and is has been turned on 8871 times so it gets used enough, it might start to show signs of wearing out but not reporting it as a issue yet?

I don’t actually use the SSD every day. Not as much as my hard drive. When I got this computer, Windows was already installed on the SSD, so I installed Linux on my hard drive (/dev/sdb). I use Linux every day, but I hardly use Windows. On my SSD I just have office programs, but I’ve been using the online versions lately. I always left Windows there only for a just in case scenario.

My boot time has gotten much better than before, I think I have had enough fiddling.
Thanks to everyone who tried to help.

1 Like

What are your loading times now? Post a new screenshot. Bootloader taking 43 seconds can’t be considered normal, have you checked your TIMEOUT value in grub? You could even disable lvm2-monitor.service if you don’t use encryption and probably ModemManager.service as well. Did you permanently reduce your journal size to a sane number or did you just cleaned it once?
You should have posted also your
mhwd-kernel -li ,
contents of /etc/mkinitcpio.conf,
lsblk -f
/etc/fstab to name a few.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.