开云体育

ctrl + shift + ? for shortcuts
© 2025 Groups.io

Re: IBC headless gateway with wsl2?

 

All working well now for several hours using tigervnc-standalone-server package and port 5900 open

Next step is to implement the loopback option with port forwarding.

This is a major breakthrough for me as the documented solution :
?which is a summary of?
?
doesn't work

Thanks to 闯ü谤驳别苍 for publishing the solution!!

Happy Bot trading everyone!


Re: Gateway crashing on AWS

 

开云体育

I’ve now got both my live TWS and paper Gateway running on my new Ubuntu Server 22.04 LTS, including auto-restarts at 05:50 GMT.

?

I’m using xvfb and x11vnc, with RealVNC viewer, so pretty much the same setup as you on the server. If it hits the same problem you described, I’ll try switching to TigerVNC as 闯ü谤驳别苍 suggested in the ‘IBC headless gateway with wsl2?’ thread.

?

Richard

?


Re: IBC headless gateway with wsl2?

 

Thanks a lot Jurgen, that was the answer I was looking for. let me try this out and report back to the community here


Re: IBC headless gateway with wsl2?

 

The setup you are following is way too complex and outright dangerous when you run it within a cloud instance. You will severely compromise your server's security if you punch a hole into the AWS firewall for port 5900 so you can access VNC directly. The correct way is for the VNC server as well as TWS/IBGW to operate only on the loopback/localhost interface and to shield them completely from any and all direct access outside of the server. You would then use ssh port forwarding with strong encryption and authentication to connect your VNC client securely through the AWS firewall.

TWS/IBGW use JavaFX for their GUIs and the recent V10 versions require a pretty sophisticated "graphics" card. There is a good chance that Xvfb/TightVNC just are not good enough.

We run an AWS instance with TWS rock stable for years and use TigerVNC. I'd suggest you uninstall Xvfb and TightVNC and replace it with just the tigervnc-standalone-server package.It performs both the frame buffer and VNC server functions and, for startup, you'd use a simple command such as "vncserver :0 -localhost -nolisten tcp"

You can also look at the topic "Can anyone help with crashing IB gateway?" that describes similar IBGW crashes.

闯ü谤驳别苍


Re: Gateway crashing on AWS

 

开云体育

Ok, yes I understand now where the TWS log stuff is coming from: it’s actually what’s displayed in the Gateway’s log pane at the time the window was opened or activated.

?

You didn’t say whether you tried the export DISPLAY=:0 command. The reason I thought this might help is that it’s just possible that Gateway occasionally, for some reason, spawns a separate GUI process, so it would need to inherit the DISPLAY variable which won’t happen if it hasn’t been exported. But I have no evidence that this actually happens.

?

I’ve actually just created an Ubuntu Server 22.04 LTS virtual machine so I can try setting this all up myself. I’ll let you know how I get on.

?

Regarding running on home hardware and internet connection: my internet connection is full fibre to the premises, running at 140Mbps. It’s almost completely reliable: I can’t actually recall any failures at all – other than power failures which knock out the router but are rare here these days, in spite of being in very rural Scotland (rare enough that I’ve never seriously considered bothering with UPSs). The only negative is a ping time of 34ms to the IB servers, so I’m not going to win any races to hit the latest bid or ask!

?

I run TWS/Gateway on a Dell server from 2014 (actually in a Hyper-V VM hosted on that machine). The host has two 6-core hyperthreaded CPUs, and 48GB of RAM. It’s absolutely rock solid. It also runs two sizeable SQL Server databases for market data collection, a mail server, an Ubuntu VM, and a handful of Windows VMs. The VMs are all also rock solid – except Ubuntu which I have to re-install every so often because it gets itself in a mess that I don’t have enough Linux-fu to dig myself out of.

?

I have two other physical computers of around the same age: one is a Microsoft Surface Pro 2, and the other is a desktop from a UK manufacturer. They are also entirely reliable, if a bit slow. If push came to shove, I’d be happy to run my trading stuff on any of them.

?

So I really don’t see there’s any real issue with running on home hardware. Of course, if I were running some AI-driven resource-hungry trading bot that might be a different story in terms of required computing power, but reliability is not really a factor.

?

I would also say that there’s little point in worrying about cloud servers until one has something approaching a viable trading strategy.

?

Richard

?

?


Re: IBC headless gateway with wsl2?

 

Can you give me more details please....

I have followed the setup from


But it doesn't stay up more than a couple of hours before a fatal Java error


Re: Gateway crashing on AWS

 

I changed the config files to spit out as much logging info as possible. This logfile is not editted

I am surprissed that you and others are not running the GW/IBC on the cloud, how can you have a bot rely on your home hardware and internet connection?

I have almost exhausted my options with the xvfb and vnc server combo on ubuntu, might have to try doing the same on amazon linux ......


Re: Gateway crashing

 

开云体育

Well, headless running isn’t an area of expertise for me, but IBC and Gateway certainly seem to be running ok.

?

The only thing I can think of is that maybe you should add:

?

export DISPLAY=:0

?

after the xvfb command.

?

By the way, I’m curious that your logfile contains a lot of lines from the Gateway logfile. Did you edit them in? If not, how did they get there? In general it’s very rare that there’s any value in the Gateway/TWS logfiles for diagnosing IBC issues.

?

Richard

?

?

?

?


Re: Gateway crashing

 

Here is a screen shot of my Vnc client being closed ...


Re: Gateway crashing

 

Please find attached my logfile ....

Qn: Should I be suing X11 forwarding with Putty instead of using a vnc server?

Thanks in advance
Paul


Re: Problem witrh Gateway 10.22

 

Oooops, please disregard my last question. I had a senior moment. Installing xterm (which was apparently not installed on my computer) solved all issues. IBC is now running like a charm.


Re: Problem witrh Gateway 10.22

 

I have installed IBC on my Ubuntu computer, downloaded the newer IBC.jar and version files, and followed the instructions on setting the basic (default) parameters in the config.ini and 1022 version number in gatewaystart.sh and twsstart.sh. Unfortunately does it not start: when executing from a command prompt I get an error message: "line 233: xterm: command not found" I get this for both gatewaystart and twsstart. What am I doing wrong?


Re: Problem witrh Gateway 10.22

 

Thank you. I will do a fresh install of the latest version of IBC and hope that it will cure the Gateway issues I'm seeing recently. Thus far, when I did see that pop-up window asking about re-login, I was not required to provide any credentials. But thanks for warning that this might be necessary on occasion.


Re: Problem witrh Gateway 10.22

 

开云体育

Yes, IBC will do this. But it may require 2FA again, So you may need to keep your phone (or other device running IBKR Mobile app) handy.

?

Richard

?

?

From: [email protected] <[email protected]> On Behalf Of windmill_1965 via groups.io
Sent: Saturday, April 22, 2023 2:47 AM
To: [email protected]
Subject: Re: [ibc] Problem witrh Gateway 10.22

?

Richard,
I recently upgraded Gateway from 9.81 to 10.22. I am currently not using IBC. However, I notice that 10.22 is more unreliable than its predecessor. I am running Gateway the entire week: starting it on Sunday evening and letting it run to the following Saturday morning. Unfortunately, about three times per week it loses connection, can't reconnect itself and then shows a pop-up window asking me whether I want to re-login. I have attached a screenshot of this pop-up window. Would IBC be able to recognize this pop-up window and push the "Re-login" button?


Re: Gateway crashing

 

开云体育

Please reply with the complete logfile – attach it, don’t quote it.

?

Richard

?

?

?

From: [email protected] <[email protected]> On Behalf Of PaulMac
Sent: Saturday, April 22, 2023 9:16 AM
To: [email protected]
Subject: [ibc] Gateway crashing

?

I haven't been able to keep the Gateway running longer than a couple of hours.

It is installed on AWS ubuntu 2GB server

Vers 10.21

I need to run?

/usr/bin/Xvfb :0 -ac -screen 0 1024x768x24 & //?X11 virtual framebuffer

/usr/bin/x11vnc -ncache 10 -ncache_cr -viewpasswd view_only_pwd -passwd full_access_pwd -display :0 -forever -shared -bg -noipv6 //?start the VNC server

then run the GW to the X Display

DISPLAY=:0 ~/opt/ibc/gatewaystart.sh // run the GW script using Display :0

My logfile contains the following ....

2023-04-20 09:45:00:540 IBC: Saving Tws settings

2023-04-20 09:45:00:540 IBC: Getting main window

2023-04-20 09:45:00:540 IBC: Main window already found

2023-04-20 10:00:00:539 IBC: Saving Tws settings

2023-04-20 10:00:00:539 IBC: Getting main window

2023-04-20 10:00:00:539 IBC: Main window already found

2023-04-20 10:15:00:539 IBC: Saving Tws settings

2023-04-20 10:15:00:539 IBC: Getting main window

2023-04-20 10:15:00:539 IBC: Main window already found

?

java: Fatal IO error 11 (Resource temporarily unavailable) on X server :0.

I would like to run the Gateway in a headless form but not possible, need to have a framebuffer unfortuneatly but doesn't work for me


Gateway crashing

 

I haven't been able to keep the Gateway running longer than a couple of hours.

It is installed on AWS ubuntu 2GB server

Vers 10.21

I need to run?

/usr/bin/Xvfb :0 -ac -screen 0 1024x768x24 & //?X11 virtual framebuffer

/usr/bin/x11vnc -ncache 10 -ncache_cr -viewpasswd view_only_pwd -passwd full_access_pwd -display :0 -forever -shared -bg -noipv6 //?start the VNC server

then run the GW to the X Display

DISPLAY=:0 ~/opt/ibc/gatewaystart.sh // run the GW script using Display :0

My logfile contains the following ....

2023-04-20 09:45:00:540 IBC: Saving Tws settings

2023-04-20 09:45:00:540 IBC: Getting main window

2023-04-20 09:45:00:540 IBC: Main window already found

2023-04-20 10:00:00:539 IBC: Saving Tws settings

2023-04-20 10:00:00:539 IBC: Getting main window

2023-04-20 10:00:00:539 IBC: Main window already found

2023-04-20 10:15:00:539 IBC: Saving Tws settings

2023-04-20 10:15:00:539 IBC: Getting main window

2023-04-20 10:15:00:539 IBC: Main window already found

?

java: Fatal IO error 11 (Resource temporarily unavailable) on X server :0.

I would like to run the Gateway in a headless form but not possible, need to have a framebuffer unfortuneatly but doesn't work for me


Re: Problem witrh Gateway 10.22

 

Richard,
I recently upgraded Gateway from 9.81 to 10.22. I am currently not using IBC. However, I notice that 10.22 is more unreliable than its predecessor. I am running Gateway the entire week: starting it on Sunday evening and letting it run to the following Saturday morning. Unfortunately, about three times per week it loses connection, can't reconnect itself and then shows a pop-up window asking me whether I want to re-login. I have attached a screenshot of this pop-up window. Would IBC be able to recognize this pop-up window and push the "Re-login" button?


Re: Problem witrh Gateway 10.22

 

开云体育

Pranav

?

I’ve no idea what went wrong apart from the fact that the relevant jar file didn’t seem to contain the code it should.? Why that should be the case is a mystery to me, unless there was actually something wrong with the installer. ?It’s possible the installer you downloaded was faulty and IB fixed it before I downloaded it.

?

So if you actually need 10.22, it would be worth doing it again. Note that you can have any number of Gateway/TWS versions installed – they don’t interfere with each other, so you don’t need to uninstall 10.19 to try 10.22. You only need to change the major version number in the start script (and use the 3.16.3 IBC for 10.22). You could also install 3.16.3 in a different folder from 3.16.2 so if it still doesn’t work it would be easy to revert to 10.19.

?

?

From: [email protected] <[email protected]> On Behalf Of Pranav Lal
Sent: Sunday, April 16, 2023 4:37 AM
To: [email protected]
Subject: Re: [ibc] Problem witrh Gateway 10.22

?

Hi Richard,

?

I have gone back to gateway version 1019.1. I searched for

interactive brokers standalone gateway linux 64 installer

And finally to

At least as far as I can recall.

?

I also reinstalled ibc’s current release without the updated IBC.jar.

?

Things are working once again.

?

I cannot determine what happened.

?

Did the startup scripts mess up the classpath or were things really mixed at my end?

?

Pranav


Re: Problem witrh Gateway 10.22

 

开云体育

Hi Richard,

?

I have gone back to gateway version 1019.1. I searched for

interactive brokers standalone gateway linux 64 installer

And finally to

At least as far as I can recall.

?

I also reinstalled ibc’s current release without the updated IBC.jar.

?

Things are working once again.

?

I cannot determine what happened.

?

Did the startup scripts mess up the classpath or were things really mixed at my end?

?

Pranav

From: [email protected] <[email protected]> On Behalf Of Richard L King
Sent: Saturday, April 15, 2023 11:25 PM
To: [email protected]
Subject: Re: [ibc] Problem witrh Gateway 10.22

?

[Actually the version is still incorrect – it’s not showing any version at all now! The version file should contain just “3.16.3” and nothing else. However, that’s irrelevant as far as your actual problem is concerned.]

?

Well, here’s a strange thing, I’ve compared your logfile with mine on Ubuntu 22.04 and they are identical up to the point where yours fails (except for the OS details and the username). Mine carries on fine and loads IBC with no problem.

?

I can only conclude that one of your jar files is corrupt – presumably the one that contains the main entrypoint, can’t remember which one that is. Maybe it has somehow lost its manifest?

?

As a basic sanity check, if you haven’t already done so, can you try running Gateway directly from the IB-supplied link – ie without using IBC. If that doesn’t work, then you’ll have to uninstall Gateway and reinstall. If it does work, then I’m completely at a loss – so I think I’d still recommend you uninstall and reinstall Gateway.

?

?

?

?

From: [email protected] <[email protected]> On Behalf Of Pranav Lal
Sent: Saturday, April 15, 2023 12:31 PM
To: [email protected]
Subject: Re: [ibc] Problem witrh Gateway 10.22

?

Hi again Richard,

?

Please see the updated log which I have attached. The version seems to be now correct but the problem remains the same.

?

Pranav

?

From: [email protected] <[email protected]> On Behalf Of Richard L King
Sent: Saturday, April 15, 2023 4:15 PM
To: [email protected]
Subject: Re: [ibc] Problem witrh Gateway 10.22

?

You should have let the installer install to its default location, which is /home/pranav/Jts/ibgateway/1022

?

This being the case, IBC should find the jars folder at /home/pranav/Jts/ibgateway/1022/jars. If it’s not there, it must be because you didn’t use the installer’s default location.

?

If you actually used the TWS installer, the default location would be /home/pranav/Jts/1022, and the jars folder would be at /home/pranav/Jts/1022/jars

?

Since IBC isn’t finding the jars folder, either you didn’t install the standalone (offline) version, or you changed the installer’s location from the default.

?

By the way, you don’t seem to have successfully deployed the updated IBC.jar and version files, as your logfile still says it’s IBC 3.16.2, not 3.16.3.

?

Richard

?


Re: Problem witrh Gateway 10.22

 

开云体育

[Actually the version is still incorrect – it’s not showing any version at all now! The version file should contain just “3.16.3” and nothing else. However, that’s irrelevant as far as your actual problem is concerned.]

?

Well, here’s a strange thing, I’ve compared your logfile with mine on Ubuntu 22.04 and they are identical up to the point where yours fails (except for the OS details and the username). Mine carries on fine and loads IBC with no problem.

?

I can only conclude that one of your jar files is corrupt – presumably the one that contains the main entrypoint, can’t remember which one that is. Maybe it has somehow lost its manifest?

?

As a basic sanity check, if you haven’t already done so, can you try running Gateway directly from the IB-supplied link – ie without using IBC. If that doesn’t work, then you’ll have to uninstall Gateway and reinstall. If it does work, then I’m completely at a loss – so I think I’d still recommend you uninstall and reinstall Gateway.

?

?

?

?

From: [email protected] <[email protected]> On Behalf Of Pranav Lal
Sent: Saturday, April 15, 2023 12:31 PM
To: [email protected]
Subject: Re: [ibc] Problem witrh Gateway 10.22

?

Hi again Richard,

?

Please see the updated log which I have attached. The version seems to be now correct but the problem remains the same.

?

Pranav

?

From: [email protected] <[email protected]> On Behalf Of Richard L King
Sent: Saturday, April 15, 2023 4:15 PM
To: [email protected]
Subject: Re: [ibc] Problem witrh Gateway 10.22

?

You should have let the installer install to its default location, which is /home/pranav/Jts/ibgateway/1022

?

This being the case, IBC should find the jars folder at /home/pranav/Jts/ibgateway/1022/jars. If it’s not there, it must be because you didn’t use the installer’s default location.

?

If you actually used the TWS installer, the default location would be /home/pranav/Jts/1022, and the jars folder would be at /home/pranav/Jts/1022/jars

?

Since IBC isn’t finding the jars folder, either you didn’t install the standalone (offline) version, or you changed the installer’s location from the default.

?

By the way, you don’t seem to have successfully deployed the updated IBC.jar and version files, as your logfile still says it’s IBC 3.16.2, not 3.16.3.

?

Richard

?