[10:12] <jcz> I would like to install ubuntu core rootfs on SD card. Basically, im following this instructions: https://wiki.ubuntu.com/Core/InstallationExample but i have problems with chrooting and installing the kernel because it is an armhf rootfs. Any ideas how i could bypass this problem?
[10:13] <ogra_> jcz, are you on a Ubuntu machine doing all this ?
[10:13] <jcz> ogra_: yes
[10:13] <ogra_> then you can install qemu-user-static, that will set you up so you can chroot into arm cheroots (after copying one file into the chroot)
[10:15] <ogra_> install it, then copy /usr/bin/qemu-arm-static to the /usr/bin inside the chroot dir ... then try ot chroot, it should work
[10:17] <jcz> ogra_: i will try it out now. BTW - how does this work with simply coping the binary? Does the package modify the chroot command to look for this file while chrooting?
[10:18] <ogra_> no, the package installs a binfmt handler for th kernel ... the kernel notices the binary is for arm and wraps every such binary into a call to qemu-arm-static
[10:18] <jcz> ogra_: i think it worked :D thanks, really
[10:18] <ogra_> (the wrapper has the path hardcoded, so to make sure it still works after chrooting, the binary needs to be in the same place)
[10:19] <jcz> ogra_: at least it managed to launch bash now
[10:19] <ogra_> there is a qemu-debootstrap too ... that you can use to build such chroots from scratch
[10:20] <ogra_> (that might be less cut down than ubuntu-core btw)
[10:21] <jcz> ogra_: oh, ill check it out (dont know what debootstrap is yet)
[10:21] <jcz> ogra_ i am kind of green in this stuff now
[10:22] <ogra_> we all were once ;)
[10:35] <jcz> what is the difference between debootstrap, qemu-debootstrap and just unpacking ubuntu-core?  debootstrap just downloads the image by itself and unpacks?
[10:37] <ogra_> ubuntu-core is a tarball of a chroot that was built using debootstrap ....
[10:38] <jcz> and that qemu version?
[10:38] <ogra_> debootstrap istself can only build for a binary compatible architecture (i.e. x86 on amd64 machines) ...
[10:38] <jcz> oh
[10:39] <ogra_> to build a chroot it needs to chroot itself into the new root and configure the packages ...
[10:39] <jcz> so for arm i need qemu-debootstrap
[10:39] <ogra_> so if you want a foreign arch you can use debootstrap in two steps (using the --foreign switch) ... in the arm case it would be that the first step is run on your PC and the second would have to run on your arm board
[10:40] <ogra_> qemu-debootstrap now uses the above explained binfmt method to do both in one go
[10:40] <ogra_> sand on your PC ... preventing you from having to do the second half on real hardware
[10:41] <ogra_> s/sand/and/
[10:42] <jcz> but still i guess it doesnt install the kernel? I need to do this with chrooting and running dpkg -i ?
[10:42] <ogra_> right, debootstrap only builds root filesystems ...
[10:43] <ogra_> for kernel and bootloader setup you have to take care yourself
[10:43] <ogra_> (or use a prebuilt image if someone already took care of that step)
[11:38] <jcz> i have openwrt on my arm device. When i try to chroot to a ubuntu armhf rootfs on sdcard i get a segfault. Any ideas why would that be? Does it have any connection with using the hard float version?
[11:39] <jcz> i also tried booting ubuntu image on the device directly, and it failed..
[11:39] <jcz> im using linux-image-3.8.0-34-generic armhf kernel
[11:41] <ogra_> if you chroot into the sdcard, was it automounted ?
[11:41] <jcz> i mounted it manually
[11:41] <ogra_> (note that udisks disables all binary execution on all automounted devices)
[11:42] <ogra_> hmm, then it should just work
[11:42] <jcz> is there any way to see which program segfaults?
[11:42]  * ogra_ has no idea if the generic armhf kernel can run on openwrt though ... you would have to ask in #ubuntu-kernel
[11:42] <jcz> just the chroot or i dont know - bash?
[11:42] <ogra_> what is the exact error message ?
[11:43] <jcz> yes, just the segmentation fault
[11:43] <ogra_> and is qemu-arm-static on the sd in /usr/bin/ ?
[11:43] <jcz> in the rootfs?
[11:43] <ogra_> indeed
[11:43] <jcz> yes, it is there
[11:44] <ogra_> if you chroot into the SD from the PC it needs to be there
[11:44] <ogra_> and the SD needs to have the right mount options so that binaries can be executed on it
[11:45] <ogra_> (if qou manually did a mount /dev/mmcblk* or /dev/sdX* on the cmdline, the defaults should usually be file)
[11:45] <jcz> i did: mkdir /mnt/root; mount /dev/mmcblk0p2 /mnt/root
[11:45] <jcz> and then chroot /mnt/root
[11:46] <ogra_> that should work then
[11:46] <ogra_> as long as qemu-arm-static is in /mnt/root/usr/bin/
[11:46] <jcz> do i need to use the qemu on arm board?
[11:47] <jcz> it is already correct architecture
[11:47] <ogra_> no, thats only for chrooting on the PC
[11:48] <ogra_> on the board itself you should just get a proper bootloader and kernel setup and point the root= argument of the kernel commandline to the right device ...
[11:49] <jcz> when booting, i use parameters: console=ttyS0,115200 root=/dev/mmcblk0p2 rw rootfstype=ext4 noinitrd
[11:49] <jcz> and it just restarts the board after a while
[11:49] <jcz> the image is properly loaded into the memory from sd card, the checksums are okay
[11:50] <ogra_> rootfstype should be autodetected by your kernel, it is obsolete ... you might want to add "rootwait" though so the system has enough time to initilize the SD card ...
[11:50] <jcz> that might be the case... ill check it out in a sec
[11:51] <ogra_> are you sure that kernel works properly ? did you test it with some other rootfs before ?
[11:51]  * ogra_ would always start porting to some board with a known working kernel and bootloader 
[11:53] <jcz> i didnt boot that kernel yet. I think it should work because it is the ubuntu already compiled kernel. The bootloader works properly on the board and boots other stuff.
[11:53] <jcz> i downloaded it from ubuntu.packages.com
[11:55] <jcz> argh, adding rootwait didnt help
[11:56] <ogra_> you are aware that the precompiled ubuntu arm kernels only work on a very limited amount of systems ?
[11:57] <jcz> hmm, not really :/ so you are suggesting that i need to compile the kernel myself?
[11:57] <ogra_> (i think it is 4 or 5 boards for the generic kernel in 13.10, ask teh kernel team in #ubuntu-kernels which ones)
[11:57] <ogra_> err
[11:57] <ogra_> #ubuntu-kernel ... no "s" in the end
[12:14] <jcz> i dont see why it doesnt even print anything at all, just restarts
[12:15] <jcz> i suppose it could not work on the board, but at some point during boot or smth
[12:19] <ogra_> well, i would try with a known working kernel first
[12:19] <ogra_> (and bootloader)