2

My Ubuntu was stuck in a login loophole hence I removed lightdm and installed gdm instead. Somewhere in the instructions someone suggested to add a sleep 1 in a file. After I did so the system has slowed down so badly. I cannot remember the filename. How would I know which file I have added this line to ? Also, how can I fix the system slowdown? I keep getting the following error as well: enter image description here

Mona Jalal
  • 4,545
  • 21
  • 68
  • 99
  • it's possible I might have changed one of lightdm configs not sure as it doesn't show it after I purged it $ find . -type f -mtime -7 -exec ls -l {} ; – Mona Jalal Jul 09 '18 at 22:28
  • Sleep 1 causes the script it to pause for 1 second; place in the wrong spot and it could make that script/system perform very slowly. If you used commands to navigate your directory, and vim/nano/any-editor to make the change, you'll find your commands in your history; you won't be able to see what changes you made, but the filename, or path/filename (if you didn't cd there) will be found in your history. I've also modified my history to record date/time, but that's not there by default. – guiverc Jul 10 '18 at 00:14

1 Answers1

1

Read Me First

Looking at your error messages it appears to be the classic "Login Loop" caused by nVidia drivers. Follow these instructions apply nomodeset at boot time: Graphics issues after/while installing Ubuntu 16.04/16.10 with NVIDIA graphics

Read all the instructions to see if you catch something you missed or did wrong.

If you also have Intel Integrated Graphics you can open the terminal and use:

sudo prime-select intel

This will save battery life, generate less heat, give similar performance and a lot less grief.


Answering your question

I don't think sleep 1 causes any problems but to answer your question use this answer: `grep`ing all files for a string takes a long time

sudo time grep -rnw --exclude-dir={boot,dev,lib,media,mnt,proc,root,run,sys,/tmp,tmpfs,var} '/' -e 'sleep 1'

On my system the results are too numerous to list, so here's the abridged version:

$ sudo time grep -rnw --exclude-dir={boot,dev,lib,media,mnt,proc,root,run,sys,/tmp,tmpfs,var} '/' -e 'sleep 1' | wc -l
11.55user 8.05system 0:38.33elapsed 51%CPU (0avgtext+0avgdata 8364maxresident)k
21161832inputs+0outputs (0major+3286minor)pagefaults 0swaps
283

It takes about 38 seconds to run and 283 files contain sleep 1 or sleep 1.0. Most, if not all, the files were not modified by me but, released that way by the developers.


Answering your comment

As far as your comment concerning:

$ find . -type f -mtime -7 -exec ls -l {} \;

This command only lists files in the current directory and all subdirectories below matching a certain file type. It doesn't modify these files in any way.

On my system the abridged version (starting from my home directory) is:

$ time find . -type f -mtime -7 -exec ls -l {} \; | wc -l
4026

real 0m5.614s user 0m0.092s sys 0m0.572s

There are 4,026 files found. Keep in mind on my system the find command caches all filenames every 10 minutes, so your results might be substantially longer than 5.6 seconds.