Re: [gentoo-user] chroot: cannot run command `bin/bash': Exec format error [SOLVED]
On Friday 24 February 2006 06:56, Bo Andresen [EMAIL PROTECTED] wrote about 'Re: [gentoo-user] chroot: cannot run command `bin/bash': Exec format error [SOLVED]': Actually I guess I could just download the the amd64 livecd, mount it, copy its kernel to the harddrive (already did emerge coldplug) and boot on it. I did, however, find this very interesting so I do wish to compile a 64-bit kernel and see what it takes. Well, when you are already running a 64-bit kernel and have a native gcc, you won't have to use the ARCH and CROSS_COMPILE magic. It just works. The whole process was also enlightening to me. I've never cross-compiled a kernel, but now I know how to have my dual-Opteron box compile the kernel for my Linksys router or my friend's hppa box. make ARCH=x86_64 CROSS_COMPILE=x86_64-pc-linux-gnu- (menuconfig, all, modules_install, etc.) At first when typing make ARCH=x86_64 CROSS_COMPILE=x86_64-pc-linux-gnu- it told me it could not find these files: arch/x86_64/kernel/asm-offsets.c:12:21: asm/pda.h: No such file or directory arch/x86_64/kernel/asm-offsets.c:16:22: asm/ia32.h: No such file or directory [...] make[1]: *** [arch/x86_64/kernel/asm-offsets.s] Error 1 make: *** [prepare0] Error 2 # ls -ld include/asm lrwxrwxrwx 1 root root 10 Feb 24 14:27 include/asm - asm-386 I solved this by: # ln -sfn include/asm-x86_64 include/asm I think this could also be solved with a 'make mrproper'. make install didn't work either Weird. This all did solve the problems. The resulting kernel does indeed boot and it does make it possible to chroot into a 64 bit environment. :D Thanks a lot. This has been very educating. Very good! I'm glad we solved your problem. -- Boyd Stephen Smith Jr. [EMAIL PROTECTED] ICQ: 514984 YM/AIM: DaTwinkDaddy -- gentoo-user@gentoo.org mailing list
Re: [gentoo-user] chroot: cannot run command `bin/bash': Exec format error
On Thursday 23 February 2006 00:42, Boyd Stephen Smith Jr. wrote: livecd gentoo # chroot /mnt/gentoo bin/bash chroot: cannot run command `bin/bash': Exec format error Your 32-but kernel can't run the 64-bit bash. You'll have to use a 64-bit kernel (or as 32-bit stage3, and then gradually recompile) Will a 64 bit kernel be able to run a 32 bit bash? In order to get a 64 bit kernel a have to set CFLAGS=-march=k8 and set the processor type to K8 in the kernel configuration, right? -- Bo Andresen -- gentoo-user@gentoo.org mailing list
Re: [gentoo-user] chroot: cannot run command `bin/bash': Exec format error
On Thursday 23 February 2006 15:31, Bo Andresen [EMAIL PROTECTED] wrote about 'Re: [gentoo-user] chroot: cannot run command `bin/bash': Exec format error': On Thursday 23 February 2006 00:42, Boyd Stephen Smith Jr. wrote: livecd gentoo # chroot /mnt/gentoo bin/bash chroot: cannot run command `bin/bash': Exec format error Your 32-but kernel can't run the 64-bit bash. You'll have to use a 64-bit kernel (or as 32-bit stage3, and then gradually recompile) Will a 64 bit kernel be able to run a 32 bit bash? A 64-bit kernel will run 32-bit binaries fine... Um, there may be a needed kernel option though... CONFIG_IA32_EMUL? Anyone? In order to get a 64 bit kernel a have to set CFLAGS=-march=k8 Your CFLAGS in make.conf don't affect your kernel, normally. I don't use genkernel maybe it does some crazy magic like that. and set the processor type to K8 in the kernel configuration, right? Just setting the proper processor type should build your kernel as 64-bit. -- Boyd Stephen Smith Jr. [EMAIL PROTECTED] ICQ: 514984 YM/AIM: DaTwinkDaddy -- gentoo-user@gentoo.org mailing list
Re: [gentoo-user] chroot: cannot run command `bin/bash': Exec format error
On Thursday 23 February 2006 22:40, Boyd Stephen Smith Jr. wrote: On Thursday 23 February 2006 15:31, Bo Andresen [EMAIL PROTECTED] wrote about 'Re: [gentoo-user] chroot: cannot run command `bin/bash': Exec format error': On Thursday 23 February 2006 00:42, Boyd Stephen Smith Jr. wrote: livecd gentoo # chroot /mnt/gentoo bin/bash chroot: cannot run command `bin/bash': Exec format error [SNIP] Will a 64 bit kernel be able to run a 32 bit bash? A 64-bit kernel will run 32-bit binaries fine... Um, there may be a needed kernel option though... CONFIG_IA32_EMUL? Anyone? I cannot seem to find any such kernel config option. In order to get a 64 bit kernel a have to set CFLAGS=-march=k8 Your CFLAGS in make.conf don't affect your kernel, normally. Didn't really think so either. It's just that I still get the Exec format error when I try to chroot. Is there a way to very that I really am running a 64 kernel? I don't use genkernel maybe it does some crazy magic like that. I don't either. and set the processor type to K8 in the kernel configuration, right? Just setting the proper processor type should build your kernel as 64-bit. Did do that. Thanks for your replies.. -- Bo Andresen -- gentoo-user@gentoo.org mailing list
Re: [gentoo-user] chroot: cannot run command `bin/bash': Exec format error
On Thursday 23 February 2006 15:56, Bo Andresen [EMAIL PROTECTED] wrote about 'Re: [gentoo-user] chroot: cannot run command `bin/bash': Exec format error': Will a 64 bit kernel be able to run a 32 bit bash? A 64-bit kernel will run 32-bit binaries fine... Um, there may be a needed kernel option though... CONFIG_IA32_EMUL? Anyone? I cannot seem to find any such kernel config option. I think these are relevant: $ zgrep -i ia32 /proc/config.gz CONFIG_IA32_EMULATION=y CONFIG_IA32_AOUT=y In order to get a 64 bit kernel a have to set CFLAGS=-march=k8 Your CFLAGS in make.conf don't affect your kernel, normally. Didn't really think so either. It's just that I still get the Exec format error when I try to chroot. Is there a way to very that I really am running a 64 kernel? I believe this tells you: $ uname -m x86_64 and set the processor type to K8 in the kernel configuration, right? Just setting the proper processor type should build your kernel as 64-bit. Did do that. The only thing I can't think of at this point is something from the gentoo cross compile howto from vapier that may or may not apply: If you want to cross compile a kernel, do this: make ARCH=hppa CROSS_COMPILE=hppa2.0-unknown-linux-gnu- So, you may want to configure, make, and install your kernel like: make ARCH=x86_64 menuconfig make ARCH=x86_64 make ARCH=x86_64 install (You don't need a CROSS_COMPILE prefix since gcc should work fine.) -- Boyd Stephen Smith Jr. [EMAIL PROTECTED] ICQ: 514984 YM/AIM: DaTwinkDaddy -- gentoo-user@gentoo.org mailing list
Re: [gentoo-user] chroot: cannot run command `bin/bash': Exec format error
On Thursday 23 February 2006 23:33, Boyd Stephen Smith Jr. wrote: On Thursday 23 February 2006 15:56, Bo Andresen [EMAIL PROTECTED] A 64-bit kernel will run 32-bit binaries fine... Um, there may be a needed kernel option though... CONFIG_IA32_EMUL? Anyone? I cannot seem to find any such kernel config option. I think these are relevant: $ zgrep -i ia32 /proc/config.gz CONFIG_IA32_EMULATION=y CONFIG_IA32_AOUT=y I cannot find those options. ~ # zcat /proc/config.gz | grep -i '32\|k8' CONFIG_X86_32=y CONFIG_INIT_ENV_ARG_LIMIT=32 CONFIG_MK8=y # CONFIG_SCSI_QLA2322 is not set # CONFIG_SCSI_NSP32 is not set # CONFIG_PCNET32 is not set # CONFIG_USB_SERIAL_MCT_U232 is not set # CONFIG_NLS_CODEPAGE_932 is not set CONFIG_CRYPTO_CRC32C=m CONFIG_CRC32=y CONFIG_LIBCRC32C=m I notice CONFIG_X86_32=y but cannot figure out where to change that in make menuconfig. Typing /X86_32 just gives this as a search result: Symbol: X86_32 [=y] Is there a way to verify that I really am running a 64 kernel? I believe this tells you: $ uname -m x86_64 ~ # uname -m i686 So, you may want to configure, make, and install your kernel like: make ARCH=x86_64 menuconfig make ARCH=x86_64 make ARCH=x86_64 install (You don't need a CROSS_COMPILE prefix since gcc should work fine.) Should I ignore all these warnings? # make ARCH=x86_64 menuconfig scripts/kconfig/mconf arch/x86_64/Kconfig # # using defaults found in .config # .config:90:warning: trying to assign nonexistent symbol X86_ELAN .config:91:warning: trying to assign nonexistent symbol X86_VOYAGER .config:93:warning: trying to assign nonexistent symbol X86_SUMMIT .config:94:warning: trying to assign nonexistent symbol X86_BIGSMP .config:96:warning: trying to assign nonexistent symbol X86_GENERICARCH .config:97:warning: trying to assign nonexistent symbol X86_ES7000 .config:98:warning: trying to assign nonexistent symbol M386 .config:99:warning: trying to assign nonexistent symbol M486 .config:100:warning: trying to assign nonexistent symbol M586 .config:101:warning: trying to assign nonexistent symbol M586TSC .config:102:warning: trying to assign nonexistent symbol M586MMX .config:103:warning: trying to assign nonexistent symbol M686 .config:104:warning: trying to assign nonexistent symbol MPENTIUMII .config:105:warning: trying to assign nonexistent symbol MPENTIUMIII .config:106:warning: trying to assign nonexistent symbol MPENTIUMM .config:107:warning: trying to assign nonexistent symbol MPENTIUM4 .config:108:warning: trying to assign nonexistent symbol MK6 .config:109:warning: trying to assign nonexistent symbol MK7 .config:111:warning: trying to assign nonexistent symbol MCRUSOE .config:112:warning: trying to assign nonexistent symbol MEFFICEON .config:113:warning: trying to assign nonexistent symbol MWINCHIPC6 .config:114:warning: trying to assign nonexistent symbol MWINCHIP2 .config:115:warning: trying to assign nonexistent symbol MWINCHIP3D .config:116:warning: trying to assign nonexistent symbol MGEODEGX1 .config:117:warning: trying to assign nonexistent symbol MCYRIXIII .config:118:warning: trying to assign nonexistent symbol MVIAC3_2 .config:119:warning: trying to assign nonexistent symbol X86_GENERIC .config:121:warning: trying to assign nonexistent symbol X86_XADD .config:125:warning: trying to assign nonexistent symbol X86_WP_WORKS_OK .config:126:warning: trying to assign nonexistent symbol X86_INVLPG .config:127:warning: trying to assign nonexistent symbol X86_BSWAP .config:128:warning: trying to assign nonexistent symbol X86_POPAD_OK .config:129:warning: trying to assign nonexistent symbol X86_CMPXCHG64 .config:131:warning: trying to assign nonexistent symbol X86_INTEL_USERCOPY .config:132:warning: trying to assign nonexistent symbol X86_USE_PPRO_CHECKSUM .config:140:warning: trying to assign nonexistent symbol X86_UP_APIC .config:141:warning: trying to assign nonexistent symbol X86_UP_IOAPIC .config:145:warning: trying to assign nonexistent symbol X86_MCE_NONFATAL .config:146:warning: trying to assign nonexistent symbol X86_MCE_P4THERMAL .config:147:warning: trying to assign nonexistent symbol TOSHIBA .config:148:warning: trying to assign nonexistent symbol I8K .config:149:warning: trying to assign nonexistent symbol X86_REBOOTFIXUPS .config:160:warning: trying to assign nonexistent symbol NOHIGHMEM .config:161:warning: trying to assign nonexistent symbol HIGHMEM4G .config:174:warning: trying to assign nonexistent symbol REGPARM .config:220:warning: trying to assign nonexistent symbol APM .config:231:warning: trying to assign nonexistent symbol PCI_GOBIOS .config:232:warning: trying to assign nonexistent symbol PCI_GOMMCONFIG .config:233:warning: trying to assign nonexistent symbol PCI_GODIRECT .config:234:warning: trying to assign nonexistent symbol PCI_GOANY .config:1405:warning: trying to assign nonexistent symbol X86_FIND_SMP_CONFIG .config:1406:warning: trying to assign nonexistent symbol X86_MPPARSE .config:1459:warning: trying
Re: [gentoo-user] chroot: cannot run command `bin/bash': Exec format error
On Friday 24 February 2006 01:12, Bo Andresen wrote: On Friday 24 February 2006 00:52, Boyd Stephen Smith Jr. wrote: So, it's starting from your i686 config, and trying to use it to assign as many symbols as possible to the new x86_64 kernel. Some of the symbols just won't exist. When you 'make ARCH=x86_64 menuconfig', can you find the IA32 configuration options? Indeed I can. Thanks. :) Unfortunately, however, it doesn't compile.. :( # make ARCH=x86_64 CHK include/linux/version.h SPLIT include/linux/autoconf.h - include/config/* CC arch/x86_64/kernel/asm-offsets.s cc1: error: code model `kernel' not supported in the 32 bit mode make[1]: *** [arch/x86_64/kernel/asm-offsets.s] Error 1 make: *** [prepare0] Error 2 Going to bed now. Will look at it tomorrow. -- Bo Andresen -- gentoo-user@gentoo.org mailing list
Re: [gentoo-user] chroot: cannot run command `bin/bash': Exec format error
On Thursday 23 February 2006 18:16, Bo Andresen [EMAIL PROTECTED] wrote about 'Re: [gentoo-user] chroot: cannot run command `bin/bash': Exec format error': On Friday 24 February 2006 01:12, Bo Andresen wrote: On Friday 24 February 2006 00:52, Boyd Stephen Smith Jr. wrote: When you 'make ARCH=x86_64 menuconfig', can you find the IA32 configuration options? Indeed I can. Thanks. :) Unfortunately, however, it doesn't compile.. :( # make ARCH=x86_64 CHK include/linux/version.h SPLIT include/linux/autoconf.h - include/config/* CC arch/x86_64/kernel/asm-offsets.s cc1: error: code model `kernel' not supported in the 32 bit mode make[1]: *** [arch/x86_64/kernel/asm-offsets.s] Error 1 make: *** [prepare0] Error 2 Going to bed now. Will look at it tomorrow. Oy, oy, oy. No wonder my friends would rather fsck with the amd64 live cd (that panics on boot unless the BIOS settings are /really/ special) than start off in 32-bit land. Anyway, I think what you probably need to do is append -m64 to your CFLAGS. Try: make ARCH=x86_64 CFLAGS=-m64 I'll go fiddle a bit, too. I'm already running a 64-bit userland, but I have an i686 cross-compiler installed, maybe I can iron out think kinks in the process for ya. -- Boyd Stephen Smith Jr. [EMAIL PROTECTED] ICQ: 514984 YM/AIM: DaTwinkDaddy -- gentoo-user@gentoo.org mailing list
Re: [gentoo-user] chroot: cannot run command `bin/bash': Exec format error
On Thursday 23 February 2006 18:32, Boyd Stephen Smith Jr. [EMAIL PROTECTED] wrote about 'Re: [gentoo-user] chroot: cannot run command `bin/bash': Exec format error': Try: make ARCH=x86_64 CFLAGS=-m64 Nah, don't. It won't help, the kernel's Makefile doesn't pay attention to CFLAGS, it sets up it's own based on your .config. While I didn't get the same error as you, I see definite I'm trying to compile 64-bit assembly into 32-bit binaries-style errors when compiling with: make ARCH=x86_64 CROSS_COMPILE=i686-pc-linux-gnu- make ARCH=x86_64 CROSS_COMPILE=i686-pc-linux-gnu- CFLAGS=-m32 make ARCH=x86_64 CROSS_COMPILE=i686-pc-linux-gnu- CFLAGS=-m64 and make ARCH=x86_64 CROSS_COMPILE=i686-pc-linux-gnu- CC=gcc -m32 However, I /was/ able to convince the kernel to build with make ARCH=x86_64 CROSS_COMPILE=i686-pc-linux-gnu- CC=gcc -m64 although I didn't see if that would boot. So, why don't you give it a go with: make ARCH=x86_64 CC=gcc -m64 menuconfig make ARCH=x86_64 CC=gcc -m64 make ARCH=x86_64 CC=gcc -m64 modules_install make ARCH=x86_64 CC=gcc -m64 install and let me know how it goes. -- Boyd Stephen Smith Jr. [EMAIL PROTECTED] ICQ: 514984 YM/AIM: DaTwinkDaddy -- gentoo-user@gentoo.org mailing list
Re: [gentoo-user] chroot: cannot run command `bin/bash': Exec format error
On Friday 24 February 2006 01:56, Boyd Stephen Smith Jr. wrote: So, why don't you give it a go with: make ARCH=x86_64 CC=gcc -m64 menuconfig make ARCH=x86_64 CC=gcc -m64 make ARCH=x86_64 CC=gcc -m64 modules_install make ARCH=x86_64 CC=gcc -m64 install and let me know how it goes. linux # make ARCH=x86_64 CC=gcc -m64 clean CLEAN .tmp_versions # make ARCH=x86_64 CC=gcc -m64 menuconfig HOSTCC scripts/basic/fixdep HOSTCC scripts/basic/split-include HOSTCC scripts/basic/docproc HOSTCC scripts/kconfig/conf.o HOSTCC scripts/kconfig/kxgettext.o HOSTCC scripts/kconfig/mconf.o HOSTCC scripts/kconfig/zconf.tab.o HOSTLD scripts/kconfig/mconf HOSTCC scripts/lxdialog/checklist.o HOSTCC scripts/lxdialog/inputbox.o HOSTCC scripts/lxdialog/lxdialog.o HOSTCC scripts/lxdialog/menubox.o HOSTCC scripts/lxdialog/msgbox.o HOSTCC scripts/lxdialog/textbox.o HOSTCC scripts/lxdialog/util.o HOSTCC scripts/lxdialog/yesno.o HOSTLD scripts/lxdialog/lxdialog scripts/kconfig/mconf arch/x86_64/Kconfig # # using defaults found in .config # *** End of Linux kernel configuration. *** Execute 'make' to build the kernel or try 'make help'. via linux # make ARCH=x86_64 CC=gcc -m64 CHK include/linux/version.h UPD include/linux/version.h SPLIT include/linux/autoconf.h - include/config/* CC arch/x86_64/kernel/asm-offsets.s cc1: error: code model `kernel' not supported in the 32 bit mode cc1: sorry, unimplemented: 64-bit mode not compiled in make[1]: *** [arch/x86_64/kernel/asm-offsets.s] Error 1 make: *** [prepare0] Error 2 # gcc --version gcc (GCC) 3.3.5-20050130 (Gentoo 3.3.5.20050130-r1, ssp-3.3.5.20050130-1, pie-8.7.7.1) Copyright (C) 2003 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- Bo Andresen -- gentoo-user@gentoo.org mailing list
Re: [gentoo-user] chroot: cannot run command `bin/bash': Exec format error
On 2/22/06 5:03 PM, Bo Andresen [EMAIL PROTECTED] wrote: Hi I have just purchased a new computer with a AMD Semphron 2800+ 64 bit processor. I am installing it following the gentoo handbook of the amd64 architecture - only I am using the x86 minimal livecd (2005-r1) and the stage3-amd64-2005.1-r1.tar.bz2 tarball. Shouldn that be a problem? When I get to step 6a (chrooting) http://www.gentoo.org/doc/en/handbook/handbook-amd64.xml?part=1chap=6#doc_cha p1 I get the following error: livecd gentoo # chroot /mnt/gentoo bin/bash chroot: cannot run command `bin/bash': Exec format error I've seen that when chrooting into 64-bit environment from a 32-bit kernel. You cannot boot from the x86 minimal and use an amd64 stage file. You need the amd64 boot cd. I did use LVM2 for partitioning but other than that I have followed the handbook very throughly. I hope someone has a solution. Please feel free to ask for any information that may be helpful. -- gentoo-user@gentoo.org mailing list
Re: [gentoo-user] chroot: cannot run command `bin/bash': Exec format error
2006/2/23, Bo Andresen [EMAIL PROTECTED]: Hi Hi, I have just purchased a new computer with a AMD Semphron 2800+ 64 bit processor. I am installing it following the gentoo handbook of the amd64 architecture - only I am using the x86 minimal livecd (2005-r1) and the stage3-amd64-2005.1-r1.tar.bz2 tarball. Shouldn that be a problem? When I get to step 6a (chrooting) http://www.gentoo.org/doc/en/handbook/handbook-amd64.xml?part=1chap=6#doc_chap1 I get the following error: livecd gentoo # chroot /mnt/gentoo bin/bash chroot: cannot run command `bin/bash': Exec format error You'll have to boot on a 64bits liveCD if you want to chroot into a 64bits environment. Regards, Boris. -- Bo Andresen -- gentoo-user@gentoo.org mailing list -- Quiconque me parle de Dieu en veut à ma bourse ou à ma liberté. -- gentoo-user@gentoo.org mailing list
Re: [gentoo-user] chroot: cannot run command `bin/bash': Exec format error
On Wednesday 22 February 2006 17:03, Bo Andresen [EMAIL PROTECTED] wrote about '[gentoo-user] chroot: cannot run command `bin/bash': Exec format error': I have just purchased a new computer with a AMD Semphron 2800+ 64 bit processor. I am installing it following the gentoo handbook of the amd64 architecture - only I am using the x86 minimal livecd (2005-r1) and the stage3-amd64-2005.1-r1.tar.bz2 tarball. Shouldn that be a problem? Definitely a problem. livecd gentoo # chroot /mnt/gentoo bin/bash chroot: cannot run command `bin/bash': Exec format error Your 32-but kernel can't run the 64-bit bash. You'll have to use a 64-bit kernel (or as 32-bit stage3, and then gradually recompile) I did use LVM2 for partitioning but other than that I have followed the handbook very throughly. I hope someone has a solution. Please feel free to ask for any information that may be helpful. If you have a little bit of free space, do a 32-bit install to a separate LV. No need to really do a full install, just enough so you can compile a 64-bit kernel and install and configure your bootloader to load the 64-bit kernel. That should be as easy as lvcreate, format, mount, extract 32-bit stage3, cp over /etc/resolv.conf, chroot, emerge your_favorite-sources, cd /usr/src/whatever, zcat /proc/config.gz .config, make oldconfig, make, emerge grub, mount /boot, grub-install, make install, umount boot, shutdown -r now. (Maybe a few steps I'm missing, and I don't mess with (e)lilo.) -- Boyd Stephen Smith Jr. [EMAIL PROTECTED] ICQ: 514984 YM/AIM: DaTwinkDaddy -- gentoo-user@gentoo.org mailing list
Re: [gentoo-user] chroot: cannot run command `bin/bash': Exec format error
On Thursday 23 February 2006 00:42, Boyd Stephen Smith Jr. wrote: Your 32-but kernel can't run the 64-bit bash. You'll have to use a 64-bit kernel (or as 32-bit stage3, and then gradually recompile) Thanks for explaining that. If you have a little bit of free space, do a 32-bit install to a separate LV. No need to really do a full install, just enough so you can compile a 64-bit kernel and install and configure your bootloader to load the 64-bit kernel. That should be as easy as lvcreate, format, mount, extract 32-bit stage3, cp over /etc/resolv.conf, chroot, emerge your_favorite-sources, cd /usr/src/whatever, zcat /proc/config.gz .config, make oldconfig, make, emerge grub, mount /boot, grub-install, make install, umount boot, shutdown -r now. Is that all it takes? I'll definitely try that then. Thanks again. -- Bo Andresen -- gentoo-user@gentoo.org mailing list