How do i chroot into my system and update my kernel

i won’t take too much of your time, i looked online and didn’t find something quick and dirty i just wanna reinstall my kernel, i was updating it but power went off while it was installing and now it’s broken, i want to reinstall it with chroot i’m already in another manjaro environment i wanna finish this quick because i have some urgent things to finish on my main system

If you have booted up from another Manjaro environment, then open up a terminal window and issue the command… :arrow_down:

sudo manjaro-chroot -a

Pick the Manjaro installation from the menu it’ll show you. Next, issue the following commands… :arrow_down:

[ -f /var/lib/pacman/db.lck ] && rm -f /var/lib/pacman/db.lck
pacman -Syu
mhwd-kernel -i your_kernel_version_here
update-grub
exit

Replace your_kernel_version_here in the command above by whatever the kernel package is called. For instance, for kernel 5.15, the package is called linux515.

Just to expand a bit on this:

How to chroot

  1. Ensure you’ve got a relatively new ISO or at least one with a still supported LTS kernel.

  2. Write/copy/dd the ISO to a USB thumb drive.

  3. When done, boot with the above mentioned USB thumb drive into the live environment.

  4. Once booted, open a terminal and enter the following command to enter the chroot encironment:

manjaro-chroot -a
  1. If you have more than one Linux installation, select the correct one to use from the list provided.

When done, you should now be in the chroot environment.

But, be careful, as you’re now in an actual root environment on your computer, so any changes you make will persist after a restart.

1 Like

For other readers, sure. :slight_smile: But the OP has stated… :arrow_down:

:wink:

1 Like

And on this, to find the available kernel versions to install, in the chroot environment, run:

mhwd-kernel --list

Install the desired one with:

mhwd-kernel --install <kernelVersion>
1 Like

says failed to synchronize all databases (unable to lock database)

So i nano’d into /etc/pacman.conf and set Siglevel to never, tried again and it didn’t work

That means you didn’t issue the first command I gave you. :arrow_down:

[ -f /var/lib/pacman/db.lck ] && rm -f /var/lib/pacman/db.lck

My bad didn’t notice, I’m a bit tired, i did the command but now pacman -Syu doesn’t update and says my system is up to date even though the kernel is broken and doing mhwd-kernel -i linux515 gives me an error saying i can’t reinstall the current kernel, and that i should use pacman -Syu instead

Try installing a later kernel version then, like linux61. You don’t have to stick with that one if you don’t like it, but then maybe you’ll be able to remove and reinstall linux515 once you’ve booted back up into your main system.

Alright I’ll try that, thanks for the help too man

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.