Tag Archive | Linux

The twin window manager

The Text WINdow manager, twin, is quite a nice piece of software if you don’t
want to have to run X, though it can run within an X term.

GitHub – cosmos72/twin: Text mode window environment. A “retro” program for embedded or remote systems, that doubles as X11 terminal and text-mode equivalent of VNC server

I have found that it works extremely well with the ‘leggie’ fonts, from
Leggie, a legible, pretty bitmap font

Here is an example of a twin session, captured using fbcat.

4 windows within a twin session

twin is great for running a bunch of text applications

So this was a twin session, using the leggie18 font, on a netbook.

Top-left is a Gopherus session, top right is a window on my tilde.club account, bottom-left is Vim editing a LaTeX file and bottom-right is an Alpine
mail window.

twin has many capabilities — this only shows you what it looks like. One cannot run framebuffer graphics inside twin windows — eg fbi, or dosbox (which uses sdl) — but I have found that a twin window on one virtual console, and then a ‘bare’ framebuffer on a second one makes for a good combination for working without X.

I have noticed that some fonts give ugly outlines on the windows (rows of diamonds or non-characters). The leggie fonts on 32-bit Debian give neat lines around the windows. YMMV.

Some nice features include a built-in clock (see bottom-right corner), and the ability to type in a window while keeping it behind others. That’s why the screen capture command is invisible in the screen grab above. Alpine, links, lynx and other text-based network tools work fine, plus all your other console tools. It is very light on resources, too. top suggests it uses about 0.5% of my memory and CPU — and I am running an old netbook with 1GB RAM and an Atom N550 chip!

Could form the basis of a Linux distro to challenge TinyCore,

 

twin

Alpine: [Refusing to write non-encrypted password file]

To save passwords when using Alpine mail program, one creates ~/.pine-passfile:

$ touch ~/.pine-passfile

But when I tried to save a password I got:

[Refusing to write non-encrypted password file]

So why won’t Alpine write to it?

I took a guess.

I edited the .pine-passfile and hit return once. So instead of being completely empty it had a single empty line in it (ie one non-printing character).

Next time I fired up Alpine it worked — it asked me for the master password and then stored my mail account password. Odd but true. Whether only Enter would work, I dunno.

Now, if you want to avoid using the master password, that is also possible. Not a great idea, I guess, but possible.

 

And off we go

 

 

Installing MATE-terminal on Cygwin

First, I should say I have been using the excellent, though I think no longer maintained (or is it?) (but stable and pretty reliable), apt-cyg.

$ apt-cyg --version
apt-cyg version 1
The MIT License (MIT)
Copyright (c) 2005-9 Stephen Jungels

(In fact, the status of apt-cyg seems a little unclear — is it this apt-cyg? See here as well.)

$ apt-cyg install mate-terminal

And the install works fine. But:

$ mate-terminal
** (mate-terminal:1413): WARNING **: Error retrieving accessibility bus address: org.freedesktop.DBus.Error.NoReply: Message recipient disconnected from message bus without replying
(mate-terminal:1413): GLib-GIO-ERROR **: Settings schema 'org.mate.terminal.global' is not installed

Now, the first one is not a problem, but the second one is fatal. But I’ve seen that message somewhere before … so do this:

$ glib-compile-schemas /usr/share/glib-2.0/schemas/
Warning: Schema “org.gnome.crypto.cache” has path “/desktop/gnome/crypto/cache/”. Paths starting with “/apps/”, “/desktop/” or “/system/” are deprecated.
Warning: Schema “org.gnome.crypto.pgp” has path “/desktop/gnome/crypto/pgp/”. Paths starting with “/apps/”, “/desktop/” or “/system/” are deprecated.
Warning: Schema “org.gnome.system.locale” has path “/system/locale/”. Paths starting with “/apps/”, “/desktop/” or “/system/” are deprecated.
Warning: Schema “org.gnome.system.proxy” has path “/system/proxy/”. Paths starting with “/apps/”, “/desktop/” or “/system/” are deprecated.
Warning: Schema “org.gnome.system.proxy.http” has path “/system/proxy/http/”. Paths starting with “/apps/”, “/desktop/” or “/system/” are deprecated.
Warning: Schema “org.gnome.system.proxy.https” has path “/system/proxy/https/”. Paths starting with “/apps/”, “/desktop/” or “/system/” are deprecated.
Warning: Schema “org.gnome.system.proxy.ftp” has path “/system/proxy/ftp/”. Paths starting with “/apps/”, “/desktop/” or “/system/” are deprecated.
Warning: Schema “org.gnome.system.proxy.socks” has path “/system/proxy/socks/”. Paths starting with “/apps/”, “/desktop/” or “/system/” are deprecated.

And now it works …

screen shot of a MATE terminal window

MAAAAATE!

 

Mate

Website as screensaver

I wanted to set https://time.is/ as my screensaver. Nothing new about this, and there are ways. I’m using Linux, so… Google led me to https://github.com/lmartinking/webscreensaver. Note: this is for Debian 9. For 10, some of the packages are different (eg gir1.2-webkit2-4.0) and won’t work — it may be necessary to either hack the webscreensaver script or install parallel older packages.

    1. Fired up synaptic and checked if webscreensaver is part of Debian — seems no.
    2. Checked that the dependencies were installed;
      1. python 2.7
      2. xscreensaver
      3. GTK3
      4. webkitgtk
    3. Well, libwebkit2gtk is installed … will that do? I guess we’ll find out.
    4. Download https://raw.githubusercontent.com/lmartinking/webscreensaver/master/webscreensaver (it’s a Python 2.7 program)
    5. “Copy webscreensaver into /usr/lib/xscreensaver” (direct quote from the git page — this needs sudo of course)
    6. $ sudo chmod +x /usr/lib/xscreensaver/webscreensaver
    7. $ cp ~/.xscreensaver ~/.xscreensaver.original
    8. Now, I don’t have gnome-screensaver installed, but I do have mate-screensaver, and I need to make it so that xscreensaver is initialised (and then webscreensaver is called by it) so…
      1. $ sudo apt-get remove mate-screensaver
      2. $ sudo apt-get install xscreensaver xscreensaver-data-extra xscreensaver-gl xscreensaver-gl-extra libwebkitgtk-3.0-0 gir1.2-webkit-3.0
      3. Then in MATE menus, System → Control Centre → Startup Applications → Screensaver → Edit and change to xscreensaver -nosplash
    9. $ xscreensaver &
    10. Now, edit ~/.xscreensaver

Here it is (only showing key fields):

# XScreenSaver Preferences File
# https://www.jwz.org/xscreensaver/

timeout: 0:10:00
cycle: 0
lock: True
lockTimeout: 0:01:00
passwdTimeout: 0:00:30
visualID: default
splash: False
fade: True

mode: one
selected: 1

programs:                                                       \
                         webscreensaver -url https://time.is/Canberra \n\

OK, it launched but it chose maze. Numbering starts at 0! So selected: 0 … works! Though the page is not as nice as I had hoped. Ads, etc. Ah-ha! https://time.is/just/Canberra. Nice and clean.

the time at the time -- 21:51:13

My screen saver using webscreensaver

Notes:

timeout: is the time till it kicks in

lockTimeout: is the time after timeout that it waits before requiring a password

splash: False stops the xscreensaver splashscreen from coming up

selected: 0 chooses the first item in the list of programs in .xscreensaver

mode: one means it will only choose one program

I don’t know if I installed more things than needed when I ran my apt-get install command.

 

Works, though

Page sizes on Seiko SII SLP label printer

The CUPS driver is very useful, but the media selection menu in CUPS does not give the paper size, just the label code, so I thought a table giving the description, the label code and the dimensions in a couple of units might be handy. It’s really for my own reference.

First, find siislp200.ppd and look through it for the relevant text.

grep PageSize siislp200.ppd | grep SLP > sizes.txt

This gives all the lines that set page sizes. The sizes are in points.

Neaten up the output using cut; this pulls out the label size names:

$ cut -d'*' -f2 sizes.txt | cut -d' ' -f2- | cut -d':' -f1 > list-of-labels.txt

This pulls out the sizes (in points)

$ cut -d'[' -f2 sizes.txt | cut -d']' -f1 | cut -d' ' -f1 > size-in-pointsx.txt
$ cut -d'[' -f2 sizes.txt | cut -d']' -f1 | cut -d' ' -f2 > size-in-pointsy.txt

(-d'x' sets x as the delimiter, and -fn takes the nth field defined by these delimiters. I separate x and y dimensions so that paste below will put a tab in between instead the the space that is already there, so when I import into LibreOffice Calc I can set tab as the delimiter.)

Then (I have to do things one step at a time, sorry)

$ paste list-of-labels.txt size-in-pointsx.txt size-in-pointsy.txt > labels-and-sizes.txt

Then opened that list in Libreoffice Calc and calculated the sizes in mm and inches as well as points. (Also decided to separate the label code from the description). Pasted into Writer, formatted the table and exported as HTML, and pasted here.

Note: x = length along label roll, y = width of roll.

Description

Code

x (pts)

y (pts)

x (mm)

y (mm)

x (in)

y (in)

8mmSpine/8mm Spine

SLP-27210

187

26

66

9

2.60

0.36

35mmSlide/35mm Slide

SLP-35L

26

104

9

37

0.36

1.44

AddressLarge/Address – Large

SLP-2RLE

236

99

83

35

3.28

1.37

AddressSmall/Address – Small

SLP-1RL, SLP-2RL

236

68

83

24

3.28

0.94

Diskette/Diskette

SLP-DRL

181

136

64

48

2.51

1.89

EuroFolderNarrow/Euro Folder – Narrow

SLP-FN

526

107

186

38

7.31

1.49

EuroFolderWide/Euro Folder – Wide

SLP-FW

526

136

186

48

7.31

1.89

EuroNameBadge/Euro Name Badge

SLP-ENT

189

108

67

38

2.62

1.50

FileFolder/File Folder

SLP-FLW

230

37

81

13

3.19

0.51

Jewelry/Jewelry

SLP-Jewel

76

136

27

48

1.06

1.89

MediaBadge/Media Badge

SLP-NB, SLP-NR

180

136

63

48

2.50

1.89

MultiPurpose/Multi-Purpose

SLP-MRL

126

68

44

24

1.75

0.94

Return/Return

SLP-RTN

122

45

43

16

1.69

0.62

Round/Round

SLP-RND

62

68

22

24

0.86

0.94

Shipping/Shipping

SLP-SRL

271

136

96

48

3.76

1.89

VHSFace/VHS Face

SLP-VTL

205

127

72

45

2.85

1.76

VHSSpine/VHS Spine

SLP-VSL

400

50

141

18

5.56

0.69

ZipDisk/Zip Disk

SLP-ZIP

156

136

55

48

2.17

1.89

CutHanging13/1/3 cut hanging file folder

SLP-3HFL

90

222

32

78

1.25

3.08

CutHanging15/1/5 cut hanging file folder

SLP-5HFL

90

114

32

40

1.25

1.58

EuroFileFolder/European File folder

SLP-EHFL

139

112

49

40

1.93

1.56

RetailLabel/Retail Label

SLP-RTL

90

104

32

37

1.25

1.44

EuroNameBadgeLarge/Euro Name Badge Large

SLP-ENTL, SLP-FCS2

223

136

79

48

3.10

1.89

TopCoatedPaper/Topcoated Paper is 150 mm length

SLP-P150, SLP-DIA

396

136

140

48

5.50

1.89

4PartLabel/4-Part Label

SLP-MPL4

271

136

96

48

3.76

1.89

CUPS

edlin on Linux and a man page for it

A little while ago I compiled the edlin line editor for on Windows 10. More recently, I compiled it for Linux; it is really easy, thanks to the authors. Went to https://sourceforge.net/projects/freedos-edlin/files/freedos-edlin/2.17/ and downloaded the current source. This needs no skills!

$ tar xvjf edlin-2.17.tar.bz2
$ cd edlin-2.17/
$ ./configure
$ make
$ sudo make install
$ which edlin
$ /usr/local/bin/edlin

But, there is no man page for it, as far as I know, anyway.

Until now.

I created edlin.1.gz and copied it into the manpath:

$ sudo cp edlin.1.gz /usr/local/man/man1/

And now:

Screen shot of the edlin man page

It sort of works, even.

Now, I must emphasise that all I have done is take the text from the FreeDOS pages, http://help.fdos.org/en/hhstndrd/base/edlin.htm, and formatted it (crudely) to work with man, and made a few minor edits to make it fit with the Linux compile.

But it does work OK.

It’s at http://djg.altervista.org.

 

Tra-la

Choosing a virtual terminal font on Debian

I’ve been playing around in the framebuffer/text console, partly because my old netbook is, well, not the most powerful machine going around. I’ve figured out how to boot into the console and to get the interwebs to go. Now, the default console font it too small, so I want to explore options for custom terminal fonts — ideally, something bigger and may be nicer.

The first thing is to explore the options using:

$ sudo dpkg-reconfigure console-setup

And then decide on a font. This link may be useful: https://unix.stackexchange.com/questions/198791/how-do-i-permanently-change-the-console-tty-font-type-so-it-holds-after-reboot

Eventually, I edited /etc/default/console-setup to look like:

# CONFIGURATION FILE FOR SETUPCON
# Consult the console-setup(5) manual page.
ACTIVE_CONSOLES="/dev/tty[1-6]"
#CHARMAP="UTF-8"
#CODESET="Lat15"
#FONTFACE="TerminusBold"
#FONTSIZE="24x12"
FONT="Lat7-TerminusBold24x12.psf.gz"
VIDEOMODE=
# The following is an example how to use a braille font
# FONT='lat9w-08.psf.gz brl-8x8.psf'

And then ran:

$ setupcon

(Run as sudo it changes all virtual terms, run as user it changes the current one.) And that works fine, though I found that I have to run it each time I log in. So I just added it to .profile; could also mess with setfont.

Now, the mouse. The simplest way is to use gpm. I am just using it as a 2-button mouse because my touchpad has 2 buttons, and since I’m not using a GUI, right click is not needed for context menu, so can be paste.

$ sudo gpm -2 -m /dev/input/mice -t imps2

So at this point I have control over the console font (look for others in (/usr/share/consolefonts/), I have interweb and mouse, it’s just a question of applications.

One last thing; the console fonts are PSF fonts (often psf.gz). If you find the range of options limited, there are tools out there to convert other fonts to PSF, possibly via other formats (likely bdf); you may need to explore the command line options to get a font that works at the size and in the encoding that you want. For example, http://www.seasip.info/Unix/PSF/, otf2bdf, ttf2bdf, bdf2psf, gbdfed. (And FontForge of course.) I have not tested all there tools myself yet!

gbdfed

Targus PAUM35

Remote mouse / clicker for walking around while PowerPointing is useful. Modern ones are quite sleek and neat. This is an old device, but that has some advantages, especially in the Linux world where a lot of manufacturers don’t provide drivers. It has a built-in mouse that lets you drive the pointer remotely, and mode switch that lets you click in and out of a PowerPoint presentation if you want to go to a website (though needs some practice).  Also has laser pointer. Is relatively bulky — 4cm wide and 2cm thick. Not sleek.

Compatibility report

  • Works automagically with Windows 10 (64 bit) (may have downloaded a driver without telling me — it is Windows 10, after all).
  • Works on Windows 7 (64 bit) but it needed to download a driver from Windows Update.
  • Works automagically on Windows xp (that box was not even on the ‘net).
  • Works automagically on Debian GNU/Linux 9.8.

Linux version information:

$ uname -a
Linux lauequad 4.9.0-8-amd64 #1 SMP Debian 4.9.144-3.1 (2019-02-19) x86_64 GNU/Linux
$ cat /etc/debian_version
9.8

Tail of dmesg

[ 1543.657284] usb 2-1.1: new low-speed USB device number 4 using ehci-pci
[ 1543.772132] usb 2-1.1: New USB device found, idVendor=05af, idProduct=216a
[ 1543.772136] usb 2-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 1543.772138] usb 2-1.1: Product: USB RF Keyboard
[ 1543.772149] usb 2-1.1: Manufacturer: Innovace
[ 1543.775850] input: Innovace USB RF Keyboard as /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.1/2-1.1:1.0/0003:05AF:216A.0002/input/input10
[ 1543.833657] hid-generic 0003:05AF:216A.0002: input,hidraw1: USB HID v1.10 Keyboard [Innovace USB RF Keyboard] on usb-0000:00:1d.0-1.1/input0
[ 1543.839829] input: Innovace USB RF Keyboard as /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.1/2-1.1:1.1/0003:05AF:216A.0003/input/input11
[ 1543.897730] hid-generic 0003:05AF:216A.0003: input,hidraw2: USB HID v1.10 Mouse [Innovace USB RF Keyboard] on usb-0000:00:1d.0-1.1/input1

Manual for very similar PAUM30 is at http://cdn.targus.com/web/us/downloads/paum30_ug.pdf.

 

Just FYI.

Resurrect a HDD: fsck is a champ

After getting the data off using testdisk [[post]], I wanted to see if the drive was reusable. I plugged the USB hard drive into my Debian gnu/Linux box and used gparted to wipe and reformat (gpt partition table, ext4 file system), but it would not mount.

Tried processing it using fsck. Partition in question is /dev/sdg1

$ sudo mke2fs -n /dev/sdg
mke2fs 1.43.4 (31-Jan-2017)
Found a gpt partition table in /dev/sdg
Proceed anyway? (y,N) y
Creating filesystem with 488378646 4k blocks and 122101760 inodes
Filesystem UUID: 202d9436-fc78-4c87-b3fb-773acd10efab
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
102400000, 214990848

OK, try to restore from one the the superblock backups.

$ sudo e2fsck -b 32768 /dev/sdg1

Lots of complaints about timestamps and garbage. Since I’ve already got all the files off it and I’m dealing with a clean drive, hit ‘a’ for ‘all’ to queries

It goes for a bit, then the file system check aborts before finishing the job:

.....
Inode 1053105 passes checks, but checksum does not match inode. Fix? yes
Inode 1053107 passes checks, but checksum does not match inode. Fix? yes
Inode 1053108 seems to contain garbage. Clear? yes
Inode 1053109 seems to contain garbage. Clear? yes
Inode 1053110 seems to contain garbage. Clear? yes
e2fsck: aborted

SamsungAgain: ***** FILE SYSTEM WAS MODIFIED *****

Run it again.

The problematic inodes start later in each run, so it does seem to be fixing some of them, then barfing. Note: df -i give the number of inodes in total.

I ran it over and over again until it completed the whole drive, adding the -y flag. I used a script to run it repeatedly and went out for the day.

$cat fsck-script

for i in {1..2000}
  do
  sudo e2fsck -yb 32768 /dev/sdg1 2> /dev/null | tail -10 | grep inode | tail -1
done

(Thus just looks through the last 10 lines of screen output for mention of an inode, then prints the last occurrence, so I can see what inode number we’re up to. I redirect error stream to null so it does not clutter anything up.) Output looks like this:

Inode 1838533 passes checks, but checksum does not match inode. Fix? yes
Inode 1855561 passes checks, but checksum does not match inode. Fix? yes
Inode 1867274 passes checks, but checksum does not match inode. Fix? yes
Inode 1869523 passes checks, but checksum does not match inode. Fix? yes
Inode 1895923 passes checks, but checksum does not match inode. Fix? yes
Special (device/socket/fifo) inode 1926002 has non-zero size. Fix? yes
Inode 1939589 passes checks, but checksum does not match inode. Fix? yes

Eventually (hours later), it’s done the whole disk. But is the disk any use?

Unplug and replug and it mounts OK, but do I trust it?

Look at it again:

$ sudo umount /dev/sdg1
$ sudo e2fsck -ycvb 32768 /dev/sdg1

Probably should have just done that first.

Then it goes to:

Checking for bad blocks (read-only test): 0.07% done, 0:38 elapsed. (0/0/0 errors)

And so on. Takes forever, but looks good. Eventually, it is done and the drive mounts readily on various machines. Seems OK, but I don’t think I’ll use it for mission-critical data ever again.

 

YMMVwildly

Install tde editor on Linux — properly

TDE is a derivative of an editor used on IBM machines. It is currently maintained by Jason Hood at http://adoxa.altervista.org/.

The source code does not compile on 64-bit Linux without a patch. The patch is here:

http://adoxa.altervista.org/tde/linux64.patch

The patch is used like this:

$ cd /path/to/tde-5.1v
$ patch -p1 < /path/to/linux64.patch

That also has the makefile patch.

Thanks to Jason Hood!


I originally got it to work by doing a 32-bit compile — before I knew about the patch. Here are the details, as they stood at the time…

First, some prerequisites.

The trick with using TDE on Linux is that it only works as a 32-bit compile — you might get a 64-bit version to compile and link, but it will not actually work. If you have a native 32-bit system, all good, but these are less and less common. Now, 64 bits is not a problem. On Debian, for example, it means installing some multiarch libraries. It also uses the 32-bit version of ncurses-dev, and compresses the binary using upx. Thus:

$ sudo apt-get install gcc-multilib g++-multilib upx lib32ncurses5-dev

Now, apt should install everything you need with this command. But I can’t make promises. (I don’t need g++, but what the hell.)

If your system is 32 bit, you might just need upx and lib32ncurses5-dev — assuming you have a sane gcc build environment already…

Anyway, once that’s done, there are a couple of minor changes to make to the makefile.

OK, go back a step.

The source of TDE can be downloaded from http://adoxa.altervista.org/tde/index.html. As of this writing, the current version in 5.1v and the file is tde-5.1v.tar.gz; you should also grab the manual.

When you expand the archive, there is a makefile in it called makefile (there are others, like makefile.dos, but that is the relevant one). On 32 bit it will probably work out of the box, but on 64-bit machines it needs a little modification. Or so I found. The -mtune flag is set for a 32-bit architecture (‘pentiumpro’).  I changed it to ‘corei7’, based on the output of:

$ hwinfo --cpu --short

But you could try ‘native’ if unsure. I also added ‘-m32’ to the CFLAGS.

When I ran make, the compilation worked, but not the linking into the final binary. I realised that I had not added ‘-m32’ to the final step that links and produces the executable. When I did this, it worked fine.

Unfortunately, a few keys (‘End’ and ‘Home’) do not seem to work (Alt+a and suchlike seem to do that job). Maybe can fix using the config file.

Here is the diff between the supplied makefile (copied to makefile.ori) and the modified one (makefile):

$ diff makefile.ori makefile
22c22
< OS = djgpp --- > #OS = djgpp
24c24
< #OS = unix --- > OS = unix
59c59
< CFLAGS += -mtune=pentiumpro -fomit-frame-pointer --- > CFLAGS += -m32 -mtune=corei7 -fomit-frame-pointer
109c109
< $(BRIEF)$(CC) -o $@ $^ $(LIBS) --- >       $(BRIEF)$(CC) -m32 -o $@ $^ $(LIBS)

You can see that all I did was:

  1. comment out ‘djgpp’ and uncomment ‘unix’ in the OS section
  2. remove ‘-mtune=pentiumpro’ and replace it with ‘-m32 -mtune=corei7’ on line 59
  3. add ‘-m32’ to the line that makes the binary (line 109).
The TDE editor window showing some syntax highlighting of its own make file

TDE in action on 64-bit Linux.

Not much to it, really.

TiDiEst