boot – How to make Ubuntu 18.04 and Visual Studios run faster?

I am new to Ubuntu Linux and just installed version 18.04 on my computer alongside Windows in dual-boot mode. However, after three weeks, Linux started to be very slow, and it will even crash a few times a day when it is not able to run my code efficiently enough. It will stop building a package completely when I run catkin build such that I am forced to switch off my laptop.

I have tried the following:

  • Looking at CPU specs with lspcu, which are good

  • Looking at the omputer make and model, gotten with the system information part of sudo dmidecode | less

  • Some of the solutions found on the following website: https://www.maketecheasier.com/linux-running-too-slow-heres-how-to-find-the-cause/. Such as: checking my CPU size (seems okay), examine CPU load with top (no process seems to be abusing my CPU usage) and check if my hard drive is overworking with iotop (it is not).

  • Examining the system with systemd-analyze blame:

            19.606s apt-daily.service
            6.913s NetworkManager-wait-online.service
            4.019s plymouth-quit-wait.service
            3.163s apt-daily-upgrade.service
            2.258s bolt.service
            1.391s snap-gnomex2d3x2d34x2d1804-66.mount
            1.354s snap-onenotex2ddesktop-13.mount
            1.352s snap-gnomex2dcalculator-826.mount
            1.337s dev-sda7.device
            1.332s snap-gnomex2dcharacters-570.mount
            1.241s snap-dub-53.mount
            1.206s snap-gtkx2dcommonx2dthemes-1514.mount
            1.172s snap-snapd-11107.mount
            1.100s snap-gnomex2dcalculator-884.mount
            1.031s snap-gnomex2dsystemx2dmonitor-148.mount
            1.013s snap-gnomex2dlogs-103.mount
             993ms snapd.service
             971ms snap-core-10958.mount
             912ms snap-code-59.mount
             911ms dev-loop4.device
             878ms dev-loop5.device
             857ms fwupd.service
             835ms dev-loop2.device
    

It seems like the upper lines are taken up a lot of time, so maybe this is a cause of the problem?

  • It should be noted that my Ubuntu running slow is mainly caused when I am using Visual Studio Code for too long – when my Ubuntu has just started, it runs fine, but after a while it gets slower and slower. I checked again with the top command the CPU usage when running a code in Visual Studio Code and it seems like maybe this causes a problem since cc1plus command runs at 99-100% CPU:

Result of top command: cc1plus running at 99-100% CPU

  • I have looked at /var/log/syslog errors as well with cat var/log/syslog | grep 'error' and the following error occurred multiple times:
Apr 16 13:48:06 jessie-HP-ZBook-Studio-G3 gnome-shell(1321): Error setting property 'Powered' on interface org.bluez.Adapter1: GDBus.Error:org.bluez.Error.Blocked: Blocked through rfkill (g-io-error-quark, 36)

Other errors that occur (not as often, though) are:

Apr 16 13:48:07 jessie-HP-ZBook-Studio-G3 org.gnome.Shell.desktop(1957): (4212:4212:0416/134807.054559:ERROR:gpu_service_impl.cc(1177)) Exiting GPU process because some drivers can't recover from errors. GPU process will restart shortly.
Apr 16 15:11:04 jessie-HP-ZBook-Studio-G3 kernel: ( 6106.242652) traps: ocs2_controller(14048) general protection fault ip:7f96415d58da sp:7ffd54f40af8 error:0 in libocs2_centroidal_planner.so(7f96414fa000+258000)
Apr 16 15:18:21 jessie-HP-ZBook-Studio-G3 org.gnome.Shell.desktop(1957): Fontconfig error: Cannot load default config file: No such file: (null)
Apr 16 16:36:57 jessie-HP-ZBook-Studio-G3 kernel: (    0.173308) ACPI Error: Aborting method _SB._OSC due to previous error (AE_AML_BUFFER_LIMIT) (20190816/psparse-531)
Apr 16 16:36:57 jessie-HP-ZBook-Studio-G3 kernel: (    6.312196) EXT4-fs (sda7): re-mounted. Opts: errors=remount-ro
Apr 16 16:36:57 jessie-HP-ZBook-Studio-G3 kernel: (    6.736341) hp_accel: probe of HPQ6007:00 failed with error -22
Apr 16 16:36:59 jessie-HP-ZBook-Studio-G3 snapd(1048): stateengine.go:150: state ensure error: Get https://api.snapcraft.io/api/v1/snaps/sections: dial tcp: lookup api.snapcraft.io: no such host
  • Finally, I went to the folder /var/crash and look for files there (ls -a), however, no files are found, the only thing my terminal displays are dots: . ..

Anyone who has any idea where to look for the cause of these crashes when running code, and if the main cause is my Ubuntu / dual boot or Visual Studio Code? I am sorry for stating such an unclear general question. If anything else is needed I’ll provide it.