Thursday, November 23, 2017

Docker networking issue - IPV4 forwarding is disabled error and Fix



During docker build, faced the following error:

Docker Networking Disabled: WARNING: IPv4 forwarding is disabled. Networking will not work

So, all yum install commands failed.

Fix:

Added the following to /etc/sysctl.conf:

net.ipv4.ip_forward=1


Then restarted the network service.
Now, docker build should be able to reach the network.


Note to self:
Next, time keep an eye on all the warnings faced during docker build itself :) 




Tuesday, November 21, 2017

list files in installed package/rpm file


list the files for already INSTALLED package:

rpm -ql package-name


To list the files for specific RPM package downloaded:

rpm -qlp package.rpm

--

To list the rpm  which installed the specific file(executable / configuration file).

rpm -qf   /path/to/the/file

--

Friday, November 17, 2017

To have unique machine id in multiple VMs - Centos





When you clone a VM, sometimes VM id may not be unique and you end up with same VM id for multiple machines.

So, if that is the case just remove /etc/machine-id and then reboot

Then, run systemd-machine-id-setup.

Now, you will have a unique id in /etc/machine-id.   Now, Live happily ever after :) :) 

# systemd-machine-id-setup
Initializing machine ID from KVM UUID.

# cat /etc/machine-id 
4cd635a844fb4219bb03f8726a64abca


Original error faced while using ansible:

failed: [centosmaster] (item=tmaster) => {
    "assertion": "ansible_hostname == hostvars[item]['ansible_hostname'] or ansible_machine_id != hostvars[item]['ansible_machine_id']", 
    "changed": false, 
    "evaluated_to": false, 
    "failed": true, 
    "item": "tmaster"
}

Monday, November 13, 2017

vagrant - unable to reach host - fix



I was trying to reach a url from inside a vagrant based virtual machine..but unable to reach the same.

It errors out like:

Name or service not known

Tried multiple options - and ended up restarting libvirtd service at host did the trick.

So, sudo systemctl restart libvirtd 


Underlying libvirtd, dnsmasq is running (at host) and I think it is causing some issue.


So, next time, just restart libvirtd and check :)

Monday, November 6, 2017

checkout a github Pull Request locally


So, you have cloned a repo and working on it.

You have a Pull Request(PR) in *upstream* repo which you wish to clone locally.


First set the upstream:

$ git remote add upstream https://github.com/organization/repo


Then, do the below:

$ git fetch upstream pull/195/head:my_testing

remote: Counting objects: 32, done.
remote: Total 32 (delta 8), reused 8 (delta 8), pack-reused 24
Unpacking objects: 100% (32/32), done.
From https://github.com/gluster/gluster-kubernetes
 * [new ref]         refs/pull/195/head -> my_testing

Here,
upstream -> branch from which you actually forked.
195 -> PR number
my_testing -> new branch name


$ git checkout my_testing
Switched to branch 'my_testing'


PS: If you have not forked but cloned the original repo itself, use "origin" instead of "upstream".
Use git config -l  to  see origin, upstream branches.