4

I attempted to download VirtualBox from terminal. Now, when I try to update, or input a command this reads out:

tyiese@penguin:~$ apt-get update
E: Malformed entry 1 in list file /etc/apt/sources.list.d/virtualbox.list (Component)
E: The list of sources could not be read.
tyiese@penguin:~$ rm /etc/apt/sources.list.d/virtualbox.list
rm: remove write-protected regular file '/etc/apt/sources.list.d/virtualbox.list'? Y
rm: cannot remove '/etc/apt/sources.list.d/virtualbox.list': Permission denied

I did attempt to remove the file - I think - but, as you can see it was not accepted.

4

2 Answers 2

16

As for the file removal, the last line of the output you provided hints what the problem is. Given your question, I assume you're not too familiar with users and permissions in GNU/Linux. The $ sign means you're running your commands as ordinary user, whereas to modify most system/configuration files (such as those pertaining to apt) you need root privileges. You typically obtain those on a per-command basis by prepending a command with sudo. So in your case that would be:

sudo rm /etc/apt/sources.list.d/virtualbox.list

After that you would be prompted for your password and (assuming your user is allowed to do so) the command would be run as root.

As for your original problem - malformed entry in sources file - I cannot help you unless you post the contents of said file. It might be a missing keyword or missing newline at the end. Hard to say.

One remark for the future. When pasting multi-line transcripts or snippets of code, please place them between two sets of triple backquotes (```) on lines of their own for better formatting.

1
  • Thanks and sorry for the formatting errors. I ran with sudo and it worked - and now I am able to update and input other commands. Thanks again for helping a clueless person!
    – TNim
    Dec 11, 2019 at 18:08
1

root cause for this error is recent update made by you. Generally copy n paste resultant to new line to the file which for some reason is causing the file to go in invalid state.

use sudo to edit the file and remove the unnecessary line. This will work 99%. cheers

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.