You are not logged in.
Project page: http://xyne.archlinux.ca/projects/arch32-light
*edit: check the project page above for up-to-date information*
I finally got around to going through the 32-bit chroot setup guide in the wiki and ended up with this. The project and man pages should explain everything.
As always, questions, suggestions and feedback are welcome.
Related: What's the best way to detect the chroot for the sake of setting the PS1 variable?
Last edited by Xyne (2011-12-10 19:37:00)
My Arch Linux Stuff • Forum Etiquette • Community Ethos - Arch is not for everyone
Offline
Offline
Xyne wrote:Related: What's the best way to detect the chroot for the sake of setting the PS1 variable?
If the root of the chroot exists, you're not in it.
I thought of checking for the chroot's root too, but the would lead to false positives if the package is removed. It's not really an issue, but I would prefer something that can just be left in .bashrc. So far I'm leaning towards creating a hidden file in the chroot's root and testing for that instead, e.g. /opt/arch32/.arch32
Thanks all the same.
My Arch Linux Stuff • Forum Etiquette • Community Ethos - Arch is not for everyone
Offline
Awesome. I have wanted to do the same thing for a long time – as always, you were faster.
I just saw that you don't include locale-gen in your pacman32 -S list, but copy locale.sh and locale.gen over into the chroot directory in arch32.conf. Do localized programs work inside the chroot? I tried dwarffortress a few days ago (without creating locales) and got only boxes instead of characters in a dialog, which was fixed by running locale-gen in the chroot.
Since schroot does some --bind mounting of itself, is it really necessary to mount the directories manually when using arch32run?
I also tried integrating bauerbill into a chroot. I got the package installing part down, this alias should be enough if anyone wants to use it (adjust makepkg32.conf accordingly):
bb32='bauerbill --arch i686 --root /opt/arch32 --cachedir /opt/arch32/var/cache/pacman/pkg --pacman-config /opt/arch32/etc/pacman32.conf --makepkg-config /opt/arch32/etc/makepkg32.conf'
Last edited by Runiq (2010-05-24 12:10:28)
Offline
It's left to the user to install locale-gen if they want it. If you look closely at the arch32.conf file, it doesn't actually copy over files that don't yet exist in the chroot. Both locale.gen and locale.sh will only be copied if the user has installed locale-gen in the chroot. I've done it this way to avoid file conflicts when installing packages in the chroot with pacman.
I've never actually used schroot so I didn't know that it mounted anything itself. Note though that all the hook does is make sure that the daemon is running, which is expected anyway, so I don't think it can hurt to have the extra check. Aside from ensuring that the correct directories are mounted in the chroot, it also prevents files from being created inside the empty mountpoints. The post_remove function of the install file checks that all mount points are empty before removing the chroot to ensure that no data in the mounted directories is lost.
The bauerbill alias that you've posted needs to be changed to work with arch32-light because the pacman32 configuration file and mirrorlist are located at /opt/arch32/etc/pacman32.conf and /opt/arch32/etc/pacman32.d/mirrorlist. This is to ensure that pacman32 in the host remains independent of pacman in the chroot (the base installation doesn't even include pacman in the chroot).
I'll eventually add an "--arch" option to powerpill and tweak both powerpill's and bauerbill's architecture detection to make them easier to use with the chroot.
My Arch Linux Stuff • Forum Etiquette • Community Ethos - Arch is not for everyone
Offline
It's left to the user to install locale-gen if they want it. If you look closely at the arch32.conf file, it doesn't actually copy over files that don't yet exist in the chroot. Both locale.gen and locale.sh will only be copied if the user has installed locale-gen in the chroot. I've done it this way to avoid file conflicts when installing packages in the chroot with pacman.
Ah, I missed that. Thanks for the clarification.
The bauerbill alias that you've posted needs to be changed to work with arch32-light because the pacman32 configuration file and mirrorlist are located at /opt/arch32/etc/pacman32.conf and /opt/arch32/etc/pacman32.d/mirrorlist. This is to ensure that pacman32 in the host remains independent of pacman in the chroot (the base installation doesn't even include pacman in the chroot).
Yes, I caught that right after I posted it. I'll fix the alias.
Edit: Done.
I've never actually used schroot so I didn't know that it mounted anything itself. Note though that all the hook does is make sure that the daemon is running, which is expected anyway, so I don't think it can hurt to have the extra check. Aside from ensuring that the correct directories are mounted in the chroot, it also prevents files from being created inside the empty mountpoints.
Schroot has a precofigured makeshift fstab file for arch32 under /etc/schroot/mount-arch32. Since I never really did anything else with my chroot aside from running applications installed by pacman32 (or bb32 in my case), I left it to schroot to mount my stuff. That way I also didn't need to run the arch32 daemon the wiki specified. If I actually needed shell access to the chroot, I just launched schroot -p -- bash or schroot -p -- zsh. (I don't know if this could give rise to any security issues, though). I didn't try the more exotic cases however, like installing applications that need to change CDs in the middle of the process in chrooted wine…
I'll play around with schroot a bit to see if any issues come up with the mounts.
Last edited by Runiq (2010-05-24 12:10:45)
Offline
hmm interesting approach. "packaging" a chroot by (ab)using an .install file
< Daenyth> and he works prolifically
4 8 15 16 23 42
Offline
Maybe better place for ARCH32MOUNT array is no rc.conf but /etc/conf.d/arch32.
Just suggestion ...
I'm not sure and so far I've had nearly no feedback on this, but the idea behind rc.conf is that if should be a common configuration file. As the daemon is Arch-specific, I think it makes sense to use an array in rc.conf.
If others disagree then I will consider changing it.
My Arch Linux Stuff • Forum Etiquette • Community Ethos - Arch is not for everyone
Offline
Related: What's the best way to detect the chroot for the sake of setting the PS1 variable?
I use schroot to get into my chroot environment. schroot defines several environment variables
SCHROOT_UID
SCHROOT_GID
SCHROOT_GROUP
SCHROOT_USER
SCHROOT_SESSION_ID
SCHROOT_COMMAND
I test for SCHROOT_USER in my .bashrc and apply my prompt from there.
if [ -z "$SCHROOT_USER" ]; then
PS1='\[\033[1;39m\]\h:\[\033[1;32m\]\W/\[\033[0m\] '
else
PS1='(\[\033[1;32m\]arch32)\[\033[1;39m\]\h:\[\033[1;32m\]\W/\[\033[0m\] '
fi
Offline
First of all: Thank you Xyne for this wonderful tool!
I'm having trouble running skype with this. I have to use "LD_PRELOAD= /usr/lib/libv4l/v4l1compat.so skype" to get my camera to work, but trying that with 'arch32run' gives me the following error:
Failed to execute "LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so": No such file or directory
Now, if I use 'arch32' to chroot in first and then run the command it functions fine.
I'm hoping someone can explain what I'm doing wrong here.
Thanks!
Offline
I never use arch32run or per-command variables, so I don't know. If you're running
arch32run "LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so skype"
then I would try
LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so arch32run skype
or
arch32run 'sh -c "LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so skype"'
(maybe without the single quotation marks)
I think the first suggestion will work because the schroot command in arch32run is set to preserve the environment. Again though, I never use it so I'm very unfamiliar with it.
If neither suggestion works, check schroot's documentation. Let me know if arch32run needs to be changed in some way.
My Arch Linux Stuff • Forum Etiquette • Community Ethos - Arch is not for everyone
Offline
Xyne, thank you so much.
I've been trying to get my damned camera working with skype for months now and thanks to your help I have.
the second one you posted (without the single quotations) worked.
Thanks again.
Offline
Just tried it out coz I had nothing better to do. Removed all my lib-32 packages.
just one question: If i don't mount my 64bit /home, would I have to create a /home for the 32bit chroot?
The only program I use in the 32bit chroot is skype and I don't really need to have access to /home apart from skype storing my username and password. so If I can have skype store it under /opt/arch32 itself, then I wouldn't have to mount /home.
There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !
Offline
You could use /opt/arch32/home as a regular home directory (just make sure that you create the necessary user directories and set the permissions).
You could also mount something other than /home to /opt/arch32/home. Just use a colon (":") in the ARCH32MOUNT array to specify a different mountpoint. Here are some example suggestions:
/home/you/home32:/home # mount "/home/you/home32" as "/home" in the chroot
/home/you/home32:/home/you # mount "/home/you/home32" as "/home/you" in the chroot
/home/home32:/home # mount "/home/home32" as "/home" in the chroot
/tmp/home32:/home # mount "/tmp/home32" as "/home" in the chroot
*edited to remove unintentional smiley due to colon*
Last edited by Xyne (2010-07-18 10:30:29)
My Arch Linux Stuff • Forum Etiquette • Community Ethos - Arch is not for everyone
Offline
A little patch to arch32.conf to get rid off the xhost messages when there is no DISPLAY variable set:
# Add the local host to xhost.
if [ ! -z "${DISPLAY}" ]; then
xhost +local:
fi
Offline
Thanks, slubman. I've updated the package.
My Arch Linux Stuff • Forum Etiquette • Community Ethos - Arch is not for everyone
Offline
I don't know what just happened... but I installed this package and added the array (ARCH32MOUNT=('/proc' '/proc/bus/usb' '/dev' '/dev/pts' '/dev/shm' '/sys' '/tmp' '/home')) and arch32 daemon to rc.conf... and upon restart, I realized the mounts to my home directory almost wiped my home directory. It deleted a few light folders and killed a bunch of files (like .xinitrc).
I realized my mistake may have been to have include the /home as a mount, but I also found that a bunch of other daemons like alsa and dbus now don't seem to function correctly. Anyone know where I went wrong?
Offline
The ARCH32MOUNT array that you posted includes some extra spaces but I don't see anything wrong with it:
ARCH32MOUNT=('/proc' '/proc/bus/usb' '/dev' '/dev/pts' '/dev/shm' '/sys' '/tmp' '/home')
Mounting /home does not remove anything in /home and I've added checks to the arch32-light package to make sure that everything is unmounted before removing anything from the chroot. The only think that I can think of is that you inadvertently ran something in the chroot that started wiping your home directory in the chroot. Anything that you do to a mounted directory in the chroot is done to the underlying mounted directory.
If you don't want to mount /home, you could always create a subdir just for the chroot and mount that as home, e.g. "/home/arch32:/home". The arch32-light manpage mentions the use of the colon to change mountpoint mappings.
My Arch Linux Stuff • Forum Etiquette • Community Ethos - Arch is not for everyone
Offline
What is the proper way to run arch32run? I don't want to run everything as root in the chroot but doing it as user gives me stuff like:
non-network local connections being added to access control list
/usr/bin/diff: /etc/shadow: Permission denied
/usr/bin/diff: /opt/arch32/etc/shadow: Permission denied
/usr/bin/diff: /etc/sudoers: Permission denied
/usr/bin/diff: /opt/arch32/etc/sudoers: Permission denied
/usr/bin/diff: /etc/sudoers.d: Permission denied
/usr/bin/diff: /opt/arch32/etc/sudoers.d: Permission denied
Can I safely ignore that?
Offline
Read through the comments in the configuration file (arch32.conf). You could remove those files from the list of files to synchronize (and then handle them manually), you could simply ignore the warnings, or you could even dynamically change the list depending on the current user.
My Arch Linux Stuff • Forum Etiquette • Community Ethos - Arch is not for everyone
Offline
Since those are system files, wouldn't the only successful sync occur when the user is doing something as root? In that case, I suggest the syncing should only occur if USER==root. I will change this for me now but you might want to add it to your default script as well.
Offline
After thinking about the issue a bit, I've made several changes. You can find a changelog here.
My Arch Linux Stuff • Forum Etiquette • Community Ethos - Arch is not for everyone
Offline
You should update the "about" above your changelog to actually reflect the changes.
Offline
done, thanks
My Arch Linux Stuff • Forum Etiquette • Community Ethos - Arch is not for everyone
Offline