andresgongora/synth-shell

ls doesn't list the contents of a directory.

Closed this issue · 26 comments

This has happened to me a few times yet I don't understand the pattern/reason why this happens.

Problem is that sometimes when I'm in a directory and type ls, it won't show the contents of the directory. I have to type ls -l or dir to see the contents.

Using Manjaro KDE, guake but it also happens in konsole.

So I'm not really sure how to install the development branch (n00b here).

Is it just

git clone --recursive https://github.com/andresgongora/synth-shell.git checkout -b develop

./setup.sh

??
Is there a way to check the version?

I encountered a similar behavior. I re-installed with [1], including the option "better ls"

Bug desccription (example) -- as a root
cd /root/
"ls" gives me ". .." (---> malfunction ?)
"ls -al" gives me ". .." and a list of hidden folders ".xxxxxxxxxx"

then, cd /root/.config/
"ls" and "ls -al" give me exactly the same thing, except that "ls -al" also gives me the weight of the contained files in the first line of the results ("total 48K")

When not root but normal user, "ls" in my home folder works properly, result is a list of folders (hidden or not) displayed in the better-ls way.
[1]
git clone --recursive https://github.com/andresgongora/synth-shell.git
chmod +x synth-shell/setup.sh
synth-shell/setup.sh

Thanks for all the feedback. I think I might have solved this problem, but I'm still working on it on a separate repository. Sorry for the late reply/solution, I'm currently finishing a separate and very big project :)

Sorry for the late reply. I have several major projects going on and so I was unable to address all issues of this repo. I'm a bit more free now and so we should be able to fix all issues in a short time.

Please let me remind you that synth-shell is going through a big change. I'm moving all script inside synth-shell to external repos, so that they now becomes submodules that can, if the user wishes so, be installed completely independently. This is a big improvement, but requires a lot of work. Just as a brief overview:

- synth-shell https://github.com/andresgongora/synth-shell: this will be the parent repo. Eventually it will contain little code on its own and will become a bundle of submodules.

- bash-tools https://github.com/andresgongora/bash-tools: all auxiliar functions that have "generic" use will be store here. Like printer helpers and such.

- synth-shell-greeter https://github.com/andresgongora/synth-shell-greeter, formerly known as status.sh, is the script that prints the logo and system status info.

- synth-shell-prompt https://github.com/andresgongora/synth-shell-prompt: prints a nice colored prompt with triangles.

Hi @Rochenoire and @bassamanator , thanks for the bug report. I think this issue is tightly tied to the other bugs the script has. Please consider reinstalling synth-shell, I have updated the master branch heavily. Please let me know if doing so fixes the bug or other new ones appear.

I've updated better-ls. Let me know if it works now as expected :)

So I reinstall synth-shell as per the instructions on the main page just now on my pc(manjaro) and on my raspberry pi4 (rasberry pi os 32bit).

Manjaro:
-ls is working I think. I'll report back if it doesn't list directory contents again.
-I still get the (standard_in) 1: syntax error when I open terminal and the status info is different. There is no coloring like before, it's in grayscale where as before (and currently on raspberry piOS) it was coloured.

Raspberry pi os 32bit:
-Lots of errors when terminal starts, like the ones in the other issue that I created yesterday.

-bash: bc: command not found
-bash: [: -gt: unary operator expected
-bash: [: -gt: unary operator expected
-bash: bc: command not found
-bash: [: -gt: unary operator expected
-bash: [: 0: unary operator expected
-bash: bc: command not found
-bash: bc: command not found
-bash: [: -gt: unary operator expected
-bash: [: -gt: unary operator expected
-bash: bc: command not found
-bash: [: -gt: unary operator expected
-bash: [: 0: unary operator expected
-bash: bc: command not found
-bash: [: -gt: unary operator expected
-bash: [: -gt: unary operator expected
-bash: bc: command not found
-bash: [: -gt: unary operator expected
-bash: [: 0: unary operator expected
-bash: bc: command not found
-bash: [: -gt: unary operator expected
-bash: [: -gt: unary operator expected
-bash: bc: command not found
-bash: [: -gt: unary operator expected
-bash: [: 0: unary operator expected
-bash: bc: command not found
-bash: [: -gt: unary operator expected
-bash: [: -gt: unary operator expected
-bash: bc: command not found
-bash: [: -gt: unary operator expected
-bash: [: 0: unary operator expected

-Status screen looks ok except there are no bars depicting memory usage, storage, etc.
-The shell prompt is messed up. Before I updated synth-shell today, the prompt was working fine. There are extra characters that appear in the prompt. So normal is this:

pi rpi ~/Downloads

Now it looks like this:
image

Hi @bassamanator

  1. You can disable unwanted or problematic scripts inside your $HOME/.bashrc file. Just comment the elements you do not want.
  2. Please install the bc software package. It's a terminal calculator. Does it solve the error -bash: bc: command not found ?
  3. The no color problem is very weird. Let's fix the others first.
  4. You can fix your terminal by installing, on the computer from where you log in (not the rpi), the powerline-fonts or fonts-powerline. It will make those E0B0 characters go away and replaces them with nice triangles. Alternatively, disable synth-shell-prompt in your $HOME/.bashrc.

Please let me know if it worked :) Once everything is fixed, we will address problem 3, no color.

rpi
-bc installed: bash error solved
-fonts-powerline installed: shell-prompt weird characters errors not solved

Great. One less problem.
Did you install fonts-powerline on the rpi, your computer (the one with the screen) or both? Please try to install it in both. Maybe that helps. Please let me know.

Manjaro setup (main computer):
-fonts-powerline are already installed but I reinstalled them just in case. Shell prompt is fine locally.
-when I ssh into the rpi, the shell prompt is corrupted

UPDATE:
RPI
-when I use vncviewer to connect to rpi, the terminal inside that virtual desktop is fine. So for some reason the shell prompt is corrupted when I connect via ssh. We can mark this as a problem with my computer and not synth-shell I think.

I just downloaded and reinstalled synth-shell for safety.

Here's my greeting (main pc):
image

I think before there used to be flashing but I don't remember. Also just noticed that socket error, it's new. My external ip is also not available like it was before.

I do think the the ls function is fixed however.

EDIT I think the socket error has nothing to do with synth shell. I rebooted and it's gone and my external ip is visible now.

Ok, could you run the following commands and tell me their outputs? I have several "getters" to recover the IP, selected according to their availability. One of them seems to be messing up:

  • which dig
  • which drill
  • which nslookup
  • which curl
  • which wget

Also, you logo is now Manjaro's. Can you confirm that your distro is indeed Manjaro?

Yes I'm on Manjaro.

I think the ip not showing up in the greeting was unrelated to synth-shell but here's your output.

$ which dig
which: no dig in ...

$ which drill
/usr/bin/drill

$ which nslookup
which: no nslookup in ...

$ which curl
/usr/bin/curl

$ which wget
/usr/bin/wget

Perfect. I'm glad the Manjaro theme was automatically loaded.

Ok. The script checks what commands it has available and the first it finds from the list is drill. I've tested it on my manjaro and it seems to work... could you run this command?

drill +time=3 +tries=1 TXT -4 +short o-o.myaddr.l.google.com @ns1.google.com | grep IN | tail -n 1 | cut -f5 -s | awk -F\" '{print $2}'

it's the bit that get your external IP. Does it succeed this time or do you get the same error message as with the complete greeter?
In case you are wondering, this bit resides in: synth-shell-greeter/synth-shell-greeter/info_about_network.sh.
We almost have it :)

$ drill +time=3 +tries=1 TXT -4 +short o-o.myaddr.l.google.com @ns1.google.com | grep IN | tail -n 1 | cut -f5 -s | awk -F\" '{print $2}'
Error: error sending query: Error creating socket

OK. This is very related to the title of this issue by now, but let's get it fixed first and then we see what to do with it.
Let me gather my thoughts: its seems that the only error you have right now in your script is that drill is not working as expected. As a result of that, you get an error message when you run synth-shell-greeter, and you can't see your external IP address.

drill +time=3 +tries=1 TXT -4 +short o-o.myaddr.l.google.com @ns1.google.com | grep IN | tail -n 1 | cut -f5 -s | awk -F\" '{print $2}'

The above command is meant to contact google and try to get it to answer with the IP >it< sees the request came from. Consequently, >your< external ip. The rest of the command, | grep IN | tail -n 1 | cut -f5 -s | awk -F\" '{print $2}' is just there to get it beautiful.

Why does drill fail? Honestly, I have no clue. Are you running some sort of firewall or VPN network or something that could be a simple answer to the problem? I've searched in google drill error sending query Error creating socket but I got no real results.

So, the dirty solution for you is to simply install dig with sudo pacman -S bind-tools. In my script, dig has precedence over drill, and so far, dig seems to work more reliably (probably because it has less features). On the other hand, the hard solution for you is, if you have the time to spare, lend me a hand and try to figure out what is wrong with drill in your setup, so that we can patch it and ensure that anyone with a similar system does not run into the same problem.

Let me know if dig worked :)

I don't mind giving you a hand.

I disabled my VPN and the drill command worked and returned my external IP. I enabled my VPN and I got the error again. So my VPN is the cause of this.

I installed bind-tools and I see no difference in the greeter. I imagine as long as my VPN is turned on I won't be able to see my external IP listed in the greeter, which isn't really a big deal for me but I wonder if it's causing other issues in synth-shell.

BTW ls has been working fine as far as I can tell now

pgrewal  oracle7-ansible  ../.config/synth-shell  bash

                                           OS              Oracle Linux Server 8.2
                                           Kernel          5.4.17-2011.3.2.1.el8uek.x86_64
                            __  __         CPU             Intel Core i5-7300U 
          _______  ______  / /_/ /_
         / ___/ / / / __ \/ __/ __ \       Shell           /usr/bin/bash
        /__  / /_/ / / / / /_/ / / /       Date            2020.07.01 - 16:42:24
       /____/\__  /_/ /_/\__/_/ /_/        Uptime          34 min hours
            /____/                         Local IPv4      10.0.2.15,  192.168.56.101
     _____ __  __________    __            External IPv4   43.230.65.185
    / ___// / / / ____/ /   / /            Services        All services OK
    \__ \/ /_/ / __/ / /   / /             CPU temp        lm-sensors not installed
   ___/ / __  / /___/ /___/ /___           Sys load avg    [         ]    0%
  /____/_/ /_/_____/_____/_____/           Memory          [|        ]  371/1781  MB
                                           Swap            [         ]    0/2755  MB
                                           Storage /       [|        ]    4/23    GB
                                           Storage /home   [|        ]    4/23    GB

Error:
pgrewal  oracle7-ansible  ../.config/synth-shell  ls
bash: alias: -d: not found
bash: alias: .: not found
bash: alias: ..: not found
bash: alias: -lA: not found
bash: alias: --human-readable: not found
bash: alias: --group-directories-first: not found

pgrewal  oracle7-ansible  ../.config/synth-shell  ls
bash: 'better_ls': command not found

pgrewal  oracle7-ansible  ../.config/synth-shell 

@punit144 did you isntall the develop or the master branch. Also, when you cloned the repo, did you use --recursive?

@bassamanator Work is not leaving me much time - Let's close this issue once punit's problem is also solved and create a new one specific for VPNs - andresgongora/synth-shell-greeter#26

@andresgongora Please note that i have installed the script using steps given in README.md file.

git clone --recursive https://github.com/andresgongora/synth-shell.git
chmod +x synth-shell/setup.sh
synth-shell/setup.sh

Also i think my errors were due to script better_ls as when i skipped better_ls during installation everything else worked perfectly.

image

That's weird - I thought I had pushed the fixed better-ls to master. Could you please try this one?

git clone --recursive https://github.com/andresgongora/synth-shell.git
cd synth-shell
git checkout develop
git pull
./setup.sh

Also, one of the errors you get seems to be related to your GPU - the script seems unable to parse its name. Please let me know if it works in the develop branch. Otherwise I'll try to push some fixes :)

Still the same error:
image

image

I just reinstalled synth-shell following the instructions in README.md, and as far as I am concerned the "ls issue" is completely solved.
Thanks!

I just reinstalled synth-shell following the instructions in README.md, and as far as I am concerned the "ls issue" is completely solved.
Thanks!

Errata: I realized that the command "ls" does not work properly in the presence of a file or folder starting with the character "-" (minus). It simply displays "." and "..", while "ls -l" would show the actual content of the present folder.

@Rochenoire thanks for reporting. I've created #181 to keep the issues separated. It'll probably take me a few weeks to look into it, as I'm currently on a tight schedule, but it will be fixed :)