Blog-Archiv

Samstag, 28. November 2020

Ubuntu 20.04 Upgrade when Packages Have Been Kept Back

Ubuntu releases a new long-term-supported (LTS) distribution all two years. The 20.04 version (released April 2020) will be maintained until 2025. In LINUX, "update" means short-term- and "upgrade" means long-term-actuation. Today on this foggy, cold and lazy Saturday I dared to do an upgrade of my Ubuntu 18.04 laptop.

As I always save my data after I've worked on them, I did not do a backup (which is recommended). The "Software Updater" (update-manager) showed up some time after logging in, I clicked it to update. Then I started it again and pressed the "Upgrade" button for installing the new distribution.

I waited. Nothing happened. One minute, two minutes, ... they need lots sometimes ... launching the system monitor showed that nothing is going on. No error message, no info message, no update, no upgrade, nothing.
Yes, it is an open-source operating system:-)

Seaching for the Upgrade Problem

I began to read on the internet and experiment on command line.

$ sudo do-release-upgrade -d -f DistUpgradeViewGtk3 --allow-third-party

A graphical user interface came up telling me that I must update all packages first. Haven't I done this just before? So, once again:

$ sudo apt update
....
$ sudo apt upgrade
....
The following packages have been kept back:
  libsane-common libsane1
....

I overlooked the message about packages that have been kept back. I did a cleanup and then tried again the distro-upgrade:

$ sudo apt autoremove
....
$ sudo do-release-upgrade -d -f DistUpgradeViewGtk3 --allow-third-party

Again the graphical UI telling me that I must update all packages first. I tried out another upgrade-command:

$ sudo apt-get dist-upgrade
....
The following packages have been kept back:
  libsane-common libsane1
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.

Even after this the upgrade did not work, telling me again that I have to update all packages first.

Now I assumed that the kept-back packages are the problem. I remembered that I once fixed, compiled and installed the "xsane" scanner software and protected it against system upgrades to not lose the fix. Now I had to update these libraries explicitly, possibly losing my fix (fortunately I wrote a Blog about it, so I can repeat it). Here is the force-update command:

$ sudo apt-get install libsane-common libsane1
....

After this, the upgrade through update-manager worked.

For about 90 minutes it installed packages on my 4 cores with 8 GB RAM. Many times the grub bootloader was updated, many times /boot/initrd.img-5.4.0-54 was generated. When shutting down it showed the Ubuntu logo together with the laptop's vendor logo (in my case "DELL"). I was thinking "Will I ever see you again?" ...

Ubuntu 20.04

On computer reboot I saw no Ubuntu/Linux version in my BIOS boot menu. You still have to edit /boot/grub/grub.cfg when you want such.
If you want console output instead of the splash screen during startup, also replace the line

    linux /boot/vmlinuz-5.4.0-54-generic root=UUID=your-linux-partition-uuid ro quiet splash $vt_handoff

by

    linux /boot/vmlinuz-5.4.0-54-generic root=UUID=your-linux-partition-uuid ro

in /boot/grub/grub.cfg.

Startup has not become faster. Was fast once, but currently is no comparison to WINDOWS 10.

The desktop environment came up with a black mouse cursor (was white in 18.04), black top bar, and a grey semi-transparent side bar. Graphics seem to have improved, very sharp contours.

My auto-login was removed, I had to re-enable it in Settings under "Users".

Desktop screenshot:

Like on 18.04 upgrade all desktop icons were disabled, but with right mouse context menu I could "Allow" them. Launching a graphical application then from one of these icons showed white text color on light-gray background in title-bar, not readable, but some minutes later the title-bar background magically turned to black.

Desktop side bars are now possible on more than one screen. With "Auto-hide the Dock" (Settings -> Appearance) activated they are visible anyway, they hide only when some window overlaps them. When having configured a second side-bar on right monitor, and a full-screen app is on right monitor too, moving the mouse to the left monitor is kind of impossible. The side-bar pops out any time the mouse is over it , and the mouse hangs there. I switched off this feature immediately.

The Alt-Tab key (switch between application windows) did not work any more. It was changed to Super-Tab, I had to restore that in Settings - "Keyboard Shortcuts".

The Constant LINUX Screenshot Trouble

A good screenshot utility is an indispensable work tool. You need it for quickly and precisely communicating bugs on user-interfaces. Adding annotations on such screenshots is a must, point to the fail with an arrow, or frame it with an ellipse. The most useful graphical element is a speech bubble that tells the problem and points to it.

Linux screenshot tools were never sufficient. I found out that Shutter (my previously installed screenshot tool) had disappeared silently from my side bar through the upgrade, so I had to search for a replacement.

Flameshot

A very unusual UI, super-modern. You can add annotations, but you can not modify, move, size or remove it afterwards. There are just "Undo" and "Redo" actions. There are lines, arrows, circles, full or empty rectangles, and text, but no speech bubbles. You must find out that the SPACE key slides in a left-side panel, providing a generic "Thickness" chooser where you can size the currently written text or figure. Edit buttons are arranged around the screenshot image in different layouts, depending on the dimension of the shot, which is a little bit confusing, because you need to find the "Save" button on every screenshot newly among many many others.

Following sceenshot shows the launcher in top-bar:

This comes up when you click "Open Launcher":

Some short help:

Ksnip

Hard to remember name. Ksnip has a better editor than Flameshot. It lets modify, move, size or remove markup after it has been drawn (if you find the "Select" button). The concept is the same as in "Greenshot" (a free WINDOWS tool), but Ksnip also has no speech bubbles.

Conclusion

Happy that my upgrade worked. Upgrades are indispensable. If you stay back too long, you will be lost. We depend on the Internet, the Internet depends on web-browsers. Browsers are evolving fast and change all the time. As they open more and more hardware possibilities, they depend on a current operating systems.

I am really grateful for this free operating system. I've been using it for 23 years now, and always preferred it to WINDOWS. But yes, I am a developer.




Samstag, 21. November 2020

Java Module Types

The Java Platform Module System (JPMS) defines different types of modules. This is to ease the migration from old CLASSPATH bound projects to the new module-path way. In an ideal world, just real JPMS modules exist, no other types. But, as some open-source libraries are not maintained any more and may never become modules, it is questionable whether that world will ever exist.

Type Designations

Module Type Description Can Access No Access To
Java Modules
(Named Modules,
Explicit Modules)
One or more Java packages that have a module-info.java descriptor in their root directory (dependency definitions).
Sub-types are ...
System Modules Java runtime libraries like java.base that need no requires statement to be available
Application Modules whatever your application defines as module
Service Modules a module that uses the provides keyword
Open Modules a module that uses the open keyword to allow reflection on its classes
System modules and all modules that it requires (in case it was not prohibited via exports somepackage to somemodule), also Automatic modules that it requires The Unnamed Module
Automatic Modules A Java archive (JAR) file without module-info.java that has been put on the module-path. All its packages will be exported automatically and are open for reflection. It has an automatically generated name, built from the basename of the JAR file, by which it can be required in a named module.
Legacy JARs go here.
All exported packages of modules on the module-path, also the Unnamed Module. Module packages that were not exported
The Unnamed Module Everything that is on CLASSPATH. All packages get exported automatically and are open for reflection. This module has no name, thus it can not be required by modules. All exported packages of modules on the module-path, also Automatic modules, and all packages on CLASSPATH. Module packages that were not exported

How to Use

The JDK runtime library has been modularized to System Modules. Any application that wants to upgrade to Java 9 can use them by going to the Unnamed Module, together with all its JAR dependencies (CLASSPATH). For that it is not even necessary to define a module-path.

The only drawback is the "Split Packages" constraint. Java compilers above version 9 don't accept two packages with the same name on CLASSPATH. Typical error message is

  The package javax.xml.transform is accessible from more than one module: <unnamed>, java.xml

when you have e.g. xml-apis.jar on the CLASSPATH as transitive Maven dependency. Normally this can be solved with Maven <exclusions>. The "Split Packages" constraint detects different versions of the same library, a big problem of CLASSPATH-bound applications.

As soon as you modularize your application, all JAR dependencies must go to the module-path as Automatic Modules and have to be required in module-info.java, because Named Modules can not access the Unnamed Module (CLASSPATH) any more. Running the application then will not work without --module-path option. Mind that the module-info.java descriptor can be extended through JVM commandline options like --add-modules, --add-exports, --add-reads.

The "Split Packages" constraint would not work when both CLASSPATH and module-path are active. If there were two packages with same name, one on CLASSPATH and one on module-path, the one on module-path would be silently preferred.

Conclusion

The different module types make it easy to migrate applications to a Java version above 9. CLASSPATH is represented by the Unnamed Module, Named Modules are intended to be on module-path. Like the CLASSPATH, the module-path plays a role at both compile-time and runtime. In future it will replace the CLASSPATH.

JPMS modules are made to be checked at compile-time. They can not be replaced at runtime like OSGI plugins can, they can not be started or stopped, and they do not support versioning. Their only runtime-bound behavior is the service providing via provides and uses.




Samstag, 14. November 2020

Good Terms

Terms are the foundation of communication. Terms appear in documentation, and if you are lucky, they are explained in a glossary. If you are extremely lucky, your company maintains a term dictionary that lets define words and abbreviatons online, discuss them, link them, and adapt them over time, representing some kind of common sense for the company's business. Reality is, most of us are neither lucky nor extremely lucky:-(

We find out how important term definitions are when we have to maintain source code using business terms that were not clearly defined at the time of writing. Developers invent their own terms and acronyms when they were not accurately introduced into the business. These inventions tend to be purely technical, in a way that you can not read the business from such source code any more. Events and processing mixed up with business events and workflow processes.

People prefer jargon to simple language. Maybe they want to protect knowledge by using words that is known to a limited number of persons only. Some say that acronyms are the only way to have a short description for an abundance of semantic. Some say that it is the only way to bind a very general word to their according context. No science without scientific language. Whatever the motivation for business language is, we need to map it to normal language somewhere.

Glossaries

The simplest way for binding a word to a meaning is to have a table with two columns, left the term, right the definition (description, explanation):

TermDefinition
JargonThe specialized terminology associated with a particular area of activity.
........

Mind that you should keep the terms in alfabetical sort order, else people won't use the glossary.

Adding terms with the same meaning in a "Synonyms" column is useful:

TermSynonymsDefinition
DescriptionExplanationThe pattern of narrative development that aims to make vivid a place, object, character, or group.

The "Term" column should contain just one single word or word group, the "Synonyms" column can contain several comma-separated terms.

Abbreviations (acronyms) for business terms are frequently used:

TermSynonymsAbbreviationsDefinition
DefinitionDescription, ExplanationDEFA statement about the meaning of a term (word, phrase, or set of symbols).

"Term" should be a sortable column. If "Synonyms" and "Abbreviations" contain just one word, this would be useful for them too.

As we have so many languages on this planet, it is nice to provide a commonly known one. Here is a German glossary with English term translation:

BegriffSynonymeAbkürzungDefinitionEnglish
AbkürzungAkronymAbk.Verkürzte Darstellungsform eines Wortes oder einer Wortgruppe.Abbreviation

Context and Audience

To keep a glossary simple we need to know its context or targeted audience. Synonyms may be interesting for business experts only, abbreviations just for developers. Glossaries that also contain a "Context" column may become too big.

It makes sense to put abbreviations into their own table, and keep them apart from terms. Mostly they are clearly distinguishable from normal words, and they are more often reason for a search than words.

Mind that abbreviations often are used like normal words, think of "CV" (curriculum vitae).

How to Write Definitions

  1. Don't use the left-side term in the right-side definition, this would be self-explanatory!

  2. Don't use left-side terms in definitions at all. Explaining "definition" by "description" and "description" by "definition" leaves the reader alone. Use plain language, understandable by the majority of people.

  3. Add delimitations of the term.

  4. Give examples, they convey certainty about correct understanding.

  5. Add pronounciation, because people will talk about the terms, and they should understand each other. For example the computer tool curl is actually pronounced "kurl", pronouncing "see-url" may lead to misunderstandings nowadays ...

  6. In an abbreviation glossary, always give the long form of the acronym, because people would remember it better when seeing the parts it was created from (WYSIWYG = What-You-See-Is-What-You-Get).

Who Reads Glossaries

Nobody wants to read glossaries. You go there when you need to. Thus we should link terms to the glossary wherever they occur. In case your documentation system supports hyperlinks this may be easy. Some Wikis even support automatic term linking.

Another way is a cross-reference index that provides an alfabetical list of terms with the page numbers where they occur. Well known for printed books.

Conclusion

Words live when used by people. You can keep them alive by relating them to some meaning or context well-known to all involved persons. Glossaries are the simplest way to share knowledge. What about term-oriented software development?