LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 10-18-2019, 10:24 AM   #1
Mig21
Member
 
Registered: Jan 2005
Posts: 263

Rep: Reputation: 45
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.

Thanks in advance.
 
Old 10-18-2019, 10:31 AM   #2
ponce
LQ Guru
 
Registered: Aug 2004
Location: Pisa, Italy
Distribution: Slackware
Posts: 7,140

Rep: Reputation: 4208Reputation: 4208Reputation: 4208Reputation: 4208Reputation: 4208Reputation: 4208Reputation: 4208Reputation: 4208Reputation: 4208Reputation: 4208Reputation: 4208
try
Code:
sudo -i touch /etc/environment
or, if you prefer, as root
Code:
touch /etc/environment
sudo shouldn't show any warning after that...

for details see
https://www.linuxquestions.org/quest...ml#post6047733
https://www.linuxquestions.org/quest...ml#post6047879

Last edited by ponce; 10-18-2019 at 10:33 AM.
 
Old 10-18-2019, 10:49 AM   #3
Mig21
Member
 
Registered: Jan 2005
Posts: 263

Original Poster
Rep: Reputation: 45
That worked, thanks. I hope having it there won't cause any unexpected consequences.
 
Old 10-18-2019, 01:53 PM   #4
TheRealGrogan
Member
 
Registered: Oct 2010
Location: Ontario, Canada
Distribution: Slackware, LFS, Manjaro (for gaming)
Posts: 570

Rep: Reputation: 413Reputation: 413Reputation: 413Reputation: 413Reputation: 413
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.
 
Old 10-18-2019, 03:40 PM   #5
ivandi
Member
 
Registered: Jul 2009
Location: Québec, Canada
Distribution: CRUX, Debian
Posts: 528

Rep: Reputation: 866Reputation: 866Reputation: 866Reputation: 866Reputation: 866Reputation: 866Reputation: 866
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
 
Old 10-18-2019, 08:31 PM   #6
upnort
Senior Member
 
Registered: Oct 2014
Distribution: Slackware
Posts: 1,893

Rep: Reputation: 1162Reputation: 1162Reputation: 1162Reputation: 1162Reputation: 1162Reputation: 1162Reputation: 1162Reputation: 1162Reputation: 1162
In 14.2 Pat rendered the issue moot:

Code:
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.
 
Old 10-19-2019, 04:53 AM   #7
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,922

Rep: Reputation: 5040Reputation: 5040Reputation: 5040Reputation: 5040Reputation: 5040Reputation: 5040Reputation: 5040Reputation: 5040Reputation: 5040Reputation: 5040Reputation: 5040
Quote:
Originally Posted by ivandi View Post
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.

Last edited by GazL; 10-19-2019 at 06:59 AM.
 
Old 10-19-2019, 10:21 AM   #8
Mig21
Member
 
Registered: Jan 2005
Posts: 263

Original Poster
Rep: Reputation: 45
Quote:
Originally Posted by upnort View Post
In 14.2 Pat rendered the issue moot:

Code:
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?
 
Old 10-19-2019, 10:27 AM   #9
bassmadrigal
LQ Guru
 
Registered: Nov 2003
Location: West Jordan, UT, USA
Distribution: Slackware
Posts: 8,792

Rep: Reputation: 6657Reputation: 6657Reputation: 6657Reputation: 6657Reputation: 6657Reputation: 6657Reputation: 6657Reputation: 6657Reputation: 6657Reputation: 6657Reputation: 6657
Quote:
Originally Posted by Mig21 View Post
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).
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
deny sudo -s/ sudo -i command in linux with /etc/sudoers gbcbooks Linux - Security 35 02-18-2017 10:28 PM
[SOLVED] Kdenlive complaining about missing libdv module though it is installed kikinovak Slackware 2 12-03-2016 11:41 AM
libssh2 failed to compile complaining missing libgcrypt aherrys Slackware 7 05-20-2015 06:28 AM
LXer: The Ultimate Sudo FAQ — To Sudo Or Not To Sudo? LXer Syndicated Linux News 13 04-13-2013 01:36 AM
kate complaining about KAccel missing (KDE 3.2) Siemen Mandriva 1 02-21-2005 08:43 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 02:20 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration