Ubuntu getting slow [solved]

My main Ubuntu machine (Ubuntu 16.04, core2 duo + 4GB Ram) is taking almost 2 minutes from pushing the button to a functioning desktop.

I’m sure it used to be a lot quicker and I haven’t made any changes lately.

Does Ubuntu gradually slow down like Windows?

No it shouldn’t…

What’s the output from:

systemd-analyze time

and

systemd-analyze critical-chain

and

systemd-analyze blame

Hello Mark,

Here goes…

mike@mike-ubuntu:~$ systemd-analyze time
Startup finished in 4.754s (kernel) + 32.997s (userspace) = 37.751s
mike@mike-ubuntu:~$ systemd-analyze critical-chain
The time after the unit is active or started is printed after the “@” character.
The time the unit takes to start is printed after the “+” character.

graphical.target @32.973s
??multi-user.target @32.973s
??grub-common.service @22.394s +10.579s
??basic.target @17.173s
??sockets.target @17.173s
??snapd.socket @17.154s +12ms
??sysinit.target @17.057s
??apparmor.service @7.838s +9.178s
??local-fs.target @7.675s
??run-cgmanager-fs.mount @22.935s
??local-fs-pre.target @7.675s
??systemd-remount-fs.service @7.513s +119ms
??systemd-journald.socket @3.020s
??-.mount @2.691s
??system.slice @3.020s
??-.slice @2.691s
mike@mike-ubuntu:~$ systemd-analyze blame
15.151s apport.service
14.898s ondemand.service
14.830s networking.service
14.757s speech-dispatcher.service
13.119s dev-sdc5.device
10.579s grub-common.service
10.067s irqbalance.service
9.178s apparmor.service
6.925s ModemManager.service
6.836s lightdm.service
5.190s vboxdrv.service
5.189s iio-sensor-proxy.service
5.159s avahi-daemon.service
5.019s thermald.service
4.559s NetworkManager.service
3.422s accounts-daemon.service
2.655s gpu-manager.service
2.563s systemd-udevd.service
2.416s console-setup.service
2.018s colord.service
1.746s rsyslog.service
1.742s plymouth-start.service
1.593s keyboard-setup.service

I hope that means a lot more to you than it does to me!

By the way, the Code: [Select] function isn’t working. At least not for me. I get 'Unable to locate url javascript:void(0) ’

Well that’s suggesting your boot finished in 37.751 seconds, so how are you defining 2 minutes ?

By the clock on my desk.

I just tested it again. From clicking ‘restart’ in Ubuntu, it was 90 seconds until the desktop appeared, with lots of disk accessing still going on. I clicked immediately on the Firefox icon and it took another 40 seconds for FF to load and be useable.

what’s the output from:

df -h

and

free -m

mike@mike-ubuntu:~$ df -h
Filesystem Size Used Avail Use% Mounted on
udev 2.0G 0 2.0G 0% /dev
tmpfs 396M 6.4M 389M 2% /run
/dev/sdc5 130G 46G 78G 38% /
tmpfs 2.0G 668K 2.0G 1% /dev/shm
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup
cgmfs 100K 0 100K 0% /run/cgmanager/fs
tmpfs 396M 64K 395M 1% /run/user/1000
mike@mike-ubuntu:~$ free -m
total used free shared buff/cache available
Mem: 3950 1266 1307 38 1377 2355
Swap: 4092 0 4092
mike@mike-ubuntu:~$

This is getting silly now. I’ve just spent over five minutes listening to constant disk accessing and waiting for this PC to become responsive again. I couldn’t shut anything down, open a terminal, or anything else.

I was on the point of a hard reboot when things finally started responding. The terminal showed this;

mike@mike-ubuntu:~$ free -m
total used free shared buff/cache available
Mem: 3950 1374 1980 50 594 2265
Swap: 4092 331 3761
mike@mike-ubuntu:~$ free -m
total used free shared buff/cache available
Mem: 3950 1375 1979 50 594 2264
Swap: 4092 331 3761
mike@mike-ubuntu:~$ free -m
total used free shared buff/cache available
Mem: 3950 1303 2002 49 644 2337
Swap: 4092 329 3763
mike@mike-ubuntu:~$ free -m
total used free shared buff/cache available
Mem: 3950 1302 2003 50 644 2338
Swap: 4092 329 3763
mike@mike-ubuntu:~$ free -m
total used free shared buff/cache available
Mem: 3950 492 2817 18 640 3185
Swap: 4092 329 3763
mike@mike-ubuntu:~$ free -m
total used free shared buff/cache available
Mem: 3950 492 2817 18 640 3185
Swap: 4092 329 3763
mike@mike-ubuntu:~$ free -m
total used free shared buff/cache available
Mem: 3950 494 2815 18 640 3183
Swap: 4092 329 3763
mike@mike-ubuntu:~$ free -m
total used free shared buff/cache available
Mem: 3950 494 2815 18 640 3183
Swap: 4092 329 3763
mike@mike-ubuntu:~$ free -m
total used free shared buff/cache available
Mem: 3950 494 2815 18 640 3183
Swap: 4092 329 3763
mike@mike-ubuntu:~$

Swap used is still at 323 with only Firefox running. No streaming or downloading going on…

So does it only go slow when using Firefox ?

No, I don’t think so. I also use Chrome and/or Chromium.

Slowness seems to be the order of the day. Swap is being used, albeit minimally. Do you think this may be a physical memory problem?

Could be but I doubt it, if there’s disk thrashing I’d have thought it more likely an HDD problem.

If you install iotop

sudo apt-get install iotop

then run it

sudo iotop

is there anything at the top that’s using an inordinate percentage of “IO>” ?

Also what’s the output from:

sudo smartctl -A /dev/sda

IO is in the order of 0 - 4%, with occasionally 7 - 9%.

sudo smartctl -A /dev/sda gives…

mike@mike-ubuntu:~$ sudo smartctl -A /dev/sda
smartctl 6.5 2016-01-24 r4214 [x86_64-linux-4.4.0-79-generic] (local build)
Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF READ SMART DATA SECTION ===
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 100 100 051 Pre-fail Always - 2
2 Throughput_Performance 0x0026 252 252 000 Old_age Always - 0
3 Spin_Up_Time 0x0023 073 071 025 Pre-fail Always - 8297
4 Start_Stop_Count 0x0032 097 097 000 Old_age Always - 3642
5 Reallocated_Sector_Ct 0x0033 252 252 010 Pre-fail Always - 0
7 Seek_Error_Rate 0x002e 252 252 051 Old_age Always - 0
8 Seek_Time_Performance 0x0024 252 252 015 Old_age Offline - 0
9 Power_On_Hours 0x0032 100 100 000 Old_age Always - 17282
10 Spin_Retry_Count 0x0032 252 252 051 Old_age Always - 0
11 Calibration_Retry_Count 0x0032 252 252 000 Old_age Always - 0
12 Power_Cycle_Count 0x0032 097 097 000 Old_age Always - 3727
191 G-Sense_Error_Rate 0x0022 100 100 000 Old_age Always - 428
192 Power-Off_Retract_Count 0x0022 252 252 000 Old_age Always - 0
194 Temperature_Celsius 0x0002 057 051 000 Old_age Always - 43 (Min/Max 14/49)
195 Hardware_ECC_Recovered 0x003a 100 100 000 Old_age Always - 0
196 Reallocated_Event_Count 0x0032 252 252 000 Old_age Always - 0
197 Current_Pending_Sector 0x0032 252 252 000 Old_age Always - 0
198 Offline_Uncorrectable 0x0030 252 252 000 Old_age Offline - 0
199 UDMA_CRC_Error_Count 0x0036 200 200 000 Old_age Always - 0
200 Multi_Zone_Error_Rate 0x002a 100 100 000 Old_age Always - 28
223 Load_Retry_Count 0x0032 252 252 000 Old_age Always - 0
225 Load_Cycle_Count 0x0032 100 100 000 Old_age Always - 3727

However, Ubuntu is on sdc on this machine, so here’s the output fom that…

mike@mike-ubuntu:~$ sudo smartctl -A /dev/sdc
smartctl 6.5 2016-01-24 r4214 [x86_64-linux-4.4.0-79-generic] (local build)
Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF READ SMART DATA SECTION ===
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 0x000f 200 200 051 Pre-fail Always - 0
3 Spin_Up_Time 0x0003 191 085 021 Pre-fail Always - 5408
4 Start_Stop_Count 0x0032 096 096 000 Old_age Always - 4705
5 Reallocated_Sector_Ct 0x0033 200 200 140 Pre-fail Always - 0
7 Seek_Error_Rate 0x000f 200 200 051 Pre-fail Always - 0
9 Power_On_Hours 0x0032 073 073 000 Old_age Always - 19949
10 Spin_Retry_Count 0x0013 100 100 051 Pre-fail Always - 0
11 Calibration_Retry_Count 0x0012 100 100 051 Old_age Always - 0
12 Power_Cycle_Count 0x0032 096 096 000 Old_age Always - 4700
194 Temperature_Celsius 0x0022 113 101 000 Old_age Always - 37
196 Reallocated_Event_Count 0x0032 200 200 000 Old_age Always - 0
197 Current_Pending_Sector 0x0012 200 200 000 Old_age Always - 0
198 Offline_Uncorrectable 0x0010 200 200 000 Old_age Offline - 0
199 UDMA_CRC_Error_Count 0x003e 200 200 000 Old_age Always - 80
200 Multi_Zone_Error_Rate 0x0009 200 200 051 Pre-fail Offline - 0

mike@mike-ubuntu:~$

Thanks Mark

In 2 terminals, leave

top

and

iotop

running.

The when the PC slows down, try to see if there’s some process that’s either hammering the CPU (top) or hard drive (iotop).

My point is, there’s no point in taking a single reading from those whilst the PC isn’t running slowly … so do something that causes the system to slow down, and look at those terminals whilst it’s doing it.

Hello Mark,

I’ve been trying this, but there’s no obvious culprit. FF and Chrome (which I’m reluctantly trying because FF keeps giving me the “Well, this is embarrassing” screen) tend to use a lot of CPU, especially when streaming videos, but I haven’t seen the whole machine freeze up again.

Obviously I can’t open the two terminals until the machine is running, so they don’t offer any clues as to why the boot process takes so long (consistently around 100 - 120 seconds to a usable desktop). FF also starts up amazingly slowly.

I’m beginning to think in terms of a full reinstall of Ubuntu 16.04…

Might be the simplest solution mike because I’m all outa ideas.

Thanks Mark,

If you’re out of ideas, there’s no hope of me fixing it.

Reinstall it is then, as soon as I find the time.

Thanks for your help.

Mark,

I’ve just discovered from the ‘properties’ of the partition on which Ubuntu is installed, that some contents are unreadable.

Does that throw any light on the problem? I suspect it’s confirmation that a reinstall is needed.

That may just mean the user under which you opened the properties doesn’t have permission to read all the contents.

Have you either

a) opened that utility as root

or

b) run a file system check … IIRC we already did this (?)

I don’t know how to do that…

Not sure, but I don’t think so - still a linux newbie…

Incidentally, we have a laptop also running Ubuntu 16.04 which is also running very slowly, and which also shows unreadable contents on the Ubuntu partition. I assume that probably confirms that this is a permissions problem…

I’m having one last shot at this before I go for the nuclear option…

Given the amount of disk accessing I’m hearing (not all the time, but quite often) I’m wondering whether the partition on which Ubuntu is installed is nearly full.

Problem is, I don’t yet know how to find out. I’m googling (with duckduckgo) but any clues appreciated (ubuntu is on sdc5).

M