You are not logged in.

#1 2010-03-24 22:10:06

daba
Member
Registered: 2010-03-24
Posts: 20

running wine in userspec'ed chroot will fail

Hi Archlinux Community!

I have just set up my first Archlinux system coming from Windows + Debian/Ubuntu. Because I'm a dedicated gamer one of my first goals, after setting up X was to get wine up and running. I followed the instructions on how to setup a 32bit chroot enviroment using the Arch64: Install bundled 32bit system Guide. I choose not to setup an entire system, but the Alternative lightweight install, because all I want to use this chroot environment for is running a bunch of games through wine.

While setting up the chroot environment I configured and ran everything inside the chroot as root, but because it is not recommended to run wine as root I choose to move the .wine directory from /root to /home/myuser and chown it to my user. I opened a terminal, su'ed to root and then chrooted into my 32bit system using the --userspec=1000 flag (1000 is my users user id):

user@system> su
Password:
root@system# chroot --userspec=1000 /opt/arch32
user@chroot> whoami
user

The prompt showed my username and whoami confirmed I successfully chrooted into the 32bit system with my own user credentials. The next step was to run wine with a program I had successfully been running with root permissions. However, I would not start giving me the following message:

wine: '/root' is not owned by you, refusing to create a configuration directory there

I was buffed. Why would wine bother about /root, I am not logged in as root. I tried running winecfg but it gave me the exact same error. I wondered what was happening, so I looked into my enviroment variables and voila:

user@chroot> env | grep HOME=
HOME=/root

I don't know why this wouldn't change to reflect my actual user's home. However, I manually changed this to fit my actual home:

user@chroot> HOME=/home/$USER

I then tried running wine again which indeed worked - more or less. I obviously had no sound and no graphics acceleration. My user is in all the media groups (audio, video, etc) but I figured I might not only "lost" my home dir, but maybe also my groups and indeed:

user@chroot> groups
root bin daemon sys adm disk wheel log

This does not look like my groups, but more like root's groups. I thought maybe all this is happening because of me using su to change to root for chrooting. What if I instead use sudo? So I left my chroot, left the su environment and ran chroot through sudo:

user@system> sudo chroot --userspec=1000 /opt/arch32

And indeed $HOME was now correctly set to /home/user - but nevertheless my groups remained those of root. So I tried using the --groups option of chroot and added all the required multimedia groups:

user@system> sudo chroot --userspec=1000 --groups=50,92,93,95,90 /opt/arch32

50 = games, 92 = video, 93 = audio, 95 = optical, 90 = storage (or in a different order; i just recall this from memory right now). But then chroot would fail with the following message:

chroot: invalid group `50'
chroot: invalid group `92'
chroot: invalid group `93'
chroot: invalid group `95'
chroot: invalid group `50'
chroot: invalid group `90'

I thought maybe I may not user GIDs but must use the groups names, but that did not change anything - except for chroot complaining about the names instead of the numbers. All those groups are existent in the original system aswell as in the chroot system. I tried figuring out what I was doing wrong by reading the man page and searching the web, but without any success. Infact the --groups and --userspec options seem to be so new to chroot that you hardly find any documents regarding them. Most distros without a rolling release don't even have them in their repos yet.

In the end I suspect chroot's new options to not be very production ready: --userspec obviously does not adjust at least the $HOME environment variable which I believe it should (and does not say so in the man page) and --groups does not seem to work at all. I hope I'm interpreting this wrong and hope I'm just screwing this up by myself. I'd really appriciate any hints, ideas, links or whatever on what is going wrong and why I'm not able to run a fully accelerated wine from within my chroot - without explicitly su'ing to my user from within the chroot, what infact does work without any problems.

Am I doing this wrong? Might these be bugs in the new chroot options? I hope someone can clarify this for me.

Best Regards,
Daniel

Last edited by daba (2010-03-24 22:19:04)

Offline

#2 2010-03-25 14:04:36

jimburnettva
Member
From: Virginia, USA
Registered: 2010-02-12
Posts: 48
Website

Re: running wine in userspec'ed chroot will fail

Just curious. Can you make 1 group for your whole chroot system and just use that group? Assign the audio and everything else to that group? OR, make a group and add all those groups to the new group? Just as a test?

I ran into this before when making my own chroot jail a while back, can't remember exactly what I did to fix it but I do know it was related to what I wrote above.


My Linux & Progamming Blog - Jimmy Burnett

Offline

#3 2010-03-26 10:23:28

daba
Member
Registered: 2010-03-24
Posts: 20

Re: running wine in userspec'ed chroot will fail

I could create a single group for my chroot system, however, I do not know how to give that group the same privileges as the audio, video, etc groups. I grepped for audio beneith /etc but didn't find anything that would look like "allow the group audio to use the audio device". The closes I found where some magic numbers in /etc/security/limits.conf. I'll give it a shot and give my chroot group the same limits configuration. However, I do not like the approach of adding another group and "copying" the audio, video, etc group privileges very much. It clutters stuff up a lot.
I would really like adding video, audio, etc to another group as "sub groups" as you suggested, but afaik there is no such thing as group cascading in *nix. At least groumod aswell as usermod will not allow me to set a group as a member of another group.

I found that /opt/arch32/etc/gshadow did not contain my users group information, so I added it there as well. However, I do not even know if gshadow is even used by the system to determin group-user relations. After all: it did not help.

Last edited by daba (2010-03-26 10:23:58)

Offline

Board footer

Powered by FluxBB