1 Attachment(s)
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:
- Downloaded and installed Kali Sana 2.0 Light
- apt-get update
- apt-get dist-upgrade
- apt-get install cloud-init (It's version 0.7.6)
- 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
- Enabled ssh on every boot this way: http://www.drchaos.com/enable-ssh-on-kali-linux/
- dpkg-reconfigure cloud-init (I left only ConfigDrive datasource, that's what I need. Othervise it uses fallback datasource.)
- cloud-init init --local
- cloud-init init
- cloud-init modules --mode=config
- 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: Attachment 993
- 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:
- Changed line mounting cdrom in /etc/fstab - I removed noauto attribute and added ro.
- 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.