Dkms build kernel failed

Hello

when I boot to manjaro recive this output

[Failed] Failed to start Load AppArmor profiles.
[Failed] Failed to start Load AppArmor managed internally by snapd
[Failed] Failed to start Clean up module from old kernel
[Failed] Failed to start TLP system startup/shutdown

next boot manjaro live boot from usb and enter below command

sudo mount /dev/sda4 /mnt
sudo mount /dev/sda3 /mnt/home
sudo mount /dev/sda2 /mnt/boot
manjaro-chroot /mnt/

and get this output

chroot: failed to run command '/bin/sh': No such file or directory

how can I fix?

Chroot is complaining because it can’t find /bin/sh inside the chroot environment, so it can’t drop you on a shell there. Mount your device, then check inside:

manjaro-chroot -a

Edit - should be manjaro-chroot /mnt /bin/bash

Hi,
You shloud be able to tell chroot to use bash :

chroot /mnt/ /bin/bash

and then do this symlink:

ln -s /bin/bash /bin/sh
## or
ln -s /bin/dash /bin/sh   ### this is what I personally do
sudo umount /mnt/boot
sudo umount /mnt/home/
umount /mnt/
manjaro-chroot -a

output

[manjaro@manjaro ~]$ manjaro-chroot -a
grub-probe: error: cannot find a GRUB drive for /dev/sdb1.  Check your device.map.
grub-probe: error: cannot find a GRUB drive for /dev/sdb1.  Check your device.map.
==> Mounting (ManjaroLinux) [/dev/sda4]
 --> mount: [/mnt]
mount: /mnt: /dev/sda4 already mounted on /mnt.
 --> mount: [/mnt/boot]
mount: /mnt/boot: /dev/sda2 already mounted on /mnt/boot.
 --> mount: [/mnt/home]
mount: /mnt/home: /dev/sda3 already mounted on /mnt/home.
[manjaro /]# grub-mkconfig -o /boot/grub/grub.cfg
Generating grub configuration file ...
Found theme: /usr/share/grub/themes/manjaro/theme.txt
Found linux image: /boot/vmlinuz-5.10-x86_64
Found initrd image: /boot/amd-ucode.img /boot/initramfs-5.10-x86_64.img
Found initrd fallback image: /boot/initramfs-5.10-x86_64-fallback.img
Warning: os-prober will be executed to detect other bootable partitions.
Its output will be used to detect bootable binaries on them and create new boot entries.
grub-probe: error: cannot find a GRUB drive for /dev/sdb1.  Check your device.map.
grub-probe: error: cannot find a GRUB drive for /dev/sdb1.  Check your device.map.
/usr/bin/env: 'bash': No such file or directory
[manjaro@manjaro ~]$ sudo chroot /mnt/ /bin/bash
[manjaro /]# grub-mkconfig -o /boot/grub/grub.cfg
/usr/bin/grub-probe: error: cannot find a device for / (is /dev mounted?).
[manjaro /]# ln -s /bin/bash /bin/sh
## or
ln -s /bin/dash /bin/sh   ### this is what I personally do
ln: failed to create symbolic link '/bin/sh': File exists
ln: failed to create symbolic link '/bin/sh': File exists
[manjaro /]# rm /bin/sh
[manjaro /]# ln -s /bin/bash /bin/sh
## or
ln -s /bin/dash /bin/sh   ### this is what I personally do
ln: failed to create symbolic link '/bin/sh': File exists
[manjaro /]# grub-mkconfig -o /boot/grub/grub.cfg
/usr/bin/grub-probe: error: cannot find a devi

now when I boot to manjaro, see grub terminal!

for the symlink: use the f option (force) => ln -sf /bin/bash /bin/sh
for grub : it’s another issue and I don’t know how to fix this

[manjaro /]# grub-mkconfig -o /boot/grub/grub.cfg
Generating grub configuration file ...
Found theme: /usr/share/grub/themes/manjaro/theme.txt
Found linux image: /boot/vmlinuz-5.10-x86_64
Found initrd image: /boot/amd-ucode.img /boot/initramfs-5.10-x86_64.img
Found initrd fallback image: /boot/initramfs-5.10-x86_64-fallback.img
Warning: os-prober will be executed to detect other bootable partitions.
Its output will be used to detect bootable binaries on them and create new boot entries.
grub-probe: error: cannot find a GRUB drive for /dev/sdb1.  Check your device.map.
grub-probe: error: cannot find a GRUB drive for /dev/sdb1.  Check your device.map.

/usr/bin/env: 'bash': No such file or directory #### <---- ?

are you dual booting with windozs?

Try to restore grub:

sudo grub-install /dev/sda --recheck
sudo update-grub

and reboot.

If this is not helping probably your boot partition /dev/sda1 is corrupted and you need to restore it via Windoze tools.

no just installed manjaro

show again this…

/usr/bin/env: 'bash': No such file or directory

my main issue is /usr/bin/env: 'bash': No such file or directory
if fix them can fix grub

please help me to fix bash issue :pray:

What happens when you try bash grub-mkconfig -o /boot/grub/grub.cfg. What is the output of echo $PATH

[manjaro /]#  bash grub-mkconfig -o /boot/grub/grub.cfg
bash: bash: command not found
[manjaro /]# echo $PATH
/home/manjaro/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/var/lib/snapd/snap/bin

seems like bash is not even installed

Fixed :sunglasses:

My guess is that the last time I installed the package dkms could not build the kernel properly

So I reinstalled Linux with sudo pacman -S linux
As a result, dkms rebuilt the kernel and the problem was fixed


Read about DKMS

1 Like

Thank you all for your help
Good luck

@ishaan2479 @oguere @anon12891489

1 Like

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