Unable to open env file

Since a couple of weeks I'm getting a very strange error in my logs:
> Sep 23 16:02:43 tufus CRON[2444]: pam_env(cron:setcred): Unable to open env file: /etc/environment: No such file or directory

Sep 23 16:09:04 tufus CRON[3554]: pam_env(cron:setcred): Unable to open env file: /etc/environment: No such file or directory

Sep 23 16:09:04 tufus CRON[3554]: pam_env(cron:setcred): Unable to open env file: /etc/environment: No such file or directory

Sep 23 16:12:01 tufus CRON[3599]: pam_env(cron:setcred): Unable to open env file: /etc/environment: No such file or directory

Sep 23 16:12:02 tufus CRON[3599]: pam_env(cron:setcred): Unable to open env file: /etc/environment: No such file or directory

Sep 23 16:17:01 tufus CRON[3660]: pam_env(cron:setcred): Unable to open env file: /etc/environment: No such file or directory

Sep 23 16:17:01 tufus CRON[3662]: pam_env(cron:setcred): Unable to open env file: /etc/environment: No such file or directory

Sep 23 16:17:01 tufus CRON[3660]: pam_env(cron:setcred): Unable to open env file: /etc/environment: No such file or directory

Sep 23 16:17:03 tufus CRON[3662]: pam_env(cron:setcred): Unable to open env file: /etc/environment: No such file or directory

Sep 23 16:26:01 tufus CRON[3775]: pam_env(cron:setcred): Unable to open env file: /etc/environment: No such file or directory

Sep 23 16:26:02 tufus CRON[3775]: pam_env(cron:setcred): Unable to open env file: /etc/environment: No such file or directory

Sep 23 16:39:02 tufus CRON[4007]: pam_env(cron:setcred): Unable to open env file: /etc/environment: No such file or directory

Sep 23 16:39:02 tufus CRON[4007]: pam_env(cron:setcred): Unable to open env file: /etc/environment: No such file or directory

Sep 23 16:40:01 tufus CRON[4022]: pam_env(cron:setcred): Unable to open env file: /etc/environment: No such file or directory

Sep 23 16:40:04 tufus CRON[4022]: pam_env(cron:setcred): Unable to open env file: /etc/environment: No such file or directory

Sep 23 17:02:05 tufus CRON[4146]: pam_env(cron:setcred): Unable to open env file: /etc/environment: No such file or directory What can I do to solve the problem? :roll:

6 Replies

This is my root cron, so the error happens everytime a cron is started? > # m h dom mon dow command

12 * * * * perl /var/www/awstats.tufus.info/web/cgi-bin/awstats.pl -update -config=5ib2.be >> /dev/null 2>&1

17 * * * * perl /var/www/awstats.tufus.info/web/cgi-bin/awstats.pl -update -config=tufus.info >> /dev/null 2>&1

40 * * * * perl /var/www/awstats.tufus.info/web/cgi-bin/awstats.pl -update -config=saai.be >> /dev/null 2>&1

26 * * * * perl /var/www/awstats.tufus.info/web/cgi-bin/awstats.pl -update -config=gottasport.com >> /dev/null 2>&1

  • 5 * * * /usr/bin/php5-cgi /var/www/saai.be/cron-dagelijks.php >> /dev/null 2>&1

09 00 * * Sun rm /var/www/cache// -d -r

Which distro are you using? Debian?

It sounds to me like cron is looking for /etc/environment, so that it has things like PATH when it runs your cron jobs.

I don't have the file on my debian stable linode, and cron works fine for me. But according to this thread at google groups, debian installers have been creating the file since 2002 or so:

http://tinyurl.com/3y93mo

That thread also says that the problem surfaced after upgrading PAM stuff to the packages in testing. I think it's a recent thing.

On my ubuntu box at home, the /etc/environment file is:

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11:/usr/games"
LANG="en_US.UTF-8"

Here's the ownership and permission info:

-rw-r--r-- 1 root root 111 2007-04-15 11:15 /etc/environment

Maybe this is something wonky in the default linode debian install.

Thanks for your reply! Yes, I'm running Debian Unstable (Lenny?).

My installation is from a date later then 2002, so it's very strange the file is missing. I will try to make the file manual. I leave the LANG attribute, I read that that's saved somewhere else now.

I checked all the directory's, and I have them all. Also the X11 and the games directory :?. So now I created a file like this:
> PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11:/usr/games" I let you know what it does.

Problem solved :P.

I will try to remove the PATH, so with an emty file, but now it's working. Thanks!

@tofu:

Thanks for your reply! Yes, I'm running Debian Unstable (Lenny?).

FWIW, Lenny is the current testing branch. The unstable branch is, and will always be known as, Sid.

Thanks for that information.

I said Lenny because phpSysInfo told me that :wink:. But I see it's also speaking about Sid.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct