firoorg / firo

The privacy-focused cryptocurrency
https://firo.org
MIT License
720 stars 354 forks source link

docker image on dockerhub firoorg/firod doesn't build #1241

Open erciccione opened 1 year ago

erciccione commented 1 year ago

Tried to run the docker image as explained in https://github.com/firoorg/firo#running-with-docker, but it fails (no container is started). Tried to run interactively to see what's going on and i consistently get this error:

2023-05-17 06:54:05 Firo version v0.14.12.1-gc7e3ef0e6
2023-05-17 06:54:05 InitParameterInteraction: parameter interaction: -whitelistforcerelay=1 -> setting -whitelistrelay=1
2023-05-17 06:54:05 Assuming ancestors of block 50aff78270725ec253a722ec18069deb233f2e57eb7d64479f027141619cdda4 have valid signatures.
2023-05-17 06:54:05 Error: Cannot obtain a lock on data directory /home/firod/.firo. Firo Core is probably already running. No such file or directory.
Error: Cannot obtain a lock on data directory /home/firod/.firo. Firo Core is probably already running. No such file or directory.

I confirm Firo is not already running.

justanwar commented 1 year ago

I got the same failure when running as docker run -d --name firod -v "${HOME}/.firo:/home/firod/.firo" firoorg/firod. Removing the volume flag and arguments causes the container to start normally, but this means that nothing is saved to disk.

reubenyap commented 1 year ago

@erciccione Can you confirm that it is fixed by #1251 ?

justanwar commented 1 year ago

This is a permissions issue, not fixed by that PR.

PanderMusubi commented 1 year ago

Any progress on this one?

justanwar commented 1 year ago

@NorseGaud Do you have any insights on this?

NorseGaud commented 1 year ago

Hey @justanwar , looks like the user has a host permission issue that needs to be solved. @erciccione , please provide output from the following commands:

erciccione commented 1 year ago

I tested the image again today and seems to be working now, not sure why but might have been a local problem indeed. If @justanwar confirms the problem is solved for them too, i'd close this issue.

justanwar commented 1 year ago

I ran docker with sudo. Was able to replicate the original issue only if the .firo datadir does not exist.

Output of docker logs firod if .firo datadir exists:

2023-09-01 11:05:21 Firo version v0.14.12.1-gc7e3ef0e6
2023-09-01 11:05:21 InitParameterInteraction: parameter interaction: -whitelistforcerelay=1 -> setting -whitelistrelay=1
2023-09-01 11:05:21 Assuming ancestors of block 50aff78270725ec253a722ec18069deb233f2e57eb7d64479f027141619cdda4 have valid signatures.
Error: Cannot obtain a lock on data directory /home/firod/.firo. Firo Core is probably already running. No such file or directory.
2023-09-01 11:05:21 Error: Cannot obtain a lock on data directory /home/firod/.firo. Firo Core is probably already running. No such file or directory.

If .firo datadir does not exist:

2023-09-01 11:08:20 Firo version v0.14.12.1-gc7e3ef0e6
2023-09-01 11:08:20 InitParameterInteraction: parameter interaction: -whitelistforcerelay=1 -> setting -whitelistrelay=1
2023-09-01 11:08:20 Assuming ancestors of block 50aff78270725ec253a722ec18069deb233f2e57eb7d64479f027141619cdda4 have valid signatures.

@NorseGaud :

ls -halt ${HOME}/.firo
total 123M
-rw-------  1 justanwar justanwar    2 Sep  1 19:08 firod.pid
drwxr-x--- 42 justanwar justanwar 4.0K Sep  1 19:08 ..
drwxrwxr-x 16 justanwar justanwar 4.0K Sep  1 19:00 .
-rw-------  1 justanwar justanwar 9.8M Sep  1 18:58 debug.log
-rw-------  1 justanwar justanwar 516K Sep  1 18:58 wallet.dat
-rw-------  1 justanwar justanwar 516K Sep  1 18:58 wallet-current.dat
-rw-------  1 justanwar justanwar  22K Sep  1 18:58 fee_estimates.dat
-rw-------  1 justanwar justanwar   17 Sep  1 18:58 mempool.dat
-rw-------  1 justanwar justanwar   91 Sep  1 18:58 banlist.dat
-rw-------  1 justanwar justanwar 1.3M Sep  1 18:58 peers.dat
drwx------  2 justanwar justanwar 4.0K Sep  1 18:58 chainstate
drwx------  2 justanwar justanwar  20K Sep  1 18:58 evodb
drwx------  2 justanwar justanwar 4.0K Sep  1 18:58 llmq
drwx------ 14 justanwar justanwar 4.0K Aug 30 19:14 regtest-ql
-rw-rw-r--  1 justanwar justanwar 110M Aug 25 15:47 testnet3-backup.zip
-rw-------  1 justanwar justanwar 354K Jul 20 20:24 elysium.log
drwx------  2 justanwar justanwar  44K Jul 20 20:24 MP_persist
drwx------  2 justanwar justanwar 4.0K Jul 20 20:08 MP_txlist
drwx------  2 justanwar justanwar 4.0K Jul 20 20:04 Elysium_TXDB
drwx------  2 justanwar justanwar 4.0K Jul 20 20:04 MP_spinfo
drwx------  2 justanwar justanwar 4.0K Jul 20 20:04 MP_lelantus
drwx------  2 justanwar justanwar 4.0K Jul 20 20:04 MP_stolist
drwx------  3 justanwar justanwar 4.0K Mar 25 06:14 blocks
-rw-rw-r--  1 justanwar justanwar   98 Nov 13  2022 firo.conf
drwx------  2 justanwar justanwar 4.0K Oct 12  2022 persistent
drwx------  4 justanwar justanwar 4.0K Oct 12  2022 certificates
drwx------ 14 justanwar justanwar 4.0K Oct 11  2022 testnet3
-rw-------  1 justanwar justanwar   87 Oct  1  2022 db.log
-rw-------  1 justanwar justanwar    0 Sep 27  2022 .lock
ls -halt ${HOME}
total 53M
drwxr-x--- 42 justanwar justanwar 4.0K Sep  1 19:08  .
drwxrwxr-x 16 justanwar justanwar 4.0K Sep  1 19:00  .firo
-rw-------  1 justanwar justanwar  15K Aug 30 19:24  .bash_history
drwxr-xr-x  5 justanwar justanwar 4.0K Aug 30 17:27  Downloads
-rw-------  1 justanwar justanwar   20 Jul 20 20:30  .lesshst
-rw-r--r--  1 justanwar justanwar  34M Jul 20 19:57  firo-7c014dffd989-x86_64-linux-gnu.tar.gz
drwxrwxr-x 15 justanwar justanwar 4.0K Jul 20 19:33  firo
drwx------ 32 justanwar justanwar 4.0K Jul 20 19:27  .config
drwxrwxr-x 10 justanwar justanwar 4.0K Jul 20 19:27  firo-client
drwx------ 31 justanwar justanwar 4.0K Jul 20 19:25  .cache
drwxr-xr-x  3 justanwar justanwar 4.0K Jul 20 16:59  firo-7c014dffd989
drwxr-xr-x  3 justanwar justanwar 4.0K Jun 11 04:28  firo-c783ab64212d
drwxr-xr-x  4 justanwar justanwar 4.0K Jun  9 12:57  output
drwxrwxr-x  2 justanwar justanwar 4.0K Jun  9 12:57  .ssh
drwxr-xr-x  4 justanwar justanwar 4.0K Jun  9 02:18  e903a7caa39f
drwxrwxr-x 19 justanwar justanwar 4.0K May 30 23:38  .ccache
drwxrwxr-x  5 justanwar justanwar 4.0K May 27 19:57  .npm
drwxrwxr-x  8 justanwar justanwar 4.0K May 27 19:55  .nvm
-rw-r--r--  1 justanwar justanwar 3.9K May 27 19:54  .bashrc
-rw-rw-r--  1 justanwar justanwar  389 May 27 19:54  .wget-hsts
drwxrwxr-x 13 justanwar justanwar 4.0K Mar 22 12:16  zcoin-dev
drwxrwxr-x 11 justanwar justanwar 4.0K Mar 14 02:12  .firodex
drwxrwxr-x 12 justanwar justanwar 4.0K Feb 26  2023  electrum-firo
drwx------  7 justanwar justanwar 4.0K Feb 26  2023  .electrum-firo
drwxrwxr-x 17 justanwar justanwar 4.0K Feb 13  2023  Python-3.9.9
drwxrwxr-x  5 justanwar justanwar 4.0K Jan 31  2023  .electrum-venv
-rw-rw-r--  1 justanwar justanwar  23K Jan 27  2023 'electrum-firo wine build.txt'
drwxr-xr-x  2 justanwar justanwar 4.0K Jan 15  2023  Desktop
drwxr-xr-x  4 justanwar justanwar 4.0K Jan 15  2023  .wine
drwxr-xr-x  3 justanwar justanwar 4.0K Jan 15  2023  Games
drwxrwxr-x  4 justanwar justanwar 4.0K Dec  5  2022  .stackwallet
drwxr-xr-x  8 justanwar justanwar 4.0K Nov 21  2022  coinswaps
drwx------  3 justanwar justanwar 4.0K Nov 20  2022  .gnupg
drwx------  7 justanwar justanwar 4.0K Nov 20  2022  .local
drwxrwxr-x  8 justanwar justanwar 4.0K Nov 16  2022  coinswaps.old
-rw-rw-r--  1 justanwar justanwar  20K Nov 16  2022  get-docker.sh
drwx------  7 justanwar justanwar 4.0K Oct 17  2022  .zoom
drwxr-xr-x  3 justanwar justanwar 4.0K Oct 17  2022  Documents
drwxrwxr-x  2 justanwar justanwar 4.0K Oct 13  2022  winsshterm
-rwxrwxr-x  1 justanwar justanwar 4.8K Oct  1  2022  llmq_50_60.sh
-rwxrwxr-x  1 justanwar justanwar 2.5K Oct  1  2022  llmq_400.sh
-rwxrwxr-x  1 justanwar justanwar  260 Sep 29  2022  chainlocks.sh
drwx------  3 justanwar justanwar 4.0K Sep 28  2022  .pki
drwxr-xr-x  3 justanwar justanwar 4.0K Sep 28  2022  Videos
drwxr-xr-x  2 justanwar justanwar 4.0K Sep 28  2022  Music
drwxr-xr-x  2 justanwar justanwar 4.0K Sep 28  2022  Public
drwxr-xr-x  2 justanwar justanwar 4.0K Sep 28  2022  Templates
drwxr-xr-x  3 root      root      4.0K Sep 28  2022  ..
drwxr-xr-x  3 justanwar justanwar 4.0K Sep 28  2022  Pictures
drwxr-xr-x  3 justanwar justanwar 4.0K Sep 27  2022  .var
drwx------  4 justanwar justanwar 4.0K Sep 27  2022  .mozilla
-rw-r--r--  1 justanwar justanwar    0 Sep 27  2022  .sudo_as_admin_successful
-rw-r--r--  1 justanwar justanwar  220 Jan  7  2022  .bash_logout
-rw-r--r--  1 justanwar justanwar  807 Jan  7  2022  .profile
-rw-rw-r--  1 justanwar justanwar  19M Nov 16  2021  Python-3.9.9.tar.xz
whoami
justanwar
id
uid=1000(justanwar) gid=1000(justanwar) groups=1000(justanwar),4(adm),27(sudo),122(lpadmin)
NorseGaud commented 1 year ago

https://github.com/firoorg/firo/issues/1247 should be linked to this one.

NorseGaud commented 1 year ago

@justanwar , please show the exact steps you take to repro. I can't from my end.

erciccione commented 1 year ago

Was able to replicate the original issue only if the .firo datadir does not exist.

I can reproduce

@justanwar , please show the exact steps you take to repro. I can't from my end.

Rename or remove the .firo folder, then run docker run --name firod -v "${HOME}/.firo:/home/firod/.firo" firoorg/firod without using -d and you should see the error message:

Error: Cannot obtain a lock on data directory /home/firod/.firo. Firo Core is probably already running. No such file or directory.
skironDotNet commented 8 months ago

there is a better way, by using ready complied version from github create build.sh file with

VERSION=$(curl -sL https://api.github.com/repos/firoorg/firo/releases/latest | jq -r ".tag_name")
VERSION=${VERSION#v} #skip v
docker build -t firo --build-arg VERSION=$VERSION .

Create Dockerfile with (you can adjust CMD to ENTRYPOINT, but the assumption here is you'll map blockchain dir to container /data dir )

FROM ubuntu

ARG VERSION

RUN apt-get update && apt-get install -y wget

RUN wget https://github.com/firoorg/firo/releases/download/v${VERSION}/firo-${VERSION}-linux64.tar.gz

RUN tar xzf firo-${VERSION}-linux64.tar.gz

RUN cp firo-*/bin/firod /usr/bin/firod
RUN chmod +x /usr/bin/firod 
RUN rm -rf firo-*

RUN apt-get remove -y wget

RUN apt clean

EXPOSE 8168/tcp

RUN mkdir /data

CMD ["firod", "-datadir=/data"]

now chmod +x build.sh ./build.sh

erciccione commented 7 months ago

@skironDotNet thanks for your suggestion, but ideally we should fix the image on dockerhub without relying on pre-compiled builds.

For now, a workaround was added with https://github.com/firoorg/firo/pull/1325.