Welcome back to the fourth article of my "Leveraging Linux for Development" series! I apologize for the wait, I've been very busy with issues with my laptop.
No matter, what I'm here to explain today is all for the Windows users who want to try out Linux (Ubuntu is our demonstration). I'll also talk about WSL, and if it's even worth it to dual boot Ubuntu with Windows if WSL exists. Let's get started!
WSL should do the job, right?
Short answer: Not really.
Some Windows developers daily drive Windows and develop on WSL, and they seem to decide that it's "enough" for them, and that there's no need to replace Windows with Ubuntu or even just dual boot Ubuntu alongside Windows!
While that does have some truth to it, I personally don't think WSL comes even close to actual standalone Linux.
Performance
I used to develop React apps on Windows with WSL. So I would have WSL open as a terminal, VSCode connected to the WSL session, and Brave Browser running the React app!
I can not describe how slow my PC would become. And because Windows tends to freeze completely instead of freezing a singular Window/app, my PC was almost unusable.
While I do have old hardware that does contribute to the performance degradation, running standalone Ubuntu on the same hardware in the same situation (terminal running React, VSCode open in the project, and Brave Browser showing the app) was, with no exaggeration, a million times better!
From my whole PC freezing and having to wait more than 10 seconds for VSCode intellisense to work, to everything running smoothly with VSCode intellisense working the same as if I'm writing a static HTML file: That difference was astronomical!
And the same could be said for all tasks I did on WSL Vs Standalone Ubuntu, WSL will just never reach the speed or efficiency of the standalone distro.
Terminal-only interface
Ubuntu WSL, while supporting some GNOME Apps, predominantly only provides access to the Ubuntu terminal. So you can use bash and apt, but if you run gnome-text-editor
you'll get a barely good-looking window that's terribly slow.
Standalone Ubuntu comes with GNOME by default, and even if you can change the desktop environment to something like KDE, having a full UI environment is much better for users coming from Windows than a bare terminal that is very inefficient for accessing files (even if you use Windows apps, you have to go to Linux > Ubuntu > /home/username to access your files. And to upload files from WSL you have to type \\wsl.localhost\Ubuntu
manually)!
I personally prefer my full Ubuntu Desktop experience than the boring, bland-looking black terminal of WSL. I also much prefer the beautiful GNOME terminal over WSL or CMD! And besides the looks, the GNOME terminal is still easier to use, and resizing the window does not break the terminal like on Windows.
So while WSL can get your job done with some light tasks (e.g. running a discord.js bot), it will get slower and slower the more you do on it (and the more packages you install) and it's inefficient to use with the Windows side (e.g. VSCode + WSL) of your system.
How to dual boot Ubuntu with Windows?
It would seem simple at first, but depending on the state of your Windows machine, things could go terribly wrong!
Check your disk type
If you have lots of partitions on your Windows disk, or have two hard drives and played around with the second, then your disk type might be Dynamic. And we definitely don't want that.
Dynamic disks allow for large amounts of partitions on one disk, but they are only a Windows thing. Other operating systems will not be able to read partitions on a dynamic disk and will treat the whole disk as one chunk of unallocated space. You can easily imagine how this could go wrong since partitioning the disk during Ubuntu installation could cause terrible data loss in the other partitions due to Ubuntu not acknowledging them!
To check your disk type, press Win + X > Disk Management and look at your disk(s). Any disk than has yellow-ish partitions instead of blue are dynamic disks and will say "Dynamic Disk" under their name (you can also right click the disk name, if it shows a "Convert to basic disk" option then it's dynamic, and vice versa).
If all your disks are basic, skip the next section. If the one you're planning to install Ubuntu on is dynamic, continue reading...
Convert dynamic disks to basic disks
Do NOT click "Convert to basic disk" immediately in the context menu of the disk, this will wipe all the data on the disk! We need to do a few things first:
Clean your dynamic disk(s)
First of all, clean your disks of any trash you don't need, movies you already watched, projects that are commited to GitHub, .exe installer files, and everything that doesn't need to take space on your disk. Preferably get the occupied disk space to be less than half the total disk space.
Compress your entire disks
Next, you need to protect the data that's left. Download 7-Zip on any partition of a disk that's not the dynamic one. Then go to the first partition of the dynamic disk, and select everything in it (make sure you select everything including hidden folders) then right-click your selection.
Click 7-Zip and add to archive, use this configuration for the compression:
- Archive format: 7z
- Compression level: 9 - Ultra
- Compression method: * LZMA2
- Dictionary size: 512MB (if 512MB shows an error when starting the compression, decrease the size. If it doesn't show an error, keep increasing the size until you reach the maximum size that does not show an error)
- Word size: 273
- Solid Block size: Solid
- Number of CPU threads: * 2 / 4
- Memory usage for Compressing: 5415 MB/6315 MB/7894 MB * 80%
- Memory usage for Decompressing: 514MB
The last two fields could change based on your dictionary size. This 7-Zip configuration will take the longest time, but it will result in the most compact .7z archive!
After the first partition is done archiving (could take multiple hours), go on to do the second partition and continue until you finish each partition in the dynamic disk (if it's only one, then go ahead to the next section).
Store the archive(s) safely
The archive of each partition will be output in the same partition (that's why I told you to clean the partitions until the occupied space is less than half the size of the entire partition. This is to ensure that the archive has enough space to be saved).
You need to move the archives somewhere other than the dynamic disk, this could be an external hard drive or USB, or it could just be another disk on your computer.
Always prefer copying (yes, copying not cutting. If cutting fails then you could lose data from the archive. Only delete the archive after it's done copying) the archives to a hardware device you have before the cloud. Uploading it to the cloud can take tremendous time and bandwidth (and probably money) based on the archive size, but you can still use the cloud if you so like!
Delete all partitions on the dynamic disk(s)
After you're done moving the archives and have made sure that they're safe, right click each partition on the dynamic disk(s) and select "Delete partition". It will show you a warning, click yes.
The dynamic disk(s) should now show only one huge, black chunk that says "Unallocated Space". Right click on the disk itself, then choose convert to basic disk. If there's also an option to "Covert to GPT Disk", select it!
And that's it, your disk is now basic. If you want to recreate the previous partitions that were archived, you can do so, but make sure you leave some Unallocated Space for Ubuntu to use.
Install Ubuntu 24.04.1 LTS
Ubuntu 24.04.1 LTS just came out yesterday, you can get the ISO file from the Ubuntu Desktop download page (or download the file directly).
You can follow the Ubuntu installation tutorial to create the bootable USB and run the installer.
Make sure you run the installer without and internet connection to avoid weird issues
If the installer still has annoying issues, download the Ubuntu 22.04.4 LTS instead, create the bootable media, and follow the rest of the Ubuntu installation tutorial to install Ubuntu.
One thing to note, though, is when you get to the "How do you want to install Ubuntu?" page. Carefully select the option you need:
If you only have one disk with Windows on it, and you want to dual boot Ubuntu
- You have to first disable Windows BitLocker before installing Ubuntu.
- Select "Install alongside Windows Boot Manager", click next and use the slider to specify the space you need for Ubuntu
If you have two or more disks, and you want to install Ubuntu on a disk besides the Windows disk
- Select "Something else..." (Or "Manual Installation") and look for the disk you want to install Ubuntu on (it will be sdX, where X is the count of the disk alphabetically. The first disk will be sda, second will be sdb, and so on)
- Remove all partitions on the wanted disk (partitions on the wanted disk will be numbered sdX1, sdX2, and so on...) by selecting each of them and clicking the minus sign
- Create one big partition in the resulting "Free Space" by clicking the plus sign, then choose "/" as the mount point, and choose the file system as "EXT4 Journaling Filesystem"
- Look for a partition with type "efi" (should be on sda, the Windows disk), then look for that same partition in the "Device for bootloader" dropdown and select it
- Continue the installation
If you have two or more disks, and want to install Ubuntu on a single partition of one of those disks
- Do the same steps as the previous section, but choose one partition of the device to delete and recreate as EXT4 (or immediately create a new partition with the same info if there's free space left in that disk)
If you want to replace Windows with Ubuntu
- Select "Erase disk and install Ubuntu" and choose the Windows disk, then continue with the installation
Configure Secure Boot (Optional)
If you have Secure Boot enabled in your BIOS/UEFI settings then Ubuntu could show you a "configure Secure Boot" checkbox:
On Ubuntu 22.04, you'll find this checkbox in the minimal/extended installation screen under the "Install third-party drivers" checkbox. Type a one-time password (do something easy like "aaaaaaaa", this password is only used once anyways) and continue with the installation
On Ubuntu 24.04, there will be no checkbox, it will automatically configure Secure Boot
After you specify a one-time password for Ubuntu 22.04, finish the installation and reboot... Your device should show a "Perform MOK management" screen or something similar, you'll have a couple of options which you can pick using the arrow keys and the enter key.
- Select "Enroll MOK"
- Select "View key 0" and you'll see the key is related to Ubuntu, go back by pressing an arrow key (optional)
- Select "Continue"
- It will ask you for a password, type "aaaaaaaa" (your typing will not show up, so make sure you type it correctly) that we used during installation and hit enger
- Select "Yes"
- Select "Reboot" Dell has a useful Support Page that also works for my Samsung PC
Reboot into Ubuntu and enjoy
After rebooting, you'll either boot directly into Ubuntu or will see the GRUB menu to pick between Windows and Ubuntu. Depending on whether or not you kept Windows...
You can also check out my "Maximize Your Experience on Ubuntu Desktop" article to learn about some cool optimisations for your system! If the GRUB menu does not show up and boots into Ubuntu directly even though you kept Windows, then you can also read that article since it contains a solution.
The next article will be about familiarizing yourself with Linux and customizing it to fit your muscle memory as a Windows user so that you don't have to relearn all the various actions.
And, as always, Happy Hacking!