Ubuntu

Quick Links

my DNS serversFree DNS @ afraid.orgOzHosting
useful linksWhoIs databaseRebuilding Ubuntu from scratch
(current version 18.04)
Ubuntu Samba Server configurationNFS
programmingArgParsestdout encodingProcessing Text Files in Python 3
UsageDownloading Photosslow loginswake on LAN
MaintenanceInstalling 10Gb CardConfigure Static IP
DisastersA sad, sad tale of a lonely orphan
Ubuntu (well, 2 orphans, actually)

Useful Tips

These are tips I have gleaned that describe useful (?)customizations in Ubuntu (13.10 - now 17.04). To find out whatversion of Ubuntu is running, type lsb_release -a into aterminal window at a shell prompt.

Fixing networking in Ubuntu 18.04

Ubuntu 18.04 (and 17, I believe) have gratuitously changed thenetworking setup. All I see when I open the network systemconfig is a VPN option, and a Network Proxy option. Nodialogue for setting wired network parameters. I wanted to beable to change the dns settings, but there seemed to be no wayof doing it. So I did someresearch, and found that my system used what is "mostlyobsolete on Ubuntu 18.04 systems". However, it wasn'tobsolete, and here is what I did to fix the problem. (takenfrom https://linuxconfig.org/how-to-configure-static-ip-address-on-ubuntu-18-04-bionic-beaver-linux)

Set the contents of /etc/network/interfaces to

auto loiface lo inet loopback# The primary network interfaceauto eno1iface eno1 inet staticaddress 10.0.0.3netmask 255.255.255.0gateway 10.0.0.101dns-nameservers 8.8.8.8 8.8.4.4
where eno1 is the name of the ethernet interface, andgateway is the IP address of my local gateway router.Save this file, and then reboot. (You are supposed to be ableto systemctl restart the network manager, but that didnot work for me.) After rebooting, the correct gateway(10.0.0.101) is used. I also changed the address of theinterface eno1to be static, but that should not begermane to the problem being addressed.

Most of the webpage material on 18.04 networking talks aboutnetplan. I have not yet understood how this works, butI'm saving this link as a starting point to understanding it. Alsothis link talks about reverting to ifupdown, sothat may be worth reading too.

ls -l explanation

I had trouble finding out what the columns in an ls -llisting mean. Here is an explanation from MKSSoftware:

Long Output FormatThe output from ls -l summarizes all the most important informationabout the file on one line. If the specified pathname is a directory,ls displays information on every file in that directory (one file perline). It precedes this list with a status line that indicates thetotal number of file system blocks (512 byte units) occupied by thefiles in that directory. Here is a sample of the output along with anexplanation.-rw-rw-rw- 1 root   dir 104 Dec 25 19:32 fileThe first character identifies the file type:-    Regular fileb    Block special filec    Character special filed    Directoryl    Symbolic linkn    Network filep    FIFOs    SocketThe next nine characters are in three groups of three; they describethe permissions on the file. The first group of three describes ownerpermissions; the second describes group permissions; the thirddescribes other (or world) permissions. Because Windows systems do notsupport group and other permissions, these are copies of the owner'spermissions. Characters that may appear are:r    Permission to read filew    Permission to write to filex    Permission to execute filea    Archive bit is on (file has not been backed up)c    Compressed files    System fileh    Hidden filet    Temporary fileOn Windows systems, most of the permissions shown are artificial, withno real meaning. The w bit is set according to the ReadOnly attribute,and the rx bits are always set on.You can change some permissions with the chmod command.After the permissions comes the number of links to the file.Next comes the name of the owner of the file or directory. On filesystems that don't support 7/2008R2/8/2012/10/2016 security, the ownername cannot be determined and the owner ID number is displayedinstead. Under 7/2008R2/8/2012/10/2016 the name of the owner of a fileis displayed if the file's SIDs can be obtained and if these SIDs havean associated name in the SAM database. If the file has a SIDassociated with it, but the name of the SID cannot be determined, thenthe value of the SID is displayed. (This can happen when the currentuser is not in the domain that was used when the file was created.) Ifthe file does not have a SID (for example, if it is on a non-NTFS filesystem), or if the file security information cannot be accessedbecause the file is locked by another process, then the user nameappears as <unavail>.Note:When a listed file is owned by the local computer, the owner isdisplayed as computer_name\ where computer_name is the name of thelocal computer.Then comes the name of the group that owns the file or directory. OnWindows systems, the same rules are followed for the group name as forthe owner name.Following this is the size of the file, expressed in bytes.After this comes a date and time. For a file, this is the time thatthe file was last changed; for a directory, it is the time that thedirectory was created. The -c and -u options can change which timevalue is used. If the date is more than six months old or if the dateis in the future, the year is shown instead of the time.The last item on the line is the name of the file or directory.

Naming a Disk

To (re)name a disk using Ubuntu, use:

e2label /dev/sdx name
where /dev/sdx is the device name, and nameis the desired disk name.

Also a reminder to setup /etc/fstab to auto mount thedisk if required.

Renaming an SD card

I couldn't get the above recipe to work for an SD card. Itseems to be more subtle than that. I used gparted tosolve the problem:

1. $ sudo gparted2. find the partition where the card is mounted by using thepull-down disk list in the top right hand corner.3. unmount the disk if it is mounted (right click on theline with the partition in question and select "Unmount" option.4. right click again, the pull down will now show "LabelFile System" as an option, select this.5. Enter new label, click OK6. exit gparted, and apply pending operations.

NFS

There is a useful tutorial on how to setup NFS mounts athttps://www.digitalocean.com/community/tutorials/how-to-set-up-an-nfs-mount-on-ubuntu-16-04

Rotate Console

When using a portrait monitor, or a monitor with rotatingscreen, you can rotate the display to suit according to thefollowing parameter values:

For transient rotations, use

echo 1 | sudo tee /sys/class/graphics/fbcon/rotate

and for permanent rotation, (sudo) edit/etc/default/grub to ensure that it contains aline:

GRUB_CMDLINE_LINUX="fbcon=rotate:1"

In both cases, substitute the 1 with the required rotation parameter.

Make Print Directory

I got a bit fed up with make printing directory entry andexit messages when recursively making, so I added this to mymaster make directory:

ifndef MAKEFLAGSMAKEFLAGS += --no-print-directoryendif
The general advice is that if you want to debug makes that douse recursive makes, then you should turn this off (and resumeprinting the entry and exit messages).

Workspace Configuration and Shortcuts

To enable multiple workspaces:

  1. Open System Settings -> Appearance -> Behaviour
  2. Click on the Enable workspace checkbox

To change the nuumber of workspaces:

  1. Type gsettings set org.compiz.core:/org/compiz/profiles/unity/plugins/core/ hsize 3 to change the number of columns to 3
  2. Type gsettings set org.compiz.core:/org/compiz/profiles/unity/plugins/core/ vsize 3 to change the number of rows to 3

To change the keyboard shortcuts for navigating between workspaces:

  1. Open System Settings -> Keyboard -> Shortcuts
  2. Click on Navigation in the left side bar
  3. Edit the shortcuts acording to the instructions.

Adding user name to title bar

gsettings set com.canonical.indicator.session show-real-name-on-panel true/false

The last word (true/false) turns on the display of the username in the root window title bar (if true), and false turns itoff.

Creating multiple machine pulldowns for remote terminals

These are my settings for the gnome-terminal configuration file/usr/share/applications/gnome-terminal.desktop.Actually, the proper place for this file is/home/ajh/.local/share/applications/gnome-terminal.desktop,which is now where it is placed. The /usr location isfor system-wide defaults.

[Desktop Entry]Name=TerminalComment=Use the command lineKeywords=shell;prompt;command;commandline;cmd;TryExec=gnome-terminalExec=gnome-terminalIcon=utilities-terminalType=ApplicationX-GNOME-DocPath=gnome-terminal/index.htmlX-GNOME-Bugzilla-Bugzilla=GNOMEX-GNOME-Bugzilla-Product=gnome-terminalX-GNOME-Bugzilla-Component=BugBuddyBugsX-GNOME-Bugzilla-Version=3.6.1Categories=GNOME;GTK;Utility;StartupNotify=trueOnlyShowIn=GNOME;Unity;Keywords=Run;Actions=heywood;heywood-root;dimboola;echuca;spencer;X-Ubuntu-Gettext-Domain=gnome-terminal[Desktop Action heywood]Name=HeywoodExec=gnome-terminal --window-with-profile=Heywood[Desktop Action heywood-root]Name=Heywood-RootExec=gnome-terminal --window-with-profile=Heywood-Root -x ssh root@localhost[Desktop Action dimboola]Name=DimboolaExec=/usr/bin/gnome-terminal --window-with-profile=Dimboola -x ssh dimboola[Desktop Action echuca]Name=EchucaExec=/usr/bin/gnome-terminal --window-with-profile=Echuca -x ssh echuca[Desktop Action spencer]Name=SpencerExec=/usr/bin/gnome-terminal --window-with-profile=Spencer -x ssh spencer

Make sure when editing the Desktop Actions that you add the"Name" field to the list of "Actions" in the top entry.

The other thing to note is that when you first create thisfile, you need to make it executable, and then drag it from the Files display to theLauncher bar. If the file is not visible in Files, clickView->Show Hidden Files to make it visible.

The desktop file syntax is described in theDesktop File Specs page.

Samba

I am running a samba server on my disk farm server. Here's auseful page on how to configure a Ubuntu Samba Server.

Unix Stuff

To set the system timezone to Melbourne

$ sudo bash$ cd /etc$ ln -sf /usr/share/zoneinfo/Australia/Melbourne localtime

Moving to Ubuntu

I got the irrits with Apple and have sworn not to buy a newsystem or upgrade the systems I have, preferring instead tomove (back) to Linux as necessity demands. But Ubuntu has itsown irrits, too! This is a log of things that I have fixed.

Virtual desktops

Mac OSX calls them "Spaces", Ubuntu calls them "Workspaces".I prefer "Virtual Desktops". Oh well. You can't please everyone.

The hassle is that there is no clear way of driving thenumber of them, and how to switch between them.

Setting Up
Go into the System Settings > Appearance > Behaviour,and check the box "Enable workspaces". This sets up thedefault 2x2 workspaces.
Changing the Number of Workspaces
Make sure that "CompizConfig Settings Manager" isinstalled (use the "Ubuntu Software Centre" to search forand install this). Then follow General Options > DesktopSize, and set the Horizontal Virtual Size and VerticalVirtual Size to your preferences. Close the CCSM.
Showing the Virtual Desktops
You show see an icon in the launcher that looks likethis one (it may have a background colour to match thelauncher). If you click this icon, a representation of theworkspaces available will be shown. Click it again todismiss, or click inside any of the workspaces to switch tothat workspace.
Keyboard Shortcut to Switch Workspace
CTRL-ALT-arrow will change to the next workspace in thedirection of arrow.

Emacs and PSGML

One of the hassles of upgrading a system (and moving from Appleto Linux counts as an upgrade) is that new versions of justabout everything surface, just when you are not in the mood fordealing with them. I suppose the Nathans of the world wouldargue that this is why one should upgrade continuously, so thatthe Principle of Least Surprise is observed. Whatever. Movingto Ubuntu forced my Emacs from version 23 to version 24, and myPSGML scripts all stopped working.

Fortunately, PSGML has also been upgraded to now run withversion 24. See the pageby the author, Florian v. Savigny, or download the code directly

Some Ubuntu Problems in Ubuntu 18.04

(As of August 2018)

Wake on LAN (20200607:140353)

I wanted to keep my laptop shut (because the cat keptsleeping on the keyboard as it was a nice warm place!), yetstill be able to access it remotely. It was a dickens of ajob getting it to "Wake on LAN access", but this pagehelped. One extra comment; when the page says to useethtool -s INTERFACE wol ug, make sure to add thatextra 'u' flag, so that the system will wake on unicastaccesses, as well as magic packets.

Slow logins with ssh (20200607:123648)

I added a 10Gbs network card to my server, and from then on,remote ssh to the machine took around 30s to come up. Aftermuch digging around, I found the following UsefulPage, which although quite helpful didn't directly fixthe problem. A bit more digging around found that settingUsePAM no in /etc/ssh/sshd_config did fixthe problem (but incidentally also shortened the MotD!)

wallch

wallch does not run correctly, and keeps crashing. Onepoint is when you start the window (type just 'wallch' in aterminal window) and click 'start'. The first time it doesnothing, the second time, it crashes with a floating pointexception.

It does work if you type 'wallch --start' at a terminal prompt.

vlc

vlc comes up with very small text, too small to read. Ihave traced the steps offered in (URL cite) by clicking inthe right real estate territory, but nothing changes.

There is also a problem with .wtv files having no sound. Ifixed this on one computer (a generic Intel box) where thefont size was readable, but could not on the other computer(an iMac).

CD rom

This may be a problem with very old CDs, but many of mycollection not only do not mount, but they also put theCDrom into a frozen state, where the only recovery option isto reboot.

Workspaces

I dislike workspaces only partly appearing when the 'super'key is pressed, and you have to move the mouse into thesidebar to see the workspace icons. Why not blow the Iconsout immediately?

lizard fs

files has a big problem with lizardfs, and refuses/takes avery long time to display some subdirectories of a lizardmount. The same subdirectories list correctly whendisplayed with ls.

backup

again, perhaps a lizardfs issue, but backup keeps failingwith a /lizard mount save directory.

firefox

Firefox refuses to display some images in my web pages - theimages can be opened successfully from the command line, andhave the correct permissions. The problem seems to be oneof just not wanting to load the relevant files.

Downloading Photos from Samsung S8

I switched to using Dolphin as my file manager window, butit does not recognize my Samsung S8 when it is plugged in.Use the old 'files' for this purpose: it does work.

No WiFi on HP Pavilion x360

I bought a new laptop (HP Pavilion x360), but while its wifiworked under Windows, it did not with Ubuntu. After somemixed success in downloading drivers for the ReakTekrtl8822be (success in downloading, failure in getting it towork), I saw this webpage, which said to turn off secure boot, which I did.That fixed it!

To turn off secure boot, bring up the BIOS start screen and go to ...

Screen Lock

For some reason, screen lock does not stay disabled when Isuspend Ubuntu. I have tried various settings of the systemparameter in "Privacy -> Screen Lock", to no avail. So nowI am trying

gsettings set org.gnome.desktop.lockdown disable-lock-screen true
to see if that has a more lasting effect.

I also followed the advice of KishnBera and changed /etc/default/grub so that theline GRUB_CMDLINE_LINUX="" now saysGRUB_CMDLINE_LINUX="nouveau.modeset=0"

Regular Software under Ubuntu

Here is a list of all the software I regularly use, and whichneeds to be installed in a new Ubuntu system:

  1. xsltproc
  2. make
  3. python2 and 3
  4. firefox
  5. zoom
The list is being extended as I recognize missing entries.

This page is copyright, and maintained byJohn Hurst.148 accesses since
19 Jul 2020
My PhotoMy PhotoTrain Photo

Local servers:LocalhostNewportBurnleyEvertonKerangOuyenSpencerTerang(accessible only on local network.)
Public Web Servers:HurstServerHomeServer1HomeServer2InternodeServer(not all may be active.)
Dynamically generated at20210122:0249from an XML file modified on20200607:1408.

149 accesses since 19 Jul 2020, HTML cache rendered at 20210122:0249