Artix Linux Forum

Init systems => dinit => Topic started by: Everyone on 09 August 2022, 20:10:53

Title: [SOLVED] Dovecot fails to run as a dinit service
Post by: Everyone on 09 August 2022, 20:10:53
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.
Title: Re: Dovecot fails to run as a dinit service
Post by: Lancia on 09 August 2022, 21:32:22
Is there a way you can set environment variables in dinit service files?
Title: Re: Dovecot fails to run as a dinit service
Post by: Everyone on 10 August 2022, 12:01:00
There is. Infact, dovecot does have its own run script in /etc/dinit.d/scripts . Do I set the PATH there? To what value?
Title: Re: Dovecot fails to run as a dinit service
Post by: Lancia on 10 August 2022, 13:12:06
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
Title: Re: Dovecot fails to run as a dinit service
Post by: Arch_user on 10 August 2022, 13:30:20
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
Title: Re: Dovecot fails to run as a dinit service
Post by: Everyone on 10 August 2022, 19:08:38
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'.
Title: Re: Dovecot fails to run as a dinit service
Post by: Lancia on 10 August 2022, 20:54:10
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?
Title: Re: Dovecot fails to run as a dinit service
Post by: Everyone on 11 August 2022, 10:10:47
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.
Title: Re: [SOLVED] Dovecot fails to run as a dinit service
Post by: davmac on 11 August 2022, 11:50:48
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).