Friday, February 5, 2021

Lubuntu 20.04 LTS Upgrade

After working thru my Lubuntu 18.04 notes, it's time to get started on 20.04LTS.  18.04 has served me well, but support for 18.04LTS ends in April of 2021.  With the  maintainers dropping LXDE in favor of LXQT,   I expect there will be some surprises along the way...  will things be better and faster?  Or will the new distro require more memory and processor power?       

The computer I'm grading is a vintage 2013 Asus netbook, X102ba with 4GB of memory, 320GB disk, and a dual-core AMD processor running at 1GHz, so I'm pretty sensitive to performance issues.   I need the new distrbutuon to run as well as 18.04.   And I'd like to find that the tweaks I made to 18.04 running LXDE work with 20.04 running LXQT, too .

Before getting started, I'd like to plug the Lubuntu Manual.   It's well-organized with a lot of useful information.  Many of the tweaks I made in Lubuntu releases 17 and 18 by editing configuration files can be done using the Lubuntu 20.04 GUI configuration tools.   Let's get started.

First Note: Installation Media

Everything went well through my first note, Installation media.   There are really no changes here.

Second Note:  Broadcomm Wireless Adapter

The old HP dv8210us laptop with the  Broadcomm wireless adapter took its last boot, so the Broadcomm wireless adapter is no longer an issue.  

Third Note: Consistency 

Not surprisingly, adding Windows-L (or meta-L in Unix-speak) to lock my screen has changed.  In my two previous posts, I edited the lubuntu-rc.xml file in my ~/.config/lubuntu directory.  That file no longer exists, and this time I'll use the built-in Preferences > LXQT Settings > Keyboard Shortcuts to add this function. This opens the Global Actions Manager (that's a mouth-full!).  Click the Add button, move the cursor to the shortcut and press the desired shortcut, Windows-L in this case.  Add a short comment (Lock Screen like Windows), select the Command radio button, and add the command xdg-screensaver lock.   Click OK, and you're done.   You can lock the screen with either Ctrl-Alt-L or Windows-L.

Fourth Note: Two Monitors  

There's a huge improvement here in setting the position of the second monitor.  My extended monitor sits to the right of my labtop's screen, and making everything work smoothly in Lubuntu 17 and 18 was tricky.  Now the Monitor Settings app sets everything up, there's  no fooling with xrandr,  and there's no need to add a second task bar to the extended monitor. 

Select Preferences > LXQT Settings > Monitor Settings.  Click on Set position, drag the monitors into the correct position for your setup, and click apply.   Confirm the new setting works for you, and you're all set.   

But, if you've become accustomed to task bars on both monitors (and I have), it's easily done.  Move cursor to the task bar, right click, and select Add New Panel. Set the new task bar to your favorite position on Desktop 2, then select Widgets from the left panel, and add the widgets you'd like to use.  Unlike LXDE, all the settings for both task bars are stored in one file (~/.config/lxqt/panel.conf), so there's no advantage (and probably some risk) in editing files manually.  Just configure everything thru the UI.

Fifth Note: Network and Volume Indicators

As I expected, there are changes here.  For the volume indicator, right-click on the task bar (aka panel), select Configure Panel, select Widgets from the left panel, and add the Volume Control if it's not there.  For the Network, make sure the Status Notifier Plugin (statusNotifier) is added.  The Status Notifier includes the battery monitor and the network status icons.  Everything works as it should without any tricks, so if you add these two widgets, no further action is required.

I prefer the Network indicator to the nm-tray indicator.   To change this, follow the instructions in Advanced Networking, selecting the Network and unselecting the nm-tray.

Sixth Note: More on Network Interfaces

I have two wireless network interfaces with my Asus netbook.  The built-in Qualcomm Atheros AR9485 worked fine out of the box.   In addition, I have a Realtek RTL8192cu USB dongle. When booting into Windows 10, I found the Realtek interface is much faster than the Qualcomm interface.   In Lubuntu 17, the Realtek interface would stop working every two or three minutes until I disabled/enabled the interface. Then it would work again for another two or three minutes. The Realtek interface no longer quits working every two or three minutes in Lubuntu 20.0, so this problem has been fixed. But the throughput in Speedtest is faster using the Realteck interface under Lubuntu 18.04 than it is under 20.04, so I'm going to apply the same update.


sudo apt-get install linux-headers-$(uname -r) build-essential dkms git
git clone https://github.com/pvaret/rtl8192cu-fixes.git
sudo dkms add ./rtl8192cu-fixes
# NB:  The step above reports a version.   
#      As of 2018-04-12, the version is 1.11, not 1.10.
#      Use the correct version in the next step.
sudo dkms install 8192cu/1.11
sudo depmod -a
sudo cp ./rtl8192cu-fixes/blacklist-native-rtl8192.conf /etc/modprobe.d/
sudo cp ./rtl8192cu-fixes/8192cu-disable-power-management.conf /etc/modprobe.d/
reboot

After rebooting, speedtest shows about a 10MB/second improvement in through-put.

Seventh Note: Printers

As expected, the postscript-capable Lexmark Optra S installed with no problems.  Even better, the installation found the wireless Epson Workforce 2860 and installed the correct drivers.  But installing the Epson NX420 turned out to be an even bigger headache than I expected.  

First, I had to fight through the cartridge-not-recognized messages on the Epson printer.  This is a common complaint on the web; it's just a matter of finding one of the black-magic solutions that work.   After finally satisfying the printer's lust for ink cartridges, I was able add the printer and print the test page.

The Epson Workforce installed so cleanly that I hoped I would have better luck with the NX420 this time, but no.  The test page images and text did not align cleanly.   Referring to my earlier notes, I downloaded the driver from http://www.openprinting.org  The Discover software installation tool will open the downloaded file, but Discover will not install a file from an unsigned archive. Instead of opening the the downloaded file automatically, save it, and then run the command 

 sudo gdebi epson-inkjet-printer-nx420_1.0.0-1lsb3.2_amd64.deb 

from a terminal window. There are a couple dozen dependencies that will be installed as well, so don't be alarmed. After the install is finished, right click on the NX420 printer, and open the properties. Under Settings, check the values in the Make and Model line. This looks like informational text, but it's actually the driver. Click on change, wait while Change Driver dialog. The recommended manufacturer (Epson) is already selected, click Forward. There will be two choices of drivers, choose the one that says Epson Stylus NX420 Series - epson-inkjet-printer 1.0.0-1lsb3.2. The other, Epson Stylus NX420 - CUPS+Gutenprint v5.2 is the bad driver. Select the correct driver, click Forward, click the radio button to Use the new PPD, and click Apply. The test page should print correctly now.

Eighth Note: Final Tweak

The keyboard and touch-pad on the netbook are pretty tight, and I frequently bump the touch-pad while typing.  Of course, this sends my cursor all over the place, and soon I'm typing text three paragraphs above where I should be.  Because I have a mouse, I really don't need the touch-pad most of the time, and I want an easy way to turn it on and off.

I will re-use the script in my Lubuntu 18.04 Upgrade post. The script  toggles the touch-pad on and off, and we'll just need to bind the script to a key.   Open the Global Actions Manager (Preferences > LXQT Settings > Keyboard Shortcuts). Click the Add button, move the cursor to the shortcut and press the desired shortcut key.   I use fn-F9 because that key has a small touch-pad image on it.  The Global Actions Manager identifies this key as XF86TouchPadToggle.  Select the Command radio button, and enter the full path and filename of the script in the command box.   Click OK, and you're done.   Now I can enable or disable the touchpad with the fn-F9 key.  

This completes my upgrade to Lubuntu 20.04 LTS.  By the time support of this version of Lubuntu expires, this netbook will be 10 years old.   This light-weight version of Ubuntu has added 5 years to the useful life of my old netbook. 

Thursday, January 14, 2021

Lubuntu 18.04 Upgrade

Wow.... where has this post been hiding?  I'm getting ready to update to Lubuntu 20.04 LTS and I found this mostly completed post from a year or two ago!  This information is useful to my next upgrade, so I'm going to finish this post and document a new note before starting the upgrade to Lubuntu 20.04 LTS.

So, a couple years ago I was running Lubuntu 17.04 and 17.10 on an old HP laptop and Asus netbook for about a year when Lubuntu 18.04 LTS was released.   While the 17.x distributions worked well, they were not LTS (Long Term Support) versions, and updates are no longer available.  

I decided to start with a fresh install, overwriting my old distribution.   I started with my earlier notes in Lubuntu 1704 to1710-upgrade.  Most of these notes are still useful, so in this post I'll document where things went awry.

Everything went well through my first two notes, Installation media and  Broadcomm wireless adapter.

But following my third note, Consistency, when I tried to change the Window-l key to lock my screen, it didn't work;  neither did the Lubuntu default key combination of ALT-DEL-L.   I fired up an xterm, and the command lxsession-default lock just echoed the word "lock" in the window.  Not so good.

Google is your best friend in this situation, and after googling this issue, I found that everyone is reporting it.  To fix it, we need to run a command that locks the screen.   I could install the xscreensaver command, which wouldn't be a bad thing if I was running gnome.  But I'm not, so installing 20+ dependencies to run the screensaver on hardware that is nearing the end of its life didn't seem like a great idea.

So, how does Lubuntu lock the screen?   The menu Logoff command displays a menu of logoff options, including locking the screen.  Now it's time for some brute-force detective work.   First, where is the lxsession command stored?  The command whereis lxsession shows us the executable is found in /usr/bin.   What else is stored in /usr/bin?   The command ls lx* finds the command lxsession-logout.   The command type lxsession-logout shows it's a hashed file, aka a compiled executable.  Running lxsession-logout from my terminal, I get the same pop-up window as executing logoff from the main menu.

Again, google is our friend.  Googling lxsession-logout, we find the source for lxsession-logout.c in github.  This is where open source really shines -- we'd really be stuck with proprietary vendor code in a situation like this.  Looking thru the source, lxsession-logout searches for two programs to lock the screen:  lxlock and xdg-screensaver.  If it finds one of those program, it will use the program it finds to lock the screen.  Back in our terminal session, we can look for those two programs; either key in the program at the prompt and see what happens, or search using find.  On my fresh install, I did not have lxlock, but I did have xdg-screensaver.

Now, back to lubuntu-rc.xml.   Edit the file in your favorite text editor, and after the default lock command, add the following; it's the almost the same code from the 17.04 to 17.10 upgrade, except we use the xdg-screensaver command instead of lxsession-default.
  
  <!-- Lock the screen on Windows + l-->
  <keybind key="W-l">
    <action name="Execute">
      <command>xdg-screensaver lock</command>
    </action>
  </keybind>


Save the file, and from a terminal session refresh your openbox configuration:
openbox --reconfigure
Assuming you didn't get any errors, the Windows-L sequence will lock your screen. And before you close up lubuntu-rx.xml, you might as well fix the command for CTRL-ALT-L, too.

Fourth Note:  Dual Monitors

Handling two monitors hasn't changed.   I found that I still needed to duplicate the task bar on both monitors.   This is a new feature of Windows 10 that I've become accustomed to at work, so having the taskbar on both monitors doesn't seem as odd as it once did.

Fifth Note: Network and Volume Indicators

The Network and Volume indicators seem to work a little better in Lubuntu 18 than in Lubuntu 17, but you still need to be pretty quick.  I went ahead and followed my notes from the upgrade to 17.10.

Sixth Note:  Network Interfaces

The newer Linux kernel should support the Realtek USB dongle properly in my Asus netbook. It does work, but testing my network speed with my ISP's speedtest showed that the performance was about half that with Windows 10.    I followed my notes from the earlier upgrade and used the better driver.   Performance is now slightly better than Windows 10.

Seventh Note: Printers

The Lexmark Optra S installed with no problems, as expected.  But installing the Epson NX420 turned out to be a bigger headache than I expected.  As expected,  the default installation did not work properly.     Referring to my notes, I downloaded the driver from openprinting.org.  As before, I chose to open the file with the Software Center, but nothing happened...  Google has now become my best friend,  and there are several reports of the latest Software Center not processing .deb files correctly.

Luckily, reports of the problem also included suggestions to use the command line tools.   Instead opening the the download automatically, save it as a file, and run the command

sudo gdebi epson-inkjet-printer-nx420_1.0.0-1lsb3.2_amd64.deb

There are a couple dozen dependencies that will be installed as well, so don't be alarmed.    After the install is finished,  right click on the NX420 printer, and open the properties.   Under Settings, check on the Make and Model line.   This looks like informational text, but it's actually the driver.  Click on change, wait while Change Driver dialog. The recommended manufacturer (Epson) is already selected, click Forward.  There will be two choices of drivers, choose the one that says Epson Stylus NX420 Series - epson-inkjet-printer 1.0.0-1lsb3.2.   The other, Epson Stylus NX420 - CUPS+Gutenprint v5.2 is the bad driver.  Select the correct driver, click Forward, click the radio button to Use the new PPD, and click Apply.  The test page should print correctly now.

Eighth Note: Final Tweak

The keyboard and touchpad on the netbook are pretty tight, and I frequently bump the touchpad while typing.  Of course, this sends my cursor all over the place, and soon I'm typing text three paragraphs above where I should be.  Because I have a mouse, I really don't need the touchpad most of the time, and I want an easy way to turn it on and off.

First, there's a short script. The script stores state information in a status file ($statusFile), and toggles the touchpad on and off.  Be sure to use chmod+x to make the script executable.

#!/bin/bash  

whoAmI=${0##*/}
notifySeconds=5000   
statusFile=/tmp/touchPadOff

# Get the current status.  If there's no status file,
# create one and notify the user.   Otherwise, get the current status
# and set it the opposite way.
touchPadOff=$(cat ${statusFile}  2>/dev/null)
if [  $?  ==  0  ] ;     then 
	if  [  $touchPadOff  ==  0  ] ;      then 
		echo 1 > $statusFile
		synclient TouchPadOff=1
		notify-send -t $notifySeconds  $whoAmI:  'Touch Pad turned off.'
	else
		echo 0 > $statusFile
		synclient TouchPadOff=0
		notify-send -t $notifySeconds $whoAmI:  'Touch Pad turned on.'
	fi
else
	echo 1 > $statusFile
	synclient TouchPadOff=1
	notify-send -t $notifySeconds $whoAmI: 'Touch Pad initialized  and turned off.'
fi
#  

Next use lxhotkey command from a terminal window ( or Preferences -> Setup Hot Keys) to associate a key with the script to execute. Click on the Programs tab, the press the + button to add a new command and hot key. In the pop-up, move the cursor to Hotkey1 and press the desired key.  In my case, I used fn-F9, because that key has a small touchpad image on it.   Lxhotkey identifies this key as XF86TouchPadToggle.  Move the cursor to the command line, enter the fullpath of the script, click on the check mark to save it. 


With this final note, everything is documented, and I'm ready for Lubuntu 20.04 LTS.