2

I recently installed nvidia-331 driver via Software & Updates -> Additional Drivers tab.

Now when I use:

sudo apt-get install <package>

or

sudo apt-get remove <package>

apt-get ends up with following errors:

lyn@antares:~$ sudo apt-get install hexedit
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following package was automatically installed and is no longer required:
  linux-image-generic
Use 'apt-get autoremove' to remove it.
The following NEW packages will be installed:
  hexedit
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
Need to get 0 B/24.6 kB of archives.
After this operation, 88.1 kB of additional disk space will be used.
Selecting previously unselected package hexedit.
(Reading database ... 226032 files and directories currently installed.)
Preparing to unpack .../hexedit_1.2.13-1_amd64.deb ...
Unpacking hexedit (1.2.13-1) ...
Processing triggers for man-db (2.6.7.1-1) ...
Setting up nvidia-331 (331.89-0ubuntu1~xedgers14.04.2) ...
INFO:Enable nvidia-331
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/lenovo_thinkpad
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/dell_latitude
Traceback (most recent call last):
  File "/usr/bin/quirks-handler", line 65, in <module>
    operation_status = main(options)
  File "/usr/bin/quirks-handler", line 44, in main
    quirks = Quirks.quirkapplier.QuirkChecker(options.package_enable, path=quirks_path)
  File "/usr/lib/python3/dist-packages/Quirks/quirkapplier.py", line 38, in __init__
self._system_info = self.get_system_info()
  File "/usr/lib/python3/dist-packages/Quirks/quirkapplier.py", line 64, in get_system_info
return quirk_info.get_dmi_info()
  File "/usr/lib/python3/dist-packages/Quirks/quirkinfo.py", line 46, in get_dmi_info
'class', 'dmi', 'id', item)).read().strip()
  File "/usr/lib/python3.4/codecs.py", line 313, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte
dpkg: error processing package nvidia-331 (--configure):
 subprocess installed post-installation script returned error exit status 1
Setting up hexedit (1.2.13-1) ...
Errors were encountered while processing:
 nvidia-331
E: Sub-process /usr/bin/dpkg returned an error code (1)

I already tried to remove nvidia drivers using this topic however apt-get still shows almost the same error.

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte
5
  • what is your "sudo apt-get update" giving?Is this showing any error messages? Sep 21, 2014 at 5:37
  • @saptarshinag no, it doesn't
    – Etherealyn
    Sep 21, 2014 at 5:45
  • Remove the nvidia-331 then install the current driver version by "sudo apt-get install nvidia-current" Sep 21, 2014 at 5:46
  • @saptarshinag both "sudo apt-get remove nvidia-331" and "sudo-apt-get install nvidia-current" starts and fails (with the same errors I posted above). Is there a proper way to uninstall a driver without apt-get ?
    – Etherealyn
    Sep 21, 2014 at 6:00
  • see this unix.stackexchange.com/questions/153208/… Sep 21, 2014 at 6:04

3 Answers 3

2

This worked for me :)

Make a backup and edit the file:

sudo cp /usr/bin/quirks-handler /usr/bin/quirks-handler.bak
sudo gedit /usr/bin/quirks-handler

replace the contents with the following code:

#! /usr/bin/python3
if __name__ == '__main__':
    pass

Purge nvidia-331:

sudo apt-get purge nvidia-331

It will complete successfully, and then you can restore the backup:

sudo mv /usr/bin/quirks-handler.bak /usr/bin/quirks-handler
3
  • Well... that worked for me too but then Unity crashed after a while. Using Ctrl+Alt+F1 I've managed to install nvidia-340 driver. Doing so I recovered Unity but apt-get fails again.
    – Etherealyn
    Oct 5, 2014 at 14:25
  • You must not have nvidia drivers from PPA. Keep the latest drivers from the repository. Do the trick again to remove 340 and install 331 which is part of ubuntu 14.10 right now.
    – kapcom01
    Oct 29, 2014 at 7:35
  • Worked flawlessly. Jul 31, 2015 at 8:02
2

A brutally way to remove the problem is the following

  1. edit the file /var/lib/dpkg/info/package-name.postrm; in this case it should be sudo gedit /var/lib/dpkg/info/nvidia-331.postrm
  2. adds exit 0 after the line #!bin/sh and save.
  3. run "sudo apt-get remove --purge nvidia-331". It should end without errors.
  4. make sure to delete the previously added line from the file (so again sudo gedit /var/lib/dpkg/info/package-name.postrm, remove the line and save).
  5. before trying anything else, run sudo apt-get update and sudo apt-get upgrade and check that it returns without errors.
7
  • on step 3 it ends with errors pastebin.com/nhak1W4D but thanks anyway
    – Etherealyn
    Sep 22, 2014 at 17:30
  • try this: dkms remove -m X -v Y --all. You have to replace X and Y with your current module and version. To do this, after typing -m nv press two times the tab button to see what it displays. Then do the same with Y. E.G. for me it is dkms remove -m nvidia-304 -v 304.117 --all
    – tigerjack
    Sep 22, 2014 at 19:46
  • I pressed the tab button and it suggested me nothing. I mean, nv[tab][tab] doesn't turn into nvidia-331. Also nvidia-settings doesn't list any of nvidia drivers.
    – Etherealyn
    Sep 24, 2014 at 2:46
  • can you post again the output of dpkg -l | grep nvidia and apt-get upgrade -f?
    – tigerjack
    Sep 24, 2014 at 10:59
  • grep: pastebin.com/BkhMwKLj upgrade: pastebin.com/DfQd6wez
    – Etherealyn
    Sep 25, 2014 at 8:19
1

What worked for me was to purge nvidia-current, autoremove, restart, install cairo-dock then go to software updates and select the nvidia 331 from additional drivers (it took much more time than installing from cli), restart. Then from terminal install CCSM and activate the unity plug-in.

Now in commands what I think is the minimum to solve the issue:

  1. Before login (because lightdm shows the login) type ctrl+alt+F2
  2. From the CLI type sudo apt-get install cairo-dock
  3. Now typesudo apt-get install compizconfig-settings-manager
  4. Go back to the login typing ctrl+alt+F7
  5. select cairo as your shell (click in the Ubuntu icon) and login as normal
  6. From the application menu in Cairo go to system tools->preferences->CompizConfig Settings Manager
  7. Click OK in the warning dialog
  8. Click over desktop button in the left panel.
  9. Push the Ubuntu Unity Plugin button in the right panel
  10. Check the check box in the left panel to activate Ubuntu Unity Plugin
  11. Activate everything that is needed in order to get Unity back
  12. Voilá Unity is again working as before

I hope those steps make sense. the first explanation was a super fast story telling of what I had to do, so if the detailed minimum steps doesn't work for you then follow the exactly path I had to do

  1. Don't login typectrl+alt+F2, so you go to the CLI
  2. login and then type sudo apt-get install cairo-dock
  3. sudo apt-get purge nvidia-current and confirm
  4. Now type sudo apt-get autoremove and confirm
  5. sudo reboot
  6. Now login from lightDM (graphically) as usual but selecting the cairo shell from the Ubuntu icon
  7. If the GUI appears good jump to step 11; otherwise
  8. Go back to CLI typing ctrl+alt+F2
  9. type cairo-dock (I hope it starts correctly in your GUI; otherwise, you have to specify the DISPLAY before -gurus, please help-)
  10. Return to GUI typing ctrl+alt+F7
  11. From the applications menu in Cairo go to System Tools->Software Updates
  12. when it finished to update push the configuration button and go to the last tab (additional drivers)
  13. Other way is to go to System Tools->Preferences->Additional Drivers
  14. Select the best (tested) Nvidia driver and apply changes
  15. Restart using Cairo icon for that
  16. Then login again and install compizconfig-settings-manager using System tools->Administration->Ubuntu Software Center
  17. Continue from step 6 of the minimum steps (the previous list)

I hope this makes sense and work for you as it worked for me.

You must log in to answer this question.

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