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.
  1. I can't install g++ in software center.
  2. I can install other programs. For example, after I found g++ can't be installed, I installed chrome for test purpose through software center, and it worked!
  3. g++ can be installed in the terminal via apt-get install. Only the software center way didn't work.
    Here is the messages display in the terminal when I installed g++ in software center :

    E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied) 
    E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?         xch@xch-PC:~$ sudo software-center [sudo] password for xch:  2013-03-20 13:11:19,232 - softwarecenter.ui.gtk3.app - INFO - setting up proxy 'None' 2013-03-20 13:11:19,272 - softwarecenter.db.database - INFO - open() database: path=None use_axi=True use_agent=True 2013-03-20 13:11:20,412 - softwarecenter.backend.reviews - WARNING - Could not get usefulness from server, no username in config file 2013-03-20 13:11:20,893 - softwarecenter.ui.gtk3.app - INFO - show_available_packages: search_text is '', app is None. 2013-03-20 13:11:20,901 - softwarecenter.db.pkginfo_impl.aptcache - INFO - aptcache.open() 2013-03-20 13:12:09,553 - softwarecenter.backend - ERROR - error in_on_trans_finished 'Error: Requires installation of untrusted packages The action would require the installation of packages from not authenticated sources.
    g++ g++-4.6 libstdc++6-4.6-dev' 2013-03-20 13:12:11,356 - softwarecenter.db.pkginfo_impl.aptcache - INFO - aptcache.open() 2013-03-20 13:12:15,565 - softwarecenter.db.update - INFO - skipping region restricted app: 'Bulleti d'esquerra de Calonge i Sant Antoni ' (not whitelisted) 2013-03-20 13:12:16,527 - softwarecenter.db.update - INFO - skipping region restricted app: 'Comentarios Web' (not whitelisted) 2013-03-20 13:12:18,910 - softwarecenter.ui.gtk3.app - INFO - software-center-agent finished with status 0 2013-03-20 13:12:18,911 - softwarecenter.db.database - INFO - reopen() database 2013-03-20 13:12:18,911 - softwarecenter.db.database - INFO - open() database: path=None use_axi=True use_agent=True ^Cg_dbus_connection_real_closed: Remote peer vanished with error: Underlying GIOStream returned 0 bytes on an async read (g-io-error-quark, 0). Exiting..
    

Who can tell me why this happens? How can I fix it?

PS: I have had gcc and gdb installed in my 12.04LTS before. My goal is to install Qt Creator via software center, which doesn't work either.


I finally installed qt creator via synaptic. But I'm still curious about why it can't be done in software center. Does software center use some specific website? I'm in China and some websites can't be accessed because of the so called GFW.

share|improve this question
    
Try doing from a command line instead. I would recommend you install build-essential sudo apt-get install build-essential as it includes other packages you will probably want for development but if you only want g++ the command is sudo apt-get install g++. This still may not work. If doesn't post the error messages you get. Should give us a clue why –  Warren Hill Mar 20 '13 at 11:29
    
@WarrenHill Thanks for your reply. I have added some details. I don't use command line because I don't qt creator's package name. PS:when using apt-get install, there may be some "suggested packages" showed as well, will they be installed by default after I input "y"? –  duleshi Mar 20 '13 at 14:48
add comment

2 Answers

Just do the following:

  • stop all package-management processes
  •  killall -9 apt* kpackage dpkg software-center
    

  • if you use synaptic package manager, add it to that list
  • killall -9 apt* kpackage dpkg synaptic software-center
    

  • Having confirmed that there were no "rogue" pkg. managers running, I checked, removed, & rechecked the lock file:
  • ls -l /var/lib/dpkg/lock
    rm -f /var/lib/dpkg/lock
    ls -l /var/lib/dpkg/lock
    

  • Finally, just fix it up:
  • aptitude safe-upgrade
    dpkg --configure -a 
    

  • In the end if required just update the file database using
  •  sudo updatedb
    
    share|improve this answer
        
    Thank you for your detailed answer! It's useful for me. Since I have circumvented the problem via Synaptic, I'll try and verify your method the next time software center fails. –  duleshi Mar 21 '13 at 14:50
    add comment

    You probably just need sudo before apt-get install g++. Try it from the command line instead the software-center. I can't open the software center. Already reported the bug to Launchpad but the good old command line always works for me so try that.

    share|improve this answer
    add comment

    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.