Ubuntu: Allow Automatic Updates for Specific Packages Only

Tuesday, June 14th, 2022

Ubuntu: Allow Automatic Updates for Specific Packages Only

If you want to allow Google products and packages to update automatically, follow this guide.

You can also add additional sources that should update automatically following the same process.

This is helpful when using Selenium, WebDriver for Chrome, and Python.  Doing this allows you to always use the most up-to-date version of all of these dependent packages.

Tested in Ubuntu 20.04

Fixing Sound in Ubuntu

Wednesday, April 21st, 2021

Fixing Sound in Ubuntu

If your sound quits working randomly after installing updates via the apt system (via sudo apt-get update && apt-get upgrade) or via the Software & Updates graphical program, it's possible that some of the drivers have not been installed with the latest kernel updates.

To fix this, try running the below command:

sudo apt install linux-modules-extra-$(uname -r)

Reboot.  Your sound should hopefully work again!

If the above command doesn't work (older versions of Ubuntu do not have this package), please see the generic information here:

https://itsfoss.com/how-to-fix-no-sound-through-hdmi-in-external-monitor-in-ubuntu/

Intel Original Compute Stick – Keep WiFi from Breaking – Block Kernel Updates and Chestersmill-Settings Updates – Get Latest Software from Ubuntu Advantage

Wednesday, April 21st, 2021

Intel Original Compute Stick – Keep WiFi from Breaking – Block Kernel Updates and Chestersmill-Settings Updates

If you have the original Intel Compute Stick (STCK1A8LFC [1GB of RAM] or STCK1A32WFC [2GB of RAM] models from 2015), you'll need to prevent a few software packages from updating so that these updates won't break your WiFi!  I've never been able to get the WiFi to work with these Intel Compute Sticks running a kernel newer than version 3.16 on any version of Ubuntu.  I've also never been able to get the WiFi to work on anything but Ubuntu 14.04, so you might be stuck having to run this older version of Ubuntu.  Also, updates to the chestersmill-settings package can break your WiFi.  To prevent both scenarios from breaking your WiFi, simply prevent the below packages from being updated.

Preventing packages from being updated can be accomplished using hold statuses in the apt system as explained on AskUbuntu:

https://askubuntu.com/questions/18654/how-to-prevent-updating-of-a-specific-package

Basically, you'll need to run the below commands to prevent WiFi from breaking due to buggy kernel and chestersmill-settings package updates:

sudo apt-mark hold chestersmill-settings
sudo apt-mark hold linux-image-$(uname -r)
sudo apt-mark hold linux-image-generic
sudo apt-mark hold linux-generic

You can now safely update software packages without worrying about your WiFi being broken by kernel and chestersmill-settings package updates!

Get Latest Software from Ubuntu Advantage for Ubuntu 14.04

Ubuntu 14.04 is also still supported via the Extended Security Maintenance (ESM) Ubuntu Advantage program (https://ubuntu.com/advantage).  

To get updated software and packages until April of 2022, you'll need to get an Ubuntu Advantage key.  Get your key using your UbuntuOne account on this page:  https://ubuntu.com/advantage

Now, install the Ubuntu advantage client by using the commands below:

sudo add-apt-repository ppa:ua-client/stable
sudo apt-get update
sudo apt-get install ubuntu-advantage-tools

Set your key using the command below (using your key rather than YOUR_KEY_HERE):

sudo ua attach YOUR_KEY_HERE

Now update and install the upgraded packages available via Ubuntu Advantage:

sudo apt-get update && sudo apt-get upgrade

Ubuntu Grub Fails to Install on RAID Array

Friday, February 6th, 2015

Ubuntu Grub RAID Issues

Grub Fails To Install on RAID Array

If grub fails to install on your RAID array in any version of Ubuntu, do NOT disable your BIOS RAID! The correct solution is at this blog entry. I'll summarize it below.

At the stage of the install where it is attempting to install GRUB it will detect as

/dev/mapper

This is incomplete! That's why the GRUB install fails.

You need the actual name of the RAID array to install to. So during that step, press ctrl+alt+F2 to drop to a busybox terminal, then enter

ls -l /dev/mapper

Pick out the name of your array from the list shown, then press ctrl+alt+F1 to switch back to the install (you can switch back and forth as much as you like with no problems) and enter it in the field as

/dev/mapper/{your array name}  

Then GRUB installs perfectly and you're ready to go, with a proper BIOS RAID array intact.

System Won't Boot After Grub Failed to Install

If your system will no longer boot because you skipped installing or updating grub, you need to download an Ubuntu version that does support RAID, boot from the LIVE CD, drop to a terminal, and then run:

ls -l /dev/mapper
sudo grub-install /dev/mapper/{ARRAY_NAME_HERE}

Setting Up RAID Array During Ubuntu Install

If you are configuring a BIOS RAID array for the first time on Ubuntu, you should create a 1MB boot partition.  Its partition type is "boot".  If you do this, grub will always try to install there and will succeed every time without failing when upgrading or reinstalling grub.

Using JQuery Color Picker and Cookie Plugins to Change Element Background Colors Dynamically Based on User Preference

Sunday, April 21st, 2013

Changing Website Element Colors Dynamically Based on User Preferences

Wouldn't it be cool to dynamically style a website or webpage based on a user's favorite color?  Thanks to several JQuery plugins, it is now possible to do so!  The JQuery Color Picker plugin allows users to select a color based on a color pallete / color wheel similar to those found within photo editing software such as Adobe Photoshop or Corel PaintShop Pro.  The JQuery Color Plugin can darken, lighten, add, multiply, subtract, find color hues, change rgb values, and manipulate colors in all sorts of ways you probably never imagined possible.  The final piece to dynamically styling a page based on a user selected color is to save the picked color's value in a cookie using the JQuery-Cookie Plugin.  When any page loads, you will need to use the document.ready JQuery function to read the cookie and restyle elements as necessary.  If a cookie is not set, the default color can also be specified here. 

Here's a screenshot of the JQuery Color Picker in action:

To load / use the color picker, place this function within the document.ready function:

// Color Picker Loader
    $('#colorpicker').ColorPicker({
    
       color: defaultColor,
         onShow: function (colpkr) {
              $(colpkr).fadeIn(500);
              return false;
         },
         onHide: function (colpkr) {
              $(colpkr).fadeOut(500);
              return false;
         },
         onChange: function (hsb, hex, rgb) {
          var origColor = '#' + hex;
       
          // Set the main div background colors to what was selected in the color picker
              $('#colorpicker').css('backgroundColor', origColor);
          $('#origColor').css('backgroundColor', origColor);
          
          // Set the cookie
          $.cookie("color", '#' + hex, { path: '/' });
          
          // Set the dark and light colors (multi-iterations)
          darkColor = $.xcolor.darken('#' + hex).getHex();
          for (var i = 0; i < iterations; i++) {
            darkColor = $.xcolor.darken(darkColor).getHex();
          }
            
          lightColor = $.xcolor.lighten('#' + hex).getHex();
          for (var i = 0; i < iterations; i++) {
            lightColor = $.xcolor.lighten(lightColor).getHex();
          }
          
          
          // Set the light and dark divs
          $('#darkColor').css('backgroundColor', darkColor);
          $('#lightColor').css('backgroundColor', lightColor);
          
          // Change class attributes
          $('.light').css('backgroundColor', lightColor);
          $('.dark').css('backgroundColor', darkColor);
          $('.pad').css('backgroundColor', origColor);
          
          // Set the border
          $('#colorpicker').css('border-color', darkColor);
          
          
         }
    }); 

Assign a DIV element the ID of "colorpicker" in your HTML file to activate the color picker.    Don't change the "onShow" or "onHide" JQuery sub-functions of the ColorPicker.  When a user chooses a color from the color picker, the color picker "onChange" function is called.  This is where you need to define what should be done with the color the user has picked.  In my example, I call the $.xcolor.lighten and $.xcolor.darken Color Plugin functions to generate a lighter and darker color.  I use then use the color selected, a lighter variant of that color, and a darker variant of that color to style elements appropriately to keep text readable while offering a new color scheme.  As you can see from the code above, I mainly change the css attributes of certain classes, which the elements have been assigned.  What is changed is the backgroundColor and border-color of certain classes based on the three colors that were generated.

To see what other cool things you can do with all of these plugins, check out the links in the first paragraph.  Click here to see a live demonstration of all three plugins in action and download the source for how it all works based on the example discussed above.  The only Javascript file that needs to be changed to experiment with this sample is the "main.js" file within the "js" folder.

I hope this guide helps.  The plugin websites did not provide all of the code needed for a working sample, but luckily, I did the combination work for you.  Go ahead and use my source for anything!  Please comment if you have questions.