Can't ls anymore

Hello all

Since some time when I ls in the terminal (bash and fish) I get this error:
–color=tty: No such file or directory
So I can’t ls anymore! Can you imagine!

I use NixOS unstable package.

When I use another configuration.nix file, this error doesn’t happen. So I assume it must be something with my current configuration.nix file.

So far I tried to comment out everithing that had to do with bash and fish with no luck!

Some tips are much appreciated !

Are you able to share your configuration?

Also please check your environment.shellAlias.

1 Like

Thank you for your answer NobbZ

I commented out everything from environment.shellAliases. Still same error.

So are you able to share your configuration?

In bash what does type ls print?

1 Like

“ls print” gives me the same error:
–color=tty: No such file or directory

I would rather not share the config, to afraid of revealing a password …

The question was not to "type ls print", but “tell what type ls prints”.

1 Like

sorry NobbZ, I really don’t understand what I should do! Or what Information you need from me. I hope you can explain to me a little further explain me like I’m 5.

When in bash, use the command type ls and tell me what got printed, like in the example below:

$ type ls
ls is aliased to `ls --color=tty'

If this prints just ls is aliased to `--color=tty' or something like that, then you are somehow overwriting the default alias. The file that defines the alias hasn’t been touched since August 2022.

1 Like

I get: ls is aliased to `ls --color=tty’

I know it must somehow be in my settings, but by gully I can’t find anything!

A search in your config directory doesn’t show anything?
E.g. for ls --color=tty, color, tty, etc.

1 Like

Thank you for the tip Nebucatnetzer

I tried searching your terms. Only one that I found was the already uncommented terms from my environment.shellAliases …

What life is this without ls!

Interesting, at least we know now that it isn’t defined anywhere else.
I guess problem persists after a reboot or at least a re-login?
Certain changes don’t get applied immediately.

1 Like

Did you install busybox ? It probably does not support --color.

2 Likes

When I run ls from busybox with the colour switch, it lists the contents of the current folder with some colour sprinkled in.

1 Like

@ symphorien

no busybox installed … but good thought!

$which busybox
which: no busybox in (/run/wrappers/bin:/home/usr/.local/share/flatpak/exports/bin:/var/lib/flatpak/exports/bin:/home/usr/.nix-profile/bin:/etc/profiles/per-user/usr/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin)

readlink $(which ls) should reveal which ls implementation is being executed.

1 Like

$ readlink $(which ls)
/nix/store/5jzdsfwynrnhzqmdqilzf7j4hngnjsrk-klibc-2.0.12/bin/ls

This would be my result:
/nix/store/jsi5ln3ic8b7mqwg9fzzw9jwsgyzr1bx-coreutils-full-9.1/bin/ls

so I don’t seem to use the coreutils-full!

A search for klibc gives me this: https://launchpad.net/ubuntu/+source/klibc

I reckon this works:

nix-shell -p coreutils-full --run 'ls --color=tty'

I’m not sure but maybe something changed with your shell or environment?

1 Like