carderne/signal-export

Docker process failed... exit status 126

N-Prime opened this issue · 11 comments

Desktop (please complete the following information):

  • OS and version: [e.g. Ubuntu 22.04, Windows 11, WSL 2]

I've tried to get it working in several VMs - Ubuntu 22.04, Mint 21, Mint 21.1 (tried Mint twice because I had it working before in a Mint VM in November but no longer have it), and Fedora 37.

  • Terminal/shell used: [e.g. PowerShell, bash]

bash

Describe the bug

In all of them, docker is working (hello-world is successful), though to get docker installed on Mint, I had to edit the docker.list file to read "jammy" instead of vanessa or vera.

I copied my Signal folder (which contains the sql folder among others) to ~/.config

I see output for sigexport --help but if I try to run sigexport --list-chats or sigexport ~/signal-chats I get:

Docker process failed, see logs below:
Command '['docker', 'run', '--rm', '--volume=/home/USERNAME/.config/Signal:/Signal', 'carderne/sigexport:v1.5.4']' returned non-zero exit status 126.

To reproduce
Steps to reproduce the behavior. Please include the exact commands tried.

Create a VM, update it, install docker using the instructions from docs.docker.com, test docker (hello-world), install python3-pip if needed, edit .bashrc to add ~/.local/bin to PATH

Install signal-export with pip install signal-export

Check with sigexport --help

Copy Signal folder to ~/.config

Attempt to use sigexport with --list-chats or export with sigexport ~/signal-chats

As an aside, is there a specific distro that you test this with?

If you describe a configuration that you know works (distro, docker version, etc.), I can try to recreate it in a VM and just use that VM for exporting signal chats.

had a similar issue on a basic arch setup (was getting exit status 125). seemed to be a docker configuration issue but i wasn't able to look into it too much. used the No-Docker install method and was able to get things working.

To be honest it shouldn't matter too much what VM it runs in, as all the complicated bits happen inside the Docker container. (Unfortunately that means it's a but opaque when something goes wrong, and I haven't put in the effort to make it easier to inspect.)

Let's start from basic and build up to see what's going wrong.
Try the stuff below and let me know where and what goes wrong!

Run image with volume

docker run --rm -it --entrypoint='' \
  --volume $HOME/.config/Signal:/Signal \
  carderne/sigexport:v1.5.4 bash

Try running sigexport in the container

Inside the shell you get from running the above, run:

sigexport --source=/Signal --list-chats

Thank you for assisting with this!

The first command downloaded the image (when I ran sigexport previously it didn't download the image) and the second command worked for showing the chats.

But if you run sigexport --list-chats from a normal command line it still doesn't work?

What about this:

docker run --rm -it --volume $HOME/.config/Signal:/Signal carderne/sigexport:v1.5.4 --list-chats

sigexport --list-chats from a normal command line still gives the error with exit status 126.

The docker run line (with sudo) works.

Okay maybe the sudo thing is related?

Can you try this:

  1. Save this into a file called test_docker.py: (remember to change USERNAME).
import subprocess
cmd = ['docker', 'run', '--rm', '--volume=/home/USERNAME/.config/Signal:/Signal', 'carderne/sigexport:v1.5.4']
p = subprocess.run(cmd, capture_output=True, text=True, check=True)
print(p.stdout)
  1. Then run:
python test_docker.py

And? If you get a 126 error, maybe try with sudo?

I got a 126 without sudo. When run with sudo, I got a wall of text that contains the content of messages.

I also needed sudo for the docker command in your first comment of this thread. People write commands all the time, sometimes they need sudo, sometimes they don't, and I just figured that this was one of those commands that needs sudo and didn't think to mention it before.

Ok, so the only issue here was sudo...?

So:

  1. I should add a note about that to the README.
  2. (If you want) you can follow these instructions to enable sudo-less usage. In the mean time just run sudo sigexport outputdir.

On a system that set up docker without doing the post-install steps for sudo-less usage, using sudo sigexport --list-chats (or to an output directory) gives the error sudo: sigexport: command not found (edit - fixable with sudo -E env "PATH=$PATH" sigexport --list-chats).

On a system with docker set up for sudo-less usage everything works, so this seems to be a required step.
[Edit 2 - Not really required since workarounds are available. In my case, it didn't even occur to me to try sigexport with sudo this time because I know I didn't need it when it worked for me in the past (I know I just copied and pasted the commands in the README back then). If I did try it, I would have looked up the error and gotten it working.)

I think it's a good idea to add a note to the README because:

  • Some users will overlook the post-installation steps link at the docker site (what happened with me this time - I must have did it the first time months ago).
  • The post-installation link at docs.docker say the steps are optional ("These optional post-installation procedures shows you how to configure your Linux host machine to work better with Docker.") so some users who do go to that step might not opt to do them.
  • The error users receive when running sigexport without sudo-less usage enabled don't indicate a permissions issue with docker (just 126 and "command not found"), so users might not think to return to docker and do the post-install steps (it wouldn't have occurred to me if you hadn't mentioned it above).

Something to the effect of:

First off, install Docker (including following the post-installation steps for managing Docker as a non-root user) and make sure you have Python installed.

...would help keep people from going astray.

Thanks, fixed in 25d2fb3

Thanks again for your help!

I feel a bit foolish it turned out to be such a simple thing but am glad it's an easy fix.