Monday, November 30, 2026

YouTube full screen action menu

YouTube has added a new 'quick actions' menu to desktop full screen mode. It appears in the bottom right with buttons for like, dislike, comments, share, etc.

It is annoying. It interferes with subtitles. And there is no option to turn it off.

Fortunately, with uBlock Origin, it is easy to remove. Just add a filter to MyFilters:

youtube.com##div.ytp-fullscreen-quick-actions:style(display: none !important)

This sets CSS display mode to none for the div that contains the menu, identified by element (div) and class (ytp-fullscreen-quick-actions). 

Monday, October 12, 2026

Cost of Bandwidth for hosting sites

One of the many problems that comes with hosting a site is the cost of bandwidth.

Commonly, the cost is part of the cost of hosting the site. If something goes viral or bots come scraping, the cost goes up, or access is throttled, depending on the terms and abilities of the hosting service provider.

This problem discourages me making some sites more broadly accessible. I can't afford to pay unlimited amounts. I don't have time for real-time, 7/24 monitoring but finding out when I review the bill at the end of the month is too late.

I have several publicly available phone numbers. Anyone can call me from anywhere in the world. I don't have a similar problem with my phone bill because with the phone the caller pays, if it is not a local call.

The equivalent, for hosting a site on the Internet, would be for the client to pay for the bandwidth: no incremental cost for the person hosting the site.

This is obviously possible. The telephone companies implemented solutions for charging the caller long ago. Yet it has not been implemented on the Internet, as far as I know. All the hosting services I am aware of charge for bandwidth, with or without caps beyond which access is disabled.

ISPs already charge for bandwidth. Higher prices for unlimited bandwidth. Marginal prices for additional bandwidth. No change would be required to pass on the cost to the client/consumer.

What is missing is the mechanisms to transfer funds between the ISPs: from the ISP of the client accessing a site or service to the ISP of the server providing the site or service.

I hear vaguely about some deals for cost sharing with very large content providers, but it isn't routine, like it is with the telephone.

Even if it was routine, I would still be discouraged from making sites more widely available by security, privacy and IP theft concerns. But it would be nice to not have to worry about unpredictable, unaffordable costs if I host a blog, website or whatever.  

Friday, October 9, 2026

Wealth Tax

The primary value of a wealth tax is not the revenue it brings to the government, though this would be considerable. The primary value is the reduction of wealth of the excessively wealthy, which reduces their power and influence over government and society and preventing them so thoroughly subverting democracy.

As companies also exert political influence, to the detriment of democracy, they too should be subject to the wealth tax.

The wealth tax should begin at a net worth greater than 250 times the median net worth of people in the country. 

All people and companies with a greater net worth than this should be required to file annual, independently audited financial accounts and these should be made public. 

Filing such financial statements below this threshold should be voluntary. 

To encourage compliance, the cost of preparing the statements should be fully tax deductible and the penalty for failing to file the statements should be a minimum of 10% of net worth for a first offense and 20% of net worth for a repeat offense. And upon conviction, the prior 10 years of financial activity should be independently audited at the expense of the offender, with any prior offenses punished retroactively.

The wealth tax itself should begin at 2% of net worth, increasing linearly to 10% of net worth at a net worth of 5000 times the median net worth of people in the country and fixed at 10% of net worth above 1000 times the median net worth.

To put this in perspective with concrete numbers, the median net worth in the United States in 2026 is approximately USD$200,000. The median net worth in Canada in 2026 is approximately CAD$330,000. The median net worth in the United Kingdom in 2029 is approximately £124,700.

For example, in the United States, the wealth tax would begin at 2% at a net worth of $50,000,000 ($50 million) and increase to 10% at a net worth of $1,000,000,000 ($1 billion). In the United States there are approximately 200,000 individuals with a net worth above $50 million and approximately 1,000 individuals with a net worth above $1 billion, out of a total population of approximately 350 million people. The wealth tax would affect approximately 0.06% of the population. It would still allow great disparity of wealth but would curtail the extreme accumulation of wealth at a rate that is significant within a generation (i.e. approximately 20 to 30 years).

People and companies who are not resident in Canada for tax purposes should none the less pay the wealth tax on the Canadian assets they own or have a controlling interest in. This includes financial institutions that loan money to people or companies who are resident in Canada for tax purposes or own assets in Canada.

People and companies should pay the wealth tax based on their consolidated net worth.

Monday, September 28, 2026

Thunar default applications

The default application that opens a file when double-clicking it in Thunar is not well documented and the UI does not make it clear.

The fault is not all Thunar's. The implementation is rooted in the XDG specification:  Association between MIME types and applications.

XDG defines the configuration files that determine the mapping from file mime type to application. Part of the problem is that the configuration of this mapping is not well defined and the specified behaviour, which Thunar exhibits, is confusing and dangerous.

The problem is that there are two parts of the configuration that are significant:

  1. An explicit list of default applications
  2. A list of applications, in 'priority' order, that handle the mime type

If the explicit default application list is set, then the first available application in that list is the default application that is run to open the file on double-click.

If the explicit default application list is not set, then the first available application in the list of applications supporting the mime type is run to open the file on double-click.

The Thunar context menu puts the name of the default application - the one that will be run on double-click, as the first entry in the context menu, preceded by 'Open with'. For example, 'Open with "Restretto Image Viewer"'.

But it does not distinguish whether this is an explicit default application or merely the first in the list of applications supporting the mime type.

The distinction is important because if one selects Open with from the context menu and selects some application, that application is moved to the head of the list of applications supporting the mime type. If there is no explicit default application, then this becomes the new default application: every time on uses Open with to open a file with a different application (e.g. Gimp Vs Restretto Image Viewer), the default changes.

If an explicit default application is set, then opening with another application via Open with does not change the default application. But the Thunar UI does not make it obvious if there is an explicit default application or not.

The file properties also show the default application but similarly do not indicate if it is an explicit default or merely the first in the list of supporting applications.

The design is dangerous because if there is an explicit default application but that application is not available (e.g. it has been removed), then the default application does not become unset - it becomes whatever happens to be first in the list of supporting applications, which depends on the history of Open with operations: essentially random, based on history.

A better design would be, on double-click:

  • If there is an explicit default application, run it to open the file
  • If there is no explicit default application, prompt the user to select an explicit default application and save it as the explicit default, then run it to open the file.

This ensures that the file is not opened by an essentially random application, and that the explicit default application is set if double-click is used. Also, if the explicit default application is unavailable (e.g. has been removed from the system, permission denied or whatever) then the file is not opened in some other, essentially random application. Instead, the user is prompted to select a new explicit default application.

In short: double-click should only ever run an explicit default.

The Thunar implementation and documentation makes the situation worse by not clearly describing what 'the default application' is or how it relates to the mime types and desktop application configurations.

The Thunar documentation does not describe the side effects of Open with, nor the interaction with the explicit default application.

To be very generous, this statement in the Thunar documentation regarding Open With Other Application is ambiguous to the point of being misleading:

The action you have chosen is now added to the list of Recommended Applications for that particular file type. If you enabled the Use as default for this kind of file option or there was no prior action associated with the type, the newly added action becomes the default.

The ambiguity is between default in 'Use as default for this kind of file', which sets the explicit default, and 'becomes the default'. One might think that 'becomes the default' is the same outcome as 'Use as default', but it isn't. The 'becomes the default' case merely moved the selected application to the front of the list of supporting applications. The 'Use as default' sets the application as explicit default so that the order of applications in the list of supporting applications becomes irrelevant and future changes to the order of the list of supporting applications do not change what the default application is.

And 'there was no prior action associated with the type' is simply incorrect. Even if there was a prior action (there almost always is), opening a file with Open with changes the order of the list of supporting applications, effectively changing the default application but without setting the explicit default application, unless the checkbox Use as default for this kind of file is checked. 

The XDG specification allows one or more 'default' applications to be specified explicitly, for each mime type. It also allows the set of applications supporting the mime type to be specified, in order of decreasing priority.

If there is an explicit default application list, the first available application in that list (e.g. not uninstalled) is used to open the file. If there is no explicit default application, the first available application in the list of applications supporting the mime type is used to open the file.

There are multiple problems with this:

  1. There are multiple configuration files which may specify the applications and/or default applications associated with a mime type. Each may specify files in priority order, but it is not clearly stated how lists from multiple files are merged.
  2. In addition to the mimeapps.list files, there are also .desktop files, each of which can specify the set of mime types handled by the application. It is not clearly stated how these are merged with the prioritized list of applications for a mime type.
  3. In addition to the configuration files, there are cache files. The specification says nothing about them but the implementation uses them, but it is not clearly stated how the contents of the cache files are derived and/or merged with the configuration files.
  4. If the explicit default application is not available (e.g. has been removed) then the file is opened with the first application in the list of applications supporting the mime type. But this could be a totally inappropriate application to be used by default. For example, Thunar sets whatever is selected as 'Open with' as the highest priority. So something that was used just once, on one particular file, can become the default used on double-click.
  5. Thunar has a 'Use as default' checkbox in the 'Open with' dialog. If this is checked, then the explicit default application is set. What is confusing is that if this is not checked and there is no explicit default, then the explicit default application is not set but the selected application becomes the default for double-click none the less, because the selected application becomes first in the list of supporting applications. 

XDG specifies a very dysfunctional and dangerous algorithm for determining the Default Application.

The problem is:

Once all levels have been checked, if no entry could be found, the implementation should pick the most-preferred .desktop files associated with the mimetype, taking into account added and removed associations as per the previous section.
By 'most-preferred', one can only guess: the term isn't defined. The section Adding/removing associations provides and algorithm for listing applications 'in preference order' but it doesn't define how lists from multiple files are merged. Presumably the are appended, but this isn't stated. It doesn't define how duplicates (i.e. the same association specified in multiple mimeapps.list files) should be handled.

When associations are added from .desktop files with MimeType= including the given mime type, the specification does not say in what order these should be added.

As a result, the 'preferred order' is not well specified.

So, if no 'Default Application' has been specified in any 'mimeapps.list file, then the default application is the 'most-preferred' one in the list that does not have a well defined order.

Double clicking a file can open it with an appropriate app, then after some change (add/remove software, or whatever change) if that app can't be found for some reason, an effectively random app is used, instead of alerting the user that the default app cannot be found and forcing an explicit selection. This is dangerous.

The problem is that Thunar does nothing to clarify or disambiguate what will happen on double-click.  

When you double-click a file, it is opened with a 'default' application - that is, without specifying an application, some application is used to open the file. I call that a 'default' application.

In fact, when one double-clicks, there are two cases:

  1. A 'Default Application' has been set and that is used to open the file
  2. No 'Default Application' has been set, in which case whatever application was last used to open the mime type of the file is used

That second case is the problem. The 'whatever application was last used' is effectively a default application, except that it is not saved as the 'Default Application' so that every time 'Open with...' is used to select a different application, without checking 'Use as default', the effective default application (i.e. whatever was used last) changes.

The two kinds of default are not well documented and the magic behaviour of 'Use as default' is not documented. The fact that there are two ways of determining the default application is not documented. Users are left with this unexplained, confusing behaviour.

The behaviour should be documented at  Thunar - Working with Files and Folders, but it isn't. Instead, there are statements about 'the default action' without any clarification about the different kinds of default action or how to set them. Nothing is said at all about the difference between 'the default action' and the 'Default Action'.

See "Open with" always changes default  

The Thunar 'Open with...' interface does not clearly indicate whether there is a 'Default Application' or not. It shows a list of applications that may be selected and one is the effective default but there is no distinction in the presentation between it being the configured 'Default Application' or merely the last application used.

To see the 'Default Application' for a mime type, it is necessary to open ~/.config/mimeapps.list and look for the section [Default Applications]. If the mime type is listed in this section, then it has a 'Default Application'. Otherwise, it just has whatever was used last.

The context menu option 'Set default application' sets the 'Default Application' and it also, despite the name, opens the file with the new 'Default Application'. It does not, as the name implies, merely change the default application.

The context menu option 'Open with other application...', with the checkbox 'Use as default for this kind of file' is redundant with 'Set default application': it changes the 'Default Application' and opens the file with the new 'Default Application'.

The file properties shows 'Open with:' but does not indicate whether the application is the 'Default Application' or merely 'the default application' - i.e. the application that was last used to open the type. 

If you add a 'Custom Command', these are stored in '.desktop' files in ~/.local/applications.  The file names begin with 'userapp-'.

Even worse: Open with > Open With Other Application... opens a dialog with title 'Open With' that has at the top an application under the heading 'Default Application' even when there is no 'Default Application' - there is only the application that was last used. This makes it totally confusing as to whether there is a 'Default Application' or not and makes the behaviour of selecting a different application with 'Open with' extremely mysterious. It is stupid by design.

You can delete .desktop files in ~/.local/applications, but then you must run 'update-desktop-database ~/.local/applications' to rebuild the cache of mime type / application associations. It is not clear what happens if an entry in ~/.config/mimeapps.list refers to a desktop file that has been deleted. 

What would be a not-stupid design: If there is no default, then there is no default - double clicking a file with no default application should open a pop-up dialog that tells the user there is no default application so the double-click cannot open the file. The right click context menu should show a list of options for opening the file with none distinguished as the default application. On the other hand, if there is a default application, the right click context menu should clearly indicate the default application, and other options for opening the file. 

Wednesday, September 23, 2026

Modern Slavery

What is the essence of slavery?

I think the most fundamental motivation for slavery is the desire to have goods or services as cheaply as possible, without concern for the rights, dignity and well being of those producing them.

When people work to produce goods or services, they should be compensated enough that they do that work and give up the products willingly. They should not be forced to do the work without compensation or against their will and the products of their work should not be taken from them against their will.

This gives rise to the most morally objectionable aspect of slavery: taking away the liberty of others, to force them to do work against their will. This typically entails effective imprisonment, physical and emotional abuse and an almost complete lack of compensation for the work done, beyond the minimum necessary for the workers to survive to do the work, and sometimes not even that much.

Some few people might find pleasure in abusing others but the vast majority who benefit from slavery do it merely for the benefit of having goods or services at a lower cost than possible when they are produced by people living freely, with dignity, health and security, and producing them willingly, for compensation.

Of course, everyone wants more for less. It is a natural desire. What separates those benefiting from slavery is the willingness to ignore the abuse of others.

One might be more or less removed from the direct abuse of others. One might be directly involved in the physical coercion of them to work. Or one might trade with people who are. Or with people who trade with people who are. Or ever more removed. But if, ultimately, the goods or services are produced, in whole or in part, by people who are coerced to work against their will and without reasonable compensation, then one is benefiting from and therefore participating in slavery.

Our society is structured to obscure the existence of slavery and its contribution to the goods and services that are available. Long supply chains obscure the ultimate sources, more of less deliberately. This allows people who would not knowingly participate in slavery to benefit from it. And this motivates efforts to expose slavery, so that others might choose not to participate in it.

Beyond merely exposing slavery, there are laws to make slavery illegal. These take many forms. Some refer explicitly to slavery. Others bar the means of physical or emotional coercion essential to slavery. Laws restricting hours of work and setting minimum wages also contribute to the prevention of slavery, as do the many laws protecting basic human rights.

Theft is typically treated as something distinct and different from slavery. Slavery is forcing someone to do work and taking the products of that forced work without compensation. Theft doesn't entail forcing someone to do work, merely taking the products of work after the fact, without forcing the work. But the end result is very similar: people work and the product of their work is taken from them against their will, without the compensation that would make them do the work and give up the products willingly.

It seems to me that theft is just a more subtle and devious means of slavery. It avoids some of the physical and emotional coercion, which is good to avoid, but it has all the other adverse consequences of slavery.

Thinking of theft and modern slavery, it seems to me that one of the biggest transfers of wealth in human history is the taking of almost all the artifacts of our culture for the training of LLMs, without compensation to the creators. This is deemed not to be theft, by those in power and benefiting from the transfer. But for the vast majority of creators, their products were taken against their will and without compensation: the essence of theft.

And as for coercion to work against ones will, one means to make others do this without direct physical coercion is to remove all alternatives. If one isn't allowed to raise or grow food and there are no stores except the company store, one will buy food at the company store, regardless of the price. Even if that makes one perpetually indebted to the company. The force, in this case, isn't up front as in traditional slavery, but it comes later, if one tries to stop working and leave the company town without paying off the debt: then law enforcement intervenes. So it isn't physical coercion that leads to slavery, but rather the threat of physical coercion: just one slight step removed. Like theft, this avoids the direct use of physical coercion that is the essence of slavery, but has all the other immoral consequences.

The so-called 'AI' industry entails two aspects of slavery: theft of the products of work, without compensation to the workers; and removal of any alternative but to work in conditions equivalent to slavery, by way of unfair competition. The industry is giving away the outputs of the LLM systems at far below cost, in order to compete with real people working productively and creatively, leaving them no alternative but to work in abject poverty to gain a few scraps of food.

It surprises me, therefore, that there isn't more vocal opposition to the 'AI' industry from those advocating against modern slavery. It is a morally repugnant abuse of human rights, morality and basic dignity, in progress at a massive scale, and should be opposed.

It is less direct that a sweatshop with imprisoned slaves, but it is so pervasive that it is almost inescapable. And, thus far, there is very little attention to the immorality of it. Not no attention, but not nearly enough. Many people discuss LLMs and so-called 'AI' merely on the basis of effectiveness as a tools for producing an immediate result in comparison with other means of producing the same result,  without consideration of its broader effects on people, society and the environment: without consideration of the theft of the products of people's work without compensation or the elimination of alternatives to working in slave-like conditions.

Saturday, September 19, 2026

Some thoughts about LLMs

I'm not an LLM developer, mathematician or computer scientist with deep insight into how LLMs work and what they are capable of.

I am not a lawyer with thorough knowledge of the law, its applications and impacts.

I have used LLMs, out of curiosity and as required for work.

LLMs are not perfect: they sometimes produce utter nonsense with good local consistency but overall lacking in self-consistency and consistency with reality. Often the output is not correlated with the input in any way that is useful to a person living the the real world and wanting help to deal with it. Not long ago, the outputs were predominantly nonsense. As time goes by, such faults in the output are less noticeable and less impactful, but they still exist. It remains foolish to depend on the outputs of LLMs for anything that matters in the real world (e.g. health, legal or business issues, social or political issues, relationships, etc.) without thoroughly vetting the outputs.

LLMs often produce useful outputs: the outputs are not devoid of truth or useful information. They are able to analyze, manipulate and produce computer software source code, often very effectively. They sometimes provide true information in response to questions. They sometimes correlate information from disparate sources to synthesize a summary or describe a pattern that might otherwise be difficult to discover. However, the usefulness is impaired by having to fact check everything, in cases where correctness matters.

The companies developing LLMs have been allowed to take copies of a large part of humanities cultural artifacts, to use them to train their LLMs with very little compensation to the creators or owners of the intellectual property rights in those artifacts. As far as I know, in the vast majority of cases, with no compensation at all. In a few cases, courts have forced them to provide some little compensation. I am not aware of any cases where they have provided compensation willingly, on their own initiative.

I understand that the legal justification for the companies developing LLMs being allowed to take and consume copies of artifacts not in the public domain is that the LLMs are transformative and therefore use of the artifacts is 'fair use'.

I do not understand how it is transformative, 'fair use' for these companies to take and use copies of protected works without permission or compensation but it is not equivalently 'fair use' if I or others take copies to similarly consume them - to learn from them - to train ourselves. 

Surely if I read a book, blog post, media company article or any other written work, or listen to an audio recording or watch a video recording, to become aware of the content, then my learning is also transformative. Whatever the internal representation of it in my mind, it is not a mere copy of the original. Whatever I might say or do subsequently, it is not an exact copy of the original, but transformed by my broader experience, abilities and limitations. Even if I tried, I couldn't create an exact copy of anything.

If I take a copy of a physics text book or article without compensation to the copyright holder, to read and learn from it, it is deemed theft.

If an LLM developer takes a copy of a physics text book or article without compensation to the copyright holder, to train their LLM, it is deemed 'fair use'.

The inconsistency is striking. I think the obvious difference is that the companies developing LLMs have billions of dollars to bribe and manipulate politicians and courts, while I and others like me do not.

I do not think there is anything fundamentally different in what we are doing, from a moral perspective, and there should be no difference from a legal perspective. Taking copies of protected works to consume them for whatever benefits doing so might provide should be treated the same, regardless of who is doing it.

I think the different treatments by the courts is a manifestation of fundamental injustice, largely resulting from the difference in power and influence of the extremely wealthy companies developing LLMs, compared to individuals.

LLMs are not useless. They can produce valuable outputs. This has already been proven. They have improved greatly in recent years and there is little reason to expect that they are already the best they can be or that there is no more possibility of learning to use them better.

None the less, it remains uncertain whether the benefit of using them will exceed the cost of producing and operating them and the adverse impacts of using them.

To the extent that LLMs are powerful tools, they can be used for good or for evil. There are harms associated with using them that is inherent in the use of them. This includes the consumption of resources to develop, build and operate them, for example. These costs and harms are not trivial. There is enormous energy consumption, at a time when climate change is already a serious problem. There is disruption to the balance of supply and demand of many goods and services. There is disruption in the economy on a massive scale, including the displacement of humans from their means of earning a living in our capitalist society. But I think the far greater harm is the harm that has and will come from evil people using the for evil purposes and selfish people using them for selfish purposes, to the detriment of others and society as a whole.

At the level of society as a whole, the greatest impact of the companies that develop LLMs and the LLMs themselves, thus far, seems to be to have greatly increased the already excessive concentration of wealth and power in the hands of a very few people. I think the short term and long term impact of such concentration of wealth and power is a net harm to society. Worse, that it is harmful to the vast majority of people and benefits only a very few who already enjoy the benefits of such extreme wealth that they have no legitimate moral need for any more.

Further, the use of LLMs is somewhat akin to slavery: the work of others taken for oneself, without any compensation - those others essentially made to work for free. Not by physically restraining or punishing them, but by unfairly competing with them, giving them no alternative. Many people have long wanted to benefit from the work of others without having to respect their rights or compensate them with a living wage. This desire is not new. LLMs are just a new mechanism to remove oneself from the direct oppression but still benefit from it. Like buying goods made in a sweatshop where slaves work or trading with a country or industry where slavery is common. But knowingly participating in such activities makes one complicit in the oppression and abuse. It is morally reprehensible.

I expect that the risks associated with the development and operation of LLM systems will be externalized by the companies developing and operating them. The risks will be transferred, through the financial institutions and governments, to the majority of ordinary people, who have no knowledge of the risks nor control of the decisions that will determine the outcomes. This will happen, for example, by institutional investors investing funds from pension funds, insurance funds, mutual funds, etc. on a massive scale: providing the companies with billions or even trillions of dollars, freeing the wealthy initial investors from risk and losses.

I expect many of the companies developing LLMs will fail, going bankrupt or bought out for very low prices. In the end, there will be a further concentration of wealth and power: an effective monopoly, or perhaps a duopoly or oligopoly: very few companies, not truly independent. controlling the market to extract maximum wealth and power from it. Externalizing losses and internalizing profits for the wealthy owners.

These companies or the people who use the LLMs they produce, might produce great benefits, some of which will be broadly distributed through society. New and better software, medicines, medical treatments and other products and services of all sorts. But I am skeptical that these benefits will be greater than the costs and harm done, in the foreseeable future.

The disruption will continue for decades and generations. Ultimately, if more efficient LLM systems are developed, new power sources are developed and the environments is not degraded to the point of being unlivable, LLMs might produce net benefits that could be broadly distributed throughout society. But I don't think a fair, equitable and generally beneficial distribution is likely. 

I don't think the companies developing LLMs will willingly share any of the benefits. They are, after all, capitalistic and operated by narcissistic sociopaths. Despite the legal definition in some jurisdictions, companies are not people. They do not behave like people. They do not have the morality, empathy or compassion of people. Rather, they are amoral, bureaucratic systems for extracting wealth with minimal risk, cost and responsibility. If a person behaved similarly, we would call that person a sociopath.

As always, the challenge is to negotiate an equitable distribution of the benefits of our culture, technology and work, that motivates people to be productive, cooperative members of society while allowing as much freedom as possible for different people to live according to their preferences and priorities. To mitigate and regulate conflicts sufficiently to avoid violence. To hold people accountable for their actions, including rewards for their good actions and punishment for their bad or harmful actions. 

This is made particularly difficult by different people having different values and therefore different ideas about what is good or bad, harmful or beneficial.

Society will never be peaceful. There will forever be conflict.

 

I like Yanis' take on the dangers of AI: "Is AI dangerous? Of course it is dangerous. All new tech is dangerous, because it reveals: how terribly humans are treating other humans. That has happened since time immemorial."

Monday, April 13, 2026

Windows 11 error message rant

I was given an incorrect security key for a WiFi network.

I tried to connect WiFi but the attempt failed. 

All Windows 11 indicated was 'Unable to connect to this network' - no indication that authentication had failed.

I followed advice for debugging WiFi problems: disabling and re-enabling WiFi, Forgetting the WiFi connection, rebooting Windows 11 and the router, disabling and re-enabling the WiFi device.

An utter waste of time.

If Windows 11 had indicated 'Authentication failed' instead of 'Unable to connect to this network', it would have been a quick fix.

My mistake was to assume that since Windows 11 didn't report an authentication failure, that authentication had not failed. Silly me! 

Why is it so hard from Microsoft to provide useful error messages?

'Unable to connect to this network' provides no actionable information other than what I already know: the WiFi isn't connected. 

Monday, March 16, 2026

Python PEP Caution

I didn't realize until today that Python PEP documents are not static. For example, look at PEP 366. This PEP document was modified many times, from May 1 2007 when it was first created until February 1 2025 when it was last changed. It began as a txt document with history from May 1 2007 to September 16 2022, then was changed to an rst document with history from September 10 2023 to February 1 2025.

Why is this an issue?

Because, when you read a post that references a PEP, unless they provide a copy of the PEP they were referring to, or the commit of the version they are referring to, you can't be certain what they were reading.

While most of the changes don't change the essence of the PEP, some do. You can't know without investigating them all. In the case of PEP 366, substantial changes were made until February 2 2009, after which changes were mostly changes to metadata, formatting and links to referenced resources.

To make matters worse, substantial changes are made even after the status of a PEP has been updated to Finished or Final.

Compare this to the IETF management of RFCs. RFCs are published and don't change substantially. Only metadata is changed to indicate if there are errata or when the RFC is superseded. Corrections are published in separate errata documents. More substantial changes are published in new RFCs that clarify or supersede the original RFC but don't change the RFC.

Tuesday, March 10, 2026

YouTube alternatives?

Bruce understands the fundamental problem with YouTube, and proposes an alternative: PeerTube, combined with portals to make it easier to find content: multiple portals. The biggest issues will be the monetization,  liability for illegal content, if a node proxies access for others, and security. The big players (YouTube, Meta, Apple, etc.) can have competition de-banked, which would disrupt monetization. Governments are increasing the restrictions and liabilities imposed on content providers.

Friday, March 6, 2026

AI in Firefox

I don't want a browser with inbuilt AI and a configuration switch to disable it: a switch which might inadvertently or maliciously be set to enable the AI features.

An addon that provides the AI features would be better: I could choose not to install the addon and to enable the AI features, an attacker would have to breach security to the extent they could install and enable the addon. At that point, they probably already have access to all my data anyway.

AI systems are, at the current state of the art, fundamentally unreliable and insecure. See, for example AI Agent, AI Spy.

Mozilla has decided that it will build AI features into Firefox. Therefore, I am forced to seek an alternative to the browser I have used preferentially for decades.

Nothing is forever and it is time for change, but not the change Mozilla intends.

It does make me wonder who funds Mozilla and what their real objectives are. 

Monday, March 2, 2026

Configuring WireGuard VPN client on Debian 13/trixie Linux

I am having difficulty configuring a WireGuard VPN client on my laptop running Debian 13/trixie Linux with XFCE desktop and NetworkManager managing network connections, to connect to the WireGuard VPN server I have configured on my router running OpenWrt.

I installed the wireguard package with: sudo apt install wireguard

I installed dbus-x11 package with: sudo apt install dbus-x11

The dbus-x11 package provides dbus-launch. At one point in my trials I was running nm-connection-editor as root (as some posts suggest this is necessary for it to write configuration to /etc/NetworkManager) and got an error indicating dbus-launch was not found. Installing dbus-x11 resolved this.

I tried configuring the VPN client by opening 'Configure VPN...' from the network icon in the XFCE panel (presented by the Status Tray Plugin of the panel). This appears to run nm-connection-editor, which can also be run from the command line.

This opens a window with title 'Network Connections' and two lists of connections: Wi-Fi and WireGuard. I clicked the '+' icon at bottom left and a new window appeared: Choose a Connection Type. I chose WireGuard and clicked Create.

This opens a window with title 'Editing WireGuard Connection 1'. The default connection name is 'WireGuard Connection 1'. I changed this to 'wg0'.

I completed the form on the WireGuard tab, including a peer with details of the WireGuard server on my router. It all seemed simple, except that  when adding the peer I was unable to enter the preshared key until I realized that the icon at the right of the field value text box is clickable and brings up a menu of options, the default being: The password is not required. With the default setting, the input textbox is disabled. 

But the connection didn't work. When I re-opened it in the connection editor, I found that sometimes the Preshared key input of the peer configuration was blank and sometimes the Private key input of the connection was blank. There were no pop-up errors or indications that the connection didn't work, but the connection wasn't created and the checkbox beside the VPN name in the pop-up from the network icon in the XFCE panel wasn't checked.

Eventually I found that when I tried to bring up the connection, there logs from NetworkManager in syslog, including:

2026-03-02T10:25:50.614594+13:00 tpt590 NetworkManager[849]: <warn>  [1772400350.6144] device (wg0): No agents were available for this request.
2026-03-02T10:25:50.614731+13:00 tpt590 NetworkManager[849]: <info>  [1772400350.6145] device (wg0): state change: need-auth -> failed (reason 'no-secrets', managed-type: 'full') 

When I added or edited the peer, I could enter the Preshared key after selecting 'Store the password only for this user' or 'Store the password for all users'. I could save the peer configuration then immediately reopen it for edit and all settings remained. But if I saved the connection then reopened it then opened the peer for editing, the Preshared key value was gone. And sometimes the Private key value of the connection was gone. It isn't obvious to me when the Private key value is cleared. Often, but not always, when I open the connection in the connection editor, the Private key value is gone - reverted to blank, though my selection for only this user or all users remains.

If I edited the connection and the Private key was present, then edited the peer and added the Preshared key and saved the peer but didn't save the connection (i.e. the connection editor was still open), then I was able to bring up the connection and the error about missing key did not appear. But as soon as I saved the connection, the Preshared key was lost and I was unable to bring up the connection. 

The WireGuard site does not provide documentation for the NetworkManager nm-connection-editor.  At least, not that I could find.

I don't know what package provides the functionality for editing WireGuard connections: whether it is part of XFCE, NetworkManager, WireGuard or some other. The forms I see are a bit different from what I see in posts about GNOME connection editor, which makes me think it might be desktop specific. It clearly relates to NetworkManager: the configuration editor is launched by running 'nm-connection-editor', but I suspect there is a plugin provided for WireGuard. Thus far, I don't even know where to ask: there are multiple forums for each of these components.

I am able to configure a client using the 'wg-quick' script and a configuration file I wrote by hand. Or by using the ip and wg commands directly. Bringing up the connection this way results in some configuration in  /run/NetworkManager/system-connections, but none of the keys are in the generated file.

I don't know if I'm missing some package or using the connection editor incorrectly or if it is actually misbehaving. Maybe the keys are supposed to disappear from the connection editor. I see some suggestions that they are stored by some sort of agent. But I haven't yet found any helpful documentation about this.

Update: 

I have found source code for nm-connection-editor and it includes modules for WireGuard. I have also found posts that assert that support for WireGuard is built in to NetworkManager: that the wirreguard package and wg command are not required.

I have also found that importing the WireGuard configuration that worked with 'wg-quick' into NetworkManager with the command:

sudo nmcli connection import type wireguard file ./vpntest.conf 

creates a connection file in /etc/NetworkManager/system-connections that can be brought up and down from nm-applet, which runs from the network icon in XFCE panel.

This creates a configuration similar to what I created using nm-connection-editor, except that all the keys are present.

I am still undecided where there is a bug in nm-connection-editor or I am using it incorrectly, to cause it to lose the Private key and/or Preshared key. I see implications that a key/secret store may be used to store them. But the keys are sometimes lost with no error message, which is very unhelpful even if, technically, it is not a nm-connection-editor bug that causes it.

For the moment, I will ignore nm-connection-editor and use 'nmcli connection import' to create configurations. Or edit the files manually, now that I have a working example.

FWIW, the working configuration in /etc/NetworkManager/system-connections is:

 

[connection]
id=vpntest
uuid=0fb0c5dd-9494-4854-b0a9-33659c21d5c1
type=wireguard
interface-name=vpntest

[wireguard]
private-key=REDACTED

[wireguard-peer.q0wK24nJWvlC+pZQ6wzGzsaqiI41vONaf8wtXjG7xzA=]
endpoint=64.246.80.42:51820
preshared-key=REDACTED
preshared-key-flags=0
persistent-keepalive=25
allowed-ips=192.168.1.234/32;

[ipv4]
address1=192.168.9.2/24
method=manual

[ipv6]
addr-gen-mode=default
method=disabled

[proxy]

 

The redacted keys are as created by 'wg genkey'

 

Friday, February 13, 2026

OpenWrt router connected to Lightwire wireless internet service

I installed my own router for access to Lightwire wireless internet service because with the router provided by Lightwire I was unable to forward port 443 to one of my own nodes. Lightwire uses HTTPS for remote administration of their router and was unable to use an alternate port for their purposes.

Lightwire documents that customers may use their own routers but has no documentation of how to do so. I received instructions from support, in follow-up to my ticket asking why my attempt to forward port 443 wasn't working. 

The requirements for configuring the router were:

  • PPPoE connection
  • Traffic must be tagged VLAN ID 10

I started with a router with a fresh install of OpenWrt v24.10.

I connected to a LAN port and configured WiFi interfaces using the web interface, then connected via WiFi.

I disconnected the network cable from the router provided by Lightwire and connected it to the WAN port of my router. 

I logged in to the web interface and edited the wan and wan6 interfaces under Network > Interfaces by clicking Edit and then changing the protocol from DHCP to PPPoE and entering the username and password provided by Lightwire in the PAP/CHAP username and PAP/CHAP password fields. All other options left unchanged. Clicked Save then Save & Apply.

As I wasn't sure how to set the VLAN ID via the web interface, I logged in via ssh and edited /etc/config/network and changed the configuration for interfaces wan and wan6, changing option device from 'wan' to 'wan.10'. After the change, the sections were:

config interface 'wan'
	option device 'wan.10'
	option proto 'pppoe'
	option username 'REDACTED username'
	option password 'REDACTED password'
	option ipv6 'auto'

config interface 'wan6'
	option device 'wan.10'
	option proto 'pppoe'
	option username 'REDACTED username'
	option password 'REDACTED password'
	option ipv6 'auto'

Then I rebooted with command reboot.

With these changes, the router connected to the Lightwire service and I had Internet access again. But now with a router fully under my control, allowing me to forward port 443 to one of my servers.

Wednesday, February 4, 2026

Ordinary Men

I was reading Christopher Robert Browning's Ordinary Men recently.

It's a sobering thought that ordinary men can be made to behave so badly. That the inclinations to morality, empathy, compassion and decency are so feeble that they can so easily be overcome.  That aggression and hatred are so easily stirred, to become dominant in so many, with so little resistance, comment or criticism.

What is happening in the United States now is not yet as evil, but it is already far from the civil, decent, compassionate and caring society that made so many in the world envy and long for it. The rule of law and due process seem on the wane, leaving only brute force. Ordinary men, turned brutal and violent and uncaring.

There is some criticism, but not nearly enough to stop it. Barely enough even to slow it. Which makes one wonder how far will it go this time, before there is some real resistance? How many will die? How many will suffer.

There is a long history of violence and destruction. It is far easier to destroy and terrorize than to make a great, civil society. There are very few left who experienced the evil of WWII and they are now too old and feeble to have much influence. To resist the inclination to violence and evil. And history shows us that without such resistance, violence is almost inevitable. The inclination to it is too much a part of human nature.

Civilization requires active support and defense, else it will crumble and decay and be overcome, yet again. The time is now. 

Even ordinary men. 

Monday, February 2, 2026

NZ PC Clearance

I just received a 'new' laptop from NZ PC Clearance. 

I placed the order Friday morning, about 09:00. Promptly received an email confirmation. The order included replacing the SSD so, presumably, they had to open one to put in the new SSD.

Confirmation that the package had been picked up by NZ Post came Monday at about 17:20. That's not bad turnaround.

And it was delivered today, Tuesday morning, before 11:00.

It's a refurbished Lenovo ThinkPad T590 (20N5). i5 processor, 16GB RAM and 1TB SSD. It came with a power adapter. Nothing else in the box. Windows 11 Pro - pre-installed. I haven't put it on the network, but it already wants to install updates, nagging me for a time to install.

Cosmetically, it looks good. Some of the key caps are slightly worn, but no more than I wear them on a new laptop in just a few months. The TrackPoint is a bit discoloured - like black permanent marker on the bottom quarter. But all the little bumps on the surface are fine. And it works well. There's some very slight scuffing around the edges. A bit more than my three year old Dynabook, but not really noticeable, unless I'm looking for them. No defects on the screen that I can see. So, practically speaking: nearly as new condition. I'm very pleased. I was worried it would be all banged up and worn out.

I don't think anyone sells them new any more. I saw a review listing a unit with i7 processor, 16GB RAM and 512GB SSD for 1,800 euros. Another with i5 processor, 8GB RAM and 256GB SSD for US$1,469.99 at Best Buy (sold out - but I guess that's the price they were selling them at new). So, under NZ$900, including the new SSD, shipping and taxes seems a reasonable price.

I hadn't dealt with NZ PC Clearance before and was hesitant about buying a refurbished laptop, but thus far, I'm very pleased. 

Saturday, November 1, 2025

Ubuntu VM on Windows 11

Recently I had need of an Ubuntu system for developent, in an environment where Windows is the only operating system allowed on work devices. I proposed a virtual machine running Ubuntu, which was accepted. So, I had to set up a VM running Ubuntu, running on Windows.

For consistency with the production server, we ruled out WSL as an option: without being specific about the differences, documentation of WSL indicates the environment is different from native Linux: it can't run everything.

I had experience with qemu on Linux, so I first set up a qemu VM on Windows. This was easy but performance was poor. Without KVM (not supported by the Windows kernel) it is un-accelerated software emulation. It works fine. It's easy to manage. But a bit slow. The developer team was likely to be frustrated.

Guidance I could find on speeding up qemu said the solution was to enable hyper-v and WSL, run Ubuntu in WSL2 and install and run qemu from this Ubuntu. While this might work, I wasn't inclined to run qemu in WSL2. One of the motivations for developing the VM was to eliminate the configuration work for the developers and I wasn't interested to deal with the issues of developing a WSL2 image export/import, if that is even possible.

But Hyper-v is itself virtualisation. Why not run Ubuntu in a Hyper-V VM directly?

It was easy to install Hyper-V and create the VM, booting from an Ubuntu iso, but network configuration failed: despite the documentation, there was not DHCP service on the default switch. Using sniffer, I could see the DHCP requests from the guest, but there was no response. The interface worked, but had to be brought up manually after each boot. I did manage to find documentation for adding a NAT network: add a private switch and configure that, and it was possible to access the Internet from the VM and access the VM from the host using SSH. But still the VM network had to be brought up manually after each boot. The default switch, even if it worked as documented, was for Internet access from the VM and documented to not allow access from host to guest. The recommended solution was an 'external' switch, but that requires two NICs on the host and an external switch to connect them. Hyper-V networking it truly perverse.

Next option was VirtualBox. It's open source, but provided by Oracle and Oracle has a history of adverse management of open source projects under its control. None the less, given the poor performance of qemu and the nearly useless and undocumented networking of Hyper-V, I gave it a go.

And I was pleasantly surprised. VirtualBox is easy to install and it was easy to create the VM. Networking just worked and it was easy to map ports from the host to the guest to allow SSH, HTTP and file share access from the host to the guest. And, after all was done, performance was significantly better than qemu running on Windows.

So, the final solution is Ubuntu running in a VirtualBox VM. It's easy to export/import. Easy to set up on a developer system: just install VirtualBox an import the VM image. Easy to start/stop and change resources (more memory and CPU for those with more grunty workstations) and easy to change the port mapping if access to additional guest services is required. 

Saturday, October 4, 2025

Chinese word segregation with jieba

A while ago I wrote a program to analyse the vocabulary of my Chinese ebooks. It was very simple: it extracted the text and segregated it into words by lookup in the cedict dictionary and ranked them according to the HSK word lists. But it was crude: it found the longest matching word at each position in the text, then moved on. It found words but often not the intended or even common or sensible words.

I thought about getting word frequency data and choosing the words that were more common. But while searching for word frequency data (cedict doesn't have it) I found articles on Chinese word segregation and found that there are many existing programs.

One I kept seeing was jieba. There are many implementations. My program was written in JavaScript on node, so I looked for JavaScript implementations on npmjs.com. There were many but most of them had not been updated for years. I tried a few but most of them didn't even install, let alone work. I assume they did when they were published but node/npm and their other dependencies have changed so much in the meantime that they didn't install or didn't work with current versions.

One difficulty was that most of them had very little documentation and most of it was in Chinese. Not surprising for software that does Chinese word segregation, but my Chinese isn't good enough that I can read it.

I tried a few packages based on cppjieba which were more recently updated than most. It was still challenging to get them to work, but eventually I got one working and it seemed quite nice: good performance and good results.

But I wanted to understand the algorithm and when I started to look through the cpp code I got lost. Too many layers of objects and abstractions, and no documentation or comments describing the data structures or algorithms.

So I looked some more and found a pure JavaScript implementation. It hadn't been updated for 7 years and didn't work, but at least it was a familiar language. It was left half way through being converted from CJS JavaScript to ESM TypeScript - not in a working state.

I had a go at TypeScript but after a few days of dealing with a seemingly endless stream of errors I finally got it to compile and got runtime errors with references into a monolithic blob of transpiled, compacted code. Life is too short to waste it on such nonsense.

So I stripped out all the TypeScript and reverted to simple ESM JavaScript, and in a few minutes I had it working well enough to run the included demos.

I then was able to add logging and trace the code to understand what it was doing.

It is quite simple, actually, like most good algorithms. The implementation I had picked up was based on Python Jieba module as it was about 12 years ago: quite different from current. And the implementation in JavaScript wasn't ideal, but it worked and I was able to understand it and then quickly rewrite various of the wonky bits.

So now I have an all JavaScript implementation that works with current node/npm and I have updated my analysis script to use it. Speed is good: as fast or maybe a bit faster than my previous, simple implementation of word lookup in cedict.

I don't know where the dictionary and weights come from: whatever Python Jieba was using a decade or so ago. From manual segregation of some corpus of books and articles, if I understand correctly.

I found a nice article from people who had used move subtitles to develop lexicon and statistics for more modern Chinese usage. They have done similar for several other languages. It was actually this paper that lead me to Jieba in the first place, as they had used it in their research: cppjieba.

My revised implementation omits the DAG: it builds the segregation route directly from a 'prefix dictionary'. The dictionary is like current Python Jieba but the algorithm for building the route isn't: no DAG. Much quicker.

I only have basic cut functionality, but that's all I need for the moment.

@ig3/node-jieba-js

Monday, September 8, 2025

Dynabook TECRA A50-J annoyance

Today I was running my laptop on battery. Not intentionally. I had unplugged it to move earlier and had neglected to plug it back in when I returned.

I was concentrating on what I was doing, so didn't notice that the battery was running low. No audio alert because I had disabled all the system sounds.

So the battery ran down and the system fairly abruptly shut down. The system is set to shut down when battery falls to 10% of capacity.

I plugged it in within 10 seconds of it shutting down, waited a few seconds then pressed the power button.

The keyboard backlight lit for about a second, as it usually does when powering up. Then nothing.

I waited a few seconds then pressed the power button again, with the same result.

I kept waiting, then trying. Sometimes the keyboard backlight would come on briefly but sometimes not even that.

After a couple of minutes, the keyboard backlight came on briefly, then all went dark but then the screen backlight came on. But no Dynabook logo appeared. I thought it might be doing some sort of POST and waited. After somewhere between 30 and 60 seconds, it shut down again.

I kept waiting and trying, with the keyboard backlight coming on briefly but usually nothing more.

Finally, after about five minutes being plugged in, it finally booted normally.

The whole time it had full power: it was plugged in and powered up. Any reasonable laptop could have run without any battery at all.

But not the Dynabook TECRA A50-J. Evidently, it can't run without a battery, even when it has full power.

People have been making personal computers for almost 50 years now. Making laptops, or at least portable computers with batteries for almost as long. Dynabook wasn't a novice company when it designed and built its TECRA A50-J. But this behaviour, they thought, was acceptable.

I don't think I'll be buying another Dynabook computer. I had a Toshiba Satellite previously. Used it for many years. It was a tank, except for the too delicate case. After about a decade, I finally gave up on it because the last time the mounts for the screen had failed I had potted them up in epoxy and glued the case shut: too many of the clips and screw sockets had failed. When the mounts failed again, I couldn't open it to glue it back together without doing more damage. I also thought it would be nice to have something lighter, with longer battery life.

The Dynabook has been OK. The paint came off many of the keycaps within a few months. But the battery can't be replaced without opening it up and not being able to run without a battery is stupid.

I've only had it for about 3.5 years, but it's time to start looking for a new laptop, before they're all unavoidably infested with Microsoft AI.

Tuesday, September 2, 2025

Debian 13 on HP 665 G11 laptop

Today I installed Debian 13 on a new HP 665 G11 laptop that came with Windows 11 pre-installed in 1TB SSD. It's not well tested yet but superficially it seems fine.

I created only local Windows 11 accounts on the laptop.

I used Windows Disk Manager to shrink the Windows C drive to make space, reducing it to 250GB.

I disabled BitLocker Device Encryption, which was enabled by default, though I don't think it had encrypted the device yet: I could not export recovery keys. After dire warnings that it would take a long time to decrypt the disk, it was complete in under a minute but, again, I suspect the disks weren't encrypted, pending login to a Windows account.

I downloaded the Debian 13 network install image and copied it to USB using `sudo cp /dev/sda` on another system running Linux.

Getting to the BIOS/Boot menus is a nuisance. Power on and keep pressing Esc or F10 quickly/repeatedly. I don't know when it checks but sometimes it notices and brings up the BIOS/Boot menu. Otherwise it starts Windows 11 again and I had to go round and try again: too many times.

I disabled secure boot. I might try re-enabling it later. I expect the laptop has the new Microsoft keys but haven't confirmed and don't want trouble when the old key expires. I don't need the secure boot security, given the intended use of the laptop.

Then I booted from USB and installed Debian. It took about half an hour, mostly due to my slow Internet connection, making it slow to download all the software. I installed basic system with XFCE desktop.

Now it boots to Debian by default but boot to Windows 11 works.

Wireless network works fine. I haven't explored all the other hardware, bluetooth, power management, etc. but I am optimistic that any problems can be resolved before too long.

It was quick and easy. It took less time to install Debian than for Windows to download all its updates and I don't think it is done yet: whenever I was running Windows 11 my network was overloaded despite me setting download limits on Windows Update for 0.5Mbps background an 1Mbps foreground.

Saturday, August 30, 2025

Starting X Server on Debian with systemd, xfce and lightdm

I have been reading about X server keyboard configuration and this lead me to wonder how the X server was started, with what arguments and configuration files, resulting in what keyboard configuration.

There are many posts that describe how to run X, xfce and lightdm but they are almost all in terms of what packages to install or reconfigure before rebooting. None that I found explain what configuration those packages create or the process of booting to bring up the X server and 'greeter' for login.

So I investigated the lightdm source code, finally coming to the following conclusions:

The lightdm package includes a lightdm systemd service which is started at boot, to run the lightdm executable.

The lightdm executable starts the X server: /usr/lib/xorg/Xorg.

After starting the X server, lightdm must start the greeter, which is provided by a separate package. Presumably it is a separate executable that creates windows on the display managed by the X server. But I didn't look for the code that does this.

I still don't know how the session setup after authentication is done but I expect that this can change the keyboard layout. It would be strange if different users were not able to use different keyboard layouts. One might prefer qwerty US English and another dvorak or French or German or whatever. That is, the keyboard layout should configurable as a per-user preference: optionally overriding the system default.

The Xorg command line does not specify the keyboard layout. The layout appears to be specified in /etc/X11/xorg.conf.d/00-keyboard.conf. At least, this seems plausible. I haven't edited it to confirm that it makes a difference or found evidence in logs that it did determine the layout.

There are still many unknowns and uncertain guesses, but I am happy enough with these conclusions to get back to investigation of the keyboard layout itself.

Monday, March 24, 2025

Armbian on NanoPi R2S Plus and RK3328 boot

I have several Friendly Elec NanoPi boards. Recently I have been working on my NanoPi R2S Plus because Armbian didn't have support for it and while it booted the Armbian images for NanoPi R2S, the WAN port and eMMC didn't work.

I have made changes to Armbian to support the NanoPi R2S Plus, including working WAN port and eMMC. These changes have been merged into armbian/build so it is now possible to build with BOARD=nanopi-r2s-plus, to build images for current and edge kernels.

When I started I was not familiar with armbian/build, u-boot or the rk3328 boot process. I didn't find much that gave a good overview, to put all the bits into context. At least, not in terms that I could understand and feel confident I understood them correctly.

The RK3328 Datasheet Revision 1.1 Mar. 2017 should be a reliable source but some of the English is a bit unclear.

The RK3328 has internal memory including BootROM (and Internal SRAM (36KB), utilized for the initial stages of boot, including initialization of DDR RAM and loading the subsequent boot programs.

The BootROM is, as far as I can tell, truly ROM. I found no indication that it can be updated. 

The Friendly Elec Wiki page for NanoPi R2S Plus describes the Unbricking Method. This is the worst case means to load software to the system, if it is not bootable by any other means. Systems based on the RK3328 (and several other RockChip SoC models) are often described as 'unbrickable'. What this means is that no software update can make the system completely unbootable. This is because to BootROM is truly ROM: it can't be updated to invalid code. And it supports loading software via USB OTG interface, regardless of the state of any other memory. So, as long as there isn't a hardware fault, the system can be booted and updated, even when it is otherwise unbootable.

Unfortunately, Section 12 Unbricking Method of the Wiki page begins with:

If the ROM is not installed correctly, causing the development board to become bricked, and you might not have the opportunity to reinstall the ROM via an SD card, you need to enter Maskrom mode to unbrick it by erasing the storage device.

This mislead me into thinking that the ROM could be updated to an invalid state. I spent a long time searching for information about how to update the ROM, but never found any.

My conclusion is that the BootROM is truly ROM: it cannot be modified. There are no images to be installed. There is no way to 'reinstall the ROM' via an SD card or otherwise.

The code that can make the system difficult to boot ('bricked') is that on the eMMC. The SD card can always be re-flashed on another system, with a good image. Or the SD card can be replaced. But the boot code in the BootROM checks for bootable code on the eMMC before it tries to boot from the SD card. If it finds data on the eMMC consistent with it containing bootable code, then it copies the code to RAM and executes it. If the code is bad, then the boot will fail and boot from the SD card will not be attempted, even if it contains good code. The Unbricking Method allows the eMMC to be completely erased, in which case the boot code on the BootROM will find it empty and will then attempt boot from the SD card. Thus the system becomes 'unbrlcked'.

The Rockchip RK3328 Technical Reference Manual Part 1 Revision 1.2 July 2017 (I haven't yet found a Part 2), describes the boot process in a bit more detail, in Section 1.2 System Boot.

RK3328 provides system boot from off-chip devices such as SDMMC card, eMMC memory, serial nand or nor flash. When boot code is not ready in these devices, also provide system
code download into them by USB OTG interface. All of the boot code will be stored in internal bootrom. The following is the whole boot procedure for boot code, which will be stored in bootrom in advance.

The boot code in the BootROM 'which will be stored in bootrom in advance' is, as far as I can tell, written once, by Rockchip, as part of SoC manufacturing. It is not possibly to modify it via the USB OTG interface.

The initial boot code checks for an ID Block at a particular location on each of the bootable devices. I don't yet know what the ID Block content is or where it is stored, but Armbian builds SD card images that contain it, so it shouldn't be too difficult to find.

The following devices are checked for an ID Block:

  1. eMMC
  2. external SPI Nor Flash
  3. external SPI Nand Flash
  4. SDMMC card

The devices are checked in this order and code is loaded to SDRAM from the first one with a valid ID Block, and that code is executed. Subsequent devices are checked only if preceding devices do not have a valid ID Block. This is how bad data on the eMMC can 'brick' the system: if the eMMC has a valid ID Block but does not have good boot code, the boot will fail.

If none of the devices have a valid ID Block then the USB OTG interface is initialized and this can be used to load a program to SDRAM. There are programs available that allow the various devices to be erased and written with new images. It is sufficient to simply erase the eMMC, external SPI Nor Flash and external SPI Nand Flash, in order to be able to boot from the SDMMC card. In fact, the NanoPi R2S Plus does not have external SPI Nor or Nand Flash, so it is sufficient to erase the eMMC, unless the system has been modified.

What the Technical Reference Manual doesn't mention, in its 'whole boot procedure for boot code' is that there is a way to skip checking the external devices for valid ID Block and jump straight to initialization of and loading code from the USB OTG interface.

Rockchip has a Wiki page Boot Option, that describes the boot procedures in somewhat more detail but it barely mentions the option to boot via USB OTG interface. Rather confusingly, in section Boot from eMMC, it describes how to update the eMMC via the USB OTG interface. It provides sample commands but almost no explanation of what the requirements are or how the commands work. But there is a link to 'Get the board into maskrom mode'

This Rockusb wiki page provides some description of this other boot option supported by the code in the BootROM.

The NanoPi R2S Plus provides a convenient 'Mask' key, to boot into Maskrom mode regardless of whether any of the usually checked storage devices have a valid ID Block. If this button is pressed while the system is booting up, the BootROM code will not find a valid ID Block on any device and will proceed to initialize the USB OTG interface and wait for commands there.

It looks like the Reset button holds eMMC Data 0 line low. Presumably this prevents the boot code from reading a valid ID Block from the eMMC. But what about the SPI Flash and SD card? If the button only affects eMMC, then if there is bootable code in those other devices when there is unbootable code in eMMC, then holding the Reset button may result in boot from one of those other devices, rather than USB OTG. Presumably this is why the Unbricking Method specifies to remove the SD card. As NanoPi R2S Plus doesn't have any SPI Flash device, if the SD card is removed and eMMC access is effectively disabled by holding Data 0 line low, then the boot program will not find any valid ID Block on any device and will proceed to the USB OTG interface.

Details of how the next stage of boot program is loaded from eMMC or SD card are in Wiki Boot Option and can be deduced from how Armbian prepares SD card images and how the armbian-install utility writes the eMMC for boot from eMMC. The U-Boot documentation also describes how images can be prepared - there are several options.

Being unable to modify the BootROM code is a limitation of the SoC. Not a problem as long as it works but if there are any bug or limitations in the SoC BootROM code, then the only solution will be to get a new SoC (practically, a new board) with a different, improved BootROM. For example, I see some reports of the BootROM code not handling SPI Flash very well. Not much of an issue for NanoPi R2S Plus, as it doesn't have wiring for SPI Flash, but NanoPi R2S has such wiring, despite it is delivered without a chip installed. But, if an SPI Flash chip is installed, then one must work around the limitations of the BootROM. In particular, I saw reports that if a large SPI Flash is installed, the interface switches from 3bit to 4bit address mode but reset doesn't switch back so on reset the SPI Flash cannot be accessed. Only a cold boot allows boot from SPI Flash.

The BootROM code is proprietary and not made available by Rockchip. But Tom Trebisky and Marcin Wozniac, at least, have extracted the BootROM code for investigation.

See ig3/trebisky-Rockchip and ig3/MarcinWad-RK3328-Uboot-SPI for clones of their GitHub repositories, including RK3328 BootROM images, and some cryptically documented code for extracing the BootROM code in the former.

See also dmkikushin-RK3328-Uboot-SPI for a somewhat enhanced version of Marcin's repo.

Marcin described some of his difficulties getting NanoPi R2S to boot from SPI Flash in his post to the u-boot mailing list 2022-12-22.

From u-boot  Thu Dec 22 20:15:53 2022
From: =?UTF-8?Q?Marcin_Wo=c5=baniak?= <marcin.wadowice () gmail ! com>
Date: Thu, 22 Dec 2022 20:15:53 +0000
To: u-boot
Subject: Rockchip RK3328 4-byte addressing problem in SPI
Message-Id: <f3451d5f-7b3b-e393-4ea7-370a86d45458 () gmail ! com>
X-MARC-Message: https://marc.info/?l=u-boot&m=167175500517093

Hello,

I would like to let you know how i've lost about 2 weeks because of lack 
of Rockchip BOOTROM documentation.

I tried to use Mainline Uboot to Boot NanoPI R2S using soldered SPI 
Winbond 25Q256 chip.

I had to make some patches in Uboot core files to make it work.

First one adds SPI boot device. File 
|arch/arm/mach-rockchip/rk3328/rk3328.c with adding: |

|[BROM_BOOTSOURCE_SPINOR] "/spi@ff190000", |const char * const 
boot_devices ||

Second was |arch/arm/mach-rockchip/spl-boot-order.c and last if statement:|

|if (!uclass_get_device_by_of_offset(UCLASS_SPI, node, &parent)) return 
BOOT_DEVICE_SPI;|

||

This patch is added because RockChip SPI driver is using UCLASS_SPI 
instead of SPI_FLASH so boot device wasn't connecting with right DM 
Driver rk_spi.c

Third one fixed SPL and it was added at the end: |drivers/spi/rk_spi.c
|

|DM_DRIVER_ALIAS(rockchip_rk3288_spi, rockchip_rk3328_spi);|

After that board booted successfully. Second bigger problem was a 
mistake and lack of RockChip Bootrom documentation.

I've soldered 32Mbyte Flash and didn't know that U-Boot in SPL was 
switching it's 3-byte address mode to 4-byte one to gain access to full 
32 Mbytes.

The problem was that board booted in cold-start but after issuing 
"reset" - it was going to MASKROM mode like no SPI was soldered or empty.

After loosing two weeks i figured that RockChip bootrom talks to SPI 
using only 3-byte addressing.

So leaving 4-byte switched by UBoot SPI chip made it unusable to 
RockChip Bootrom. I found this by dumping Bootrom and decompiling it.

I don't know if it's enough information to make a patch to MainLineƂ  (at 
least for SPI boot in RK3328).

Problem with 3-byte addressing is a complete different story.

Sorry for my "unproffesional" mail. I am writing this type of message 
for a first time.

Marcin

 

Follow the thread for all the followups but note this from Kever:

Sync with engineer working on these area, and get below: Yes, this "4-byte addressing problem in SPI" issue is in SoCs including rk3328, this only happen on SPI NOR size at least 32MB, most of customers only use smaller size SPI NOR. If 32MB+ SPI NOR is needed for the project, them we would suggest to use those SPI flash with 3&4 byte command set support; or else workaround to do the snor_deinit and exit_4byte_address_mode will needed before every reboot/hot reset in the system.

 And a further response from Michael:

I'm not sure this is a problem of the SoC (bootrom). The issue is either board design or flash usage pattern. If you enable 4byte mode and don't have a hardware reset pin (or don't assert it during board reset) you are likely in trouble. Have a look at JESD216D. The 16th DWORD lists 6 different software reset methods, there is even a "no software reset instruction is supported". That's also true for the "exit 4byte mode": there is no common way to exit it. You could try to read the SFDP tables. But that will only work for flash devices with (valid) SFDP. So in the general case, you are probably f** when you enable the 4 byte mode, boot from that flash and don't have a reset. As mentioned here, you should instead use the 4byte opcodes where possible. -michael

These details aren't important for my NanoPi R2S Plus, but they illustrate why it is sometimes important to have complete information about the board, including the boot code and how it initializes hardware. For the RK3328 SoC, it seems the only way to get the full details of the boot code is to extract it from the relevant system, disassemble it and figure out what it is doing, as Rockchip does not provide binaries or source code for the BootROM code. 

It would also be interesting to know:

  • If there are different versions of the BootROM code
  • What, if anything, the BootROM code writes to console
  • How it initializes the SoC and external devices
  • How it checks for the ID Block
  • How it loads the next stage software and executes it
  • The full implementation of the USB OTG interface

 

Labels