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!

Recreating a Lost or Removed EFI Windows Boot Partition (Repair Windows Boot)

Wednesday, January 29th, 2020

Recreating a Lost or Removed EFI Windows Boot Partition

In case you remove an SSD with a Windows Boot Partition that boots an installation of Windows, you'll need to recreate the boot system to be able to successfully boot again.  To recreate the boot EFI partition on another drive or partition, perform the following:

1) Create or use an existing Windows installation disc or flash drive (you can use Rufus USB to format a flash drive with a Windows ISO)
2) Boot PC using your Windows installation media (a CD, DVD, flash drive, etc containing Windows installation files)
3) Press SHIFT + F10 on the first screen to bring up Command Prompt
4) Run the following commands and click Enter each time at Command Prompt:

diskpart
list disk
select disk N (N refers to the disk which contains the deleted the EFI System partition)
list partition
create partition efi size=200
format quick fs=fat32
list partition
list volume (find the volume letter which belongs to the installed Windows OS)
exit (exit diskpart)
bcdboot M:\windows (M refers to the volume letter of installed Windows OS)

Add any additional Windows installations by repeating the bcdboot command followed by the installation path for any other Windows installations you want added to the menu.  For example, I added my Windows 7 partition using the below command:

bcdboot P:\windows

You should now be able to boot Windows again without needing the old boot partition or drive.

Instructions were modified from this post.

Save iptables on Shutdown and Restart, and Restore on Boot

Tuesday, October 6th, 2015

Save iptables Rules on Shutdown, Restore on Boot

When your server shutsdown (halts), reboots, or enters runlevel 1, your iptables configuration is automatically wiped and reset.  Packages such as iptables-persistent supposedly help with this problem, but unless you save your rules manually, the rules are never saved automatically when the system reboots. 

I've wanted to truly persist my iptables, so I decided to change their package to always save the iptables rules when the system reboots, halts, or enters runlevel 1 automatically.  The rules are then restored when the system boots to runlevels 2-5.  This means that your iptables configuration will persist forever.  This may not be desired, but if I ban an IP address permanently, I always want it to be banned.

If you'd like to use this modified version of iptables-persistent so that your rules are automatically saved on shutdown, you can install it by running the below commands:

sudo apt-get remove iptables-persistent
sudo dpkg -r iptables-persistent
wget http://dinofly.com/files/linux/iptables-persistent_0.5.8_all.deb
sudo dpkg --install iptables-persistent_0.5.8_all.deb

Use at your own risk.  If you do something stupid, it will persist until you can clear it!

The above package was tested in Ubuntu 12.04 x86, Ubuntu 12.04 x64, Ubuntu 14.04 x86, Ubuntu 14.04 x64, and Ubuntu 15.04 x64.  Should work on other debian operating systems as well.

Windows XP, Windows Vista, and Windows 7 x86 and x64 .NET 4.0 Post Installation Slow Startup Network LAN Devices Fix

Thursday, March 29th, 2012

Windows XP, Vista, and Windows 7 .NET 4.0 Post Slow Startup Fix

I've been running my main machines on Windows XP x64 for several years, and I am a .NET developer.  There came a day when I needed .NET 4.0 for my development projects.  After installing .NET 4.0 in Windows XP x64 SP2, I noticed a slow bootup despite the fact that I have a solid state drive.  Windows would always boot up and freeze for about a minute before the network LAN and Wireless LAN computer icons appeared in the system tray.  At first, I never realized the problem was caused directly from the install of .NET 4.0.  For over a year I tried troubleshooting the problem.  I noticed that I had this problem on all of my XP machines after installing .NET 4.0.  I suspected video drivers, LAN drivers, wireless LAN drivers, and even my BIOS.  Nothing fixed this issue.  After further searching, I finally found a thread describing the same issues I was having.  Save yourself the read, and just run this batch file I wrote after installing .NET 4.0 on ANY Windows XP x64 or x86 machine:

set I=%windir%\
%I:~0,2%
cd %windir%\Microsoft.NET\Framework\v1.1.4322
ngen update
cd \
cd %windir%\Microsoft.NET\Framework\v2.0.50727
ngen update
cd \
cd %windir%\Microsoft.NET\Framework\v4.0.30319\
ngen update
cd \
cd %windir%\Microsoft.NET\Framework64\v2.0.50727\
ngen update
cd \
cd %windir%\Microsoft.NET\Framework64\v4.0.30319\
ngen update
sc stop "clr_optimization_v4.0.30319_32"
sc stop "clr_optimization_v4.0.30319_64"
sc config "clr_optimization_v4.0.30319_32" start= disabled
sc config "clr_optimization_v4.0.30319_64" start= disabled
@echo off
echo.
echo. All operations have been completed successfully.  The .net 4.0 framework services were disabled, as they are no longer needed.  This will not affect .net 4.0 applications, and your startup boot time should be back to instant!
pause

This script is useful on all versions of Windows.  If you have a slow startup, try running this to see if it improves the situation!

Keep Num Lock On at Startup on Windows Computers

Thursday, March 29th, 2012

Windows XP, Vista, and Windows 7 :: Keep Num Lock On at Startup

Despite what Microsoft claims, I've seen some computers not revert back to their last set num lock setting when Windows was last shut down.  Granted, this could be caused by Enterprise configurations.Here's a simple batch file that should keep Num Lock always ON when a user logs in.  It may or may not need to be run with administrator privileges based on your enterprise configuration.  I've had several users complain about the fact that Num Lock is turned off when they turn on their computers in the morning.  As a result, this batch file allows you to enable the setting that keeps num lock enabled after a user logs in with minimal effort.  I'm still under the impression that this is more work than the user simply pressing the num lock key to turn it back on.

REGEDIT4
@ECHO OFF
CLS
REGEDIT.EXE /S "%~f0"
EXIT

[HKEY_CURRENT_USER\Control Panel\Keyboard\]
"InitialKeyboardIndicators"="2"