6

After apt-get update; apt-get upgrade successfully on my Kali Linux VM, restarted to finish some installations and was taken to grub rescue mode.

On grub rescue >

ls, returns:

(hd0) (hd0,msdos1) (hd0,msdos5)

set, returns:

cmdpath=(hd0)
prefix=(hd0,msdos1)/boot/grub
root=hd0,msdos1

I ran ls on (hd0)/boot, (hd0,msdos1)/boot, (hd0,msdos5)/boot, and confirmed results of bootable images only on (hd0,msdos1)

insmod linux, returns following grub error:

symbol 'grub_file_filters' not found 

Wanted to see where grub is looking so tried insmod kali which returned:

/boot/grub/i386-pc/kali.mod not found

Hence it seems that the linux module is found before I get the error.

From research, found that this error is filesystem/USB device related but since this is a Virtual image (and I'm on VirtualBox) I am unsure of how to fix it.

No problem in installing again from scratch but curious about this error and what it is referring to / how it can be resolved.

Thanks for any insights

Additional Note: This is the output on my screen from the moment I boot the VM and after I execute some of the ls commands mentioned above

error: symbol ‘grub_file_filters’ not found. 
Entering rescue mode... 
grub rescue> ls 
(hd0) (hd0,msdos5) (hd0,msdos1) 
grub rescue> ls (hd0) 
(hd0): Filesystem is unknown. 
grub rescue> ls (hd0,msdos5) 
(hd0,msdos5): Filesystem is unknown. 
grub rescue> ls (hd0,msdos1) 
(hd0,msdos1): Filesystem is ext2. 
grub rescue> ls (hd0)/boot
error: unknown filesystem
grub rescue> ls (hd0,msdos5)/boot
error: unknown filesystem
grub rescue> ls (hd0,msdos1)/boot
./ . ./ System.map-4.18.0-kali2-amd64 config-4.18.0-kali2-amd64 
initrd.img—4.18.0-kali2-amd64 vmlinuz-4.18.0-kali2-amd64 
grub/ config-4.19.0-kali5-amd64 vmlinuz-4.19.0-kali5-amd64 
System.map-4.19.0-kali5-amd64 initrd.img-4.19.0-kali5-amd64
grub rescue> 
6
  • 1
    Could you explain what "ls on (hd0)/boot, (hd0,msdos1)/boot, (hd0,msdos5)/boot" looks like? I've tried ls (hd0)/boot, ls hd0/boot and ls hd0 and none of these work. This is very different environment than what people may be used to using a shell in userspace.
    – huertanix
    Jul 29, 2019 at 3:39
  • 1
    Hi @huertanix, this is not an actual shell. It is the shell for grub rescue mode. The initial ls -without any arguments- showed me the different directories/partitions. Using ls again, with those directories as arguments and /boot, listed their content. In my case, results were only returned for (hd0,msdos1)/boot. 'Set' showed the current setting which I can change. I tried changing it to a different configuration but still no luck. Seems that the current setting (seen above after 'set') is the correct one as I only found contents in (hd0,msdos1/boot). Grub rescue has limited commands
    – AlexiaK
    Jul 31, 2019 at 16:05
  • 1
    @huertanix I have added an additional note in my original question containing the specific output of the ls commands in grub rescue mode
    – AlexiaK
    Jul 31, 2019 at 16:26
  • 2
    The following youtube link provides detailed instructions on reinstalling grub bootloader. It resolved the "Symbol 'grub_file_filters' not found" error I was experiencing.
    – ddburrjr
    Aug 3, 2019 at 23:59
  • Hi @ddburrjr , this worked for me! If you would like to gain rep points, please post the link as an answer and write the step by step instructions so I will upvote your answer as the solution :)
    – AlexiaK
    Aug 10, 2019 at 15:58

3 Answers 3

3

What worked for me on OSX is combining Daniel Simon's answer and ddburrjr's comment.

  1. Download a fresh .iso image from the official web page of Kali Linux.
  2. Start VirtualBox and open the settings for the Kali Linux virtual machine. Add the downloaded iso image in the 'storage page' as a virtual cd. How? Select 'Controller: IDE' and press CD button on the right, 'choose disk' and then select the downloaded .iso file.
  3. Press F12 during boot and press 'C' to to boot from CD_ROM
  4. Select 'Live (amd64)' in the Boot menu to run Kali Linux from .iso file.
  5. Follow these instructions https://www.youtube.com/watch?v=5spKO02G5v4
  6. Done! Kali Linux boots up again from virtual harddrive
0

I've had a similar problem when I tried to boot a manually created grub image (with the grub-mkimage command) after my GRUB installation was updated on ArchLinux. In my case reinstalling GRUB to the /boot partition solved the problem.

Because your entire OS does not boot I would recommend you boot a live image of Kali and reinstall the bootloader from there, after making a backup of the current bootloader installation (e.g. to ensure that you keep your original configuration file).

A possible reason why the problem occurred could be that the modules GRUB tried to load belong to the previous version of GRUB while the image doesn't.

Instructions:
1. Download a fresh image from the official web page of Kali Linux.
2. Start VirtualBox and open the settings for the Kali Linux virtual machine.
2.1 Add the downloaded iso image in the 'storage page' as a virtual cd.
2.2 Change the boot order in the 'system' tab so that the VM boots from optical first.
3. Boot your virtual machine and start the image in live mode. 4. Mount the boot partition to a folder (e.g. /mnt) and copy the grub folder to another destination. If there's no boot partition, the files should reside in your main partition inside the boot folder. In this case mount the main partition and skip steps 5 and 6.
5. Unmount the boot partition again and mount your main partition (with the /home, /etc, /boot, ... folders) to that point.
6. Mount the boot partition again to the /boot folder under your mount point of the main partition. The structure should look like this:

/mnt/ (mount folder of main partition)
  etc/
  home/
  boot/ (mount folder of boot partition)
    grub/
    (other boot files)
  (other folders)
  1. Change the root to the mounted OS files with the chroot command.
  2. Reinstall grub with grub-install /dev/sdX command where X is the descriptor of your device where Kali Linux is installed. You haven't to supply the --boot-directory parameter because you changed your root to the installed OS. If you should supply another parameter take a look at the manpage of the grub-install command.
  3. Execute the grub-mkconfig -o /boot/grub/grub.cfg to create a new config file for grub. This command should detect the Kali Linux installation.
  4. Leave the changed root with exit and unmount all partitions.
  5. Shut the virtual machine down.
  6. Change the boot order back to the previous setup or disable the boot from optical disks.
  7. Boot your virtual machine. If everything has worked as expected, Kali Linux and GRUB should boot as always.

If a command is not installed or not found, try executing with sudo first and if it's still not there try installing it with apt-get install [name].

Important note:
Currently I'm using ArchLinux (as I said above) and so it's difficult to provide a detailed manual about how to reinstall grub with another distribution on an unknown setup.
I would recommend you to inform yourself a little bit about the used commands before you execute them to ensure that these play nicely together with your setup.
In addition to that because you're using a virtual machine I would recommend you creating a snapshot before following these instructions.

5
  • Can you please provide information / instructions on how to do this? Thanks.
    – bruntime
    Jul 25, 2019 at 16:58
  • Thanks Daniel. I'm immediately taken to the grub rescue prompt (and above error). Only "step" I can take before that (when I Start Kali from VirtualBox) is press F12 to view the boot device selection... no choice to boot the live image of Kali and reinstall the bootloader. Let me know if there is a way to follow your recommendation.
    – AlexiaK
    Jul 25, 2019 at 19:38
  • Try downloading a fresh image from the official web page of Kali Linux, then start VirtualBox and open the settings for your VirtualMachine. There add the downloaded iso image in the storage page as a virtual cd and then change the boot order in the system tab so that the VM boots from optical first. Then the ISO should start instead of the installed version. There should be an option for just booting the CD in live mode. After the live OS has started, mount the boot partition of your virtual disk and reinstall grub with the grub-install command.
    – Daniel
    Jul 25, 2019 at 21:47
  • I did fdisk -l and got the disk name /dev/sda and some devices (/dev/sda1, /dev/sda2, /dev/sda5). Then I did a mkdir /media/test-mount and a mount /dev/sda /media/test-mount, but I got a wrong fs type, bad option, bad superblock on /dev/sda, missing codepage or helper program, or other error.. I the boot partition is the one listed on the devices 'table', when I try to do mount /dev/sda1 /media/test-mount it works. But then, when I do a grub-install, it says command not found.Any ideas why?Also, should I do a grub-install /media/test-mount or a grub-install /dev/sda1? Jul 31, 2019 at 14:29
  • Thanks Daniel. I had issues after step 7. Can you clarify the use of the chroot command? First, I could not find the boot partition using ldisk, then did fdisk -l and found /dev/sda1 having the * sign under the Boot column. So I proceeded with step 4, skipped 5,6 then did 7. Not sure how to use chroot in my case. Just chroot /mnt ? (as I mounted /dev/sda1 to /mnt). In that case, on step 8 I get the error: cannot find a device for /boot/grub (is /dev mounted?). I tried to do the grub-install on sda1 because I skipped steps 5,6, is that right? Thanks again
    – AlexiaK
    Aug 10, 2019 at 15:47
0

Sorry i can't comment, so, in my case, the Daniel Simon answer works! but with some extra mounting.. my distro was Ububtu Server, and after upgrade from 18.04 to 20.04 it give me the same error.

my VPS has recover mode (it is like startup from other drive (or usb in other cases)) then i follow the steps, (not step 5 and 6) because my boot partition was inside main partition. And before step 7 (chroot) i was to mount /dev, /sys, and /proc as follow: (first mount main partition)

# mount /dev/vdb1 /mnt     (in my case the main partition to mnt dir)
# mount --bind /dev /mnt/dev
# mount --bind /proc /mnt/proc
# mount --bind /sys /mnt/sys

after that, continue with step 7.. chroot

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .