Sunday, March 29, 2015

Change forgotten password in linux using initramfs

If you have been encountered with a linux box and you can't remember the password or just desperately need to get into the box, here is an easy way of doing so without using any external tools.


  1. Reboot the box
  2. Hold down the shift button upon starting up so you get into the grub menu
  3. Press the "e" key to edit the first option in the menu
  4. Append "break=init" to the end of the line that contains the linux boot parameters
  5. Press F10 to boot using the edited grub script
  6. You should now be prompted with the initramfs user handle
  7. The partition that was mentioned in the grub menu is mounted, but in a readonly state
  8. /bin/mount -o remount,rw /
  9. passwd user
  10. exit
  11. exit
  12. You can now reboot normally and login as the user with the password you just changed

Monday, March 9, 2015

Quickly get openstack up and running

I just wanted to get openstack up and running to test it out.  Devstack is the quickest way to get this going.  Here's how I did it.

Environment:
macbook pro osx 10.10.2
brew
boot2docker

Steps:
  1. Get boot2docker
    1. brew install boo2docker
  2. Configure and run boot2docker (Allocate at least 3GB ram)
    1. boot2docker init -m 4096
    2. boot2docker up
    3. boot2docker ssh
  3. Get an ubuntu trust image
    1. docker pull debian:jessie
  4. Run it with the proper specs
    1. docker run -it -p 8000:80 -p 8443:443 --privileged --publish-all=true --name devstack debian:jessie /bin/bash
  5. Get the prerequisites for devstack
    1. apt-get update && apt-get -y install python net-tools bsdmainutils git build-essential libssl-dev libffi-dev python-dev sudo vim apt-utils
    2. yum update && yum install python git sudo iproute hostname
  6. Edit the policy-rc.d file or else we'll have issues with rabbitmq
    1. perl -pi -w -e 's/101/0/g;' /usr/sbin/policy-rc.d 
  7. Make a folder to put your devstack clone in and close it
    1. mkdir github
    2. cd github
    3. git clone https://git.openstack.org/openstack-dev/devstack
  8. Run devstack
    1. devstack/tools/create-stack-user.sh
    2. chown -R stack:stack /github/*
    3. su stack
    4. /devstack/stack.sh
  9. As a temporary fix until nova can be fixed as of 03/10/2015
    1. It will fail the first time, this is ok. It will complain about sslv3 because pyopenssl does not support sslv3 while nova still does
    2. cd /opt/stack/nova
    3. wget http://anonscm.debian.org/cgit/openstack/nova.git/plain/debian/patches/removed-reference-to-sslv3-removed-from-debian.patch?id=04d5dcd9e70c6caf0df7b10396285549a0e56e99
    4. git apply removed-reference-to-sslv3-removed-from-debian.patch\?id\=04d5dcd9e70c6caf0df7b10396285549a0e56e99 
    5. cd /github/devstack 
    6. ./clean.sh
    7. ./stack.sh

If you happen to encounter an error and need to restart, do the following:
  1. ./unstack.sh
  2. ./clean.sh
Then restart the process again with ./stack.sh

Issues:
  • cgroups is broken in ubuntu trusty.
  • tgt init script is broken in debian wheezy