sudo started complaining about missing /etc/environment
SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
sudo started complaining about missing /etc/environment
Hello
I've had a cron job for years with these contents:
Code:
sudo -i -u spamd /usr/local/bin/sa-update
This morning I got an email from root saying:
Quote:
sudo: /etc/environment: No such file or directory
Luckily I remembered that I installed the sudo security update that was releases recently, using the package from the Slackware repository.
Now it looks like no matter what user I use or what command I run, I get the same warning:
Code:
sudo -i -u andrew ls /
sudo: /etc/environment: No such file or directory
bin dev git lib lost+found mnt proc root sbin svn tmp var
boot etc home lib64 media opt razor-agent.log run srv sys usr
I guess the sudo update contained more than just the required bugfix. Does anyone have suggestions for what I should do?
I have no idea what I would put in /etc/environment, and why it seems to be required but is not included by default.
It won't, as you just created a blank file. The -i switch sources root's environment, and I guess the new sudo expects that file to be there. It's yet another clever file for putting global environment variables in.
Fri Oct 18 21:00:50 UTC 2019
patches/packages/sudo-1.8.28p1-x86_64-2_slack14.2.txz: Rebuilt.
This is a bugfix release:
Ensure that /etc/environment exists to prevent complaints from "sudo -i".
Likewise in Current:
Code:
Fri Oct 18 21:00:50 UTC 2019
a/shadow-4.7-x86_64-2.txz: Rebuilt.
Added /etc/environment.new to fix "sudo -i" noise.
Careful observers might have noticed that /etc/environment has been since ages the standard way to set the environment using the pam_env.so module.
Cheers
It's also read by /bin/login, and su, even without PAM. Unfortunately, xdm doesn't read it without PAM, so it makes the environment a little inconsistent when PAM is absent. The xdm case is easy enough to fix, but I admit PAM makes things cleaner here.
If I remember rightly, on AIX, it's actually read by init and inherited from PID 1 by everything, which IMO, is a sensible way of handling a global environment.
Fri Oct 18 21:00:50 UTC 2019
patches/packages/sudo-1.8.28p1-x86_64-2_slack14.2.txz: Rebuilt.
This is a bugfix release:
Ensure that /etc/environment exists to prevent complaints from "sudo -i".
Likewise in Current:
Code:
Fri Oct 18 21:00:50 UTC 2019
a/shadow-4.7-x86_64-2.txz: Rebuilt.
Added /etc/environment.new to fix "sudo -i" noise.
Weird. How come I didn't have one then, having installed all the updates in 14.2?
Weird. How come I didn't have one then, having installed all the updates in 14.2?
That update was pushed late yesterday, several hours after your initial post. If you update again, it should create a new file and you would need to allow slackpkg to move it over (since you already have one, it would prompt you when it runs the new-config portion of slackpkg).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.