# Unable to run pkg(8) - a mksh(1) or kernel quirk?



## Steen E (Nov 16, 2020)

As root I get the following error
`# pkg search screen-4.8.0`
mksh: pkg: inaccesible or not found
`# env -i pkg search screen-4.8.0`
env: pkg: No such file or directory

Switching to sh(1) somehow solves the issue
`# env -i /bin/sh -c "pkg search screen-4.8.0"`
screen-4.8.0   Multi-screen window manager
`# pkg search screen-4.8.0`
screen-4.8.0   Multi-screen window manager

The current system is FreeBSD 12.2 with a custom kernel. The console is vt(4) without a KMS driver. The problem happened after a new kernel. I think the kernel compile is the most likely cause - the kernel config is a mess and I'll be correcting it right now.


----------



## SirDice (Nov 16, 2020)

Steen E said:


> mksh: pkg: inaccesible or not found


Looks like an issue with your PATH. Your PATH is probably incorrect, while it's correct for sh(1). Has nothing to do with your kernel.


----------



## Steen E (Nov 16, 2020)

No. The above cli lines actually happened just so. I'm not able to take a screenschot, but still has the console preserved. From a previous session I also used ktrace(1) and wrote a description, see attached plaintext file buglog.txt. That session 'showcase'  a different quirk where the issue is solved by root calling su(1) <some_user_also_using_mksh>.


----------



## Emrion (Nov 16, 2020)

What about if you type `sh` and retry the commands?


----------



## ljboiler (Nov 16, 2020)

Please type command name correctly :  _*p k g*_

not  *p g k*


----------



## SirDice (Nov 16, 2020)

Steen E said:


> From a previous session I also used ktrace(1) and wrote a description, see attached plaintext file buglog.txt.


Like ljboiler said, it's `pkg` not `pgk`. You've traced a typo.


----------

