Page MenuHomePhabricator

WDQS bash: cannot set terminal process group (-1): Inappropriate ioctl for device
Closed, ResolvedPublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

Wikibase release pipeline with current latest stable version 1.41.1 deployed on Docker version 26.0.0 hosted on Ubuntu 20.04.6 LTS

What happens?:

The command :
docker compose -f docker-compose.yml -f docker-compose.extra.yml run --rm wdqs-updater bash

Returns error message:

bash: cannot set terminal process group (-1): Inappropriate ioctl for device
bash: no job control in this shell
bash: /root/.bashrc: Permission denied

And so command using environment variables failed, for exemple :

docker compose -f docker-compose.yml -f docker-compose.extra.yml run --rm wdqs-updater bash -c 'echo $WIKIBASE_HOST'

The environment variable is not displayed

What should have happened instead?:

The environment variables should be displayed with previous command.

Software version (on Special:Version page; skip for WMF-hosted wikis like Wikipedia):

The issue seems to appear since version wikibase/wdqs:0.3.137-wmde.16/17/19/20

In previous wikibase/wdqs:0.3.135-wmde.14 there is not the issue.

Other information (browser name/version, screenshots, etc.):

Event Timeline

Hi,

Any idea of the cause?
The problem is also in version 0.3.135-wmde.18

Regards

Frédéric

Hi @Fdeuze,

I can reproduce the issue with bash printing error messages. When I check the env vars from within the bash session, they are available though.

❱ docker compose run -it wdqs-updater bash                                   
[+] Creating 3/0
 ✔ Container wbs-deploy-mysql-1
 ✔ Container wbs-deploy-wikibase-1 
 ✔ Container wbs-deploy-wdqs-1   
[+] Running 2/2
 ✔ Container wbs-deploy-mysql-1     Healthy    
 ✔ Container wbs-deploy-wikibase-1  Healthy 
bash: cannot set terminal process group (-1): Inappropriate ioctl for device
bash: no job control in this shell
bash: /root/.bashrc: Permission denied
blazegraph@c756967c7a76:/wdqs$ echo $WIKIBASE_HOST 
wikibase

I think the error messages originate from switching user accounts in the entrypoint: https://github.com/wmde/wikibase-release-pipeline/blob/deploy-3/build/WDQS/entrypoint.sh#L31 This could be handled in a cleaner way, e.g. already setting the user in the Dockerfile.

What are you trying to archive?

Hi @roti_WMDE,

Thanks a lot for your answer and glad you succeeded in reproducing this issue.

Indeed it seems to be because of user account switch in entrypoint.

As on my setup there is frequently unsynchronized data between mysql and blazegraph, I want to be able run command inside the container from the docker host as for example :

docker compose run -it wdqs-updater bash -c '/wdqs/runUpdate.sh -h http://"$${WDQS_HOST}":"$${WDQS_PORT}" -- --wikibaseUrl "$${WIKIBASE_SCHEME}"://"$${WIKIBASE_HOST}" --conceptUri "$${WIKIBASE_SCHEME}"://"$${WIKIBASE_HOST}" --entityNamespaces "120,122" --init --start 20000101000000'

Hi @Fdeuze,

Sorry to hear that you keep having sync issues.

To force a re-sync we currently suggest a very similar command in our documentation. This works with the current configuration of the WDQS image.

https://github.com/wmde/wikibase-release-pipeline/tree/4e5c4217f67de15f8ca56f7e77c5e89c4e1b2637/build/wdqs#updater-keeps-restarting

# Stop the stock updater
docker compose stop wdqs-updater

# Start an updater with force sync settings
docker compose run --rm wdqs-updater bash '/wdqs/runUpdate.sh -h http://"$WDQS_HOST":"$WDQS_PORT" -- --wikibaseUrl "$WIKIBASE_SCHEME"://"$WIKIBASE_HOST" --conceptUri "$WIKIBASE_SCHEME"://"$WIKIBASE_HOST" --entityNamespaces "$WDQS_ENTITY_NAMESPACES" --init --start $(date +%Y%m%d000000)'

# As soon as you see "Sleeping for 10 secs" in the logs, press CTRL-C to stop it again

# Start the stock updater again
docker compose start wdqs-updater

Does this work for you as a workaround for now too?

Best,
Robert

Hi @roti_WMDE ,

Indeed that is the procedure you gave me in https://phabricator.wikimedia.org/T352975

But I can notice that the command has tiny changed and don't have -c anymore.

So changing command and removing -c from

... bash -c '/wdqs/runUpdate.sh ...

to

... bash '/wdqs/runUpdate.sh ...

is solving the issue.

Thanks a lot for your help.

Hi @Fdeuze,

Thanks for reporting back. Glad that works.

Running without -c and in single quotes is our current approach to postpone the bash variable expansion until running in the context of su, last line in the entrypoint.sh script. Here again, refactoring the privilege drop in the WDQS image should make this clearer in the future.

Closing this ticket for now. Feel free to reopen or create a new one for follow ups or new issues.

Best,
Robert

  NODES
HOME 1
Idea 1
idea 1
Note 1
os 29
text 1