Gmail for older computers and the command line — Alpine

We used to be able to access Gmail from browsers without JavaScript, but that’s no longer the case. So now, if going by browser, I need to install a relatively heavy-duty piece of kit like Firefox or Chrome (heavy compared with say Links or Dillo). But can still get at the email without…

I started by installing Alpine mail reader. On Debian, it’s

$ sudo apt install alpine

I then logged into my Gmail account as usual (ie in Firefox) and went to Settings → Forwarding and POP/IMAP and chose Enable IMAP (IMAP is preferable to POP if I want to use this method on more than one computer — it does a better job of syncing between sessions).

Then clicked on Configuration instructions, opened up Alpine and did what the Google instructions said.

Updated my details as per the gmail website instructions. These websites are also handy:

Compile: http://www.chiark.greenend.org.uk/doc/alpine-doc/tech-notes/installation.html

Save password: https://scienceblogs.com/gregladen/2009/10/08/do-you-want-the-alpine-email-c

But the best guide is at:

https://bcacciaaudio.com/2018/10/09/alpine-mail-setup-with-gmail/

but note that an app-specific password is necessary (or was for me) — this is a 16-letter combination you can generate after logging into your Google account and going to Security (you must have turned on 2-factor authentication, too). Also, unless you want to have to note it down and reenter it multiple times, go to the ‘Save password’ link noted above and turn on Alpine password saving (on Linux, $ touch ~/.pine-passfile). Note that this may be a security issue; the encryption in this file is (apparently) not that strong. I don’t know.

So ran Alpine, went (S)etup and Co(L)lections and (A)dd, then entered:

Nickname : Gmail
Server : imap.gmail.com/ssl/user=first.second@gmail.com
Path :
View :

On hitting ‘Enter’ after the imap line, I was asked for my password. Used the 16-letter app-specific password.

Then, back to the main menu of Alpine and:

(S)etup (C)onfig

Personal Name = <No Value Set: using "Username">
User Domain = gmail.com
SMTP Server (for sending) = smtp.gmail.com:587/tls/user=first.second@gmail.com

See also the Gmail help page — https://support.google.com/mail/answer/7126229.

Also, went to Gmail on the web, and set:

Limit IMAP folders to contain no more than this many messages = 1000

And that allows use of Gmail without JavaScript or even a GUI — no need for X windows, for example. I’m sure other mail clients would work just as well.
screen shot showing the main menu -- Help, Compose, Message Index, Folder List, Address book, Set up and Quit

The Alpine front page

viewing system mail -- three messages

A typical Alpine screen

Quote of the day

Any sufficiently rigorous magic is indistinguishable from technology.

–Me (as far as I know)

Here is a picture of a hammer.

line drawing of a hand swinging a hammer

Quoth

netsurf and netsurf-fb

I (re)installed netsurf on Debian:

$ sudo apt-get --reinstall install netsurf

I can run it from the Applications menu, but typing netsurf at an xterm prompt gives me:

$ netsurf
Unable to initialise the font system

but that’s because I should be running

$ netsurf-gtk

And that works great. Now, I have also been playing with frame buffer applications, and working without X in general. Netsurf plays a very rare role there, because it includes a frame buffer version, netsurf-fb.

At first I could not get netsurf-fb to run, but after some searching… found this page. I’ll link to the original source:

https://askubuntu.com/questions/817937/how-to-run-netsurf-fb-fails-with-unable-to-set-video-could-not-set-console-s

In summary:

$ sudo apt install xserver-xorg-video-fbdev fbset
$ sudo cp /usr/share/fonts/truetype/dejavu/DejaVu* /usr/share/netsurf

Then, in a virtual terminal (not a terminal emulator running under X):

$ sudo gpm -3 -m /dev/input/mice -t imps2
$ netsurf-fb --window_width 1000 --window_height 1000

Hint: Frame buffer stuff can make your computer hang such that it needs a hard reset, so don’t have any files open when you play with it.

Yay! It worked. Some oddities:

(1) I seemed to get a UK keyboard (shift-2 gave me a quote mark rather than a @ when typing an email address)

(2) I could not download anything

(3) After doing this, I could run netsurf in an X term (no -gtk) and get a browser session, but it looked like the barer framebuffer session. I think copying the fonts was the key step.

Petty good, really. There’s some documentation at https://ci.netsurf-browser.org/jenkins/vcdiew/Categorized/job/docs-netsurf/doxygen/md_docs_using-framebuffer.html that shows that this version was never meant to be as feature-full as the gtk-type ones. It still works very well for graphical browsing without X, though logging in to things like gmail and such may be a problem.

netsurf-fb -- screenshot

netsurf-fb in the framebuffer — a more minimal interface, but works well

Other good browser options include links and lynx for text browsing and links2 -g for graphical-ish browsing.

 

Notes in the void

WordGrinder — distraction-free writing; current version on Debian

WordGrinder is a distraction-free writing tool, written by a programmer who wanted to write a novel. At the website, you can find links to a Windows installer. It also runs on Mac and Linux.

I run Linux, and there’s a Debian package. I’ll install that, but I am also installing build dependencies, and I’ll explain why in a moment.

$ sudo apt-get install ninja-build libncursesw5-dev liblua5.2-dev zlib1g-dev libxft-dev wordgrinder

$ wordgrinder --help
WordGrinder version 0.6.0 © 2007-2008 David Given
Syntax: wordgrinder [<options...>] [<filename>]
Options:
-h  --help Displays this message.
    --lua file.lua Loads and executes file.lua and then exits
                         (or file.lua can be some Lua statements)
-c  --convert src dest Converts from one file format to another
    --config file.lua Sets the name of the user config file

Only one filename may be specified, which is the name of a WordGrinder
file to load on startup. If not given, you get a blank document instead.

To convert documents, use --convert. The file type is autodetected from the
extension. To specify a document name, use :name as a suffix. e.g.:

  wordgrinder --convert filename.wg:"Chapter 1" chapter1.odt

The user config file is a Lua file which is loaded and executed before
the program starts up (but after any --lua files). It defaults to:

  /home/username/.wordgrinder.lua

Use a unicode-aware terminal; so not rxvt, mrxvt or xterm, but urxvt or something fancy like konsole or the MATE terminal.

 

Screenshot

A couple of simple example WordGrinder sessions.

However, the WordGrinder website (http://cowlark.com/wordgrinder/index.html) suggests using the latest version; Debian’s is quite old (0.6.0 when the developer is up to 0.7.2 or something).

Thus:

$ sudo apt-get remove wordgrinder

(I love that removing it saves a princely 11.3 kB of disk space!)

This is why I used the long apt-get line above. It made sure all the dependencies are installed, both runtime and build.

$ mkdir wordgrinder
$ cd wordgrinder/
$ wget https://github.com/davidgiven/wordgrinder/archive/master.zip
$ unzip master.zip
$ cd wordgrinder-master/
$ make
$ sudo make install PREFIX=/usr
$ wordgrinder --help
WordGrinder version 0.7.2 © 2007-2008 David Given
(This version has been compiled with debugging enabled.)
Syntax: wordgrinder [<options...>] [<filename>]
...etc...

Where the version number is now 0.7.2.

Grind those words.

Serial port on GA-H67MA-USB3-B3

I wanted a hardware serial port on the old machine. I could get a PCIE card to do it, but is there a serial port header on the motherboard? Probably.

How about the manual: http://download.gigabyte.asia/FileList/Manual/mb_manual_ga-h67ma-usb3-b3_e.pdf

Screenshot from the manual:

Diagram showing the 5 pin com port on the mother board -- top-left is pin 9, top right is 1, bottom left is 10, bottom right is 2 -- numbering looks odd.

Look at bottom-right corner.

Can also see it on a picture of the board at: https://static.gigabyte.com/Product/2/3806/4111_big.jpg (Bottom-left, in this case.) It even says ‘COM’.

And it has 9 pins! But the numbering looks funny. In fact, it is ‘IDC-10’ which is kind of standard. (https://strugglers.net/~andy/blog/2015/06/19/fun-with-supermicro-motherboard-serial-headers/)

Searched for “ICD-10 DB9” on ebay and bingo. They’re all two-socket and I only need a single, but at about $2.20 I can live with that.I could make one myself, but for <$3, why? I can’t buy the parts for that price.

While we’re here, though, what is the TPM socket? It’s a ‘Trusted Platform Module (TPM) header’… https://www.tomshardware.com/reviews/tpm-trusted-platform-module-header,5766.html … nope, don’t need that!

Buy one. Plug it in.

Done.

Note to self: Printing to the EP44 from Windows 10

OS: Windows 10, 64-bit, current as of 02 May 2019.

  1. Bought a USB to DE9 (DB9) cable that claimed to be FTDI
  2. It arrived and was a Winchiphead 340; asked for my money back
  3. Oh well. Plugged it in but Win 10 could not drive it. Removed it and installed 340.exe from the 340.exe/win7_win10/ folder on the little CD that came with the cable
  4. Plugged it in again
  5. Opened Device Manager; it was there as COM3
  6. Using Device Manager, set baud to 75, data bits to 8, parity to none, stop bits to 1 and flow control to none
  7. Plugged in the EP44 and set its terminal properties to match; use CR+LF to eat the LF that Windows sends (otherwise will get double-spaced output)
  8. Went to Add printer. Added a local printer to COM3 and chose the Generic Text Only driver
  9. Printed a test page, no problems
  10. Works; can print plain text and a handful of symbols
Photo showing the machine viewed from above.

The Brother EP44 dot matrix typewriter/serial printer.

The adapter does not work on Linux. I am more than a little annoyed by that, since that was why I wanted an FTDI one. I hardly ever use that Windows machine.

End it

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.

Expand a VirtualBox virtual hard disk

Expand the disk on your VirtualBox virtual machine (VM). There are really two main parts. First, make the virtual disk bigger, then expand the partition on the disk.

  1. No space left on device! Fudge. Shut it down.
  2. Find out where the vdi file lives. On Windows hosts, somewhere like “C:\Users\username\VirtualBox VMs\VMname\VMname.vdi”
  3. Use vboxmanage to manipulate the virtual disk. On a Windows host, something like
     C:\Program Files\Oracle\VirtualBox>VBoxManage.exe modifyhd "C:\Users\username\VirtualBox VMs\Slack\Slack.vdi" --resize 40000
    0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%

    In this case, 40000 is the size of the enlarged disk, in megabytes. You can’t shrink a disk as far as I know, at least, not as easily.

  4. Now we need to make the partition bigger. Since we want to manipulate the VM’s partition, we do not boot the VM — we use a Linux live disk. The best one is a dedicated partitioning tool. So — booted the VM with gparted live disk in the virtual CD drive and ran gparted from the desktop. https://gparted.org/download.php
  5. In this case, the disk structure was first a 10GB ext4 file system and then about 1GB of swap. After I expanded the disk, the structure was a 10GB ext4 file system and then about 1GB of swap and then 29GB of unpartitioned space.
  6. Made a new swap at the back of the disk to leave empty space after the partition I want to expand. If swap is at the front of the disk, or on another disk, you don’t need to do this, but …
    1. right-click existing swap partition and turn swapoff
    2. delete it
    3. make a new partition in the last GB or so of the disk and give it type swap (all done easily inside gparted)
  7. Right click on /dev/sda1 and choose resize
  8. Apply
  9. Shut down gparted, remove the iso image and boot back into Slackware (or whatever VM you are using)
  10. Login again; this is Linux, so I type $ df -h and it shows 8% used!

Hokey dokey

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

ELinks!

ELinks is an aging text browser; last updates given as 2012. Yet despite being aged and text-based, it work with Twitter in 2019.

Here’s a picture to prove it:

Screen shot using ELinks to access twitter

Twitter in a text browser

I can make text posts, but I’m not sure how to add images to a tweet. Anyway, it’s just a curiosity. It would look better in a UTF-8 terminal — this is mrxvt, and it does not render smart quotes and other non-keyboard characters. For comparison, the one below uses uxterm.

Using a unicode-enabled terminal emulator, the accented characters are displayed correctly

And there you go.