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.