Installing Snap under Debian

The traditional way of installing software under Linux, specifically under Debian, has been, to use a package manager which accesses global repositories of software, and sometimes, to use a graphical front-end to the same package manager.

Thus, under Debian the package-manager command-line to install <somepackage> would be:

apt-get install <somepackage>

But, if we have “Synaptic” installed, that is a graphical front-end for the same set of commands, that I’ve come to like and trust. If we do not have Synaptic installed but wish to, then the way to install it from the command-line would be:

apt-get install synaptic

But what has happened in the Linux world is that this method of installing packages has become ‘boring’. There exists software which is not listed in the package repositories, and which Synaptic will therefore also not find in response to explicit searches, but which users will want to install, simply due to the evolution of software. One reason for which this software is not listed could be, that it would be tedious for package maintainers to compile, but another could be, the fact that some software is proprietary in nature, or at least partially so, so that to include it in the open-source repositories may in some cases be illegal.

And so, even Linux users will sometimes seek other ways of installing specific software, which they already know exists. And another way to do so has traditionally been, to compile this additional software from source code. But, sometimes the out-of-tree software we wish to install needs to come in the form of binaries. A recent development in this field has been, the emergence of a software-management system called “Snapcraft“. It’s based on the ‘Snappy’ package manager, that was developed by Canonical.

I’m going to assume for the moment that the reader already understands the existence of security implications, in installing binaries from anywhere except the package manager, together with the official repositories, even when those binaries are to be sandboxed. And I’m not going to explain those in this posting.

One reason for which Snappy exists, is the fact that some of the more-traditional installation scripts, for out-of-tree binaries, needed to make arbitrary assumptions about the organization of the Linux computer, and there are many different versions of Linux, which eventually lead to incompatibilities with the binary software. Their developers have had to make assumptions about how the customer’s computer was configured, and those assumptions will eventually be wrong for some versions of Linux. Snappy can circumvent this limitation, or so its developers claim. Whether it truly can or not remains to be seen, as Snappy is still in its infancy as I’m writing this. It could be that I just jumped in with a fashion trend, which may turn out just to have been a fad, as seen several years or decades in the future.

But this posting will continue on the assumption that the reader has a Debian Linux computer, but that he wishes to install Snappy anyway. Snappy was designed more with Ubuntu in mind, but is also available for Debian Linux.

(Updated 6/15/2019, 14h20 … )

Continue reading Installing Snap under Debian

Solving the recent Firefox ESR problem, with the Expired Extension Signing Certificate.

One of the problems that befell (almost all) Firefox users, midnight from May 3 to May 4, 2019, was, that many extensions which we had installed had suddenly become deactivated because an Intermediate Certificate used to sign those extensions, had simply expired. Apparently, somebody overlooked that status of the certificate in question.

To remedy this situation as quickly as possible, Mozilla offered to publish a “Study”, which is a kind of project that Firefox users can subscribe to, and the purpose of which usually is, to allow Mozilla to conduct experiments on users’ browsers. This study had as purpose however, just to install a renewed certificate.

One important piece of advice is, ‘If you are still experiencing this issue, Do not try to uninstall and reinstall the extensions. Doing so would delete all the data stored with the extensions, while simply to have them disabled, and then to have them re-enabled, will allow most extensions to keep their stored data!’

Therefore, to receive this fix, what Firefox users were advised to do, was to go into ‘Tools -> Preferences -> Privacy & Security’, and there, to Enable Studies. The problem which I experienced myself was, that this advice was not narrowed enough, for Linux users with ‘Firefox ESR’. First of all, the Linux versions of Firefox have their Preferences sub-menu under ‘Edit’, not under ‘Tools’, but that was the least significant problem. What was worse was that, under my Linux distribution, the option we were advised to check was greyed out, and could not be checked:

Screenshot_20190505_075343

(Edit 5/10/2019, 22h10 : )

Because as of this time, under Debian / Jessie as well as under Debian / Stretch, the official fix for this problem has been pushed through the package repositories, it’s no longer advisable by any means to apply the workaround described here. However, the update under Debian / Stretch was a bit slow in coming, for which reason this workaround served me well.

(End of Edit.)

However, I was able to get this feature of Firefox ESR to work anyway. And what follows is how I did that…

(Updated 5/06/2019, 16h00 … )

Continue reading Solving the recent Firefox ESR problem, with the Expired Extension Signing Certificate.

Finally getting the LanguageTool Grammar-Checker to work under Debian.

One of the software products which Linux has traditionally been lacking in, is grammar-checking software, that runs off-line. And one such package that I’ve been keen on getting to work, under Debian / Stretch as well as under the older Debian / Jessie, is LanguageTool. Why this LibreOffice extension? Because I would mainly want German and English support, while the product also offers some French support, the last of which can always come in handy in a Canadian province, which is officially French-speaking. The need can always arise, to write some letter in French, and a letter in which the grammar will need to be correct.

There do exist other proprietary solutions, but none which add full support for German.

When I write that I’ve been ‘keen on getting (this) to work’ , I’m referring to the fact that this extension can be a bit temperamental. As I was activating version 4.3 on my Debian / Jessie laptop ‘Klystron’ , I noticed that I had versions 2.3 and 3.8 already-downloaded there, that were left on my hard drive from past, forgotten failures. So, what I learned while installing v4.3 on ‘Plato’ , my main, Debian / Stretch computer, would be put to the test. If the attempt to install v4.3 on ‘Klystron’ also, worked on my first try, then these would be valid observations made, when previously working to get the same version working on ‘Plato’ . And my result was, that I could get v4.3 to work on ‘Klystron’ as well, on the first try! :-D

screenshot_20181222_212045

( Screen-Shot from the computer ‘Plato’ . )

During my recently-failed attempt to get this extension working on ‘Plato’ , I had gotten to a series of error-messages while clicking on ‘Tools -> LanguageTool -> Options…’ , that amounted to Java Null-Pointer Exceptions. Usually, such exceptions would indicate some serious programming error. But what I found was that I could get the extension to work, if I followed 4 basic guidelines:

(Updated 12/25/2018, 14h20 … )

Continue reading Finally getting the LanguageTool Grammar-Checker to work under Debian.

Integrating Sage with LyX

I have been interested in the LaTeX typesetting system, but not in actually learning the extra syntax. And so I’ve been using a WYSIWYM GUI named ‘LyX‘. The .TEX-Files LyX exports are suitable to creating HTML Files, which in turn can contain typeset Math, by way of scripts, that provide MathJax code.

But then one compromise this has meant for me was, that I could either typeset Math which I had written myself, or that I could do Computer Algebra, the latter through the use of ‘wxMaxima’, which has its own system of exporting to HTML. But so far, I could not do both in one document.

Well, now that I have ‘SageMath’ and ‘SageTeX’ installed, I can do both within the same document. It’s possible to integrate SageTeX into LyX. The following is an article which explains how to do that, under the assumption that the user has both SageTeX and LyX installed:

https://wiki.lyx.org/Layouts/Modules#toc7

There is an important way in which I needed to modify the instructions however, to get the two working. First of all, there is a list of files to download – LyX does not support SageTeX out of the box – that the article above links to. Out of those files, ‘setup.sh’ is absolutely useless on a modern Linux computer. The following files from the repository above are essential:

  1. sage.module
  2. preferences
  3. compile-pdf-sage.sh
  4. example.lyx

The file ‘preferences’ needs to be edited, in that its last line needs to be uncommented.

The file ‘compile-pdf-sage.sh’ needs to be edited, in that the first two lines need to be commented out, and the next three lines which are commented by default, need to be uncommented. Then:

 


(As user:)

$ mkdir -p ~/.lyx/layouts
$ cp sage.module ~/.lyx/layouts
$ cat preferences >> ~/.lyx/preferences

(As root:)

# cp compile-pdf-sage.sh /usr/local/bin
# chmod a+x /usr/local/bin/compile-pdf-sage.sh


 

Then, within the GUI of LyX, one gives the command ‘Tools -> Reconfigure’. One shuts down and restarts LyX. Next, one opens ‘example.lyx’ to test the setup. The following is the document which I finally obtained (successfully), which was provided by the Web-site above (not written by me):

http://dirkmittler.homeip.net/sg_lyx_1.pdf

(Update 2/22/2019, 2h05 : )

I suppose that I should warn other users, that, even when one has ‘installed’ this extension to LyX properly, it will not cause SageMath figures to appear in the editing view. Instead, the editing view will contain the actual SageTex code. But, when one clicks on ‘File -> Export -> PDF (pdflatex+sagetex)’, then, a PDF-File will be output that contains the figures, such as the PDF File above.

(Update 2/24/2019, 15h15 : )

I can also elaborate that, the editing of the two text files which I recommended above, merely has as purpose, to enable the use of the module in a single-step process, which is by default written to work in a two-stage process.

The way in which the author of the module intended for it to be used was that users should click on ‘File -> Export -> SageTex’, and obtain a LaTeX File, which they’d need to compile from the command-line, to arrive at an actual document. The way to do that would have been, to run the ‘pdflatex’ command on it, then, to run the ‘sage’ command on the .sage File that results, and then, to run the ‘pdflatex’ command on the original .tex File again. The supposed advantage of that would have been, that users could also edit the SageTex File output, before compiling it, ?

But the way the module was originally written – by the same author – allows for a PDF File to be output, with a single click from within LyX, when those two text files are edited as he recommended, and as I wrote above. I felt that it would be more satisfying both for me, and perhaps for readers of this blog, to be able to obtain a document in one click. And when the two files have been edited like that, the option still exists within the GUI, to export to SageTex format, which can still be compiled from the command-line…

I should add that, if the goal was to compile this sort of file from the command-line, then, it becomes necessary to obtain a Sage-File, if need be from the .TEX-File, and then actually to run ‘sage’ on the Sage-File, at which point Sage is performing its Math. Only after that, can the corresponding .TEX-File be compiled for a second time, into a document that displays correctly. If the step was omitted, to run Sage on the Sage-File, then at no point will the final document actually contain solved Math.


 

I suppose that a further question could be asked which would be:

‘In the one-step process, “pdflatex” is used twice, as it should be. But if we wanted output in some other format, would it be possible to Export the document from LyX as a SageTex document, and then merely to run “latex” on it, where appropriate?’

And the short answer is, ‘Only if the .TEX-File is edited accordingly.’ The slightly longer answer would be:

As it stands, the .TEX-File will export images into a separate folder, as .PDF-Files, that contain the plots. The simpler ‘latex’ command cannot use anything other than .EPS-Files as images. So the .TEX-File would need to be modified, to generate the .EPS-File (by deleting any occurrences of ‘[pdf]’), and then in principle, EPS Images should be generated, alongside PDF Images, and the .EPS-Files used.

Just to make the above exercise more confusing, a .DVI-File will be output, which ‘xdvi’ might not preview correctly, in that it will seem to contain a blank rectangle where the plot should be. The error message is then output by ‘xdvi’, that ‘gs’ doesn’t recognize the output device ‘x11′. Yet, when ‘dvips’ is next run on the .DVI-File, a correct .PS-File results, that contains the plot.

This modern problem with ‘xdvi’ can be solved, by installing the package ‘ghostscript-x’, which enhances the way ‘gs’ works, and also allows ‘xdvi’ to preview the .DVI-File properly.


 

Further, a plausible question could be:

‘What will happen if I simply click on “File -> Export -> Sage” ?’

And AFAIK the answer would be, that the file output only contains the Math for Sage to solve. The rest of the LyX Document, with text etc., will not be contained in that file.

AFAIK, That export option is ultimately only useful, if ‘File -> Export -> SageTex’ is also used.


 

(Update 2/24/2019, 16h20 : )

I suppose that yet another plausible question to ask might be, ‘What advantage did the author see, in a two-step process, that requires manual compilation?’

The best answer I can think of would be:

The actual step of running ‘sage’ on the Sage-File, is also the slowest. A situation is conceivable in which the actual Math to solve is very complex, but in which minor editing of the document is needed, after which to recompile would not require that the Math be redone.

For the purposes of this posting, the computer is fast, the Math is still straightforward, and the reader needs an easy-to-follow guide on how to get the integration of ‘SageTex’ into ‘LyX’ working.


 

(Update 2/25/2019, 8h45 : )

Since some of my readers may want to obtain a preview of their document, before actually exporting the final PDF, if the configuration files have been edited as I wrote, the way to do that is ‘Document -> View (Other Formats) -> PDF (pdflatex+sagetex)’.


 

(Update 6/09/2019, 18h05 : )

I suppose that one idea users might get would be, that SageTex integration into LyX can make LyX a good, graphical front-end to Sage. And I suppose that this idea will be true, as long as the user never makes any syntax errors, in the Sage commands, either in the ‘sageblock’ or the ‘sagedisplay’ paragraphs. ;-)  When using the actual ‘sage’ program either from a text-command-console, or from within ‘Jupyter‘, then a benefit will be that SageMath will output error messages, whenever it was unable to evaluate an expression for any reason.

If some such error takes place within LyX, then, the value to be displayed, finally, will simply consist of two question marks. This situation is not to be confused with the result, of two question-marks with a yellow background, which indicate an error in the SageTex integration into LyX, or just, in the encoding of the final document. But simply given two question marks, the user would need to ‘guess’ at where his error was, within the actual Sage code, that Sage could not evaluate. Further, SageTex has the quirk, that it can sometimes generate final documents, in which some but not all the Sage outputs seem to be displayed, even though Sage crashed at some point, when the LyX document was being processed. In short, this can be visualized as partial outputs being stored, from a previous attempt to render the entire document.

LyX remains a convenient way to typeset Sage output – especially plots – as parts of a complex document, on the assumption that the commands given to SageMath contain no errors.

Enjoy,

Dirk