Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Container starts with error message #363

Open
nsouedet opened this issue Nov 25, 2024 · 2 comments
Open

Container starts with error message #363

nsouedet opened this issue Nov 25, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@nsouedet
Copy link
Contributor

nsouedet commented Nov 25, 2024

Describe the bug
When I start my casa-dev env, the following error message occurs :
/.singularity.d/runscript: 91: /home/souedet/.bashrc: Bad substitution
The error is because dash is the default shell in our containers (/bin/sh is a link to /bin/dash).
So it forbids to add bash only compatible expressions like :
'[[ -z "" ]] && echo hello'

To Reproduce
Steps to reproduce the behavior:

  1. Edit your ~/.bashrc
  2. Append a bash compatible line but not dash compatible '[[ -z "" ]] && echo pouet'
  3. Starts your container : bv bash
  4. See error

Expected behavior
I think that ~/.bashrc should allow to contain compatible bash expressions when we start our casa-dev container.

Environment:

  • Engine: Apptainer
  • Version of BrainVISA: master branch
  • Version of the casa-dev image: casa-dev-5.3-28

Additional context
To solve the issue we should reconfigure dash package to not be the default shell.
The following code should be added to casa-dev receipe:

echo "dash       dash/sh boolean false" | debconf-set-selections
DEBIAN_FRONTEND=noninteractive dpkg-reconfigure dash
@nsouedet nsouedet added the bug Something isn't working label Nov 25, 2024
@denisri
Copy link
Contributor

denisri commented Nov 25, 2024

That's strange, I don't get this.
If I append [[ -z "" ]] && echo pouet in the .bashrc of my environment home, I get this:

dr144257@is243176:~/casa_distro$ bv bash
pouet
(brainvisa-master-ubuntu-22.04)dr144257@is243176:/volatile/home/dr144257/casa_distro$ 

if I call sh or dash, I get:

dr144257@is243176:~/casa_distro$ bv sh
Apptainer> 

(no pouet).
Normally the .bashrc is only called when running a bash shell...
Or, I have an hypothesis:
do you have a .profile in your env home, which explicitly sources the .bashrc ? If so it's the reason: .profile is sourced by all sh shell variants, thus should not contain bash-specific or source bash-specific code. Otherwise you can use .bash_profile instead of .profile.

@nsouedet
Copy link
Contributor Author

Many thanks Denis, I think you are true, my .profile explicitly sources my .bashrc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants