0

I ran different commands. Maybe I have also corrupted many things. But I do not see any sort of error or crashes so far. So my main question is how do I know that my pc is healthy and there is nothing wrong in it?! I want to try all "Safe" commands that you guys probably know and see if something is wrong or not. Kind of like "Debugging my PC" as smooth as possible. Especially focusing on dpkg case. And other cases if you know.

Pranav
  • 1,200
  • Depends entirely upon what you did and what you suspect might be wrong. There is no magic "you are just fine" test for all possible circumstances. If dpkg works without error, and packages really do get installed and removed, then dpkg is working properly. – user535733 Jul 24 '19 at 07:33
  • @user535733 should I install something to check that!? – Pranav Jul 24 '19 at 08:11
  • Sure, install and uninstall the 'hello' package. It's good for an easy test. – user535733 Jul 24 '19 at 08:14
  • @user535733 I got this: https://pastebin.com/WUjTnkL9 Do u know a bash script to solve this? An automation technique which does all the work. – Pranav Jul 24 '19 at 08:48
  • dpkg -l | egrep -v '^ii|rc Any chance you have a SSD? – nobody Jul 24 '19 at 08:57
  • @nobody I tried ur command, and I got this: https://pastebin.com/bsteBkM9 No, I don't have SSD, I have HDD. I think ur command need some more input. – Pranav Jul 24 '19 at 09:36
  • dpkg -l | egrep -v '^ii|rc' the letter are to tiny for me. Big sorry. – nobody Jul 24 '19 at 09:55
  • @nobody Here is the output: https://pastebin.com/hSkXrq5E – Pranav Jul 24 '19 at 09:59
  • Why are so many warnings? Make a filesystemcheck and check healthy of your harddrive with smartmontools. – nobody Jul 24 '19 at 10:06
  • @user535733 I ran " sudo apt install smartmontools", it gave me "E: Unable to locate package smartmontools". Can't I use gedit and check for errors? – Pranav Jul 24 '19 at 10:11
  • 1
    Possible duplicate of dpkg warning files list file for package missing. Includes the script to automate repair. – user535733 Jul 24 '19 at 11:54
  • @user535733 The answer did respond or didn't do anything. I copy the script and pasted in a file named ls.sh and tried to run using "sudo ./ls.sh". No outputs, nothing. – Pranav Jul 24 '19 at 11:59
  • No output might indicate success, too. Did you check? – user535733 Jul 24 '19 at 12:40
  • @user535733 if the way I execute this command is right then, yes the post answer did not work for me. Probably why their answers barely upvote and accepted. – Pranav Jul 24 '19 at 17:30
  • All the script does is reinstall the packages that generate the error message, thus fixing the problem. If the script doesn't work for you, then I suppose you will spend an afternoon reinstalling each relevant package manually -- you have that list of package names. It might be faster for you to learn the correct scripting. Alternately, you can backup your data and reinstall. It's your time; how you want to fix it is entirely your choice. There is really no magic involved - this seems like a very straightforward problem, and easy (though tedious) to fix. – user535733 Jul 24 '19 at 17:34
  • @user535733 u right. Thanks. – Pranav Jul 25 '19 at 04:01

1 Answers1

0

I solved this problem in this way. The answer is a bit different in this case. Since update and upgrade didn't show any error, you need.

First install a random program u want, for ur easiness u can try a small program named "hello" using "sudo apt install hello", and paste below command.

for package in $(apt remove --purge hello -y 2>&1 | grep "warning: files list file for package '" | grep -Po "[^'\n ]+'" | grep -Po "[^']+"); do apt-get install --reinstall "$package" -y; done

Incase if u don't know how to paste this command. For a demo, create a file named ls.sh and edit and paste above command. Go to its properties allow the file for executing. And go to terminal and reach to that folder where your script is, using "cd" and type "./ls.sh" to execute.

Now this will take huge amount time depending your internet speed and whether its a SSD or HDD. Fast internet + SDD = Less time. So, if its not in ur case than u can simple press Ctrl + C to stop the program. The number of "installing packages" decrease time by time. Stop at your will, run at your will.

To clean your memory, run:

 sudo apt autoclean 
 sudo apt autoremove

every-time if possible when you stop the script from running.