$PATH broken


Today, my $PATH took a dump.

It happened a few times in the past that a command like reboot would stop working, but a reboot fixed the problem.

Today, it seems rebooting does not fix anything at all.
My path now looks like this:

echo $PATH /usr/local/bin:/usr/bin:/bin:/usr/games

Installing something with apt-get gives me this

dpkg: warning: 'ldconfig' not found in PATH or not executable dpkg: warning: 'start-stop-daemon' not found in PATH or not executable dpkg: error: 2 expected programs not found in PATH or not executable Note: root's PATH should usually contain /usr/local/sbin, /usr/sbin and /sbin

I’ve noticed that there’s this line in /etc/profile

if [ "id -u" -eq 0 ]; then PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" else PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games" fi export PATH

Should I change something here?

I’ve looked at this post here https://discourse.osmc.tv/t/system-path-broken-when-running-a-non-interactive-sudo-command but it’s not very helpful on how to proceed in a clean way.

What should I do?

Your $PATH should never be changing. Just what did you be before it suddenly changed?

This is what the path should look like:

osmc@kaled:~$ echo $PATH

@bmillham I can’t remember what I did. Maybe install nzbget 2 days ago. I know the first think I tried to do today was install nethogs but that didnt work for obvious reasons(see OP)

So what should I try to permanently change it to something similar to yours ?

Probably corruption, try fsck

@Dilligaf I got stuck in a sad face loop a day or two ago, and it was due to corruption (another file overwriting kodi’s settings(!?)) so that may have caused something… But I think it only affected kodi

Your Sd card may be dying. I would backup and do a fresh install. Problem is I don’t know if I would trust a backup from a messed up system. You say you’ve had problems in the past, how’s your power supply? Have you checked voltage under load? Are you shutting down/rebooting properly or do you just cut the power?

Power supply is fine and I guess voltage too.

Most of the time I cut the power… Yeah…

Cutting power without properly shutting down will cause corruption sooner or later.
Please don’t do it :wink:

I’ve learned my lesson.
Also there have been a lot of power outages lately, so I guess this makes it worse.

I’ve decided to simply reformat. This thread is useless now.