Thursday 30 June 2016

How Many Mints?

In my household I have four computers for various purposes plus another one out the back. I have been thinking a lot about which computers will run which OSs. The main issue is I still need a Windows 7 system for some stuff that is easier to do on a physical computer than by running something in a Wine layer or virtual machine. But there only needs to be one single computer in the whole house that does this. I also need a Windows 10 system for testing some stuff out but not for day to day use and that is the one out the back, but getting the right balance for the house computers has been tricky.

The main killer apps are things like IrfanView and Office plus the backup system but that isn't to say it would be impossible to run some of that stuff in a virtual machine and store the files on a virtual hard disk necessarily so it could be feasible to run things in a Windows VM hosted on a Linux desktop, or the photos could be on a Linux host system served by Samba. The key issue is I want to be able to do most of my stuff in one location and the second location essentially be no more than a backup. Perhaps it is a kind of server or live backup. I am sort of working towards a future understanding that living in a smaller premises than the previous one guarantees that that fourth computer could be using up valuable space where it is. However it is the newest of my computers and it won't be let go of in a hurry. Running it on Linux and having it as some kind of storage location or server seems to be the best use of it right now.

I have had a lot of fun with VMWare on Linux of late with silly error messages stopping it from running which is why I am taking a serious look at VirtualBox as of now. VB won't run on the AMD E350 computers that I have apparently because the Gigabyte Mini-ITX motherboards in these PCs don't support it. Although I was sure I had had VMWare Player running under Lubuntu on one of these systems, I am not so confident now but I seem to recall that was the case because it was quite apparent that the system struggled with low resources to run a virtual machine. Since I have got VB ready to set up a Win7 VM on my main computer then I will see if it works better in this system than VMware, which tended to freeze the system. If all else fails I have got a Windows 7 system next to the main PC that can be used as an actual physical computer to do some stuff. I also need to rearrange the networking here so that the computers are all running across gigabit as at the moment some of them are connected through a fast ethernet switch so they don't all have the full speed capability.

The spare PC cum server is going to be set up as a RAID-1 system just like my main PC which means I will be applying my newfound skills with MDADM having completed the commissioning of the RAID-1 array on the latter in the last week. In this case the data to be migrated has been backed up through the Cobian Backup software I used on the computer when it was running Windows, and it will be migrated back to the array once it has been set up. Due to finding that it is not possible to connect a camera via USB to the VirtualBox VM on the main PC, the third computer in the living room (one of the AMD E350s) is being reinstalled to Windows. This turned out to be surprisingly difficult to do with the installation of Windows 7 SP1 being unable to install updates, or Windows 7 without SP1 able to install updates fine until SP1 was installed, when the VM using the same ISO image had no such difficulties. Being unable to find any solution to the problem, including flashing a BIOS update, I have had to install Windows 8.1 instead. It is very difficult to understand what the problem could be as this computer has had Windows 7 on it before. However with 7 now out of mainstream support it is going to be more and more difficult to resolve problems with it and eventually MS will force everyone onto 10 as the only supported version.

Tuesday 21 June 2016

Today's Linux Tip - 21/6/2016

How to debug a program that is not working properly

If you are having trouble with a software application that is not working properly in Linux, start the command from a terminal shell. The shell will receive all the status messages from the application that you don't see in the GUI shell. You can see a lot of extra information about what is happening in the application.


Today's Linux Experience - Mint Vs Lubuntu

Today's Linux Experience is about the differences between Linux Mint and Lubuntu. Linux Mint is a full desktop experience distro intended to look and feel as much like Windows or other full featured GUI operating systems as possible. This is reflected in its resource needs. I have used Linux Mint extensively over the past four months and believe that like later versions of Windows, it is best used on systems with 8 GB or more of RAM. However it is not bloated in any sense and does not use a lot of disk space, but some of its components tend to use 1-2 GB of RAM in a typical installation, and curiously, Mozilla Thunderbird tends to use quite a lot of memory under Mint, so a system with 4 GB or less of RAM will tend to struggle a bit with a Mint 17 installation.

Whilst both Lubuntu and Mint are based on Ubuntu, Lubuntu has much more in common with its similarly named parent. Lubuntu and Xubuntu are both "lite" flavours of Ubuntu that attempt to reduce its memory and CPU use footprint. Lubuntu is by far the more successful of the two efforts at producing something that can run effectively on old slow limited capacity hardware. Whilst most of my six systems are now running Mint, I have retained Lubuntu for the only one that has less than 8 GB of RAM. This old computer (Wolfdale Celeron) is actually usable under Lubuntu when Mint would really struggle with it. 

It is a curious fact that the resources are not only what the desktop manager / windowing environment itself uses, it is what apps themselves use under that windowing environment. Thunderbird running under Mint uses a lot more memory and CPU than when it is running under Lubuntu. Of course this may be because the OS swaps more aggressively to disk. But the balance is great because the system is so much more responsive.

The main issue I have found with Lubuntu is difficulty in the installation of some more sophisticated software packages because it lacks some libraries. So it is not easy to recover some of those saved resources for powerful software packages. An example recently was to install KGrab, this simple screenshot application required 214 additional packages installed. Some attempts to install more substantial software have required considerable effort. That is the main reason why I do not have more computers running it. It is a great package for low end hardware for mainly internet based tasks that do not need powerful software packages to run. 

How to install the latest QGIS on Mint/Ubuntu

Here are how to install stable and unstable versions of Qgis.

Edit /etc/apt/sources.list and add the following lines:

Unstable edition

# qgis unstable
deb http://qgis.org/ubuntugis-nightly xenial main
deb-src http://qgis.org/ubuntugis-nightly xenial main
deb http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu xenial main

N.B. change xenial to the codename of whatever release of Ubuntu you have installed.

Stable or LTR editions
Change these lines in accordance with the instructions given on the Qgis download page.

Then enter these commands (all as root):
apt add-repository ppa:ubuntugis/ubuntugis-unstable

apt update

You will get this error message

W: GPG error: http://qgis.org trusty InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 3FF5FFCAD71472C4

To fix this you need to run the following command:

apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3FF5FFCAD71472C4

Followed by 

apt update 

Finally

apt install qgis

Monday 20 June 2016

Linux RAID-1 [5]

Just for future reference I think it is a good idea to write up the steps that are necessary to create a RAID-1 array. This guide is for Linux Mint 17.03 the version of Linux I am running on most of my computers. Refer to the source documents if you wish to create a different type of array. All these documents assume root rights so you either use sudo before each command as needed or open up a root shell.

The first stage is to configure the kernel with any additional kernel modules that are required to be loaded at boot time. To check if these are loaded, type

cat /proc/mdstat

The output of this command should refer to certain RAID personalities. For example on my system it reads

Personalities: [raid1] [linear] [multipath] [raid0] [raid6] [raid5] [raid4] [raid10]

This tells you what kind of RAID arrays you can run in your system. If information relating to your particular preference in RAID arrays is missing, you will need to ensure the required modules are loaded into the kernel. For the current session you can use these commands to immediately load these modules:

modprobe raid1

There is also a reference in the source documents to loading the md module in the same way but all my systems gave an error message stating they could not load the module.

To install these modules permanently, edit /etc/modules to add raid1 and md to the end of the file. This will still work even if there is no md module in your system.

The second stage is to install the mdadm package:

apt install mdadm

Once this has installed successfully we can move on to the task of creating our RAID-1 array. Here we are assuming the volumes to be assembled into the array have already been identified and are ready to go.

Assuming a two disk mirror with no additional spares the command would look like this (in my case):

mdadm --create --verbose /dev/md0 --level=mirror --raid-devices=2 /dev/sda1 /dev/sdd1

The form of the command is to specify in turn the mountpoint of the new array, the type of array, the number of devices to be added and the mount points of those devices.

The next thing is to do another iteration of

cat /proc/mdstat

which gives a progress indication of the building of the array. Another way to see this progress is to open the Disks gui tool. The new array will be visible along with an informational display including the progress and expected ETA of this task.

You need to save the configuration information by adding it to the end of /etc/mdadm/mdadm.conf. Please note this is the specific location for Ubuntu-based distributions, and other distributions may use a different location. Issue the following command

cat /etc/mdadm/mdadm.conf

If there is not an ARRAY statement for the array you just created, for example:

ARRAY /dev/md0

then this information needs to be obtained from the output of this command

mdadm --detail --scan

You can add this directly to the mdadm.conf file with this command

mdadm --detail --scan >> /etc/mdadm/mdadm.conf

It is recommended not to run this command until the array has finished initialising.

This information is needed in the mdadm.conf file in order to start the array at boot up and if it is not in the file the array may not start. This in turn could cause the system to halt during startup with a disk load error. So it is important to take note of this point.

The next step is to create and format a partition on the new md device. Give this partition a recognisable name for the next step.

To have the array mounted automatically at bootup you need the correct UUID for it. Which you can get from the blkid command. N.B. if you are not running this command as root, it will not output anything.

Before I got to this I rebooted the system, and then found that my array was renamed as /dev/md127. The blkid command output a line reading this:

/dev/md127: LABEL="Data" UUID="581966fb-0d41-4dac-bef3-c6de6267ec9e" TYPE="ext4"

In order to have this RAID drive mounted at startup, it must be added to the /etc/fstab file. The command in this file typically looks like

 UUID=581966fb-0d41-4dac-bef3-c6de6267ec9e /newhome        ext4    defaults        0       2

Note the UUID obtained above when creating this line. The mount point, file system and some other parameters that I don't know about must be included in the line you enter.

Once you have saved the changes to /etc/fstab then check your work by typing

mount -a

This will apply the mount point you just specified from the file. If there are no problems with this then you should be able to reboot and the system will come back up with the array mounted to the specified mount point.

This should complete the creation of the array.

Originally part 6 was going to show how to move the home drive to the new partition. Basically I just followed the instructions from the website below. Part 6 is now about reconnecting the RAID array after installing a new version of the operating system.

References:

Sunday 19 June 2016

Linux RAID-1 [4]

So the "new" RAID-1 array finished syncing and it was time to start testing it to see if it would work as planned. Unfortunately this did not prove to be the case. Attempting to mount the new array in /etc/fstab failed on a number of occasions because once again the system would stop dead during startup reporting the device is not ready etc. I have still not been able to work out whether this is because of the missing md module or some other issue. Because I eventually reached the outcome where fstab started stalling the startup even with all lines relating to /newhome removed completely from it, I have had to reinstall Mint again from scratch.

Here at least you do get a massive advantage over Windows. As your /home partition is on a separate volume, you can just remount it at install and start using it again as if nothing had happened. Whilst it is possible to change the profiles drive in Windows to a different drive, there are two problems with this. One is that this is unsupported to the extent that service packs will often not install, and secondly the system will create a new profile, in which all you can restore are files from directories like Downloads, Documents, Music and Pictures etc. You won't have the experience of being able to start up Thunderbird and seeing it load all your accounts and emails, or being able to install Opera and seeing it recall your history and sync settings. So a reinstall is a much faster process; the actual Mint installation takes at most 10 minutes, and for other applications there isn't this process of having to reinstall all the settings.

So at this point I went back to the test system to see if I could have more success in remounting its RAID-1 array at startup. Here I found similar to MainPC, the system has renamed the volume as /dev/md127 instead of /dev/md0. The main difference in this system was that I had created a partition on the new volume and labelled it "Data". When I went to the terminal and ran the blkid command I got a UUID just for "Data" (as opposed to the UUID for the RAID-1 array). I then came up with the idea of mounting that UUID in /etc/fstab. As it turned out this worked and using the mount -a command prior to rebooting showed there were no errors. When the system was rebooted it came up normally and the partition was mounted as /newhome as expected. I then applied these lessons to MainPC. Again it came up with a partition called "Data" with its own new block ID. I rebuilt the RAID array from scratch with MDADM and then once it had finished syncing, formatted it then got the UUID of the new partition and put that into /etc/fstab. mount-a produced no errors and rebooting the system came up properly.

So that has been an epic journey up to this point and it ain't over just yet. The next step is to restore /home to the RAID disks (previously it ran on a single one of the pair) and I am planning to let things stabilise for a week to show it all really is working well before I am prepared to move things back across again. In the meantime I want to have a look at mdadm's monitoring system to see how it works or perhaps there is an alternative system that will monitor the state of the RAID array.

Saturday 18 June 2016

Linux RAID-1 [3]

So at the end of the last post the system had not been able to startup because of a problem mounting the RAID array and the LiveUSB could not start the system because the Nouveau drivers had problems. As it happens all that is needed is to change some parameters in the LiveUSB Grub bootloader and these are similar to the ones I had to put into MainPC's bootloader to get it to start when it was first installed. I'm using the Lubuntu USB installer because the Mint one seems to have some corruption and the loader kept reporting problems with the USB ports and hubs. In the Lubuntu one you need to at the initial menu move the selection to "Try Lubuntu without installing" and then press e to edit the boot parameters, look for some text that reads "quiet splash" and replace it with "nomodeset" and possibly also "text". It would seem Nouveau issues are quite common out there and this works around those problems. See http://ubuntuforums.org/showthread.php?t=2289050

Once you have Lubuntu going then open LXTerminal and we need to mount the boot disk to somewhere convenient e.g, /mount/boot so make a boot directory inside /mount and then mount the boot volume to it. Lubuntu LiveCD allows you to use sudo without a password but if you want to take a shortcut and use su then you need some password and a blank one doesn't work. But that seems to be OK anyhow because sudo works well enough. Or you can just open the Disks tool from the Preferences section of the menu and it will mount the volume to a path inside /media so that is what I worked with in the end. Once I had got used to the fact I was working with the fstab in this path and not the /etc/fstab from the LiveUSB boot it was a simple step to comment out the line for /newhome's mount, and then the system rebooted and here I am writing the rest of this post from it.

This time I am doing all the steps starting from checking the RAID modules are loaded in the kernel. Well indeed the two modules needed, raid and md, are not being loaded in the kernel at startup so I followed the steps needed to make them load, however md is not installed and I can't find it as a package to install. I left that for now and went onto trying to sort out the array itself. A check with the Disks gui tool found that the array is not running. Rebooting (with the raid1 module now being loaded at startup) did not fix the problem. So I deleted the partition and now there is no RAID array reported so it is back to creating a new partition to see if I can make things work from here. Once I had the new partition I decided for good measure to recreate /dev/sdd1 from scratch as well, deleted the partition and created it from scratch, again all OK so it appears. With the disks looking like back to normal I went back to do the mdadm create command again and again it appeared to create normally and so the array is resyncing. This time both disks appear to be reporting as members of the array in all the commands I can run (last time it seems only one disk was reported) so maybe it is working better this time.

So I have to wrap up Part 3 of this series for now, leaving the new RAID-1 array to resync properly for a few hours and getting on with some other things, as my system is otherwise working well with its home partition on the removable drive caddy, then hopefully we can come back and maybe it will all work this time, but I am concerned about the missing md module which could still cause problems. However as I have been working on getting the system up and going for the best part of a day I have to leave it for now and come back to it later this afternoon once it has finished syncing the array. So a Part 4 of this series is coming.

Linux RAID-1 [2]

Well I have started on this having left it all week, it is now time to get the main computer set up to make this happen. As noted in my previous posting I am using this guide, although it has a different scenario for relocating /home in mind:


So making the backups was the first step. The regular backup from the Win7 PC was run with access to MainPC via Samba over the house network. Then a separate backup was made with a Ext4 formatted removable disk using the rsync command. This took an hour or three to copy 300 GB of data. At the moment it is actually moving towards live stage with another copy of the same data being made onto a second removable disk that is mounted as /media/patrick/newhome, with its own entry in /etc/fstab to remount it at each boot up. Once that copy is completed then the next step is to mount the removable drive as the new /home by changing /etc/fstab again. Then with the original disk now not required then I can move from there to set up the new RAID-1 array with the pair of disks as it was always meant to be. Life is a bit simpler on both my PCs because they each have a separate 120 GB SSD for the operating system and swap partition(s) which is not part of the software RAID-1 arrays, because booting off such an array can be difficult if not impossible to set up.

After relocating /home was completed the next step was to do a diff to see that the copying was exact. Oddly the diff command put out several messages about recursive directory loops. Probably these are due to symlinks that point in circles or something. Most of the other errors like no such file or directory are probably from dereferencing links that don't yet point to anything.

From there I moved to mounting the new home drive as the actual home drive and then rebooting. Before doing this I ran the rsync command again, after stopping the diff command because there were too many issues reported. Things looked good and the system came back up with its new home drive and things seemed to be working well so I decided not to wait to see if any problems would show up from shifting the home partition, but to press on right there and then and set up the RAID array.

Following the same steps as in the test system I installed MDADM and followed the steps to create a RAID-1 array. Things however haven't gone quite to plan and these last paragraphs are being written from the test system rather than MainPC. Even though the creation of the RAID-1 array looked OK, attempting to mount it would produce issues like saying dev/sda1 (the original home drive) was in use or the new mount name was busy. I decided to press on and reboot the system but then the normal startup stopped with an error about serious problems with /newhome, the mount point of the RAID-1 volume. It's apparent that this sort of problem will simply stop startup of a Mint system in its tracks; there is no error recovery for this scenario (like ignoring the mount because the volume isn't needed to start the system!) so as in my case it stops dead. Because I had not succeeded in getting /newhome to mount, there was no data on it and /home is running nicely on the spare disk in the removable bay, so /newhome was not an essential mount point for the system.

This means I now have to use a LiveCD/USB to start the system to a shell in order to comment out the line in /etc/fstab relating to the mount of newhome. I also realised after reviewing the steps I did with the test system that I forgot to check the modules were loaded into the kernel for RAID support. So the third post of this series (I thought there would only be two parts!) will be reporting on the subsequent steps needed to get the system started and the RAID fixed up and made operational. Due to issues with the NVidia card and built in Nouveau drivers (the ones I don't use in the GUI) the regular LiveCD/USB startups are hanging (something like the first boot experience I had with this system) so I need to do some research to be able to force a text mode startup. Back soon I hope...

Thursday 16 June 2016

Samsung vs Motorola, Galaxy J2 vs Moto E

At the weekend I bought my first Samsung phone, a Galaxy J2. I mainly got it because I needed 8 GB of memory instead of 4 GB, so as to be able to install more apps. So I have been able to put on Twitter which I was really after at the time, all the Facebook apps, and a few more besides.

The issues with buying a Samsung phone or the Galaxy J2 to date are as follows:
  • The amount of memory used by the system is higher than stock Android. So while adding 4 GB of memory should theoretically give you 4 GB more than what the Moto E makes available, that isn't the case. I went from about 2.2 GB left for apps to about 4.2 GB, so the extra Samsung software and built-in apps that you can't remove (or even disable) swallow up another 2 GB on top of Android and what the Motorola apps in the Moto E used.
  • Things like priority timers aren't available even though they are part of regular Android. On the Moto E when you press the volume controls you get offered the ability to set the priority to a lower level and have it restored to full level after a certain period of time. All the J2 has on it is buttons to make it vibrate or silent and turn on DND mode. There is no timer as there was on either the Moto E or various Nokia feature phones I used to own years ago. There is just the DND timer which you set at night to turn off emails and texts so you can get some sleep.
  • Some of the Samsung apps are not very good. I thought the email app seemed to be quite useful, until it started draining my battery. Its power usage is very high through using a lot of resources. Switching to Gmail, as I used on the Moto E, saw a huge drop in power consumption for the phone and that is how it will stay for now. 
The phone itself appears to be quite well designed, but as far as I can tell accessory shells are not available which is somewhat disappointing. There are the usual range of clip on covers, but as I only want to replace the back cover for something more personalised, that doesn't seem to be an option for this phone model.

Overall I am quite pleased with the phone once these beginning issues are resolved. I am up for question as to whether Samsung will release Android 6 for this phone. There is a 2016 update of the J2 due for release soon and it will come with 6, while from looking at leaks on the internet it looks like Marshmallow is due to be released for the 2015 J2 sometime later this year.

Once I changed all my emails over to Gmail and therefore stopped the built in email app from working the gain in battery life was immediate and huge. The system now uses 50% less juice in a day so the battery will last twice as long. Google doesn't state what the sync frequency is for Gmail accounts but it seems to work quite well with messages popping up almost as soon as they come in. I had thought of using the Outlook app to separate personal and work accounts as I did when I had the Moto E but the design of the current Outlook for Android app is really off putting. MS has decided to hide the technical settings such as account security and sync frequency completely away from the user. It means I can't be confident my Vodafone account is using secure transmissions at all and neither do I have a choice of how often messages are synced or how far back they go. MS is getting really patronising like this in the design of their apps and operating systems where they are focusing on chopping out settings and hiding them from the user interface so this is hardly a surprise.

I am overall very pleased with the design of the phone and how well it is working. Samsung haven't skimped on the design of this phone as much as I expected; it is quite classy compared to the Moto E although a different coloured back would be nice. Overall I tend to think a lot more highly of it than the reviewers who are slating Samsung for turning out a pile of phones that all look and feel the same.

Edimax EW-7811UAC Wireless Adapter

These days with wireless everywhere and getting faster all the time, there are situations where we need to hook up a desktop computer to a wireless network. The solutions these days can include a card installed in the PC, or a plug in USB device. Internal cards have the advantage of having an external antenna that could be substituted with one of a higher gain if your situation demanded it. However there are times when a card is not an option, in my case my Mini-ITX board has no PCI Express slot in which a card could be installed. Hence I am limited to USB devices.

Edimax has a nice little and cheap 802.11ac solution which retails for around $40 in NZ in the EW-7811UAC, which also includes an accessory USB cradle with a 1.2 metre cable so you can put the adapter a distance from the computer for better signal reception. The photos below show the device. The overall height of the unit when attached to the cradle is around 20 cm.


The CD comes with drivers for Windows, Mac and Linux. The Linux driver was the subject of yesterday's post about compiling and installing a hardware driver. Suffice it to say that the supplied instructions will get you no further than how to load the driver into your current running session, and additional knowledge is needed to have the driver reloaded automatically each time the computer is started. Admittedly these instructions will vary between distros. Doing it a second time on a different Linux Mint computer from the one used to write yesterday's post was very straightforward and should pose no issues for competent tech-savvy Linux users. However when the computer was resumed from hibernation although the adapter still appeared to work the little blue light on it did not flash anymore. This was fixed with a reboot and there may well be an issue for the driver when a system is hibernated and then resumed. This may also be an architectural limitation of Mint as hibernation is a relatively new feature for some Linux systems and not 100% dependable in my experience to date, although fair to say it can be because of hardware issues on some systems.

The adapter gives variable results with my 802.11n home router on Speedtest.net from 5-15Mbps. I am not sure why the variance shows up. When hooking to a full 802.11ac network the typical speed is around 35-40Mbps. So with 802.11ac access points and strong signal reception it can go quite well but the claimed 433Mbps speed seems to be just puffery. The only time I have seen anything like that on wireless is when using a point to point link between a pair of Ubiquiti Nanobeams. It may be however that the network I am using for these tests has some kind of limiting applied, in fact I think in both cases the speeds were likely to be the result of rate limiting on those networks. A little more playing has got me 25Mbps on the home network so putting this thing in the right place also helps. Since that is only 802.11n it is a pretty good result and it would seem the purported benefits of 802.11ac are only achievable over short distances, at the distance I am at I am probably not getting much 5 GHz signal which ac works on so maybe that is the reason I am not seeing much speed on that system.

Wednesday 15 June 2016

Adding a driver to Linux

UPDATED 23/8/16

Revised instructions using a generic driver downloaded from Github. These instructions were needed for the same wireless adapter but under Xubuntu 16.04 the kernel used was a newer version meaning the manufacturer drivers wouldn't work.

Firstly install the build headers etc

sudo apt-get install linux-headers-generic build-essential

Next thing is to download a generic package from the internet Github site:
https://github.com/gnab/rtl8812au/archive/master.zip

Unzip the file (choose "Extract here" in Archive Manager) and you will get a folder called rtl8812au-master

cd rtl8812au-master

Then build the driver

make
sudo make install
sudo modprobe 8812au

Then copy the module file to the modules folder

cp 8812au.ko /lib/modules/`uname -r 

Final step is to add it to /etc/modules

nano /etc/modules

Put 8812au onto the last line of the file and then save and quit.

This is coming up as expected. The main problem I am having is the system seems to spend all its time trying to detect a network on the ethernet adapter and consequently seems to run into problems with getting the wireless up or else it tries to access the internet through the non existent ethernet. I am still working to debug this at the time of writing. With a router connected supplying a DHCP address on the ethernet adapter the wireless came up and worked properly.



Original instructions using the manufacturer supplied driver (for matching kernel version 15/6/16

If you have a device driver and it comes with files to build a Linux driver, you may have to do some work to get it to load the driver when Linux starts up. I had this experience recently on testing a new wireless adapter for a desktop computer. The instructions supplied with the device were basically incomplete insofar as they only got you to the command needed to load the driver for the current session. The sequence needed to get the driver to load automatically on subsequent sessions was absent.

Let's go back right to the beginning of what was needed to build this driver and have it loaded on startup. Since most of these commands need to be run as root, first thing to do is to change to root by using the su command.

Then we need to ensure build-essential is installed:

apt install build-essential

This ensures we have things like the Linux header files and the gcc compiler available for use.

Next was to copy the tar.gz file supplied by the manufacturer to the Downloads folder and then extract it with tar xfvz command sequence.

Then change into the directory it created to hold the extracted files.

Build the driver by executing

make

Test the resulting .ko file using insmod:

insmod 8821au.ko

At this point the driver is loaded into memory for only the current session. Since I wanted the driver to load in each session at startup I have to copy that 8821au.ko file to the right folder:

cp 8821au.ko /lib/modules/`uname -r`

The last bit of the command is a clever expansion that will ensure you go into the folder that corresponds to your current kernel version. Note that we aren't using single quote marks, we are using backtick characters (the key to the left of 1 on most keyboards).

If you then use depmod it should come back with no errors

depmod -a

then use modprobe to ensure it will load

modprobe 8821au

(the .ko extension can be left off for modprobe)

Then use lsmod to check it is loaded.
Final step is to add it to /etc/modules

nano /etc/modules

Put 8821au onto the last line of the file and then save and quit.

Then restart the computer as the last test step.

In testing the system it was able to hotplug this USB wireless adapter with no issues (as it should be able to with a USB) so that is a good result.


Monday 13 June 2016

Linux RAID-1 [1]

Well I have made a start on testing the RAID configuration for my main PC. After looking at various scenarios, the one that fits the closest is incorporated into the documentation at this site:

In addition the following was referenced for some of the initial setup steps:
In order to make a start I have already (at install time) set up two partitions of identical size (320 GB each). This was done using a 320GB and a 500 GB disk. The 500 GB disk was further partitioned to produce the swap partition and the full install partition (mount point /) for the Linux Mint install for this computer. Mint was installed and I am now working in the Mint installation to set up the RAID-1. The partitions are /dev/sda2 and /dev/sdb1.

Referring to the second reference document (linuxconfig.org) we work through section 3, install mdadm, then section 4.1, loading kernel modules. In other words we are having raid-1 and md modules loaded by adding lines for them to /etc/modules file. Then the system is rebooted to get the modules loaded. Doing a cat /proc/mdstat now reveals that we have RAID-1 support loaded.

We then go to the first reference document (raid.wiki.kernel.org) and go to section 1.5.3 to create a RAID-1 array. In this case the command looks like

sudo mdadm --create --verbose /dev/md0 --level=mirror --raid-devices=2 /dev/sda2 /dev/sdb1

The next step after the command completes is to look at /proc/mdstat again and read the output, which tells us that the raid-1 array has been created and gives an estimate of how long the initialisation will take to complete. In my case I have also opened the Disks applet from the Mint menu to take a look at how the new disk shows up there, and it appears categorised as a RAID array with all the right information and gives me a graphical representation of the syncing process. At this stage I elected to use the GUI to format the new drive and name it, and then was able to mount it even though the rebuild isn't yet complete. It therefore appears as a new 320 GB volume in the filesystem, but doesn't have any special standing because it hasn't been mounted within the regular filesystem tree of the installation.

Once the initialisation is complete there is one more step and that is to save the RAID configuration. After switching into SU mode (by issuing the command su) we can run the following:

mdamd --detail --scan >> /etc/mdadm/mdadm.conf

The reboot that followed proved that the volume was recognised again on startup. 

Now that we have our RAID running, the next issue to be tackled is how to relocate /home. In the case of my real world system, this relocation will have to occur twice. Firstly, /home will have to go temporarily to another disk, and secondly, after creating the RAID-1 array, /home then gets moved back on the new RAID volume. Here is some documentation I have looked at so far:
For the test I will put some data in place to be copied across from the existing location within the install partition.

For the real thing I need to undertake some steps as follows:
  • Run a full backup, probably not using the Windows based backup but a native Linux one on a removable disk.
  • Find a disk from somewhere to be the temporary home of /home and put it into the removable drive bay of the main PC.
  • Move /home from the internal drive to the removable drive
  • Set up the RAID-1 array using the two internal disks.
  • Move /home from the removable drive to the new RAID-1 array.
So that will gradually happen over the next few weeks, depending on how long it takes to run my test case on the demo machine.

More Mint and a system monitor applet

After playing with a lot of Lubuntu systems I have started to prefer Mint where enough memory is installed because it is often easier to install higher spec apps like Qgis. Lubuntu is really good for a lower spec system which doesn't get used for more than internet stuff and I really recommend it for general use but if you are a power user with some grunty apps then you will find that Mint is easier to install some of these apps on. Google Earth is another example. I could not get it to install on Lubuntu without a lot of hacking and trying various things and the failed attempts also removed a lot of Lubuntu base install applications. I eventually restored most of them manually.

So yes Lubuntu is great and highly recommended but if you have 8 GB or more of memory, even on what is a very old Conroe system that I use at work (at least 8 years old), Mint will go really well and make it easier to install power user applications.

Since I put Mint onto that old Conroe I have struggled to find a system monitor applet to put into the panel. I also have decided one of my screens will have two panels with the one at the top of the screen displaying the clock, system tray, launchers, status icons, workspace switcher and the aforementioned system monitor applet. The one that I finally found that works very well is called System Monitor and its UUID is sysmonitor@orcus. This was after I had tried quite a few that Cinnamon didn't like and disabled. You can find it in the list of available applets (online) that is in the add applet dialog box when you right click and select add applets to the panel. Be aware that you need to install a couple of dependencies and should do this in a terminal before you tell Mint to install System Monitor. The packages you need to install are:
  • gir1.2-gtop-2.0
  • gjs
Whilst it will work with only the first package installed, the second one is needed to change options for the graphs it puts into the taskbar. These graphs look like the ones that are in the system monitor applet that is included with Lubuntu and that is the look I was trying to get from a Mint applet as all I really need to see are a couple of boxes displaying the CPU load and memory usage so that I can tell when the system is really bogging down. It is actually quite surprising how much more performance you can get by increasing the RAM to 8 GB. This old Conroe can do that much memory because it has four slots. I remember my old Intel G41 system which is actually newer (the Conroe is a Intel Q35 system) being limited to 4 GB of RAM because it had only two slots. That system was really an object exercise in getting the right balance between price and performance. Most of the decisions I made such as buying LGA775 right at the end of that architecture, a Celeron CPU (Wolfdale-3M) and a board with only two DIMM slots were bad decisions in hindsight as the result is a system that has fallen well below useful after only three or four years, now struggling through its sixth year of life. Every system I have built since (with the exception of a couple of embedded mini-ITX Atom boards, and their replacement AMD E350s) has been specced for at least 8-16 GB of RAM with four slots, and the Pentium G is my preferred CPU for domestic use, being functionally equivalent to a Core i3 except for disabled hyperthreading.

I am now setting up one of my two AMD E350 board systems (Gigabyte GA-E350 WIN8) as a Mint testbed. What I need to do with it as a very high priority is to work out how to add RAID-1 to my Main PC at home as this has the disks but it was not set up when I installed or since because there are no nice GUIs unlike Windows. In other words I will probably have to move /home off the disk it is on to a disk that goes into the removable drive bay, then configure the RAID-1 and then migrate /home back to the RAID-1 array. So that is what the testbed is for. After I have finished with that it will become a Windows 10 testbed so I will have a Windows 10 computer in the house after all. But it will only be used for testing easyworship to start with.

The retreat from Lubuntu has now been completed with the second AMD E350 (identical motherboard to the other) also being installed with Linux Mint. But I continue to have a pen drive dedicated to the Lubuntu64 installer, and use it on some virtual machines. As I have stated above it is a great system for 4 GB or less of memory; once you are able to get as high as 8 GB, its advantages are no longer so clear cut because the CPU spec or speed is not so significant when such a large amount of RAM is installed. The second AMD E350 is in my workshop and will have a wireless connection to another network. It is being used primarily for work related to that network, which is not very much work at all at the present time. But hopefully the wireless connection will work well. I have had sooo much fun with a little Edimax nano adapter supposedly rated to 150Mbps which seems to be able to get real-world about 5Mbps on my home Wi-fi. So using another wireless antenna I have here I hope to be able to get a much faster speed. Well indeed I eventually tested with a much better Edimax solution, a wireless 802.11ac USB adapter with a big aerial on it. It turns out to be at least 5-10 times faster particularly on a 802.11ac network.

Another thing I am trying on my two work PCs is using Chrome instead of Chromium. Since it turns out Google makes a release of the full Chrome product for Linux alongside Chromium which is the open source part of the Chrome package. The newest one also has Firefox Developer installed from a source other than Ubuntu Make, which I could not find to install. I got FFDE from the Mozilla site instead. Once it is extracted you need to copy the firefox folder to somewhere, for example /opt (with root privileges needed) and then make a firefox-dev.desktop file for the menu entry which you put into ~/.local/share/applications where the Cinnamon menu thingy will pick it up automatically. The contents could look something like this (the firefox folder has been renamed to firefox_dev):

[Desktop Entry]
Name=Firefox Developer 
GenericName=Firefox Developer Edition
Exec=/opt/firefox_dev/firefox
Terminal=false
Icon=/opt/firefox_dev/browser/icons/mozicon128.png
Type=Application
Categories=Application;Network;X-Developer;
Comment=Firefox Developer Edition Web Browser.

This has worked just as well as the Umake version.

Thursday 9 June 2016

Windows / Android

Well the Windows 7 computer has been set up and is doing a great job of running Windows 7 instead of 10. Of course MS will try to phase out Win 7 support as soon as they can so when that happens I will have to try to work out what I am going to do with it because of my very strong feelings about subsequent versions. I may be pushed onto 8 or 8.1 but it may well be the case that the support for these versions doesn't last a whole lot longer. I also support on a voluntary basis a Win7 computer next door so I am not sure how well this computer can transition to Win10 or later in the future. A big issue for that computer is that it has Intel Skylake architecture, which while being a great advance on its predecessor for speed and so forth, only has support from MS on Win7 for a limited period. MS naturally wants to push everyone using such a late architecture onto 10. But then there are the other issues with 10 that make it less suitable for a projection computer for example. At least on Win7 Enterprise you don't get the annoying "Install Windows 10" popups and enticements that people have been scammed with by MS on other editions of 7. People in the IT industry I know or work with seem to get asked quite often how to uninstall Windows 10 because they have been tricked into installing it without awareness of its differences.

In the phone area I am about to purchase my second Android phone, the Samsung Galaxy J2. The main thing I am attempting to achieve is to get a phone that has more than 4 GB of onboard storage. In Android there are many apps, particularly the built in Google/Android ones, that can only install into the onboard storage. Since the Moto E running Lollipop can only make 2.2 GB available for installs, it has filled up all this space long since leaving me with only a few extra apps I can use and I run into problems every time I get an app upgrade or want to add some new app. Ideally of course 16 GB would guarantee no more problems ever but there is a big leap in price to 16 GB, the only models I can see are the Galaxy A3 at $549 which is way too dear. In other words I should have thought that the extra cost of the Galaxy J5 over the J2 would have brought more memory whereas in actuality Samsung has decided the extra $100 is to be expended on a bigger screen and 13 megapixel camera. It will be interesting to be buying a phone that has a front camera for the first time and the most annoying limitation of the Moto E phone has been its fixed focus which has often resulted in blurry photos. I have elected to buy the phone outright and not be locked into a contract for two years to pay for it as well as keeping the special terms of my current contract (a big data allowance) which was a one off special and is not currently available in general although in a practical sense there are similar plans at similar or slightly cheaper prices considering the amount of talk time and data I actually use on it.