Discussion:
[Erp5-dev] ERP5's deb package does not rebuild /home/erp5 in case of total removal of /home/erp5
Tadeus Prastowo
2009-09-16 10:19:16 UTC
Permalink
Hi Ho!

I upgraded my Hardy to Jaunty using Update Manager. In my Hardy, I had
got ERP5 installation that I hadn't used because of the already-fixed
problem mentioned in
http://mail.nexedi.com/pipermail/erp5-dev/2009-September/002292.html

After the upgrade, I purged ERP5 from my system and deleted /home/erp5
to start everything from scratch. My erp5.list in
my /etc/apt/sources.list.d is as follows:

--- 8< ---------------
deb http://10.0.0.51:3142/erp5.raskon.org/apt jaunty main
deb-src http://10.0.0.51:3142/erp5.raskon.org/apt jaunty main
--- 8< ---------------

Doing sudo aptitude install erp5-buildout ended with the following error message:

--- 8< ---------------
Setting up erp5-buildout (0.8jaunty1) ...
abort: No such file or directory: /home/erp5/erp5-buildout
dpkg: error processing erp5-buildout (--configure):
subprocess post-installation script returned error exit status 255
Processing triggers for python-support ...
Processing triggers for libc6 ...
ldconfig deferred processing now taking place
Processing triggers for menu ...
Errors were encountered while processing:
erp5-buildout
E: Sub-process /usr/bin/dpkg returned an error code (1)
A package failed to install. Trying to recover:
Setting up erp5-buildout (0.8jaunty1) ...
abort: No such file or directory: /home/erp5/erp5-buildout
dpkg: error processing erp5-buildout (--configure):
subprocess post-installation script returned error exit status 255
Errors were encountered while processing:
erp5-buildout
--- 8< ---------------

Well, I solved this problem by manually pulling out erp5-buildout from
the repository at https://www.raskon.org/hg as follows:

sudo mkdir /home/erp5/
sudo chown erp5:erp5 /home/erp5
cd /home/erp5
sudo -u erp5 hg clone https://www.raskon.org/hg/erp5-buildout

After that, entering `sudo aptitude install erp5-buildout' completes the
installation phase.

The same problem also appears on Hardy if I try to reinstall
erp5-buildout after I purged erp5-buildout and removed /home/erp5.

The error, however, does not appear if I start with a fresh installation
of Hardy or Jaunty. Restarting the system does not help.

After some investigation, I realized that "/home/erp5" is created by
"adduser". Since "sudo aptitude purge erp5-buildout" does not remove
erp5 user and group in "debian/postrm" script, it prevents "adduser"
from running in "debian/postinst" script, and therefore, no creation of
"/home/erp5".

This situation is annoying for users that somehow try to start the
installation of ERP5 from scratch by removing "/home/erp5" manually.
Therefore, I propose the attached patches. Only one of them needs to be
applied because patch1 fixes the problem in "debian/postinst" script
while patch2 fixes the problem in "debian/postrm" script. I myself
prefer patch2 to be applied since it is saner.

Best regards,
Eus

--------------------------------------
Free Software specialist and developer
of
PT. Vikasa Infinity Anugerah
--------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch1
Type: text/x-patch
Size: 738 bytes
Desc: not available
URL: <http://mail.tiolive.com/pipermail/erp5-dev/attachments/20090916/8b690cc1/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch2
Type: text/x-patch
Size: 516 bytes
Desc: not available
URL: <http://mail.tiolive.com/pipermail/erp5-dev/attachments/20090916/8b690cc1/attachment-0001.bin>
Tadeus Prastowo
2009-09-16 10:29:30 UTC
Permalink
Hi Ho!

Ops, sorry, I made a typo:

On Wed, 2009-09-16 at 17:19 +0700, Tadeus Prastowo wrote:

[snip]
Post by Tadeus Prastowo
This situation is annoying for users that somehow try to start the
installation of ERP5 from scratch by removing "/home/erp5" manually.
Therefore, I propose the attached patches. Only one of them needs to be
applied because patch1 fixes the problem in "debian/postinst" script
while patch2 fixes the problem in "debian/postrm" script. I myself
prefer patch2 to be applied since it is saner.
Please exchange "patch1" with "patch2" so that:

"Only one of them needs to be applied because patch2 fixes the problem
in "debian/postinst" script while patch1 fixes the problem in
"debian/postrm" script. I myself prefer patch1 to be applied since it is
saner."
--
Best regards,
Eus

--------------------------------------
Free Software specialist and developer
of
PT. Vikasa Infinity Anugerah
--------------------------------------
Tadeus Prastowo
2009-09-17 05:22:43 UTC
Permalink
Hi Ho!
Post by Tadeus Prastowo
Hi Ho!
I upgraded my Hardy to Jaunty using Update Manager. In my Hardy, I had
got ERP5 installation that I hadn't used because of the already-fixed
problem mentioned in
http://mail.nexedi.com/pipermail/erp5-dev/2009-September/002292.html
After the upgrade, I purged ERP5 from my system and deleted /home/erp5
to start everything from scratch. My erp5.list in
Removing user's home folder without removing user - bad workflow ( change
user's home folder needs too - see /etc/passwd ).
Yes, it is a bad workflow. I assumed that purging ERP5 had taken care of
removing erp5 user and group leaving the home folder intact. But, I am
pretty much mistaken ;-)
sudo rm -r /home/erp5/erp5-buildout
Good idea :-)

But, this doesn't dispel that some users may end up thinking that
purging ERP5 has taken care of removing the user and group.

[snip]
Post by Tadeus Prastowo
After some investigation, I realized that "/home/erp5" is created by
"adduser". Since "sudo aptitude purge erp5-buildout" does not remove
erp5 user and group in "debian/postrm" script, it prevents "adduser"
from running in "debian/postinst" script, and therefore, no creation of
"/home/erp5".
"sudo aptitude purge erp5-buildout" does not remove erp5 user and
group in "debian/postrm" script.
But, i do not sure what distribuion upgrade save my
/home/erp5/erp5-buildout/var (with gigabytes essential information )
in that case.
I think this kind of case also occurs for DB applications such as
PostgreSQL. ERP5's "debian/postrm" script can be modeled after that of
PostgreSQL.
Second part not to be issue: no creation of "/home/erp5".
It is an issue for users who thought that purging ERP5 takes care of
removing the user and group. How about if we just put a notification at
the end of purging ERP5 with ncurses interface like what some other
packages do (e.g., dbcommon) to save such users?
I explain: If system contain user and his home folder !='/nonexistent',
then folder whould be exist.
[snip]
Post by Tadeus Prastowo
--- postrm 2009-09-16 17:07:23.000000000 +0700
+++ debian/postrm 2009-09-16 17:09:38.000000000 +0700
@@ -21,12 +21,12 @@
case "$1" in
purge)
# remove zope user and group.
- # if getent passwd $erp5user > /dev/null 2>&1 ; then
- # userdel $erp5user
- # fi
- # if getent group $erp5group > /dev/null 2>&1 ; then
- # groupdel $erp5group
- # fi
+ if getent passwd $erp5user > /dev/null 2>&1 ; then
+ userdel $erp5user
userdel --remove $erp5user
for me seems better.
Does that mean that actually no user data is stored under /home/erp5
(i.e., all data is stored in the MySQL DB)?

If yes, that's the best move.

[snip]
http://mercurial.selenic.com/wiki/PatchbombExtension
Thank you for pointing this one out since I didn't know that before :-)

The mail for the revised patch will follow taking into account that all
user data is stored in MySQL DB instead of under /home/erp5.
--
Best regards,
Eus (Free Software specialist & developer of PT. Vikasa Infinity Anugerah)
Tadeus Prastowo
2009-09-18 02:34:54 UTC
Permalink
Hi Ho!
Post by Tadeus Prastowo
Post by Tadeus Prastowo
--- postrm 2009-09-16 17:07:23.000000000 +0700
+++ debian/postrm 2009-09-16 17:09:38.000000000 +0700
@@ -21,12 +21,12 @@
case "$1" in
purge)
# remove zope user and group.
- # if getent passwd $erp5user > /dev/null 2>&1 ; then
- # userdel $erp5user
- # fi
- # if getent group $erp5group > /dev/null 2>&1 ; then
- # groupdel $erp5group
- # fi
+ if getent passwd $erp5user > /dev/null 2>&1 ; then
+ userdel $erp5user
userdel --remove $erp5user
for me seems better.
Does that mean that actually no user data is stored under /home/erp5
(i.e., all data is stored in the MySQL DB)?
That wrong.
Mysql used for indexing only. Data stored in zodb.
Ah, okay. Thanks for pointing this out.
Post by Tadeus Prastowo
If yes, that's the best move.
If distro upgrade only delete not purge package, that's best move without "if".
Better than that, instead of relying on the behavior of distro upgrade,
let's just use the method that some other packages use that is either
notifying the user that /home/erp5 as well as erp5 user and group are
left intact as well as the consequence of having so or asking the user
whether s/he wants to keep, move or delete his/her data
under /home/erp5/erp5-buildout/var.

What do you think?
--
Best regards,
Tadeus Prastowo (Free Software specialist and developer)

i n f i n i t y . s o l u t i o n (www.infi-nity.com) - pt. vikasa
infinity anugrah
bsd city sektor 14 - ruko golden madrid g/9 - tangerang 15321 -
indonesia
t: +62 (21) 5316 4796 f: +62 (21) 5316 4797
Boris Kocherov
2009-09-18 19:11:38 UTC
Permalink
Post by Tadeus Prastowo
Hi Ho!
I upgraded my Hardy to Jaunty using Update Manager. In my Hardy, I had
got ERP5 installation that I hadn't used because of the already-fixed
problem mentioned in
http://mail.nexedi.com/pipermail/erp5-dev/2009-September/002292.html
After the upgrade, I purged ERP5 from my system and deleted /home/erp5
to start everything from scratch. My erp5.list in
Removing user's home folder without removing user - bad workflow ( change
user's home folder needs too - see /etc/passwd ).
If you want install erp5 from scratch, you can run:
sudo rm -r /home/erp5/erp5-buildout
Post by Tadeus Prastowo
--- 8< ---------------
deb http://10.0.0.51:3142/erp5.raskon.org/apt jaunty main
deb-src http://10.0.0.51:3142/erp5.raskon.org/apt jaunty main
--- 8< ---------------
--- 8< ---------------
Setting up erp5-buildout (0.8jaunty1) ...
abort: No such file or directory: /home/erp5/erp5-buildout
subprocess post-installation script returned error exit status 255
Processing triggers for python-support ...
Processing triggers for libc6 ...
ldconfig deferred processing now taking place
Processing triggers for menu ...
erp5-buildout
E: Sub-process /usr/bin/dpkg returned an error code (1)
Setting up erp5-buildout (0.8jaunty1) ...
abort: No such file or directory: /home/erp5/erp5-buildout
subprocess post-installation script returned error exit status 255
erp5-buildout
--- 8< ---------------
Well, I solved this problem by manually pulling out erp5-buildout from
sudo mkdir /home/erp5/
sudo chown erp5:erp5 /home/erp5
cd /home/erp5
sudo -u erp5 hg clone https://www.raskon.org/hg/erp5-buildout
After that, entering `sudo aptitude install erp5-buildout' completes the
installation phase.
The same problem also appears on Hardy if I try to reinstall
erp5-buildout after I purged erp5-buildout and removed /home/erp5.
The error, however, does not appear if I start with a fresh installation
of Hardy or Jaunty. Restarting the system does not help.
After some investigation, I realized that "/home/erp5" is created by
"adduser". Since "sudo aptitude purge erp5-buildout" does not remove
erp5 user and group in "debian/postrm" script, it prevents "adduser"
from running in "debian/postinst" script, and therefore, no creation of
"/home/erp5".
I agree, first part issue:
"sudo aptitude purge erp5-buildout" does not remove erp5 user and
group in "debian/postrm" script.
But, i do not sure what distribuion upgrade save my
/home/erp5/erp5-buildout/var (with gigabytes essential information )
in that case.


Second part not to be issue: no creation of "/home/erp5".
I explain: If system contain user and his home folder !='/nonexistent',
then folder whould be exist.
Post by Tadeus Prastowo
This situation is annoying for users that somehow try to start the
installation of ERP5 from scratch by removing "/home/erp5" manually.
Therefore, I propose the attached patches. Only one of them needs to be
applied because patch1 fixes the problem in "debian/postinst" script
while patch2 fixes the problem in "debian/postrm" script. I myself
prefer patch2 to be applied since it is saner.
Best regards,
Eus
--------------------------------------
Free Software specialist and developer
of
PT. Vikasa Infinity Anugerah
--------------------------------------
--- postrm 2009-09-16 17:07:23.000000000 +0700
+++ debian/postrm 2009-09-16 17:09:38.000000000 +0700
@@ -21,12 +21,12 @@
case "$1" in
purge)
# remove zope user and group.
- # if getent passwd $erp5user > /dev/null 2>&1 ; then
- # userdel $erp5user
- # fi
- # if getent group $erp5group > /dev/null 2>&1 ; then
- # groupdel $erp5group
- # fi
+ if getent passwd $erp5user > /dev/null 2>&1 ; then
+ userdel $erp5user
I aggree, but one note:
userdel --remove $erp5user
for me seems better.
Post by Tadeus Prastowo
+ fi
+ if getent group $erp5group > /dev/null 2>&1 ; then
+ groupdel $erp5group
+ fi
;;
remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
--- postinst 2009-09-16 17:01:31.000000000 +0700
+++ debian/postinst 2009-09-16 17:03:09.000000000 +0700
@@ -22,6 +22,7 @@
erp5homedir=`getent passwd $erp5user | cut -f 6 -d :`
erp5buildoutdir=$erp5homedir/erp5-buildout
erp5instance=$erp5buildoutdir/parts/instance
+ [ ! -d $erp5homedir ] && runfromerp5 mkdir $erp5homedir
As i see, it command do not work - user "erp5" do not have permission create /home/erp5
folder.
Post by Tadeus Prastowo
[ ! -d $erp5buildoutdir ] && runfromerp5 hg clone $erp5url $erp5buildoutdir
[ ! -d $erp5buildoutdir ] && exit 1
cd $erp5buildoutdir
Mercurial have very comfortable feature 'patchbomb' described on this page:
http://mercurial.selenic.com/wiki/PatchbombExtension
--
Crisis had come unexpectedly, just as winter comes unexpectedly to
Russia every year.
Loading...