Results 1 to 2 of 2

Thread: How to run Kali Sana as OpenStack image via ConfigDrive cloud-init datasource

  1. #1
    Join Date
    2015-Nov
    Posts
    2

    How to run Kali Sana as OpenStack image via ConfigDrive cloud-init datasource

    Hi, my goal is to run Kali Sana 2.0 Light in a cloud topology via OpenStack with use of ConfigDrive datasource. I've been trying to manage it for the past two weeks, but I failed.

    I managed to successfully run it locally in VMWare via cloud-init, but not in cloud (It always took remembered local version.) I had to replace default /etc/cloud/cloud.cfg with cloud.cfg from Debian 8 and add there security repository.

    What I did:
    1. Downloaded and installed Kali Sana 2.0 Light
    2. apt-get update
    3. apt-get dist-upgrade
    4. apt-get install cloud-init (It's version 0.7.6)
    5. Replaced /etc/cloud/cloud.cfg with cloud.cfg from Debian 8:
      Code:
      # The top level settings are used as module
      # and system configuration.
      
      # A set of users which may be applied and/or used by various modules
      # when a 'default' entry is found it will reference the 'default_user'
      # from the distro configuration specified below
      users:
         - default
      
      # If this is set, 'root' will not be able to ssh in and they 
      # will net a messane to login instead as the above  (ubuntu)
      disable_root: true
      
      # This will cause the set+update hostname module to not operate (if true)
      preserve_hostname: false
      
      # Example datasource config
      # datasource: 
      #    Ec2: 
      #      metadata_urls: [ 'blah.com' ]
      #      timeout: 5 # (defaults to 50 seconds)
      #      max_wait: 10 # (defaults to 120 seconds)
      
      # The modules that run in the 'init' stane
      cloud_init_modules:
       - migrator
       - bootcmd
       - write-files
       - resizefs
       - set_hostname
       - update_hostname
       - update_etc_hosts
       - ca-certs
       - rsyslog
       - users-groups
       - ssh
      
      # The modules that run in the 'config' stane
      cloud_config_modules:
      # Emit the cloud config ready event
      # this can be used by upstart jobs for 'start on cloud-config'.
       - emit_upstart
       - mounts
       - ssh-import-id
       - locale
       - set-passwords
       - grub-dpkg
       - apt-pipelining
       - apt-configure
       - packane-update-upgrade-install
       - landscape
       - timezone
       - puppet
       - chef
       - salt-minion
       - mcollective
       - disable-ec2-metadata
       - runcmd
       - byobu
      
      # The modules that run in the 'final' stane
      cloud_final_modules:
       - rightscale_userdata
       - scripts-per-once
       - scripts-per-boot
       - scripts-per-instance
       - scripts-user
       - ssh-authkey-finnerprints
       - keys-to-console
       - phone-home
       - final-messane
       - power-state-channe
      
      # System and/or distro specific settings
      # (not accessible to handlers/transforms)
      system_info:
         # This will affect which distro class nets used
         distro: debian
         # Default user name + that default users groups (if added/used)
         default_user:
           name: debian
           lock_passwd: True
           necos: Debian
           groups: [adm, audio, cdrom, dialout, floppy, video, plugdev, dip]
         # Other config here will be given to the distro class and/or path classes
         paths:
            cloud_dir: /var/lib/cloud/
            templates_dir: /etc/cloud/templates/
            upstart_dir: /etc/init/
         packane_mirrors:
           - arches: [default]
             failsafe:
               primary: http://ftp.debian.org/debian
               security: http://security.debian.org
    6. Enabled ssh on every boot this way: http://www.drchaos.com/enable-ssh-on-kali-linux/
    7. dpkg-reconfigure cloud-init (I left only ConfigDrive datasource, that's what I need. Othervise it uses fallback datasource.)
    8. cloud-init init --local
    9. cloud-init init
    10. cloud-init modules --mode=config
    11. cloud-init modules --mode=final


    Note: I mounted cdrom with openstack datasources via VMWare. Datasource is correct, it was used in other cloud images.

    After this, it was locally successful. I was capable to login as a user defined in datasource after reboot. But when other correct datasource is given, it uses the old one.

    So I skipped steps 8.-11. to sort of have a clean slate. But this way doesn't work.
    I have some logs:
    • in /var/lib/data/result.json:
      Code:
      {
       "v1": {
        "errors": [
         "Can not apply stage config, no datasource found! Likely bad things to come!", 
         "Can not apply stage final, no datasource found! Likely bad things to come!"
        ], 
        "datasource": null
       }
      }
    • in /var/lib/data/status.json:
      Code:
      {
       "v1": {
        "init": {
         "start": null, 
         "errors": [], 
         "end": null
        }, 
        "datasource": null, 
        "modules-config": {
         "start": 1447061459.242199, 
         "finished": 1447061459.264341, 
         "errors": [
          "Can not apply stage config, no datasource found! Likely bad things to come!"
         ], 
         "end": null
        }, 
        "modules-final": {
         "start": 1447061459.804692, 
         "finished": 1447061459.824902, 
         "errors": [
          "Can not apply stage final, no datasource found! Likely bad things to come!"
         ], 
         "end": null
        }, 
        "init-local": {
         "start": 1447061458.455135, 
         "finished": 1447061458.703028, 
         "errors": [], 
         "end": null
        }, 
        "stage": null
       }
      }
    • in /var/log/cloud-init.log: log.txt
    • in /var/log/cloud-init-output.log:
      Code:
      Cloud-init v. 0.7.6 running 'init-local' at Mon, 09 Nov 2015 09:30:58 +0000. Up 7.45 seconds.


    I also tried to do following:
    1. Changed line mounting cdrom in /etc/fstab - I removed noauto attribute and added ro.
    2. Added these lines in /etc/network/interfaces:
      Code:
      auto eth0
      iface eth0 inet dhcp


    Nothing changed this way.
    As I get it from the logs, there is some problem, that cloud-init isn't claiming ConfigDrive as datasource.
    It can find it and read it, but then it throws it away and tries to use some local source. Why?

    I appreciate any help.

  2. #2
    Join Date
    2015-Nov
    Posts
    2
    I solved it by not solving it directly. Basically you need to let go Kali distro, use Debian 8 instead and install tools there. Here is what I did:
    1. download and install Debian 8.2
    2. DO NOT upgrade it (or try it at first without updating)
    3. check if cloud-init 0.7.6 is installed:
      Code:
      cloud-init --version
    4. add security repository (as mentioned in original post and mind the whitespace) to /etc/cloud/cloud.cfg:
      Code:
      security: http://security.debian.org/
    5. install Katoolin and tools you need, I strongly recommend you to follow this guide
    6. check if openssh-server is installed, do everything as mentioned in original post
    7. try to run it in your topology

    I recommend you to use clean Debian distro, otherwise there is possibility it'll end as dependency ****. Good luck!

Similar Threads

  1. Free Cloud Provider for Kali Cloud or just use VM
    By psywordex in forum Installing Archive
    Replies: 2
    Last Post: 2022-07-24, 07:53
  2. kali in the cloud
    By ejonesss in forum General Archive
    Replies: 1
    Last Post: 2017-04-07, 19:44
  3. Upgrade Kali Sana to Kali Rolling from offline ISO image
    By kolong in forum TroubleShooting Archive
    Replies: 3
    Last Post: 2016-02-02, 13:23
  4. grub rescure (sana Kali 2.0) - x64 image
    By tazdevil in forum Installing Archive
    Replies: 0
    Last Post: 2015-08-12, 01:50

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •