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.

When I run apt-get -f install, it gives the following error:

# apt-get -f install
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
  libcdio10 lp-solve libunique-1.0-0 libgmime-2.4-2 libcdio-paranoia0 hplip-cups libmagickcore3 libtaglib2.0-cil libgkeyfile1.0-cil
  zeitgeist-extension-fts libgudev1.0-cil linux-headers-3.0.0-12 libtextcat-data libgdata1.9-cil libglew1.5 libproxy0 libgexiv2-0
  libmagickwand3 libgnomevfs2-common linux-headers-3.0.0-12-server libgupnp-1.0-3 libwebkitgtk-1.0-common python-indicate libnux-1.0-common
  libboost-date-time1.46.1 libindicator3-6 linux-headers-3.0.0-19-generic banshee python-webkit python-aptdaemon.gtkwidgets libindicator6
  gir1.2-gconf-2.0 libjavascriptcoregtk-1.0-0 libept1 banshee-extension-soundmenu libgnomevfs2-0 libmono-zeroconf1.0-cil libvpx0
  python-telepathy libgdata1.7-cil libminiupnpc5 libnotify0.4-cil libpoppler-glib6 python-aptdaemon-gtk libtextcat0 libgtk-sharp-beans-cil
  gnome-utils-common libxss1 libhunspell-1.2-0 unity-2d-places libjpeg62:i386 libquvi0 libexiv2-10 libgupnp-igd-1.0-3 gnome-desktop-data
  libgtkspell3-0 libnautilus-extension1 libwebkitgtk-1.0-0 gir1.2-dee-0.5 libcdio-cdda0 libmusicbrainz4c2a python-wnck libmagickcore3-extra
  libglewmx1.5 libnux-1.0-0 libgmime2.4-cil libnatpmp1 unity-2d-launcher libgssdp-1.0-2 libllvm2.9
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  postgresql-9.1
Suggested packages:
  oidentd ident-server locales-all
The following packages will be upgraded:
  postgresql-9.1
1 upgraded, 0 newly installed, 0 to remove and 80 not upgraded.
2 not fully installed or removed.
Need to get 0 B/4,290 kB of archives.
After this operation, 295 kB disk space will be freed.
Do you want to continue [Y/n]? y
(Reading database ... 252269 files and directories currently installed.)
Preparing to replace postgresql-9.1 9.1.3-0ubuntu0.11.10 (using .../postgresql-9.1_9.1.4-0ubuntu12.04_amd64.deb) ...
 * Stopping PostgreSQL 9.1 database server
 * Insecure directory in $ENV{PATH} while running with -T switch at /usr/bin/pg_ctlcluster line 246.
Insecure directory in $ENV{PATH} while running with -T switch at /usr/bin/pg_ctlcluster line 255.
(does not shutdown gracefully, now stopping immediately)
                                                         [fail]
invoke-rc.d: initscript postgresql, action "stop" failed.
dpkg: warning: subprocess old pre-removal script returned error exit status 1
dpkg - trying script from the new package instead ...
 * Stopping PostgreSQL 9.1 database server
 * Insecure directory in $ENV{PATH} while running with -T switch at /usr/bin/pg_ctlcluster line 246.
Insecure directory in $ENV{PATH} while running with -T switch at /usr/bin/pg_ctlcluster line 255.
(does not shutdown gracefully, now stopping immediately)
                                                          [fail]
invoke-rc.d: initscript postgresql, action "stop" failed.
dpkg: error processing /var/cache/apt/archives/postgresql-9.1_9.1.4-0ubuntu12.04_amd64.deb (--unpack):
 subprocess new pre-removal script returned error exit status 1
No apport report written because MaxReports is reached already
Errors were encountered while processing:
 /var/cache/apt/archives/postgresql-9.1_9.1.4-0ubuntu12.04_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

I tried to uninstall postgresql but could not do it. Please advice.

share|improve this question
add comment

1 Answer 1

I think you would be new to ubuntu. sudo apt-get update <argument> will just update the repositories and it is showing you an error because you have wrong (bad) links. Once you have updated the repositories you have to run sudo apt-get upgrade to download and install the updates. So to totally update your ubuntu pc you have to type:

sudo apt-get update

and then:

sudo apt-get upgrade

A better command to the first one will be:

sudo apt-get update -fmy

The argument "f" is for fixing unresolved (broken) dependencies.
The argument "m" is for attempting to search even if the archives are unlocatable.
The argument "y" is for assuming yes for every queries.

share|improve this answer
    
Thanks for your reply. I already tried those two commands a few times but they are not able to solve the problem. When I try to install or uninstall any software it says "the package system is broken" and asks to run "apt-get install -f". On running this command, it gives the error posted above. Suggestions please.. Thanks, Shiv –  Shiv Jun 20 '12 at 13:46
    
You can always update even if you have this problem. But if want a concrete solution then remove the links from the update-setting. –  Pranit Bauva Jun 20 '12 at 13:53
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.