# Commcare Deployement error

**URL:** <https://forum.dimagi.com/t/commcare-deployement-error/9113>\
**Category:** Developers\
**Created:** [June 29, 2022, 9:21pm UTC](https://forum.dimagi.com/t/commcare-deployement-error/9113 "2022-06-29T21:21:00Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rodolphe](https://dimagi.b-cdn.net/user_avatar/forum.dimagi.com/rodolphe/32/1825_2.png) [@Rodolphe](https://forum.dimagi.com/u/Rodolphe)\
**Post date:** [June 29, 2022, 9:21pm UTC](https://forum.dimagi.com/t/commcare-deployement-error/9113/1 "2022-06-29T21:21:00Z")

</div>

I am trying to upgrade commcare (self manage instance) to the latest version.

By following the documentation here Deploying CommCare HQ code changes i've executed the following commands :

1. update-code :  
it indicates me that there are **commcare-cloud has uncommitted changes:**. Is this an issue?

2. commcare-cloud deploy  
it return :  
[x.x.x.x] Executing task 'deploy\_commcare'  
Are you sure you want to preindex and deploy to monolith? [y/N] y  
[x.x.x.x] Executing task '\_setup\_release'  
[x.x.x.x] Executing task 'create'  
[x.x.x.x] sudo: mkdir -p /home/cchq/www/monolith/releases/2022-06-29\_17.28  
[x.x.x.x] Executing task 'update'  
[x.x.x.x] sudo: git submodule foreach "git fetch origin"  
[x.x.x.x] out: Entrée dans 'corehq/apps/hqmedia/static/hqmedia/MediaUploader'  
[x.x.x.x] out: fatal: impossible de se connecter à [github.com](http://github.com) :  
[x.x.x.x] out: [github.com](http://github.com)[0: x.x.x.x]: errno=Connexion terminée par expiration du délai d'attente  
[x.x.x.x] out:  
[x.x.x.x] out: fatal: run\_command a retourné un statut non-nul pour corehq/apps/hqmedia/static/hqmedia/MediaUploader  
[x.x.x.x] out: .  
[x.x.x.x] out:

Fatal error: sudo() received nonzero return code 128 while executing!

Requested: git submodule foreach "git fetch origin"  
Executed: sudo -S -p 'sudo password:' -H -u "cchq" /bin/bash -l -c "cd /home/cchq/www/monolith/current \>/dev/null && git submodule foreach "git fetch origin""

Aborting.  
!!! Parallel execution exception under host u'x.x.x.x':  
Process x.x.x.x:  
....  
Underlying exception:  
sudo() received nonzero return code 128 while executing!

```
Requested: git submodule foreach \"git fetch origin\"
Executed: sudo -S -p '\"'\"'sudo password:'\"'\"' -H -u \"cchq\" /bin/bash -l -c \"cd /home/cchq/www/monolith/current >/dev/null && git submodule foreach \\"git fetch origin\\"\"' --environment monolith"

```

Disconnecting from x.x.x.x... done.

Can you help me with this?  
Thanks,

P.s :  
I try to change repository to use https and git@ without success.

---

<div class="post-metadata">

**Author:** ![Sravan\_Reddy](https://dimagi.b-cdn.net/letter_avatar_proxy/v4/letter/s/da6949/32.png) [@Sravan\_Reddy](https://forum.dimagi.com/u/Sravan_Reddy)\
**Post date:** [June 30, 2022, 5:13am UTC](https://forum.dimagi.com/t/commcare-deployement-error/9113/2 "2022-06-30T05:13:17Z")

</div>

> [@Rodolphe](#):
>
> [x.x.x.x] sudo: mkdir -p /home/cchq/www/monolith/releases/2022-06-29\_17.28  
> [x.x.x.x] Executing task 'update'  
> [x.x.x.x] sudo: git submodule foreach "git fetch origin"

Hello Rodolphe,

It appears that there is some issue with git or github. I suggest you to try to run this command manually to troubleshoot the issue with git/github. Below is how to do this manually.

- Login to the above VM where the code is getting deployed
- Change to cchq user
- CD into `/home/cchq/www/monolith/releases/2022-06-29_17.28` directory
- Execute `git submodule foreach "git fetch origin"`

---

<div class="post-metadata">

**Author:** ![Rodolphe](https://dimagi.b-cdn.net/user_avatar/forum.dimagi.com/rodolphe/32/1825_2.png) [@Rodolphe](https://forum.dimagi.com/u/Rodolphe)\
**Post date:** [June 30, 2022, 8:39am UTC](https://forum.dimagi.com/t/commcare-deployement-error/9113/3 "2022-06-30T08:39:22Z")

</div>

Hi Sravan\_Reddy,

Thank you for your help.

> [@Sravan\_Reddy](#):
>
> - Login to the above VM where the code is getting deployed
> - Change to cchq user
> - CD into `/home/cchq/www/monolith/releases/2022-06-29_17.28` directory
> - Execute `git submodule foreach "git fetch origin"`

I have executed the command and I have this message :  
**fatal: not a git repository (or any of the parent directoriesà: .git**

By the way, all this would not be to the fact that it fails to connect to github when I run **commcare-cloud deploy** as shown here :

x.x.x.x] sudo: git submodule foreach "git fetch origin"  
[x.x.x.x] out: Entrée dans 'corehq/apps/hqmedia/static/hqmedia/MediaUploader'  
**[x.x.x.x] out: fatal: impossible de se connecter à [github.com](http://github.com) :**  
[x.x.x.x] out: [github.com](http://github.com)[0: x.x.x.x]: errno=Connexion terminée par expiration du délai d'attente  
[x.x.x.x] out:

---

<div class="post-metadata">

**Author:** ![jmiller](https://dimagi.b-cdn.net/letter_avatar_proxy/v4/letter/j/d9b06d/32.png) [@jmiller](https://forum.dimagi.com/u/jmiller)\
**Post date:** [June 30, 2022, 12:37pm UTC](https://forum.dimagi.com/t/commcare-deployement-error/9113/4 "2022-06-30T12:37:14Z")

</div>

Hello Rodolphe,

I suspect this is still an issue with the remote URLs for the git repositories on your current release (located at `/home/cchq/www/monolith/current`).

If you login to the server and `cd` to that directory (similar to what Sravan asked above, but in the `current` release this time, not the new release) and run the following two commands:

```bash
git remote get-url origin
git submodule foreach 'git remote get-url origin'

```

This will print out the remote URL for the commcare-hq repository (first command) and all the remote URLs for the submodules (second command). I suspect some of those URLs need to be adjusted.

---

<div class="post-metadata">

**Author:** ![Rodolphe](https://dimagi.b-cdn.net/user_avatar/forum.dimagi.com/rodolphe/32/1825_2.png) [@Rodolphe](https://forum.dimagi.com/u/Rodolphe)\
**Post date:** [July 1, 2022, 3:19pm UTC](https://forum.dimagi.com/t/commcare-deployement-error/9113/5 "2022-07-01T15:19:23Z")

</div>

> [@jmiller](#):
>
> /home/cchq/www/monolith/current

Hi Joel,

Thank you for the guidelines.

When i cd to /home/cchq/www/monolith/current and execute :

1. git remote -v  
origin [GitHub - dimagi/commcare-hq: CommCareHQ is the server backend for CommCare, the world's largest platform for designing, managing, and deploying robust, offline-first, mobile applications to frontline workers worldwide](https://github.com/dimagi/commcare-hq.git) (fetch)  
origin [GitHub - dimagi/commcare-hq: CommCareHQ is the server backend for CommCare, the world's largest platform for designing, managing, and deploying robust, offline-first, mobile applications to frontline workers worldwide](https://github.com/dimagi/commcare-hq.git) (push)

2. git submodule foreach 'git remote get-url origin'  
Entrée dans 'corehq/apps/hqmedia/static/hqmedia/MediaUploader'  
git://github.com/dimagi/MediaUploader.git  
Entrée dans 'submodules/commcare-translations'  
git://github.com/dimagi/commcare-translations.git  
Entrée dans 'submodules/couchdbkit-aggregate'  
git://github.com/dimagi/couchdbkit-aggregate.git  
Entrée dans 'submodules/django-digest-src'  
git://github.com/dimagi/django-digest.git  
Entrée dans 'submodules/django-no-exceptions'  
git://github.com/dimagi/django-no-exceptions.git  
Entrée dans 'submodules/langcodes'  
git://github.com/dimagi/langcodes.git  
Entrée dans 'submodules/python-digest'  
git://github.com/dimagi/python-digest.git  
Entrée dans 'submodules/xml2json'  
git://github.com/dimagi/xml2json.git

Also in **~/.commcare-cloud/repo** repository, remote repository is set on :  
origin [GitHub - dimagi/commcare-cloud: Tools for standing up and managing a CommCare HQ server environment](https://github.com/dimagi/commcare-cloud.git) (fetch)  
origin [GitHub - dimagi/commcare-cloud: Tools for standing up and managing a CommCare HQ server environment](https://github.com/dimagi/commcare-cloud.git) (push)

Are all these URLs correct?

---

<div class="post-metadata">

**Author:** ![jmiller](https://dimagi.b-cdn.net/letter_avatar_proxy/v4/letter/j/d9b06d/32.png) [@jmiller](https://forum.dimagi.com/u/jmiller)\
**Post date:** [July 1, 2022, 5:15pm UTC](https://forum.dimagi.com/t/commcare-deployement-error/9113/6 "2022-07-01T17:15:50Z")

</div>

Thanks for that information, Rodolphe.

The `https://` URL is fine, but the submodules are using the old `git://` URL format and need to be changed (either the `https://github.com/` prefix or the `git@github.com:` prefix will work, more info at [this GitHub doc](https://github.blog/2021-09-01-improving-git-protocol-security-github/#git-protocol-troubleshooting)).

For example, this is what I see on my system:

```shell
$ git remote get-url origin 
git@github.com:dimagi/commcare-hq.git

$ git submodule foreach 'git remote get-url origin'
Entering 'corehq/apps/hqmedia/static/hqmedia/MediaUploader'
git@github.com:dimagi/MediaUploader.git
Entering 'submodules/commcare-translations'
git@github.com:dimagi/commcare-translations.git
Entering 'submodules/couchdbkit-aggregate'
git@github.com:dimagi/couchdbkit-aggregate.git
Entering 'submodules/django-digest-src'
git@github.com:dimagi/django-digest.git
Entering 'submodules/django-no-exceptions'
git@github.com:dimagi/django-no-exceptions.git
Entering 'submodules/langcodes'
git@github.com:dimagi/langcodes.git
Entering 'submodules/python-digest'
git@github.com:dimagi/python-digest.git
Entering 'submodules/xml2json'
git@github.com:dimagi/xml2json.git

```

---

<div class="post-metadata">

**Author:** ![Rodolphe](https://dimagi.b-cdn.net/user_avatar/forum.dimagi.com/rodolphe/32/1825_2.png) [@Rodolphe](https://forum.dimagi.com/u/Rodolphe)\
**Post date:** [July 1, 2022, 6:58pm UTC](https://forum.dimagi.com/t/commcare-deployement-error/9113/7 "2022-07-01T18:58:42Z")

</div>

I didn't pay attention to the url. Many thanks Joel for the very good remark.

So I first modified the submodules urls format with [git@github.com](mailto:git@github.com) format, but deploy was still not working then I used the [https://github.com/](https://github.com/) format.

With this last one the deploy really started, but I face another error now.

> [x.x.x.x] sudo: virtualenv-clone /home/cchq/www/monolith/releases/2020-09-29\_11.57/python\_env-3.6 /home/cchq/www/monolith/releases/2022-07-01\_18.34/python\_env-3.6  
> [x.x.x.x] sudo: sed -i -e "s~/home/cchq/www/monolith/current/python\_env-3.6~/home/cchq/www/monolith/releases/2022-07-01\_18.34/python\_env-3.6~g" $(find /home/cchq/www/monolith/releases/2022-07-01\_18.34/python\_env-3.6/bin/ -type f)  
> [x.x.x.x] sudo: export HOME=/home/cchq && source /home/cchq/www/monolith/releases/2022-07-01\_18.34/python\_env-3.6/bin/activate && pip uninstall -r /home/cchq/www/monolith/releases/2022-07-01\_18.34/requirements/uninstall-requirements.txt --yes  
> [x.x.x.x] out: ERROR: Could not open requirements file: [Errno 2] Aucun fichier ou dossier de ce type: '/home/cchq/www/monolith/releases/2022-07-01\_18.34/requirements/uninstall-requirements.txt'  
> [x.x.x.x] out:
> 
> Fatal error: sudo() received nonzero return code 1 while executing!
> 
> Requested: export HOME=/home/cchq && source /home/cchq/www/monolith/releases/2022-07-01\_18.34/python\_env-3.6/bin/activate && pip uninstall -r /home/cchq/www/monolith/releases/2022-07-01\_18.34/requirements/uninstall-requirements.txt --yes  
> Executed: sudo -S -p 'sudo password:' -H -u "cchq" /bin/bash -l -c "cd /home/cchq/www/monolith/releases/2022-07-01\_18.34 \>/dev/null && export HOME=/home/cchq && source /home/cchq/www/monolith/releases/2022-07-01\_18.34/python\_env-3.6/bin/activate && pip uninstall -r /home/cchq/www/monolith/releases/2022-07-01\_18.34/requirements/uninstall-requirements.txt --yes"
> 
> Aborting.  
> !!! Parallel execution exception under host u'x.x.x.x':
> 
> ...  
> Underlying exception:  
> sudo() received nonzero return code 1 while executing!
> 
> ```
> Requested: export HOME=/home/cchq && source /home/cchq/www/monolith/releases/2022-07-01_18.34/python_env-3.6/bin/activate && pip uninstall -r /home/cchq/www/monolith/releases/2022-07-01_18.34/requirements/uninstall-requirements.txt --yes
> Executed: sudo -S -p '\"'\"'sudo password:'\"'\"' -H -u \"cchq\" /bin/bash -l -c \"cd /home/cchq/www/monolith/releases/2022-07-01_18.34 >/dev/null && export HOME=/home/cchq && source /home/cchq/www/monolith/releases/2022-07-01_18.34/python_env-3.6/bin/activate && pip uninstall -r /home/cchq/www/monolith/releases/2022-07-01_18.34/requirements/uninstall-requirements.txt --yes\"' --environment monolith"
> 
> ```
> 
> Disconnecting from x.x.x.x... done.

This error looks familiar to you?

---

<div class="post-metadata">

**Author:** ![jmiller](https://dimagi.b-cdn.net/letter_avatar_proxy/v4/letter/j/d9b06d/32.png) [@jmiller](https://forum.dimagi.com/u/jmiller)\
**Post date:** [July 1, 2022, 7:27pm UTC](https://forum.dimagi.com/t/commcare-deployement-error/9113/8 "2022-07-01T19:27:31Z")

</div>

Hmm unfortunately, no.

> [@Rodolphe](#):
>
> ERROR: Could not open requirements file: [Errno 2] Aucun fichier ou dossier de ce type: '/home/cchq/www/monolith/releases/2022-07-01\_18.34/requirements/uninstall-requirements.txt'

This "file not found" error is puzzling to me. I'm not familiar with that file or what part of a deploy needs it. Maybe someone who has more `cchq` familiarity will know when a deploy might expect this file?

---

<div class="post-metadata">

**Author:** ![Rodolphe](https://dimagi.b-cdn.net/user_avatar/forum.dimagi.com/rodolphe/32/1825_2.png) [@Rodolphe](https://forum.dimagi.com/u/Rodolphe)\
**Post date:** [July 1, 2022, 7:34pm UTC](https://forum.dimagi.com/t/commcare-deployement-error/9113/9 "2022-07-01T19:34:19Z")

</div>

I get it.

Maybe I'll create another post to specify another more specific topic.

Thanks for the help!
