You are not logged in.

#1 2019-07-02 11:59:38

amaro
Member
From: 5.11.1-1-ck-ivybridge, xfce
Registered: 2014-05-09
Posts: 363

[SOLVED] bash warning shell level (1000) too high resetting to 1

Hello everybody!

I am trying to update the time with

ntpd -gq

and get

bash: warning: shell level (1000) too high, resetting to 1
/usr/local/bin/ntpd: fork: Cannot allocate memory

First time get such warning while adjusting the time.
What's the right way to solve this?

Thank you!

Last edited by amaro (2019-07-02 12:19:31)

Offline

#2 2019-07-02 12:03:56

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,449
Website

Re: [SOLVED] bash warning shell level (1000) too high resetting to 1

amaro wrote:

/usr/local/bin/ntpd: fork: Cannot allocate memory

What is this, where did it come from, and why are you using it?


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#3 2019-07-02 12:12:02

amaro
Member
From: 5.11.1-1-ck-ivybridge, xfce
Registered: 2014-05-09
Posts: 363

Re: [SOLVED] bash warning shell level (1000) too high resetting to 1

Frankly, I do not recall why there is such a script. I removed it. Reinstalled ntpd.

# S ntp
warning: ntp-4.2.8.p13-2 is up to date -- reinstalling
resolving dependencies...
looking for conflicting packages...

Packages (1) ntp-4.2.8.p13-2

Total Installed Size:  4.32 MiB
Net Upgrade Size:      0.00 MiB

:: Proceed with installation? [Y/n] y
(1/1) checking keys in keyring                     [####################] 100%
(1/1) checking package integrity                   [####################] 100%
(1/1) loading package files                        [####################] 100%
(1/1) checking for file conflicts                  [####################] 100%
(1/1) checking available disk space                [####################] 100%
:: Processing package changes...
(1/1) reinstalling ntp                             [####################] 100%
:: Running post-transaction hooks...
(1/3) Reloading system manager configuration...
(2/3) Creating system user accounts...
(3/3) Arming ConditionNeedsUpdate...

Now I got

ntpd -gq
-bash: /usr/local/bin/ntpd: No such file or directory

P.S. After reboot everything works fine.
Thank you, Trilby!

Last edited by amaro (2019-07-02 12:20:45)

Offline

#4 2019-07-02 12:26:06

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,449
Website

Re: [SOLVED] bash warning shell level (1000) too high resetting to 1

I gather the script in /usr/local/bin was meant as a ntpd wrapper which would do some preliminary work and then call the "real" ntpd.  But if it didn't specify a full path to the "real" ntpd, it would just end up calling itself recursively which would result in the errors in your first post.

Such a script could have worked fine when it was in your home directory or somewhere else not in PATH.  But when you put it in /usr/local/bin (higher in PATH than the "real" ntpd) and don't specify the full path the to real ntpd within the script, you'd get this problem.

Last edited by Trilby (2019-07-02 12:27:28)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#5 2019-07-02 13:09:21

amaro
Member
From: 5.11.1-1-ck-ivybridge, xfce
Registered: 2014-05-09
Posts: 363

Re: [SOLVED] bash warning shell level (1000) too high resetting to 1

Thank you, Trilby! This comment was very helpful. You are right, I was testing something, but  completely forgot about it. After reading your comment I realize I have made 3 mistakes: gave the script a wrong name, did not remove it after the testing, did not specify the full path to  'ntpd'. Thank you!

Offline

#6 2019-07-02 23:44:55

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,217
Website

Re: [SOLVED] bash warning shell level (1000) too high resetting to 1

For future reference in regard to shell levels: https://www.lifewire.com/why-would-you- … le-2196747

The $SHLVL variable is used to tell you how many shells deep you are.
.....
When you run a command in a shell it runs at something called the shell level. Within a shell, you can open another shell which makes it a subshell or the shell that opened it.

Therefore the parent shell would be considered perhaps the level 1 shell and the child shell would be a level 2 shell.

Offline

Board footer

Powered by FluxBB