Monday, 19 October 2020

Removing non-Latin fonts from Mint/Ubuntu

The default installation of Mint (now 20) includes a wide range of fonts for non-Latin alphabets - Chinese, Gujarati and so forth.  It's excellent that Ubuntu provides these, of course, but it seems odd that they are automatically included in an installation carried out after specifying a Latin-character language (UK English in my case).  It's also rather inconvenient because lists of fonts (in word-processing applications, for example) contain large numbers of fonts which will be inappropriate for most UK, US and European users virtually all of the time. 

During my recent Mint upgrade I spent a bit of time creating a list of the font packages which can be removed.  With one or two exceptions the list I came up with is this:

fonts-beng fonts-beng-extra fonts-gubbi fonts-gujr fonts-gujr-extra fonts-guru fonts-guru-extra fonts-kacst fonts-kacst-one fonts-kalapi fonts-khmeros-core fonts-lao fonts-lohit-beng-assamese fonts-lohit-beng-bengali fonts-lohit-deva fonts-lohit-gujr fonts-lohit-guru fonts-lohit-knda fonts-lohit-mlym fonts-lohit-orya fonts-lohit-taml fonts-lohit-taml-classical fonts-lohit-telu fonts-mlym fonts-noto-cjk fonts-pagul fonts-sahadeva fonts-samyak-deva fonts-samyak-gujr fonts-samyak-mlym fonts-samyak-taml fonts-sarai fonts-sil-abyssinica fonts-sil-padauk fonts-smc fonts-smc-anjalioldlipi fonts-smc-chilanka fonts-smc-dyuthi fonts-smc-gayathri fonts-smc-karumbi fonts-smc-keraleeyam fonts-smc-manjari fonts-smc-meera fonts-smc-rachana fonts-smc-raghumalayalamsans fonts-smc-suruma fonts-smc-uroob fonts-tamil fonts-telu fonts-telu-extra fonts-thai-tlwg fonts-tibetan-machine fonts-tlwg-garuda fonts-tlwg-garuda-ttf fonts-tlwg-kinnari fonts-tlwg-kinnari-ttf fonts-tlwg-laksaman fonts-tlwg-laksaman-ttf fonts-tlwg-loma fonts-tlwg-loma-ttf fonts-tlwg-mono fonts-tlwg-mono-ttf fonts-tlwg-norasi fonts-tlwg-norasi-ttf fonts-tlwg-purisa fonts-tlwg-purisa-ttf fonts-tlwg-sawasdee fonts-tlwg-sawasdee-ttf fonts-tlwg-typewriter fonts-tlwg-typewriter-ttf fonts-tlwg-typist fonts-tlwg-typist-ttf fonts-tlwg-typo fonts-tlwg-typo-ttf fonts-tlwg-umpush fonts-tlwg-umpush-ttf fonts-tlwg-waree fonts-tlwg-waree-ttf fonts-yrsa-rasa

If you want to do the same, use the list above with sudo apt remove.

Friday, 9 October 2020

NEC Multisync 1970NX display not centred, no controls to move it

I have a trusty NEC LCD1970NX 17" display which is in regular use with the domestic Linux workhorse, connected via the DVI interface.  Recently I've been building a Windows 10 machine, for occasional use, which will be connected to the same monitor; for a number of reasons the new machine will be connected via the VGA socket on the display: there's a handy "select source" button on the screen so I can switch between the two when necessary.

But when I brought the Windows system up, the display image was offset about 15mm to the right: quite unusable.  Worse, the "Menu" button on the display did not bring up the image-adjustment controls referred to in the manual: instead it offered only brightness/contrast adjustment.

The solution, admittedly a sledge-hammer-scale fix for what should be a nut-sized problem, was this:

  • On the Windows machine, install NEC's "NaViSet Administrator" application, a 200MB-odd download from NEC.  This is a tool for systems administrators, allowing them remote access to NEC displays and projectors across a network.
  • Also install the "DDC/CI WMI Provider" client on the same machine; this is the component that talks to NaViSet to provide the control functions.  Without it you get no information about the current state of the monitor, and can make no changes.
  • Fire up NaViSet, again on the same machine, add the PC to the network, navigate to it and find its display.
  • There is now a "Geometry" tab which allows modification of the image position on the screen.  For me the "Auto Setup" function did the trick.

Here's what the NaViSet window looks like:



Monday, 26 August 2019

LibreOffice can't open files on NFS server

Trying to open a LibreOffice spreadsheet on an NFS-mounted directory within my home network.  LibreOffice comes up with "locked for editing by unknown user". 

Many posts will tell you to look for a hidden lock file in the same directory: I had none.  In fact there were no files anywhere of any consequence with the names *lck* or *lock*.

I found a comment on an Ubuntu LibreOffice bug 1751005 which corresponded with some AppArmor messages I found in the local client log, and took the requisite action: I still had the problem.  I'm now running LibreOffice 6 so that action may have been unnecessary, actually.

I tailed the server log and attempted the failing access: instantly there came a lockd: cannot monitor myclient message.

Finally I found the problem: rpc-statd.service was not running on the Ubuntu 18.04 server which was providing the NFS mounts.  I enabled the service and all is now well.

Friday, 14 December 2018

Why has emacs stopped running in a window?

I use several editors (and also Eclipse, which has its own) and manage to be reasonably productive with all of them, but all other things being equal emacs is my favourite.I have it installed as an icon on the Linux Mint start bar.

Imagine my annoyance and distress when yesterday clicking on the emacs icon did nothing; no error message, no window display, just a momentary blink and then nothing.  emacs would run in a terminal window, but not in its own emacs window on the desktop.  Reinstalling the "emacs" package didn't help.

I traced the problem to a mistake I made yesterday.  I have a list of packages to install on a remote Ubuntu server, which has no X windows installed and which runs headless.  In error I typed the "apt install" command into a window which was not ssh-ed into the local machine, thus installing all those packages on my local laptop (the one where emacs was failing to run).  I do my development and testing locally so in fact installing those packages was a no-op, with one important exception: I use emacs on the Ubuntu Server system, but to avoid problems install only the terminal-only version, called emacs-nox.  So of course I had installed emacs-nox on my laptop, which had faithfully done what was required of it: stop emacs running in an X Window.  I purged it, reinstalled emacs and all was well. 

Saturday, 6 January 2018

A run-once system for linux

Current development of the Linux image for the community centre I'm involved with requires me to be able to carry out tasks just once (a "run once" capability). Moreover, I have need to run such tasks at three different stages in the overall process:
  1. At start up before the network is active (to manipulate network definitions)
  2. At start up after the network is active but before users log in (in my case to incorporate the IP address into a workspace wallpaper)
  3. At shut down, after the users are logged off but while the filesystems are still mounted.

The run-once script

I have a run-once script /usr/local/bin/runonce, based on one I found here.
RUNONCE_DIR=$1
[ -z $RUNONCE_DIR ] && RUNONCE_DIR=/etc/local/runonce.d

[ ! -d $RUNONCE_DIR/ran ] && mkdir -p $RUNONCE_DIR/ran

for FILE in $RUNONCE_DIR/*; do
    [ -d "$FILE" ] && continue
    COMMAND_NAME=$(basename $FILE)
    logger -it runonce -p local3.info "Running: $FILE"
    "$FILE"
    mv "$FILE" "$RUNONCE_DIR/ran/$COMMAND_NAME-$$-$(date +%Y%m%d-%H%M%S)"
    logger -it runonce -p local3.info "Ran: $FILE"
done


I use it in all three places, with three directories /etc/local/runonce-a.d, /etc/local/runonce-b.d and so on.  The parameter to the runonce job specifies which one to use.

The three jobs are then controlled by systemd unit files (I'm just getting used to systemd ..), as follows:

runonce-a.service

# Run-once service; runs any executable in /etc/local/runonce-a.d
# Ensuring that it runs before the network is active
[Unit]
Description=Run once programs (pre network)

Before=network-pre.target
Wants=network-pre.target

[Service]
Type=oneshot
ExecStart=/usr/local/bin/runonce /etc/local/runonce-a.d

[Install]
WantedBy=network.target

runonce-b.service

# Run-once service; runs any executable in /etc/local/runonce-b.d
# Ensuring that it runs after the network is active
[Unit]
Description=Run once programs (post-network)

After=network-online.target
Wants=network-online.target

[Service]
Type=oneshot
ExecStart=/usr/local/bin/runonce /etc/local/runonce-b.d

[Install]
WantedBy=multi-user.target

runonce-c.service

# Run-once service; runs any executable in /etc/local/runonce-c.d
# before the system is shut down or rebooted.
[Unit]
Description=Run once programs (before shutdown)
RequiresMountsFor=/home

[Service]
Type=oneshot
ExecStop=/usr/local/bin/runonce /etc/local/runonce-c.d
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target


It took quite a while to assemble the various bits of this from around the web; hope it helps someone else.

Wednesday, 12 October 2016

Windows 7 PC can't see anything on the network

If you have this problem and go searching on the web you'll find a huge number of posts: it's terribly common.  So common that you'd have thought that Microsoft would have fixed it, but there we are.

Here's my experience today, which isn't as far as I can see the same as any of the twenty or so hits (none of them saying anything definitive) which I looked at this morning.

Symptoms

  • Clicking on "network" showed only the local machine, the defined network printers, and an icon representing the NAS to which I was trying to get access.  Not the sort of icon that allows you to get at the files, though.
  • Opening a command window and pinging the device by name (I haven't bothered creating a hosts file) worked fine, so the TCP/IP parts were working.

The cure

I can't call this a "fix" since it makes no sense.  In order to check whether some firewall rule was dropping the relevant traffic I turned the firewall off.  Bingo!  The network appeared.  "Ah, a firewall problem," I said to myself.  "Now what on earth is causing that?"

I turned the firewall back on again, and the network was still visible.  Job done ... but why?  Oh well, Windows is like that. 

Friday, 30 September 2016

You told Windows 10 that your network was "public": what do you do now?

When you connect to a new network Windows 10 will ask you whether it's "private" or "public".  It's clear that some people don't understand the real intention of this, which isn't to do with whether or not the network is used by "the public", but rather is to do with whether you trust the people that configure and administer it.  So the network at the community centre whose IT I look after is "private".

If you designate a network "public" Windows 10 will--correctly in my opinion--tightly constrain what the machine will "see" in that network.  File shares won't work, printers can't be seen, and so forth.  The only trouble comes if you designate a network as "public" by mistake: there is no easy way to change it to "private"!  This seems to be a major oversight on Microsoft's part.

Faced with the problem this morning I found the way to fix it.  It involves using the Deep Magic of the powershell, but it worked first time for me.  It comes from this page, about half way down.
  1. Windows-key and search for "power"; you'll get a list of "powershell" options.
  2. Right click on the simple "powershell" one and select "Run as Administrator".
  3. In the blue window that comes up, type Get-NetConnectionProfile
  4. You'll get a list of network connections, each with a number.  Select the one you want to change and make a note of its number (let's say it's number 2).
  5. Now type Set-NetConnectionProfile -InterfaceIndex 2 -NetworkCategory Private, where you replace "2" with whatever your interface is.
That web page says you should reboot after this but I found it worked fine without.  And I've no idea whether you need to respect the upper- and lower-case letters in those commands: I typed them as they are.