Patches in an Operating System is simply a file containing a set of instructions or data that updates or addresses a vulnerability or a bug within a software or an application. The Kernel Patch refers to applying patches to the running Linux Operating System Kernel to improve the overall security of the Linux System. The Kernel in an Operating System manages the operations and functions inside a CPU and thus is crucial to be updated regularly.
This article explains the process of applying Kernel Patches in Ubuntu without Rebooting.
Apply Kernel Patches in Ubuntu Without Rebooting
Ubuntu offers the Ubuntu Pro Version where you can use the Advanced Tools and Services to Apply Kernel Patches in Ubuntu Without the need for rebooting your Ubuntu System. To Apply Kernel Patches in Ubuntu, you have to install and then enable the Canonical-livepatch Package. The steps below discuss the way to apply Kernel Patches in Ubuntu without Rebooting your Ubuntu System.
Step 1: Register for the Ubuntu Live Patch Service
To apply Kernel Patches in Ubuntu, you have to register for the Ubuntu Pro version first. With the Ubuntu Pro Version, Kernel Patches can be applied easily without the need for rebooting your Ubuntu System. To Register for Ubuntu Live Patch Service, search for Ubuntu Pro on your favorite web browser URL:
The Ubuntu Pro Official Website will appear. Click on the Ubuntu Pro Link to open the Website:
Instead of searching for the Ubuntu Pro Version, you can directly access the Ubuntu Pro Version Web Page as well. This will open the Ubuntu Pro Version Web Page. On the Web Page, click on the “Get Ubuntu Pro Now” button:
The Web Page will now ask for the Subscription User. As you need to use Ubuntu Pro for free and solely for yourself, click on the “Myself” Option instead of “My Organisation”:
Once you click on the “Myself” option, scroll down now and you will find the “Register” Button. Click on it to start registering for the Ubuntu Pro Version:
The Ubuntu One Web Page will appear. The Ubuntu One is a single account where only one user can log in and utilize all the Services. If you already have a Ubuntu One account Registered, log in to your Ubuntu One Account by typing in your email and account Password. In our case, we do not have any account registered yet, so we will click the “I don’t have an Ubuntu One Account” option:
The Ubuntu One Account Menu will now ask you to create your account. To Create your Ubuntu One Account, enter your email address, full name, Username, and Password:
Once you type in your credentials, Re-type your Account Password to verify the Password, then click on the Radio Button to accept the Policy and Terms of Service, and then click on the “Create Account” button at the end to Create your Fresh Ubuntu One Account:
In our case, we have entered the required credentials and then clicked on the ”Create Account” button:
When your New Account is registered, you will receive an email at the provided email address during account creation:
To verify your email address, open your email and click on the provided verification or confirmation link:
Once you click on the email, it will redirect you to the Ubuntu One Web Page again where a Captcha will appear. Click on the “I’m not a robot” radio button to confirm the Captcha and then click on the “Yes, I’m Sure” button to validate your email with your Ubuntu One Account:
Once validated, you will log in to your account and you will see the “Email Validated” message:
You can now register for the Ubuntu Pro Account Subscription by scrolling down, clicking on the “Myself” option, and then clicking the “Register” button:
The Ubuntu One Account will now Request for Personal Data. Check all the boxes and then click on the “Yes, log me in” Button:
You will now be logged in to your Ubuntu Pro Account where you can see your Account Subscription Details and your Ubuntu Pro Kernel Patch Token:
Step 2: Apply Kernel Patches
Now to Apply the Kernel Patches to your Ubuntu System, you have to install the Ubuntu Canonical Livepatch Package. The Canonical Livepatch ensures that the Patches are added in the Kernel without the need for rebooting the Ubuntu system. Before installing the Canonical Livepatch package, update your Ubuntu system repository using the “apt” command:
The Packages will start updating. Wait for the process to complete:
Now, Install the Snap Bundle with the “apt” command:
In our case, it is already installed on our Ubuntu System:
To use Live Kernel Patches, you have to enable the Livepatch Feature on your Ubuntu System by Attaching your Ubuntu Pro Token. Open your Ubuntu Pro Account and in your Account Page, scroll down and copy the Token:
Once you copy the Token, enable the Livepatch by running the “attach” command in the Ubuntu Terminal along with the Token:
This will enable the Livepatch Feature:
In case, your Attached Token does not work and your Canonical Livepatch is not enabled, you have to install the canonical-livepatch feature first on your Ubuntu System with the “snap” command:
In our case, the livepatch was already added to our Ubuntu System:
Once the Livepatch is enabled, Install the Ubuntu Pro Client now to use the Pro Tools. To install Ubuntu Pro Client, use the “apt” command:
In our case, it is already installed:
Step 3: View Live Patch
After you have installed and enabled the Canonical Livepatch Package on your Ubuntu System, you can view the status of your Livepatch using the command:
The Kernel if covered by the Livepatch, will be displayed in the Terminal:
You can also View All the Pro Ubuntu Services with the “pro status” command:
The enabled Pro Services will be displayed in the Terminal and you can see the livepatch service is enabled:
Bonus Step 1: Disabling a Pro Service
You can also disable a Pro Service through the Terminal. In our case, we disabled the canonical-livepatch service with the “snap” command:
The Service when stopped, will be displayed in the Terminal:
To confirm the stopped service, in our case, livepatch, the “pro status” command can be used again to list the services. You can see the livepatch is disabled in our case:
Bonus Step 2: Uninstalling Canonical Livepatch
If you want to remove the Canonical Livepatch Service, you can do so with the “remove” command:
When the service is removed, the Terminal will inform about its removal:
Conclusion
To apply Kernel Patches in Ubuntu, Register for Ubuntu Live Patch Service by subscribing through the Ubuntu Pro Website, and then install the canonical-livepatch package to patch your Ubuntu Pro Services. Once the Kernel is Patched, you can also use the Advanced tools of Ubuntu Pro to disable or enable any service. This article discusses each step required to apply kernel patches in Ubuntu in detail.