Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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\.............‌​
share|improve this question

1 Answer 1

up vote 2 down vote accepted

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$";
      };
    };
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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