Dual Boot Linux (Ubuntu 22.04) and Windows 11 on Modern Systems – UEFI

Thursday, December 7th, 2023

Dual Boot Linux (Ubuntu 22.04) and Windows 11 on Modern Systems – UEFI

In order to setup a dual boot of Windows 11 and Ubuntu 22.04 on a modern system that uses UEFI, follow these steps.

  1. Install Windows 11 first leaving some unpartitioned space (at least 60GB is my recommendation) on the drive you're installing Windows on.
  2. Boot up the Ubuntu installer.
  3. During installation, you'll be presented with an Installation Type options screen.  Choose "Something else". 
  4. On the next screen, you'll see a list of drives and partitions.  On the same drive you installed Windows, create 3 new partitions. 
    1. Create an EXT4 partition for the / mount point at least 40GB in size (this is the main drive for Linux files).
    2. Create a SWAP partition at least 18GB in size.
    3. Create an EFI partition at least 500MB in size.  This is extremely important in order to get grub to install properly. 
  5. Leave the "Device for boot loader installation" set as the top level drive that Windows and Ubuntu was / is being installed on.  You should not select an individual partition here.
  6. Complete the installation process. 
  7. You might need to change the UEFI boot order in the BIOS of your system to boot Ubuntu / Linux first versus booting the Windows EFI partition.  Since you created an EFI partition for your Linux install, it should show up as a bootable option in the bios.  Set / adjust accordingly.
  8. That's it!

CentOS LVM and Software RAID Partitioning Instructions

Sunday, May 30th, 2021

Installing and Configuring CentOS to Host KVM Virtual Machines

GUI

When configuring a fresh install of CentOS for a KVM host machine (the main server that hosts all of the virtual machines), I like to run a GUI to make managing some of the virtual machines easier.  Thus, during install, choose the options for CentOS with Minimal GUI:

RAID 10 LVM Partitions

When configuring the hard drive partitions, set it up to use RAID 10 LVM SOFTWARE RAID:

Create volume group called "vms" without the quotes that is setup as RAID 10 (set volume group space to be as large as possible).

Set the "/" partition to 100GB XFS LVM (RAID10).

Set the "swap" partition to 32GB.

Only setup those two partitions.  The remaining space in the RAID 10 volume group "vms" will be used for KVM containers (and the remaining space does NOT need to be assigned to any mount points).

That's all.

Adding SAS RAID Drivers to CentOS 8 and Red Hat Linux During Installation

Friday, April 30th, 2021

Adding SAS RAID Drivers to CentOS 8 and Red Hat Linux During Installation

CentOS 8 and Red Hat Linux 8 removed a lot of built in RAID controller and SAS drivers.  As such, you'll need to identify your SAS RAID controller card model number, and then during the installation of CentOS 8 or Red Hat, you will need to follow these instructions (modifying them for your hardware).

https://gainanov.pro/eng-blog/linux/rhel8-install-to-dell-raid/

If for some reason the link above is no longer available, I saved and archived a copy which can be read here.

Add El Repo Permanently

As updates are released to CentOS 8 / Rocky Linux / Red Hat 8, the kernel will often be upgraded.  To make sure the SAS drives are updated as well, you'll need to configure your system to pull updates from El Repo automatically by using the following commands:

sudo rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
sudo yum install https://www.elrepo.org/elrepo-release-8.el8.elrepo.noarch.rpm
sudo yum update -y

In case the above instructions no longer work, this guide should help.

Disable NetworkManager Wait Online Service

Prevent the boot from being halted on startup by network connection checks by running the below command:

sudo systemctl mask NetworkManager-wait-online.service

Installing Chrome WebDriver (Linux Script)

Wednesday, August 28th, 2019

Installing Chrome WebDriver (Linux Script)

Find out which version of Chrome is installed on your system before running the below commands.  You can find out your chrome version by running the following command:

google-chrome --version

Adjust the version number (replace {VERSION_NUMBER})  in the below commands to match the version installed on your system!!!

sudo -i
cd ~/Downloads
rm chromedriver_linux64.zip
wget -N https://chromedriver.storage.googleapis.com/{VERSION_NUMBER}/chromedriver_linux64.zip
unzip chromedriver_linux64.zip
mv chromedriver /usr/bin/chromedriver
chown root:root /usr/bin/chromedriver
chmod +x /usr/bin/chromedriver

Selenium and other libraries that rely on the Chrome WebDriver should now work properly.

Installing the Newest Version of Python 2.7.x on Older Versions of Ubuntu (like 14.04 and 16.04)

Thursday, May 9th, 2019

Installing the Newest Version of Python 2.7.x on Older Ubuntu Systems

If you need to upgrade to the newest version of Python 2.7.x, and you're running an older distribution (like Ubuntu 14.04), use the following commands to get and compile the latest version from source (works on Ubuntu 17.04 and older – tested on Ubuntu 14.04):

sudo apt-get install build-essential checkinstall
sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
version=2.7.18
cd ~/Downloads/
wget https://www.python.org/ftp/python/$version/Python-$version.tgz
tar -xvf Python-$version.tgz
cd Python-$version
./configure --with-ensurepip=install
make
sudo make install

Install requests and hashlib:

sudo rm /usr/lib/python2.7/dist-packages/chardet*.egg-info
sudo rm -r /usr/lib/python2.7/dist-packages/chardet
sudo rm /usr/lib/python2.7/lib-dynload/_hashlib.x86_64-linux-gnu.so
sudo rm /usr/lib/python2.7/lib-dynload/_hashlib.i386-linux-gnu.so
sudo pip install requests
sudo easy_install hashlib

You may need to create a symlink for chardet after installing it directly from pip:

ln -sf /usr/local/lib/python2.7/site-packages/chardet /usr/lib/python2.7/dist-packages/chardet

If you get the error of "ImportError: cannot import name _remove_dead_weakref" when running a pam python based authentication script after installing the new version of python, try this fix:

sudo cp /usr/local/lib/python2.7/weakref.py /usr/local/lib/python2.7/weakref_old.py
sudo cp /usr/lib/python2.7/weakref.py /usr/local/lib/python2.7/weakref.py

Getting Let's Encrypt Certbot to Work:

Now, you'll need to delete the EFF directory from the /opt directory to avoid old configuration issues that were used for your older version of python.  Once you cleanup this directory, you'll run certbot again so it can reconfigure itself. 

sudo rm -r /opt/eff.org/
sudo certbot

Old Way

jonathonf is now a very greedy person and has made his repositories private, so this method no longer works as of 12/20/2019.

sudo add-apt-repository ppa:jonathonf/python-2.7
sudo apt-get update
sudo apt-get install python2.7

Then, you'll need to cleanup a few leftover system packages manually before installing the newest version of python-pip.  If you don't do this, you'll run into problems installing some new packages using pip.

sudo rm /usr/lib/python2.7/dist-packages/chardet*.egg-info
sudo rm -r /usr/lib/python2.7/dist-packages/chardet
sudo rm /usr/lib/python2.7/lib-dynload/_hashlib.x86_64-linux-gnu.so
sudo rm /usr/lib/python2.7/lib-dynload/_hashlib.i386-linux-gnu.so

Now, you can download and install the newest version of python-pip:

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
sudo python get-pip.py

Getting Let's Encrypt Certbot to Work:

First, you'll need to install a few packages that Certbot (the Let's Encrypt client) uses:

sudo pip install requests
sudo pip install hmac

Now, you'll need to delete the EFF directory from the /opt directory to avoid old configuration issues that were used for your older version of python.  Once you cleanup this directory, you'll run certbot again so it can reconfigure itself. 

sudo rm -r /opt/eff.org/
sudo certbot

You're done.

Full list of commands (for quickly doing all of the above):

sudo -i
add-apt-repository ppa:jonathonf/python-2.7
apt-get update
apt-get install python2.7
rm /usr/lib/python2.7/dist-packages/chardet*.egg-info
rm -r /usr/lib/python2.7/dist-packages/chardet
rm /usr/lib/python2.7/lib-dynload/_hashlib.x86_64-linux-gnu.so
rm /usr/lib/python2.7/lib-dynload/_hashlib.i386-linux-gnu.so
mkdir -p /root/Downloads
cd /root/Downloads
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py
pip install requests
pip install hmac
rm -r /opt/eff.org/
certbot

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.

Debian & Ubuntu :: Suppress Installation Package Prompts Completely or Preconfigure Prompt Answers

Saturday, September 14th, 2013

Suppress Installation Package Prompts Completely or Preconfigure Installation Question Answers

Automating the installation of software via bash scripting on Linux can be difficult.  However, in debian and its related distributions such as Ubuntu, you can simplify the installation of packages by using a few tools.  One of these tools is called debconf-utils.  If installation packages such as MySQL or PHPMyAdmin ask configuration questions, you can provide a default set of answers without being prompted.  This is excellent for testing scripts or automating installation for users who may not know how to appropriately answer these questions.

Basically, with debconf-utils you can pre-answer these questions so that no prompts show up!

To install, run this command:

sudo apt-get install debconf-utils

To get a list of questions an installer might ask, first install the package on a test machine where you're writing the script normally.  For example, let's install phpmyadmin:

sudo apt-get install phpmyadmin

Now, to retrieve a set of questions phpmyadmin may ask, you can run this command:

sudo debconf-get-selections | grep phpmyadmin

In your bash script, you can now pre-answer certain questions by including your preconfigured answer commands before installing the package.  For example, when phpmyadmin installs, it asks for the MySQL root user password.  You can skip this prompt and define what the MySQL root password should be by using this command in your script:

echo 'phpmyadmin phpmyadmin/mysql/admin-pass password 1234' | debconf-set-selections

password defines the type and 1234 sets the password to 1234.
You can also suppress questions entirely by using the following command in front of your install command:

DEBIAN_FRONTEND=noninteractive sudo apt-get install phpmyadmin

Default configuration will be used during the installation of the phpmyadmin package, which means it may not work after being installed because some configuration options should be answered.  So, use both combinations for various packages to fit your needs!

How to Make MATE Look Like Windows XP using the Luna Theme

Sunday, April 14th, 2013

Make MATE or GNOME2 Look Like Windows XP Using the Luna Theme

If you want your Linux installation to look like the original theme used in Windows XP, you can do that! This guide will walk you through the process of easily making any MATE or GNOME2 Desktop Environment look like the Windows XP GUI. The Luna Theme can be downloaded here and installed using our simple installation script. If you already have MATE installed or are already running GNOME2, skip to the Luna Theme install instructions.

Install MATE on Ubuntu:

Run the below commands for your matching Ubuntu version in a terminal to install MATE.  To find out which version of Ubuntu you're running, use this command:

lsb_release -a

For Ubuntu 12.04:

sudo add-apt-repository "deb http://packages.mate-desktop.org/repo/ubuntu precise main"
sudo apt-get update 
sudo apt-get --yes --quiet --allow-unauthenticated install mate-archive-keyring 
sudo apt-get update
sudo apt-get install -y mate-desktop-environment

For Ubuntu 14.04:

sudo apt-add-repository ppa:ubuntu-mate-dev/ppa
sudo apt-add-repository ppa:ubuntu-mate-dev/trusty-mate
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install -y mate-desktop-environment-extras

For Ubuntu 16.04:

sudo add-apt-repository ppa:ubuntu-mate-dev/xenial-mate
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install -y mate-desktop-environment

For Other Distributions (Distros):

http://wiki.mate-desktop.org/download

Installing the Luna Theme:

Our version of the Luna theme has been converted and ported over to GTK3, so it should work with all newer flavors of Linux running MATE while still working on older Linux installs running GNOME2.To install the Luna Theme which will make Linux look like Windows XP, run the following commands. The theme files will be downloaded and saved in your Downloads directory.

cd ~/Downloads
wget -O linux_xp_luna_theme_install.tar.gz http://dinofly.com/files/linux_xp_luna_theme_install.tar.gz
mkdir Luna
tar -zxvf linux_xp_luna_theme_install.tar.gz -C Luna
cd Luna
sudo rm -rf /usr/share/themes/Luna
rm -rf ~/.themes/Luna
sudo bash install.sh

Next, Right Click on the Desktop, and choose "Change Desktop Background".  Click on the "Themes" tab.  Select "Luna".  Click on the "Background" tab.  If you want the default XP wallpaper set as your background, click on the "Add" button.   Select your "Pictures" folder.  Select "luna_background.jpg".  Click "Open".  Click on "Close" to change it. 

Now, MATE or GNOME2 looks like XP!  Enjoy!  This theme was copied from Ylmf OS 3.0.

WinRar Create SFX Self Extracting Installation Wizard and Add Registry Settings

Saturday, January 19th, 2013

Creating a SFX Installation Wizard with WinRar that Can Modify Registry Settings

WinRar's "SFX options…" dialog does not contain any information or guides that help you modify registry settings after the files for your installation have been extracted.  This is a hinderance, but it is extremely possible to modify registry settings by running a batch file after the installation has been completed.  First, make sure the .bat file is included with the rest of your installation files that you selected before making the SFX archive.  In the "Advanced SFX options" window, click on the Setup tab.  Under "Run after extraction", type in just the name of the .bat file you're going to be running.

The Batch File Itself:

This template batch file checks to see if the operating system is 32-bit or 64-bit.  This is an important distincting as it will affect how you setup keys for each type of operating system.  64-bit system keys are usually placed in the Wow6432Node key, so it is important to make this distinction so that your registry settings will work properly.  This batch file called "Program Registry Adder 1.0" provides examples on how to add and modify registry keys depending on the operating system type.

Download Program Registry Adder 1.0

Adding Keys with a .bat (batch) File:

To add specific keys, you use the following parameters:

REG ADD "HKLM\SOFTWARE\My Proggy\" /f /v "InstallDir" /t REG_SZ /d "%PPROG%

The first parameter specifies which hive and key should be created.  The /f flag forces the addition.  The /v flag is the name of the key that should be created.  The /t flag specifies what type of Registry key should be created.  The example uses REG_SZ, which is just a string.  The possible types are:

Value Type (Use this in the batch File)
Binary REG_BINARY
DWORD REG_DWORD
Expandable String REG_EXPAND_SZ
Multi-String REG_MULTI_SZ
String REG_SZ
Binary REG_RESOURCE_LIST
Binary REG_RESOURCE_REQUIREMENTS_LIST
Binary REG_FULL_RESOURCE_DESCRIPTOR
None REG_NONE
Link REG_LINK
QWORD REG_QWORD

 

Check out more information here.

The /d flag contains the value of the key.

Conclusion

Using both a self extracting installation wizard and a batch file for registry key settings makes for the perfect free to use professional looking installation script. You can always run the batch file silently by removing all pause statements in the script. 

WinRar SFX Custom Start In and Target Paths on Desktop Shortcuts

Saturday, January 19th, 2013

WinRar SFX Custom Start In and Target Paths

When creating a self extracting installation wizard using WinRar, you may want to create a shortcut to your program on the user's desktop.  Typically, these parameters are specified in the "SFX options…" dialog.  In the "Advanced SFX options", click on the "Advanced" tab.  Here, you'll see a section called "Shortcuts".  If you create a shortcut using the "Add shortcut…" button, WinRAR will typically leave out an important undocumented feature.

If you create a desktop shortcut using the "Add shortcut…" button, make sure you set the "Destination folder" to just a slash "\" (no quotes) or the shortcut on the desktop will have the following properties:

Target: "D:\Install Directory\YourProgram.exe"
Start in:

Notice, there is no "Start in:" path.  To fix this, you need to add a "\" to the desktop shortcut parameters manually like so:

D, yourProgramsName.exe, \, "Shortcut Description", "Shortcut name",

Or, make sure you place a "\" (no quotes) for the "Destination folder" in the add shortcut helper.

This problem only affects desktop shortcuts and can be fixed by adding a "\" to the parameters for each desktop shortcut after the program's name.