Uncategorized

RethinkDB is dead ? Long live RebirthDB

Hi,

RethinkDB company has closed the doors, some time ago.
For me as a RethinkDB early developer and advocate, I really worried for the worse.

However when RethinkDB Joined The Linux Foundation, all of us got a little bit of a relief.  This happened on Feb. 6, 2017.

rethinkdb-open

From that point on, things did not change much. I felt a vacuum and only few developers managed to stay by committing with their own resources.

The last release published by the team was 2.3.6 Fantasia (Jul 23,2017).

 

For quite some time, members of the RethinkDB have been waiting for a new release, for project updates, for the founders to show-up for the community.

A freshly new release(2.4) is frozen for almost a year, all seems ready to launch, but nothing happened.

The community tried for several times to contact the founders, but no-one replied.

Without success, for long time we waited. But at some point, people started questioning the complete stone-walling silence from the former founders, and we asked ourselves the question: “Do they actually care?”, “Do they moved to a underground bunker without internet access?”.
It still a misery for many, because the last time we checked, Stripe is not a Coal mine in Zambia, in fact, we strongly believe that they have internet access over there.

The fact of the matter is: I still believe on the technology, I believe and I have built strong and resilient software using it. Software that I’m not keen to re-write. Software that I’m keen to update and monetize strongly for many years to come. People have built entire companies on top of this Database. We can’t just let it die.

We all know the fact: A year and a half has passed since the startup failed. We all know that we can’t see any database in the market fitting the same niche of RethinkDB.
The communication is just not happening, the official website is not updated, there is a slack channel advertised as “official” BUT new users can’t join.

The community is left scattered between Slack, Discord, IRC, Gitter and Google Groups. Too many choices, but not a single word from the founders.

So we decided enough is enough. Its time for us to get together, grab a bunch of volunteers, fork the database, and create a new organization. Start fresh, with a new plan and release the 2.4 ASAP.

Screenshot_20180525_124019

Thanks to @thelinuxlinch for paying from his own funds, the community have funds to start working and develop the Data Compression features we want so much.

Thanks for @Sam, @Atri and many other great devs that did not let us in the dark. We hope to be able to collect funds to sponsor the core work. We understand its very difficult to find developers with the skills we need and we really appreciate the fact that you have not turned the back on us!

If you are interested, please join us: RebirthDB, to help build the next-gen database.

 

Join us also on the RebirthDB @Github and star the project.

Blockchain, Ethererum, Solidity, Uncategorized

Solidity, The Ethereum programming model latest design flaw leads to vulnerability batchOverflow on uint256

Ethereum has a fairly “hard to understand” programming model.

This has been explained in detail on a previous post  Solidity, The Ethereum programming model. 

I highly recommend you read it before to understand some of the biggest flaws on writing Ethereum Smart contracts and prevent bugs.

 

Today I happen to learn a new issue reported by Coinmonks. They seem to have a automated software that scans all ERC20 tokens and reports alerts when very high transactions are performed.

The issue is really interesting, but is not a new issue. In fact its a 2yo issue that remains open on github Arithmetic overflows return silently:

Well, it turns out that someone exploited some poorly written ERC20 smart contract, and for me, its really interesting how people that do not understand the language can produce bizarre bugs.
In this case a bug that can cause millions of dollars to be stolen from its owner.
The issue is very simple, in fact is a issue that most experient programmers would have spotted right away, if they knew the language and what they where doing.

The image bellow shows the vulnerable function: batchTransfer()

Lets try to understand what is going on….shall we ??
In Ethereum Solidity, if you overflow a number it overflows silently and reset its value to 0.
So the attacker explored the issue by sending a batch transfer with a very big number: EG: (0x8000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000)
By having two _receivers passed into batchTransfer(),  with that extremely large _value, the attacker manages to explore the flaw and turn it into profit.
This is a example of how the function would have been called:
 batchTransfer([0x123f681646d4a755815f9cb19e1acc8565a0c2ac,0x123f681646d4a755815f9cb19e1acc8565a0c2ad], 0x8000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000)
This very large number will cause the uint256 number to overflow, and because number overflows in Ethereum silently reset to zero, there is no error, no exception, no nothing and the program silently continues.
With amount zeroed, the hacker manages to pass the sanity checks in lines 258–259 and make the subtraction in line 261 irrelevant.
Finally, because he send two addresses on the function call, the lines 262–265, the owner of the smart contract, unadvised, will be sending the extremely large _value to the hackers, and the hackers on their turn won’t have to spend a dime, due to the overflow issue!
I did a little research to find out if there are more examples like this one, and guess what…
Ethereum Solidity have some issues that they need to give a little more attention to, in fact this one just happen to become a huge problem and could have been avoided at the first place if the Github issue was properly fixed in a timely fashion manner.
I think the Crypto market need to evolve and become a little more professional and start dealing with the problems like Professionals.
There is a problem, no matter who did it, it need to be fixed. And right now, I think we can all agree that overflow a number silently, is kind of critical.

Just to wrap this up, I don’t want to spoil anyone party here. I just think there is a lot going on on Ethereum right now, developers are working hard and is likely that this get fixed soon (HOPEFULLY).

However, one should consider this points, before diving into programming in Solidity, therefore avoid creating new bugs like this.

 

More on the same subject:
Uncategorized

Yarn package manager, a bless or a curse ?

The other day, a developer on my team decided it was a good idea to leave a pull request half done before going on holiday. So, I went to pick this ticket from the board in order to clear-out things and start shipping the product out of the window … It was somewhat quite hard to understand and solve … so I  decided to write here what happened, maybe someone could benefit from it …

So, there was me, all alone with that issue what was “potentially” a quick fix ….

First things first, lets check that the build is green and CI automation is happy …. I Went to Codeship and oh my dear, someone else outside of my team (probably the maintainer of the module) decided it was a good idea to just delete a existing package from the yarn registry (who cares right?). Consequently, the build is now failing and the error is quite bizarre.

error An unexpected error occurred: "https://registry.yarnpkg.com/acorn/-/acorn-4.0.12.tgz: Request failed \"404 Not Found\"".

Screenshot from Codeship:

 

Without being able to believe myself / understand the error, I wondered “Someone is definitely doing something nasty” … So I retried the build 3 times … all ending up with the same error.

So I went to double check that module Yarn is complaining about, with curl I checked for the package URL (To find out the obvious, it was deleted):

 

Yes, it have been deleted. Somehow yarn can’t figure out a solution for it. The author of the pull request said:

 

With no time to loose, I went deeper into the pull request … for minutes I was fighting with Yarn, NPM … all resulting in the same dead end, that dependency somehow always get written inside the yarn lock file, causing the build to fail.

Ok, so lets delete the yarn file and the new one should be good right ? no more issues like that, right ?

No, this time, after deleting the yarn lock file and generating a new one, I’m having some weird tests that where working before, to fail with even more strange error:

 TypeError: this.context.getStore is not a function

I wonder with myself, what next ? should I fight to fix this error, or should I stick with the old one ?? Fight with Yarn or with the new downloaded yarn dependencies that broke this poor project apart ?

I looked at the clock, the day is about to end, and I have to get this out of the window, and fast. So I decided it was about time to get this done, and fast.

I went on Yarn lock file and analyzed it “line by line”, its was about 8.000 lines …  so I finally  I found the culprit:

acorn@^4.0.3, acorn@^4.0.4:
 version "4.0.12"
 resolved "https://registry.yarnpkg.com/acorn/-/acorn-4.0.12.tgz#335679ab819ec3c78772fe0c2c2f4bfa4359854e"

 

So I went on the web and tried to reach out the github repo for acorn … there is no such version 4.0.12, only 4.0.11 or 4.0.10:

 

So I was like, OMG how the hell this  happened (??), I’m looking at the right acorn ? What to do ? I decided to try my luck with version 4.0.13 ? and TADA, that works like a charm:

acorn@^4.0.3, acorn@^4.0.4:
 version "4.0.13"
 resolved "https://registry.yarnpkg.com/acorn/-/acorn-4.0.13.tgz#105495ae5361d697bd195c825192e1ad7f253787"

 

After so many years doing this, I remember, with NPM it (Or … in the old times Maven) it was nothing different … so I was wondering, is Yarn package manager, a bless or a curse ? Is solving something for real or the issue is just now a little less worse ??

You tell me.

 

 

Happy opensource coding to everyone! 😀

Blockchain, Ethererum, Solidity

Solidity, The Ethereum programming model.

Ethereum has a fairly “hard to understand” programming model.

 

 

I understand that people should know the design flaws in order to avoid them and write proper code.

So I decided to write this little post, in order to clarify some aspects that I think are Crucial on any programming language and help people to avoid them.

 

YES, Solidity can improve, and there are few issues that require attention.

 

 

Issues

There are few issues that need attention, I’ve managed to collect few of them. If you know more please leave a comment. If you think something is wrong please comment as well.

 

Strings

String concatenation must be done by hand after casting to a byte array.

String indexOf

If you want to use indexOf() you must writte your own implementation by hand or copy one into your program (or import from a lib).

 

String Length

To get the length of a string you must cast it to a byte array.

If you “accidentally” pass a empty string to a function (normal day to day programming issue). Warn: This will cause all arguments after that string to be silently corrupted.

 

Numbers

Despite Ethereum being intended to be used by Finance contracts, floating point is not supported and Integer operations can overflow.

(That’s a feature, not a bug. Said a solidity developer).

There is a enhancement open in order to provide simple basic functions for fixed point types:

 

Arithmetic overflows return silently:

FOR LOOP:

A normal JS programmer, would write a for loop like this:

var a[] = (... think there are +256 elements on this array)
for (var i = 0; i < a.length; i ++) {
 a[i] = i;
}

WELL, if you are programming in Solodity, be advised: This loop it will enter an infinite loop.

Because a[] is a array bigger than 255 elements it will wrap around back to zero.

Arrays:

Array syntax kind of looks like C or Java. BUT, you will freak out now: Array declaration syntax is written backwards:

 int8[][5]

This syntax declares a 5 dynamic arrays of bytes.

 

Array of String

Arrays of Strings is not allowed. You cannot create multi-dimensional dynamic arrays.
Because “string” is a byte array, that means “string[]” does not work. 😀

 

Crash with too large arrays 

A simple uint definition, can cause the compiler to crash with error: Integer constant too large

contract c {
	uint[8**90] ids;
}
contract c {
	struct Data { uint x; uint y; }
	Data[8**90] data;
}

Detailed error:

solidity/libsolidity/ast/Types.cpp(977): Throw in function virtual u256 dev::solidity::RationalNumberType::literalValue(const dev::solidity::Literal *) const
Dynamic exception type: boost::exception_detail::clone_impl<dev::solidity::InternalCompilerError>
std::exception::what: Integer constant too large.
[dev::tag_comment*] = Integer constant too large.

 

JSON:

The documentation includes a list of …. scary warnings ….

Warn: `In some situations, the optimizer replaces certain numbers in the code with routines that compute different numbers`

Warn: `Dynamic allocation of an empty memory array caused an infinite loop and thus an exception`

 

Garbage Collection (GC):

Solidity have no garbage collection.
Dead allocations are never reclaimed, despite the scarcity of available memory space.
There is also no manual memory management.

 

 

THIS keyword:

In Solidity there is a “this” keyword …

However there are actually security-critical differences between “this.setX()” and “setX()” that can cause wrong results.

This Dev seems to be concerned about it:

 

Conclusion

There are tons of libs to make your life easier as a Solidity developer this days, you will be better off using them instead of writing smart contracts on your own.

OpenZeppelin is a great repo with lots of great implementations which you can deploy as-is or extend to suit your needs.

Ethereum developers are working hard and is likely that this get fixed soon.

However, one should consider this points, before diving into programming in Solidity, therefore avoiding new bugs.

 

More about it:

Solidity is so riddled with bizarre design errors that it makes PHP4 look like a work of genius.

Exactly, this is a language that they want to run a new economy, not just payment processing, but banking, title transfer, legal resolutions

Underhanded Solidity Coding Contest 

Deconstructing the DAO Attack: A Brief Code Tour

List of “closed” bugs on Ethereum Solidity

List of Open bugs on Ethereum Solidity

Uncategorized

Kubernetes DevOps day-to-day tasks and commands – Kubernetes/HELM Cheatsheet

 

Often I see members of my team struggling to remember the somehow hard to remember commands for operating Kubernetes. Its quite hard to find a descent documentation that goes straight to the point. Not much lalala, but just give me the CMD I’m looking for.

This is a curated list that I’ve been updating periodically with many of the commands I use day to day on operations, so if you know anything that is not here, please let me know! 😀

Kubernetes DevOps day-to-day tasks and commands

devops

 

Kubernetes – How to change the scope to another namespace

$ kubectl config set-context $(kubectl config current-context) --namespace=env-JIRA-1234

Kubernetes – How to List the active pods on a namespace:

$ kubectl get pods
NAME READY STATUS RESTARTS AGE
golang-api-1280745034-4s6jt 1/1 Running 0 17m
golang-api-1280745034-7knzq 1/1 Running 0 17m
``

 

Kubernetes – How to Get the logs for a POD:

$ kubectl logs golang-api-1280745034-4s6jt

 

Kubernetes – How to Get services the Load Balancer IP addresses for a Namespace:

$ kubectl get services --namespace=develop
NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE
(...)

 

Kubernetes – How to Get the ingres and services for a Namespace:

$ kubectl get ing,service --namespace=develop

Kubernetes – How to Get info about the services for a Namespace

$ kubectl describe services --namespace=develop 
NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE
(...)

Kubernetes – How to Get info about the services for ALL Namespaces

$ kubectl get services --all-namespaces
NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE
(...)

 

Kubernetes – How to open a proxy to a POD and expose it locally OR (How to connect to a POD directly and expose it locally)

$ kubectl port-forward golang-api-1280745034-4s6jt 8888:3000

 

Kubernetes – How to configure kubectl to always point to same cluster

$ kubectl config set-context gke_apps_europe-west1-b_europa --namespace=prod

Kubernetes – How to Get the current context (The cluster kubectl is pointing to)

$ kubectl config current-context

Kubernetes – How to setup kubectl Auto Complete

$ source <(kubectl completion bash)

Kubernetes – How to check resource utilization (TOP) for all nodes (Cluster legs)

$kubectl top nodes

Kubernetes – How to check resource utilization (TOP) for all pods in all namespaces

$ kubectl top pods --all-namespaces

Kubernetes – How to WATCH constantly the resource utilization for all pods in a particular namespace and order the results so they don’t keep changing all the time.

$ watch "kubectl top pods --namespace=prod |sort"

Kubernetes – How to WATCH constantly the resource utilization for nodes in a particular namesmace (legs) and order the results so they don’t keep changing all the time.

$ watch "kubectl top nodes --namespace=prod |sort"

Kubernetes – How to WATCH constantly the resource utilization for all pods in ALL namespaces and order the results so they don’t keep changing all the time.

$ watch "kubectl top pods --all-namespaces |sort"

 

Kubernetes – How to kill all running jobs:

`kubectl delete jobs -l `

Kubernetes – How to SSH inside a node to execute commands

 gcloud compute ssh gke-cluster-default-pool-123-4321s --zone europe-west1-c

 

Kubernetes – How to SSH inside the pod and perform a curl on the healthcheck endpoint. This is particular useful for troubleshot and assert that the service is really running and healthy.

$ kubectl exec -ti golang-api-1280745034-4s6jt curl http://localhost:3000/health`

 

Kubernetes – How to Change the configuration file  ‘on the fly’

 kubectl apply -f kubernetes/config/develop.yaml

Kubernetes – How to Restart all PODS in one go:

 $kubectl delete pods -l app=golang-api --namespace=prod

Kubernetes – How to List all Environment variables for a particular POD

$ kubectl exec -ti golang-api-4135068084-3wpb5 env --namespace=prod

Kubernetes – How to Check health for a particular backend POD from inside the frontend pod in order to test that they connect with no issues

$ kubectl exec -ti front-end-355436834-whtnp curl http://golang-api/health --namespace=prod

Kubernetes – How to Check for all logs inside the main scheduler

 $ journalctl -f

Kubernetes – How to List all pods and order them by how many times they have restarted. This is useful to detect memory leaks or debug the pods that are restarting more often.

$ kubectl get pods --sort-by=.status.containerStatuses[0].restartCount

Kubernetes – How to test that your API is returning something on a particular endpoint directly inside the POD (Useful when you deploy something but is not working .. you are pulling your hair out and hating kubernetes … keep call and curl it from inside 😀 )

$ kubectl exec -ti frontend-355436834-whtnp curl http://golang-api/find/1 --namespace=develop

 

Kubernetes – How to proxy a existing InfluxDB pod so you can use it locally:

$ kubectl port-forward --namespace monitoring $(kubectl get pods --namespace monitoring -l app=influxdb-influxdb -o jsonpath='{ .items[0].metadata.name }') 8086:8086

 

GCLOUD: How to list all images for your Docker eu.gcr.io:

gcloud

$ gcloud container images list-tags eu.gcr.io/thomasmodeneis-apps/golang-api

 

HELM DevOps day-to-day tasks and commands

helm

HELM – How to deploy a Docker image from eu.gcr.io to your cluster:

$ export NAMESPACE=develop
$ export VERSION=1.0.0
$ helm upgrade -i golang-api-$NAMESPACE ./helm_chart \ 
--namespace=$NAMESPACE 
--values helm_values/develop.yaml 
--set cluster=clustername,version=$VERSION

 

HELM – How to delete a chart and all its pods

helm delete redis-develop

 

HELM – How to delete a chart and all its pods for a specific namespace:

helm delete redis-develop --namespace=cache-develop

 

HELM – How to delete a chart and all its pods and purge it, in order to also delete PV and PVC’s associated to it: (Caution, this will delete all your data from stored disks).

helm delete redis-develop --purge

 

 

I hope it helps,

 

Happy opensource coding for everyone 😀

docker, gcloud, golang, kubectl, kubernetes-dedicated, linux, ubuntu

Installing Kubectl with GCloud – Common errors

The Google recommended steps for installing the GCloud and Kubectl are somehow confusing, and I see that often, members of my team are confused and can’t find good enough instructions in order to have this installed correctly.

ERROR 1:  Google is not able to enable component manager. If you have found this post on google search, chances are that you are stuck with the error.

ERROR: (gcloud.components.update) The component manager is disabled for this installation

ERROR 2: Google cant find default credentials

error: google: could not find default credentials. See https://developers.google.com/accounts/docs/application-default-credentials for more information.

ERROR 3: Kubectl can’t do anything … error is confusing (what now ?)

➜ kubectl get pods --namespace=develop
 The connection to the server localhost:8080 was refused - did you specify the right host or port?

 

docker_kubernetes

If you have followed the installation instructions for Mac, Ubuntu,  (and others) Linux distributions chances are that you end-up with a incomplete  google cloud SDK installation.

kubectl is missing on the default instalation, together few many other important tooling.

 

We will start by listing and learning some useful cheat-sheet commands:

List all availbale components:
$ gcloud components list

Your current Cloud SDK version is: 154.0.1
The latest available version is: 154.0.1

┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Components │
├───────────────┬──────────────────────────────────────────────────────┬──────────────────────────┬───────────┤
│ Status │ Name │ ID │ Size │
├───────────────┼──────────────────────────────────────────────────────┼──────────────────────────┼───────────┤
│ Not Installed │ App Engine Go Extensions │ app-engine-go │ 47.9 MiB │
│ Not Installed │ Bigtable Command Line Tool │ cbt │ 3.9 MiB │
│ Not Installed │ Cloud Datalab Command Line Tool │ datalab │ < 1 MiB │
│ Not Installed │ Cloud Datastore Emulator │ cloud-datastore-emulator │ 15.4 MiB │
│ Not Installed │ Cloud Datastore Emulator (Legacy) │ gcd-emulator │ 38.1 MiB │
│ Not Installed │ Cloud Pub/Sub Emulator │ pubsub-emulator │ 21.0 MiB │
│ Not Installed │ Emulator Reverse Proxy │ emulator-reverse-proxy │ 14.5 MiB │
│ Not Installed │ Google Container Registry's Docker credential helper │ docker-credential-gcr │ 3.4 MiB │
│ Not Installed │ gcloud Alpha Commands │ alpha │ < 1 MiB │
│ Not Installed │ gcloud Beta Commands │ beta │ < 1 MiB │
│ Not Installed │ gcloud app Java Extensions │ app-engine-java │ 128.6 MiB │
│ Not Installed │ gcloud app Python Extensions │ app-engine-python │ 6.1 MiB │
│ Not Installed │ kubectl │ kubectl │ 14.9 MiB │
│ Installed │ BigQuery Command Line Tool │ bq │ < 1 MiB │
│ Installed │ Cloud SDK Core Libraries │ core │ 6.0 MiB │
│ Installed │ Cloud Storage Command Line Tool │ gsutil │ 2.9 MiB │
│ Installed │ Default set of gcloud commands │ gcloud │ │
└───────────────┴──────────────────────────────────────────────────────┴──────────────────────────┴───────────┘


To install or remove components at your current SDK version [154.0.1], run:
 $ gcloud components install COMPONENT_ID
 $ gcloud components remove COMPONENT_ID

To update your SDK installation to the latest version [154.0.1], run:
 $ gcloud components update

 

How to resolve ERROR 1: (gcloud.components.update) The component manager is disabled for this installation:

If you try to use the recommended way to install anything, it will fail and argue something with very little sense like …

ERROR: (gcloud.components.update) The component manager is disabled for this installation

 

 

Solution: Remove the google recommended way of installing the Google Cloud SDK and install it again, this time doing it the right way:

 

  • UBUNTU install steps:
sudo apt-get update
sudo apt-get remove google-cloud-sdk
curl https://sdk.cloud.google.com | bash
exec -l $SHELL
gcloud init
gcloud components list

Optionally you can run the one liner command :

sudo apt-get remove google-cloud-sdk && curl -sSL https://sdk.cloud.google.com | bash -

 

After installing and initializing the gcloud, you are finally able to install a full-blown Cloud SDK installation:

$ gcloud components install kubectl

Your current Cloud SDK version is: 154.0.1
Installing components from version: 154.0.1

┌──────────────────────────────────────────────┐
│ These components will be installed. │
├─────────────────────────┬─────────┬──────────┤
│ Name │ Version │ Size │
├─────────────────────────┼─────────┼──────────┤
│ kubectl │ │ │
│ kubectl (Linux, x86_64) │ 1.6.2 │ 14.9 MiB │
└─────────────────────────┴─────────┴──────────┘

For the latest full release notes, please visit:
 https://cloud.google.com/sdk/release_notes

Do you want to continue (Y/n)? y

╔════════════════════════════════════════════════════════════╗
╠═ Creating update staging area ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: kubectl ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: kubectl (Linux, x86_64) ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Creating backup and activating new installation ═╣
╚════════════════════════════════════════════════════════════╝

Performing post processing steps...done. 

Update done

 

After this, you should be able to use gcloud with kubectl. However, you will have to solve more errors … keep reading.

 

GCLOUD Kubectl Common errors:

Problems may raise. One of them is not having the gcloud configs properly set. This will get you an error like this:

How to resolve ERROR 2: GCLOUD is not able to get your credentials, kubectl is blocked:

error: google: could not find default credentials. See https://developers.google.com/accounts/docs/application-default-credentials for more information.

This can be fixed by setting the container credentials for the cluster you are wanting to target:

gcloud container clusters get-credentials europa

 

How to resolve ERROR 3: kubectl complains can’t find localhost:8080 (???)  

➜ kubectl get pods --namespace=develop
 The connection to the server localhost:8080 was refused - did you specify the right host or port?

To get this solved, you will have to run the gcloud container clusters get-credentials:

gcloud container clusters get-credentials yourclustername
 Fetching cluster endpoint and auth data.
 kubeconfig entry generated for yourclustername.

 

As you can see, there are many things that can go wrong. But we luck you have most of it covered here. Please let me know if you happen to find any other error that is not covered here.

I hope it helps.

Cheers.

linux, ubuntu

How to fix: ERROR: ld.so: object ‘libgtk3-nocsd.so.0’ from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.

This days, after doing a update on Ubuntu, I stumbled upon this error:

ERROR: ld.so: object 'libgtk3-nocsd.so.0' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored. 

I’ve looked for answers on the web but there is nothing really specific about it…

I found there is a bug opened on Date: Tue, 10 May 2016 11:27:02 UTC: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=823914

But there is no clear resoliton.

It seems that they have raised a bug for the lib, but I’m not sure how this fixed the issue. There is no comments: https://sourceware.org/bugzilla/show_bug.cgi?id=20172

 

The problem seems to be that Ubuntu is looking for a library that does not exist for some reason.

LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libgtk3-nocsd.so.0

 

So if you check for the file, you won’t find anything:

ls -l /usr/lib/x86_64-linux-gnu/ |grep libgtk3

Fortunately, after a big of dig here and there, I’ve found that there is a quick fix. Execute the following command and install the missing library: gtk3-nocsd

$ sudo apt-get install gtk3-nocsd

----- OUTPUT ------
ERROR: ld.so: object 'libgtk3-nocsd.so.0' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
Reading package lists... Done
Building dependency tree 
Reading state information... Done
The following package was automatically installed and is no longer required:
 libgcrypt20:i386
Use 'sudo apt autoremove' to remove it.
The following additional packages will be installed:
 libgtk3-nocsd0
The following NEW packages will be installed:
 gtk3-nocsd libgtk3-nocsd0
0 upgraded, 2 newly installed, 0 to remove and 119 not upgraded.
Need to get 53,0 kB of archives.
After this operation, 125 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://nl.archive.ubuntu.com/ubuntu artful/universe amd64 libgtk3-nocsd0 amd64 3-1 [13,5 kB]
Get:2 http://nl.archive.ubuntu.com/ubuntu artful/universe amd64 gtk3-nocsd all 3-1 [39,5 kB]
Fetched 53,0 kB in 2min 0s (440 B/s)
debconf: unable to initialize frontend: Dialog
debconf: (Dialog frontend requires a screen at least 13 lines tall and 31 columns wide.)
debconf: falling back to frontend: Readline
Selecting previously unselected package libgtk3-nocsd0:amd64.
(Reading database ... 423877 files and directories currently installed.)
Preparing to unpack .../libgtk3-nocsd0_3-1_amd64.deb ...
Unpacking libgtk3-nocsd0:amd64 (3-1) ...
Selecting previously unselected package gtk3-nocsd.
Preparing to unpack .../gtk3-nocsd_3-1_all.deb ...
Unpacking gtk3-nocsd (3-1) ...
Setting up libgtk3-nocsd0:amd64 (3-1) ...
Setting up gtk3-nocsd (3-1) ...
Processing triggers for libc-bin (2.24-12ubuntu1) ...
Processing triggers for man-db (2.7.6.1-2) ...

 

Check that you have the required file:

ls -l /usr/lib/x86_64-linux-gnu/ |grep libgtk3
-rwSr--r-- 1 root root 26616 jun 1 2016 libgtk3-nocsd.so.0

 

Happy opensource coding for everyone! 😀

 

automation, kubernetes-dedicated, linux, packet.net

Kubernetes, Helm and RancherOS

What is Helm?

Helm is the package manager for Kubernetes.

Helm is divided into two parts, the Helm Client (client) and Tiller Server (server)

Why do I need Helm?

To exemplify why do I need helm, I will tell you:

How my life was before Helm:

In order to get any kubernetes apps up and running, I had to:

  • Write Kubernetes manifests by hand
  • Do this everytime I wanted to release anything
  • Figure out how to deal with sharing this with other team members
  • Tweak all the resources by hand
  • Use kubectl to manage it

 

How is my life now with Helm:

  • Installing resources with kubernetes is now easy like apt-get, yum, homebrew … etc
  • My team is now able to colaborate, sharing helm charts on our internal repositories
  • Releases are reproducible across all environments (develop, accept and production)
  • Packages are now sharable

 

 

  • Charts: A bundle of kubernetes resource data, it operates the System Package
  • Repository: A collection of release charts, something like NPM, or Ubuntu Repository.
  • Release: A chart instance that was loaded into Kubernetes. If the same chart is installed several times inside the same cluster, each time the cart will have its own release.

 

Installing Helm on RancherOS

If you are trying to install Helm on RancherOS, chances are that you are now running into the problem that RancherOS does not come with cURL installed.

[rancher@kubernetes1 ~]$ curl https://raw.githubusercontent.com/kubernetes/helm/master/scripts/get > get_helm.sh
-bash: curl: command not found

Due to the fact that Helm uses cURL to download its dependencies, please follow up How to install cURL on RancherOS

 

Download Helm executable script:

[root@kubernetes1 ~]# curl https://raw.githubusercontent.com/kubernetes/helm/master/scripts/get > get_helm.sh
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 5962 100 5962 0 0 47711 0 –:–:– –:–:– –:–:– 55203

 

Add the chmod to the executable file:

[root@kubernetes1 ~]# chmod 700 get_helm.sh

Install Helm:

[root@kubernetes1 ~]# ./get_helm.sh

Happy Helming

 

 

automation, docker, kubernetes-dedicated, linux, rancher server, rancheros

How to install Rancher Server on RancherOS

How to install Rancher Server on RancherOS ?

If you are playing with RancherOS, chances are that you are stuck trying to figure out how to get the Rancher Server (Web UI) up and running after your fresh RancherOS installation.

Why RancherOS?

With RancherOS,  your server runs on a System Docker as the first process the kernel starts.

The System Docker replaces systemd, thus allowing RancherOS to manage all system services as Docker containers.

 

In order to get started on it, I’ve created this little guide for my own reference, I hope it helps:

 

Installing Rancher Server on RancherOS with Docker

 

$ sudo docker run -d --restart=unless-stopped -p 8080:8080 rancher/server
Unable to find image 'rancher/server:latest' locally
latest: Pulling from rancher/server

6599cadaf950: Pull complete 
23eda618d451: Pull complete 
f0be3084efe9: Pull complete 
52de432f084b: Pull complete 
a3ed95caeb02: Pull complete 
e75cd91a1dc5: Pull complete 
997f1b48f59f: Pull complete 
313c28fb4e37: Pull complete 
2a0730d1275c: Pull complete 
8848fbebd2c8: Pull complete 
bf44fc918d8d: Pull complete 
294d2b8ef44a: Pull complete 
8ef53e786a1e: Pull complete 
c66f5c1af2aa: Pull complete 
21a529f5f5c5: Pull complete 
e0b120915e7e: Pull complete 
1ce569657333: Pull complete 
a21d853ef921: Pull complete 
d11646728ac8: Pull complete 
Digest: sha256:59dba13b5cc1f50bbeb9127ed77cc5e72674e80f92dc0a22905a5df9372af464
Status: Downloaded newer image for rancher/server:latest
8064ddc60d59db1f4609f75cf425ab4e02e5dec08604014c1258195b398c3441


Check that the docker instance of rancher is up and running:

[rancher@kubernetes1 ~]$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
8064ddc60d59 rancher/server "/usr/bin/entry /usr/" About a minute ago Up About a minute 3306/tcp, 0.0.0.0:8080->8080/tcp hungry_roentgen



Installing Rancher Agent on RancherOS with Docker
[rancher@kubernetes1 ~]$ sudo docker run --rm --privileged -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/rancher:/var/lib/rancher rancher/agent:v1.2.2 http://147.75.81.119:8080/v1/scripts/59ADA64CAB0BC3410D4F:1483142400000:8Fxhl6E5HlVEIqLQmfrqKWG9V8c
Unable to find image 'rancher/agent:v1.2.2' locally
v1.2.2: Pulling from rancher/agent
b3e1c725a85f: Pull complete 
4daad8bdde31: Pull complete 
63fe8c0068a8: Pull complete 
4a70713c436f: Pull complete 
bd842a2105a8: Pull complete 
3f7d6fd71888: Pull complete 
16914729cfd3: Pull complete 
b9c91512c230: Pull complete 
Digest: sha256:cfb7fc0de1146680ca26e3bc8cd09cc7a0274eff99f5b84246c33642a99f81da
Status: Downloaded newer image for rancher/agent:v1.2.2

INFO: Running Agent Registration Process, CATTLE_URL=http://147.75.81.220:8080/v1
INFO: Attempting to connect to: http://147.75.81.220:8080/v1
INFO: http://147.75.81.220:8080/v1 is accessible
INFO: Inspecting host capabilities
INFO: Boot2Docker: false
INFO: Host writable: true
INFO: Token: xxxxxxxx
INFO: Running registration
INFO: Printing Environment
INFO: ENV: CATTLE_ACCESS_KEY=4DF30CB1CA8A0B6B4251
INFO: ENV: CATTLE_HOME=/var/lib/cattle
INFO: ENV: CATTLE_REGISTRATION_ACCESS_KEY=registrationToken
INFO: ENV: CATTLE_REGISTRATION_SECRET_KEY=xxxxxxx
INFO: ENV: CATTLE_SECRET_KEY=xxxxxxx
INFO: ENV: CATTLE_URL=http://147.75.81.220:8080/v1
INFO: ENV: DETECTED_CATTLE_AGENT_IP=172.17.0.1
INFO: ENV: RANCHER_AGENT_IMAGE=rancher/agent:v1.2.2
INFO: Launched Rancher Agent: ca73dede34008Installing Rancher Agent on RancherOS92f9203b1b45a9c3228d267cd2f723b105805c5dfa25170373e


You can now access your Rancher Server on the provided IP address, on my case (eg: http://147.75.81.220:8080/v1)

automation, kubernetes-dedicated, rancheros

Installing cURL on RancherOS

How to install cURL on RancherOS ?

RancherOS comes without cURL, so it maybe that if you are trying to install something on a RancherOS box, you will find a dead end when trying to use cURL.

So I created this post for my own future reference, I hope it helps someone else

 

 

[root@rancheros ~]# echo 'docker run --rm radial/busyboxplus:curl curl $@' > /usr/bin/curl && chmod +x /usr/bin/curl


[root@rancheros ~]# curl
Unable to find image 'radial/busyboxplus:curl' locallycurl:

Pulling from radial/busyboxplusa3ed95caeb02:

Pull complete 7802a1bc4dbd:

Pull complete e89c986f208e:

Pull complete Digest: sha256:a68c05ab1112fd90ad7b14985a48520e9d26dbbe00cb9c09aa79fdc0ef46b372Status:

Downloaded newer image for radial/busyboxplus:curlcurl: try 'curl --help' for more information