public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-user] emerge stuck after dovecot upgrade
@ 2020-05-21  4:44 Andreas Fink
  2020-05-21 10:20 ` Neil Bothwick
  0 siblings, 1 reply; 4+ messages in thread
From: Andreas Fink @ 2020-05-21  4:44 UTC (permalink / raw
  To: gentoo-user

Hello,
recently emerge started to get stuck after an upgrade of dovecot, and it is somehow
related to my /etc/portage/bashrc, which has the following content:
function post_pkg_postinst() {
    if test "$CATEGORY/$PN" = "dev-db/mariadb"; then
        /etc/init.d/mysql status && /etc/init.d/mysql restart
    elif test "$CATEGORY/$PN" = "www-servers/apache"; then
        /etc/init.d/apache2 status && /etc/init.d/apache2 restart
    elif test "$CATEGORY/$PN" = "net-mail/dovecot"; then
        /etc/init.d/dovecot status && /etc/init.d/dovecot restart
        echo 'going to sleep'
        sleep 5
        echo 'finished sleeping'
    elif test "$CATEGORY/$PN" = "mail-mta/postfix"; then
        /etc/init.d/postfix status && /etc/init.d/postfix restart
    elif test "$CATEGORY/$PN" = "net-misc/openssh"; then
        /etc/init.d/sshd status && /etc/init.d/sshd restart
    fi
}


I restart dovecot after an upgrade, in the same way as I restart e.g. postfix. However
for dovecot emerge gets stuck and does not continue and is sitting there quietly
(killable only via `pkill -9 emerge`). These are the last lines in my /var/log/emerge.log:
1590023821:  === (17 of 26) Post-Build Cleaning (net-dns/bind-tools-9.16.3::/usr/portage/net-dns/bind-tools/bind-tools-9.16.3.ebuild)
1590023821:  ::: completed emerge (17 of 26) net-dns/bind-tools-9.16.3 to /
1590023821:  >>> emerge (18 of 26) net-mail/dovecot-2.3.10.1 to /
1590023821:  === (18 of 26) Cleaning (net-mail/dovecot-2.3.10.1::/usr/portage/net-mail/dovecot/dovecot-2.3.10.1.ebuild)
1590023821:  === (18 of 26) Compiling/Packaging (net-mail/dovecot-2.3.10.1::/usr/portage/net-mail/dovecot/dovecot-2.3.10.1.ebuild)
1590024325:  === (18 of 26) Merging (net-mail/dovecot-2.3.10.1::/usr/portage/net-mail/dovecot/dovecot-2.3.10.1.ebuild)
1590024331:  >>> AUTOCLEAN: net-mail/dovecot:0
1590024331:  === Unmerging... (net-mail/dovecot-2.3.10)
1590024334:  >>> unmerge success: net-mail/dovecot-2.3.10

So it is missing the "Post-Build Cleaning" and the "completed emerge" line for dovecot.
Lokking into the temporary build directory of portage I can see see only a single file
being left (PORTAGE_TMPDIR="/home/portage/tmp):
/home/portage/tmp/portage/net-mail/.dovecot-2.3.10.1.portage_lockfile
There are no build artifacts left, it's clean and empty, only the lockfile is still there.

Restarting the upgrade process with `emerge -auvDN @world` wouldn't retry to upgrade
dovecot, so I guess it actually got merged and registered as being successfully merged.

I'm kind of lost, why upgrading dovecot gets emerge stuck, but upgrading e.g. openssh or
postfix works correctly and the services are being restarted the same way as dovecot in
/etc/portage/bashrc.

One last note, doing the merge manually with the commands
ebuild /path/to/dovecot.ebuild compile
ebuild /path/to/dovecot.ebuild install
ebuild /path/to/dovecot.ebuild qmerge
will get stuck in the qmerge step, but it is killable with a regular SIGINT/SIGTERM.

Any ideas how I can debug this any further? I assume that emerge is waiting for some
children and the forking in dovecot is different than in openssh, but I'm unsure how I
can debug this. I even tried to background everything like this:
    /etc/init.d/dovecot status && ( ( bash -c '/etc/init.d/dovecot restart &' ) & )

The last successful full upgrade of dovecot was
2020-03-21T14:06:21 >>> net-mail/dovecot-2.3.10: 7 minutes, 15 seconds
The first failed full merge was on April 30th and last night again.

After that portage has been updated to these versions:
2020-03-21T11:15:55 >>> sys-apps/portage-2.3.94: 48 seconds
2020-03-23T18:30:34 >>> sys-apps/portage-2.3.95: 56 seconds
2020-03-26T05:37:17 >>> sys-apps/portage-2.3.96-r1: 47 seconds
2020-03-28T04:23:23 >>> sys-apps/portage-2.3.96-r1: 43 seconds
2020-04-09T10:00:41 >>> sys-apps/portage-2.3.97: 48 seconds
2020-04-11T09:39:30 >>> sys-apps/portage-2.3.98-r1: 43 seconds
2020-04-13T07:05:40 >>> sys-apps/portage-2.3.99-r1: 48 seconds
2020-04-22T03:15:44 >>> sys-apps/portage-2.3.99-r2: 44 seconds
2020-05-01T03:50:56 >>> sys-apps/portage-2.3.99-r2: 57 seconds
2020-05-07T13:44:14 >>> sys-apps/portage-2.3.99-r2: 42 seconds

Any help is appreciated :)
Cheers
Andreas


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [gentoo-user] emerge stuck after dovecot upgrade
  2020-05-21  4:44 [gentoo-user] emerge stuck after dovecot upgrade Andreas Fink
@ 2020-05-21 10:20 ` Neil Bothwick
  2020-05-21 11:54   ` Neil Bothwick
  0 siblings, 1 reply; 4+ messages in thread
From: Neil Bothwick @ 2020-05-21 10:20 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 1563 bytes --]

On Thu, 21 May 2020 06:44:35 +0200, Andreas Fink wrote:

> recently emerge started to get stuck after an upgrade of dovecot, and
> it is somehow related to my /etc/portage/bashrc, which has the
> following content: function post_pkg_postinst() {
>     if test "$CATEGORY/$PN" = "dev-db/mariadb"; then
>         /etc/init.d/mysql status && /etc/init.d/mysql restart
>     elif test "$CATEGORY/$PN" = "www-servers/apache"; then
>         /etc/init.d/apache2 status && /etc/init.d/apache2 restart
>     elif test "$CATEGORY/$PN" = "net-mail/dovecot"; then
>         /etc/init.d/dovecot status && /etc/init.d/dovecot restart
>         echo 'going to sleep'
>         sleep 5
>         echo 'finished sleeping'
>     elif test "$CATEGORY/$PN" = "mail-mta/postfix"; then
>         /etc/init.d/postfix status && /etc/init.d/postfix restart
>     elif test "$CATEGORY/$PN" = "net-misc/openssh"; then
>         /etc/init.d/sshd status && /etc/init.d/sshd restart
>     fi
> }
> 
> 
> I restart dovecot after an upgrade, in the same way as I restart e.g.
> postfix. However for dovecot emerge gets stuck and does not continue
> and is sitting there quietly (killable only via `pkill -9 emerge`).

I can confirm this. I tried your bashrc (nice idea by the way, I normally
manually run needrestart after an update) and the dovecot install
completed but then hung. The next step is to add set +x to bashrc to see
where the hang occurs.


-- 
Neil Bothwick

Walking on water and writing software to specification is easy if they're
frozen.

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [gentoo-user] emerge stuck after dovecot upgrade
  2020-05-21 10:20 ` Neil Bothwick
@ 2020-05-21 11:54   ` Neil Bothwick
  2020-05-21 14:44     ` Andreas Fink
  0 siblings, 1 reply; 4+ messages in thread
From: Neil Bothwick @ 2020-05-21 11:54 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 2177 bytes --]

On Thu, 21 May 2020 11:20:18 +0100, Neil Bothwick wrote:

> On Thu, 21 May 2020 06:44:35 +0200, Andreas Fink wrote:
> 
> > recently emerge started to get stuck after an upgrade of dovecot, and
> > it is somehow related to my /etc/portage/bashrc, which has the
> > following content: function post_pkg_postinst() {
> >     if test "$CATEGORY/$PN" = "dev-db/mariadb"; then
> >         /etc/init.d/mysql status && /etc/init.d/mysql restart
> >     elif test "$CATEGORY/$PN" = "www-servers/apache"; then
> >         /etc/init.d/apache2 status && /etc/init.d/apache2 restart
> >     elif test "$CATEGORY/$PN" = "net-mail/dovecot"; then
> >         /etc/init.d/dovecot status && /etc/init.d/dovecot restart
> >         echo 'going to sleep'
> >         sleep 5
> >         echo 'finished sleeping'
> >     elif test "$CATEGORY/$PN" = "mail-mta/postfix"; then
> >         /etc/init.d/postfix status && /etc/init.d/postfix restart
> >     elif test "$CATEGORY/$PN" = "net-misc/openssh"; then
> >         /etc/init.d/sshd status && /etc/init.d/sshd restart
> >     fi
> > }
> > 
> > 
> > I restart dovecot after an upgrade, in the same way as I restart e.g.
> > postfix. However for dovecot emerge gets stuck and does not continue
> > and is sitting there quietly (killable only via `pkill -9 emerge`).  
> 
> I can confirm this. I tried your bashrc (nice idea by the way, I
> normally manually run needrestart after an update) and the dovecot
> install completed but then hung. The next step is to add set +x to
> bashrc to see where the hang occurs.

It seems the final echo is executed, but then the function doesn't exit
for some reason. I tried rewriting it using case, which looks cleaner to
me but fails in the same way.


function post_pkg_postinst() {
	set +x
	case "$CATEGORY/$PN" in
		"net-mail/dovecot")
			/etc/init.d/dovecot status && /etc/init.d/dovecot restart
			echo 'going to sleep'
			sleep 5
			echo 'finished sleeping'
			;;
			
		"mail-mta/postfix")
			/etc/init.d/postfix status && /etc/init.d/postfix restart
			;;
		esac
}


-- 
Neil Bothwick

Vuja De: the feeling that you've never been here before.

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [gentoo-user] emerge stuck after dovecot upgrade
  2020-05-21 11:54   ` Neil Bothwick
@ 2020-05-21 14:44     ` Andreas Fink
  0 siblings, 0 replies; 4+ messages in thread
From: Andreas Fink @ 2020-05-21 14:44 UTC (permalink / raw
  To: gentoo-user

On Thu, 21 May 2020 12:54:49 +0100
Neil Bothwick <neil@digimed.co.uk> wrote:

> On Thu, 21 May 2020 11:20:18 +0100, Neil Bothwick wrote:
>
> > On Thu, 21 May 2020 06:44:35 +0200, Andreas Fink wrote:
> >
> > > recently emerge started to get stuck after an upgrade of dovecot, and
> > > it is somehow related to my /etc/portage/bashrc, which has the
> > > following content: function post_pkg_postinst() {
> > >     if test "$CATEGORY/$PN" = "dev-db/mariadb"; then
> > >         /etc/init.d/mysql status && /etc/init.d/mysql restart
> > >     elif test "$CATEGORY/$PN" = "www-servers/apache"; then
> > >         /etc/init.d/apache2 status && /etc/init.d/apache2 restart
> > >     elif test "$CATEGORY/$PN" = "net-mail/dovecot"; then
> > >         /etc/init.d/dovecot status && /etc/init.d/dovecot restart
> > >         echo 'going to sleep'
> > >         sleep 5
> > >         echo 'finished sleeping'
> > >     elif test "$CATEGORY/$PN" = "mail-mta/postfix"; then
> > >         /etc/init.d/postfix status && /etc/init.d/postfix restart
> > >     elif test "$CATEGORY/$PN" = "net-misc/openssh"; then
> > >         /etc/init.d/sshd status && /etc/init.d/sshd restart
> > >     fi
> > > }
> > >
> > >
> > > I restart dovecot after an upgrade, in the same way as I restart e.g.
> > > postfix. However for dovecot emerge gets stuck and does not continue
> > > and is sitting there quietly (killable only via `pkill -9 emerge`).
> >
> > I can confirm this. I tried your bashrc (nice idea by the way, I
> > normally manually run needrestart after an update) and the dovecot
> > install completed but then hung. The next step is to add set +x to
> > bashrc to see where the hang occurs.
>
> It seems the final echo is executed, but then the function doesn't exit
> for some reason. I tried rewriting it using case, which looks cleaner to
> me but fails in the same way.
>
>
> function post_pkg_postinst() {
> 	set +x
> 	case "$CATEGORY/$PN" in
> 		"net-mail/dovecot")
> 			/etc/init.d/dovecot status && /etc/init.d/dovecot restart
> 			echo 'going to sleep'
> 			sleep 5
> 			echo 'finished sleeping'
> 			;;
>
> 		"mail-mta/postfix")
> 			/etc/init.d/postfix status && /etc/init.d/postfix restart
> 			;;
> 		esac
> }
>
>

I do not think that it is stuck in the bashrc itself, but something that happens in the
bashrc makes the emerge python process not realizing that everything finished. These are
the interesting running processes after the command
`ebuild /usr/portage/net-mail/dovecot/dovecot-2.3.10.1.ebuild qmerge`
gets stuck (I cannot see any bash still running, that's why I assume that the bashrc itself finishes):
root      5281  2.0  0.7  71060 63412 pts/0    SN+  16:19   0:01 /usr/bin/python3.7 -b /usr/lib/python-exec/python3.7/ebuild /usr/portage/net-mail/dovecot/dovecot-2.3.10.1.ebuild qmerge
root      5286  8.5  0.0      0     0 pts/0    ZN+  16:19   0:06 [ebuild] <defunct>
root      5869  0.0  0.0   4284  2388 ?        SNs  16:19   0:00 /usr/sbin/dovecot -c /etc/dovecot/dovecot.conf
root      5876  0.0  0.0   4152  2620 ?        SN   16:19   0:00 dovecot/log
root      5879  0.0  0.0   6236  4568 ?        SN   16:19   0:00 dovecot/config
root      5883  0.0  0.0  19632  8048 ?        SN   16:19   0:00 dovecot/auth

Cheers
Andreas


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-05-21 14:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-21  4:44 [gentoo-user] emerge stuck after dovecot upgrade Andreas Fink
2020-05-21 10:20 ` Neil Bothwick
2020-05-21 11:54   ` Neil Bothwick
2020-05-21 14:44     ` Andreas Fink

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox