4

My system boot time suddenly became very high. I've been dual booting Kubuntu and Win10 for quite some times. The root partition is on ssd. I recently increased my swap size using live usb and then this started to happen. Before this, my boot time was about 7-10 seconds. Here's the systemd-analyze output now. Notice the kernel time, about 36s.

Tried switching to previous kernels, still slow. Here's the inxi -Fz info. Unfortunately, I don't know exactly what to look for in the dmesg info. Only other query I found related to my issue is this one.

I don't think my issue can be resolved by decreasing different service's startup time. But here's the blame and critical-chain output anyway; blame and critical-chain.

I'm just including blkid, grub and fstab info, it that's required.

Thanks. Kindly let me know, if any other info is required.

Harley
  • 68
  • Try sudo update-initramfs -u -k all – kenn Jan 16 '22 at 15:30
  • @kenn How will this help when the problems are with fstab and NCQ disk errors? – heynnema Jan 16 '22 at 15:50
  • @heynnema Editing some system files may give rise to conflicts. Rebuilding initial ramdisk will solve such issues. – kenn Jan 16 '22 at 15:56
  • @kenn ramdisk has nothing to do with incorrect mounts in /etc/fstab, or with NCQ disk errors. Fixing /etc/fstab won't "give rise to conflicts". Did you read my answer? – heynnema Jan 16 '22 at 16:00
  • @heynnema there is nothing wrong running sudo update-initramfs -u -k all. It will check if modified system files are consistent, else it will print errors. Initial ramdisk is important for fast boot. I also don't know all the modification user did. So my suggestion is a general approach rather than your specific answer. – kenn Jan 16 '22 at 16:16

2 Answers2

3

BIOS

ASUS X556UB v: 1.0

You have BIOS version X556UB.411. Version 412 is available here.

Note: Confirm that I have the correct web page for your model #.

Note: Have good backups before updating the BIOS.

Nvidia GM108M [GeForce 940M]

It looks like you're using the nouveau video driver. The Nvidia driver would provide better performance. The Nvidia driver can be downloaded here. (Or use Software & Updates Additional Drivers tab).

FSTAB (the real problem #1)

Note: 1.309s home-shawon-Store.mount

Change this line:

/dev/sdb1    /home/shawon/Store    ntfs    defaults,noatime,uid=1000,x-gvfs-hide    0    2

To this:

/dev/sdb1    /home/shawon/Store    ntfs    defaults,noatime,uid=1000,x-gvfs-hide    0    0

Note: For more reliable operation, change the /dev/sdxx to UUID=xxxxxxxxxxxxxxx

NCQ errors (the real problem #2)

Note: ata2.00: failed command: READ FPDMA QUEUED

Native Command Queuing (NCQ) is an extension of the Serial ATA protocol allowing hard disk drives to internally optimize the order in which received read and write commands are executed.

Edit sudo -H gedit /etc/default/grub and change the following line to include this extra parameter. Then do sudo update-grub to write the changes to disk. Reboot. Monitor hangs/etc., and watch grep -i FPDMA /var/log/syslog* or dmesg for continued error messages.

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash libata.force=noncq"

SWAP

Suggest the use of a /swapfile, instead of a swap partition.

Note: Incorrect use of the rm and dd commands can cause data loss. Suggest copy/paste.

In the terminal...

sudo swapoff -a           # turn off swap
sudo rm -i /swapfile      # remove old /swapfile

sudo dd if=/dev/zero of=/swapfile bs=1M count=4096

sudo chmod 600 /swapfile # set proper file protections sudo mkswap /swapfile # init /swapfile sudo swapon /swapfile # turn on swap free -h # confirm 16G RAM and 4G swap

Edit /etc/fstab, using sudo -H gedit /etc/fstab or sudo pico /etc/fstab.

Confirm this /swapfile line in /etc/fstab... and confirm no other “swap” lines... use SPACES in this line... confirm NO TABS...

/swapfile  none  swap  sw  0  0

Note: Comment out this line in /etc/fstab...

UUID=76408dec-2d63-402b-9624-fc562b8e9b5b    none    swap    sw    0    0

reboot                    # reboot and verify operation
heynnema
  • 70,711
  • 1
    Hi, @heynnema! First of all, thank you for taking your time to provide such detailed response. Luckily I already resolved my issue through fstab modification and switching to nvidia. Kernel time is about 4s now. – Harley Jan 17 '22 at 18:47
  • Now, upon your suggestion, I updated the bios, switched to using swapfile and modified the /etc/default/grub. while checking with sudo dmesg -HT | grep -i --color=never ata2 | grep -i --color=never failed found some error. – Harley Jan 17 '22 at 18:47
  • Unfortunately, I had to switch back to nouveau again. For the life of me I couldn't run windows 7 guest in vmware workstation pro (16.2.1) while the nvidia driver was active. But that's another can of worms and (probably) outside of this question's scope. I tried with nvidia-driver-495 and nvidia-driver-470, but no luck. Finally I settled with nvidia-driver-470, but set the PRIME Profile to Intel (Power Saving Mode). After that, I couldn't find any nouveau related message/ warning in dmesg. Thanks again, for your assistance. – Harley Jan 17 '22 at 18:52
  • @Harley Good on the fstab fix. The ata2 errors occurred after the change of /etc/default/grub and a reboot (required)? Nvidia 495 is beta software. 470 is the correct one to use. Nouveau wasn't creating any errors in dmesg. It was just something I noticed in your other logs that indicated you weren't using Nvidia. Check for any VMWare settings having to do with accelerated GPU. Are you using X11/xorg or Wayland? – heynnema Jan 17 '22 at 20:07
  • @Harley I reviewed your latest dmesg, and although you're not getting any more NCQ errors, you are getting read/media errors. See Update #1 in my answer. After bad blocking the disk, you may be able to remove the NCQ patch. Report back. – heynnema Jan 17 '22 at 20:08
  • I rebooted anyway; after every trial, either nvidia-driver change or after running sudo update-grub. # Yes, 'Accelerate 3d Graphics' is enabled in vmware guest (win7_x64) display settings. # My session type is x11. – Harley Jan 17 '22 at 21:45
  • @Harley Turn off "Accelerate 3D Graphics", put Nvidia in Performance Mode, reboot and retest. Let me know how the bad blocking goes. – heynnema Jan 17 '22 at 22:01
  • Sadly I can't fix this with e2fsck as /dev/sdb is a ntfs formatted disk. Although I can employ the chkdsk from Windows 10. On the other hand both linux partitions are on ssd (sda), in that case, you advised NOT to use e2fsck on ssd. Here's the blkid output. – Harley Jan 17 '22 at 22:06
  • @Harley Do both chkdsk /f and chkdsk /r on /dev/sdb. – heynnema Jan 17 '22 at 22:20
1

Your log file shows the most time-consuming process with the line:

6.458s NetworkManager-wait-online.service

Therefore it would appear your biggest performance gain would be to have systemd not wait for the network to come up. See:

The answer explains the process in detail but, to summarize, you can use:

sudo systemctl disable NetworkManager-wait-online.service

Long kernel boot time

From this answer:

Try enabling Intel SpeedStep in BIOS.

  • That didn't help. In this case, it was not responsible for high kernel time. here's the new systemd-analyze and blame output after rebooting. Kernel time (about 35s) was barely deviated by this change. – Harley Jan 02 '22 at 03:33
  • @Harley After booting check dmesg for long times between commands. I've revised the answer with possible solution if that occurs. – WinEunuuchs2Unix Jan 02 '22 at 04:50
  • @WinEunuuchs2Unix The problem is with the mount for Store in /etc/fstab, and NCQ errors. – heynnema Jan 16 '22 at 15:27
  • @heynnema Thanks. I've upvoted your answer, but will leave mine here for the time-being as a general solution for others coming to this question. – WinEunuuchs2Unix Jan 16 '22 at 16:16