You are not logged in.

#1 2010-05-23 02:57:37

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,965
Website

arch32-light: minimal 32-bit chroot

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 StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#2 2010-05-23 03:16:28

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: arch32-light: minimal 32-bit chroot

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.

Offline

#3 2010-05-23 03:34:55

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,965
Website

Re: arch32-light: minimal 32-bit chroot

falconindy wrote:
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 StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#4 2010-05-23 09:32:12

Runiq
Member
From: Germany
Registered: 2008-10-29
Posts: 1,053

Re: arch32-light: minimal 32-bit chroot

Awesome. I have wanted to do the same thing for a long time – as always, you were faster. smile

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

#5 2010-05-23 16:15:45

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,965
Website

Re: arch32-light: minimal 32-bit chroot

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 StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#6 2010-05-24 12:09:38

Runiq
Member
From: Germany
Registered: 2008-10-29
Posts: 1,053

Re: arch32-light: minimal 32-bit chroot

Xyne wrote:

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. sad 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

#7 2010-05-24 13:18:11

Dieter@be
Forum Fellow
From: Belgium
Registered: 2006-11-05
Posts: 2,001
Website

Re: arch32-light: minimal 32-bit chroot

hmm interesting approach. "packaging" a chroot by (ab)using an .install file wink


< Daenyth> and he works prolifically
4 8 15 16 23 42

Offline

#8 2010-06-05 05:48:29

grimi
Member
Registered: 2009-12-27
Posts: 27

Re: arch32-light: minimal 32-bit chroot

Maybe better place for ARCH32MOUNT array is no rc.conf  but /etc/conf.d/arch32.
Just  suggestion ...

Offline

#9 2010-06-06 19:37:24

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,965
Website

Re: arch32-light: minimal 32-bit chroot

grimi wrote:

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 StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#10 2010-06-07 16:24:00

asherlm
Member
From: Virginia
Registered: 2008-03-10
Posts: 2

Re: arch32-light: minimal 32-bit chroot

Xyne wrote:

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

#11 2010-06-22 10:28:11

ctarwater
Member
Registered: 2009-02-05
Posts: 300

Re: arch32-light: minimal 32-bit chroot

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

#12 2010-06-22 19:45:59

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,965
Website

Re: arch32-light: minimal 32-bit chroot

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 StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#13 2010-06-22 20:00:22

ctarwater
Member
Registered: 2009-02-05
Posts: 300

Re: arch32-light: minimal 32-bit chroot

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

#14 2010-07-18 02:45:17

Inxsible
Forum Fellow
From: Chicago
Registered: 2008-06-09
Posts: 9,183

Re: arch32-light: minimal 32-bit chroot

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.


Forum Rules

There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !

Offline

#15 2010-07-18 10:29:15

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,965
Website

Re: arch32-light: minimal 32-bit chroot

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 StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#16 2010-08-05 12:31:32

slubman
Member
From: Grenoble (France)
Registered: 2004-08-04
Posts: 86
Website

Re: arch32-light: minimal 32-bit chroot

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

#17 2010-08-05 16:32:21

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,965
Website

Re: arch32-light: minimal 32-bit chroot

Thanks, slubman. I've updated the package.


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#18 2010-08-08 21:54:34

ajbader
Member
Registered: 2010-03-22
Posts: 23

Re: arch32-light: minimal 32-bit chroot

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

#19 2010-08-13 23:42:10

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,965
Website

Re: arch32-light: minimal 32-bit chroot

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 StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#20 2010-08-18 03:06:26

Svenstaro
Administrator
From: Germany
Registered: 2008-11-19
Posts: 388

Re: arch32-light: minimal 32-bit chroot

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

#21 2010-08-18 03:32:04

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,965
Website

Re: arch32-light: minimal 32-bit chroot

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 StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#22 2010-08-18 04:21:05

Svenstaro
Administrator
From: Germany
Registered: 2008-11-19
Posts: 388

Re: arch32-light: minimal 32-bit chroot

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

#23 2010-08-18 21:00:20

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,965
Website

Re: arch32-light: minimal 32-bit chroot

After thinking about the issue a bit, I've made several changes. You can find a changelog here.


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#24 2010-08-22 22:36:08

Svenstaro
Administrator
From: Germany
Registered: 2008-11-19
Posts: 388

Re: arch32-light: minimal 32-bit chroot

You should update the "about" above your changelog to actually reflect the changes.

Offline

#25 2010-08-23 00:11:22

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,965
Website

Re: arch32-light: minimal 32-bit chroot

done, thanks


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

Board footer

Powered by FluxBB