OpenVZ Forum


Home » General » Support » faking arch
faking arch [message #3351] Tue, 23 May 2006 21:10 Go to next message
dlzinc
Messages: 34
Registered: March 2006
Member
I have a 64-bit system running a 64-bit kernel and a mix of CentOS 64-bit and CentOS 32-bit VEs. The problem is that some software uses the (uname) arch to determine whether the system is running a 64-bit OS or a 32-bit OS, of course it gets confused when it can't find 64-bit libraries in CentOS 32-bit...

Is there a way I can fake arch per-vps? i.e. have it so that calls made to the kernel requesting it to report the arch will report x64_64 for some VEs and i686/i386 for others?
Re: faking arch [message #3929 is a reply to message #3351] Sat, 24 June 2006 07:11 Go to previous messageGo to next message
almahdi is currently offline  almahdi
Messages: 2
Registered: February 2006
Junior Member
You may want to replace the uname binary with this simple bash script:

#!/bin/bash

case "$1" in
'-a')
  echo "Linux $HOSTNAME 2.6.13 #1 Sat Sep 3 21:11:20 PDT 2005 i686 unknown unknown GNU/Linux"
  ;;
'-n')
  echo "$HOSTNAME"
  ;;
'-r')
  echo "2.6.13"
  ;;
'-v')
  echo "#1 Sat Sep 3 21:11:20 PDT 2005"
  ;;
'-m')
  echo "i686"
  ;;
'-p')
  echo "unknown"
  ;;
'-i')
  echo "unknown"
  ;;
'-o')
  echo "GNU/Linux"
  ;;
*)
  echo "Linux"
esac


Dont forget to give it executable rights.

You may want to change the kernel version too..
Re: faking arch [message #3937 is a reply to message #3351] Sun, 25 June 2006 07:14 Go to previous messageGo to next message
dev is currently offline  dev
Messages: 1693
Registered: September 2005
Location: Moscow
Senior Member

there is so called setarch.rpm with setarch utility exactly for this. Also, starting from some version vzctl should call setarch itself if VPS init is 32bit.


http://static.openvz.org/userbars/openvz-developer.png
Re: faking arch [message #3955 is a reply to message #3937] Mon, 26 June 2006 02:27 Go to previous messageGo to next message
dlzinc
Messages: 34
Registered: March 2006
Member
The uname script only works for things that actually call /bin/uname. At the moment, I've replaced /bin/bash with a slightly modified setarch that setarch's then runs the real bash. Is there a bug open or version-eta for the vzctl setarch feature?

Something interesting...
If I do:
setarch i686 vzctl start 200
then SSH into the VPS and do uname -ar, it will say i686. If I do vzctl enter 200, it'll say x86_64.

So for now, a "cleaner" solution seems to be doing setarch to vzctl.
Re: faking arch [message #3963 is a reply to message #3955] Mon, 26 June 2006 08:34 Go to previous message
dev is currently offline  dev
Messages: 1693
Registered: September 2005
Location: Moscow
Senior Member

Can you please post a bug in http://bugzilla.openvz.org, Igor will check then.
This will help tracking and make sure it will be fixed, not lost.


http://static.openvz.org/userbars/openvz-developer.png

[Updated on: Tue, 27 June 2006 11:04] by Moderator

Report message to a moderator

Previous Topic: HN Dropping Packets
Next Topic: OpenVZ
Goto Forum:
  


Current Time: Sat Jul 20 10:24:23 GMT 2024

Total time taken to generate the page: 0.02470 seconds