Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
INXI hanging bash script issue! (SOLVED)
#1
Hello all,

I am still working in my MYSTATS bash script and it was going real well with the help of leon.p and other good folks on the forms until the BUT!
   Yep we have a BUT!!!

Grab a cup of coffee of your favorite brew and set a spell..... Big Grin

I am having a small issue with "inxi"... Actually HUGE! 

While the script works just fine on Mint 18.3 Cinnamon, Peppermint 10.
Now on MX 18.3 and Manjaro Illyria 18.04 that is another story and issue, maybe other Distro's too not sure.
Please note:These are on real systems, (whatever the buzz word is today) an not VM's...

When I run the script on Mint it runs as it should taking 3 sec. or less to run. Then it outputs to the screen and a text file in the "/home".
Now On MX and Manjaro about 99% of the time the script will hang at the "inxi" section of the script and if you leave it there and wait for the output, nothing, if you keep waiting for output the system will use all the CPU and Memory until the system will Freeze and die! I can see this in Htop...
You will have to turn off the computer and restart it...

I think it is getting stuck in a loop or something and I am not sure how to fix it.
If after 3 sec, say 4 sec. I hit "Ctrl + C" to get out of the script. The output log that I have the script write to (>> "$infofile") stops at the INXI section of the script every time...

Now this does happen more often than not, but sometimes after rebooting the script will work as intended on MX and Manjaro, with no hanging just "1" time, from there it hangs every time in MX and Manjaro.
Now if it was just a Debian base or Arch base system well OK, but it is both?

I have checked the $PATH for "inxi" it is the same on Mint, Peppermint, MX  and Manjaro (/usr/bin/inxi)...
And now if I run "inxi -c0 -Fxzd" from the terminal on all of them it works as it should.
Now if you use the same command "inxi -c0 -Fxzd" in the script, it hangs the script on MX and Manjaro. I also tried to issued "/usr/bin/inxi -c0 -Fxzd" in the script, thinking it was a path thing and still, it hangs.

Here is some of the code in question...
Code:
echo -e "\nInxi System Data Information:"
echo "================"
/usr/bin/inxi -c0 -Fxzd
# /home/$myuser/bin/test
>> "$infofile"

If you need more of the code I can post it....

So this leads me to think it is the way the command is issued in the script or the $PATH.
I have done some searching on my own and I keep going in circles.....

WEIRD Things ----------------------------------------------------------------- From Here!

Now on the Manjaro box, if I run the script from "/home/bruce" ~>$./mystatMJ, it runs as it should...
BUT move the script to the "/home/bruce/bin" , then run ~:>$mystatMJ, it will hang every time at the "inxi" section...
The same for the MX Box.... Sigh!!! (Notice the commands above, not the same...)

Mint is fine from either ~:>$ or from ~ /bin:>$ works....

I would like to run all of my scripts from my "bin" in "/home/bruce/bin" on all my systems right?
No! not happening!
Here is the reason that I think it is a $PATH issue somewhere (me thinks)...

Here is another weird thing, if I issue "echo $PATH" in a terminal on all the systems I get these outputs...

I get on my Mint 18.3 (/home/bruce/bin:/home/bruce/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games)

On my Manjaro it is (/home/bruce/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl
)

On my MX it is (/home/bruce/:/home/bruce/.local/bin:/home/bruce/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games)

The "/home/bruce/bin and /usr/bin" are all in the $PATH on all the Distro's....

More Weirdness ----------------------------------------------------------------- From Here!

When I move the script to my "Bash Path" for "bin" it will not run and hangs, take it out of the "Bash Path""/home/bruce/bin" put in say, /home/bruce, works fine! ~>$./mystatMJ, or in /home/bruce/bill_n_ted  >:$./mystatMJ works fine.....

Mint does not care apparently as for the placement in the path and just run's the script and it works..... 

DAMN my head hurts!!!

( Hay Joe! I have tried to explain this the best I can and give all the information I can... LOL)

But! Really, if you need something else let me know!!!!
I may have repeated something in a different way just putting out information.... Sorry!   

Thanks for your help in advance and thoughts!
Also for letting me VENT some.... Big Grin
LLAP


Damn my head hurts where's my Jack Daniels!
**********************************************************
Taglines of the Day:
Today is the tomorrow you worried about yesterday.  Huh 

Everybody remember where we parked. - Kirk

To Boldly Go Where No BBS Has Gone Before. USS Stargazer BBS, Sheridan In.
Reply
#2
I haven't looked at the source code but I have seen similar issues.

This points to path issues.  Of course this can and does cause problems.  So you have some options.

1) Edit your .profile file to include your bin path.  (For those distros that /home/USERNAME/bin is NOT working)

Add:


Code:
if [ -d "$HOME/bin" ] ; then
   PATH="$HOME/bin:$PATH"
fi

Now create a backup copy before editing in case you need to undone your edits.  Once the edit is complete restart or from the command issue
shell> source ~/.profile

2) Versions can matter.  If you have multiple versions order matters.  So you either have to change the $PATH layout (can be dangerous) or even better just hard code the full path so the correct program will be used.  The other option is commands are not in the $PATH layout in a specific distro.  This too can and will cause issues.  So once again full paths will fix these errors as long as the programs are installed.

Unfortunately hard coding paths can make the programs less movable from distro to distro.
Jeremy (Mr. Server)

* Desktop: Ubuntu MATE
* Windows are for your walls, Apple is for your health, Linux is for your computer
Reply
#3
[quote pid='5544' dateline='1565880290']
Code:
if [ -d "$HOME/bin" ] ; then
   PATH="$HOME/bin:$PATH"
fi

[/quote]

In regard to the path issue, I've found that with MX-Linux, LMDE and Debian 10, I've had to add the above code to the .bashrc because Debian doesn't seem to source ~/.profile when opening a terminal. It works fine from an SSH login or opening a TTY. Another alternative is going into your terminal program's settings and checking the box to have it run as a login shell.
Reply
#4
(08-15-2019, 03:50 PM)rickromig Wrote: [quote pid='5544' dateline='1565880290']
Code:
if [ -d "$HOME/bin" ] ; then
   PATH="$HOME/bin:$PATH"
fi

In regard to the path issue, I've found that with MX-Linux, LMDE and Debian 10, I've had to add the above code to the .bashrc because Debian doesn't seem to source ~/.profile when opening a terminal. It works fine from an SSH login or opening a TTY. Another alternative is going into your terminal program's settings and checking the box to have it run as a login shell.
[/quote]

Well certainly things change and I haven't used Debian 10, yet, but I do know they recommend .profile for environment settings as stated at https://wiki.debian.org/EnvironmentVariables

"Put all your environment variables in ~/.profile"

Still you are correct that Linux can be setup in different ways and testing is required. Smile
Jeremy (Mr. Server)

* Desktop: Ubuntu MATE
* Windows are for your walls, Apple is for your health, Linux is for your computer
Reply
#5
Well Guys, thanks for the replies and information...

So,
All 3 distro's have INXI in the /usr/bin. The /usr/bin is in all of the distro's "echo $PATH" when issued in the terminal...

All 3 distro's have /home/bruce/bin in all of the distro's "echo $PATH" when issued in the terminal...

I have the "mystat" script in all distro's /home/bruce/bin.

Mint works fine. MX and Manjaro does not and hang at the inxi section of the script when in the BIN folder which is in the $PATH and work when NOT in the $PATH... Sad   Huh

I have checked both the .profile and .bashrc as stated and the findings for the code you suggested below are...

Code:
if [ -d "$HOME/bin" ] ; then
  PATH="$HOME/bin:$PATH"
fi

Mint does not have this code but has this one in ~/.profile

Code:
# set PATH so it includes user's private bin directories
PATH="$HOME/bin:$HOME/.local/bin:$PATH"

Manjaro has this in the ~/.profile

Code:
if [ -d "$HOME/bin" ] ; then
  PATH="$HOME/bin:$PATH"
fi

Now like rickromig stated with MX, to get the ~/home/bruce/bin to work is something else. Joe Collins mentioned this in one of his videos and gave this command to put into the .bashrc file...

Code:
# set PATH so it includes user's private bin directories
PATH="$HOME/bin:$HOME/.local/bin:$PATH"

Now with this being said this is in the .profile to start with and was not working from day 1 of installation.


Code:
if [ -d "$HOME/bin" ] ; then
  PATH="$HOME/bin:$PATH"
fi


So there you have it. Weirdness an more weirdness...

So I am still confused on what to do as everything should work because INXI is in the path on all the system, the BIN folder is in all the paths on all the distro's...

Hard coding the path does not work either!   Confused
To make things worse it is not portable from one distro to another.....   Exclamation

My head still hurts.....
LLAP
**********************************************************
Taglines of the Day:
Today is the tomorrow you worried about yesterday.  Huh 

Everybody remember where we parked. - Kirk

To Boldly Go Where No BBS Has Gone Before. USS Stargazer BBS, Sheridan In.
Reply
#6
(08-15-2019, 03:50 PM)rickromig Wrote:
Code:
if [ -d "$HOME/bin" ] ; then
   PATH="$HOME/bin:$PATH"
fi

In regard to the path issue, I've found that with MX-Linux, LMDE and Debian 10, I've had to add the above code to the .bashrc because Debian doesn't seem to source ~/.profile when opening a terminal. It works fine from an SSH login or opening a TTY. Another alternative is going into your terminal program's settings and checking the box to have it run as a login shell.

As far as I know, not sourcing '.profile' for terminal emulators is the correct behaviour. '.profile' should only be sourced once, at login, as it not only configures the environment for your bash shell, but basically for everything. '.profile' is not a bash configuration file.

However many terminals have the option to act as a "login shell", which will cause them to explicitly source '.profile'.
My website - My git repos

"Things are only impossible until they’re not." - Captain Jean-Luc Picard
Reply
#7
If that doesn't work then odds are there is something in the INXI version(s) that don't like your hardware.

It may be possible to upgrade INXI (depending on the version).  I have seen others report INXI crashing/locking their system too and updates help.

Have you tried the script using the problem distros on other machines?
Jeremy (Mr. Server)

* Desktop: Ubuntu MATE
* Windows are for your walls, Apple is for your health, Linux is for your computer
Reply
#8
(08-16-2019, 03:14 PM)cleverwise Wrote: If that doesn't work then odds are there is something in the INXI version(s) that don't like your hardware.

It may be possible to upgrade INXI (depending on the version).  I have seen others report INXI crashing/locking their system too and updates help.

Have you tried the script using the problem distros on other machines?

Well I have been the last 2 days messing with this some more Cleverwise.
With no real success. But here is the version Numbers of INXI....
Here is the information on the INXI;
MX ---------- v3.0.33-00 [03-29-29]
Solus ------- v3.034-00 [04-30-2019]
Manjaro ---- v3.0.35-00 [07-15-19]
Mint 18.3 --- v2.2.35-00 [02-16-19]
Mint 19.2 --- v3.0.32-00 [02-07-19] new stock installation..... 8/18/19

I have tried the same script in all the distros. None of them are VM's all hardware.
I removed the Solus drive and installed a 1TB drive and installed a new copy of Mint 19.2...
Guess what it has the same issue when the script is in the ~/bin.
Infact Mint 18.3 has been the only one that has worked all along, which has the oldest version of INXI...

All the Mobo's are 4 core AMD, 16gig ram, AMD onboard video, HDMI so on... Mobo's are MSI, Gigabyte, Asrock, Dell something AMD...

More weirdness.... If I put the script anywhere but in the $PATH it works just fine on all of the Distro's!!!
Put it in a $PATH hangs on all of them but Mint 18.3... Weird!

As stated in earlier posts all the systems see the the $PATH for the ~/bin n the all of them... Weird!!!
Any other script in the ~/Bin work just fine. I have CYA, UP, XBT, BU and more, all work! Just not this one... Other scripts work fine too.....

If you want I guess I can send it to you or post it ( pretty Long script). It is stuff that I found and add to, some is rickromig scripts and some help from leon.p, also just stuff I read and tried.... (:?

I guess I will just have to use it in a non-path and call it with a small script from in the ~/bin. Which by the way does work... I just put the mystat script in a folder in the ~/bin and call it from there and it works...

I hate to give up but I just can't figure out what the issue is..... Been 2 months.... If I leave or comment out "INXI" the script works fine every time, no matter where it is run from.... GO FiGure.....

LLAP
**********************************************************
Taglines of the Day:
Today is the tomorrow you worried about yesterday.  Huh 

Everybody remember where we parked. - Kirk

To Boldly Go Where No BBS Has Gone Before. USS Stargazer BBS, Sheridan In.
Reply
#9
Hello All,
I have a Update to the INXI hanging in a script!

Grab a cup of coffee of your favorite brew and set a spell.....
I am sorry about the long post in advance....

I (we) now know the issue with the "inxi"...  Best of all there is a workaround, this is Great News!
No it is Actually HUGE!

I will try to explain what has transpired in the last few days...

Our good friend here on EzeeTalk, deck_luck and I have been conversing via emails about "mystatDF" (My box is called Defiant) script...

Deck_luck had offered to invest sometime in the project to see what the issue is and why the script is hanging
at the INXI section of the script...
Our good friend deck_luck devised a script to check and see what INXI was doing.

A bit of history first...

The "Purpose of the script" "MYSTAT" is to collect all the systems information, hdd, network, disto/version, kernel and so on for a
diagnostics tool to get answers for what is in my system so when I was asked in a post "What is it you Have" and so forth, then I would have the answer.
We all have been there... Lol
This way I would have the answer to the question... 
Yes I know that you can type it all in and get it BUT, I'm lazy... Big Grin

Now I'm a old Dos ".Bat" writer back in the day of BBS's so I know what I am seeing and sometimes fixing things.

Being new to Linux and Bash scripting, I'm trying to learn as I go!
I could see that the script was hanging on the "inxi -c0 -Fxzd" command.
I could also see this happening in a "Htop terminal"...

I watch as the memory pool was filling up to the point that if "CTRL + C" was not pressed to stop the script it would kill Linux!

I looked at every command over and over and search the net, it was clear it was one of 2 things.
  1. A issue with "PATH" of some kind, not sure what...
  2. Also that "INXI" was getting caught in a loop and eating up the system resources and killing Linux! Ugly Death... :-(

After several comments here in the forum and suggestion of things to check, still no fix and still more questions...

I would like to thank everyone On EzeeTalk for there questions and suggestions, THANKS All.....
------------------------------------------------------------------------------------------------------
Fast forward 2 months, Now we revisit the issue..

NOW, we bring up the "myscript" issue again but with the focus on the "INXI" hanging the script...
Still more comments and suggestion of thing to check with no fix and still more questions...

After Cleverwise asked what the inxi version on the systems in question, it was clear this could be the issue. Thank you Cleverwise!
I was working on the script in Mint 18.3. which has v2.2.35-00 of inxi which the script worked as intended, but not on the other Linux Distro's...
Here are the INXI versions on all of the Distro's

If you look you will see a clue/pattern... Big Grin

Quote:Here is the information on the INXI;
MX ---------- v3.0.33-00 [03-29-29]
Solus ------- v3.034-00 [04-30-2019]
Manjaro ---- v3.0.35-00 [07-15-19]
Mint 18.3 --- v2.2.35-00 [02-16-19]
Mint 19.2 --- v3.0.32-00 [02-07-19] new stock installation..... 8/18/19

After the Version Question, Deck_Luck offered to help to see what the issue was... He made a script to see what the problem was with my script.
(What! A Script to fix a script?)

Deck_luck found this... I will quote him here:

Quote:20190820 LM19.2 inxi investigation and workaround

When running any script using inxi from ~/bin and the PATH contains ~/bin, the inxi 3.0.32+ will attempt to get the version of the parent process by running the parent process with the --version argument.  This result in the parent process script running again which in turn runs another inxi resulting in a vicious loop.  The loop will eventually cause the Linux proc table to fill and or run out of memory.  

Well this confirmed what I thought was going on....
I will not post the script he used as he did all the work on his system and shared the outcome with me... I can post if you want it I guess... Let me know....

Here are his findings...

Quote:As a work around for the script containing the inxi command, an argument check for --version should occur.  If the argument exists the script should simply exit.   After applying the work around to the mystatDF script it successfully ran from the ~/bin with the PATH containing the ~/bin directory.

There are apparently several BUG reports filed by others with the 3.x.x.-xx series of inxi and sldo filled by deck_luck..
It looks like the Dev is a bit of a hard headed Let say...

Here is the workaround that deck_luck wrote to fix the "--version" tag issue

Code:
if [[ "${1}" == "--version" ]] ; then
    # patch for inxi_3.0.32 parent --version anomaly
    exit 1
fi

Here is what deck_luck sent me

Quote:The mystatDF workaround is as follows:

#!/bin/bash

if [[ "${1}" == "--version" ]] ; then
# patch for inxi_3.0.32 parent --version anomaly
exit 1
fi

The Linux Mint 19.2 XFCE was used to reproduce the problem and test the work around.

Well there you have it! My "mystatDF" script is all fixed and ready to go out on the town and do it's thing... LOL

I have applied the fix/workaround to all of the scripts on the the various Distro's and I am HAPPY to Report all of them work Perfectly!!!
Now the script is a portable script and will/should work on any Distro....

I would like to thank everyone here on EzeeTalk and a special "Thank You" to Deck_Luck for offering his time to resolve this issue
and fixing my script to function as it was intended from the start!

God Bless All....
LLAP
**********************************************************
Taglines of the Day:
Today is the tomorrow you worried about yesterday.  Huh 

Everybody remember where we parked. - Kirk

To Boldly Go Where No BBS Has Gone Before. USS Stargazer BBS, Sheridan In.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)