Yeah, we’ve all been there. You, in a fit of bravery or possible foolishness (maybe because you tucked your shirt into your underwear?) have decided to do some system-level messing and have accidentally deleted or messed up an important file. If you mess up the sources.list file found in the /etc/apt directory, then you might not think it’s important enough to have a fit over. It is.
After you’ve finished screaming and pulling your hair out, then you might wonder why it’s such a bad thing. After all, it doesn’t seem like one. Your computer is running fine, you can run apps no problem.
Yes problem. It’s not such a bad thing in the short run, but try installing an app. It won’t install, and if you run it via the terminal to get output, it will not look great. For example, here’s me trying to install gphoto2, a utility for grabbing photos off Nikon cameras, what with their weird DSC files and all:
See? It’s not pretty. So you need to fix the file. How? I’ll tell you. Wait, hold on. First, go sweep your hair off the floor and apologize to your neighbors/family for the screaming. Done? Alrighty. Let’s begin.
Fixing The File
The methood for doing this is remarkably simple. Just a little command-fu involved, and then we can go back to nice, mushy GUIs.
First, open a terminal (press Ctrl+Alt+T) and type:
<code>sudo rm /etc/apt/sources.list</code>
If it returns an error like “No such file or directory” don’t be alarmed. All that means is that instead of corrupting your file, you just deleted it outright. Scary.
Okay. Now, open Software and Updates. I use the Budgie Desktop, so what you see may be different from me, but it’s safe to say that if you hit the Super (Windows) Key and type “Software And Updates” (no quotes) then it will be there.
In Software and Updates, start checking boxes. The first time you check a box, it will ask you for authentication. Go ahead and type your password.
Now, check all the boxes, like so. You may want to leave “Source Code” unchecked.
Click the close button and a prompt will pop up. Click Reload.
After your lists are reloaded, then congrats! You’ve done it! You can now install software again!
Do note this won’t bring back your PPAs, and honestly I can’t say how to. I’ll update this post if I find a method.
Did you find this useful? Are you back to normal now? Please let us know in the comments!
PS If you didn’t get the joke in the first paragraph, here’s a link to Episode 1 of Rhett and Link’s Buddy System, where I got it.