Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I can not run mu index when mu4e/mu-server #8

Closed
semente opened this issue Mar 23, 2012 · 11 comments
Closed

I can not run mu index when mu4e/mu-server #8

semente opened this issue Mar 23, 2012 · 11 comments

Comments

@semente
Copy link

semente commented Mar 23, 2012

I currently run offlineimap from cron and just after mu index, but I receive the following message when I have mu4e opened:

mu: mu_store_new_writable: xapian error 'Unable to get write lock on ~/.mu/xapian: already locked'

There is no way to let the user run mu index when the mu-server is running?

Thanks and thanks for mu/mu4e. It is everything I was looking for!

@djcb
Copy link
Owner

djcb commented Mar 24, 2012

The underlying database (Xapian) can be opened in read/write-mode only once... To prevent this error, you can either retrieve your mail from within mu4e (ie., 'U' in the main view), or in your cron script put something like:

pkill -2 -u $UID mu

This will sent a SIGINT to the mu process, which will then terminate gracefully. Mu4e will automatically restart mu when it is needed again (of course, you can still only have one mu at the same time, but in practice it works quite well).

@djcb djcb closed this as completed Mar 24, 2012
@semente
Copy link
Author

semente commented May 25, 2012

Just a important note for the readers:

The full command set to it work fine is:

pkill -2 -u $UID mu
sleep 1
mu index

The 1 second delay was needed for me. ;-)

@MassimoLauria
Copy link

Hi Dirk-Jan,

I have a similar problem, and of course your answer clarify everything. But my setup is a little bit different:
I make offlineimap+mu run in background. But when I launch mu4e the lock is taken and mu update does not work anymore. I have to update the db manually, which is not nice (make the email reading not interactive). Is it possible to force mu4e to open the xapian database read only, and let the offlineimap daemon to run mu index?

Thank you.

@djcb
Copy link
Owner

djcb commented Oct 20, 2013

That's not possible...mu4e cannot do its job when it cannot write the database.

However, what you can do is either the pkill trick mentioned above, or in your background script check for a running mu and if there is already, let mu4e handle indexing.

@tituomin
Copy link

tituomin commented May 10, 2017

Just a tip: if you have an Emacs daemon running, you can index with mu4e using the following shell command:

emacsclient -e '(mu4e-update-index)'

@edumerco
Copy link

@shackra
Copy link

shackra commented Mar 6, 2018

I was doing what @tituomin writes and from version 1.x of mu I cannot even run mu4e on Emacs.

error in process sentinel: mu4e~proc-sentinel: Database is locked by another process
error in process sentinel: Database is locked by another process

Running pkill -2 -u $UID mu on a console and then trying again yields the same result.

I swear I haven't touch my configuration of mu for Emacs or the configuration of my goimapnotify (nor touched the source code in months) and after the update to 1.x mu have been showing such behavior.

shackra added a commit to shackra/emacs that referenced this issue Mar 6, 2018
La versión 1.x de mu4e rompió mi flujo de trabajo

- djcb/mu#8 (comment)
@LeeiFrankJaw
Copy link

I assume that if mu server is running then Emacs is also running (mu server is started by mu4e) and Emacs server is enabled. And my way to solve the problem is the following.

#!/usr/bin/env bash
if pgrep -f 'mu server'; then
    emacsclient -e '(mu4e-update-index)'
else
    mu index
fi

shackra added a commit to shackra/emacs that referenced this issue Jun 17, 2018
@daphniz
Copy link

daphniz commented Aug 27, 2019

Any idea how to suppress the message resulting from mu4e-update-index?
For some reason, (let ((inhibit-message t)) (mu4e-update-index)) still shows it.

I assume that if mu server is running then Emacs is also running (mu server is started by mu4e) and Emacs server is enabled. And my way to solve the problem is the following.

#!/usr/bin/env bash
if pgrep -f 'mu server'; then
    emacsclient -e '(mu4e-update-index)'
else
    mu index

@ghost
Copy link

ghost commented Apr 26, 2020

Remove the ~/.mu and re-run mu index.

@M-Stenzel
Copy link

I assume that if mu server is running then Emacs is also running (mu server is started by mu4e) and Emacs server is enabled. And my way to solve the problem is the following.

#!/usr/bin/env bash
if pgrep -f 'mu server'; then
    emacsclient -e '(mu4e-update-index)'
else
    mu index
fi

Thank you,

but consider there is more than one person using mu4e simultaneously.
Then you have to check for "mu server" UID for this specific user.

Martin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants