0

Trying to install chainlink on my laptop I had to install go. Doing so i think i have done something wrong and now i having error message each time I open ubuntu terminal which contents the following:

-bash: export: `Files/Docker/Docker/resources/bin:/mnt/c/ProgramData/DockerDesktop/version-bin:/mnt/c/Users/myusername/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/myusername/AppData/Local/Programs/Microsoft': not a valid identifier
-bash: export: `Code/bin:/snap/bin:/usr/local/go/bin:/root/go/bin': not a valid identifier

output after running command

grep 'export.*Files/Docker/Docker/resources/bin:' ~/.bashrc ~/.bash_profile ~/.bash_login ~/.profile /etc/profile /etc/bash.bashrc
/root/.bashrc:export PATH=/bin:/root/.nvm/versions/node/v16.13.2/bin:/root/.cache/cloud-code/installer/google-cloud-sdk/bin:/root/.vscode-server/bin/d045a5eda657f4d7b676/bin/remote-cli:/root/.local/share/solana/install/active_release/bin:/root/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/Program Files/Docker/Docker/resources/bin:/mnt/c/ProgramData/DockerDesktop/version-bin:/mnt/c/Users/lonar/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/lonar/AppData/Local/Programs/Microsoft VS Code/bin:/snap/bin:/usr/local/go/bin:/root/go/bin
grep: /root/.bash_profile: No such file or directory
grep: /root/.bash_login: No such file or directory

is there a way to remove/delete these or to fix the error full stop,please?

Leo
  • 101
  • 1
  • Probably missing quotes in some `export PATH=...` command containing spaces in one of your `bash` startup files. Please [edit] your question and show the output of `grep 'export.*Files/Docker/Docker/resources/bin:' ~/.bashrc ~/.bash_profile ~/.bash_login ~/.profile /etc/profile /etc/bash.bashrc` – Bodo Oct 25 '22 at 16:12
  • @Bodo thanks for coming to my rescue, i have saved the output as requested – Leo Oct 25 '22 at 16:20
  • Don't cross-post the same question. https://unix.stackexchange.com/q/722389/330217 https://askubuntu.com/q/1437006/1186757 https://stackoverflow.com/q/74191044/10622916 – Bodo Oct 25 '22 at 16:44

1 Answers1

0

In /root/.bashrc, there are spaces in the line

export PATH=/bin:/root/.nvm/versions/node/v16.13.2/bin:/root/.cache/cloud-code/installer/google-cloud-sdk/bin:/root/.vscode-server/bin/d045a5eda657f4d7b676/bin/remote-cli:/root/.local/share/solana/install/active_release/bin:/root/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/Program Files/Docker/Docker/resources/bin:/mnt/c/ProgramData/DockerDesktop/version-bin:/mnt/c/Users/lonar/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/lonar/AppData/Local/Programs/Microsoft VS Code/bin:/snap/bin:/usr/local/go/bin:/root/go/bin

in ...:/mnt/c/Program Files/Docker... and ...Programs/Microsoft VS Code/bin:....

Without quotes, the line is split into words at every space, and export tries to interpret every word as a a variable to export.

Change it to

export PATH="/bin:/root/.nvm/versions/node/v16.13.2/bin:/root/.cache/cloud-code/installer/google-cloud-sdk/bin:/root/.vscode-server/bin/d045a5eda657f4d7b676/bin/remote-cli:/root/.local/share/solana/install/active_release/bin:/root/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/Program Files/Docker/Docker/resources/bin:/mnt/c/ProgramData/DockerDesktop/version-bin:/mnt/c/Users/lonar/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/lonar/AppData/Local/Programs/Microsoft VS Code/bin:/snap/bin:/usr/local/go/bin:/root/go/bin"

In general, working as root is discouraged. You should do most things as a normal user and only run commands as root if absolutely necessary.

Having all these Windows directories /mnt/c/... in your PATH doesn't make much sense.

Maybe you made a mistake while you followed some instructions to modify the PATH variable.

Bodo
  • 5,979
  • 16
  • 27
  • Yeah i did got things mixed up trying to set environment followings different instructions, is there a way i can revert this somehow? it seems my distro is set on my root folder – Leo Oct 25 '22 at 16:38
  • @Leo I neither know what instructions you followed nor what the original content of your `.bashrc` file was. One option might be to backup your data, remove and reinstall your WSL Linux distribution. – Bodo Oct 25 '22 at 16:47