gnzsnz / ib-gateway-docker

Docker image with IB Gateway/TWS and IBC
https://github.com/users/gnzsnz/packages/container/package/ib-gateway
MIT License
249 stars 46 forks source link

Failed to init libxfconf #185

Open shawnngtq opened 13 hours ago

shawnngtq commented 13 hours ago

Describe the bug

Under Starting IBC/TWS, I encounter Failed to init libxfconf

To Reproduce

.env

ALLOW_BLIND_TRADING=no
AUTO_LOGOFF_TIME=
AUTO_RESTART_TIME=11:59 PM
BYPASS_WARNING=
CUSTOM_CONFIG=
EXISTING_SESSION_DETECTED_ACTION=primary
JAVA_HEAP_SIZE=
PASSWD=
READ_ONLY_API=no
RELOGIN_AFTER_TWOFA_TIMEOUT=yes
SAVE_TWS_SETTINGS=
SSH_ALIVE_COUNT=
SSH_ALIVE_INTERVAL=
SSH_OPTIONS=
SSH_PASSPHRASE=
SSH_RDP_PORT=
SSH_REMOTE_PORT=
SSH_RESTART=
SSH_TUNNEL=
SSH_USER_TUNNEL=
TIME_ZONE=
TRADING_MODE=paper
TWOFA_DEVICE=
TWOFA_EXIT_INTERVAL=
TWOFA_TIMEOUT_ACTION=restart
TWS_ACCEPT_INCOMING=
TWS_COLD_RESTART=
TWS_PASSWORD_PAPER=password
TWS_PASSWORD=password
TWS_SETTINGS_PATH=
TWS_USERID_PAPER=username
TWS_USERID=username
VNC_SERVER_PASSWORD=myVncPassword

docker-compose.yml, tried both stable and latest

# https://github.com/gnzsnz/ib-gateway-docker/blob/master/tws-docker-compose.yml
name: algo-trader
services:
  tws:
    restart: unless-stopped
    devices:
      - /dev/dri:/dev/dri #recomended
    shm_size: "1gb" #recomended
    security_opt:
      - seccomp:unconfined #recomended
    build:
      context: ./latest
      dockerfile: Dockerfile.tws
      tags:
        - "ghcr.io/gnzsnz/tws-rdesktop:latest"
    image: ghcr.io/gnzsnz/tws-rdesktop:latest
    environment:
      PUID: 1000
      PGID: 1000
      PASSWD: ${PASSWD:-}
      TWS_USERID: ${TWS_USERID}
      TWS_PASSWORD: ${TWS_PASSWORD}
      TRADING_MODE: ${TRADING_MODE:-paper}
      TWS_USERID_PAPER: ${TWS_USERID_PAPER:-}
      TWS_PASSWORD_PAPER: ${TWS_PASSWORD_PAPER:-}
      TWS_SETTINGS_PATH: ${TWS_SETTINGS_PATH:-}
      TWS_ACCEPT_INCOMING: ${TWS_ACCEPT_INCOMING:-manual}
      READ_ONLY_API: ${READ_ONLY_API:-}
      TWOFA_TIMEOUT_ACTION: ${TWOFA_TIMEOUT_ACTION:-exit}
      BYPASS_WARNING: ${BYPASS_WARNING:-}
      AUTO_RESTART_TIME: ${AUTO_RESTART_TIME:-}
      AUTO_LOGOFF_TIME: ${AUTO_LOGOFF_TIME:-}
      TWS_COLD_RESTART: ${TWS_COLD_RESTART:-}
      SAVE_TWS_SETTINGS: ${SAVE_TWS_SETTINGS:-}
      RELOGIN_AFTER_TWOFA_TIMEOUT: ${RELOGIN_AFTER_TWOFA_TIMEOUT:-no}
      TWOFA_EXIT_INTERVAL: ${TWOFA_EXIT_INTERVAL:-60}
      TWOFA_DEVICE: ${TWOFA_DEVICE:-}
      EXISTING_SESSION_DETECTED_ACTION: ${EXISTING_SESSION_DETECTED_ACTION:-primary}
      ALLOW_BLIND_TRADING: ${ALLOW_BLIND_TRADING:-no}
      TIME_ZONE: ${TIME_ZONE:-Etc/UTC}
      TZ: ${TIME_ZONE:-Etc/UTC}
      CUSTOM_CONFIG: ${CUSTOM_CONFIG:-NO}
      JAVA_HEAP_SIZE: ${JAVA_HEAP_SIZE:-}
      SSH_TUNNEL: ${SSH_TUNNEL:-}
      SSH_OPTIONS: ${SSH_OPTIONS:-}
      SSH_ALIVE_INTERVAL: ${SSH_ALIVE_INTERVAL:-}
      SSH_ALIVE_COUNT: ${SSH_ALIVE_COUNT:-}
      SSH_PASSPHRASE: ${SSH_PASSPHRASE:-}
      SSH_REMOTE_PORT: ${SSH_REMOTE_PORT:-}
      SSH_USER_TUNNEL: ${SSH_USER_TUNNEL:-}
      SSH_RESTART: ${SSH_RESTART:-}
      SSH_RDP_PORT: ${SSH_RDP_PORT:-}
    volumes:
      - mypath/config:/config # optional
      - mypath/tmp:/tmp # recommended for performance
    # custom certificate and key
    #- ${PWD}/keylock:/keylock # required to avoid key generation by container
    #- ${PWD/key.pem:/etc/xrdp/key.pem # key
    #- ${PWD}/cert.pem:/etc/xrdp/cert.pem # cert
    ports:
      - "127.0.0.1:7498:7498" # live
      - "127.0.0.1:7499:7499" # paper
      - "127.0.0.1:3389:3389" # xrdp

docker compose config MANDATORY ⚠️⚠️

name: algo-trader
services:
  tws:
    build:
      context: /boot/config/plugins/compose.manager/projects/interactive-brokers/latest
      dockerfile: Dockerfile.tws
      tags:
        - ghcr.io/gnzsnz/tws-rdesktop:latest
    devices:
      - /dev/dri:/dev/dri
    environment:
      ALLOW_BLIND_TRADING: "no"
      AUTO_LOGOFF_TIME: ""
      AUTO_RESTART_TIME: 11:59 PM
      BYPASS_WARNING: ""
      CUSTOM_CONFIG: "NO"
      EXISTING_SESSION_DETECTED_ACTION: primary
      JAVA_HEAP_SIZE: ""
      PASSWD: ""
      PGID: "1000"
      PUID: "1000"
      READ_ONLY_API: "no"
      RELOGIN_AFTER_TWOFA_TIMEOUT: "yes"
      SAVE_TWS_SETTINGS: ""
      SSH_ALIVE_COUNT: ""
      SSH_ALIVE_INTERVAL: ""
      SSH_OPTIONS: ""
      SSH_PASSPHRASE: ""
      SSH_RDP_PORT: ""
      SSH_REMOTE_PORT: ""
      SSH_RESTART: ""
      SSH_TUNNEL: ""
      SSH_USER_TUNNEL: ""
      TIME_ZONE: Etc/UTC
      TRADING_MODE: paper
      TWOFA_DEVICE: ""
      TWOFA_EXIT_INTERVAL: "60"
      TWOFA_TIMEOUT_ACTION: restart
      TWS_ACCEPT_INCOMING: manual
      TWS_COLD_RESTART: ""
      TWS_PASSWORD: password
      TWS_PASSWORD_PAPER: password
      TWS_SETTINGS_PATH: ""
      TWS_USERID: username
      TWS_USERID_PAPER: username
      TZ: Etc/UTC
    image: ghcr.io/gnzsnz/tws-rdesktop:latest
    labels:
      net.unraid.docker.icon: ""
      net.unraid.docker.managed: composeman
      net.unraid.docker.shell: ""
      net.unraid.docker.webui: ""
    networks:
      default: null
    ports:
      - mode: ingress
        host_ip: 127.0.0.1
        target: 7498
        published: "7498"
        protocol: tcp
      - mode: ingress
        host_ip: 127.0.0.1
        target: 7499
        published: "7499"
        protocol: tcp
      - mode: ingress
        host_ip: 127.0.0.1
        target: 3389
        published: "3389"
        protocol: tcp
    restart: unless-stopped
    security_opt:
      - seccomp:unconfined
    shm_size: "1073741824"
    volumes:
      - type: bind
        source: mypath/config
        target: /config
        bind:
          create_host_path: true
      - type: bind
        source: mypath/tmp
        target: /tmp
        bind:
          create_host_path: true
networks:
  default:
    name: algo-trader_default

Expected

Work as expected.

Container logs

If applicable, add the container logs docker logs <CONTAINER> or docker compose logs to help explain your problem. MANDATORY ⚠️⚠️

[custom-init] Service files found in /custom-services.d
[custom-init] start_session.sh: service detected, copying...
[custom-init] start_session.sh: copied
[migrations] started
[migrations] no migrations found
───────────────────────────────────────

      ██╗     ███████╗██╗ ██████╗
      ██║     ██╔════╝██║██╔═══██╗
      ██║     ███████╗██║██║   ██║
      ██║     ╚════██║██║██║   ██║
      ███████╗███████║██║╚██████╔╝
      ╚══════╝╚══════╝╚═╝ ╚═════╝

   Brought to you by linuxserver.io
───────────────────────────────────────

To support LSIO projects visit:
https://www.linuxserver.io/donate/

───────────────────────────────────────
GID/UID
───────────────────────────────────────

User UID:    1000
User GID:    1000
───────────────────────────────────────

Generating 2048 bit rsa key...

ssl_gen_key_xrdp1 ok

saving to rsakeys.ini

........+...+..+.+...........+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*.+..+....+..+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*................+...+....+.....+......+....+..+....+..+...............+...............+...+....+...+..+......+....+.....+............+................+.....+....+.....+......+...+......+....+..+....+...+............+......+..+...+.......+..+.........+.+..............+.+.....+.+..+......+....+..+....+.....+......+.+.........+........+.......+........+...+...+.+.....+...+.+......+.........+......+.....+...+.............+..............+.+...+..+....+.........+.....+....+...+...+..+.........+.........+.+......+........+......................+.....+.......+..+...+...............+...+.......+.....+...+...+.......+..+.......+...........+...+.+...+..+.............+..+.........+......+....+.............................+.+......+...+...+...+......+........+.+.....+....+........+.........+.........+.........+...+.........+......+..........+........+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
....+............+.........+...+...+.......+.....+.+......+...+...+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*.+........+...+...+......+.+...+...........+.+..+.+..+............+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*..................+..+....+..................+..+....+.....+......+................+..+..........+..+....+.....+............+.............+.....+.+...+.....+.+............+..+..................+.......+............+...........+........................+....+..+...+.......+...+.........+...+..+.+.....+......+.+..+.......+...+...+........+.+.........+.....+.......+.....+....+........+...+....+......+...+..+....+...+..+....+......+.....+.+..............+...+...+...+..........+.....+.........+................+....................+.+.....+...+............+......+...+.+......+.....+.............+..+...+....+...+...+..+....+...+........+.......+.....+......+........................+.+.....+.+........+.......+...+..+....+..+.......+......+......+...+......+....................+.+........+......+.+........+.+...........+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-----
**** creating video group videoxq5p with id 18 ****
**** adding /dev/dri/renderD128 to video group videoxq5p with id 18 ****
**** permissions for /dev/dri/card0 are good ****
[custom-init] No custom files found, skipping...
*************************************************************************
.> Launching IBC/TWS service
*************************************************************************
.> Setting user password
Connection to localhost (127.0.0.1) 3350 port [tcp/*] succeeded!
Connection to localhost (127.0.0.1) 3389 port [tcp/ms-wbt-server] succeeded!
uid=0(root) gid=0(root) groups=0(root)
.> Setting timezone to: Etc/UTC
.> Openning Xrdp session
[ls.io-init] done.
.> Xrdp started on DISPLAY=:10
.> Setting permissions for /opt/ibkr and /opt/ibc
sh: 1: xauth: not found
*************************************************************************
.> Starting IBC/TWS
*************************************************************************
.> Running as user
uid=1000(abc) gid=1000(abc) groups=1000(abc),18(videoxq5p),27(sudo),100(users)
.> Disabling ssh-agent and gpg-agent
Failed to init libxfconf: Error spawning command line “dbus-launch --autolaunch=080a2ae9ed91449ab9c221ecaceb1386 --binary-syntax --close-stderr”: Child process exited with code 1.

Versions

Please complete the following information:

Additional context

I suspect it maybe due to the following:

  1. D-Bus daemon already running
  2. libxfconf not available
root@myPcName:~# ps aux | grep -i dbus
message+  1627  0.0  0.0   5180  1528 ?        Ss   Jul28   0:00 /usr/bin/dbus-daemon --system
root      3858  0.0  0.0   4048  2268 pts/2    S+   22:51   0:00 grep -i dbus
root@myPcName:~# ldconfig -p | grep libxfconf
root@myPcName:~# 

But aren't these inside container itself? So my OS shouldn't impact it?

gnzsnz commented 8 hours ago

I can't reproduce your issue. i just tried with stable and it works just fine for me.

you seem to have an issue while disabling agents but i don't get any issue there.

your image digest does not match stable, nor latest, please do a docker compose pull tws and then try again