Scheduled Downtime
On Tuesday 24 October 2023 @ 5pm MT the forums will be in read only mode in preparation for the downtime. On Wednesday 25 October 2023 @ 5am MT, this website will be down for maintenance and expected to return online later in the morning.
Normal Operations
The forums are back online with normal operations. If you notice any issues or errors related to the forums, please reach out to help@ucar.edu

Porting error: source not found

johanna_teresa

Johanna Malle
New Member
Hi, I am currently trying to port CTSM on a local linux machine with OS=Ubuntu 20.04 LTS. I have module environments installed and am using a gnu compiler (gcc 9.3.0) and openmpi/mpich. I have adapted the config_machines.xml and config_compilers.xml files and can create a case but when I attempt to setup the case via ./case.setup i get first get an error about the SUPPORTS_CXX variable being set ambiguously, and when I run the same command again, it can't find the source command. Presumably this has to do with my shell environment, has anyone had a similar problem? The CaseStatus is attached, as are the config_machines.xml and config_compilers.xml files which I put in my $HOME/.cime folder. Any help with this would be much appreciated! Thanks, Johanna
 

Attachments

  • CaseStatus.txt
    690 bytes · Views: 10
  • version_info.txt
    1.3 KB · Views: 6
  • config_compilers.txt
    39.1 KB · Views: 15
  • config_machines.txt
    6.6 KB · Views: 23

jedwards

CSEG and Liaisons
Staff member
The error in your CaseStatus.txt
ERROR: Command: 'source /etc/profile.d/modules.sh && module list' failed with error 'b'/bin/sh: 1: source: not found'' from dir '/home/sebastian/CESM2/my_cesm_sandbox/cime/scripts/test88'

seems like a big problem. What shell are you using? If you run the command 'type source' what is the result?
 

jedwards

CSEG and Liaisons
Staff member
Also files in ~/.cime are appended to the files in cime/config/cesm/machines/ and so should not include the original contents.
 

johanna_teresa

Johanna Malle
New Member
Just for some more context, originally when I setup the model and got this error I had been using the sh shell but I then changed to bash using chsh -s /bin/bash, opened a new session and this made no difference to the source not found error. Thanks, I really appreciate the help!
 

jedwards

CSEG and Liaisons
Staff member
I don't understand how this error could occur - can you try running the scripts_regression_tests.py
this will test some of the more fundamental issues. You'll need to build and install cprnc first, and set the path
to the installed location in config_machines.xml CCSM_CPRNC
 

johanna_teresa

Johanna Malle
New Member
there seems to be a problem with the way netcdf is installed - when i am trying to build cprnc it cannot open the module file for netcdf, the include directory seems to be nonexistent as it is set to be /usr/include/include. I don't understand where or why but will give this another try tomorrow and hopefully run the scripts_regression_tests.py. Thanks for your help already!
 

johanna_teresa

Johanna Malle
New Member
i ran the scripts_regression_tests.py, the output is attached.
 

Attachments

  • scripts_regression_tests_output.txt
    103.3 KB · Views: 13

johanna_teresa

Johanna Malle
New Member
We are still unable to solve the original error regarding the source command, which is also reflected by the results of the regression test script. Any help with this would be very much appreciated!
 

MabelSue

MabelSue
New Member
We are still unable to solve the original error regarding the source command, which is also reflected by the results of the regression test script. Any help with this would be very much appreciated!
Hello,have you solved this problem?I have the same error.I know how to change it on a PC. But this method failed on the cluster.
 

jedwards

CSEG and Liaisons
Staff member
This error:
ERROR: Command: 'source /etc/profile.d/modules.sh && module list' failed with error 'b'/bin/sh: 1: source: not found'' from dir '/home/sebastian/CESM2/output/scripts_regression_test.20200603_101401/TestCreateNewcase/testcreatenewcase'
indicates that you have not configured the python interface to modules correctly. Double check the following paths from config_machines.xml
<init_path lang="perl">/usr/local/Modules/init/perl.pm</init_path>
<init_path lang="python">/usr/local/Modules/init/python.py</init_path>
<init_path lang="csh">/etc/profile.d/modules.csh</init_path>
<init_path lang="sh">/etc/profile.d/modules.sh</init_path>
 

MabelSue

MabelSue
New Member
This error:

indicates that you have not configured the python interface to modules correctly. Double check the following paths from config_machines.xml
Thanks.

New errors:
./case.build

ERROR: BUILD FAIL: xlnd.buildlib failed, cat /home/cesminout/scratch/mycase/bld/lnd.bldlog.210710-003429
BUILD FAIL: xglc.buildlib failed, cat /home/cesminout/scratch/mycase/bld/glc.bldlog.210710-003429
BUILD FAIL: xatm.buildlib failed, cat /home/cesminout/scratch/mycase/bld/atm.bldlog.210710-003429
BUILD FAIL: xocn.buildlib failed, cat /home/cesminout/scratch/mycase/bld/ocn.bldlog.210710-003429
BUILD FAIL: xice.buildlib failed, cat /home/cesminout/scratch/mycase/bld/ice.bldlog.210710-003429
BUILD FAIL: xrof.buildlib failed, cat /home/cesminout/scratch/mycase/bld/rof.bldlog.210710-003429
BUILD FAIL: xwav.buildlib failed, cat /home/cesminout/scratch/mycase/bld/wav.bldlog.210710-003429
BUILD FAIL: sesp.buildlib failed, cat /home/cesminout/scratch/mycase/bld/esp.bldlog.210710-003429

cat /home/cesminout/scratch/mycase/bld/lnd.bldlog.210710-003429
/bin/sh: 1: /home/cesm/clm.com/clm.com/my_cesm_sandbox/cime/src/components/xcpl_comps/xlnd/cime_config/buildlib: Exec format error
 

jedwards

CSEG and Liaisons
Staff member
buildlib is a python script - do you have a python interpreter in your environment? Why is it trying to run it with sh?
I would suggest contacting a local system administrator who is familiar with your system to help.
 

MabelSue

MabelSue
New Member
buildlib is a python script - do you have a python interpreter in your environment? Why is it trying to run it with sh?
I would suggest contacting a local system administrator who is familiar with your system to help.
/bin/sh points to dash on ubuntu. I don't know how to switch dash to bash. My python version is 3.6.13,not env python 2.7.
 

aschloegl

Alois Schlögl
New Member
We see the same issue on Debian11, python3.9. /bin/sh is pointing to /bin/dash, where the module system (lmod in our case) is not supported, and "module load .." fails.

It would be great if you could recommend a solution to that issue, without changing #!/bin/sh do bash for the reasons explained here:
Shell - Debian Wiki
"Debian uses Dash as the default non-interactive shell. It is not intended to be used interactively by a user, for example, in a terminal emulator, but rather focuses on speed and compatibility with standards. Therefore, many interactive features are not present in Dash, making it faster and more memory efficient than Bash." For this reason, we do not want to change the system-wide "non-interactive shell" from dash to bash.

Compilation of CESM 2.2.0 works fine. the Problem occurs only when preparing the submit script to slurm. We have adapted the lines in config_machines.xml to :
<init_path lang="tcsh">/mnt/nfs/clustersw/Debian/bullseye/lmod/lmod/init/tcsh</init_path>
<init_path lang="bash">/mnt/nfs/clustersw/Debian/bullseye/lmod/lmod/init/bash</init_path>

<cmd_path lang="tcsh">/mnt/nfs/clustersw/Debian/bullseye/lmod/lmod/libexec/lmod module</cmd_path>
<cmd_path lang="bash">/mnt/nfs/clustersw/Debian/bullseye/lmod/lmod/libexec/lmod module</cmd_path>

but it still does not work . If anyone has an idea what might work, please let us know.

The problem is probably im
<init_path lang="sh">/mnt/nfs/clustersw/Debian/bullseye/lmod/lmod/init/bash</init_path>
which will start dash, and then try to run some lmod commands, which fails than in dash.

when trying to run
grep -r '/bin/sh' --exclude-dir '.git' ~/CESM220
we see 144 entries. Any idees which one need to be change ? Would you recommand to change all of them to /bin/bash ?
 

jedwards

CSEG and Liaisons
Staff member
I think you should try changing them all. But it's not clear to me why the problem only occurs when loading modules?
 

aschloegl

Alois Schlögl
New Member
The default shell of all users is /bin/bash or /bin/tcsh. This is configured in /etc/passwd, so the user usually works with bash by default. Only when the user runs
./case.setup
/bin/sh->dash is used, and it tries to do some "module load .." magic. This fails then.
 
Top