apt-get ends up with errors after nvidia 331 installation
Solution 1
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
Solution 2
A brutally way to remove the problem is the following
- 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
- adds exit 0 after the line
#!bin/sh
and save. - run "sudo apt-get remove --purge nvidia-331". It should end without errors.
- 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). - before trying anything else, run
sudo apt-get update
andsudo apt-get upgrade
and check that it returns without errors.
Solution 3
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:
- Before login (because lightdm shows the login) type ctrl+alt+F2
- From the
CLI
typesudo apt-get install cairo-dock
- Now type
sudo apt-get install compizconfig-settings-manager
- Go back to the login typing ctrl+alt+F7
- select
cairo
as your shell (click in the Ubuntu icon) and login as normal - From the application menu in Cairo go to system tools->preferences->CompizConfig Settings Manager
- Click OK in the warning dialog
- Click over desktop button in the left panel.
- Push the Ubuntu Unity Plugin button in the right panel
- Check the check box in the left panel to activate Ubuntu Unity Plugin
- Activate everything that is needed in order to get Unity back
- 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
- Don't login typectrl+alt+F2, so you go to the
CLI
- login and then type
sudo apt-get install cairo-dock
sudo apt-get purge nvidia-current
and confirm- Now type
sudo apt-get autoremove
and confirm sudo reboot
- Now login from
lightDM
(graphically) as usual but selecting thecairo
shell from the Ubuntu icon - If the GUI appears good jump to step 11; otherwise
- Go back to CLI typing ctrl+alt+F2
- type cairo-dock (I hope it starts correctly in your GUI; otherwise, you have to specify the DISPLAY before -gurus, please help-)
- Return to GUI typing ctrl+alt+F7
- From the applications menu in Cairo go to System Tools->Software Updates
- when it finished to update push the configuration button and go to the last tab (additional drivers)
- Other way is to go to System Tools->Preferences->Additional Drivers
- Select the best (tested) Nvidia driver and apply changes
- Restart using Cairo icon for that
- Then login again and install
compizconfig-settings-manager
using System tools->Administration->Ubuntu Software Center - 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.
Related videos on Youtube
Etherealyn
Updated on September 18, 2022Comments
-
Etherealyn over 1 year
I recently installed
nvidia-331
driver viaSoftware & 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
-
saptarshi nag over 9 yearswhat is your "sudo apt-get update" giving?Is this showing any error messages?
-
Etherealyn over 9 years@saptarshinag no, it doesn't
-
saptarshi nag over 9 yearsRemove the nvidia-331 then install the current driver version by "sudo apt-get install nvidia-current"
-
Etherealyn over 9 years@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 ?
-
saptarshi nag over 9 years
-
-
Etherealyn over 9 yearson step 3 it ends with errors pastebin.com/nhak1W4D but thanks anyway
-
tigerjack over 9 yearstry 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 isdkms remove -m nvidia-304 -v 304.117 --all
-
Etherealyn over 9 yearsI pressed the tab button and it suggested me nothing. I mean,
nv[tab][tab]
doesn't turn intonvidia-331
. Alsonvidia-settings
doesn't list any of nvidia drivers. -
tigerjack over 9 yearscan you post again the output of
dpkg -l | grep nvidia
andapt-get upgrade -f
? -
Etherealyn over 9 years
-
tigerjack over 9 yearstry this: 1. logout from your graphic session 2. press CTRL+ALT+F1 to login from tty and insert your user and password 3. run
apt-get purge nvidia*
4. logout and restart the system 5. see if something has changed running again the previous commands (grep and upgrade) -
tigerjack over 9 yearsalso, this is a known bug bugs.launchpad.net/ubuntu/+source/ubuntu-drivers-common/+bug/…
-
Etherealyn over 9 yearsWell... that worked for me too but then
Unity
crashed after a while. UsingCtrl+Alt+F1
I've managed to installnvidia-340
driver. Doing so I recoveredUnity
butapt-get
fails again. -
kapcom01 over 9 yearsYou 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.
-
ArcaneDominion almost 9 yearsWorked flawlessly.