3

I've read How to solve "Extra junk at end of file" when using apt? and though it's a similar problem, it apparently has a different cause since, looking at the contents of the file, unlike in the earlier Q&A it seems far from obvious that adding apostrophes could solve the issue.

enter image description here

enter image description here

An error occurred, please run Package Manager from the right-click menu or apt-get in a terminal to see what is wrong. The error message was: 'Unknown Error: '' (E: Syntax error /etc/apt/apt.conf.d/01autoremove-kernels:1: Extra junk at end of file)'. This usually means that your installed packages have unmet dependencies.

Contents of problematic /etc/apt/apt.conf.d/01autoremove-kernels (please note, however, that gedit complains about invalid characters):

 ../../../linux-headers-3.2.0-65/scripts/kconfig/streamline_config.pl\00\00\00\0‌​0\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\.............‌​

1 Answer 1

3

Found a solution which also worked for me:

sudo /etc/kernel/postinst.d/apt-auto-removal

which will first return the above error yet again and secondly and crucially cleanly re-write the problematic file, to be finished off by something along the lines of

sudo apt-get update && sudo apt-get dist-upgrade

Contents of problematic /etc/apt/apt.conf.d/01autoremove-kernels

  • before applying the above mentioned "recovery":
../../../linux-headers-3.2.0-65/scripts/kconfig/streamline_config.pl\00\00\00\0‌​0\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\.............‌​
  • after applying the above mentioned "recovery":
// File autogenerated by /etc/kernel/postinst.d/apt-auto-removal, do not edit
    APT
    {
      NeverAutoRemove
      {
        "^linux-image-3.2.0-65-generic$";
        "^linux-image-extra-3.2.0-65-generic$";
        "^linux-signed-image-3.2.0-65-generic$";
        "^linux-backports-modules-.*-3.2.0-65-generic$";
        "^linux-headers-3.2.0-65-generic$";
        "^linux-tools-3.2.0-65-generic$";
      };
    };

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .