Updated: February 16, 2024
You can run Windows software in Linux. There are many ways to achieve this method. Without virtualization, your "simplest" solution is to use WINE, a compatibility layer that mimics the Windows filesystem structure and API calls, allowing you to run programs as if doing it natively. Sometimes, this works perfectly, sometimes it doesn't. But WINE is at the heart of many amazing projects and ideas, including Steam Proton. I've been tinkering with this software for years now, with ever-growing rate of success.
Today, I'd like to show you how you can enable/disable services for programs that come with them, and want to run them. In Windows, if you wanted to control a service, you'd launch the Services.msc applet, and then make changes there. But what about WINE? Say a program comes with a self-update service, which you want or don't want to run. How would you manage it under Linux? Let's proceed.
An example
All right. So to demonstrate, we have Foxit Reader. It's a solid PDF application, and I have it installed on my Slimbook Titan. The program comes with its own update service. By default, this service will run, even if you configure Foxit Reader not to update itself (via Preferences > Updater). Under Linux, since things work ever so slightly differently, you could say, all right, I don't want the service to run at all. You'd prefer to update the program manually whenever needed.
You could brute force a solution - rename, delete or chmod -x the update service executable under your WINE directory, wherever Foxit Reader is installed. Locate the executable, and make it not run, e.g.:
/home/dedoimedo/.wine/drive_c/Program Files (x86)/Foxit PDF Reader/FoxitPDFReaderUpdateService.exe
However, this is not an elegant approach. What it will do is, it will make WINE spew error messages every time it runs. It will tell you that an auto-start service cannot run:
003c:fixme:service:scmdatabase_autostart_services Auto-start service L"FoxitReaderUpdateService" failed to start: 2
Properly manage services
The correct way of doing it is to by editing the system.reg file under ~/.wine (or whatever PREFIX you use). This file references the would-be registry structure of your WINE Windows setup, including the list of any services. Open the file in the text editor, make the changes, save it, "reboot" WINE. Of course, make a backup of the system.reg file beforehand!
If you're not comfortable with a raw file edit, you can run wine regedit instead. This will open a would-be registry editor, where you can make changes as you would if you were running Windows and using the registry editor program. The changes made this way will be reflected in the system.reg file. Whichever method you choose will work. Backup first, yes?
All of the services for different programs are stored under:
System\\CurrentControlSet\\Services\
And for each service, the following states are available (as in Windows):
0 = Boot
1 = System
2 = Automatic
3 = Manual
4 = Disabled
Thus, going back to our Foxit Reader example, in the system.reg file, look for FoxitPDFReaderUpdateService. A simple file search will show you the right entry. It will look something like this:
[System\\CurrentControlSet\\Services\\FoxitReaderUpdateService]
"DisplayName"="Foxit PDF Reader Update Service"
"ErrorControl"=dword:00000001
"ImagePath"="\"C:\\Program Files (x86)\\Foxit Software\\Foxit PDF
Reader\\FoxitPDFReaderUpdateService.exe\""
"ObjectName"="LocalSystem"
"PreshutdownTimeout"=dword:0002bf20
"Start"=dword:00000002
"Type"=dword:00000110
"WOW64"=dword:00000001
What we're interested in is the Start DWORD. By default, it's configured with the value of 2, meaning automatic start. If you change this value to 3 or 4, the service will not run. Edit the file, save and close the text editor.
Now, reboot the system:
wineboot
And that's it. The service will not run, and if you made any manual changes to executables, you will no longer see error messages from WINE either. Now, I demonstrated with Foxit Reader, as it's the only Windows program that I have installed that actually comes with a service. But it can be any piece of software.
You can also choose to let these services run. You should be aware that in some scenarios, the services may be beneficial, as there could be security updates to your applications (like a PDF reader, for instance). Your WINE setup isn't Windows, but some security considerations still apply. Running Internet-facing outdated software can, in some scenarios, be somewhat risky. On the other hand, perhaps your WINE setup is finely tuned, and if you update a program, it may no longer run in Linux. Be aware of the relevant outcome, and act accordingly. The idea is for you to know how to manage services - turn them off as well as on if and when needed.
Conclusion
WINE isn't Windows. Says in the name. But there are still lots of aspects of Windows behavior that apply to your Linux box. Software can come with services and run them. In some situations, this is great. Security patching and whatnot or some such. In others, this could be detrimental. Even if there are possible benefits, remember that your WINE setup, at the end of the day, works differently than Windows. Therefore, the ability to manage service is important.
This guide should give you the necessarily tools to get there. You can edit your "Windows" services directly through the system.reg file or the regedit utility. The concepts are similar to how you'd do that in Microsoft's operating system. The only major difference is in the reasoning behind why you would allow certain programs to do something. Or not. Anyway, we're done. Take care.
Cheers.