[Pkg-emacsen-addons] Bug#886024: Bug#886024: emacs deb package install is hanging forever (locked file)

H.-Dirk Schmitt dirk at computer42.org
Tue Jan 2 05:06:24 UTC 2018

The problem occurs with  emacs24  24.5+1-8 

I don't think that the problem is specifi
The from
> dirk at computer42.org (H.-Dirk Schmitt) writes:
> > 
> > > Wrote /root/.breadcrumb …ing-c-adaptive-history locked by root at vt
> > > -xenia… (pid 5423): (s, q, p, ?)?
> If you have it, the complete, unedited prompt/error-message would be
> helpful.

As written in the report, no error message is shown during normally
processing with apt-get or dpkg.

The error message was only shown by manually invoke:
`emacs24 -q -batch -l package --eval (add-to-list 'package-directory-
list "/usr/share/emacs/site-lisp/elpa-src") -f package-initialize -f
batch-byte-compile markdown-mode-autoloads.el markdown-mode-pkg.el

As I understand the problem is that the elisp install procedure is
flawed.  I experienced the problem here with elpa-markdown-mode 2.1-1,
but think the problem is related to many elisp packages following the
same installation pattern.

The problem chain I debugged was:
- /var/lib/dpkg/info/elpa-markdown-mode.postinst
-  \
  --postinst elpa-markdown-mode
- /usr/lib/emacsen-common/packages/install/elpa-markdown-mode
-  ${FLAVOR} -q -batch -l package \
    --eval "(add-to-list 'package-directory-list \"$src_dir\")" \
    -f package-initialize -f batch-byte-compile *.el > Install.log 2>&1

The last statement assume that emacs will process the --eval … stuff,
but here comes the race condition, that emacs found a locked file from
a dirty exited emacs session (e.g. reboot occurred).

So the non-interactive script is waiting for the user to answer the
question what to do with the locked file.
Due to the redirection to the „Install.log“ nothing is visible for the
user and no answer is generated. So the installation process is hanging
  for this and all future call of apt-get/dpkg.

The root cause – the locked file - is outside the scope of the emacs
packages, so a „purge and reinstall“ approach will fail and the
situation will break the whole debian/ubuntu/… package update
processing till the next time emacs is invoked by root as „interactive“

A first mitigation of the problem could be to replace the 
'&> Install.log' redirection by '|& tee Install.log' 

In this case the 'locked by root@…' message will be visible to the
admin user who called 'apt-get/dpkg'.

More information about the Pkg-emacsen-addons mailing list