Strange "command not found" error at shell login

Hello, thank you for having me.

I have this strange issue when i login to my Fedora 37 using ssh or tty, I get this:
“bash: n: command not found…”
I looked trough .bashrc, .bash_profile, /etc/bashrc, but cant find any “n” hanging in those files, where can i look for this?
Thank you.

1 Like

or this

2 Likes

Thank you for the input, I never had n - node version manager installed in my system.
One thing I tried was to create another account and login wit it, the “bash: n: command not found…” also manifests it self with the newly crated account so, I assume it is something system wide.

1 Like

Have you checked /etc/profile and other files in the /etc/profile.d/ directory?

2 Likes

Thank you for pointing me to /etc/profile.
The problem was in fact in that particular file. I checked another machine running Fedora 37 and not affected by the problem and the two differ:
The one with the problem looks like this:

# Source global bash config, when interactive but not posix or sh mode
if test "$BASH" &&\n   test -z "$POSIXLY_CORRECT" &&\n   test "${0#-}" != sh &&\n   test -r /etc/bashrc
 then
   # Bash login shells run only /etc/profile
   # Bash non-login shells run only /etc/bashrc
   # Check for double sourcing is done in /etc/bashrc.
   . /etc/bashrc
fi

the other one looks like this:

# Source global bash config, when interactive but not posix or sh mode
if test "$BASH" &&\
   test -z "$POSIXLY_CORRECT" &&\
   test "${0#-}" != sh &&\
   test -r /etc/bashrc
then
   # Bash login shells run only /etc/profile
   # Bash non-login shells run only /etc/bashrc
   # Check for double sourcing is done in /etc/bashrc.
   . /etc/bashrc
fi

I assume the &&\n is the culprit.

Why they are different, I have no idea, I never edited them.

Thank you all for the guidance provided.
Cheers.

1 Like

Can you please run rpm -Vf /etc/profile? This will verify the checksums of the files in the package that contains /etc/profile. You’ll probably see a line about fstab, which you can ignore. But if there’s one for /etc/profile that looks something like this:

S.5....T.  c /etc/profile

then something has changed that file.

Here is the output of rpm -Vf /etc/profile

S.5....T.  c /etc/environment
S.5....T.  c /etc/printcap
S.5....T.  c /etc/profile

So, yeah — something (probably “someone”) has changed those files.

S means the file size is different

5 [1] indicates that the file contents have changed.

T means the timestamp is different.


  1. originally an md5 checksum, now something else but the same idea ↩︎

1 Like

Thank very much for your input. I will do some investigation.
Cheers.