Skip to main content
Topic solved
This topic has been marked as solved and requires no further attention.
Topic: [SOLVED] Dovecot fails to run as a dinit service (Read 734 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

[SOLVED] Dovecot fails to run as a dinit service

Recently I noticed that I can't access my mails through IMAP. As it turns out, dovecot service fails to start, leaving only this error message in dinit's log:
Code: [Select]
Fatal: t_binary_abspath(dovecot) failed: PATH environment variable undefined
Though when manually run from shell, it works just fine. I tried to disable the service, remove and reinstall it, but to no avail. I'm baffled.

Re: Dovecot fails to run as a dinit service

Reply #1
Is there a way you can set environment variables in dinit service files?

Re: Dovecot fails to run as a dinit service

Reply #2
There is. Infact, dovecot does have its own run script in /etc/dinit.d/scripts . Do I set the PATH there? To what value?

Re: Dovecot fails to run as a dinit service

Reply #3
Found the appropriate code in dovecot:
Code: [Select]
	} else if ((path_env = getenv("PATH")) != NULL) {
/* we have to find our executable from path */
path = t_str_new(256);
paths = t_strsplit(path_env, ":");
for (; *paths != NULL; paths++) {
str_append(path, *paths);
str_append_c(path, '/');
str_append(path, *binpath);
if (access(str_c(path), X_OK) == 0) {
*binpath = str_c(path);
return TRUE;
}
str_truncate(path, 0);
}
*error_r = "Could not find the wanted executable from PATH";
return FALSE;
} else {
*error_r = "PATH environment variable undefined";
return FALSE;
}

So yes, for some reason when started from a dinit service file, PATH is not set.

>Do I set the PATH there? To what value?

To your standard locations like /usr/bin and /usr/sbin

Re: Dovecot fails to run as a dinit service

Reply #4
PATH variable should not be undefined in first place
Edit: switch to root user, then run
Code: [Select]
echo $PATH

check does it give output
Create problems which don't have solution

 

Re: Dovecot fails to run as a dinit service

Reply #5
adding export PATH before exec dovecot -F fixed the problem. Still, it's strange it had to be fixed in the first place, when it used to 'just work'.

Re: Dovecot fails to run as a dinit service

Reply #6
adding export PATH before exec dovecot -F fixed the problem. Still, it's strange it had to be fixed in the first place, when it used to 'just work'.
Maybe an update on dinit broke it?

Re: Dovecot fails to run as a dinit service

Reply #7
Hard to tell. Anyway, for now the problem is solved. I'd like to mark it as such, but somehow that forum button is now missing... Oh well.

Re: [SOLVED] Dovecot fails to run as a dinit service

Reply #8
Maybe an update on dinit broke it?

I don't think there have been any recent updates to the Artix dinit packages (and I don't think there are any upstream changes that would cause this, though the environment handling has been reworked a little).