You are not logged in.

#1 2012-10-07 20:13:49

jmak
Member
Registered: 2008-12-21
Posts: 394

I ran into a glitch when trying to restore grub into mbr[SOLVED]

Hello,

I would like to restore grub to mbr.
This is what I have done so far.
I mounted the target partition into /mnt.
I arch-chroot-ed into /mnt
I issued the command: grub-install /dev/sda
I got the message: rm cannot remove /boot/grub/i386-pc/core.img: Operation not permitted

Could anyone help how to proceed?
Thanks.

Last edited by jmak (2012-10-07 22:15:14)

Offline

#2 2012-10-07 20:18:32

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,412

Re: I ran into a glitch when trying to restore grub into mbr[SOLVED]

Offline

#3 2012-10-07 20:36:08

2ManyDogs
Member
Registered: 2012-01-15
Posts: 1,686

Re: I ran into a glitch when trying to restore grub into mbr[SOLVED]

How did you install grub the first time? Did you set the immutable flag on core.img when you installed grub? Did you issue this command:

# chattr +i /boot/grub/i386-pc/core.img

?

Offline

#4 2012-10-07 21:11:29

jmak
Member
Registered: 2008-12-21
Posts: 394

Re: I ran into a glitch when trying to restore grub into mbr[SOLVED]

2ManyDogs wrote:

How did you install grub the first time? Did you set the immutable flag on core.img when you installed grub? Did you issue this command:

# chattr +i /boot/grub/i386-pc/core.img

?

Yes, I did because, the first time I installed grub in its own partition, rather than mbr.

Offline

#5 2012-10-07 21:14:36

2ManyDogs
Member
Registered: 2012-01-15
Posts: 1,686

Re: I ran into a glitch when trying to restore grub into mbr[SOLVED]

You will need to unset that flag. "immutable" means "don't allow this file to be changed or deleted."

# chattr -i /boot/grub/i386-pc/core.img

Offline

#6 2012-10-07 21:16:11

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,412

Re: I ran into a glitch when trying to restore grub into mbr[SOLVED]

From man 1 chattr :

 A  file  with the `i' attribute cannot be modified: it cannot be deleted or renamed, no link can be created to this file and no data can be written to the file. 

Offline

#7 2012-10-07 21:29:33

jmak
Member
Registered: 2008-12-21
Posts: 394

Re: I ran into a glitch when trying to restore grub into mbr[SOLVED]

2ManyDogs wrote:

You will need to unset that flag. "immutable" means "don't allow this file to be changed or deleted."

# chattr -i /boot/grub/i386-pc/core.img

How should I do that? Or you think it is better not to mess with grub and leave as it is now?

Offline

#8 2012-10-07 21:30:43

2ManyDogs
Member
Registered: 2012-01-15
Posts: 1,686

Re: I ran into a glitch when trying to restore grub into mbr[SOLVED]

Use the command in my post (the one you quoted). You set it with +i, so unset it with -i.

Last edited by 2ManyDogs (2012-10-07 21:31:02)

Offline

#9 2012-10-07 21:43:59

jmak
Member
Registered: 2008-12-21
Posts: 394

Re: I ran into a glitch when trying to restore grub into mbr[SOLVED]

2ManyDogs wrote:

Use the command in my post (the one you quoted). You set it with +i, so unset it with -i.

One more question before I go ahead and do that. After instlling grub:

# grub-install --target=i386-pc --recheck --debug /dev/sda

Do I still have to do:
# mkdir -p /boot/grub/locale
# cp /usr/share/locale/en\@quot/LC_MESSAGES/grub.mo /boot/grub/locale/en.mo

I already have done these when intalled arch at first time.

I already have the "locale" directory on my system.

Im asking these questions just to make sure I won't mess up my system.

Offline

#10 2012-10-07 21:48:57

2ManyDogs
Member
Registered: 2012-01-15
Posts: 1,686

Re: I ran into a glitch when trying to restore grub into mbr[SOLVED]

I'm not absolutely sure. I suspect you do not have to do those steps again if the directory exists and you ran the cp command.

Just so we're clear, I never promised that anything I recommended would not "mess up your system." smile But if it does, I'm sure WonderWoofy will be happy to help you fix it wink (And breaking things and fixing them is a learning opportunity)

Last edited by 2ManyDogs (2012-10-07 21:51:01)

Offline

#11 2012-10-07 22:09:34

jmak
Member
Registered: 2008-12-21
Posts: 394

Re: I ran into a glitch when trying to restore grub into mbr[SOLVED]

2ManyDogs wrote:

I'm not absolutely sure. I suspect you do not have to do those steps again if the directory exists and you ran the cp command.

Just so we're clear, I never promised that anything I recommended would not "mess up your system." smile But if it does, I'm sure WonderWoofy will be happy to help you fix it wink (And breaking things and fixing them is a learning opportunity)

Thanks for everybody the help.

Grub now, successfully installed in mbr.

One more question before I mark the thread solved.

Should I issue the: # chattr +i ... command to make the directory "immutable" again, or just leave as it is?

Offline

#12 2012-10-07 22:13:25

2ManyDogs
Member
Registered: 2012-01-15
Posts: 1,686

Re: I ran into a glitch when trying to restore grub into mbr[SOLVED]

You can leave it unset. That command is not part of the instructions for installing grub to the mbr.

By the way, if you're wondering how I knew the answer to this question, I just did an Ixquick search on the exact error message you got, and I found a topic on another board that discussed how to fix it. smile

Offline

Board footer

Powered by FluxBB