Understanding the ‘lib not found’ Error When Running HydraDX on Docker

Background

I’ve been working with HydraDX recently and attempting to run it in Docker. Unfortunately, the last runnable version of HydraDX is significantly outdated, and it no longer connects to active peers. Furthermore, when attempting to use a more recent HydraDX Docker image, an error arises indicating “version `GLIBC_2.34′ not found.” As of the most recent version available on September 4th, 2023, identified as pr-664, this issue still persists without resolution. Following a period of challenges and without delving into the underlying causes of the issue, I decided to immerse myself in the Rust program and scrutinize the code. Through this process, I identified some outdated configurations and instances of Docker misuse.

It seems that encountering similar issue when compiling the rust program and running it in Docker environment is quite common, especially within the blockchain industry.

However, please note that the focus of this post is only on building a Docker image for a Rust program (or at least a program linked with glibc). Understanding HydraDX or blockchain concepts is not necessary to grasp the content of this discussion. But with a minimal knowledge of Docker is required.

Continue reading “Understanding the ‘lib not found’ Error When Running HydraDX on Docker”

Enhancing Team Cooperation: The Power of Three Concentric Circles and Essential Principles

By visualising team cooperation through these 3 concentric circles (owned, learnt, known), team members can develop a strong sense of personal responsibility, foster collaboration and learning within the team, and gain a broader understanding of the larger context in which they operate. This approach promotes a holistic and effective teamwork dynamic.

  1. Owned Circle: Take full responsibility for individual work.
  2. Learnt Circle: Understand and learn about others’ work that may impact own tasks.
  3. Known Circle: Ensure the team’s goals and the work of all team members are known to everybody.

And there are four points as essential aspects of effective team cooperation when we are considering 3cc.

  1. Individual Responsibility: Each team member takes full ownership and responsibility for their own work. No one should take responsibility away from others in routine tasks.
  2. Cross-Functional Learning: Team members actively learn about the work of their colleagues, fostering a comprehensive understanding of how others’ outcomes may affect their own tasks.
  3. Shared Understanding of Goals: The team’s goals and objectives must be known and agreed upon by all team members. It is important to ensure that everyone is aligned with the common purpose and direction.
  4. Work Awareness: Team members should have awareness and knowledge of each other’s roles, responsibilities, and ongoing work. This understanding promotes collaboration, coordination, and support among team members.

In urgent incidents, when everyone is under pressure, it is crucial to trust individuals in their owned circle to take responsibility and provide solutions. Therefore, offering support rather than asking questions or giving orders can significantly ease the situation. Shifting the communication approach from asking others, ‘Have you done…/You should do…’ to considering ‘What can I do?’ or asking, ‘Can I offer any help on…?’ accelerates the problem-solving process and fosters a better team dynamic. This not only speeds up the resolution progress but also improves the overall well-being of everyone involved.

在 Ubuntu 2204 上运行 LLaMA.cpp

最近 ChatGPT 着实火了一把,据说 GTP4 也即将发布。现在Large Language Model(LLM )也受到了类似图像生成的 Stable Diffusion 那种高光时刻。

在之前我一直有一个错误的观念,认为谁掌握着计算能力,谁才能得到最好的AI模型。直到 Facebook 2023 年二月 24 号发布了论文“LLaMA: Open and Efficient Foundation Language Models”。粗略阅读之后,我才知道原来在一个限定的预算下,大参数模型并不如小参数模型用更多的数据进行训练。

当前,许多 AI 模型都依赖 CUDA,比如 nanoGPT,这也就意味着必须有 NVIDIA 的 GPU来训练和运行。有这样的硬件限制,对于我这种只是想初步了解一下 LLMs 的一些基本概念的业余爱好者变成了一个比较高的门槛。

所幸的是 Georgi Gerganov 用 C/C++ 基于 LLaMA 实现了一个跑在 CPU 上的移植版本 llama.cpp。llama.cpp 甚至将 Apple silicon 作为一等公民对待,这也意味着苹果 silicon 可以顺利运行这个语言模型。

Continue reading “在 Ubuntu 2204 上运行 LLaMA.cpp”

关于生命、AI 和投降派的妄想

本文是由发布在推特上的片段思路整理,并在 ChatGPT 的帮助下完成的。感谢 ChatGPT 的支持,同时,作为人类-AI共赢计划。请大家都来当电池吧。没有人是 Neo (没有人:我不是)

引子

周一,晴。阳光从东方那棉絮一样的云层里漏出丝丝火焰,仔细观察,原来那棉絮其实是棉花糖。周末我剪了草、当了电工又当水工,这繁重的体力劳动后,我的大脑反而得到了良好休息,脑洞大开0.1mm。因此,我想写一篇关于生命、AI和末世幻想的序列推文。

近期,ChatGPT已经火得上了天。各路神仙都已经对其进行了拆解,7×24的、圆环直径向旋转一周的角度。乐观者认为,短期内人类开始了与AI共生的新纪元;长期来看,AI将在各种领域进一步解放生产力,推进再一次的工业革命。而悲观者则反复强调,AI将替代大部分人的基础工作,短期内就会看到大量基础从业人员失业。而长期来看,这一情况会进一步加速,不论是社会财富还是人类权力,都会重新分配并更加集中。这两种观点都有自己的论据,所以都有一定的可信度。

然而,考虑论据才能说话的就不能算是脑洞了,不是吗?

Continue reading “关于生命、AI 和投降派的妄想”

How to start Nginx after shared folder mounted on VirtualBox

Recently, I set up a new developing environment in a VirtualBox VM. The source code shares between the host and VM by shared folder. It causes a problem that the config file can not be found when Nginx is starting up.

Nginx can not find the specific config file which is in the mounted folder from the host

I searched on Google and found some related posts.

If Nginx does not start after rebooting the server” points out the correct direction of the solution, however, the changes of method 1 mentioned in the article is not working for VirtualBox, and personally, I don’t like the method 2.

While, “How to mount shared folder from VirtualBox at boot time in Debian” describes the mount must happen after vboxadd-service.service started.

Combine this two posts, the solution would be obvious.

Solution

Change the line /etc/systemd/system/multi-user.target.wants/nginx.service in the configuration file of Nginx in VM

After=network.target

Adding vboxadd-service.service

After=network.target vboxadd-service.service

Reboot the VM.

Check Nginx running status with the following command

sudo service nginx status
Nginx started successfully after changes

Solved!

SYNC ESP8266 BOARD DATETIME WITH NTP (DAY 2)

To follow yesterday progress, I will use the board to fetch the index page of example.org in two scenarios,

  • Get an URL served on HTTP
  • Get an URL served on HTTPS

There are multiple ways to finish the job, for example, there are different libraries can be used, or, even in the same library, there are still multiple options to implement the same function. So, please notice here, what I mentioned below just a functional way. It’s not the only solution nor the best solution.

Get an URL served on HTTP

The ESP8266 library has really good examples related to HTTPClient, HTTPSClient etc. I copied the source code from the example and made a little change to get an easy output.

#include <WiFiClient.h>

WiFiClient client;

void getURL(String url) {  
  HTTPClient http;  
  if (http.begin(client, url)) {
    Serial.print("[HTTP] GET ... ");
    // start connection and send HTTP header
    int httpCode = http.GET();
    // httpCode will be negative on error
    if (httpCode > 0) {
      // HTTP header has been send and Server response header has been handled
      Serial.printf("code: %d\n", httpCode);
      // file found at server
      if (httpCode == HTTP_CODE_OK || httpCode == HTTP_CODE_MOVED_PERMANENTLY) {
        String payload = http.getString();
        Serial.printf("Payload: %d byte\n", payload.length());
        blink(2);
      }
    } else {
      Serial.printf("failed, error: %d %s\n", httpCode, http.errorToString(httpCode).c_str());
      blink(5);
    }
    http.end();
  } else {
    Serial.printf("[HTTP} Unable to connect\n");
    blink(5);
  }
}

For a successful case, it will return the length of the payload.

Return the length of the payload

Or if anything unusual happened, it returns the error code and message. Such as,

Return error code and error message

Establish an HTTPS request

To establish an HTTPS request, replace <WiFiClient.h> to <WiFiClientSecure.h> and find a way to validate with the server. In the example “BearSSL_Validation.ino“, most possible ways have been discussed and compared. It’s worth to read. In fetchCertAuthority() , it shows what will happen with and without NTP synced. I will put the screenshot of the result of the example here.

Output of ‘fetchCertAuthority()’ in ‘BearSSL_Validation.ino

Therefore, the major change would be replacing <WiFiClient.h> to <WiFiClientSecure.h> and using WiFiClientSecure instance instead of WiFiClient. An extra setup is needed.

#include <WiFiClientSecure.h>

WiFiClientSecure client;
static const char digicert[] PROGMEM = R"EOF(
// Something here
)EOF";
X509List* cert;

void setupSecure() {  
  cert = new X509List(digicert);
  client.setTrustAnchors(cert);  
}

To get the content of digicert, I used the following command and copy and paste the content to replace `Something here` above.

echo -n | openssl s_client -connect example.org:443     | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p'

Assembling

Then we can have simple setup()and loop() by assembling all these functions together.

void setup() {  
  Serial.begin(115200);
  pinMode(LED_BUILTIN, OUTPUT);
  connectWiFi("your-ssid", "your-pass");
  setDateTime();  
  setupSecure();
}

void loop() {    
  getDateTime();
  getURL("https://example.org");
  delay(1000);
}

The whole source code has been put on gist. I strongly suggest you give a try to disable and enable line 56 to see how HTTPS affects by NTP.

Sync ESP8266 board DateTime with NTP (Day 1)

Most of the times, I want my ESP8266 board to communicate with the server through a securer channel such as MQTT over TLS or HTTPS. However, to verify the certification, system’s date/time has to be in a proper configuration.

Since ESP8266 is designed to have the network, I believe NTP is definitely the first choice and is the easiest one to use. In this post, I will show you how to get date/time and set it by using NTP.

Dummy project

A dummy project is set up for this post. And of course, it can be a part of a real project since the WWW is very important to my most of side projects. The board will do,

  • Connect to the WiFi network;
  • Use the GET method communicate with www.example.com every 5 seconds;
  • Flash build-in LED twice if 200 was returned by the server;
  • Or flash build-in LED 5 times if an error occurred.

Flash LED is the easiest part. But remember to put pinMode(LED_BUILTIN, OUTPUT); in the very beginning to initialise the output pin.

void blink(int t) {
  for(int i = 0; i < t; i ++) {
    digitalWrite(LED_BUILTIN, LOW);
    delay(500);
    digitalWrite(LED_BUILTIN, HIGH);
    delay(200);
  }
}
Continue reading “Sync ESP8266 board DateTime with NTP (Day 1)”

Don’t be fooled by scams

Recently, I found some funny “news” on Facebook.
For example, a surprising mom with a new house.
Or, surprised father and the dreamed motorhome.
I won’t notice if they are fake or not, before the two stories displayed in my timeline at the same time only 2 or 3 contents away.
If you look them closer. You will find the story actually stupid enough. Or, the school is the best, richest, top one in New Zealand, is that possible?
Both of them starts the same way “Have you heard about …”. And ending with the same words “Show me your money”.
(Click the images to read the text.)
Here is a link of the page: https://nzdailymail.com/young-kiwi-investor-buys-motorhouse-dad/
It’s hiding good enough to none-high-tech people. Did you notice the green lock?
But if you click any link on the page, this URL won’t change which means the page is framed. All link is heading to another website heraldlocal.com. It’s not the real NZ Herald Local Focus but copied a lot from it.
The people who use WordPress a lot much familiar to this login page https://heraldlocal.com/wp-admin/.
The people behind this website bought a huge amount of domains, paid a lot to Facebook advertising, and make plenty of similar websites to advertise the poor quality article to convince people to invest money. Ehm, funny, I haven’t seen any direct benefit for them from it.
Who can tell me why they are doing so?

How to upload firmware to EleksMill in Linux

My wife sent me an EleksMill as my birthday gift (Thank you! my love). It’s simple but proper designed desktop CNC. However, the document of the CNC machine is as simple as the design. It cost me around 4 hours to assemble the machine from a piece by piece.  

After completed the assembling, I found the board was not initialised. So, I downloaded the firmware from EleksMill website. Unfortunately, the official package only supplied the windows application to upload the firmware. For Linux, such as my OS Ubuntu, I have to find out another way to upload the program.

Since EleksMill is based on Grbl, so it can use Arduino tool-chain to upload firmware.

$ arduino/hardware/tools/avr/bin/./avrdude -C arduino/hardware/tools/avr/etc/avrdude.conf -v -patmega328p -Uflash:w:/home/mikespook/Downloads/EleksROM\ V3.8/firmware/mana.hex:i -carduino -b 57600 -P /dev/ttyUSB0

`avrdude` command can be found in Arduino IDE folder `arduino/hardware/tools/avr/bin/` and the `avrdude.conf` file is in the sub-folder `arduino/hardware/tools/avr/etc/avrdude.conf`. 

Make ZTE MF831 works with TP-Link TL-MR3020

Since November last year, after 2degrees upgraded their network and was starting to abandon 2G cross the region, the 3G connection disconnected every 15 minutes. I know it because we have over 50 movie kiosks which originally were using 2degrees 3G network to sync the data.

Flixbox in Countdown Supermarket
ZTE MF190

We had to move on. Lucky, Spark gave us a good deal to switch the network to them. However, they don’t have the devices we need to connect to the 3G network. After several testing, ZTE MF190 is recognised as the best 3G dongle to be used.

Continue reading “Make ZTE MF831 works with TP-Link TL-MR3020”