Problems with wincfg

Questions about Wine on Linux
Locked
David Bailey
Level 2
Level 2
Posts: 14
Joined: Thu Jun 02, 2011 11:11 am

Problems with wincfg

Post by David Bailey »

This is a long tale - most of which is probably not relevant.

1) I installed wine on Fedora 17 and encountered a problem which turned out to be because wine now includes 64-bit EXE execution capabilities. I therefore deleted .wine, and set up a wineprefix restricted to 32 bits - as advised here. This worked nicely.

2) At some point I accidentally ran wine as super user :(

3) I wanted to add a drive to wine so I ran winecfg, which gave the message L"C:\\windows\\system32\\wineboot.exe" although the GUI then appeared.

4) When I clicked on the Drives tab, I got the message: Failed to connect to the mount manager.

I tried deleting .wine, uninstalling wine and reinstalling, but I can't fix winecfg

Can anyone help me to get winecfg working, or maybe point out a file where the drive information is stored?

Also, if wine is not to be used as super user, why doesn't it check for that eventuality and stop with an error message before any damage is done?

David
User avatar
dimesio
Moderator
Moderator
Posts: 13207
Joined: Tue Mar 25, 2008 10:30 pm

Re: Problems with wincfg

Post by dimesio »

David Bailey wrote:2) At some point I accidentally ran wine as super user :(
http://wiki.winehq.org/FAQ#head-8b89c92 ... 96093e1484
4) When I clicked on the Drives tab, I got the message: Failed to connect to the mount manager.
Sounds like you didn't install all the necessary 32 bit parts of Wine. I believe Fedora splits Wine into lots of different packages; make sure you have all the ones you need.
Also, if wine is not to be used as super user, why doesn't it check for that eventuality and stop with an error message before any damage is done?
It's not recommended, but ultimately it's the user's choice.
David Bailey
Level 2
Level 2
Posts: 14
Joined: Thu Jun 02, 2011 11:11 am

Re: Problems with wincfg

Post by David Bailey »

dimesio wrote: Sounds like you didn't install all the necessary 32 bit parts of Wine. I believe Fedora splits Wine into lots of different packages; make sure you have all the ones you need.
Do you know where to find this list - or better, which one contains wineboot.exe .

Clearly the downside to spitting wine into many packages, is that it is messy to completely reinstall.
It's not recommended, but ultimately it's the user's choice.
Still it would be nice if you got an error message unless you configured it otherwise.

David
User avatar
dimesio
Moderator
Moderator
Posts: 13207
Joined: Tue Mar 25, 2008 10:30 pm

Re: Problems with wincfg

Post by dimesio »

David Bailey wrote: Do you know where to find this list - or better, which one contains wineboot.exe .

Clearly the downside to spitting wine into many packages, is that it is messy to completely reinstall.
Shouldn't your package manager be able to tell you what's available? I don't use Fedora, so I can't tell you the exact command.
Still it would be nice if you got an error message unless you configured it otherwise.
Wine would have to be actually running show an error message, and by then the damage is already done.
Martin Gregorie

Problems with wincfg

Post by Martin Gregorie »

On Mon, 2012-06-18 at 11:09 -0500, dimesio wrote:
David Bailey wrote:
Do you know where to find this list - or better, which one contains wineboot.exe .

Clearly the downside to spitting wine into many packages, is that it is messy to completely reinstall.
Shouldn't your package manager be able to tell you what's available? I don't use Fedora, so I can't tell you the exact command.
This does it:

yum list 'wine*'
Wine would have to be actually running show an error message, and by
then the damage is already done.
Wine does some stuff rather later than you'd expect. For instance,
it doesn't seem to respond to "wine --version" without first creating a
prefix, which rather goes against the UNIX philosophy: a program should
always respond to the command line -?/--help, -v/--version options and
report any invalid arguments and options before it does anything else.


Martin
Usurp
Level 4
Level 4
Posts: 161
Joined: Sat Apr 19, 2008 7:16 am

Re: Problems with wincfg

Post by Usurp »

The "wine" metapackage installs all the required subpackages.
It exists in both 64 and 32 bits versions.
David Bailey wrote:
dimesio wrote: Sounds like you didn't install all the necessary 32 bit parts of Wine. I believe Fedora splits Wine into lots of different packages; make sure you have all the ones you need.
Do you know where to find this list - or better, which one contains wineboot.exe .

Clearly the downside to spitting wine into many packages, is that it is messy to completely reinstall.
It's not recommended, but ultimately it's the user's choice.
Still it would be nice if you got an error message unless you configured it otherwise.

David
David Bailey
Level 2
Level 2
Posts: 14
Joined: Thu Jun 02, 2011 11:11 am

Re: Problems with wincfg

Post by David Bailey »

dimesio wrote: Wine would have to be actually running show an error message, and by then the damage is already done.
I don't really understand, surely the very first line of wine's main() could contain a test for super user - just attempt to make a directory inside /etc - should do, but I am sure their are neater methods. A simple Gnome dialog box would do.

David
Martin Gregorie

Problems with wincfg

Post by Martin Gregorie »

On Mon, 2012-06-18 at 15:37 -0500, David Bailey wrote:
I don't really understand, surely the very first line of wine's main()
could contain a test for super user - just attempt to make a directory
inside /etc - should do, but I am sure their are neater methods.
There's a much easier way:

if (strcmp(getenv("USER"), "root") == 0)
if (!run_as_root_ok)
{
fprintf(stderr, "Error: wine is being run as root\n");
exit(EACCESS);
}


Martin
David Bailey
Level 2
Level 2
Posts: 14
Joined: Thu Jun 02, 2011 11:11 am

Re: Problems with wincfg

Post by David Bailey »

Martin Gregorie wrote:On Mon, 2012-06-18 at 15:37 -0500, David Bailey wrote:
I don't really understand, surely the very first line of wine's main()
could contain a test for super user - just attempt to make a directory
inside /etc - should do, but I am sure their are neater methods.
There's a much easier way:

if (strcmp(getenv("USER"), "root") == 0)
if (!run_as_root_ok)
{
fprintf(stderr, "Error: wine is being run as root\n");
exit(EACCESS);
}


Martin
Well yes - though I would prefer a dialog box - wine tends to spew out quite a few errors to the console even for working code - they tend to get ignored, and the program might not be interactive.

The point is, even when you know about the problem, it is so easy to make a mistake. For example, I use Notepad++ under wine, so I am invoking wine all the time.

David
Martin Gregorie

Problems with wincfg

Post by Martin Gregorie »

On Mon, 2012-06-18 at 16:40 -0500, David Bailey wrote:
Martin Gregorie wrote:
On Mon, 2012-06-18 at 15:37 -0500, David Bailey wrote:

I don't really understand, surely the very first line of wine's main()
could contain a test for super user - just attempt to make a directory
inside /etc - should do, but I am sure their are neater methods.

There's a much easier way:

if (strcmp(getenv("USER"), "root") == 0)
if (!run_as_root_ok)
{
fprintf(stderr, "Error: wine is being run as root\n");
exit(EACCESS);
}


Martin
Well yes - though I would prefer a dialog box - wine tends to spew out
quite a few errors to the console even for working code - they tend to
get ignored, and the program might not be interactive.
If that was in something I'd implemented, it would be executed after
validating command line parameters and before doing anything else apart
from seeing if help had been requested. The result would be an immediate
exit with the error message as shown and the exit code set to EACCES
(Permission dented) unless run_as_root is true (which I'd probably link
to a command line option, say --allow_root). Even the dimmest bulb
should be able to understand that. If the user meant to run it as root,
the solution is easy: add --allow_root to the command line and hit
RETURN.
The point is, even when you know about the problem, it is so easy to
make a mistake. For example, I use Notepad++ under wine, so I am
invoking wine all the time.
Agreed, but given that its usually not a good idea to run wine as root
and there are remarkably few situations where its necessary, a gentle
reminder like that is a good idea.

Re Notepad++ - I'd strongly suggest you learn at least the basics of
editing files with vi/vim. Its not most peoples' idea of a friendly
editor, but there are two BIG reasons for knowing how to use it:

1) it will work reliably in rescue situations where no other editor will
even start: you can run it from the Linux console as a full screen
editor when the system is so borked that the screen will only work as a
glass teletype (no cursor movement, only CRLF, clear screen and tab) and
arrow keys are not understood (it will use h,l,j,k as
left,right,down,up).

2) it is available on almost every *NIX related system which makes it as
near to a universally available editor as you'll find. Besides, its use
of regular expressions for searching and text replacement is extremely
powerful.

Normally you'd probably use gedit if you're using Gnome, XFCE or another
Gnome-related window manager - dunno what KDE or Unify prefer since I
never use them.


Martin
User avatar
dimesio
Moderator
Moderator
Posts: 13207
Joined: Tue Mar 25, 2008 10:30 pm

Post by dimesio »

You both might want to add comments to http://bugs.winehq.org/show_bug.cgi?id=17337.
Martin Gregorie

Problems with wincfg

Post by Martin Gregorie »

On Mon, 2012-06-18 at 19:19 -0500, dimesio wrote:
You both might want to add comments to http://bugs.winehq.org/show_bug.cgi?id=17337.
Done.


Martin
David Bailey
Level 2
Level 2
Posts: 14
Joined: Thu Jun 02, 2011 11:11 am

Post by David Bailey »

I'm having difficulty getting my password back for the bugs website, but I wanted to add that testing for USER == root doesn't seem to handle sudo:

sudo echo $USER

returns 'dave' for me.

David
Martin Gregorie

Problems with wincfg

Post by Martin Gregorie »

On Tue, 2012-06-19 at 13:59 -0500, David Bailey wrote:
I'm having difficulty getting my password back for the bugs website, but I wanted to add that testing for USER == root doesn't seem to handle sudo:

sudo echo $USER

returns 'dave' for me.
This depends on when $USER is evaluated and (in a bash session) when the
value is substituted for the variable name. In your example substitution
will occur when bash parses the command line, i.e. 'dave' was substituted
for $USER before sudo was executed. OTOH, if the substitution done is inside
a simple script which is run under the control of sudo, then the substitution
takes place within the environment established by sudo. Here you go:

$ cat test
#!/bin/bash
echo $USER
$ ./test
kiwi
$ sudo ./test
root
$

What happens is that this time no substitution happens when the command
is parsed. Instead, sudo changes user to root and spawns a shell under
that user. This shell executes the script by spawning a second shell (by
executing #!/bin/bash as 'root') and this evaluates $USER and does the
substitution.

Of course, much the same applies if the value of USER is retrieved
within a C program by calling getenv(): again, its a delayed evaluation
that would happen after sudo has done its thing. Finally, take a look at
the next version of my script and think about what it does:

$ cat ./test
#!/bin/bash
if [ -n "$1" ]
then
echo $1
else
echo $USER
fi
echo "Local USER is $USER"
$ sudo ./test $USER
kiwi
Local USER is root
$ sudo ./test
root
Local USER is root


Martin
Bruno Jesus

Problems with wincfg

Post by Bruno Jesus »

On Tue, Jun 19, 2012 at 4:42 PM, Martin Gregorie <[email protected]> wrote:
Of course, much the same applies if the value of USER is retrieved
within a C program by calling getenv(): again, its a delayed evaluation
that would happen after sudo has done its thing.
I'm not sure if it was already discussed or not but what about the
good and old user id checking:

if(geteuid()==0 || getuid()==0) exit(EACCESS);

Best wishes,
Bruno
Locked