[postgis-users] Urgent help needed, messed up my postgis 2.1 server by installing latest QGIS pacake

Stephen Woodbridge woodbri at swoodbridge.com
Tue Mar 18 13:58:49 PDT 2014


This will tell you where your data is located:

su
grep data_directory /etc/postgresql/9.3/main/postgresql.conf
du -sh /var/lib/postgresql/9.3/main/*
cd /var/lib/postgresql/9.3/
tar -czf /var/lib/postgresql/9.3/backup-20140318.tgz main

Based on what you reported, I would apt-get remove the packages you 
installed and then apt-get install --reinstall the postgis packages.

and then restart the DB and see if you can get to your data.

-Steve


On 3/18/2014 4:42 PM, Willem Buitendyk wrote:
> Ok I'm having trouble finding the data directory.  I know the data is
> somewhere because I can access non-postgis data still in the database.
>   I can even get a count back on the postgis data tables. I have a
> /var/lib/postgresql/9.3/main/base directory but no data directory.
>
>
> On Tue, Mar 18, 2014 at 1:22 PM, Morten Sickel <morten at sickel.net
> <mailto:morten at sickel.net>> wrote:
>
>     If you installed postgres using apt-get, the data files should be in
>     /var/lib/postgres/9.3/data postgres is usually quite good at not messing
>     up data during upgrades, but just in case, I would make a quick
>     backup. if
>     you do a sudo du -s /var/lib/postgres/9.3/data/base/* you should see at
>     least three directories - one of them contains your entire database,
>     if it
>     is less than three there or none of them has a reasonable size, you
>     may be
>     in trouble... (unless you have set up postgres to store data somewhere
>     else) If you have installed postgres through make /make install, the
>     databases may be stored somewhere else.
>
>     Morten
>
>
>
>     Willem Buitendyk skrev:
>      > The wifi on the plane is a lot erratic.  How could I check if I
>     still have
>      > the data?  I'll certainly perform a backup as you suggest.  I
>     don't have a
>      > separate virtual machine unfortunately.  I have far too many
>     other systems
>      > associated to the current server, ip address, etc
>      >
>      >
>      > On Tue, Mar 18, 2014 at 1:03 PM, Morten Sickel <morten at sickel.net
>     <mailto:morten at sickel.net>> wrote:
>      >
>      >> Did you accidentally upgrade postgis or postgres to a new minor
>     version?
>      >> An apt-get autoremove (after having done a apt-get remove qgis) will
>      >> only
>      >> remove dependencies that qgis have pulled in, I do not think it will
>      >> rollback anything to an older version - so I don't think that
>     will help,
>      >> although it should not do any harm either.
>      >>
>      >> As long as the database files still do exist, it should be
>     possible to
>      >> get
>      >> back to a working system using a few apt-gets and/or dpkg
>     commands. So
>      >> just in case, shut down the postgres server and do a backup of
>      >> /var/lib/postgresql/9.3/data (or if you have put the database files
>      >> somewhere else you shoud know where they are) (use tar or some other
>      >> utility that gets the file ownerships and permissions right)
>      >>
>      >> Do you have access to any other virtual or real machine? then
>     you can
>      >> install postgres / postgis on that, stop postgres and just copy
>     over the
>      >> database files.
>      >>
>      >> Morten
>      >>
>      >> Willem Buitendyk skrev:
>      >> > Hi all,
>      >> >
>      >> > I'm currently sitting on a plane having made a huge mistake
>     yesterday.
>      >>  I
>      >> > have a server that runs constantly, supplying data to clients on a
>      >> daily
>      >> > basis.  The server is Ubuntu 12.04 and I had successfully
>     installed
>      >> and
>      >> > have been running PostGIS 2.1 and Postgresql 9.3 for the last 3
>      >> months.
>      >> >  Prior to leaving for my vacation I thought it would be great to
>      >> install
>      >> > QGIS so I could remotely view my database.  The problem is the
>     QGIS
>      >> > install
>      >> > altered my postgis and libgdal1 dependencies.
>      >> >
>      >> > Here are the commands I issued that got me into this mess:
>      >> >
>      >> > sudo apt-get update
>      >> >
>      >> > sudo apt-get install qgis pythin-qgis
>      >> >
>      >> > sudo apt-get install qgis python-qgis
>      >> >
>      >> > sudo apt-get install qgis
>      >> >
>      >> > sudo apt-get install python-qgis
>      >> >
>      >> > gpg --keyserver keyserver.ubuntu.com
>     <http://keyserver.ubuntu.com> --recv 47765B75
>      >> >
>      >> > gpg --export --armor 47765B75 | sudo apt-key add -
>      >> >
>      >> > sudo apt-get install qgis python-qgis
>      >> >
>      >> > sudo apt-get update
>      >> >
>      >> > sudo apt-get install qgis python-qgis
>      >> >
>      >> > sudo apt-get install python-software-properties
>      >> >
>      >> > sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable
>      >> >
>      >> > sudo apt-get update
>      >> >
>      >> > sudo apt-get install qgis python-qgis qgis-plugin-grass
>      >> >
>      >> > sudo apt-get install libssl0.9.8
>      >> >
>      >> >
>      >> > I am uncertain how to proceeed because I remember something
>     similar
>      >> > happening years ago (irony of ironies) and it ended up
>     corrupting my
>      >> > Ubuntu
>      >> > server when I tried to repair.
>      >> >
>      >> >
>      >> > I'm looking for some sage advise to correct this a painless as
>      >> possible.
>      >> >  Is it safe to perform an apt-get autoremove?
>      >> >
>      >> > Please help an overstressed dad enjoy his vacation trip to
>     Disney with
>      >> his
>      >> > wife and kids.  I promise I won't go installing packages all willy
>      >> nilly
>      >> > in
>      >> > the future.
>      >> >
>      >> >
>      >> > Thanks
>      >> >
>      >> >
>      >> > Willem
>      >> > _______________________________________________
>      >> > postgis-users mailing list
>      >> > postgis-users at lists.osgeo.org
>     <mailto:postgis-users at lists.osgeo.org>
>      >> > http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
>      >>
>      >>
>      >> _______________________________________________
>      >> postgis-users mailing list
>      >> postgis-users at lists.osgeo.org <mailto:postgis-users at lists.osgeo.org>
>      >> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
>      >>
>      >
>
>
>     _______________________________________________
>     postgis-users mailing list
>     postgis-users at lists.osgeo.org <mailto:postgis-users at lists.osgeo.org>
>     http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
>
>
>
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
>



More information about the postgis-users mailing list