Home Uniquely NZ Travel Howto Pauline Small Firms Search
Global Communications and Computing
The Chillblast Defiant Optimus Mini Laptop

This page covers the setting up of my Chillblast Defiant Laptop running under a dual booted system with Windows 8.1 and Linux Mint although I have never used the Windows system! Mint is built on top of Ubuntu and both sit at the top of the popularity stakes but Mint has the advantage of the Cinnamon Desktop. The Defiant 2 and Defiant 3 have upgraded video chips and a slightly faster processor but are otherwise identical. The nVidia drivers are the same for both models so everything written here should be equally applicable to both models.

The 'Bottom Line' is that everything that is essential, works 'out of the box' although a couple of tweaks are still desirable and, of course, software needs to be installed to handle the dual graphics configuration and save power by switching the discrete graphics card on and off when not required. The latest kernels in Mint 17, 18, 19 and 20 have greatly increased the support for the advanced Optimus configuration and nVidia GTX 765M, 860M and 960M cards. I have written applets to support the dual graphics configuration and monitor the GPU temperature but they are largely redundat now.

I have updated progressively to Mint 20 which is a LTS (long term support) version with up to 5 years life from Mint 16, either by updates or reinstallations using the same home folder. The text has been updated but the old version for Mint 16 is here. Mint 19 had considerable differences so there is quite a big upgrade section included covering Mint from 18.3 to 19. The changes to 20 have been less challenging.

I have also installed a 250 Gbyte Samsung 860 evo SSD drive which has made a considerable speed up in boot times and made the machine feel even more lively - install one from the start!

Contents

The Chillblast Defiant and Linux - Background and Requirements

We spend quite a bit of time away from home and we have two MSI Wind Netbooks which have enabled us to keep up to date with most activities and provide music through the WiFi and bluetooth connection on our narrowboat and even watch some TV through a dongle. They are many years old and have been running out of power. But what finally precipitated Pete into looking for a replacement was the old video camera gave up and the replacement was, of course, HD and the ageing desktop could barely handle the load of video processing, leave alone the netbooks. During investigating a replacement it became clear that the nearest specification to meet our requirements tended to designated ''gaming' computers with both fast processing and good graphics. In looking through possible machines we came across the Chillblast range - they have a very good reputation for their desktops but have also started to produce some 'gaming' laptops including a small one called the Defiant which looked powerful enough to even handle video editing. We always keep up with pictures on route but this would give the opportunity to keep up with videos to avoid increasing the huge backlog. The Defiant has a Haswell architecture with an Intel Core i7 Quad processor (effectively 8 through hyperthreading) and two graphics processors, the integrated Intel 4600 GPU and an extra nVidia 765M Graphics Processor Unit (GPU) combined with the Optimus technology which only powers up and uses the power consuming discrete GPU on demand thus providing a reasonable battery life. Preliminary checks show it renders video about 5 times faster than the current 64 bit AMD Athlon 5000+ desktop and 25 times faster than the MSI Wind U100. It renders H.264 720i video at about 80% of real-time and 1080i even full HD (1080i) editing should be perfectly practical on the move.

We wanted obviously wanted a machine which was light for traveling but powerful and versatile enough to replace the Desktop and was largely self contained. The Defiant has a 13.3" 1920x1080 screen and weighs 2 kgs plus the weight of a 120 watt power adapter. It has a 1000 GByte hybrid drive (8 bytes SSD smart buffer) and 8Ggbytes 1600 Mhz RAM. It has no DVD but has Wifi, Bluetooth and an SD card reader and an HDMI output as well as VGA. We expect to largely run Linux but would prefer to also have a dual boot to Windows because of Pauline's teaching where we have to be sure that everything will work 100% although we can not remember when Pauline or Peter last used Windows other than helping others to remove the inevitable viruses. The following notes on the installation of Ubuntu are based on our Road to Freedom - A progressive migration from Windows to Ubuntu for Safety, Security and Savings in Home Computing and this will eventually provide a third part to that series - perhaps we will call it The High Ground.

Chillblast Defiant 13" Laptop with Haswell/Optimus Architecture,
Core i7 Processor and nVidia GTX 765M graphics - Specifications

The Chillblast Defiant was designed for gaming so has exactly the sort of specification which is required for Full HD Video editing. It has a vastly powerful Core i7 4700MQ 2.4 Ghz (3.4 on Turbo) quad-core (8 thread) processor, 8GB of 1600MHz DDR3 memory and mine has a NVIDIA’s GeForce GTX 765M. It has Optimus technology so when I am using the machine for something less demanding than Video processing, the GeForce switches off and the Intel HD4600 takes over, saving considerable power. It has a 13.3” screen with a Full-HD 1920 x 1080 non-reflective display.

A 1000GB hybrid SSD / HDD gives rapid fast response rates and plenty of space for Video editing in a single device, 2 mSATA SSD slots are available to provide even faster dedicated storage for the OS if desired. 8GB of RAM comes as standard, expandable to 16GB. I added an 250 Gbyte Samsung 860 Evo SSD at a latter stage.

The Defiant measures 330mm x 227mm x 329mm and weighs 2.1 kg including the battery and is claimed to have up to 5 hours battery life which i never acheved. The MSI Wind has 5.5 hours on its power bulge 9 cell battery and weighs 1.4 kgs for a 10 inch 1024 x 600 screen. It should be a huge improvement.

Full Specification:
Core Logic: Mobile Intel® HM87 Express Chipset
Display: 13.3” (33.78cm) FHD (1920x1080) 16:9 panel, 2.8mm
Memory: 8GB 1600MHz DDR3 Memory (Expandable memory up to 16GB)
NVIDIA® Optimus Technology: GPU switchable between iGPU and dGPU
NVIDIA® Geforce GTX 765M (N14E-GE) - 2GB GDDR5 Video RAM
Storage: 1000GB Seagate Momentus XT Hybrid SSD/HDD
UK layout Keyboard
Built in touch pad with multi-gesture and scrolling function
SOUND BLASTER Cinema Surround Sound
1 x USB 2.0 port
3 x USB 3.0 ports(1x powered USB port, AC/DC)
1 x HDMI output port (with HDCP)
1 x external VGA port
1 x Headphone jack
1 x Microphone jack
1 x RJ-45 LAN port
1 x DC-in jack
6-in-1 Push-Push Card reader (MMC / RSMMC SD / Mini SD / SDHC / SDXC)
802.11N Wireless
Built in 10/100/1000Mb Base-TX Ethernet LAN
2M HD video camera
Full Range AC adapter, AC in 100~240V, 50~60Hz, DC output 19.5V, 6.15A, 120W
Removable 6 cells Smart Lithium-Ion battery pack, 62.16WH
Battery life : 300 minutes (UMA mode with 62.16WH battery)
Kensington® Lock
330 (W) x 227 (D) x 31.9 (H) mm
2.1kg, including 62.16WH battery
Motherboard with heat sinks removed - source unknown Motherboard with heat sinks removed - source unknown
Motherboard with easy access to all memory and all drive and peripheral slots
Heatpipe removed to show CPU and GPU. Two mSATA SSDs are also fitted in this picture.

Using Optimus under Linux

nVidia Optimus is an computer graphics hardware power/performance optimisation technology created by nVidia which, depending on the resource load generated by client software applications, will transparently and seamlessly switch between two graphics adapters within a computer system in order to provide either maximum performance or minimum power draw from the system's graphics rendering hardware. With Optimus you can choose when to use the more powerful and battery consuming nVidia graphics card or to use the integrated power saving Intel or ATI graphics. This allows you to improve your battery life while also giving you access to more powerful graphics when needed.

Up untill recently the best way for Optimus enabled laptops to work in a Linux systems was a project called Bumblebee which enabled the nVidia Optimus Graphics processor. The latest versions of Bumblebee provided automatic power management so the nVidia Graphics card is turned off when the machine is started to save power and heat generation and is only turned on for programs which required it. A program which requires the graphics processor is specifically started in that mode by the user through Bumblebee and the Graphics card is automatically turned off when it is exited. Recently nVidia have made available their own software which works alongside their proprietory drivers to enable one to switch between the Inbuilt Intel Graphics and the more powerful but power consuming Nvidia Graphics. The sytem is called nVidia Prime. It works slightly differently in as much that it one or other graphics processor is enabled all the time and can only be switched by loging out and back in. Bumblebee enables selected programs to be called using the nVidia whilst everything else continues to use the lower power built in Intel Graphics.

Bumblebee is included in the very latest Ubuntu/Mint Distributions so most users may not need to install it through a PPA, likewise there are up to date nVidia drivers although the latest can be accessed through a PPA. Despite what people say it works on both 32 bit and 64 bit Linux kernels and the 32 bit systems seem to be more robust and supported. Initialy it did not seem to work well with the latest nVidia drivers but they have good built in support via nVidia Prime and that is automatically set up in the latest versions of Mint so I switched to nVidia Prime when I updated to Mint 17.3 Rosa. Since then I have switched back again to Bumblebee and it seems to work with both 17.3 and 18.1 although some tuning needs to be done depending on the drivers and Cinnamon one is using.

Chillblast are being very helpful and I found out at an early stage know that the Defiant is based on the Clevo WS230ST chassis and I was able to download a 'generic' manual from the Clevo web site which answered some of my questions on the BIOS whilst I was awaiting delivery. More importantly it enabled me to widen my search to other machines using the same chassis and I have come on a very useful thread namely the Sager NP7330 Linux Guide/Review which indicates that some people are successfully running a machine based on the same chassis under Linux. There is also a lot of information in these threads http://forum.notebookreview.com/sager-clevo-reviews-owners-lounges/715556-official-clevo-w230st-sager-np7330-owners-lounge.html and a very full review here http://forum.notebookreview.com/sager-clevo-reviews-owners-lounges/725922-htwingnuts-sager-np7330-clevo-w230st-review.html . There are other firms using the chassis (in the USA) but nothing like the coverage as the Sagar.

Things I initially did before installing Linux with dual boot.

This was not very different to the approach in The Road to Freedom except that Backup was not be so important as it will be a largely empty machine however Virus checkers and firewall ought to be installed even if Windows 8.1 is supposed to have its own built in. So the plan (which was largely followed so I have put times from opening the box in hours and minutes in brackets) was:

The first time it only took me 3 hours to get a protected Windows 8 system with a large chunk of free disk space to install Linux and run a LiveUSB.

Accessing the Chillblast Defiant Setup and Boot Menus

Howto Access the Bios Setup and Boot Options

Setup: To enter Setup, turn on the computer and press F2 (give the system a few seconds to enter Setup; the F2 on screen will be highlighted to illustrate that the system is processing the request) during the POST (or press F7 for boot options). If you get a “Keyboard Error”, (usually because you pressed F2 too quickly) just press F2 again.

Boot Menu: To see the boot options press F7 there seem to be two wide windows of time so this is easy with a LiveUSB but DVD drives may not be ready and require a pass in an out of the Bios Setup to buy time.

Warning: It has been reported that incorrect Bios settings can cause a Haswell Optimus system to malfunction. To correct mistakes, return to Setup and restore the Previous Values with <F2>, or Optimised Defaults with <F3> Practice this 'blind' as some Optimus and NVidia setup errors can reputedly leave a blank screen on some machines until the BIOS is reset to Optimised Defaults! I would rather not find that out the hard way. I have seen no problems to date

Tests using a LiveUSB and LiveDVD

I downloaded the iso of Ubuntu 13.10 Saucy Salamander 64 Bit (AMD) version and used UNetBootIn under Linux to create a LiveUSB with Persistence as well as burning a standard LiveDVD . UNetBootIn runs under Windows and Linux to create the Live disks. Neither this or the equivalent Mint Olivia would boot on the Defiant either from LiveUSB or DVD using F7. The DVD needed time to spin up and be recognised so I found entering and then leaving the BIOS setup (F2) gave time for it to show up on the next F7 in the Boot menu as the machine was not powered down that way.

To cut a long story short both Mint 15 Olivia and Ubuntu 13.04 were happy to boot in x64 and i32 forms after the changes below. I did a lot with Mint Olivia x64 in Persistent LiveUSB form including installing updated nVidia Drivers from the PPA (version 319.49) and then Bumblebee (version 3.21) from the it's PPA and got some very impressive results with glxspheres which ran about three times faster on the nVidia 765m than on the internal Intel 4400 which was still much faster than anything I have. The current version numbers will be different.

Disk Partitioning

It is now time to discuss partitioning the hard drive

This should be a two part process with the initial shrink of a partition under Windows and final partitioning using Gparted under Linux. Somewhat to my surprise it was using the older MBR partitioning which implied that it was not UEFI booting machine which I had expected from a machine running Windows 8.1. Ubuntu/Mint will handle UEFI but it would have put a requirement of a 64 bit install. It was avery basic arrangement with a large partition for Windows (C: drive) and a small reserved partition which probably contains recovery software but not a full install image which many computer manufacturers do for easy of support and the economy of not having to provide DVDs nor the special partition for the UEFI boot. It did make it very easy as I knew reasonably well what I was doing and had done it all with the same software lots of times. All that was left was the exact planning. and layout.

So what I had was just the first tiny 350 Mbyte partition which should not be touched and a huge NTSF partition (C:) with Windows system covering the rest of the disk. So how far to shrink i? Windows 8.1 has to have a minimum of 20 Gbytes but I had lots of space so I chose 120 Gbytes so it could still be really useful or could be shrunk again. I needed several partitions and the maximum number of primary partitions under the old MBR scheme is 4 so I used one for a swap space and put all the rest into a logical partition. Swap is conventionally at the top (unless there is already a Windows recovery image partition) and 2 x the real memory and but that gave 16 Gbytes but so what as there is a lot of space. 8Gbytes would be plenty and the chances of using even that much with linux is very small even with video work.

This was initially planned to be a 64 bit system so I roughly doubled what I would normally consider for the root partition (/ 40 Gbytes) and reserved space for another root partition (30 Gbytes) so I could triple boot during development. I also left part of it unallocated at this time (for a spare home partition or encrypted partition for security??). Then I added a home folder to share between my systems of 200 Gbytes (/home) and the rest 500 Gbytes as an NTFS partition for data (/media/DATA) which can also be accessed from Windoz.

Screen Shot Screen Shot

The screen dump above is from my actual set up After Mint has been installed so the mount points show. The partition labeled reserved is to allow an extra system to be installed and allow triple booting of a development system in the future and there is also an unallocated area for an extra home partition or system (or anything else I have not thought of yet. I am now leapfrogging forwards using these two partitions in turn and as I update this I have Mint 16 and Mint 17 RC installed.

Since setting up the Defiant with Mint 15 a new feature has been included which is called TimeShift which makes a considerable difference to the size of root partition required. TimeShift is fundamental to the new update manager philosohy. To Quote "The star of the shown Linux Mint 19, t is Timeshift. Thanks to Timeshift you can go back in time and restore your computer to the last functional system snapshot. If anything breaks, you can go back to the previous snapshot and it's as if the problem never happened. This greatly simplifies the maintenance of your computer, since you no longer need to worry about potential regressions. In the eventuality of a critical regression, you can restore a snapshot (thus canceling the effects of the regression) and you still have the ability to apply updates selectively (as you did in previous releases)." The best information I hve found about TimeShift and how to use itl is by the author.

TimeShift is similar to applications like rsnapshot, BackInTime and TimeVault but with different goals. It is designed to protect only system files and settings. User files such as documents, pictures and music are excluded. This ensures that your files remains unchanged when you restore your system to an earlier date. Snapshots are taken using rsync and hard-links. Common files are shared between snapshots which saves disk space. Each snapshot is a full system backup that can be browsed with a file manager. TimeShift is efficient in use of storage but it still has to store the original and all the additions/updates over time. The first snapshot seems to occupy slightly more disk space than the root filesystem and six months of additions added another approximately 35% in my case. I run with a root partition / and separate partitions for /home and DATA. Using Timeshift means that one needs to allocate at least an extra 2 fold storage over what one expects the root file sytem to grow to.

In the case of the Defiant under 18.3 the root partition has grown to about 11 Gbytes and 5 months of Timeshift added another 4 Gbyes so the partition with the /timeshift folder neeeds to have at least 22 Gbytes spare if one intends to keep a reasonable span of sheduled snapshots over a long time period. After three weeks of testing Mint 19 my TimeShift folder has reached 21 Gbytes for a 8.9 Gbyte system!

This space requirements for TimeShift obviously have a big impact on the partition sizes when one sets up a system. My Defiant was set up to allow several systems to be emplyed with multiple booting. I initially had the timeshift folder on the /home partition which had plenty of space but that does not work with a multiboot system sharing the /home folder. Fortunately two of my partitions for Linux systems are plenty big enough for use of TimeShift ( 40 and 45 Gbytes ) and the third which is 30 Gbytes is accceptable if one is prepared to prune the snapshotss occassionally.

Important Information on using SSDs (Solid State Drives)

There are also some quirks with several SSDs when using Linux, one of which is a show stopper as the Samsung 850 Evo is favoured by Chilblast. There is a work-around in later kernels which has been backported to the Kernels which Ubuntu updates to but not the kernel recommended by Mint. See https://bugs.launchpad.net/ubuntu/+source/fstrim/+bug/1449005 and https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1338706. The kernel in use must newer than 3.13.0-57.95, 3.16.0-43.58 or 3.19.0-22.22. Kernels older than 3.12 and latter than 4.0.5 are all fixed.

In summary you will lose data with the recommended configurations of Mint 17.0, 17.1 and 17.2 if you have a current Samsung 8xx series SSD (or older models if you update the firmware) and you have TRIM enabled which is also the default for Mint and Ubuntu.

The problem occurs because the latest SATA specification includes a version of TRIM which queues requests. This has been implemented in kernel 3.12 but the Samsung SSDs have an error such that they report it is available whilst it actually does not work and destroys data. Older drives have updated firmware which then produces the fault as well. The fix in the kernel blacklists all calls to queued TRIM for all Samsung 8xx (including Evo and Pro) SSDs.

The kernel in Mint 17.3 is likely to be OK so I am not adding fixes yet - web searches will show how to disable TRIM in Ubuntu, in the short term the slow down will be acceptable.

Since setting up my machine I have found out a lot more about use of SSD disk drives. Mine has a hybrid drive which, I hope, has some internal optimisation but if you have a pure SSD then one wants to reduce the writes to the drive, align partition boundaries (gparted normally does that) and use a file system which allows trimming of the drive (ext4 rather than ext3 or ntfs) and efficient journalling. I am adding a new page to cover Optimising Drives, in particular SSds

Repairing a boot

After finishing the installation, it is possible to find that you have Windows 8 disabled from booting and it only boots to Mint (or Ubuntu), do not worry. In this case you can install a small utility to sort this out.

sudo add-apt-repository ppa:yannubuntu/boot-repair
sudo apt-get update
sudo apt-get install boot-repair

Now run boot-repair

Boot Repair may report mention a GRUB error. In most cases, just click on Apply and boot repair fixes everything. Now reboot and you should see again see a Windows 8 and Ubuntu/Mint options. I should add I have installed boot-repair as a precaution but have not yet used it in anger!

Turn off the Fast Startup option as it will lock one or more of the drives used by Windows making them inaccessible to Linux

Fast Startup (aka: hybrid boot or hybrid Shutdown) is a new feature in Windows 8 to help your PC start up faster after shutting down. When turned on, Windows 8 does this by using a hybrid shutdown (a partial hibernate) method that saves only the kernel session and device drivers (system information) to the hibernate (hiberfil.sys) file on disk instead of closing it when you shut down your PC. When you start your PC again, Windows 8 uses that saved system information to resume your system instead of having to do a cold boot to fully restart it. Using this technique with boot gives a significant advantage for boot times, since reading the hiberfile in and reinitializing drivers is much faster on most systems. Unfortunately this can lock one or more of the Windows file systems causing an error during booting of Mint as the file systems can not be mounted. This has become the default. Under Windows;

Installs from LiveUSB for assessment purposes

This is a step most users will not bother with. I did a number of installs of different systems before the final install. You must use custom partitioning and make sure you are installing into the correct partition for root and setting that partition to be reformatted every time you load a new system.

This enabled me to try out 32 and 64 bit systems and see what problems came about. It turned out that the 32 bit systems booted easily and the 64 bit systems of the Ubuntu and Mint versions I wanted to use gave problems in booting after installation. It is likely that was caused by the same problem that prevented the Mint 16 Petra LiveUSB from booting which was the open source nouveau drivers which are known not to play well with optimus until the proprietary drivers are installed and were preventing access to the internal graphics. A catch 22 as one needs to get a system installed and then load bumblebee which blacklists the nouveau drivers from loading during booting. what was important was the comparisons between 32 and 64 bit which led me to favour a 32 bit install at the time.

Final Install to Disk

So once I had confirmed which system to install the actual process was simple. The LiveUSB is run again and the various questions answered up to the partitioning where custom is selected and the partitioning above set up partition by partition including a home partition ( /home) . The only partition which is formatted is the one set to root ( / ) I used ext3 for the trial installs but for the final install of Mint 16 Petra and Mint 17 Qiana I used the newer and slightly better ext4.

NOTE: When you do the final install you want to make sure that the use your primary username as the one used during the install - this is important for a number of reasons. This makes subsequent upgrades easier and also cloning the machine. This initial user is special in several ways. To find out more read the sections below and the sections on distribution updates and on mounting files systems for use with Unison and other programes that require timestamps to be updated.

Addition steps if you are already a Linux user and want to transfer an existing user.

This only works well if the user you want to transfer was the first user set up on the other machine and the same user name and password is used on the new machine as it creates a folder in /home for that user an done can then bring in an existing home folder from another machine. I have written about the procedures for doing that under Carrying out a Distribution Update and Backing Up using tar archives.

Modifications to GRUB.

This brings together the changes which are Essential to boot successfully and some which I find desirable which might just as well be done at the same time. This section has been brought forwards to where it is required during installation but the sections covering the various problems and workarounds follow latter. To make these changes we need to edit /etc/default/grub as root:

gksudo gedit /etc/default/grub

shows /etc/default/grub the start of which typically contains these lines with changed/added lines coloured:

# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
# info -f grub -n 'Simple configuration'

GRUB_DEFAULT=saved
GRUB_SAVEDEFAULT=true
#GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=3
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="acpi_backlight=vendor i915.disable_power_well=0 nouveau.modeset=0 quiet splash"
GRUB_CMDLINE_LINUX=""

#...................

GRUB_DEFAULT=0 will boot the first menu item and so on. GRUB_DEFAULT="saved" will boot the same entry as last time which I prefer.
GRUB_SAVEDEFAULT=true - needed to make sure the last used kernel used is saved
GRUB_TIMEOUT=3 will display the grub menu for 3 seconds rather than the default of 10 - life is too short to waste 7 seconds every boot!
acpi_backlight=vendor is an addition to make the brightness keys work correctly.
i915.disable_power_well=0 is needed in Mint 16 and Mint 17 if one wishes to use the HDMI audio - otherwise it, and associated videos, run 20% fast.
nouveau.modeset=0 - This is an Essential addition to allow booting when using Mint 16 Petra or Ubuntu 13.10+ by inhibiting the nouveau driver. It may not be needed with Mint 17.

After making any changes you must run sudo update-grub in a Terminal:

sudo update-grub

to save the changes into the file actually used during booting - I keep forgetting

How to Avoid Accidently Booting into Windows Recovery

You will notice that there are two Windows entries shown - always use the first. Many recent computers, in particular, laptops and netbooks as many computer manufacturers no longer supply the Microsoft CD/DVD for Windows but instead have a hidden partition which has a disk image to restore the machine to exactly the state you bought it. Unfortunately this is not hidden to Ubuntu and it is given as an alternative operating system in the Grub start up menu. It is not always obvious which is which without knowing the partitioning so it is possible for the unwary to boot into the Restore Disk which is not good news as you are only a key stroke away from deleting everything and reformating the hard drive. I will not cover how to remove that from the menu here as it covered in Fun with Ubuntu - Customising The Grub 2 Boot Loader Menu but I should note it counts as a more advanced activity.

Installing Bumblebee

Bumbleebee is no longer required if you are using Mint 17.3 or higher with the latest nVidia Drivers a the Optimus Support is built in via nVidia Prime and you should avoid using both. If however you wish to try Bumblebee this is how to do it:

Bumblebee provides support for NVIDIA Optimus laptops. Using Bumblebee, you can use your NVIDIA card for rendering graphics which will be displayed using the Intel card. Bumblebee is officially supported by Ubuntu in 13.10 Saucy or newer.

For Mint 17.3 and 18.1 you will already have the nvidia-375 drivers installed but you may have to chose them in Driver Manager. Currently the bumblebee in the repositories does not work well with nvidia-375 and you have to use the bumblebee testing PPA. I am not sure about higher versions of nvidia. That and much of what follows came from an excellent WebUp8 article which I encourage you to read.

First it is recommended to make sure that you are using the intel processor

sudo prime-select intel

Now install the PPA

sudo add-apt-repository ppa:bumblebee/testing
sudo apt update

You should now install bumblebee and some other associated programs, some may be pulled in as dependencies but I found I needed to bring in some extras

sudo apt-get install bumblebee bumblebee-nvidia nvidia-settings primus

Now you need to Blacklist the the Nvidia driver you're using by adding it to /etc/modprobe.d/bumblebee.conf (from WebUp8)

Open /etc/modprobe.d/bumblebee.conf with a text editor (as root)

gksu xed /etc/modprobe.d/bumblebee.conf

And at the end of the file, add the following:

# 375
blacklist nvidia-375
blacklist nvidia-375-updates
blacklist nvidia-experimental-375

You may find it already present, I found it twice and had to remove one to make it work!

Now Configure Bumblebee

Open the Bumblebee configuration file with a text editor (as root) :

gksu xed /etc/bumblebee/bumblebee.conf

... and in this file, change the following options so they look like below for nvidia-375:

Driver=nvidia
KernelDriver=nvidia-375
LibraryPath=/usr/lib/nvidia-375:/usr/lib32/nvidia-375
XorgModulePath=/usr/lib/nvidia-375/xorg,/usr/lib/xorg/modules

... and save the file.

NOTE: These changes need to be repeated every time the driver is updated so that is the first thing to check if bumblebee stops working.

I got caught with the change to nvidia-382

Now another trick which I needed on Mint 17.3 but not 18.1 - check anyway

It appears that the BusID is not set properly for some users, causing Bumblebee not to work. To check / correct this, open the /etc/bumblebee/xorg.conf.nvidia file as root with a text editor:

gksu xed /etc/bumblebee/xorg.conf.nvidia

And in this file, make sure that the "BusID" line is not commented out (it shouldn't have a "#" sign in front of the line), and that it matches your Nvidia graphics bus ID. If it's not, change it, then save the file.

To check the graphics bus ID, use the following command (make sure you look for the line with Nvidia, and not Intel):

lspci | egrep 'VGA|3D'

Reboot

Check bbswitch is installed correctly from the new PPA

dmesg | grep bbswitch

What you should see is something like this

$ dmesg | grep bbswitch
[ 19.610199] bbswitch: version 0.8
[ 19.610204] bbswitch: Found integrated VGA device 0000:00:02.0: \_SB_.PCI0.GFX0
[ 19.610207] bbswitch: Found discrete VGA device 0000:01:00.0: \_SB_.PCI0.PEG0.PEGP
[ 19.610289] bbswitch: detected an Optimus _DSM function
[ 19.610294] bbswitch: Succesfully loaded. Discrete card 0000:01:00.0 is on
[ 19.679573] bbswitch: disabling discrete graphics

Bumblebee should now have turned off the Graphics card to save a lot of power. To run your application with the discrete NVIDIA card run in the terminal:

$ optirun [options] <application> [application-parameters]

ie to run firefox to look at Catchup

optirun firefox

It should turn off when the program is closed

For a list of options for optirun run:

$ optirun --help

Normally you do not use optirun for your window manager, installations or other non graphic heavy demanding programs. The optirun command is mainly used for graphic demanding programs or for games. In the long term one will edit/create new .desktop files for programs using the NVidia driver. There is an alternative to optirun - primus which is less developed but may offer advantages to optirun.

You can also check that everything is working by running nVidia Settings like this -

optirun -b none nvidia-settings -c :8

This runs the nVidia settings program. The use of optirun is required to turn on the card before running nVidia Settings - the other options flags are only needed with nVidia settings. nvidia-settings should not work fully without optirun if the card is disabled which is the case.

The final check is to run glxspheres64 with and without using optirun and see how it speeds up. It should be installed in one of the dependencies of bumblebee. Also try the 'aquarium' test at http://webglsamples.googlecode.com/hg/aquarium/aquarium.html

Cinnamon 3.2 has an extra right click item on the main Menu to run any program with optirun but it does not work for me in Mint 18.1

Warning: Do not use Nvidia Prime to switch Graphics once Bumblebee is installed or you may end up with a blank screen according to Webup8

Uninstall the Nvidia-Prime applet to be safe.

Uninstalling Bumblebee

Webup8 also emphasises that if you later want to remove Bumblebee, make sure to purge it ("sudo apt purge bumblebee"), to make sure its configuration files are removed, or else you'll experience issues, like the Nvidia drivers remaining blacklisted.

Checking Power Saving is operational (bbswitch)

The primary goals of the Bumblebee project include smart power management of the dGPU when it's not in use. This uses bbswitch (a module) to do this in Bumblebee. Since Bumblebee 3.0, this feature is enabled by default. This allow automatic power management, without any additional configuration needs. To find the status:

sudo cat /proc/acpi/bbswitch
returns

0000:01:00.0 ON

There are some commands you can use for test and extra information at bbswitch

I also checked power consumption and GPU temperature as an indicator.

Monitoring nVidia GPU temperature

Firstly it is necessary to use optimus to call the nvidia-setting when bumblebee is in use as the GPU would otherwise be off and not respond and and with bumblebee 3.21 See http://www.webupd8.org/2013/04/bumblebee-321-released-with-ubuntu-1304.htm and there are some additional options namely: "-b none " to disable injection of any render offloading bridge (primus or VirtualGL). So to invoke nvidia-settings we use

optirun -b none nvidia-settings -c :8

and to just get the core temperatures in the terminal (or within a script) we do

optirun -b none nvidia-settings -q GPUCoreTemp -t -c :8

This works with Bumblebee 3.21 giving two temperature readings which always seem to be the same. Note the capitals now in GPUCoreTemp

optirun -b none nvidia-settings -q all -c :8

The above gives all the sensors with information so you can pick out what you want and showed me that the temperatures need capitalising

Optimising Bumblebee

There are various options built into Bumblebee which most users do not exploit. You can get a good introduction to an alternative 'backend' (Render Bridge) called Primus which is available in the standard packages on the the Webupd8 page Primus: Better Performance And Less Power Consumption For Bumblebee . In summary the Bumblebee developers explain the difference as:

Bumblebee uses VirtualGL to copy the image generated by the second (faster) GPU to your display. VirtualGL was intended for use over a network though, so it takes a great many steps to enable this (compression, sending the image over a network link, decompression, etc).

Primus doesn't perform all these "extra" steps, instead taking a more direct route (copying the rendered image in memory to the other GPU, then displaying there). In theory this should get you better performance as well as better compatibility. Running applications will "see" the OpenGL implementation of your real hardware, nothing virtual is presented to them.

Primus only uses/starts secondary GPU for OpenGL parts of applications - everything else remains on your main GPU (power savings)

I have not been able to reproduce the speed improvements that Andrew got even when using "vblank_mode=0 primusrun" instead of simply running "primusrun". It is working but primusrun is not quite as good as optirun even in that mode.

I also looked in the Bumblebee Release Notes and there is some interesting information in the Notes namely:

- VirtualGL performance is very dependent on the Transport method set. The default "proxy" setting appears to perform bad in some situations. Try other available settings like "rgb" or "yuv".
- in many cases, primus offers better performance; please try it and report compatibility issues in primus tracker, if you find any; for now VirtualGL is still preferred as the default auto detected render bridge, while primus is being tested at larger scales before being released as default.

I looked at the manual page for optirun and found the following about the appropriate options:

-b, --bridge METHOD
acceleration/displaying bridge to use. Valid values are auto, virtualgl and primus. The --vgl-* options
only make sense when using the virtualgl bridge, while the --primus-* options apply only when using the
primus bridge. Additionally, value none is recognized, and its effect is to add paths to driver
libraries to LD_LIBRARY_PATH (useful for nvidia-settings and CUDA applications)

-c, --vgl-compress METHOD
image compression or transport to use with VirtualGL. Valid values for METHOD are proxy, jpeg, rgb, xv
and yuv. Changing this setting may affect performance, CPU usage and image quality

The compression method can offer significant improvements in speed.

Some examples of the commands I used during investigation were:

/opt/VirtualGL/bin/glxspheres64
optirun -c proxy /opt/VirtualGL/bin/glxspheres64
vblank_mode=0 optirun -b primus /opt/VirtualGL/bin/glxspheres64
optirun -c yuv /opt/VirtualGL/bin/glxspheres64
optirun -c jpeg /opt/VirtualGL/bin/glxspheres64
vblank_mode=0 /opt/VirtualGL/bin/glxspheres64

The Integrated Intel 4600 Graphics gave 130 Mpixels/sec. Using primus gave 239 Mpixels/sec with video blanking switched off. Using the optirun default gave 270 Mpixels/sec. Using optirun with yuv compression gave 315 Mpixels/sec and jpeg compression gave 361 Mpixels/sec (33% better than the default). The most interesting result perhaps was that turning video blanking off for the integrated graphics processor gave the best result of all at 385 Mpixels/sec. All were with the window maximised on a 1920x1080 screen and nvidia-319 driver. I have not carried out respective power measurements.

Update: I have rerun the tests with the latest nvidia driver nvidia-375 and the results are similar but my impression is that the performance is slightly lower and certainly no better.

In summary - it is worth trying the various options on real programs as the glxspheres test does not exercise the graphics processor fully and there will be tradeoffs in quality of speed, power and display. However for normal use the integrated graphics seem very good and the lower figures for it are often because of the video blanking limiting the performance to that of the screen leaving a large margin in hand. Update: I have found a lot of similar conflicting performance results with primus in the comments on the Webupd8 page Primus: Better Performance And Less Power Consumption For Bumblebee but nothing much on compression mechanisms.

Screen ShotBAND (Bumblebee And NVidia Display) Applet

Screen Shot

Screen Shot

This is an applet I have write to get round the problems of the existing nVidia/Bumblebee Monitoring Applets, in particular that of additional power usage when the nVidia Card is not in use. The screenshot shows two sample programs set up in the left click menu and the DGPU is on so the temperature is displayed. You will note that there are two additional and useful applets to the right of BAND.

It either displays the nVidia GPU temperature when running or a message that the DGPU (Discrete Graphics Processor Unit) is off. It interrogates bbswitch to get the status and when the card is on it uses nvidia-settings to get the GPU temperature. It uses the same fudge as gputemperature@silentage.com to run nvidia-settings synchronously and writes the output to a temporary file in applet folder. It currently has a delay of 20 seconds on loading before it gives information as bumblebee and bbswitch seem to take a while to come up at boot time.

The right click context menu gives the ability to easily run the nVidia Settings program without use of the terminal and also the System Monitor and Power Statistics, all useful for monitoring Bumblebee and power consumption which is paramount when using a laptop on batteries.

The standard left click menu provides a configurable list of programs which one can run using the discrete nVidia graphics through Bumblebee - this otherwise requires them to be called through optirun in a terminal or via a modified launcher. This list is configured using the standard applet configuration mechanism available from Cinnamon 1.8 . One can also configure the update rate of the applet in settings.

The latest version can be downloaded from the Cinnamon Spices Web Site. There is a longer write up on my Cinnamon Spices page.

Overclocking the GPU using nVidia Settings

Possible but not explored yet - I understand that an nVidia Settings configuration file needs changing to make this feature visible.

Setting up the new machine - other desirable changes

Set up file system to correctly mount a ntfs 'DATA' drive to allow use of unison and other programs which needing to set time stamps.

The mount point for the DATA partition (/media/DATA) should have been set up during the partitioning but I still find it necessary then edit the file system table /etc/fstab to get it auto-mounting as I want. The problem is that only the owner can reset time stamps on files which is required by some synchronisation programs such as Unison. This also makes the choice of initial user important. Again this has been written about in the past at the end of the first reference above and is not of the essence for this write up but for information my section of fstab now looks like.

# /media/DATA was on /dev/sda5 during installation
UUID=2FBF44BB538624C0 /media/DATA ntfs defaults,umask=000,uid=pcurtis,gid=46 0 0

The changes firstly set the owner (uid is User id) to the main user who will be the only one who will be able to set timestamps. The second change means that the mask which sets the file permissions allows everyone read write and execute access rather than just the owner and group (46 is plugdev group) - you may want to keep that tighter.

Change auto-mount point for USB drives back to /media

Ubuntu (and therefore Mint) have changed the mount points for USB drives from /media/USB_DRIVE_NAME to /media/USERNAME/USB_DRIVE_NAME. One can change the behaviour by using a udev feature in Ubuntu 13.04 and higher based distributions (needs udisks version 2.0.91 or higher).

Create and edit a new file /etc/udev/rules.d/99-udisks2.rules

gksudo gedit /etc/udev/rules.d/99-udisks2.rules

and cut and paste into the file

ENV{ID_FS_USAGE}=="filesystem", ENV{UDISKS_FILESYSTEM_SHARED}="1"

then activate the new udev rule by restarting or by

sudo udevadm control --reload

When the drives are now unplugged and plugged back in they will mount at /media/USB_DRIVE_NAME

 

Cinnamon Users - nVidia and System monitoring applets

lm-sensors and the CPU Temperature Indicator 1.0 applet

lm-sensors is used by some of the monitoring applets. It needs to be set up initially by running a setup in the terminal. You have options to let it investigate many options and there are preferred yes/no options for each - you should keep on to the safe side and not scan those that are not recommended and certainly NOT the graphics chip ones at the end, not only because nvidia-settings provides the information but also they have been reported to occasionally cause problems and the cause is unknown. It is however believed to be safe for monitoring CPU temperatures. There us an applet which uses lm-sensors and displays the CPU temperatures for each core plus an average in panel called CPU Temperature Indicator 1.0 which I have loaded at present. You can see it in the panel in the screendumps.

CPU Load, Memory Utilisation and Network Statistics

Image

Image

The System Monitor built in and accessible from the menu is an essential tool but not one to leave running. There are various applets which can display this data in the toolbar and I am using the Multi-Core System Monitor 1.4 which gives an graphical display in the toolbar and a more comprehensive pop-up. I only monitor the Processor Loads and Memory Use as I have written my own network monitor applet, the Network Usage Monitor with Alerts

The screendump shows applets for Network, CPU temperature, CPU loads (running flat out processing video rendering), Memory Usage breakdown including caching and GPU temperature (GPU on at time). The full information is on the popup. It also shows system applets for bluetooth and brightness to the right.

Optimising some common programs under Mint 16 and higher

Steam

I have not used Steam but the same anonymous user, that he had tried running Half-Life2 and Portal but the images were almost black. After trying many suggestions the following link provided the solution http://forums.linuxmint.com/viewtopic.php?f=90&t=155095 namely that libtxc isn't loaded automatically as a dependency, so the textures aren't loading properly. So install them by:

sudo apt-get install libtxc-dxtn-s2tc0 libtxc-dxtn-s2tc0:i386

That worked for him on Half-Life2, Portal and The Talos Principle.

Sorting Video playback and monitoring in editors

A green screen can occur in Kdenlive, Openshot and VLC with their standard configurations but not in the Mint Videos player or Cheese (the webcam application) .

Videos: This is the pre-installed player in Mint 15 and is actually the Totem player. This does not have the Green Screen problem as far as I can tell.

VLC: Version 2.08 offers Video driver option and leaving the Accelerated box ticked and the output set to OpenGL GLX video output (XCB) works well. I have not explored all the options.

Kdenlive: This seems to be a driver problem and Settings -> Configure kdenlive -> Playback lists 10 options of Video driver to use as well as an OpenGL tick box. Choosing XVideo and ticking the OpenGL box works fine and gives a smooth preview even without optirun. I have not explored all the other options.

Googleearth

Google have never supported Googleearth very well on Linux. Google Earth is available for GNU/Linux from their web site, but is non- free software and also does not integrate well into an Ubuntu/Debian based system. There is a utility in the Ubuntu Repositories which should make it possible to build your own personal Debian package of Google Earth. The packaging itself is Free Software, but the Google Earth program is governed by the copyright holder (Google), so you may be limited as to what you can do with the resulting package (i.e. no redistribution for commercial use, etc). The built in installer was also broken in Ubuntu 13.10 Saucy so the Debian one was needed. This was probably one of the results of the switch from ia32-libs, a huge package of 32 bit libraries to enable 32 bit programs to function in a 64 bit linux to instead use Multiarch, which is intended to be a replacement with the advantage that only required packages are brought in. However not everything has been sorted before ia32-libs was withdrawn. I therefore spent a lot of time when I was testing out 64 bit systems which I exploited when it came to using Googleearth on the Defiant and other machines. The version of Googleearth that I finally got working is not the most recent but perfectly adequate and I have just kept using it in Mint 16 and 17. I never fully understood what I was doing but if you want Click to display more information 

Googleearth search fails with an HTTP error box

This is a known problem and has to do with a library package which exists in several locations including within googleearth. The one in googleearth is incompatible on some systems leading to this error. There are two solutions to try.

Rename the file /usr/lib/googleearth/libGL.so.1 (safer than deleting it)

sudo mv /usr/lib/googleearth/libGL.so.1 /usr/lib/googleearth/libGL.so.1.bak

If that is not enough or the file does not exist then the following links to a working version:

sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/googleearth/

Java

I have found that at least one of my important web sites does not work with the open source java plugin (icedtea plugin) under Mint 17 so I have been forced into the proprietory Oracle Java 8 using a PPA with a download script from Webup8. In sumary the proceedure was quick, apart from a huge download and the following shows the major stems

pcurtis@defiant:~$ java -version
java version "1.7.0_55"
OpenJDK Runtime Environment (IcedTea 2.4.7) (7u55-2.4.7-1ubuntu1)
OpenJDK Server VM (build 24.51-b03, mixed mode)

pcurtis@defiant:~$ sudo add-apt-repository ppa:webupd8team/java

............................

pcurtis@defiant:~$ sudo apt-get update

..................................

pcurtis@defiant:~$ sudo apt-get install oracle-java8-installer

.................................................

pcurtis@defiant:~$ java -version
java version "1.8.0_05"
Java(TM) SE Runtime Environment (build 1.8.0_05-b13)
Java HotSpot(TM) Server VM (build 25.5-b02, mixed mode)

You can see the new Java has been installed and activated. You now have to enable the pluging in Firefox by Tools -> Addons and you will find the new Java plugin (11.5.2 or higher ) is disabled so use the drop down box to set 'Always Activate' or 'Ask to Activate'

You can find out what you have and I believe switch back by:

pcurtis@defiant:~$ sudo update-java-alternatives -h // Find out about command
[sudo] password for pcurtis:
usage: update-java-alternatives [--jre-headless] [--jre] [--plugin] [ -t|--test|-v|--verbose]
-l|--list [<jname>]
-s|--set <jname>
-a|--auto
-h|-?|--help

pcurtis@defiant:~$ sudo update-java-alternatives -l // List Java versions installed
java-1.7.0-openjdk-i386 1071 /usr/lib/jvm/java-1.7.0-openjdk-i386
java-8-oracle 1072 /usr/lib/jvm/java-8-oracle

pcurtis@defiant:~$ sudo update-java-alternatives -s java-1.7.0-openjdk-i386 //Switch back NOT TESTED

HDMI Output

Video

I initially only tested without Optirun and using Displays under Settings. Setting the LCD to the same resolution as my Goldstar 23" DVI enabled monitor (1680 x 1050) through a converter cable enabled mirror use and I could also choose either by switching the other monitor off in the panel. Using a dual monitor set up may be possible but I have not tried it.

I have since tried with an HDMI input on a 1920x1080 TV and again it worked fine with both in the same resolution and one could switch from one to the other or mirrored. If mirrored was set one could unplug and replug the monitor and it would sort itself out automatically. The same applied for a VGA cable and leaving a mirrored setting seemed to be good. The settings were preserved through a suspend. The use as a monitor seems fine.

HDMI sound output has had problems:

Audio - Speed is wrong - not specific to Defiant

No sound and no sound settings to switch to HDMI sound when using Mint 15.

This seems to be another kernel regression as sound worked in kernels prior to 3.8.0.19. See

This is solved in kernel 3.11.0 used in Mint 16 Petra and I have done some tests on Qiana now it is available and sound was available fine but see the next problem!

Fast audio playback on Intel Haswell HDMI

Playback of audio (and hence video) through Intel Haswell HDMI is accelerated by about 20%, and pitch shifted. Playback through the internal speakers and output socket is fine. This caused me a lot of grief as there were lots of reports but no solutions on the internet. I finally found a kernel bug report which had bisected back to the commit causing the problem and produced a kernel command line input to workaround the problem - by then I had started installing old and new kernels from the ubuntu mainline series - instructive but not a good way to proceed although I did find kernel 3.10.33 worked! See https://bugzilla.kernel.org/show_bug.cgi?id=74861

The solution is similar to the fix for brightness keys and to test one adds a string to the boot command lines The procedure to get round the boot problems is:

Interrupt the boot process during the countdown period by moving up and down and enter the edit mode by the Tab key (or as described on the screen if you are not using Mint).

An editor will open up that will allow you to temporarily change the grub options for the next boot, in Mint this allows access to a single line where additional options can be added or the existing options modified.

Add i915.disable_power_well=0 before the --persistent at the end of the line.

Enter now immediately takes you into the boot process

The changes made to the grub entry only work for the current session.

To permanently make changes you need to edit (as root) the /etc/default/grub file and add i915.disable_power_well=0 to the GRUB_CMDLINE_LINUX line and then run sudo update-grub.

This does not however work on a LiveUSB as you are not able to update grub so you have to edit the line every time. Changes to GRUB on installed systems are covered in more detail at Grub boot improvements where a number of additional changes which are best all made at the same time are covered and I have included this change until it is fixed in the kernel.

I have done upgrades from Mint 17 to 17.1 and then 17.2 and these additions seem to remain in the grub file.

Defiant Wifi and Bluetooth

This uses the Intel Centrino Advanced-N 6235 802.11a/g/n, dual stream 2x2, dual-band WiFi + Bluetooth 4.0 PCIe half mini card. See http://www.intel.com/content/dam/www/public/us/en/documents/product-briefs/centrino-advanced-n-wimax-6235-brief.pdf for more details. I understand from Chillblast that the WiFi works much better with WPA than WEP which I still have on a router for old XP machines and hardware. It seems fine close round the house with WEP but this is probably the excuse to change. The card has both hardware and software switching of radio but the hardware mode does not seem to be implemented in Mint so there may be a small extra power consumption.

Bluetooth

Bluetooth was one of the last issues to address on the Defiant and I have some slightly mixed results on what I have tried. The bluetooth Applet is new in Cinnamon 16 in that it is now in the Cinnamon Settings but closely based on what went before with gnome-control-center. It works fine for pairing a bluetooth audio receiver which enable me to pass audio to the HiFi on the boat or house without wires. The Audio receiver then works fine as expected. Also tested in Mint 17 and 18.

Using a BTR006 BlueTooth audio Receiver

Let us take a typical example of an audio device - an audio device does not need very high security so typically they have a preset PIN which is often 0000 but need to be made receptive to pairing for a short time. In the case of the BTR006 which is an audio input device to connect to hifi etc through a 3.5mm jack there is a single button and led to control it. Holding the button for 3-5 seconds turns it on. Holding for 10 seconds puts it into a special pairing mode where it is discoverable and it responds with a PIN of 0000 for 2 minutes. Pairing is now very simple - clicking on the Bluetooth Applet gives a menu which includes Set up a New Device which takes one to a Wizard where the second screen searches for and displays all unpaired devices and you highlight the BTR006 and on the PIN options one selects fixed and 0000 and continue and that is all that is needed. From now on the device will automatically be connected when the computer and BTR006 are turned on and within range. You will see a double blue flash every 5 seconds on the BTR006 in that case rather than the single flashes when it is just turned on and it will show up as an alternative audio device which you can select instead of the audio output or built in speakers.

Mobile Phone Tethering using internal modem (DUN) in older mobile phones

My main use of Bluetooth used to be to access modems in my older phones and use the spare data allowances for internet access in the UK. I have covered this at length in Ubuntu Mobile - Bluetooth and Connecting to the Internet via Bluetooth modems in older phones Unfortunately this does not work seem to work under Mint 16 or 17 on the Defiant. Eventually I went back to the Mint 15 Olivia and it works fine on the Defiant both using the inbuilt mechanisms through the network manager and also through gnome-ppp which is my usual way because there has been a problem starting at kernel 3.8 with the inbuilt mechanism. Neither way works under 16/17 and this seems to be a real bug but one not reported and I have filed a bug report at https://github.com/linuxmint/cinnamon-bluetooth/issues/5. I suspect few people 'tether' using bluetooth these days although I know at least one sailor who hauls his bluetooth connected phone up the mast to get a good data connection at sea!

I have done some further investigation which confirm it is not a Defiant problem and have a crude workaround which I have added to Ubuntu Mobile - Bluetooth and Connecting to the Internet via Bluetooth modems in older phones and added my findings to the bug report. (Last Updated 18th January 2014)

Tethering via Bluetooth to an Android Phone

This proved to be very easy and provides access to the internet via an Android smart phone - in my case either a Samsung S3 Mini (GT-I8200N) with Android 4.2.2 or a Samsung S3 (GT-I9301I) with Android 4.4.2) although this should work with most phones and equal or higher versions of Android. The phone needs an active internet connection which can be a mobile phone connection with Data enabled or a Wifi connection. One might ask why bother in the case of a wifi connection, why not connect directly? It has obvious advantages if you are on a 'pay by time' connection as you can connect several machines as well as the phone and it also gives extra security in an internet cafe. In may cases the phone can be set up to log in automatically to a Sky or similar Wifi connection.

First we need to set up and pair the Android Phone to the Computer

Screen Shot Screen Shot

That is basically it - when you click on the network manager applet in the panel you should have an extra heading Mobile Broadband with the new connection GT-I8200N under it.

Screen Shot Screen Shot

The pairing is slightly different in Mint 18 - you have to accept the confirm the number provided on Both machines and the button is very small at top right on the computer. You settings screen is also greatly simplified and you no longer need to explicitly tick a box to use with the network manager, it is done automatically and it shows in Network manager as above.

You only need to pair once after which you just need to click on the GT-I8200 connection after ensuring the following are satisfied:

To disconnect or after disconnection

I have found it is possible to make duplicate connections which show up in the network Manager Applet and there is ne simple way to remove them. The only way seems to be to do to the folder that contains them /etc/NetworkManager/system-connections/ and delete the duplicates - you need root privileges so use

gksu /etc/NetworkManager/system-connections/

There is no quick links in the notification panel on the Android phone under 4.2.2 for switching tethering on and off but you can add a Settings widget to the home screen to take you straight to the tethering settings. Android 4.4.2 has a link on the notification panel and a long hold takes you to the full tethering settings.

Note that you can use data very fast from a computer especially if there are automatic upgrades etc. Experiment with a Wifi connection on the phone first and use a data monitoring applet such as NUMA. Check data use frequently on the Phone.

More about the connections used by Android for Bluetooth Tethering - PAN, NAP and BNEP

The Android Bluetooth tethered connection uses a Personal Area Network (PAN) which is a computer network used for data transmission among devices such as computers, telephones and personal digital assistants. PANs can be used for communication among the personal devices themselves or for connecting to a higher level network and the Internet. A Bluetooth PAN is composed of up to 8 active devices in a master-slave relationship (a very large number of devices can be connected in "parked" mode). The first Bluetooth device is the master or in this case the Network Access Point (NAP), and all other devices are slaves that communicate with the master. The communication protocol is the Bluetooth Network Encapsulation Protocol (BNEP) which is used to transport common networking protocols over the Bluetooth media such as IPv4 and IPv6. The packet format is based on Ethernet.

The Bluetooth manager detects that the Android device supports PAN/NAP and, by ticking the box, creates a connection for the Network Manager. The Network Manager (in the form of the applet) makes this available but the support is incomplete. As mentioned above one easily ends up with duplicate connection which have to be deleted from the terminal as root. The connection is also identified by the Bluetooth address and it delivers this rather than the actual connection interface which is bnep0 and is displayed as a Mobile Broadband Connection which is an approximation to the truth! This causes a problem with my NUMA applet which depends on the interface delivered by the Network Manager so I have had to add an exception as I have with the ppp0 interfaces used by Mobile Broadband connection.

Implementing an Airplane Mode in Defiant

The Defiant has an indicator light for Airplane mode and it can be switched on by Fn F11 under Windows and this turns off all transmitters (Bluetooth and Wifi). It is implemented by a Windows Driver. This does not seem to be a hardware switch but only in software and the light seems just to be an indicator which is unrelated to the hardware. If one sets Airplane Mode using Fn F11 in Windows and turns the machine off the indicator is still on when you reboot into Linux (Mint 15) but the Wifi can be turned on and off as usual and works with the light still lit. This is not ideal as there is a real risk that a linux user might not realise and there is a finite, if small, risk that aircraft or hospital systems could be affected. The light does not have any obvious control other than in a dual boot system via windows.

In Mint 15, 16 and 17 the Network Manager -> Settings has a Airplane Mode switch which switches both Wireless and Bluetooth off.

I have set up a keyboard map from Super + F11 to open the Network screen with the switch for airplane mode in front of one - it may be possible to look at the code and write a direct call script.

Keyboard Mapping in Mint 16 and 17 is found by System Settings -> Hardware section -> Keyboard -> Keyboard Shortcuts tab: Click Custom Shortcuts then Add custom Shortcut which opens a small window: Set Name to Aircraft Mode and Command: to cinnamon-settings network then Add. Now click on the Aircraft Mode entry which will be in the list and then click twice on space marked unassigned and it will change to New accelerator. Now use the key combination you want to set which is Super and F11 - that it you can close the Window or do the same to set up Display Manager on Super F7 with command cinnamanon-settings display

Card Reader Driver - Realtek

Works fine under all Mint versions tested.

Sorting the Fn and Function Keys (Blue markings on keyboard)

The function keys (F1 - F12 etc.) act as hot keys when pressed while the Fn key is held down.

Function Keys & Visual Indicators Action in Windows Comments
Fn + ~ Play/Pause (in Audio/Video Programs)

Does not work
Not an issue
Most programs have
their own hot key

Fn + 1 Fan Control Toggle
between Automatic Fan Control
and Full Power
As expected
Fn + F1 Touchpad Toggle As expected
Fn + F2 Turn LCD Back light Off
Press a key to or use Touchpad to turn on
As expected
Fn + F3 Mute Toggle As expected
Fn + F4 Sleep Toggle As expected
Fn +F5/F6 Volume Decrease/Increase As expected
Fn + F7 Display Toggle - not actually a toggle but provides access to display configuration under Windows.

Does Nothing
Use a key binding to 'Displays' in Settings Manager using Super+F7

Fn +F8/F9 Brightness Decrease/Increase

Decreases but does not Increase
See my fix in Grub2

Fn + F10

PC Camera Power Toggle
Only indicator is on Camera
(If camera in use)

As expected
Fn + F11 Airplane Mode Toggle
Indicator Light

Does Nothing
Indicator does not change
from last setting in Windows
Alternative Needed
Key binding 'Network Settings' to Super+F11
as Fn is not recognised as a 'modifier'

Fn + F12 Toggle Keyboard Illumination
and Adjust Brightness Level
As expected
Fn + Num Lock Provides Numeric Keypad with indicator light
Indicator Light
As expected including indicator
Fn + Scr Lock Scroll Lock

Does Nothing
Rarely used except as toggle
for KVM switches
Keystroke mapping may be possible
but not a priority to me

Fn + Power Toggle USB port power on right front on and off independent of computer to power USB devices when Mains adapter in use or battery above 20% As expected including flashing orange power light

Brightness Keys Bug

There is a bug reported in the kernel https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1218547

The core of the issue is that there are two interfaces present that are trying to control brightness. If one boots with a kernel boot parameter of "acpi_backlight=vendor" this disables acpi_video0 interface leaving intel_backlight.

The acpi_backlight=vendor can be added by editing the boot sequence during a boot to test and if works it can be included by editing the grub start up scripts in a permanent way - this has already been included in the modifications to Grub discussed above.

Distribution Updates

Performance Tests

Comparison of 32 and 64 bit performance

Ubuntu have always recommended running the 32 bit system, certainly for systems of 2 Gbytes memory or under as the additional memory requirements cancel out any gains from the richer instruction set and faster processing.

I have done a quick and dirty check on my AMD Athlon 64 dual processor 5000+ with 2 Gbytes of Memory which is on the boundary. Speed in rendering videos (which is a good processor benchmark) was only 5% faster, almost within the measurement noise. Memory use was up 40% on average with quite a wide variation (28% Firefox with many tabs on startup and 54% Thunderbird with many accounts on startup). This is in line with Tests by Phoronix on Ubuntu 13.10 amd64 and i32 where Video and Audio processing showed ~15% gain and only FFTs showed a lot more, in most cases it was a very marginal or none existent gain.

I also used the benchmarks at the end of the System Information program - install hardinfo to access it.

Benchmarks MSI Wind U100 AMD Athlon 5000+ i32 Mint 16 AMD Athlon 5000+ x64 Mint 17.2 Defiant i32 Mint 17.2 Defiant x64
Mint 17.3 /19 with SSD
Helios x64 Mint 17.3 Lafite x64 Mint 19.0
CPU Blowfish (lower is better) 28.16 8.39 8.07 1.79 1.79 / 1.85 3.11 1.49
CPU CryptoHash (higher is better) 57.7 125.2 145 776 839 / 839 407 679
CPU Fibonacci (lower is better) 8.49 2.93 3.53 1.22 1.22 / 0.50 1.51 0.50
CPU N-Queens (lower is better) 17.78 16.09 13.55 0.48 0.45 /6.68 4.14 6.50
FPU FFT (lower is better) 18.69 6.75 8.16 0.69 0.75 / 0.89 0.88 0.97
FPU Ray tracing (lower is better) 33.82 - 10.28 10.92 3.21 / 1.54 3.71 1.80
GXLSpheres 1920x1080 N/A N/A 11 fps (both quite variable)
18 Mpixels/sec (1680x1050)
Intel Graphics 120 fps 237 Mpixels/sec

Intel: 192 fps
375 Mpixels/sec
Nvidia: 420 fps 830 Mpixels/sec

 

100 fps

198 Mpixels/sec

There is a lot of inconsistencies but the double the number of cores and threads of the Defiant's Core i7 4700MQ 2.4 Ghz (3.4 on Turbo) quad-core (8 thread) processor gives it about a 50% advantage over the Helios's core i5 6200U dual core four thread 2.3 Ghz (2.8 on Turbo) processor. The 8th generation Kaby Lake processor in the Lafite also has a quad core (8 thread) i5 8250 processor and comes close or often betters the 45 watt Core i7 4700MQ processor in these tests. It is possible some of the test have been changed - the Fibonacci and N-Queens look consistent on left and right but not between Mint 17.3 and 19 with SSD

Power Saving Figures with Discrete GPU Off

These tests were run it on a LiveUSB but with a 64 bit system (30% brightness and nothing at all running except the Power statistics screen). The results are that an idle of 23 watts drops to 16 watts - a saving of 7 watts giving a battery life of nearly 4 hours rather than the 2 hours 40m which is worth having. I get the impression that the 32 bit kernels use less power with the GPU on and slightly less with it off but a like for like would need it to be run under a LiveUSB.

Screen Shot Screen Shot

GPU off and no programs running other than the terminal and this monitor with fudge in Mint 15

Screen Shot Screen Shot

You can see the increase as I run the program to switch the GPU on at 6 minutes in and increase to 23 watts from 16 watts

Screen Shot Screen Shot

The predicted time of operation with the GPU off and no programs running other than the terminal and this monitor - compare to 2 hours 45 mins which is the case with the GPU on and Optimus enabled.

Other Power Saving

There are at least two applications which claim to optimise the power saving settings on linux machines. The are Laptop Mode Tools and TLP. Neither are in the standard repositories and need PPAs to install them. I have tried both and can not truthfully say that either produce any significant savings on the Defiant. The main power savings options already seem to be well set up and I am pretty sure I would have seen even a 0.5 watt saving and neither produce that in normal use both leave the power at 15.5 watts on idle with firefox open (equivalent to 4 hours on battery) as above. I have left TLP installed. The links are to Webupd8 articles if you do want to follow up further. The main power savings are gained by turning the brightness to circa 30% and turning off the keyboard illumination. I got no significant savings from turning Bluetooth off.

Note: I have not found a way to turn Bluetooth or Wifi Hardware off, only to disable in software so there still be some scope for savings.

Turbo Mode Performance


Screen Shot Screen Shot

The above screen dump is from the output od the i7z program which is now in the Ubuntu Repositories. This was obtained with a processor load of about 25% average and all 4 processors are in Turbo mode It shows that the core temperatures are at about 65 degrees but the fan was running at quite a high level.

Screen Shot Screen Shot

The above is using all 8 cores to render h264 HD Video. All processors are running close to flat out and the frequency has been dropped back to 3.1Ghz - 100Mhz less than the maximum the Turbo Multiplier for 4 processors provides although the temperature has risen to 87 deg.

Screen Shot Screen Shot

The above shows the situation when the machine is idling - the processors speeds have been reduced lowering power consumption and the temperatures are now low and the fan is not running.

In conclusion the Turbo modes and control over power and speed seems to all be implemented under Linux.

Adding an SSD to the Defiant

I have recently added a Samsung 860 evo 250 Gbyte SSD drive to my Defiant and it has considerably speeded up boot times and program loading and overall given a much faster feel to the machine. I have never been convinced that the hybrid drives have been showed much of their promises and this has just confirmed it. Fitting was very easy, 4 screws to remove the base and two empty slots are exposed with only one screw to remove and then replace to hold it down - a few minutes work. I did not change the boot drive or old fashioned booting on the existing drive as it still has the preinstalled Windows 8.1 although I have never run any program on it other than a virus checker when I received the machine 5 years ago so it is really a waste of space.

First I reviewed the requirements impossed by use of a SSD. The first time I used an SSD I did a lot some background reading which revealed that there were more nuances in getting a good setup than I had realised. The information I gather ended up quite long and covered a lot of areas which do not need action taken on as they are set up on most amchines by the manufacturers t or are defaults in Mint and Ubuntu. The in depth coverage has moved to a dedicated page on The Use of Solid State Drives in Linux and only the links in Bold below need consderation here on the Defiant and most were already done when I originally set up with a hard disk.

Checklist for the use of Solid State Drives

  1. The SATA controller mode needs to be set to AHCI in the BIOS. AHCI provides a standard method for detecting, configuring, and programming SATA/AHCI adapters. AHCI is separate from the SATA standards, but it exposes SATA's more advanced capabilities that are required in the BIOS to fully support an SSD.
  2. Partition Alignment is critical but should be correct on a recent system is essential for optimal performance and longevity as SSDs are based on flash memory, and thus differ significantly from hard drives. While reading remains possible in a random access fashion on pages of typically 4KiB, erasure is only possible for blocks which are much larger, typically 512KiB, so it is necessary to align the absolute start of Every partition to a multiples of the erase block size.
  3. Use a file system supporting TRIM: in practice this means EXT4 in Linux.
  4. Automate TRIM. A SSD system needs some form of automatic TRIM enabled to assist garbage collection otherwise the speed decreases and the number of writes also increases at the expense of SSD life. The default is weekly but this is best changed to daily.
  5. Check Queued TRIM is Blacklisted. A number of drives do not correctly support TRIM reliably and, in particular, the queued TRIM command which may need to be inhibited. The latest kernels take care of this but it is a real issue if updating an existing machine or using an LTS (Long Term Support) Distribution with an elderly kernel.
  6. Overprovision. This is the reserving of some areas of disk and leaving unformatted. This also desirable for similar reasons to TRIM, namely maintaining speed and decreasing disk writes - a certain amount is already reserved by manufacturers (~7% ) but it is best increased by another 10 to 20%.
  7. Control use of Swapping to disk. SSDs have a large but finite number of write cycles and frequent swapping uses that up. The use of swap files is not optimised for desktop machines in Linux for SSDs (or even Hard Drives) and needs to be changed.
  8. Inhibit Hibernation. (suspend to disk): This should be inhibited as it causes a large number of write actions, which is very bad for an SSD. If you are dual booting make sure Windows also has hibernation inhibited - in any case it is catastrophic if both hibernate to the same disk.
  9. Avoid Defragmentation. It is not required in Linux and is never done automatically. It must be avoided because the many write actions it causes will wear an SSD rapidly - make sure a dual booted system does not kill your SSD by defragmentation and avoid the need by maintaining at least 20% spare capacity on each partition, even in Linux this has benefits.
  10. Consider changes to the file access. Changes can be made to reduce the number of 'writes' by options in the configuration files such as noatime. (relatime is the default in Ubuntu and Mint and best compromise)
  11. Optimise the disk access scheduler. The scheduler may be optimised for hard drives rather than SSDs. The default scheduler for Ubuntu/Mint is 'deadline' which is acceptable for both but noop may be better if only SSDs are in use. No Action Planned

Only four of the above are likely to need addressing in a dedicated Linux system using Ubuntu or Mint with a single SSD and provided by Chillblast - they are in bold. The first two are factors in the initial partitioning of the SSD and the other two are carried out during the setting up procedure.

The two remaining areas which I still needed to make sure were ready for an SSD are covered below

Reduce Swapping to Disk.

Before going further the best way to reduce wear on the SSD when you also have a hard drive is to keep/put the swap file on the hard drive rather than on the SSD which is where I have it kept it on the Defiant. What follows still improves performance of the hard drive so I have left it in place.

The changes that are described here are desirable for all disk drives and I have already implemented them on all my systems. They are even more important when it comes to SSDs. A primary way to reduce disk access is to reduce the use of Swap Space which is the area on a hard disk which is part of the Virtual Memory of your machine, which is then a combination of accessible physical memory (RAM) and the Swap space. Swap space temporarily holds memory pages that are inactive. Swap space is used when your system decides that it needs physical memory for active processes and there is insufficient unused physical memory available. If the system happens to need more memory resources or space, inactive pages in physical memory are then moved to the swap space therefore freeing up that physical memory for other uses. This is rarely required these days as most machines have plenty of real memory available. If Swapping is required the system tries to optimise this by making moves in advance of their becoming essential. Note that the access time for swap is much slower, even with an SSD, so it is not a complete replacement for the physical memory. Swap space can be a dedicated Swap partition (normally recommended), a swap file, or a combination of swap partitions and swap files. The hard drive swap space is also used for Hibernating the machine if that feature is implemented

It is normally suggested that the swap partition size is the same as the physical memory, it needs to be if you ever intend to Hibernate (Suspend to disk by copying the entire memory to a file before shutting down completely). It is easy to see how much swap space is being used by using the System Monitor program or by using one of the system monitoring applets. With machines with plenty of memory like my Defiant and Helios which both have 8 Gbytes you will rarely see even a few percent of use if the system is set up correctly which brings us to swappiness.

There is a parameter called Swappiness which controls the tendency of the kernel to move processes out of physical memory and on a swap disk. See Performance tuning with ''swappiness'' As even SSD disks are much slower than RAM, this can lead to slower response times for system and applications if processes are too aggressively moved out of memory and also causes wear on solid state disks.

Reducing the default value of swappiness will improve overall performance for a typical Ubuntu desktop installation. There is a consensus that a value of swappiness=10 is recommended for a desktop and 60 for a server with a hard disk. I have been using a swappiness of 10 on my two MSI U100 Wind computers for many years - they used to have 1 Gbyte of RAM and swap was frequently used. In the case of the Defiant I have 8 Gbytes of memory and Swap is much less likely to be used. The consensus view is that optimum value for swappiness is 1 or even 0 in these circumstances. I have set 1 at present on both the Defiant and the Helios with an SSD to speed them up and minimise disk wear..

To check the swappiness value

cat /proc/sys/vm/swappiness
For a temporary change (lost on reboot) to a swappiness value of 1:

sudo sysctl vm.swappiness=1

To make a change permanent you must edit a configuration file as root:

gkgksudo gedit /etc/sysctl.conf

Search for vm.swappiness and change its value as desired. If vm.swappiness does not exist, add it to the end of the file like so:

vm.swappiness=1

Save the file and reboot.

There is another parameter which also has an influence on perceived speed as it influences the inode/dentry cache which is a layer above the block cache, caches directory entries and other filesystem-related things that cost even more to look up than just block device contents. This is even more obscure (especially the name of vfs_cache_pressure) but there are some tests in t https://freeswitch.org/confluence/display/FREESWITCH/SSD+Tuning+for+Linux which indicate that the default (100) can be halved to give an improvement in perceived performance. This is done by adding another line to /etc/sysctl.conf so for the Defiant I have:

vm.swappiness=1
vm.vfs_cache_pressure=50

I have not implemented it on the Helios as the SSD already gives a huge improvement and extra tuning is unlikely to give any perceivable enhancement.

Inhibit Hibernation

Hibernation (suspend to disk) should be inhibited as it causes a huge amount of write actions, which is very bad for an SSD. If you are dual booting also make sure Windows also has hibernation inhibited - in any case it is catastrophic if both hibernate to the same disk. Ubuntu has inhibited Hibernation but Mint does not and I prefer to change it. An easy way is to, in a terminal, do:

sudo mv -v /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla /

Note this is a single line and is best copied and pasted it into the terminal.

It moves the settings file that enables hibernation, to the main directory / (root) rendering it ineffective. The new location is a safe storage, from which you can retrieve it again, should you ever wish to restore hibernation. Thanks to https://sites.google.com/site/easylinuxtipsproject/mint-cinnamon-first for this idea. Note:I have not checked and have no views on any of the other information on that page

One needs to reboot before this is active. After the reboot Hibernation should now no longer be one of the options when you close the computer. Applets which try to hibernate will demand root access. I had again already implemented this before adding the SSD but I left it here for completeness.

Change the automated trim rate in Mint 19 to daily

Mint 19 is set up to do an automatic trim every week which seems to be a bit to long a time if one inspects the result of occasional manual trim by: sudo fstrim -av you may well see quite large numbers

Earlier version of Ubuntu/Mint used cron to schedule the trims but systemd timers are used in Mint 19. When a service is controlled by a timer there are two linked 'units' which are files with the same name and the service has an extention of .service and the timer an extension of .timer. Only the timer has to be enabled in Systemd for the service to be run as prescribed in the timer. Both are part of the linux system in the case of fstrim and are found in /usr/lib/systemd/system/ and should not be edited directly as systemctl provides built-in mechanisms for editing and modifying unit files if you need to make adjustments.

Editing systemd Unit Files with a drop-in file using fstrim.timer as an example

This section is losely based on https://www.digitalocean.com/community/tutorials/how-to-use-systemctl-to-manage-systemd-services-and-units , https://wiki.archlinux.org/index.php/Systemd/Timers#Timer_units and the manual page systemd.timer.5

The correct way to change a system service or timer is to add an drop-in (override) file. The edit command, by default, will open a drop-in file for the unit in question, in this case fstrim.timer:

sudo systemctl edit fstrim.timer

This will be a blank file that can be used to override or add directives to the unit definition. A directory will be created within the /etc/systemd/system directory which contains the name of the unit with .d appended. For instance, for the fstrim.timer, a directory called fstrim.timer.d will be created.

Within this directory, a drop-in file will be created called override.conf. When the unit is loaded, systemd will, in memory, merge the override with the full unit file. The override's directives will take precedence over those found in the original unit file.

The override.conf file will be opened in the terminal by sudo systemctl edit fstrim.timer in an unfriendly line editor called nano. Fortunately we oly have to paste a few lines into an empty file so the following should be sufficient but if you need ore see https://askubuntu.com/questions/54221/how-to-edit-files-in-a-terminal-with-nano.

To remove any additions you have made, delete the unit's .d configuration directory and drop-in file from /etc/systemd/system. For instance, to remove our override, we could type:

sudo rm -r /etc/systemd/system/fstrim.timer.d

After deleting the file or directory, you should reload the systemd process so that it no longer attempts to reference these files and reverts back to using the system copies. You can do this by typing:

sudo systemctl daemon-reload

So if we look inside the current fstrim.timer using systemctl cat fstrim.timer we find:

pcurtis@defiant:~$ systemctl cat fstrim.timer
# /etc/systemd/system/fstrim.timer
[Unit]
Description=Discard unused blocks once a week
Documentation=man:fstrim

[Timer]
OnCalendar=weekly
AccuracySec=1h
Persistent=true

[Install]
WantedBy=timers.target

We now edit it so we can add a suitable override with

sudo systemctl edit fstrim.timer

and paste in the following to change the title and timing from weekly to daily:

[Unit]
Description=Discard unused blocks once a day

[Timer]
OnCalendar=
OnCalendar=daily

Tip: Timers are cumulative, so in the override one needs to reset the existing timers by an initial OnCalender= otherwise your OnCalendar setting gets added to the existing one.

In theory we do not need reload the systemd process if we use edit by a sudo systemctl daemon-reload but I did it anyway and when I repeated the cat I got.

pcurtis@defiant:~$ systemctl cat fstrim.timer
# /etc/systemd/system/fstrim.timer
[Unit]
Description=Discard unused blocks once a week
Documentation=man:fstrim

[Timer]
OnCalendar=weekly
AccuracySec=1h
Persistent=true

[Install]
WantedBy=timers.target

# /etc/systemd/system/fstrim.timer.d/override.conf
[Unit]
Description=Discard unused blocks once a day

OnCalendar=
OnCalendar=daily

When I checked the status of the fstrim service after about 24 hours I got:


pcurtis@defiant:~$ systemctl status fstrim.service

Loaded: loaded (/lib/systemd/system/fstrim.service; static; vendor preset: enabled)
Active: inactive (dead) since Sat 2018-08-25 03:08:38 BST; 11h ago
Main PID: 31821 (code=exited, status=0/SUCCESS)

Aug 25 03:08:37 defiant systemd[1]: Starting Discard unused blocks...
Aug 25 03:08:38 defiant fstrim[31821]: /home: 965.9 MiB (1012805632 bytes) trimmed
Aug 25 03:08:38 defiant fstrim[31821]: /: 1.7 GiB (1760002048 bytes) trimmed
Aug 25 03:08:38 defiant systemd[1]: Started Discard unused blocks.
pcurtis@defiant:~$

I have gone through this at some length as it is a useful technique with wider applicability and I had to spend a lot of time before I understood how systemd timers worked and how to correctly change one.

Partitioning the new SSD

Before partitioning the hard drive it is sensible to check that this is not going to change the drive allocations and screw up the whole thing. This might occur if file mounting uses the old /dev/sda style rather than with UUID= longrandom which is unlikely but it only takes a minute to check /etc/fstab by

xed /etc/fstab

 

I then partioned the drive using gparted and used a GPT in an very similar way to that the Partitioning on the Helios so I will not repeat it here. The only difference was that the Swap partition deliberately still resides on the Hard Drive to avoid wear on the SSD - it is set up to avoid use with a swapiness of 1 so it rarely gets even 1% use.

Moving partitions from the Hard drive to the SSD

So the remaining work was just to transfer two system partitions and the home partition to the SSD by 'cloning' the existing partions on the hard drive. I then removed some of the partitions and changed sizes on the hard drive to increase my DATA partition by most of the 250 Gbytes of the SSD. I have tried to adopt the principle of backing up the section I am going to transfer then using the back itself to reinstal in the new location and then clean up after everything has been tested. One is going to back up anyway so why not use it and prove it. This approach gets round a major problem namely exactly copying a folder is not as simple as it seems - you not only need to preserve the contents of the files and folders but also the owner, group, permissions and timestamp. You also need to be able to handle symbolic links and hard links. I have a well proven way of creating and restoring backups of home folders exactly using tar which has advantages as we would create a backup before proceeding in any case! Likewise Mint depends on TimeShift so why not use it to clone the System partitions..

Moving the operating systems - Linux Root partition:

Timeshift can also be used for 'cloning' the linux system as you can choose what partition you restore to. I created the partition scheme on the SSD, took a fresh snapshot of each of the operating systems in use and restored each of them to the appropriate partition on the SSD. Now comes the important point, They will not be visible or available in the boot menu until Grub is alerted by a sudo update-grub after which they will be in the list af operating systems available at the next boot. Assuming you have a separate /home it will continue to use the existing one at that but you will certainly want also to move the home folder. The following is based on the proceedures described in the latest version of Sharing, Networking, Backup, Synchronisation and Encryption under Linux Mint

Moving /home - the users home folders.

When we back up normally we use tar to create a compressed archive which can be restored exactly but To the Same place, even during cloning we are still restoring the user home folders to be under /home. If you are moving to separate partition you want to extract to a different place, which will become /home eventually after the new mount point is set up in file system mount point list in /etc/fstab. It is convenient to always use the same backup proceedure so you need to get at least one user in place in the new home folder before changing the mount point. There are three options at this point

  1. Use the existing backups for the main users but move a very basic user using a different copy method to get a start, change the location of home, then extract the real users and delete the basic user.
  2. Modify the backup to get an archive which can be extracted anywhere.
  3. Modify the extraction to strip off the extra folder levels.

I used the first method - although I was not sure I could trust any of the copy methods for my real users but I did believe it is possible to move a basic user (created only for the transfers) that you can use to do the initial login after changing the location of /home and can then use to extract all the real users from their backup archives. I saw little advantage in creating extra backup archives etc. The last method is what I would use in the future - at the time I did not realise how many options tar has and that it was possible to strip off folder levels so easily. That said the proven has a lot of advantages over the unproven. In detail:

An 'archive' copy using cp is good enough in the case of a very basic user which has recently been created and little used, such a home folder may only be a few tens of kbytes in size and not have a complex structure with links:

sudo cp -ar /home/basicuser /media/whereever

The -a option is an archive copy preserving most attributes and the -r is recursive to copy sub folders and contents.

So the proceedure to move /home to a different partition was to:

Example of changing file system table to auto-mount different partition as /home

I will give an example of the output of blkid and the contents of etc/fstab after moving my home folder to the SSD drive highlighting the changes in red. Note this is under Mint 19 and the invocation for the text editor.

pcurtis@defiant:~$ blkid
/dev/sda1: LABEL="EFIRESERVED" UUID="06E4-9D00" TYPE="vfat" PARTUUID="333c558c-8f5e-4188-86ff-76d6a2097251"
/dev/sda2: LABEL="MINT19" UUID="e07f0d65-8835-44e2-9fe5-6714f386ce8f" TYPE="ext4" PARTUUID="4dfa4f6b-6403-44fe-9d06-7960537e25a7"
/dev/sda3: LABEL="MINT183" UUID="749590d5-d896-46e0-a326-ac4f1cc71403" TYPE="ext4" PARTUUID="5b5913c2-7aeb-460d-89cf-c026db8c73e4"
/dev/sda4: UUID="99e95944-eb50-4f43-ad9a-0c37d26911da" TYPE="ext4" PARTUUID="1492d87f-3ad9-45d3-b05c-11d6379cbe74"
/dev/sdb1: LABEL="System Reserved" UUID="269CF16E9CF138BF" TYPE="ntfs" PARTUUID="56e70531-01"
/dev/sdb2: LABEL="WINDOWS" UUID="8E9CF8789CF85BE1" TYPE="ntfs" PARTUUID="56e70531-02"
/dev/sdb3: UUID="178f94dc-22c5-4978-b299-0dfdc85e9cba" TYPE="swap" PARTUUID="56e70531-03"
/dev/sdb5: LABEL="DATA" UUID="2FBF44BB538624C0" TYPE="ntfs" PARTUUID="56e70531-05"
/dev/sdb6: UUID="138d610c-1178-43f3-84d8-ce66c5f6e644" SEC_TYPE="ext2" TYPE="ext3" PARTUUID="56e70531-06"
/dev/sdb7: UUID="b05656a0-1013-40f5-9342-a9b92a5d958d" TYPE="ext4" PARTUUID="56e70531-07"
/dev/sda5: UUID="47821fa1-118b-4a0f-a757-977b0034b1c7" TYPE="swap" PARTUUID="2c053dd4-47e0-4846-a0d8-663843f11a06"
pcurtis@defiant:~$ xed admin:///etc/fstab

and the contents of /etc/fstab after modification

# <file system> <mount point> <type> <options> <dump> <pass>

UUID=e07f0d65-8835-44e2-9fe5-6714f386ce8f / ext4 errors=remount-ro 0 1
# UUID=138d610c-1178-43f3-84d8-ce66c5f6e644 /home ext3 defaults 0 2
UUID=99e95944-eb50-4f43-ad9a-0c37d26911da /home ext4 defaults 0 2
UUID=2FBF44BB538624C0 /media/DATA ntfs defaults,umask=000,uid=pcurtis,gid=46 0 0
UUID=178f94dc-22c5-4978-b299-0dfdc85e9cba none swap sw 0 0

Removing the unused partions and increasing the size of the DATA partition.

So now it is time to tidy up the partitioning to make space. This sounds the least risk activity but it is not.

Warning about deleting system partitions after cloning.

When you come to tidy up your partitions after cloning You Must do a sudo update-grub after any partitio deletions before any reboot. If Grub can not find a partition it expects it hangs and you will not be able to boot your system at all and you will drop into a grub-recovery prompt.

I made this mistake and used the proceedure in https://askubuntu.com/questions/493826/grub-rescue-problem-after-deleting-ubuntu-partition by Amr Ayman and David Foester which I reproduce below

grub rescue > ls
(hd0) (hd0,msdos5) (hd0,msdos3) (hd0,msdos2) (hd0,msdos1) (hd1) (hd1,msdos1)
grub rescue > ls (hd0,msdos1) # try to recognize which partition is this
grub rescue > ls (hd0,msdos2) # let's assume this is the linux partition
grub rescue > set root=(hd0,msdos2)
grub rescue > set prefix=(hd0,msdos2)/boot/grub # or wherever grub is installed
grub rescue > insmod normal # if this produced an error, reset root and prefix to something else ..
grub rescue > normal

For a permanent fix run the following after you successfully boot:

sudo update-grub
sudo grub-install /dev/sdX

where /dev/sdX is your boot drive.

It was not a pleasant activity and had far too much trial and error so make sure you do update-grub.

You may also need to delete partitions you have deleted from /etc/fstab as, at the best, there will be a delay if fstab can not find a partition/

Improvements in Boot times with SSD

Since making the initial measurements I have added an SSD to the Defiant and the boot time as measured with has dropped to 1.51 seconds althogh part of the drop was disabling theNetworkManager-wait-online.service which could sometimes cause a 7 second un-required wait. I can only think it had got turned on by use of wireless and Bluetooth mice for potential login. So like for like it may only be an improvement from 22 secs to 1.5 secs. I will show the new boot times using systemd-analyze critical-chain

pcurtis@defiant:~$ sudo systemctl disable NetworkManager-wait-online.service
[sudo] password for pcurtis:
pcurtis@defiant:~$

pcurtis@defiant:~$ systemd-analyze critical-chain
The time after the unit is active or started is printed after the "@" character.
The time the unit takes to start is printed after the "+" character.

graphical.target @1.511s
multi-user.target @1.511s
getty.target @1.511s
getty@tty1.service @1.511s
system-getty.slice @1.510s
setvtrgb.service @1.497s +13ms
systemd-user-sessions.service @1.375s +3ms
network.target @1.372s
NetworkManager.service @1.104s +268ms
dbus.service @1.077s
basic.target @1.069s
sockets.target @1.069s
uuidd.socket @1.069s
sysinit.target @1.068s
systemd-timesyncd.service @886ms +181ms
systemd-tmpfiles-setup.service @866ms +18ms
local-fs.target @864ms
media-DATA.mount @542ms +322ms
dev-disk-by\x2duuid-2FBF44BB538624C0.device @540ms

STOP PRESS - CATASTROPHIC PROBLEM WITH SAMSUNG SSDs

There are also some quirks with several SSDs when using Linux, one of which is a show stopper as it is with the Samsung 850 Evo favoured by Chilblast. There is a work-around in later kernels which has been backported to the Kernels which Ubuntu updates to but not the kernel recommended by Mint. See https://bugs.launchpad.net/ubuntu/+source/fstrim/+bug/1449005 and https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1338706. The kernel in use must newer than 3.13.0-57.95, 3.16.0-43.58 or 3.19.0-22.22. Kernels older than 3.12 and latter than 4.0.5 are all fixed.

In summary you will lose data with the recommended configurations of Mint 17.0, 17.1 and 17.2 if you have a current Samsung 8xx series SSD (or older models if you update the firmware) and you have TRIM enabled which is also the default for Mint and Ubuntu.

The problem occurs because the latest SATA specification includes a version of TRIM which queues requests. This has been implemented in kernel 3.12 but the Samsung SSDs have an error such that they report it is available whilst it actually does not work and destroys data. Older drives have updated firmware which then produces the fault as well. The fix in the kernel blacklists all calls to queued TRIM for all Samsung 8xx (including Evo and Pro) SSDs.

The kernel in Mint 17.3 is likely to be OK so I am not adding fixes yet - web searches will show how to disable TRIM in Ubuntu and in the short term the slow down will be acceptable.

Partitioning and SSDs (solid State Drives)

I am starting to bring together various pieces of information I have on optimising performance. I have been aware for a while about two things:

I was however unaware of many of the other specific requirements of effective use of SSDs which I will start to cover below.

Swap File management

A primary way to reduce disk usage is to reduce the use of Swap Space which is the area on a hard disk which is part of the Virtual Memory of your machine, which is then a combination of accessible physical memory (RAM) and the swap space. Swap space temporarily holds memory pages that are inactive. Swap space is used when your system decides that it needs physical memory for active processes and there is insufficient unused physical memory available. If the system happens to need more memory resources or space, inactive pages in physical memory are then moved to the swap space therefore freeing up that physical memory for other uses. The system tries to optimise this by making moves in advance of their becoming essential. Note that the access time for swap is slower therefore do not consider it to be a complete replacement for the physical memory. Swap space can be a dedicated swap partition (normally recommended), a swap file, or a combination of swap partitions and swap files. The hard drive swap space is aslo used for Hybernating the machine.

There is a parameter called Swappiness which controls the tendency of the kernel to move processes out of physical memory and on a swap disk. See Performance tuning with ''swappiness'' As even SSD disks are much slower than RAM, this can lead to slower response times for system and applications if processes are too aggressively moved out of memory and also causes wear on solid state disks.

Reducing the default value of swappiness will actually improve overall performance for a typical Ubuntu desktop installation. There is a consensus that a value of swappiness=10 is recommended for a desktop and 60 for a server with a hard disk. I have been using a swappiness of 10 on my two MSI U100 Wind computers for many years - they used to have 1 Gbyte of RAM and swap was frequently used.

To check the swappiness value

cat /proc/sys/vm/swappiness
For a temporary change (lost on reboot) with a swappiness value of 10:

sudo sysctl vm.swappiness=10

To make a change permanent you must edit a configuration file:

sudo gedit /etc/sysctl.conf

Search for vm.swappiness and change its value as desired. If vm.swappiness does not exist, add it to the end of the file like so:

vm.swappiness=10

Save the file and reboot.

In the case of the Defiant I have 8 Gbytes of memory and Swap (aka Block Cache) is much less likely to be used and the consensus view is that optimum value for swappiness is 1 or even 0 I have set 1 at present.

There is another parameter which also has an influence on perceived speed as it influences the inode/dentry cache which is a layer above the block cache, caches directory entries and other filesystem-related things that cost even more to look up than just block device contents. This is even more obscure (especially the name of vfs_cache_pressure) but there are some tests at in the first of the references below which indicate that the default (100) can be halved to give an improvement in perceived performance. This is done by adding another line to /etc/sysctl.conf so for the Defiant I have:

vm.swappiness=1
vm.vfs_cache_pressure=50

Partitioning considerations when using pure SSDs

Since setting up my machine I have found out a lot more about use of SSD disk drives. Mine has a hybrid drive which, I hope, has some internal optimisation and does not require the following.

However if you have a pure SSD then one needs to reduce the writes to the drive (partially covered above), align partition boundaries (gparted normally does that to 1 MiB boundaries by default) and use a file system which allows Trimming of the drive (ext4 rather than ext3 or ntfs) along with efficient journalling. Also one should not defragment a pure SSD as it causes excessive writes and is not required.

Some references to start you off:

Defiant Specific Outstanding Issues

Minor:

Airplane (or Aeroplane) Mode: Better handling of Airplane Mode (Fn F11) where all transmitters are disabled to allow use on Aircraft - now handled by keyboard shortcut Super + F11 as Fn key used does not act as a 'modifier' in Mint. It opens the Network Settings screen which has the Airplane Mode switch. Issue is that this does not activate the light and does not switch off the Hardware hence there are no power saving advantages.

Issues On Upgrading

Updating to 18.0

Again it is best to reinstall the operating system when updating to Mint 18 although if you do it carefully and have a separate partion for /home you should be able to maintain all your configuation.

Changes between Ubuntu 14.04 Trusty and 16.04 Xenial LTS versions on which Mint 17 and 18 are built.

These are LTS versions spaced by two years and the diffferences are considerable, in particular the initiation and control of Daemons and Services use SystemD instead of Upstart. One results is major differences in 'power' handling between Trusty, which Cinnamon was designed to use, and Wily. The result is that anumber of Applets and Keyboard shortcuts involving shutdown, hibernate, suspend and restart will need to be modified.

The way used in Mint 17 to suspend etc is using calls like:

dbus-send --system --print-reply --dest="org.freedesktop.UPower" /org/freedesktop/UPower org.freedesktop.UPower.Suspend

whilst what needs to be used with Mint 18 are calls like:

systemctl suspend

I had, for example, defined a shortcut keyboard bindings to Ctrl+Alt+s and Ctrl+Shift+S to provide an easy suspend. The access to Shortcuts is via System Settings -> Keyboard -> Shortcut tab -> Custom Shortcuts -> Add Custom Shortcut - call it Suspend and put systemctl suspend as the Command then click on unassigned and press the key combination you want. You can add up to three alternatives. If you want to add this under Mint use the alternative from above dbus-send --system --print-reply --dest="org.freedesktop.UPower" /org/freedesktop/UPower org.freedesktop.UPower.Suspend.

I know I will have to make changes in NUMA if I want to continue to use an automatic suspend or other action if data limits are exceeded.

Updates to Mint 18.1, 18.2 and 18.3

All very quick and only issue was that I had to replace the Window List with App Grouping applet with Icing Task Manager as Window List with App Grouping applet has not been supported for many years although it is one of the most popular and to me essential applets. Icing Task Manager is a fork which has been updated and enhanced and is now much better.

Mint 18.3 is the first version to include TimeShift.

Cinnamon 3.2 is major improvement and the upgrade is worthwhile and includes a privacy function so if you want to remember your recent files you need to change the setting in Settings -> Privacy. Progressive improvements in 3.4 and 3.6

Fresh Install of Mint 19 - Work approaching completion but still largely in note form

TimeShift considerations

The major new consideration in a fresh install of Mint 19 whilst retaining the /home partition is TimeShift which is now fundamental to the update manager philosophy. To Quote "The star of the shown Linux Mint 19, t is Timeshift. Thanks to Timeshift you can go back in time and restore your computer to the last functional system snapshot. If anything breaks, you can go back to the previous snapshot and it's as if the problem never happened. This greatly simplifies the maintenance of your computer, since you no longer need to worry about potential regressions. In the eventuality of a critical regression, you can restore a snapshot (thus canceling the effects of the regression) and you still have the ability to apply updates selectively (as you did in previous releases)." The best information I have found about TimeShift and how to use it is by the author.

TimeShift is similar to applications like rsnapshot, BackInTime and TimeVault but with different goals. It is designed to protect only system files and settings. User files such as documents, pictures and music are excluded. This ensures that your files remains unchanged when you restore your system to an earlier date. Snapshots are taken using rsync and hard-links. Common files are shared between snapshots which saves disk space. Each snapshot is a full system backup that can be browsed with a file manager. TimeShift is efficient in use of storage but it still has to store the original and all the additions/updates over time. The first snapshot seems to occupy slightly more disk space than the root filesystem and six months of additions added another approximately 35% in my case. I run with a root partition / and separate partitions for /home and DATA. Using Timeshift means that one needs to allocate an extra 2 fold storage over what one expects the root file sytem to grow to.

In the case of the Defiant the root partition has grown to about 11 Gbytes and 5 months of Timeshift added another 4 Gbyes so the partition with the /timeshift folder neeeds to have at least 22 Gbytes spare if one intends to keep a reasonable span of sheduled snapshots over a long time period. After three weeks of testing Mint 19 my TimeShift folder has reached 21 Gbytes for a 8.9 Gbyte system!

This space requirements for TimeShift obviously have a big impact on the partition sizes when one sets up a system. My Defiant was set up to allow several systems to be emplyed with multiple booting. I initially had the timeshift folder on the /home partition which had plenty of space but that does not work with a multiboot system sharing the /home folder. Fortunately two of my partitions for Linux systems plenty big enough for use of TimeShift and the third which is 30 Gbytes is accceptable if one is prepared to prune the snapshotss occassionally.

Considerations when [Re-]Installing multiple users

The order is imrtant and must match the original order. This is because new users are added with successive user numbers starting at 1000 and the user names one sees are only aliases for this number. If users are added in a different order they get all mixed up! Groups are also numeric but do not seem to have the same problems. If you want to know the order then use id which will give an output like the following.

$ id
uid=1000(pcurtis) gid=1000(pcurtis) groups=1000(pcurtis),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),115(lpadmin),
999(bumblebee)
~$ id 1001
uid=1001(peter) gid=1001(peter) groups=1001(peter),27(sudo),999(bumblebee)
~$ id 1002
uid=1002(pauline) gid=1002(pauline) groups=1002(pauline),24(cdrom),27(sudo),30(dip),46(plugdev),115(lpadmin),
1000(pcurtis), 999(bumblebee)
~$ id pauline
uid=1002(pauline) gid=1002(pauline) groups=1002(pauline),24(cdrom),27(sudo),30(dip),46(plugdev),115(lpadmin)
,1000(pcurtis),999(bumblebee)
~$

Fix for Synaptic Package Manager missing quick search box

See https://ubuntuforums.org/showthread.php?t=1178974 In a terminal do:

sudo apt-get install apt-xapian-index
sudo update-apt-xapian-index -vf

Bumblebee Fixes for use with nvidia-driver-390

It is important to make Bumblebee work if you have an NVidia Optimus based dual processor machine as nvidia prime is very slow and also needs a full reboot every time you change graphics processor unlike previous versions. It took me several days to get Bumblebee working but it was worth it for the 7 - 8 watt power saving.

This guide is loosely based on the Launchpad Bug Report 1758243 for the Bumblebee Package with input from Bumblebee Issue 951 as well as my own experiments.

In sumary; bumblebee fails to work in Ubuntu 18.04, or Mint 19 which uses the same package base, with nvidia-driver-390 unless a number of configuration changes and other fixes are made.

This is a dificult proceedure and there is no easy way to undo some of the changes so use first make a copy using TimeShift. I used it and made half a dozen snapshots and had to to do many restores before I got this proceedure working. It seems excellent - almost as useful as branching in Git!

0. Firstly one needs a completely fresh start with nothing to do with nvidia or bumblebee installed. One should cary out the three initial configuration changes before rebooting.

apt purge nvidia* bumblebee*
apt install bumblebee-nvidia nvidia-dkms-390

That should bring in all the packages which are reqired.

1. For optirun to work, /etc/bumblebee/bumblebee.conf needs two library paths changed (because of the changes for GLVND) on or about lines 60 and 63:

[driver-nvidia]
LibraryPath=/usr/lib/x86_64-linux-gnu:/usr/lib/i386-linux-gnu

XorgModulePath=/usr/lib/x86_64-linux-gnu/nvidia/xorg,/usr/lib/xorg/modules,/usr/lib/xorg/modules/input

Note these are single lines

I also set on or about line 22

Driver=nvidia

You can edit /etc/bumblebee/bumblebee.conf as root by:

xed admin:////etc/bumblebee/bumblebee.conf

2. For power management to work (ie turning the nvidia card off whilst not in use), the nouveau and nvidia modules need blacklisting so they don't load on boot, and nvidia_drm and nvidia_modeset need aliasing to off so they never load. Otherwise, nvidia_drm attaches to drm_kms_helper and then bumblebee can't unload the nvidia module and turn off the card. nouveau also needs to be aliased to off as other programs try to load it.

Create a new file /etc/modprobe.d/nvidia-bl.conf as root with contents:

blacklist nouveau
blacklist nvidia
blacklist nvidia_drm
blacklist nvidia_modeset
alias nouveau off
alias nvidia_drm off
alias nvidia_modeset off

by:

xed admin:///etc/modprobe.d/nvidia-bl.conf

3. Aliasing nouveau to off still doesn't stop the nvidia-fallback service from loading the nouveau module, so also run this command:

systemctl disable nvidia-fallback.service

Now reboot because nouveau is already loaded, but the change should be permanent unless something else re-enables the nvidia-fallback service.

4. To run mesa applications, you also need to set the variable __GLVND_DISALLOW_PATCHING to 1:

export __GLVND_DISALLOW_PATCHING=1

I am not sure if this will need to be repeated and how often.

5. We are nearly there but now need to make sure that no other programs have aliased nvidia to off. In particular I found a file in /etc/modprobe.d with the line "alias nvidia off" which prevented bumblebee from loading the nvidia module. It was in /etc/modprobe.d//blacklist-nvidia.conf which I believe is created by prime-select and remained although nvidia-prime had been purged. I commented out the line after opening the file by:

xed admin:///etc/modprobe.d//blacklist-nvidia.conf

See below for reason for this new way of editing files as root

One should then restart the bumblebee daemon by

sudo systemctl restart bumblebeed

After this optirun worked as expected.

NOTE. You will need to (re)install nvidia-settings if you want to use the bumblebee applet as it is used to obtain the nvidia processor temperature.

NOTE 2: If you want to run glxsheres64 you will need to find virtualgl_2.5.90_amd64.deb and download to your home directory and install by:

sudo apt install virtualgl_2.5.90_amd64.deb

For some reason it did not install using the GDebi Package Installer.

Additional fix for Primusrun after Bumblebee fixed

Primusrun did not work for me as it looks for an non existent path to: /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1 .

A short term fudge is to set an EnvironmentVariable in your command line like this:

PRIMUS_libGL=/usr/lib/x86_64-linux-gnu/libGL.so.1 primusrun glxspheres

which works for me or by editing /usr/bin/primusrun directly, and putting PRIMUS_libGL=/usr/lib/x86_64-linux-gnu/libGL.so.1 inside that file.

Suspend Problem and fixes

I have had considerable problems with resuming from suspend and finding myself in a virtual terminal login window. I first installed nvidia-smi by which I found was being called occasionally by:

sudo apt install nvidia-utils-390

and, more importantly, add a kernel option of:

pcie_port_pm=off

in the grub configeration - see above.

I found this suggested in several threads found during internet searches which indicated this gets round a problem with NVidia not playing well with kernels after 4.8 prior to which that was the default - for example https://devtalk.nvidia.com/default/topic/971733/linux/-370-28-with-kernel-4-8-on-gt-2015-machines-driver-claims-card-not-supported-if-nvidia-is-not-primary-card/post/4999717/#4999717 .

These have not stoppped every error message in dmesg and the log files but have meant the machine has been up for 5 days continuously during which it only returned in a virtual terminal (tty1) once and even then could be returned to the GUI instantly by Ctrl Alt F7. Before this problem I was only dimly aware of the virtual terminals and switching between them and the GUI and use of Ctrl Alt F7 has changed my Suspend/Resume errors from being a show-stopper to an inconvenience.

I have had sufficient problems that I decided it was time to remind myself of ways to escape from various lockups in a tidy manner. This article is a good start on The Magic SysRq Key on Linux to Fix Frozen X Servers, Cleanly Reboot, and Run Other Low-Level Commands .

Fixing Wine after conversion to Mint 19

Wine seems to sometimes hang for up to a minute when running Dreamweaver 2004 MX as well as a number of other odd issues using the Wine version in the Mint Repositories in combination with the existing wine installation in the .wine folder with the version of wine in the repositories and my old wine system in .wine. I found no way of fixing the problems without starting afresh by removing all traces of the old version of wine, reinstalling wine from the WineHQ development branch and reloading all the programs I use in wine. I first tried this in a cloned system.

I basically followed the instructions at WineHQ

1. Remove and purge all old packages related to wiine by:

sudo apt-get remove wine*
sudo apt-get purge wine*

Rename your .wine folder to wine-bak You will need to do this for every user as every user has a complete independent wine system.

If your system is 64 bit, enable 32 bit architecture (if you haven't already):

sudo dpkg --add-architecture i386

Add the WineHQ repository:

wget -nc https://dl.winehq.org/wine-builds/Release.key
sudo apt-key add Release.key
sudo apt-add-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ bionic main'
sudo apt-get update

Then it is recommended to install the Development branch which is apparently very stable anyway

sudo apt-get install --install-recommends winehq-devel

In the unlikely event that apt-get complains about missing dependencies, install them, then repeat the last two steps (update and install).

Note: The WineHQ proceedure does not at present install the packages for wine-gecko or wine-mono but the first time you install a program in wine you will be asked if you want to download them. You must click Yes to both. You will need to do this for every user as every user has a complete independent wine system which needs these installed..

So find a nice simple Windows program (I used an old copy of Paintshop pro that I know run under wine) and right click and run under wine and download wine-gecko or wine-mono when offered

I found the programs appear in the Cinnamon Menu and often the install programs also offer the option of adding to the desktop which also seems to work.

When running, the wine programs may show up correctly in the panel or need some work as Wine seems to use a greater depth of menu folders than the Menu accepts and some of the .desktop files may need to be moved in ~/.local/shared/applications up a level after which the built in menu editor can be used. Wine programs may show up under 'other' but can be moved using the menu editor available with a right click on the 'standard' Menu.

nemo ~/.local/shared/applications

Once they are in the menu they show correctly in Icing Task manager Applet and can be pinned and started there.

You will also need to install extra Windows fonts

I have so far succesfully installed all the programs I use on a regular basis

  1. Paintshop Pro 4.2 (free circa 1990! but still useful for a quick change to an image)
  2. DreamWeaver MX (as complex as they get)
  3. Picasa 3.9 ( Still a great photo manager)
  4. Irfanview 3.95 with plugins (Nothing does the batch operations as well)

Remember: The removal of .wine and reinstalls and re-configurations will now have to be repeated for all the real users.

Fix for lack of Wine Font Smoothing

I discovered that fonts were rendering very badly in the version of wine and under Mint 19 - it looked as if there was no font smoothing and it was almost impossible to use my old copy of Dreamweaver MX for HTML editing. I checked that msscorefonts was installed and in the end did a web search and found https://askubuntu.com/questions/219791/improve-gui-appearance-of-wine-applications where there is a script which allows you to select the font smoothing used in wine and choosing Subpixel Smoothing (Cleartype) RGB made a huge improvement.

Disable hibernation

Disable hibernation (suspend-to-disk) by:

sudo mv -v /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla /

This moves the settings file that enables hibernation, to the main directory / (root) thus rendering it ineffective.

Fix for Synaptic Package Manager missing quick search box

See https://ubuntuforums.org/showthread.php?t=1178974 In a terminal do:

sudo apt-get install apt-xapian-index
sudo update-apt-xapian-index -v

Debian bug #844453 - apt-daily.service shouldn't be run during boot, but only some time afterward.

You can see the timing of the boot sequence by

systemd-analyze blame

Often you will find that the apt-daily.service is very long especially on a hard drive.

As a workaround, do

sudo systemctl edit apt-daily.timer

and paste the following text into the editor window:

# apt-daily timer configuration override
[Timer]
OnBootSec=15min
OnUnitActiveSec=1d
AccuracySec=1h
RandomizedDelaySec=30min

This changes the "timer" that triggers apt-daily.service to run at a random time between 15 min and 45 min after boot, and once a day thereafter. See the systemd.timer manpage for additional (not very well written, alas) explanation of what this means.

You can check what you have by:

systemctl cat apt-daily.timer

Although I have implemented this I suspect it is a red herring as it is not in any critical path so does not slow the boot other than by using resources .

Ways round the loss of gksu and gksudo from Mint 19

Debian and Ubuntu 18.04 and hence Mint 19 have removed gksu and libgksu. Using a plain sudo to run graphical programs has dangers as configuration changes can end up with configuration files owned by root in your home folder.

Users are recommended to use the gvfs admin backend available in 18.04 and Mint 19. You can do this with the admin:// prefix. For instance use:

nemo admin:///etc/default/

or

xed admin:///etc/default/grub

to reach or open the grub file. You will be asked for your admin password. I am sure I will get used to that as an alternative.

Tip: There is a right click item in nemo to open a folder as root which I use a lot to reach and then open files as root - this avoids the use of the terminal.

Developers can also use PolicyKit (pkexec) to use elevated privileges for the specific actions where it is needed but that involves creating policies for every program.

Using pkexec - an example policy for leafpad with root privileges (Advanced users only)

This was originally writen for xed but that is now included so I rewrote for leafpad as an example

The PolicyKit policy for leafpad is based on the one already existing for nemo and placed it in /usr/share/polkit-1/actions/ as org.leafpad.root.policy

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE policyconfig PUBLIC
"-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
"http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">

<policyconfig>

<vendor>Leafpad Project</vendor>

<action id="org.leafpad.root">
<description>Run Leafpad with elevated privileges</description>
<message gettext-domain="leafpad">Text Editor</message>
<icon_name>accessories-text-editor</icon_name>
<defaults>
<allow_any>no</allow_any>
<allow_inactive>no</allow_inactive>
<allow_active>auth_admin_keep</allow_active>
</defaults>
<annotate key="org.freedesktop.policykit.exec.path">/usr/bin/leafpad</annotate>
<annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
</action>

</policyconfig>

Fix for Epson SX510w Gutenprint version 5.2.13 driver printing far too dark.

This was a major issue as printed images were completely unacceptable and could not be adjusted in printer settings. I tried adjusting in various programs such as LibraOffice and the image viwer as well as in Printers itself with little effect. Comparison with a different machine showed that a different version of gutenprint print driver was in use in Mint 18.3 where the results were perfectly acceptable without any adjustment. I found that going back to the version 5.2.11 used in Mint 18.3 gave me a perfect working printer as in Mint 18.3.

So what I did, (which may not be the best way but is largely GUI based) was to:

If it is all working you have to make sure they are not updated by the update manager so open the Update Manager which will show they can be updated and fix using a right click on the package -> ignore updates for this package

Install Firefox ESR (Extended Support version)

This currently offers the earlier version of Firefox (52) but with full security updates. Firefox Quantum is a disaster to those who use add-ons as as few still work and the authors are not intending to continue. Firefox ESR currently supports all my favourite add-ons but only till September.

sudo add-apt-repository ppa:mozillateam/ppa
sudo apt-get update
sudo apt-get install firefox-esr

Changes for Mint 20

The Defiant works well under Mint 20. The changes for our Helios and Defiant are currently covered in the the Diary part 32 prior to incorporation here

Before You Leave

I would be very pleased if visitors could spare a little time to give me some feedback - it is the only way I know who has visited, if it is useful and how I should develop it's content and the techniques used. I would be delighted if you could send comments or just let us know you have visited by Sending a quick Message to me

Link to W3C HTML5 Validator Copyright © Peter & Pauline Curtis
Fonts revised: 28th April, 2021