'service' command complains about and invalid env option

Hello,

(on FreeBSD 14.1-RELEASE-p4 GENERIC)

I am trying to solve the following issue. When use the "service" command for any kind of operation I get the following error:

[$] <> service pf status
env: invalid option -- 'L'
Try 'env --help' for more information.

It reports this with any service or command (except if I run it without any parameters.)

I am trying to find what changed and went though a bunch of configuration files, in my home directory, /etc/, /etc/rc.d, etc, trying to find what file causes this, but to no avail.

I am quite sure that I did not change anything about the system recently.

Some advice on where to look would be very appreciated.

With kind regards,
Alexander
 
What happens when you try: sh -x /etc/rc.d/pf status? Does that provide any clues? You might want to start a script(1) session to capture the output, because it can be quite lengthy.
 
Is there a possibility that you have an env also in /usr/local/bin/ ?
$ whereis env

This does not appear to be the original FreeBSD /usr/bin/env

Your env seems to be an env version for linux. Do you have linux compat layer?
 
Is there a possibility that you have an env also in /usr/local/bin/ ?
$ whereis env

This does not appear to be the original FreeBSD /usr/bin/env

Your env seems to be an env version for linux. Do you have linux compat layer?

That is the root of the problem! Thank you very much. I disabled and removed linux compat layer and the problems are gone.

(I installed it on request of a users, not considering it could have consequences like this.... A lesson learned!)
 
Alexander, great!

It is not supposed to have bad consequences, if there is good planning.

If you really need the Linux compat layer, I suggest you to do it on a FreeBSD Jail, but you should have no problem enabling the Linux compat layer on the host if configured well.
 
Did you have the Linux dirs first in $PATH?

How did you accidentally invoke them?

Apart from enabling this feature, I did not change the path manualy. But when I check the path with the env command now, I still see remnants:

path=( /compat/linux/usr/sbin /compat/linux/usr/bin /sbin /bin /usr/sbin /usr/bin /usr/local/sbin /usr/local/bin /home/lxs/bin )

I will remove these. (these paths still exist, but are empty now)
 
Alexander, great!

It is not supposed to have bad consequences, if there is good planning.

If you really need the Linux compat layer, I suggest you to do it on a FreeBSD Jail, but you should have no problem enabling the Linux compat layer on the host if configured well.

I should have looked into this more carefully, it is totally my own fault. And of course I forgot all about it till the replies in this thread.

I enabled it because of a user (webmaster) that uses MS Visual Studio Code, which did not want to work with FreeBSD, according to him. He pointed me to an article explaining he needed it. (and it did not help him either)
 
Back
Top