Open Grieves

Open Grieves

Assimilate quickly!

You must comply!

RHEL7: Docker: Error starting daemon: error initializing graphdriver

Out of troublePosted by Magnus Glantz 2016-01-13 10:50:15
Installing docker and then upgrading from Red Hat Enterprise Linux 7.1 to Red Hat Enteprise Linux 7.2 (which took me from 1.6.0-11.el7.x86_64 to docker-1.8.2-8.el7.x86_64) I hit this problem.

[root@thehostname ~]# systemctl start docker
Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.

[root@thehostname ~]# systemctl status docker
‚óŹ docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Wed 2016-01-13 09:39:03 UTC; 5s ago
Docs: http://docs.docker.com
Process: 7711 ExecStart=/usr/bin/docker daemon $OPTIONS $DOCKER_STORAGE_OPTIONS $DOCKER_NETWORK_OPTIONS $ADD_REGISTRY $BLOCK_REGISTRY $INSECURE_REGISTRY (code=exited, status=1/FAILURE)
Main PID: 7711 (code=exited, status=1/FAILURE)

Jan 13 09:39:03 thehostname.domainname systemd[1]: Starting Docker Application Container Engine...
Jan 13 09:39:03 thehostname.domainname docker[7711]: time="2016-01-13T09:39:03.894323859Z" level=info msg="Listening for HTTP on unix (/var/run/docker.sock)"
Jan 13 09:39:03 thehostname.domainname docker[7711]: time="2016-01-13T09:39:03.916209315Z" level=fatal msg="Error starting daemon: error initializing graphdriver: Unable to take ownership of thin-pool (rootvg-docke...ed data blocks"
Jan 13 09:39:03 thehostname.domainname systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE
Jan 13 09:39:03 thehostname.domainname systemd[1]: Failed to start Docker Application Container Engine.
Jan 13 09:39:03 thehostname.domainname systemd[1]: Unit docker.service entered failed state.
Jan 13 09:39:03 thehostname.domainname systemd[1]: docker.service failed.

Solution:

# systemctl stop docker
# rm -rf /var/lib/docker
# lvremove /dev/volumegroupxyz/docker-pool
# docker-storage-setup
# systemctl start docker

Done.

More info:
https://github.com/docker/docker/issues/15651




  • Comments(0)//blog.hacka.net/#post110

New job

You must readPosted by Magnus Glantz 2016-01-11 08:49:12
Starting mid-February I start my new job as Solution Architect at Red Hat in the Nordics with focus on Denmark. So... wish me luck :)



  • Comments(0)//blog.hacka.net/#post109

Upgrade from Satellite 6.0 to 6.1: IMPORTANT

Out of troublePosted by Magnus Glantz 2015-12-11 14:26:39
If you are running Capsules. Do not forget to update katello-agent, goferd, katello-ca-consumer (from the capsule) on all clients and then to re-register all clients using subscription-manager. If you do not do that, clients will keep communicating to 5671 on the Satellite and if you have a lot of hosts, this will within time cause qpid to fail on the Satellite, which is very serious as pretty much everything then will fail.



  • Comments(0)//blog.hacka.net/#post108

Complete workflow: Properly signed certificates and Satellite/Capsule 6.1

Out of troublePosted by Magnus Glantz 2015-12-10 19:23:12
So I never ever forget.

1. Install tools on the Capsule
# yum install crypto-utils mod_ssl

2. Generate certificate request
# genkey $(hostname)

3. Submit certificate request and get an certificate.
# Not sure how you do that..

4. Download signed certificate. Convert to PEM format if it's not already that. If in DER format, convert like so:
# openssl x509 -inform der -in mysignedcertficates.cer -out /etc/pki/tls/certs/capsule-fqdn.crt

5. Perhaps, download certificate chain from CA (if you have your own CA).
# Not sure how you do that..

6. Upload files to Satellite from Capsule:
# Certificate Request:
/etc/pki/tls/certs/capsule-fqdn.0.csr
# Key
/etc/pki/tls/private/capsule-fqdn.key

7. Upload other files to Satellite:
# Certificate chain from CA
/someplace/my-certificate-chain.pem
# Signed certificate for Capsule:
/someplace/capsule-fqdn.crt

8. Move all files to /root/capsule-fqdn on Satellite
...

9. Generate certificate tar for Capsule on Satellite:
capsule-certs-generate --capsule-fqdn CAPSULE-FQDN --server-ca-cert /root/capsule-fqdn/my-certificate-chain.pem --server-cert /root/capsule-fqdn/capsule-fqdn.crt --server-cert-req /root/capsule-fqdn/capsule-fqdn.0.csr --server-key /root/capsule-fqdn/capsule-fqdn.key --certs-tar /root/capsule-fqdn.tar --certs-update-server

10. Install Capsule as described from the output from the capsule-certs-generate command.

11. Done.








  • Comments(0)//blog.hacka.net/#post107

Red Hat Satellite 6.1 My repositories disappeared from my Products and Content Views

Out of troublePosted by Magnus Glantz 2015-12-03 15:31:48
If your repositories disappear from your Products and Content Views, you may be able to solve that by issuing a Sync of those repositories.

Worked for me :-)

  • Comments(0)//blog.hacka.net/#post106

Simple automatic decommisioning

You must readPosted by Magnus Glantz 2015-11-04 12:56:57
Problem: 100000000 servers that are not used in your development or test environmnets.
Solution: Put below script in /etc/cron.daily/. 30 days after installation date, the server will shutdown automatically. You can make this as fancy as you want, but the solution is still fairly simple.

#!/bin/bash
# Date format is 15-01-31

DATEA=$(cat /etc/server-installation-date-gets-put-in-this-file)
DATEB=$(date +%y-%m-%d)

# Calculates number of days between today and installation date
if [ "$(( ($(date --date="$DATEB" +%s) - $(date --date="$DATEA" +%s) )/(60*60*24) ))" -ge 30 ]; then
logger -t auto_decommision "Server has passed it's end date. Halting server."
shutdown -h now
fi


  • Comments(0)//blog.hacka.net/#post105

Cloning VMs on VMware clusters using Red Hat Satellite 6.1

You must readPosted by Magnus Glantz 2015-09-23 10:50:28
Keep in mind that you need to put a template (in Sat 6.1, called image) on each cluster.

That was all.

  • Comments(0)//blog.hacka.net/#post104

Red Hat Satellite 6.1, VMware and resource pools

Out of troublePosted by Magnus Glantz 2015-09-22 22:59:41
FYI. In the current release of Red Hat Satellite 6.1 there is no way to set resource pools in VMware. A new VM will default to the root resource pool, meaning you have to either drag and drop VMs into correct resource pool in Vsphere, create a script that does this or create a hook script to set the resource pool for a VM.

Patches providing this functionality are available upstream in Foreman and I am using hotfixes that provides this functionality in Satellite 6.1, so I'm guessing a solution is not that far away.

  • Comments(0)//blog.hacka.net/#post103

Red Hat Satellite 6.1 and Docker firewall prerequisite

Out of troublePosted by Magnus Glantz 2015-09-18 17:29:21
To be able to sync with Red Hats Docker registry you will need to open up in our firewall to the two following URLs:

* registry.access.redhat.com
* access.redhat.com


That is all.

  • Comments(0)//blog.hacka.net/#post102

Red Hat Satelite 6.1 API integration, howto deploy and decomission servers

You must readPosted by Magnus Glantz 2015-09-16 20:46:39
Hi,

So, I spend some time integrating with Red Hat Satellite 6.1, deploying and decomissioning servers using it's API. I've compiled all the goodies for you :-)

# Please note
*
I deploy cloned VMware guests, if your compute resource or provisioning method differ, adjust accordingly.
* This requires you to have created a Linux standard in Red Hat Satellite 6.1.
* Just so it's completely clear, you need to have defined a hostgroup that points out all the stuff required to deploy a server.

# General API information

API type: REST
Header: "Accept: application/json"
Header: "Content-Type: application/json"

# Howto deploy a new server via Red Hat Satellite 6.1 API.

Step 1: Firstboot script that you put in your VM template:
#!/bin/bash
curl -s -o /root/finishscript.sh --user user:pass -H "Content-Type:application/json" -H "Accept:application/json" -k "https://satellite-fqdn/unattended/finish?hostname=$result"
# Also, don't forget to do some santity checking, retry of fetch, etc.
if [ -f /root/finishscript.sh ]; then
sh /root/finishscript.sh
fi

Note:
To make a very long story, very short..
This is because getting the finish script to run in Red Hat Satellite 6.1 via API seems very difficult and impractical (you have to define undocumented compute_attributes during host creation). If you find a way to do this without compute_attributes, let me know.

Step 2: Create a new server.

POST: https://satellite-fqdn/api/v2/hosts

Content:

{host: { name: host-fqdn,
location_id: 2,
organization_id: 1,
managed: true,
compute_resource_id: 1,
hostgroup_id: 1,
compute_profile_id: 1,
enabled: true,
build: true
}}

Example integration code:
curl -k -u user:pass -X POST -d "{\"host\": { \"name\": \"host-fqdn\", \"location_id\": \"2\", \"organization_id\": \"1\", \"managed\": \"true\", \"compute_resource_id\": \"1\", \"hostgroup_id\": \"1\", \"compute_profile_id\": \"1\", \"enabled\": \"true\", \"build\": \"true\" }}" -H "Accept: application/json" -H "Content-Type: application/json" https://satellite-fqdn/api/v2/hosts

Note: For other purposes than a POC:

* Dynamic values, depending on environment:

compute_resource_id: Defines what VMware Vsphere server or other compute resource to contact
hostgroup_id: Defines what Linux standard to install and in what Life Cycle Environment

* Dynamic values depending on version of Linux standard:
hostgroup_id: Defines what Linux standard to install and in what Life Cycle Environment

* Dynamic values depending on application:
compute_profile_id: Defines resources in VMware such as disk, VLAN, disk, CPU, and Memory. Settings get's predefined in Satellite 6.1 for each application.

* Step 3: Power on server:

PUT https://satellite-fqdn/api/v2/hosts/host-fqdn/power

Content:
{power_action: on }

Expected on success:

{"power":{"task_state":"success"}}

Example integration code:
curl -k -u user:pass -X PUT -d "{\"power_action\": \"on\" }" -H "Accept: application/json" -H "Content-Type: application/json" https://satellite-fqdn/api/v2/hosts/host-fqdn/power

# Howto get server status via Red Hat Satellite 6.1 API:

Step 1: Get host ID:

GET https://satellite-fqdn/api/v2/hosts?search="host-fqdn"

Step 2: Get host status:

GET https://satellite-fqdn/api/v2/hosts/HOSTID/status

Expected during installation of server:

{"status":"Pending Installation"}

Expected when installation complete (OS configured):
{"status":"Active"}
or:
{"status":"No changes"}

Example integration code (Get host ID and get status):
HOSTID=$(curl -s -k -u user:pass -X GET https://satellite-fqdn/api/v2/hosts?search="host-fqdn"|cut -d: -f4|grep ip|cut -d, -f1)
curl -k -u user:pass -X GET -H "Accept: application/json" -H "Content-Type: application/json" https://satellite-fqdn/api/v2/hosts/${HOSTID}/status

# Howto delete server via Red Hat Satellite 6.1 API:

DELETE https://satellite-fqdn/api/v2/hosts/host-fqdn

Example integration code:
curl -k -u user:pass -X DELETE -H "Accept: application/json" -H "Content-Type: application/json" https://satellite-fqdn/api/v2/hosts/host-fqdn




  • Comments(0)//blog.hacka.net/#post101
« PreviousNext »