Kali Linux on UDOO Quad

Discussion in 'Troubleshooting' started by BigMac, Jan 10, 2015.

  1. BigMac

    BigMac New Member

    Joined:
    Jan 10, 2015
    Messages:
    1
    Likes Received:
    0
    Hello, this is my first post, I'm in the process of purchasing a UDOO Quad and I would like to run Kali Linux on it, I opened a ticket with you guys and they said this:

    "You'll be able to run Kali linux with downloading the Cubox-i image and substituting kernel and u-boot. The image doesn't works as it is."

    Can anybody explain and help me understand how to do this? or what they mean?

    Best Regards,

    BigMac
     
  2. robertkjonesjr

    robertkjonesjr New Member

    Joined:
    Jan 3, 2015
    Messages:
    5
    Likes Received:
    0
    With these pieces of information

    1. Cubox-i image
    • substituting kernel and u-boot

    and this tutorial:

    http://www.elinux.org/UDOO_creating_a_bootable_Micro_SD_card_from_precompiled_binaries

    I was able to get Kali going on the Udoo.

    I see two ways to go about this, and I will sketch out the one I used:

    1. Download and install the Cubox-i Kali distro and then replace the kernel with one from a Kali Ubuntu image and install U-boot, as in the tutorial
    2. Install an image for a UDOO Ubuntu standard distribution to an SD card which will put the Udoo kernel and U-boot on the disk for boot. WIth this done, replace the files on the filesystem with the Kali distribution files, everything except the kernel.

    I choose method 2; method 1 might be easier with the tutorial.

    An outline with some detail, if you need additional help on any step, just ask.

    1. Download the standard Udoobuntu distro from the website. Install to a SD card per instructions, and I test to be sure it is working. We need to boot from this disk with U-boot, so I test now to be sure the U-boot and the kernel are good:

    From serial console:

    Code:
    Booting from mmc ...                                                            
    4788388 bytes read in 314 ms (14.5 MiB/s)                                       
    ## Booting kernel from Legacy Image at 12000000 ...                             
       Image Name:   Linux-3.0.35                                                   
       Image Type:   ARM Linux Kernel Image (uncompressed)                          
       Data Size:    4788324 Bytes = 4.6 MiB                                        
       Load Address: 10008000                                                       
       Entry Point:  10008000                                                       
       Verifying Checksum ... OK                                                    
       Loading Kernel Image ... OK                                                  
                                                                                    
    Starting kernel ...                                                             
                                                                                    
    [    0.000000] Initializing cgroup subsys cpu                                   
    [    0.000000] Linux version 3.0.35 (udoo@ubuntu) (gcc version 4.4.4 (4.4.4_09.4
    [    0.000000] CPU: ARMv7 Processor [412fc09a] revision 10 (ARMv7), cr=10c53c7d 
    [    0.000000] CPU: VIPT nonaliasing data cache, VIPT aliasing instruction cache
    [    0.000000] Machine: SECO i.Mx6 UDOO Board                                   
    [    0.000000] Kernel ver: v. 131\nMemory policy: ECC disabled, Data cache writc
    [    0.000000] CPU identified as i.MX6Q, silicon rev 1.2    
    So we know we are good with this distribution.

    2. Insert this SD card on another Linux PC, I use Kali booted from a USB stick on a laptop. Mount the partition on the disk. To see what we have:

    Code:
    root@kali:~# fdisk -l /dev/sdc
    
    Disk /dev/sdc: 15.8 GB, 15819866112 bytes
    255 heads, 63 sectors/track, 1923 cylinders, total 30898176 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x000c356e
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sdc1           16065    13623119     6803527+  83  Linux
    
    and this partition was mounted automatically by Kali:

    Code:
    root@kali:~# mount
    ...
    <output removed for brevity>
    ...
    /dev/sdc1 on /media/UDOObuntu type ext3 (rw,nosuid,nodev,relatime,data=ordered,uhelper=udisks)
    3. Download the Kali cubox-i image we want to use. We need the files from this disk image.

    What is this ?

    Code:
    root@kali:~# file kali-1.0.9-cubox-i.img.xz 
    kali-1.0.9-cubox-i.img.xz: XZ compressed data
    OK, uncompress. Be sure your host disk is big enough. Mine is 32GB, so no trouble:

    Code:
    root@kali:~# unxz kali-1.0.9-cubox-i.img.xz 
    What do we have now?

    Code:
    root@kali:~# file kali-1.0.9-cubox-i.img 
    kali-1.0.9-cubox-i.img: x86 boot sector; partition 1: ID=0x83, starthead 3, startsector 3999744, 10680320 sectors, code offset 0xb8
    We have an entire disk image, not just a partition. We need to mount this to get at the files included, but it's not just a single parition. Linux provides us with this capability, with a little work.

    Gather some information from the disk image:

    Code:
    root@kali:~# fdisk -l kali-1.0.9-cubox-i.img 
    
    Disk kali-1.0.9-cubox-i.img: 7516 MB, 7516192768 bytes
    4 heads, 32 sectors/track, 114688 cylinders, total 14680064 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x0006b4bf
    
                     Device Boot      Start         End      Blocks   Id  System
    kali-1.0.9-cubox-i.img1         3999744      14680063     5340160   83  Linux
    We need the block size and offset from the beginning of the image to know where to mount (Start):
    Block size: 512bytes
    Start: 3999744
    Offset: 512*3999744 = 2047868928

    Now to mount:

    Code:
    root@kali:# mkdir /media/cubox
    root@kali:# mount -o loop,offset=2047868928 kali-1.0.9-cubox-i.img /media/cubox
    What do we have, and how much is there?

    Code:
    root@kali:~# mount
    ...
    <output removed for brevity>
    ...
    /dev/sdc1 on /media/UDOObuntu type ext3 (rw,nosuid,nodev,relatime,data=ordered,uhelper=udisks)
    /root/kali-1.0.9-cubox-i.img on /media/cubox type ext4 (rw,relatime,data=ordered)
    
    root@kali:/media/cubox# du -hs
    1.4G	.
    
    The system found an ext4 filesystem and mounted it, and there is 1.4GB of data. Good.

    4. Time to move and copy files. On the original UDOObuntu disk, I removed (well actually just moved them all to a different location) the following directories:

    bin etc home lib opt root run sbin selinux srv tmp usr var

    So we are left with the following on the original UDOObuntu disk:

    Code:
    root@kali:/media/UDOObuntu# ls -al
    total 44
    drwxrwxr-x 11 1000 inetsim 4096 Jan 11 06:44 .
    drwxr-xr-x  6 root root    4096 Jan 11 06:36 ..
    drwxr-xr-x  2 root root    4096 Dec 12  2013 boot
    drwxr-xr-x  4 root root    4096 Dec 12  2013 dev
    drwxrwxr-x  2 1000 inetsim 4096 May 27  2014 gpio
    drwx------  2 root root    4096 Jul  3  2014 lost+found
    drwxr-xr-x  2 root root    4096 Jan  1  1970 media
    drwxr-xr-x  2 root root    4096 Apr 19  2012 mnt
    drwxr-xr-x  2 root root    4096 Apr 19  2012 proc
    drwxr-xr-x  2 root root    4096 Apr 14  2012 sys
    Now copy all the directories from the cubox-i Kali image file, except these above, to the UDOObuntu disk. I used Kali's graphical file manager so no cli to show, but a suitable cp -a or such command would do just as well.

    What we have done is replace all the OS files except the kernel on the original disk, which has U-boot installed in the boot partition, with the Kali OS files.

    5. We now have a bootable Kali disk for UDOO. I did boot with this and it worked but I had a small issue - I tend to run headless, so no keyboard/video/mouse. From the serial console I get boot output, and the UDOO picks up a DHCP address with the name kali. However, there is no console to login with after boot, and though I can ping, there is no ssh support (typical with Kali - ssh is disabled by default on other platforms). My options:

    1. Add KVM to system and try to get in this way
    2. Try to configure serial port on image and then boot again
    3. Try to enable ssh at boot on image

    I choose to do 2 & 3.

    Mount the SD card on another Linux system and migrate to the /etc directory. Make sure it's the /etc/directory on the SD card, not the base OS /etc directory.

    So for (2) add

    Code:
    T0:23:respawn:/sbin/getty -L ttymxc1 115200 vt100
    to /etc/inittab on the disk,

    For (3) add

    Code:
    /etc/init.d/ssh start
    to /etc/rc.local.

    You could adjust the K/S files in rcX.d to get the service to start based on the runlevel (default runlevel in inittab) but I just added the manual start command to get in. Can customize once inside.

    Now boot again, from serial console (login is default root/toor):

    Code:
    ...
    <boot messages removed>
    ...
    Kali GNU/Linux 1.0.9 kali ttymxc1                                               
                                                                                    
    kali login:                                                                     
    Kali GNU/Linux 1.0.9 kali ttymxc1                                               
                                                                                    
    kali login: root                                                                
    Password:                                                                       
    Linux kali 3.0.35 #7 SMP PREEMPT Thu Jul 3 15:12:59 CEST 2014 armv7l            
                                                                                    
    The programs included with the Kali GNU/Linux system are free software;         
    the exact distribution terms for each program are described in the              
    individual files in /usr/share/doc/*/copyright.                                 
                                                                                    
    Kali GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent                 
    permitted by applicable law.                                                    
    root@kali:~# uname -a                                                           
    Linux kali 3.0.35 #7 SMP PREEMPT Thu Jul 3 15:12:59 CEST 2014 armv7l GNU/Linux  
    root@kali:~# 
    And then test ssh:

    Code:
    root@kali:~# ssh root@192.168.3.199
    The authenticity of host '192.168.3.199 (192.168.3.199)' can't be established.
    ECDSA key fingerprint is 5d:7d:1f:12:b5:3e:11:11:11:11:11:11:11:22:f8:6d.
    Are you sure you want to continue connecting (yes/no)? yes
    Warning: Permanently added '192.168.3.199' (ECDSA) to the list of known hosts.
    root@192.168.3.199's password: 
    Linux kali 3.0.35 #7 SMP PREEMPT Thu Jul 3 15:12:59 CEST 2014 armv7l
    
    The programs included with the Kali GNU/Linux system are free software;
    the exact distribution terms for each program are described in the
    individual files in /usr/share/doc/*/copyright.
    
    Kali GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
    permitted by applicable law.
    Last login: Thu Jan  1 00:00:25 1970
    root@kali:~# 
    I tested aircrack-ng and it worked fine - and then enjoy!
     
  3. SO_yeah

    SO_yeah New Member

    Joined:
    Jan 18, 2015
    Messages:
    16
    Likes Received:
    2
    as an alternative you can use the debian wheezy image for udoo and add kali repositories as explained in this guide.
    I have installed aircrack-ng with apt-get and tested airodump-ng, works great!
     

Share This Page