Bug 850

Summary: I can't edit /etc/sudoers file. I tried to take away root privileges from some users to no avail. This poses a security risk right now.
Product: Sudo Reporter: Godlove Ndofor <godlove.ndofor>
Component: VisudoAssignee: Todd C. Miller <Todd.Miller>
Status: RESOLVED WORKSFORME    
Severity: high    
Priority: low    
Version: 1.8.6   
Hardware: PC   
OS: Linux   
Attachments: Using lsof to troubleshoot and fix a bug in /etc/visudoers

Description Godlove Ndofor 2018-08-31 01:03:07 MDT
[root@server1 ndofor]# visudo
visudo: /etc/sudoers busy, try again later
[root@server1 ndofor]#
Comment 1 Godlove Ndofor 2018-08-31 01:05:15 MDT
I have cleaned up my cached file and restarted my server (was authorized to restart) still no solution.
Comment 2 Todd C. Miller 2018-08-31 07:04:42 MDT
That error means that visudo was unable to lock /etc/sudoers.  This is usually because another visudo process is running.

If you have verified that no other visudo is running, you can use lsof to see if another process has /etc/sudoers open by running "sudo lsof /etc/sudoers".

If that doesn't show anything then there is something else preventing visudo from getting the lock.  You can use strace to see the actual error.  For example: "sudo strace -o /tmp/visudo.trace visudo"
Toward the end of the trace file you should see lines like:

openat(AT_FDCWD, "/etc/sudoers", O_RDWR|O_CREAT, 0440) = 3
fcntl(3, F_SETLK, {l_type=F_WRLCK, l_whence=SEEK_CUR, l_start=0, l_len=0}) = -1 EAGAIN (Resource temporarily unavailable)

If the F_SETLK failure is something other than EAGAIN that might provide a clue as to why visudo is not working.
Comment 3 Godlove Ndofor 2018-08-31 07:58:33 MDT
Created attachment 514 [details]
Using lsof to troubleshoot and fix a bug in /etc/visudoers

Thanks for your support Todd.
All I needed to do was to figure out the PID and delete. That worked perfectly well as seen in image.