How to Install Ubuntu on a Panasonic Toughbook CF-31

How to Install Ubuntu on a Panasonic Toughbook CF-31

Posted by Ed Lasher, TJ Supper on 26th Oct 2020

Linux operating systems come in many flavors known as distributions, or “distros” for short. A distro contains the user interface and any necessary applications. One of the most popular and user-friendly Linux distros is called Ubuntu. Whether you’re just dipping your toe in the water or you’re already an enthusiast, you can’t go wrong with Ubuntu. It’s stable and well supported, robust, but still lighter weight than Windows.

We’ll be installing Ubuntu version 20.04, the latest stable release at the time of this writing, but if you want to try one of the related distros like Kubuntu or Lubuntu, the steps are roughly the same.

We’ve tested Ubuntu on the  Toughbook CF-31 MK1, MK2, MK3, MK4 and MK5. It works on all of them, but some MKs require more tinkering to get up and running. We’ll include instructions for all of that.

Preparing your installation media

These instructions assume you are starting out with a machine running Windows 7/8/10 (not necessarily the same one you plan to install Ubuntu on). If you are using an older version of Windows or a Mac, this documentation from Ubuntu might help:
How to burn an installation DVD on Windows
How to create a bootable USB stick on Windows
How to burn an installation DVD on MacOS
How to create a bootable USB stick on MacOS

We’re not going to spend a ton of time on this part since the instructions are the same regardless of what kind of computer you are using. We have also covered this in a few other articles. But here’s the quick rundown. If you want to install Ubuntu from a DVD like we did (check the links above if you plan to use a bootable USB stick):

  1. Download the Ubuntu ISO file
  2. Pop a blank DVD in your drive, then
  3. Right click the ISO file and click “Burn disc image” then click the Burn button on the window that pops up.

Booting to your installation media

Setting boot override in the BIOS

In order to continue with the installation, we need to tell your Toughbook to boot from the DVD (or USB) rather than the hard drive. With the DVD already in the drive (or the USB stick plugged in), make sure your Toughbook is plugged into a power source, then:

  1. Turn on your Toughbook and hit the F2 key as soon as the Panasonic logo pops up. This will bring you to the BIOS.
  2. Navigate with your arrow keys to the Exit tab.
  3. Using your arrow keys again, scroll down to where it says “Boot Override.”
  4. Under Boot Override, find the appropriate boot device that has the Ubuntu ISO installed and select it using the Enter key.

Installing Ubuntu

When your computer boots up, it will automatically open up a welcome window that will walk you through the installation process. It’s pretty straightforward and does a better job of guiding you than we can do here, so just follow along with the installation process and you’re all done! End of tutorial!

Getting everything working

Oops, I guess you’re not actually all done. It’ll take a little tweaking to get everything working properly on your Toughbook CF-31. There are a few things that might need a bit of attention, depending on which generation/mark (MK) your CF-31 is, including,

  • Enabling the mouse touchpad
  • Fixing the sound
  • Calibrating the touch screen and
  • Fixing the screen brightness keys.

With most of these fixes, you will have to use the terminal. The terminal is a text-only interface that allows you to give instructions to your machine and make adjustments to your system configuration. It can feel a bit intimidating at first, but you’ll be A-OK. We’ll tell you exactly what to type (or copy/paste) into it; you don’t even need to know what any of it means.

Enabling the mouse touchpad

We found this to only be an issue on the Toughbook CF-31 MK2. If your cursor moves when you use the touchpad, go ahead and skip this part. If you are having trouble with the mouse, follow these steps:

  1. Hit Ctrl+Alt+T to open the terminal.
  2. Type sudo gedit /etc/default/grub then hit Enter.
  3. You will be prompted to type in your admin user password. Type your password and press Enter.
  4. A new window will pop up showing a text file. Find the part that says GRUB_CMDLINE_LINUX_DEFAULT="quiet splash" and change it to GRUB_CMDLINE_LINUX_DEFAULT="quiet splash i8042.nomux i8024.noloop".
  5. Press Ctrl+S to save.
  6. Press Alt+F4 to exit the text editor.
  7. Open the terminal again and type sudo update-grub then hit Enter.
  8. Type sudo shutdown now and press Enter to shut down your computer (a normal reboot will not work for this).
  9. After your computer shuts down, start it up again (your Ubuntu DVD from earlier should have been removed from the drive during the installation, but double check to make sure). You should now have a working mouse touchpad!

Fixing the sound

In our tests, every CF-31 except for the MK5 had audio problems. If your sound is working, you are one of the lucky few who can skip this part. For the rest, here’s how to fix it:

  1. Open the terminal (keyboard shortcut Ctrl+Alt+T).
  2. Copy/paste sudo gedit /usr/share/pulseaudio/alsa-mixer/paths/analog-output-speaker.conf and press Enter.
  3. When prompted, type your password and press Enter.
  4. A text file called analog-output-speaker.conf will open up in a new window. In the text file, find this part:
    [Element Headphone]
    switch = off
    volume = off
    	
    and change it to this:
    [Element Headphone]
    switch = off
    volume = merge
    override-map.1 = all
    override-map.2 = all-left,all-right
    	
  5. Next, in the same text file, find this part:
    [Element Speaker]
    required-any = any
    switch = mute
    volume = merge
    override-map.1 = all
    override-map.2 = all-left,all-right
    	
    and change it to this:
    [Element Speaker]
    required-any = any
    switch = mute
    volume = off
    	
  6. Save your changes to analog-output-speaker.conf using either Ctrl+S or the save button at the top of the file editor.
  7. Go back to the terminal, type sudo reboot and press Enter to reset your Toughbook.
  8. Once your Toughbook boots back up, check the audio. It should be working now.

Calibrating the touch screen

To keep your touch screen working, we'll need to create a startup program

If you try to use the touch screen after installing Ubuntu, you’ll find that it doesn’t register an input in the same place as you touch. The most reliable way to fix this is to create a small calibration utility that will run in the background every time you boot up your CF-31 (too many startup programs can slow your computer down, but don’t worry about this one; it works almost instantaneously, so you won’t even notice it’s there). Here’s how to set it up:

  1. Open Startup Applications Preferences from the Applications Menu.
  2. Click the Add button.
  3. In the Add Startup Program window, give your program a descriptive name, like “Touch Screen Calibration.”
  4. In the box labeled Command, copy and paste one of the following lines of text, depending on the generation of your Toughbook CF-31 (if you don’t know the generation, or MK, here’s a guide that will help you figure it out):
    For the CF-31 MK1: xinput set-prop "Fujitsu Component USB Touch Panel Pen (0)" "Coordinate Transformation Matrix" 1.075, 0, -.03, 0, 1.1, -0.07, 0, 0, 1
    For the CF-31 MK2 - 5: xinput set-prop "Fujitsu Component USB Touch Panel" "Coordinate Transformation Matrix" 1.075, 0, -.03, 0, 1.1, -0.07, 0, 0, 1
  5. Click Save and then close.
  6. Shut down your CF-31 and boot into the BIOS by hitting the F2 key as soon as the Panasonic logo pops up on screen.
  7. In the BIOS, make sure your Touchscreen mode is set to “Touchscreen Mode” and not “Auto” or “Tablet Mode.”
  8. Press F10 to exit the BIOS and save your changes if you made any.

Once your CF-31 boots up, the touch screen should be working properly. If it is, move on to the next section of this tutorial. If it isn’t,

  1. Open the terminal, type xinput and hit Enter. A list of devices will appear.
  2. Copy the name of the touch panel device listed under either "Virtual Core Pointer" or "Virtual Core Keyboard" (there will likely be a few items listed, but you should be able to tell from the name which one is the touch panel).
  3. Open Startup Applications Preferences, select the touch screen calibration utility we created earlier, and click the Edit button.
  4. In the Command box, find where it says "Fujitsu Component USB Touch Panel" and replace it with the device name we copied from the terminal.
  5. Click save, then reboot your computer.

Fixing the screen brightness keys

If you’ve tried to adjust the screen brightness using your keyboard, you may have noticed that the brightness bar will show up on the screen and move up and down, but the actual screen brightness doesn’t change. This is because of a miscommunication between the hardware and the software. Here’s how to fix it:

  1. Open the terminal (to do so, hold Ctrl+Alt+T).
  2. Type sudo apt-get update and hit Enter.
  3. Enter your admin password when prompted.
  4. The terminal will spit out a bunch of text. Give it a minute or two to finish. It might pause and look like it’s done, but wait for the green text to show up.
  5. Type sudo apt install inotify-tools and hit Enter.
  6. A prompt will appear, reading, Do you want to continue? [Y/n]. Hit Y and then Enter.
  7. Wait for it to completely finish, then type sudo nano /usr/local/bin/redirect-brightness.sh and hit Enter. This will create a new empty text file and open it in nano, a text editor that lives inside the terminal.
  8. Copy all of this and paste it into the new empty text file we just created:
    #!/bin/bash
    # NAME: redirect-brightness
    # PATH: /usr/local/bin
    # DESC: Redirect to correct driver when Ubuntu is adjusting the wrong
    #       /sys/class/DRIVER_NAME/brightness
    WatchDriver="/sys/class/backlight/panasonic"
    PatchDriver="/sys/class/backlight/intel_backlight"
    # Must be running as sudo
    if [[ $(id -u) != 0 ]]; then
        echo >&2 "Root access required. Use: 'sudo redirect-brightness'"
        exit 1
    fi
    # inotifywait required
    type inotifywait >/dev/null 2>&1 || \
        { echo >&2 "'inotifywait' required but it's not installed.  Aborting."; \
          echo >&2 "Use 'sudo apt install inotify-tools' to install it.'"; \
          exit 1; }
    # Was right watch driver directory name setup correctly?
    if [[ ! -d $WatchDriver ]]; then
        echo >&2 "Watch directory: '$WatchDriver'"; \
        echo >&2 "does not exist. Did you spell it correctly? Aborting.'"; \
        exit 1;
    fi
    # Was right patch driver directory name setup correctly?
    if [[ ! -d $PatchDriver ]]; then
        echo >&2 "Redirect to directory: '$PatchDriver'"; \
        echo >&2 "does not exist. Did you spell it correctly? Aborting.'"; \
        exit 1;
    fi
    # Get maximum brightness values
    WatchMax=$(cat $WatchDriver/max_brightness)
    PatchMax=$(cat $PatchDriver/max_brightness)
    # PARM: 1="-l" or "--log-file" then write each step to log file.
    fLogFile=false
    if [[ $1 == "-l" ]] || [[ $1 == "--log-file" ]]; then
        fLogFile=true
        LogFile=/tmp/redirect-brightness.log
        echo redirect-brightness LOG FILE > $LogFile
        echo WatchMax: $WatchMax PatchMax: $PatchMax >> $LogFile
    fi
    SetBrightness () {
        # Calculate watch current percentage
        WatchAct=$(cat $WatchDriver/actual_brightness)
        WatchPer=$(( WatchAct * 100 / WatchMax ))
        [[ $fLogFile == true ]] && echo WatchAct: $WatchAct WatchPer: $WatchPer >> $LogFile
        # Reverse engineer patch brightness to set
        PatchAct=$(( PatchMax * WatchPer / 100 ))
        echo $PatchAct | sudo tee $PatchDriver/brightness
        [[ $fLogFile == true ]] && echo PatchAct: $PatchAct >> $LogFile
    }
    # When machine boots, set brightness to last saved value
    SetBrightness
    # Wait forever for user to press Fn keys adjusting brightness up/down.
    while (true); do
        inotifywait --event modify $WatchDriver/actual_brightness
        [[ $fLogFile == true ]] && \
            echo "Processing modify event in $WatchDriver/actual_brightness" >> $LogFile
        SetBrightness
    done
    	
  9. In the terminal, press Ctrl+O and then Enter to save your file.
  10. Press Ctrl+X to exit nano. (If you are running Ubuntu 22.04 skip steps 11 - 16 and begin the next set of steps.)
  11. In the terminal, type sudo crontab -e and hit Enter.
  12. Enter your admin password when prompted.
  13. Type 1 to select nano as your text file editor (you can choose a different editor if you want, but we think nano is the easiest).
  14. Using the arrow keys on your keyboard, bring the text cursor all the way to the bottom of the file where there is blank space and type @reboot sudo redirect-brightness.sh -l
  15. Just like in steps 8 and 9, press Ctrl+O and then Enter to save your file, then Ctrl+X to exit nano.
  16. In the terminal, type sudo shutdown -r now and hit Enter. Your computer will shut down. Once you start it back up, the screen brightness keys should function correctly.

***With the updated Ubuntu 22.04, some additional steps are required to get your screen brightness keys working. You can follow these steps to in this newer version after following steps 1 - 10 in the section above***

  1. Open the terminal.
  2. Type sudo chmod a+x /usr/local/bin/redirect-brightness.sh and hit Enter.
  3. Exit the terminal.
  4. Open Startup Applications from the Show Applications menu on the desktop.
  5. Click the Add Button.
  6. Name the Startup Program something recognizable in the name field.
  7. In the Command field type sudo redirect-brightness.sh -l.
  8. Return to the section above and continue steps 11 - 16.

Starting a new journey

Now that you are up and running with Ubuntu on your Toughbook CF-31, it’s time to start your adventure with Linux! If you’re already familiar with the operating system, we hope this article helped you iron out a few wrinkles. If you are brand new, we hope you’ll enjoy this foray into the world of free and open source software. Now it’s time to explore. Leave a comment and let us know what you discover.

comments powered by Disqus