multilib or virtual machines - pro's and con's
multilib or virtual machines - pro's and con's
Hello,
I want to get an idea how to go further with the setup of my machine.
Its running Salix Xfce 13.37 64bit.
There is a need to support a 32bit application, namely Softmaker Office 2010. I bought this app as it is much easier in use than OOOorg or libreOffice etc.
However, there is no 64bit package and probably never will be. At least softmaker is refusing to make a 64bit version as Microsoft will neither produce their office in native 64bit.
So my first idea was to install multilib. However, some posts are pointing to install salix 32bit in a virtual machine.
But I cannot see the pro's and con's of each way.
What is the pitfall of/in mulitlib and what are the restrictions of a virtualbox or QEMU installation?
Even a parallel installation of both is a thinkable solution.
Please let me know your thoughts on that.
Thanks.
I want to get an idea how to go further with the setup of my machine.
Its running Salix Xfce 13.37 64bit.
There is a need to support a 32bit application, namely Softmaker Office 2010. I bought this app as it is much easier in use than OOOorg or libreOffice etc.
However, there is no 64bit package and probably never will be. At least softmaker is refusing to make a 64bit version as Microsoft will neither produce their office in native 64bit.
So my first idea was to install multilib. However, some posts are pointing to install salix 32bit in a virtual machine.
But I cannot see the pro's and con's of each way.
What is the pitfall of/in mulitlib and what are the restrictions of a virtualbox or QEMU installation?
Even a parallel installation of both is a thinkable solution.
Please let me know your thoughts on that.
Thanks.
Regards Gruß
jpg
jpg
Re: multilib or virtual machines - pro's and con's
Another possible solution is to install 32bit alongside e.g. on a separate partition. You can then use chroot to run 32bit applications from that 32bit environment. This avoids the overhead of virtualization.
Re: multilib or virtual machines - pro's and con's
That's probably the best possible option.Shador wrote:Another possible solution is to install 32bit alongside e.g. on a separate partition. You can then use chroot to run 32bit applications from that 32bit environment. This avoids the overhead of virtualization.
Re: multilib or virtual machines - pro's and con's
The major penalty of multilib is that it's sort of a mess or at least can easily create a mess. While it's a nice comfortable solution, it's still a bit "hackish and messy" (might be a bit hard to say it that plain in this case).
For virtual machines it's just performance (mainly memory, although cpu and especially any sort of acceleration like graphics, sse, ...) and convenience. Two separated computers are just not comfortable, no matter how much integration guest additions might provide.
The chroot solution pretty much overcomes those downsides. It's still a little less convenient than multilib and possibly not the easiest solution to setup.
EDIT:
That's how you setup a chroot system:
The easiest way is to just install another Salix system from an installation cd without installing lilo. There are other methods which don't even require booting from the installation cd nor rebooting at all, but you lack all the (auto)configuration done by the installation cd.
Once you have setup that partition mount it and any other partitions you might want somewhere in your tree. Then you can use this script (change the variables in the beginning and comment DISTCC_HOSTS if you don't use distcc it):
You should also add the script to your sudoers file, e.g. like this:
In the chroot environment you should consider adding this to the .bashrc of all users or some global file (it does no harm in the host bashrc either):
I also recommend at least binding your /home partition to the chroot like this:
or like this for fstab:
The script tries to change to the same directory in the chroot from where it was invoked from. That means when launched with PWD=/home/shador/projects/salix/ the result is when viewed from the host environment /media/salix32/home/shador/projects/salix/ or from within the chroot /home/shador/projects/salix/. This might of course not always be possible so the default is to fallback to /media/salix32/ (or depending on your pov /).
If you don't do this some additional setup with X is possibly needed as the magic cookie needed to connect to the Xserver is not available in the chroot. Have a look at man Xsecurity in this case. To make it short two possible solutions are coping .Xauthority or allowing at least connections from localhost with xauth.
For virtual machines it's just performance (mainly memory, although cpu and especially any sort of acceleration like graphics, sse, ...) and convenience. Two separated computers are just not comfortable, no matter how much integration guest additions might provide.
The chroot solution pretty much overcomes those downsides. It's still a little less convenient than multilib and possibly not the easiest solution to setup.
EDIT:
That's how you setup a chroot system:
The easiest way is to just install another Salix system from an installation cd without installing lilo. There are other methods which don't even require booting from the installation cd nor rebooting at all, but you lack all the (auto)configuration done by the installation cd.
Once you have setup that partition mount it and any other partitions you might want somewhere in your tree. Then you can use this script (change the variables in the beginning and comment DISTCC_HOSTS if you don't use distcc it):
Code: Select all
#!/bin/sh
CHROOT_USER=shador
CHROOT_PATH=/media/salix32
CHROOT_NAME=salix32
CHROOT_ARCH=i486
DISTCC_HOSTS="localhost nix:45932 ker:45932"
usage() {
cat <<EOF
Usage: `basename $0` [OPTIONS] [-- COMMAND]
Switch to the same directory where we're being called from inside the
chroot environment ('$CHROOT_PATH') and by default launch an
interactive shell. The architecture is modified to pretend $CHROOT_ARCH.
If the directory doesn't exist in the chroot the root is used.
Inside the chroot environment two variables are set:
CHROOT: true
CHROOT_NAME: $CHROOT_NAME (name of the chroot)
OPTIONS:
-u, --user=USER switch to USER (only root, default: '$CHROOT_USER')
-c, --command=COMMAND execute COMMAND instead of a shell
-h, --help print this message and exit
EOF
}
argument() {
opt=$1
shift
if test $# -eq 0; then
echo "Error: option requires an argument -- '$opt'" 1>&2
exit 1
fi
echo $1
}
quote() {
for i in "$@"; do
echo -n "'$i' "
done
}
# Check the arguments.
while test $# -gt 0
do
option=$1
shift
case "$option" in
-u | --user)
user=`argument $option "$@"`; shift
;;
--user=*)
user=`echo "$option" | sed 's/--output=//'`
;;
-c | --command)
command=`argument $option "$@"`; shift
command=`quote $command`
;;
--command=*)
command=`echo "$option" | sed 's/--command=//'`
command=`quote $command`
;;
-h | --help)
usage
exit
;;
--)
command=`quote "$@"`
break
;;
*)
echo "Error: Unrecognized option '$option'" 1>&2
usage
exit 1
;;
esac
done
if ! [ -d $CHROOT_PATH ] || ! [ -f $CHROOT_PATH/bin/bash ]; then
echo "Error: check if chroot path is mounted -- '$CHROOT_PATH'" 1>&2
exit 1
fi
if [ "x$user" != "x" ]; then
if [ "x$UID" == "x0" ]; then
CHROOT_USER=$user
else
echo "Error: Not allowed to change the user to su to" 1>&2
echo "Warning: Falling back to the default: '$CHROOT_USER'" 1>&2
fi
fi
if [ "x$UID" != "x0" ]; then
exec sudo "$0" -u $CHROOT_USER -- $command
fi
startdir="$PWD"
if ! [ -d $CHROOT_PATH/$startdir ]; then
startdir=/
fi
if [ "x$command" != "x" ]; then
bashcmd="/bin/bash -c \\\"`echo $command`\\\""
else
bashcmd="/bin/bash -i"
fi
cd $CHROOT_PATH
# prepare the chroot environment
mount -t proc proc proc/ >/dev/null 2>&1 && PROC=true
mount -t sysfs sysfs sys/ >/dev/null 2>&1 && SYS=true
mount -t devpts devpts dev/pts/ >/dev/null 2>&1 && DEVPTS=true
cp -L /etc/resolv.conf etc/resolv.conf
setarch $CHROOT_ARCH \
chroot $CHROOT_PATH /bin/sh -c " \
grep -v rootfs /proc/mounts > /etc/mtab; \
su $CHROOT_USER -s /bin/sh -c \"cd $startdir; \
[ -f /etc/profile ] && . /etc/profile; \
[ -f ~/.bash_profile ] && . ~/.bash_profile; \
[ -f ~/.bash_login ] && . ~/.bash_login; \
[ -f ~/.profile ] && . ~/.profile; \
[ -f ~/.bashrc ] && . ~/.bashrc; \
DISTCC_HOSTS='$DISTCC_HOSTS' \
CHROOT=true CHROOT_NAME='$CHROOT_NAME' \
PS1=\\\"($CHROOT_NAME) \\\$PS1\\\" \
$bashcmd \"" || exit 1
cd $CHROOT_PATH
[ "x$PROC" = "xtrue" ] && umount proc/
[ "x$SYS" = "xtrue" ] && umount sys/
[ "x$DEVPTS" = "xtrue" ] && umount dev/pts/
Code: Select all
%users ALL = (root) NOPASSWD:/usr/local/bin/switch32
Code: Select all
if [ "$CHROOT" == "true" ]; then
if [ -z "$CHROOT_NAME" ]; then
CHROOT_NAME=chroot
fi
PS1="($CHROOT_NAME) $PS1"
fi
Code: Select all
mount --bind /home /media/salix32/home
Code: Select all
/home /media/salix32/home none bind 0 0
If you don't do this some additional setup with X is possibly needed as the magic cookie needed to connect to the Xserver is not available in the chroot. Have a look at man Xsecurity in this case. To make it short two possible solutions are coping .Xauthority or allowing at least connections from localhost with xauth.
Re: multilib or virtual machines - pro's and con's
Very good!
Maybe some other variables must be set, like DISPLAY ?
Maybe some other variables must be set, like DISPLAY ?
Re: multilib or virtual machines - pro's and con's
Yes, possibly more could be done still, but I didn't need more so far. Anyway DISPLAY seems to be preserved. At least I can launch graphical applications from the chroot too.
Re: multilib or virtual machines - pro's and con's
Hi,
sounds interesting and thanks for the scripts I will use.
I have downloaded Salix xfce 13.37 32bit already. Will make the installation CD soon.
However, how do I manage the nvidia driver problem? The setup of the rest is pretty common and easy
but I have no idea how I can manage the nvidia driver installation.
I am still a bit confused on how it works, but I will first prepare the system and then come back with questions.
sounds interesting and thanks for the scripts I will use.
I have downloaded Salix xfce 13.37 32bit already. Will make the installation CD soon.
However, how do I manage the nvidia driver problem? The setup of the rest is pretty common and easy
but I have no idea how I can manage the nvidia driver installation.
I am still a bit confused on how it works, but I will first prepare the system and then come back with questions.
Regards Gruß
jpg
jpg
Re: multilib or virtual machines - pro's and con's
You don't need to care about that. Graphic drivers are handled by the kernel and you will be running the same 64bit kernel for which you already have a working solution I assume. Just the userspace is 32bit.
All you need is a complete, working userspace without kernel. Actually you don't even need to install kernel and kernel modules unless you're also planning to normally boot that system.
All you need is a complete, working userspace without kernel. Actually you don't even need to install kernel and kernel modules unless you're also planning to normally boot that system.
Re: multilib or virtual machines - pro's and con's
Well,
so far I did the setup hopefully correct...but I am not where I want to be.
1. installed salix 32 on sda1 (64 bit system is on sdb)
2. created the script file with following changes:
CHROOT_USER=jpg
This user is known to both environments.
3. mounted the salix32 environment like /dev/sda1 /media/salix32 - not to change too much entries in the script
4. modified the sudoers file as stated
5. modified the .bashrc file under the user directory and root directory in the salix32
Running just 'switch32' ends up with a terminal session on salix32. I can move around with 'cd' and so on. 'ping' runs fine.
However, when I try to launch a graphical application, i.e. evince, the error message is:
=> cannot open display
My understanding from the thread was that even graphical apps would run.
Maybe I missed some piece of setup.
Help please!
Other than that, it looks really cool!
Thanks.
so far I did the setup hopefully correct...but I am not where I want to be.
1. installed salix 32 on sda1 (64 bit system is on sdb)
2. created the script file with following changes:
CHROOT_USER=jpg
This user is known to both environments.
3. mounted the salix32 environment like /dev/sda1 /media/salix32 - not to change too much entries in the script
4. modified the sudoers file as stated
5. modified the .bashrc file under the user directory and root directory in the salix32
Running just 'switch32' ends up with a terminal session on salix32. I can move around with 'cd' and so on. 'ping' runs fine.
However, when I try to launch a graphical application, i.e. evince, the error message is:
Code: Select all
No protocol specified
Cannot parse arguments: Anzeige kann nicht geöffnet werden:
My understanding from the thread was that even graphical apps would run.
Maybe I missed some piece of setup.
Help please!
Other than that, it looks really cool!
Thanks.
Regards Gruß
jpg
jpg
Re: multilib or virtual machines - pro's and con's
Is there any other output? Especially directly after calling switch32? What does echo $DISPLAY say?