Trainz on Linux in 2022

I sent the following to my computer-dealer friend:
Can you find me a card or two?

I could use a new-to-me video card, details below. I would like an audio card too. Both inexpensive; used, if available, should be sufficient.

KotanaGirl wrote:
You have Intel HD Graphics 2500 built into your motherboard and it's considered to be only marginal for running games at best. Released in 2012 it's now 10 generations old and far from being a current supported model.
Its codename is Ivy Bridge which is why you are getting all those Ivy Bridge warning messages.

Much depends on the wattage of your power supply, but I would imagine that your tower computer should have something adequate in it. I ran Trainz TS2019 using an old Nvidia GTX 660 with 2Gb of video RAM and after that I ran a GTX 950 that a friend gave me. Both are old but good cards that were considered to be fine for gaming back in the day. It should be possible to pick up either of them for not much money.

JCitron wrote:
Thank you for confirming my suspicions as well. I agree with what you said in your other post. A GTX 600-series or 700-series will work fine if the power supply can handle the board. I ran T: ANE on a GTX780Ti until that system died due to a failed motherboard with no problems at all.

Since he's not running Windows, he shouldn't have an issue with the NVidia drivers. NVidia stopped supporting these chipsets a few years ago, causing much angst among people who were still using the older video cards.
He replied
I am sure I can find you some used boards. Give me a couple days for looking.
It looks like I`ll have something to look at besides a dead window in a few days.

Meanwhile, I need the help of a Wine aficionado. I need to be able to run TrainzUtil.exe inside the same Wine environment that my copy of Trainz22PE will be running in, but I need to do so from outside the Wine environment, as a Shell command. I can handle any Shell scripting I need, such as translating command-line parameters, save for the fact that I haven`t a clue how to run a command inside an existing environment from outside said environment. I tried looking at the command line in the icon that Lutris created on my desktop for launching Trainz, but that command line mentions nothing usable for my purposes. Lutris looks like it would probably object to me having multiple "games" installed in the same directory, as it seems to use the name of said directory to key on for launching a program. I`ll be taking a closer look at the situation, but any guidance you fine folks could provide would be much appreciated.
 
It looks like I`ll have something to look at besides a dead window in a few days.
That's good. A decent graphics card should make a big difference.

Meanwhile, I need the help of a Wine aficionado. I need to be able to run TrainzUtil.exe inside the same Wine environment that my copy of Trainz22PE will be running in, but I need to do so from outside the Wine environment, as a Shell command.
Ah, - pass. I own a copy of Trainz22PE, but I've not bothered to download it yet. I've decided to wait a while until the latest crop of bugs have been knocked out of TRS22 before doing anything with it.
If I try running TrainzUtil.exe in my early version of TRS22 using Lutris nothing whatsoever happens and that's the sum total of my knowledge concerning TrainzUtil.exe.
 
Well, @KotangaGirl, if you can`t help with this, that`s ok, as you definitely helped with the video issue, especially if the card I get does the trick.
If I try running TrainzUtil.exe in my early version of TRS22 using Lutris nothing whatsoever happens and that's the sum total of my knowledge concerning TrainzUtil.exe.
Nothing useful, for certain. You probably would not have seen the OK (0 Error, 0 Warnings) that I get when running the command at the Windows command prompt, as Linux tends to throw console output away when there is no console to route it to. If I try to run it in the Linux console, I get "Permission denied". Running it as root doesn`t help.

According to N3V, Content Manager uses it "under the hood" for all the heavy lifting. I need to do likewise. All I know about running it under Linux is that I need to somehow match the already-running Wine environment. While waiting for help here, I think that I`ll do some research in the Wine documentation. I just might learn something.
 
I can handle any Shell scripting I need, such as translating command-line parameters
Well that kind of thing definitely shuts me out since I know nothing about the magic incantations involved in script writing.

If I try to run it in the Linux console, I get "Permission denied". Running it as root doesn`t help
My daughter has tried to encourage me to use the Linux console, but my brain tends to do a 404 on me whenever I've made the attempt.
 
Last edited:
Well that kind of thing definitely shuts me out since I know nothing about the magic incantations involved in script writing.
That`s OK. I`m moderately well skilled there. ;)
My daughter has tried to encourage to use the Linux console, but my brain tends to do a 404 on me whenever I've made the attempt.
I`ve got a few of those myself. Worse, I seem to be having more of them than I used to.

Meanwhile, no update on those cards yet, nor have I learned anything useful about running Windows shell commands from the Linux shell. I believe that I have exhausted all local sources of information and will have to resort to DuckDuckGo.
 
Some of the following may be out of correct order, as I do not recall all details well, in particular some of the time sequence.

Almost immediately after posting the previous message, I called my dealer to ask about the cards. He had two available, a video card and a sound card. I rushed out and bought them. When I got them home, I disconnected my tower and moved it to a better place to operate on its innards than the place I keep it when using it.

I find a suitable screwdriver and open the case. There was around a sixteenth to an eighth of an inch of dust, which I removed as best as I could. The machine has four slots, as can be told from the back panel of the case. Three of those four slots have card-edge holders of approximately one inch in length. Huh? I`m not familiar with that. The fourth slot looks more like the standard slots I remember from the old days.

Both cards go into the type of slot that I have one of.

This means that I can only install one card. Of course I chose the video card. I plug it in and close up the patient.

I place the patient in the operating location and hook her back up to life-support, after which I push the power button.

The first thing I notice is that the boot screen is the old standard 24x80 format (or something close; I didn`t count) instead of the usual 132x50 format (or thereabouts; I never counted that one either). No biggy. The motherboard video and the BIOS knew how to read the size of my wide-screen monitor and use it before even booting. The new card and the BIOS did not. As long as the computer uses the screen correctly later, this is a non-issue.

When I boot to the desktop, I find that the computer is using the screen size correctly. I don`t remember just when, but I went into the settings for the display and checked that it was using the largest pixel-count display mode available. I accidentally set it to lower-res and had to fix it, causing my desktop icons to move out of position. Again, no big deal.

While I had the Settings program open, I went to the place where the system tests for and optionally installs proprietary drivers. There are two listed as available, not counting the Linux native driver currently in use. I choose the latest-and-greatest and install it. Some errors installing dependencies, but nothing that I can find in my software manager. I run Trainz. The game window actually opens without crashing, but something terminates the program abruptly several seconds later. I then try the driver that is listed as "tested", with similar results all along the line, the only difference I can see being how long the window stays open before the entire program terminates.

Somewhen about this time I tried one of my existing games, and it fails before the normal first window even opens. The error dialog provides me with three options, none of which do anything but exit the game.

I know that Linux can install most software without requiring a reboot, but I also know that sometimes a reboot fixes things that you didn`t even know were broken, so I reboot.

The machine boots most of the way to the desktop, and hangs. I try Control-Alt-Delete, and it works, restarting the machine, but I get the same results. After two or three tries, I use the hot-key that takes me to the virtual consoles, and manage to log in, but I cannot find anything to "fix" because I don`t know enough of those particular internals.

This sucks!

I shut down the machine and disconnect my "portable Linux" and connect it to my laptop, the one that runs Win10. I boot Linux on that machine, and it makes it all the way to the desktop. I mess with the settings there, and try to uninstall the NVIDIA drivers I had just installed. I then shut down, move the "portable Linux" back to the tower, and boot that.

It works.

Ok, I try firing up Trainz again, with the same results as before: the game window opens, displays the usual precaching stuff, brings up the menu, sits there for a few seconds, then the whole program terminates.

Well, at least I`ve made some progress.

Post Too Large error; to be continued in next post.
 
I launch Trainz from the console as before, with the following results:
Code:
LinuxPrompt> env LUTRIS_SKIP_INIT=1 lutris lutris:rungameid/1

(lutris:2212): dbind-WARNING **: 13:14:37.995: AT-SPI: Error retrieving accessibility bus address: org.freedesktop.DBus.Error.ServiceUnknown: The name org.a11y.Bus was not provided by any .service files
2024-03-02 13:14:39,081: The Battle.net source is unavailable because Google protobuf could not be loaded: No module named 'google'
2024-03-02 13:14:39,903: Starting Lutris 0.5.16
2024-03-02 13:14:39,909: Running nouveau Mesa driver 21.2.6 on NVC1 (0xde1)
2024-03-02 13:14:39,909: GPU: 10DE:0DE1 1462:2304 (nouveau drivers)
2024-03-02 13:14:40,408: Vulkan reports an API version of 1.2.131. 1.3.0 is required for the latest DXVK.
2024-03-02 13:14:41,165: Error reading color-scheme: g-dbus-error-quark: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.portal.Desktop was not provided by any .service files (2)
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/lutris/style_manager.py", line 80, in _call_cb
    values = obj.call_finish(result)
gi.repository.GLib.GError: g-dbus-error-quark: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.portal.Desktop was not provided by any .service files (2)
Started initial process 2263 from /home/{RedactedUserName}/.local/share/lutris/runners/wine/wine-ge-8-26-x86_64/bin/wine /home/{RedactedUserName}/Games/trainz22pe/drive_c/Program Files/N3V Games/Trainz Railroad Simulator 2022Trainz22PE/TRS22.exe
Start monitoring process.
esync: up and running.
wine: RLIMIT_NICE is <= 20, unable to use setpriority safely
WARNING: lavapipe is not a conformant vulkan implementation, testing use only.
240302.13:14:52.016| *** UDPMultiplexer 0x8bec138 stats ***
240302.13:14:52.017| Endpoints:
240302.13:14:52.017| *** UDPMultiplexer 0x8bec210 stats ***
240302.13:14:52.017| Endpoints:
240302.13:14:52.017| ** OnlineAccessClientEndpoint 0x8bebfc0 Stats **
240302.13:14:52.017| Listeners waiting:
240302.13:14:52.017| Incoming DCC endpoints:
240302.13:14:52.017| Established DCC endpoints:
240302.13:15:17.024| *** UDPMultiplexer 0x8bec138 stats ***
240302.13:15:17.025| Endpoints:
240302.13:15:17.025| *** UDPMultiplexer 0x8bec210 stats ***
240302.13:15:17.025| Endpoints:
240302.13:15:17.025| ** OnlineAccessClientEndpoint 0x8bebfc0 Stats **
240302.13:15:17.025| Listeners waiting:
240302.13:15:17.025| Incoming DCC endpoints:
240302.13:15:17.025| Established DCC endpoints:
ALSA lib pcm.c:8526:(snd_pcm_recover) underrun occurred
ALSA lib pcm.c:8526:(snd_pcm_recover) underrun occurred
ALSA lib pcm.c:8526:(snd_pcm_recover) underrun occurred
ALSA lib pcm.c:8526:(snd_pcm_recover) underrun occurred
ALSA lib pcm.c:8526:(snd_pcm_recover) underrun occurred
ALSA lib pcm.c:8526:(snd_pcm_recover) underrun occurred
ALSA lib pcm.c:8526:(snd_pcm_recover) underrun occurred
ALSA lib pcm.c:8526:(snd_pcm_recover) underrun occurred
240302.13:15:42.034| *** UDPMultiplexer 0x8bec138 stats ***
240302.13:15:42.034| Endpoints:
240302.13:15:42.034| *** UDPMultiplexer 0x8bec210 stats ***
240302.13:15:42.034| Endpoints:
240302.13:15:42.034| ** OnlineAccessClientEndpoint 0x8bebfc0 Stats **
240302.13:15:42.034| Listeners waiting:
240302.13:15:42.034| Incoming DCC endpoints:
240302.13:15:42.034| Established DCC endpoints:
240302.13:16:07.035| *** UDPMultiplexer 0x8bec138 stats ***
240302.13:16:07.035| Endpoints:
240302.13:16:07.036| *** UDPMultiplexer 0x8bec210 stats ***
240302.13:16:07.036| Endpoints:
240302.13:16:07.036| ** OnlineAccessClientEndpoint 0x8bebfc0 Stats **
240302.13:16:07.036| Listeners waiting:
240302.13:16:07.036| Incoming DCC endpoints:
240302.13:16:07.036| Established DCC endpoints:
Monitored process exited.
Initial process has exited (return code: 1280)
Exit with return code 1280
2024-03-02 13:16:09,928: Game still running (state: running)
2024-03-02 13:16:09,932: Stopping Trainz22PE (wine)
2024-03-02 13:16:10,024: Shutting down Lutris
Continued...
 
While reading that, I noted the command for launching Trainz with Wine, so I started Trainz and opened Content Manager instead of the game window. I then attempted to run TrainzUtil.exe, with the following results:
Code:
LinuxPrompt> /home/{RedactedUserName}/.local/share/lutris/runners/wine/wine-ge-8-26-x86_64/bin/wine "/home/{RedactedUserName}/Games/trainz22pe/drive_c/Program Files/N3V Games/Trainz Railroad Simulator 2022Trainz22PE/TrainzUtil.exe -help"
wineserver: using server-side synchronization.
wine: RLIMIT_NICE is <= 20, unable to use setpriority safely
002c:fixme:winediag:LdrInitializeThunk wine-staging 8.0 is a testing version containing experimental patches.
002c:fixme:winediag:LdrInitializeThunk Please mention your exact version when filing bug reports on winehq.org.
0078:err:winedevice:ServiceMain Failed to load L"C:\\windows\\system32\\win32k.sys"
0078:err:winedevice:ServiceMain Failed to load L"C:\\windows\\system32\\drivers\\dxgkrnl.sys"
0078:err:winedevice:ServiceMain Failed to load L"C:\\windows\\system32\\drivers\\dxgmms1.sys"
0074:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005
0074:err:plugplay:enumerate_new_device Unable to install a function driver for device L"WINEBUS\\VID_845E&PID_0001\\0&0000&0&0&0".
0074:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005
0074:err:plugplay:enumerate_new_device Unable to install a function driver for device L"WINEBUS\\VID_845E&PID_0002\\0&0000&0&0&0".
0098:err:winedevice:ServiceMain Failed to load L"C:\\windows\\system32\\win32k.sys"
0098:err:winedevice:ServiceMain Failed to load L"C:\\windows\\system32\\drivers\\dxgkrnl.sys"
0098:err:winedevice:ServiceMain Failed to load L"C:\\windows\\system32\\drivers\\dxgmms1.sys"
011c:err:ole:com_get_class_object class {ff48dba4-60ef-4201-aa87-54103eef594e} not registered
011c:err:ole:com_get_class_object no class object {ff48dba4-60ef-4201-aa87-54103eef594e} could be created for context 0x1
011c:err:tabtip:create_uia_event_handler Failed to create IUIAutomation interface, hr 0x80040154
00b8:fixme:imm:ImeSetActiveContext himc 00010032, flag 0 stub!
002c:fixme:imm:ImeSetActiveContext himc 00010058, flag 0x1 stub!
0128:fixme:file:NtLockFile I/O completion on lock not implemented yet
0128:fixme:ntdll:NtQuerySystemInformation info_class SYSTEM_PERFORMANCE_INFORMATION
0128:err:mscoree:LoadLibraryShim error reading registry key for installroot
0128:err:mscoree:LoadLibraryShim error reading registry key for installroot
0128:err:mscoree:LoadLibraryShim error reading registry key for installroot
0128:err:mscoree:LoadLibraryShim error reading registry key for installroot
0128:err:mscoree:LoadLibraryShim error reading registry key for installroot
0128:err:mscoree:LoadLibraryShim error reading registry key for installroot
0128:err:mscoree:LoadLibraryShim error reading registry key for installroot
0128:err:mscoree:LoadLibraryShim error reading registry key for installroot
0128:fixme:msi:internal_ui_handler internal UI not implemented for message 0x0b000000 (UI level = 1)
0128:fixme:msi:internal_ui_handler internal UI not implemented for message 0x0b000000 (UI level = 1)
wine: configuration in L"O:\\{RedactedUserName}\\.wine" has been updated.
wine: failed to open "/home/{RedactedUserName}/Games/trainz22pe/drive_c/Program Files/N3V Games/Trainz Railroad Simulator 2022Trainz22PE/TrainzUtil.exe -help": c0000135
LinuxPrompt> wine client error:64: write: Bad file descriptor
wine client error:8c: write: Bad file descriptor
wine client error:ec: write: Bad file descriptor
/home/{RedactedUserName}/.local/share/lutris/runners/wine/wine-ge-8-26-x86_64/bin/wine "/home/{RedactedUserName}/Games/trainz22pe/drive_c/Program Files/N3V Games/Trainz Railroad Simulator 2022Trainz22PE/TrainzUtil.exe" -help
wineserver: using server-side synchronization.
wine: RLIMIT_NICE is <= 20, unable to use setpriority safely
002c:fixme:winediag:LdrInitializeThunk wine-staging 8.0 is a testing version containing experimental patches.
002c:fixme:winediag:LdrInitializeThunk Please mention your exact version when filing bug reports on winehq.org.
0080:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005
0080:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005
0080:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005
0080:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005
0094:err:hid:udev_bus_init UDEV monitor creation failed
Application could not be started, or no application associated with the specified file.
ShellExecuteEx failed: Bad EXE format for S:\trainz22pe\drive_c\Program Files\N3V Games\Trainz Railroad Simulator 2022Trainz22PE\TrainzUtil.exe.

 LinuxPrompt> wine client error:48: wine client error:78: write: Bad file descriptor
Note that the Bad file descriptor message appeared after the LinuxPrompt displayed. The same thing occurred after the prompt when Trainz crashed.
 
I don't know enough about Linux and Wine to understand the error printout and identify what is wrong, but if you have no motherboard slot in your computer that can take a sound card you could use a USB sound module instead. They are about the same size as a USB key and are intended for use when a motherboard's built in sound system fails. I've used them before and they work well.
 
PCI slots can come in 4 different sizes, x1, x4, x8 and x16, the number referring to the number of channels each will support. You don't see many x1 these days but x4 are frequently used for expansion card, USB, SATA, modem, WiFi etc where as x8 are often used for sound, TV, and video capture type cards. The x16 slots have taken over from the old AGP slots for video cards. To confuse it more PCI slots depending on the motherboard and chip-set come in different speeds PCI3 and PCI4 likely the most common these days but PCI5 is readily available. Started in the early 90's they have got faster each upgrade and what goes in them more expensive.

Re: Trainz on Linux. After loading and updating Kubuntu which version of Wine did you install and did TRS22PE load and then run on it. 'Generally' Trainz has run with few issues through Wine since v6.0 and if it will not at least load there is little point complicating things further trying to sort it out with additional programs.

In Windows, TrainzUtil.exe needs to be in the same installation folder of Trainz and run from the command prompt with Trainz already running. The equivalent in Wine is the 'wineconsole cmd' which you access once Wine is installed by just typing wineconsole cmd into the Terminal. This in fact opens an additional window which you use as if it was the MS Windows command prompt while remembering you are still running Linux/Wine not full blown Windows. For scripting I think I would writing the script in a batch file and then run that from the wineconsole cmd prompt, to save constant retyping as necessary.

Peter
 
Thank you, Peter @wilts747. My tower case is old enough to have motherboard video that not only is not well-known for supporting games, but is ten generations out-of-date besides (according to @KotangaGirl), yet it is still new enough to feature slots that I have never seen before. Despite my issues with it, I think that it is the best PClone computer I own at the moment, compute-power-wise. The rest of what you tell me (aside from everything computer getting faster and more expensive for new equipment) is totally unknown to me. I`m a software person, not a hardware person.

My KUbuntu is not entirely up-to-date, but the upgradable packages seem to have nothing to do with video per se, although some are related to AI processing of video streams, something else that I have an interest in. Both of my KUBuntu repository Wine installs are the latest available from that source, and the one that Lutris is using to run Trainz is the same one that you and @KotangaGirl are using. There are NO issues relating to Wine save for running Windows command lines in Linux consoles. I have no idea what you mean by
complicating things further trying to sort it out with additional programs.
I have a specific application that requires the ability to run a single TrainzUtil invocation from another program`s "run shell command" facility. This is important to my intended usage, and is an issue that is completely independent of the video issues. It is not "complicating things" because it is entirely separate from the video issues. I can use this even if I cannot run the game itself. It is simply not related, except for the fact that both are making use of the same installation of Trainz.

My Linux copy of TrainzUtil.exe is in the same directory as the rest of Trainz, and I know that it needs Trainz to be already running. These are not issues either. No need to discuss them further.

As for "wineconsole", I do not need the console window at all, nor will I be typing the commands each time I use them. I have no need for batch files; I have several scripting languages available in the editor that I will be running TrainzUtil from, and will be capturing the output into the editor for further processing by said scripting languages. I just need a single Linux command that can run a single Windows command shell command within the same environment as the running instance of Trainz, with the resulting output captureable by the calling program by setting STDOUT and STDERR to suitable values for the subprocess. This is how it is usually done, and I have no intention of rewriting the editor to try to do things differently, although I could, if necessary, redirect the output to a temporary file and process that afterwards. I will look into the documentation for "wineconsole" to see if it is supposed to be able to do what I need, and get back to you on this.

I currently have two independent significant issues:

1. Opening the game window currently causes Trainz to abend (abnormal end).
2. I need to be able to execute single TrainzUtil commands from a Linux subprocess environment and capture the output into the calling program.

There is no need to think that either one has anything to do with the other, and my installation of Trainz under Linux works perfectly well, aside from these two issues and the usual windows-not-updating-under-Linux issues. I strongly appreciate the help I have been getting here, but please do not try to fix what is no longer broken.

Edit: I was unable to convince "wineconsole" to not open a new window to run the command in as suggested in the man page. I was also unable to get it to actually run the command, saying that it was "invalid". I feel that I`m getting closer, however.
 
Last edited:
What might be interesting is to see if we can come up with a basic system to run trainz. We need about 10,000 3D score so there are a number of GPUs that aren't going to break the bank that can do this, see the link to the console thread below. The Mac OS is UNIX based so it can't be impossible or can it?


Thoughts?

Thanks John
 
"a basic system to run trainz"? Could you please amplify on your meaning there?

For anyone in this thread who might not be following the thread that @johnwhelan linked to, I posted there that I understand that the current Mac OS is basically Linux under the hood, and suggested that this and various other factors ought to make a Linux-native Trainz easier to write than N3V currently thinks.
 
......which I only suggested to KotangaGirl because she was having issues with a Wine update and had said that the previous version she had used for her install worked better.
Lutris worked for me and fixed a problem with an unsuitable Wine 9.xx update in Debian Linux that had replaced Wine 8.xx which had previously been working fine with Trainz. I'm grateful to Peter for having made the suggestion to try Lutris because it solved the severe image flickering caused by the Wine 9.xx update and got things working again.

I'm presently running three different versions of Trainz using the Lutris interface because it works and does what I want. And because it's working well I leave it alone to get on with it. Possibly there is another method I could use to run Trainz under Wine, but I don't see the need to make a change just for the sake of making a change when what I have is working fine.

......everything I did was a response to a failure, with no-one giving me any advice on how to deal with it.
The main reason why I couldn't offer any advice is because I couldn't understand what you had done. And I still can't understand what you are doing.
 
Re: #136 Agreed on both counts.

Re: #134 John, how and with what do you measure your 3D score please.

Re: #133 Earlier I ran 'wineconsole cmd' on Mint 21.3, Kubuntu 23.10 and Wubuntu 11.44 (Plasma) and on each a new window opened as shown below from Mint.

Peter

Trainz-on-Linux.jpg
 
Re: #136 Agreed on both counts.

Re: #134 John, how and with what do you measure your 3D score please.

Re: #133 Earlier I ran 'wineconsole cmd' on Mint 21.3, Kubuntu 23.10 and Wubuntu 11.44 (Plasma) and on each a new window opened as shown below from Mint.

Peter

The 3D score came from a N3V recommendation.

Cheerio John
 
At this point, since Trainz has crashed multiple times, I would run an EDR. This will rule out any database corruption causing Trainz from loading. Once that's done, try running again.

I would go as far as removing the graphics performance settings from TRS22PE and let that regenerate again. Set the performance to the lowest settings - they can always be adjusted in the performance settings tab anyway off the Launcher Trainz settings.

Open your User-data-folder/cache

My location, on my Windows system this is E:\PLUS_DATA\cache

Delete the performance.cache file.

When you run the program again and see what happens.
 
Back
Top