Sign up ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

I'm trying to install d3dx9 with winetricks on wine 1.5 from ppa and I keep getting an error. I tried:

WINEARCH=win32 WINEPREFIX=~/.win32 winecfg 
sudo WINEARCH=win32 WINEPREFIX=~/.win32 winetricks

And still get this error:

wine cmd.exe /c echo '%ProgramFiles%' returned empty string

If I type wine cmd.exe /c echo '%ProgramFiles%' into the terminal I get C:\Program Files so the path seems correct but not when I run winetricks.

I also tried this regedit fix with no luck.

Any ideas?

share|improve this question

3 Answers 3

up vote 6 down vote accepted

I see you use sudo in one of your winetricks commands: that could be the main problem, as sudo shouldn't be used with wine or winetricks (only when running sudo apt-get install wine); see my comment at the end of my post.*

When I successfully installed d3dx9 to a separate wine prefix, which I see you are also using, I used the below command in the terminal.

WINEPREFIX=$HOME/.myprefixname winetricks d3dx9

This is part of the voluminous output I got from the command using the WINEPREFIX:

Executing cabextract -q -d /home/mike/.myprefixname/dosdevices/c:/windows/system32 -L -F d3dx9*.dll /home/mike/.myprefixname/dosdevices/c:/windows/temp/_d3dx9/

You must change .myprefixname to the name of your own prefix; for more explanation of wine prefixes and their use, please see this question.

You only need to specify WINEARCH=win32 or the 64bit equivalent when you create the prefix, as it can't be altered afterwards, as noted at WineHQ. Wine will also refuse to load if you specify a different WINEARCH to the one you created it with.

Just entering in terminal winetricks d3dx9 would instead install directX to your default ~/.wine folder.

*It is most important to note that when installing things with winetricks or using wine, you don't need to use sudo, as you are not installing the files to the system, but to your Wine folder or separate wine prefix in your home folder. Using sudo might cause the problem you are experiencing with paths, as is noted on the actual link given. In the WineFAQ it notes that

Running with sudo...has the added bonus of breaking the permissions on your ~/.wine folder in the process. If you have run Wine with sudo you need to fix the permission errors... and then run winecfg to set Wine up again.

So, I should also check your permissions and refer to the WineFAQ article, as you will need to reset your permissions even if you reinstall wine. If you have used sudo with wine and now root owns some of the files, you will need to change the permissions by running the following commands from the WineFAQ:

cd $HOME  
sudo chown -R $USER:$USER .wine 

Replace .wine with your prefix if you use a WINEPREFIX or use the command for both your .wine folder and your prefix if you have both.

share|improve this answer
Thank you, the sudo was the problem. I purged and re-installed Wine, then set permissions accordingly and winetricks works now fine without sudo and without errors. – elclanrs Dec 2 '12 at 21:54
The problem is sudo, try: sudo su and wine command as root. – WHK Oct 16 at 21:59

I solved this problem giving my user privilegies:

YOURUSERNAME@nt401: ~ $ sudo chgrp -R YOURUSERNAME ~/.cache/winetricks/
YOURUSERNAME@nt401: ~ $ sudo chown -R YOURUSERNAME ~/.cache/winetricks/

hope this helps someone else.

share|improve this answer

I had a similar problem, I fixed it by using export WINEARCH=win64 instead of export WINEARCH=win32

This is because the .wine directory present in your home directory is 64 bit and not 32. Thats why after echo %ProgramFiles% returns as it cannot find a .wine directory for 32 bit arch.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.