Bug#693958: postgresql-common: Upgrade fails when /var/lib/postgres is a NFS mount point

2012-11-26 Thread Hugh Davenport
Package: postgresql-common
Version: 134wheezy2
Followup-For: Bug #693958

Hi,

Please find attached a patch

Cheers,

Hugh

*** postgresql-common-mount.patch
diff -Naur postgresql-common-134wheezy2/debian/postgresql-common.postinst 
postgresql-common-134wheezy2-new/debian/postgresql-common.postinst
--- postgresql-common-134wheezy2/debian/postgresql-common.postinst  
2012-10-04 09:18:46.0 +1300
+++ postgresql-common-134wheezy2-new/debian/postgresql-common.postinst  
2012-11-27 07:43:46.063087069 +1300
@@ -27,7 +27,9 @@
 
 # ensure home directory ownership
 mkdir -p /var/lib/postgresql
-chown postgres:postgres /var/lib/postgresql
+su - postgres -c test -O /var/lib/postgresql 
+test -G /var/lib/postgresql || \
+chown postgres:postgres /var/lib/postgresql
 
 # nicer log directory permissions
 mkdir -p /var/log/postgresql


-- System Information:
Debian Release: wheezy/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 3.2.0-3-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_NZ.UTF-8, LC_CTYPE=en_NZ.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages postgresql-common depends on:
ii  adduser   3.113+nmu3
ii  debconf [debconf-2.0] 1.5.46
ii  logrotate 3.8.1-4
ii  lsb-base  4.1+Debian8
ii  postgresql-client-common  134wheezy2
ii  procps1:3.3.3-2
ii  ssl-cert  1.0.32

postgresql-common recommends no packages.

postgresql-common suggests no packages.

-- Configuration Files:
/etc/sysctl.d/30-postgresql-shm.conf changed:
kernel.shmmax = 147431424


-- debconf information:
  postgresql-common/obsolete-major:


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#693958: postgresql-common: Upgrade fails when /var/lib/postgres is a NFS mount point

2012-11-22 Thread Hugh Davenport
Package: postgresql-common
Version: 134wheezy2
Severity: important

Hi,

I was upgrading my system, and postgresql-common failed to configure with the
following error:

Setting up postgresql-common (134wheezy2) ...
chown: changing ownership of `/var/lib/postgresql': Operation not permitted
dpkg: error processing postgresql-common (--configure):
 subprocess installed post-installation script returned error exit status 1

My /var/lib/postgresql is a NFS mount point, with the following options:

box:/srv/nfs/gum/postgresql/ on /var/lib/postgresql type nfs 
(rw,relatime,vers=3,rsize=65536,wsize=65536,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=10.0.1.3,mountvers=3,mountport=32767,mountproto=udp,local_lock=none,addr=10.0.1.3)

If I unmount the /var/lib/postgresql before upgrading, then I get this error:
Setting up postgresql-common (134wheezy2) ...
/bin/df: `/var/lib/postgresql/9.1/main': No such file or directory
/bin/df: no file systems processed
[] Starting PostgreSQL 9.1 database server: main[] Error: 
/var/lib/postg[FAIL/9.1/main is not accessible or does not exist ... failed!
 failed!
invoke-rc.d: initscript postgresql, action start failed.
dpkg: error processing postgresql-common (--configure):
 subprocess installed post-installation script returned error exit status 1


For the first error, having a look at what it is doing, it seems it is does a
 chown postgres:postgres /var/lib/postgresql
on line 30 of debian/postgresql-common.postinst
I think this should first check what the permissions of that directory are and
only do a chown if they are not correct.

As for second error, I would expect that if no database is present, but I
included it in the report just in case.

Cheers,

Hugh

-- System Information:
Debian Release: wheezy/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 3.2.0-3-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_NZ.UTF-8, LC_CTYPE=en_NZ.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages postgresql-common depends on:
ii  adduser   3.113+nmu3
ii  debconf [debconf-2.0] 1.5.46
ii  logrotate 3.8.1-4
ii  lsb-base  4.1+Debian8
ii  postgresql-client-common  134wheezy2
ii  procps1:3.3.3-2
ii  ssl-cert  1.0.32

postgresql-common recommends no packages.

postgresql-common suggests no packages.

-- Configuration Files:
/etc/sysctl.d/30-postgresql-shm.conf changed:
kernel.shmmax = 147431424


-- debconf information:
  postgresql-common/obsolete-major:


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org