SageMath on arm64

For quite some time now, I’ve been trying to get SageMath to run on my JupyterHub server (which has an arm64-based CPU). For some reason, this just did not seem to work, whatever I tried. Every time I started a kernel, it would not connect and just die off.

After quite a bit of trial-and-error, I finally managed to find a solution today. For those looking for the quick answer, scroll to the bottom. Before I give the solution, I want to spend a little time explaining how I managed to find this solution.

I’ve already looked into many webpages earlier when trying to solve this problem. For instance, I found this page, which suggested adding an environment variable to explicitly specify the root directory of the SageMath installation to the kernel specification of the Jupyter SageMath kernel. However, this did not seem to solve the issue; the kernel kept dying before I could do anything with it.

At some point, I decided it might be worthwhile to install a more recent version of SageMath; my JupyterHub VM’s Ubuntu version only comes with SageMath 9.0, while the latest version is 9.7, as of writing this post.

But, sadly, this did not help much; the kernel kept refusing to connect. As I did not have much useful debugging information (I was mainly looking at the syslog of the VM), I decided to try something different: since Jupyter outputs quite a bit of information when it is executed from the command line, I decided it might be useful to try running SageMath from there instead of from JupyterHub. This can easily be done using the following command:

sage -n jupyter

However, this introduced a new problem: since all (TCP) ports are blocked by default for incoming traffic on my VM by a firewall, I had to find a way to access the notebook server I was running from the command line. For this, it turns out you can use SSH tunnels; these forward traffic which arrives on a port on your local PC to a port on the remote PC. Thus, we can run the following:

ssh -L 8888:localhost:8888

This command does the following: it creates an SSH session to, as usual. However, it also states that any traffic arriving at port 8888 on the computer from which this SSH session is running should be forwarded to whatever the remote PC (that is, can access at localhost:8888. In effect, this means that accessing localhost:8888 from my own PC will show the webpage I would arrive at when I would access localhost:8888 from the remote PC. Since Jupyter is running at port 8888 on the remote PC, this means I can access the SageMath Jupyter server I started above by going to localhost:8888 on my own PC.

From this point, solving the issue was relatively straightforward. When starting a SageMath kernel in Jupyter, the following error showed up almost immediately:

ImportError: /lib/aarch64-linux-gnu/ cannot allocate memory in static TLS block

At this point, I did what I usually do: just copy-and-paste the error straight into a search engine (in my case, DuckDuckGo). I found the following answer on StackOverflow:

The error already indicated that something was wrong with a library. The StackOverflow answer indicates an easy solution: by specifying the path to that library in an environment variable, it can be loaded properly.

Luckily, from the page I linked to earlier, we already know how to make Juptyter kernels load with an environment variable set to a certain value; this requires simply adding that environment variable to the kernel specification, which can be done as follows:

  "argv": ["/usr/bin/sage", "--python", "-m", "sage.repl.ipython_kernel", "-f", "{connection_file}"],
  "display_name": "SageMath 9.0",
  "language": "sage",
  "env": {
    "LD_PRELOAD": "/usr/lib/aarch64-linux-gnu/"

I placed the above in the file /usr/share/jupyter/kernels/sagemath/kernel.json. (Note: only the part with the env key was added to this file; the rest is mainly re-formatting to make it more readable.) After doing this, the SageMath kernel started almost immediately after attempting to do so from JupyterHub. Now, I can happily look forward to the cryptology exam I will soon be taking, in which SageMath can be quite useful to me.


Happy New Year

I wish everyone a Happy New Year. Let’s hope this one will be a better one than last year…

In a way, that shouldn’t be hard. One would think that nothing could be worse than last year. However, let us keep in mind that the number of infections with a viral disease displays exponential growth; the increase in the number of infections grows with the number of infections itself. This can grow out of control much faster than you think.

You can compare it with folding a piece of paper. Every time you fold it, it becomes twice as thick as it previously was. Now, consider the distance to the moon. Many people think that, in order to get to the moon, one would have to fold a piece of paper an extremely large number of times, in the order of millions or so. But, due to exponential growth, this number is much smaller in reality: you actually only need to fold 42 times in order for the piece of paper to reach the moon! (

Even though this is a bit of a stretched example, as it is impossible to fold a single piece of paper that many times, it does show us quite well how easily people underestimate exponential growth.

Don’t be fooled: when people want to take a break, Covid-19 will work extra hours. Stay safe everyone (and stay inside, as much as you can)!

It may be boring from time to time, but please make sure you don’t regret going out later; that is, when you, or someone you love gets into trouble…


Happy New Year!

I wish everyone a Happy New Year!

Let’s make this a wonderful new decade!


Merry Christmas!

I wish everyone a Merry Christmas!


The horror of… deleting files

This night, I was editing some images on my computer, when, all of a sudden, Photoshop refused to start. It told me it did not have enough disk space for something (which appeared to be something similar to swap memory).

When I saw this message, I did what was natural in this case: delete files I did not use anymore. However, I could not have expected how long this night would last.

After I found that deleting some files I did not need was not enough to get Photoshop up and running again, I thought it might be a good idea to clean up some old accounts left on my computer from before I migrated to Azure AD. What happened, however was that I accidentally not only deleted the data of old and unused accounts, but also of my own Windows account. 😭

This meant that, in a few seconds, all my user preferences and data were deleted. This, well, did not amuse me, even though this was not the worst. The worst thing I lost this night? That would be my WISeKey email certificate, without which I cannot currently logon to get that certificate renewed next year.

I tried all kinds of things to get that certificate back: running Recuva and using a tool called PhotoRec, until I came to the conclusion that the files are really gone. One lesson I certainly have learned now: take backups and store data in the cloud. Don’t be stubborn 😔, as it will only lead to more pain later on 😉.

Maybe I should be writing 'make a backup' down on my to-do list...

Now, there is one thing I still need to do: wait for my computer to finish copying over some recovered files (although I know I most likely will not get any information out of them).


Time for the holidays!

It is finally time to sit back and relax a little bit. That is because it is finally time for the summer holiday! 😃


Happy New Year

I wish everyone a Happy New Year and the best of luck in 2019!



For me, today was a busy day. After quite a bit of work, I was finally able to #deletefacebook. I have several reasons for this, and I’m going to try to explain my decision a little bit down below.

First of all, I think Facebook has far too much control over my data. Even though I rarely used the Facebook site itself, I did often use my Facebook account. To sign in to other websites, that is. After hearing about so many scandals recently, I decided I do not want to be a user of this social medium any longer.

Of course, Facebook itself is not the only problem. Facebook also owns Instagram (which I rarely if ever used) and WhatsApp (a messaging service which I really do not like to use, but which I’m pretty much forced to use because everyone else does so; that includes pretty much every student at university).

When I checked this morning, I found out I had used my Facebook account at approximately 200 other sites!

Deleting my Facebook account proved to be quite tough. When I checked this morning, I found out I had used my Facebook account at approximately 200 other sites! So, I started the cumbersome process of deleting many of these accounts, while making sure I had an alternative way to access the others. This took me several hours of work. It also meant giving up on a few accounts, especially on my Spotify account (as Spotify does not allow you to unlink your Facebook account if your Spotify account was created using your Facebook account).

In the end, all of this hard work paid off. I also found that I signed up for quite a lot of sites which I actually rarely use, and I deleted accounts on many of such sites. I have not deleted my Facebook account just yet, as I’m still waiting for Facebook to make a data download available for me, but after that I will press the (delete my account) button.

And what will happen to my WhatsApp account? I’m not sure yet, but I might actually delete it pretty soon. If I choose to do so, which might occur pretty soon, I will still be available on Telegram, Signal or via email or SMS. And of course, I will let those who know me know in that case.