Search code examples
linuxterminalpermissions

Malformed entry 1 in list file


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.


Solution

  • 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.