# visudo: /usr/local/etc/sudoers busy, try again later



## MarS (Jan 22, 2009)

I have several hosts running FreeBSD 7.0-RELEASE-p6. security/sudo was installed when installing FreeBSD using sysinstall.

When I run `visudo` as root, it works on some hosts and on some I get:


```
visudo: /usr/local/etc/sudoers busy, try again later
```

The visudo(8) manpage says about this error: "Someone else is currently editing the sudoers file." But I am absoluteley sure that nobody else is currently editing this file. I also know that I used visudo successfully on one of this hosts.

I tried to re-install sudo (`pkg_deinstall sudo` + `portinstall sudo`) but this won't change anything.

Does anybody have a clue what could be the reason for the mentioned error?

Thanks in advance
--Markus


----------



## SirDice (Jan 22, 2009)

If you're absolutely sure no others are running try *rm /usr/local/etc/sudoers.tmp*.


----------



## MarS (Jan 22, 2009)

Thank you SirDice, but this file doesn't exist.


----------



## MarS (Jan 23, 2009)

Anybody else having an idea?


----------



## ale (Jan 23, 2009)

`$ ls -latr /var/tmp/vi.recover/` ?


----------



## MarS (Jan 23, 2009)

Thanks for answering, ale.

/var/tmp/vi.recover/ is empty...


----------



## ale (Jan 23, 2009)

MarS said:
			
		

> Thanks for answering, ale.


Sorry, just trying...

I'd try running visudo(8) with ktrace(1)


----------



## anomie (Jan 23, 2009)

Also try:
`# fstat /usr/local/etc/sudoers`

What does it show?


----------



## MarS (Jan 23, 2009)

It shows:

```
USER     CMD          PID   FD MOUNT      INUM MODE         SZ|DV R/W NAME
```

Nothing more ...


----------



## anomie (Jan 23, 2009)

Sheesh. Well then, the lock file _should_ be there somewhere.

Run:
`# /etc/periodic/weekly/310.locate`

Followed by:
`# locate sudoers`

See the lock (.tmp) file now? If so, delete it.

If not, you'll need to trace visudo as suggested...


----------



## MarS (Jan 23, 2009)

Thanks anomie, but I still can't see the sudoers.tmp.

I'll look into using ktrace and see what I can find out ...


----------



## lcalvarez82 (Aug 4, 2015)

It happens to me,  try `ps -fe | grep sudo`  or `fuser /etc/sudoers.tmp` may find who is using the file sudoers. kKill hang sessions.


----------



## ColdfireMC (Aug 5, 2015)

And, what if you try to make `# visudo` in a Single-User boot?


----------



## talsamon (Aug 5, 2015)

Some other "thing": I look at this and wonder

```
ls -al /usr/local/sbin/visudo
-rwxr-xr-x 1 root  wheel  180768 22 Jul 16:39 /usr/local/sbin/visud
```

That it is world-readable and world-executable.


----------



## kpa (Aug 5, 2015)

talsamon said:


> Some other "thing": I look at this and wonder
> 
> ```
> ls -al /usr/local/sbin/visudo
> ...



That's not anything unusual, those are the standard permission on any executable that is meant to be run by any user on the system. Access to sudo(8) is controlled by /usr/local/etc/sudoers file and visudo(8) just calls sudoedit(8) on the sudoers file for editing it. There is no loophole to get around the restrictions in sudoers even if visudo binary is world readable/executable.


----------



## ShelLuser (Aug 5, 2015)

Also keep in mind that lcalvarez82 responded to a thread which was more than 5 years old. I'm pretty sure that some kind of solution has been found in the mean time


----------

