Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I did a sudo apt-get remove ruby* and then I saw that some grub packages were being removed too so I went to installed back those packages which log showed to have removed

I set grub to work on my /sda (in general, not any number) when was installing back.

Should all be ok or should I fear for my system and plan installing/reconfiguring more of grub.

And, why did this happpen?

share|improve this question
Apt-get works with regular expressions, which means that ruby* selects all packages that contain rub in their name. The correct way to remove all packages starting with ruby is: apt-get remove ^ruby. –  Andrea Corbellini Mar 9 at 17:08

2 Answers 2

up vote 3 down vote accepted

Try this command on terminal,

sudo grub-install /dev/sda

It will reinstall grub2 on your disk.

If you want to configure your grub then install grub-pc package.Try the below command to install grub-pc package,

sudo apt-get install grub-pc

Note: Install this package only if you installed Ubuntu in Legacy mode.

share|improve this answer
Even if I already did some other grub packages install (same which were removed)? –  diegoaguilar Mar 9 at 5:24
Are you installed Ubuntu in legacy mode?post the output of [ -d /sys/firmware/efi ] && echo "EFI boot on HDD" || echo "Legacy boot on HDD" command. –  Avinash Raj Mar 9 at 5:25
Legacy boot on HDD –  diegoaguilar Mar 9 at 5:27
Install grub-pc package to configure your grub.Run this command to install grub-pc package, sudo apt-get install grub-pc –  Avinash Raj Mar 9 at 5:28
I will do and trust, and by the way: Why would sudo apt-get remove ruby* end up removing grub packages? (I suggest you to post right on the answer) –  diegoaguilar Mar 9 at 5:31

If you don't know exactly what you are doing, you should not use:

sudo apt-get remove package*

as this can delete unintended packages and cause more problems than it solves. The package* will match all packages that start with package and their dependencies. If you really want to do this, first run it with -s (--simulate) option to see exactly what it will do (see man apt-get for more info).

Now, I think that you can solve your problem by running the following commands:

sudo apt-get install ruby*   #install again what you removed
sudo apt-get remove ruby     #remove only ruby
share|improve this answer
So it's all about dependencies... –  diegoaguilar Mar 9 at 6:26
+1 for the widely unknown -s option. –  i08in Mar 9 at 12:16
package* will also behave in surprising ways if run from a directory containing any files starting with package. Better to quote it: 'package*' –  Charles Duffy Mar 9 at 14:44
@AvinashRaj You shouldn't, it was ok. I just made an obs about the fact that the OP used remove, not purge... –  Radu Rădeanu Mar 9 at 15:12

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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