carderne / signal-export

Export your Signal chats to markdown files with attachments
Other
436 stars 46 forks source link

Docker process failed... exit status 126 #92

Closed N-Prime closed 1 year ago

N-Prime commented 1 year ago

Desktop (please complete the following information):

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.

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.

0nobody0 commented 1 year ago

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.

carderne commented 1 year ago

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
N-Prime commented 1 year ago

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.

carderne commented 1 year ago

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
N-Prime commented 1 year ago

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

The docker run line (with sudo) works.

carderne commented 1 year ago

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)
  2. Then run:

    python test_docker.py

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

N-Prime commented 1 year ago

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.

carderne commented 1 year ago

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.
N-Prime commented 1 year ago

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:

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.

carderne commented 1 year ago

Thanks, fixed in 25d2fb3

N-Prime commented 1 year ago

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.