1
  • OS: Debian 8
  • logged with rescue image
  • HDD LVM

Set a password for grub, and it seems did missed some hash digit when copied encrypted password in 40_custom, I managed to removed login/password details from grub /etc/grub.d/40_custom using rescue disk. but now update-grub needs to be run, sins grub is not loading, and neater the kernel, obviously setting a cron job to run it is useless,... Does anyone knows if there is a solution to add a command to grub, to run update-grub at load time in GRUB_CMDLINE_DEFAULT="command_to_run_update-grub" ?
Or may be there is a way to do manually whatever update-grub does?

1

No need to reinstall GRUB. Since you managed to access /etc/grub.d/40_custom, use the same method to access /boot/grub/grub.cfg, find the exact same login/password details in that file, and comment them out (or just delete them). They will be between lines like:

### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.
< ... here is a copy of GRUB password settings you removed from /etc/grub.d/40_custom...>
### END /etc/grub.d/40_custom ###

The files in /etc/grub.d/ are scripts which will participate in creating the actual GRUB configuration file. In particular, the /etc/grub.d/40_custom has two lines in the beginning, which will cause the rest of the file to be copied verbatim into the actual GRUB configuration file.

0

Since you have access to the root filesystem using some external applications, why don't you just reinstall grub? That way you can boot to your system once again.

Here's a tutorial on how to reinstall grub on a Debian distro. Based off of this tutorial, you could also try running the update on the rescue mode without reinstalling.

Also, if you want to keep your grub configs, you can copy them to some external storage to not lose them after the installation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.