Score:4

Really high kernel boot time

bt flag

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.

in flag
Try `sudo update-initramfs -u -k all`
heynnema avatar
ru flag
@kenn How will this help when the problems are with fstab and NCQ disk errors?
in flag
@heynnema Editing some system files may give rise to conflicts. Rebuilding initial ramdisk will solve such issues.
heynnema avatar
ru flag
@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?
in flag
@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.
Score:3
ru flag

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
Harley avatar
bt flag
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](https://pastebin.ubuntu.com/p/Pf3G3TnzQ3/) and switching to nvidia. Kernel time is about 4s now.
Harley avatar
bt flag
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](https://pastebin.ubuntu.com/p/2f7V2HJJgm/).
Harley avatar
bt flag
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](https://pastebin.ubuntu.com/p/XCGr9gHsrV/). Thanks again, for your assistance.
heynnema avatar
ru flag
@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 avatar
ru flag
@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.
Harley avatar
bt flag
# 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`.
heynnema avatar
ru flag
@Harley Turn off "Accelerate 3D Graphics", put Nvidia in Performance Mode, reboot and retest. Let me know how the bad blocking goes.
Harley avatar
bt flag
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](https://pastebin.ubuntu.com/p/P2s838KddJ/) the `blkid` output.
heynnema avatar
ru flag
@Harley Do both `chkdsk /f` and `chkdsk /r` on /dev/sdb.
Score:1
in flag

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.

Harley avatar
bt flag
That didn't help. In this case, it was not responsible for high kernel time. here's the new [systemd-analyze](https://pastebin.ubuntu.com/p/MK3gbtHHVR/) and [blame](https://pastebin.ubuntu.com/p/kwsWmDQNgb/) output after rebooting. Kernel time (about 35s) was barely deviated by this change.
WinEunuuchs2Unix avatar
in flag
@Harley After booting check `dmesg` for long times between commands. I've revised the answer with possible solution if that occurs.
heynnema avatar
ru flag
@WinEunuuchs2Unix The problem is with the mount for Store in /etc/fstab, and NCQ errors.
WinEunuuchs2Unix avatar
in flag
@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.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.