To run certain Windows programs in WINE you need to this workaround:
echo 0|sudo tee /proc/sys/kernel/yama/ptrace_scope
According to the support websites, this is due to a bug in the Ubuntu kernel that prevents ptrace and WINE playing well together.
Using the above command you set the ptrace to 0 which according the research I've done(don't ask me which websites, I have seem a lot of them), ptrace has to do with the interactions between programs. The 0 setting is more permissive than the 1.
I have to assume that there was a good reason Ubuntu wanted the ptrace=1 so this leads me back to the short form of the question.
Are there any risks involved in setting ptrace=0. Lower security? problems debugging? any others that I haven't thought of???
P.S. for anybody reading this that wonders what the bug causes, the Windows programs will fail to open at all, in the System Monitor you will see many instances of the program trying to open and then they will eventually all quit and if you run the progam for the terminal you will get an error that tells you that the maximum number of program instances has been reached.
Short answer: no practical danger yet, but read on for a better way...
What's this ptrace thing anyway?
No, ptrace protection is a deliberate kernel security measure first introduced around Ubuntu 10.10. It's not a bug, and so isn't going to be "fixed".
In simple terms, the default
ptrace_scope
value of1
blocks one process from examining and modifying another process unless the second process (child) was started by the first process (parent).This can cause problems with some programs under Wine because of the way
wineserver
provides "Windows Services" to these programs.What are the risks in setting
ptrace_scope
to0
?This restores the old behavior where one process can "trace" another process, even if there is no parent-child relationship.
In theory, a piece of malware can use this to harm you/your computer; e.g. it can attach to Firefox and log all of your URLs/passwords, etc. In practice this is extremely unlikely unless you blindly install binary debs from random sites, etc.
As far as debugging goes, the
0
settings is in fact required forgdb
,strace
, etc. to attach to non-children unless you run them with elevated privileges (sudo).What are the problems with the workaround?
ptrace_scope
is a global value, and while it's set to0
, all processes on your system are exempt from the non-child restriction.ptrace_scope
world-writable (666) as the forum post recommends -- that is a huge security risk because now any process can change it at will!Is there a better solution?
A better solution which is more secure and does not require repetitively modifying ptrace_scope is to grant Wineserver ptrace capabilities.
In a terminal:
This exempts the wineserver and wine-preloader binaries from the non-child ptrace restriction, and allows them to ptrace any process.
If you're using Crossover
Install libcap2:
Then, add an exception for Crossover:
Finally, add its libraries to ld.so.conf (or you will get "error while loading shared libraries: libwine.so.1: cannot open shared object file: No such file or directory"):
In the ubuntuforums.org I got an answer with the following link
https://wiki.ubuntu.com/SecurityTeam/Roadmap/KernelHardening#ptrace_Protection
here is the paste from the link(with my emphasis added)
So I guess the short answer would be that it's less secure but the likely hood of a personal computer coming under those kinds of attacks would be pretty slim.
UPDATE The above instructions:
does not work as of 9/15/2018 on Ubuntu 18.04.1 and PlayOnLinux v.4.2.12 using the latest stable version Wine which is v.3.0.1 libcap2 was already installed.
The error message in Gnome Terminal is as follows:
Not sure what that means.....but thought I'd put it out there for anybody to interpret and maybe have a new, workable solution.
Thanks.
On Ubuntu 19.10
/usr/bin/wineserver
and/usr/bin/wine-preloader
are actually symbolic links not files. This probably applies to 18.04 as well. I saw the following solution on a different post, that I cannot find anymore. Try this instead:Depending on which wine package you're using, you have to add either something like:
echo /opt/wine-stable/lib/ | sudo tee /etc/ld.so.conf.d/wine.conf
or:echo /opt/wine-staging/lib/ | sudo tee /etc/ld.so.conf.d/wine.conf
followed by:sudo /sbin/ldconfig