LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices


Reply
  Search this Thread
Old 09-26-2013, 09:44 AM   #1
ubume2
Member
 
Registered: Oct 2006
Distribution: Ubuntu
Posts: 65

Rep: Reputation: 15
Using arch.iso to restore ubuntu grub2


I have had to use live usbs to occassionally restore grub2.

I use the chroot method using ubuntu.

Is it possible to use the arch iso to restore Ubuntu's grub2?
I use a 64 bit arch iso and have 64 bit ubuntu installed. I also have arch installed on the computer, but I prefer to use ubuntu's grub. To use an ubuntu live usb to boot takes a long time. Arch iso is so much quicker.

When I get to #chroot /mnt I get an error message
When I try #arch-chroot /mnt I get an error message
I have mounted /dev /dev/pts /proc and /sys.

Last edited by ubume2; 09-26-2013 at 10:01 AM.
 
Old 09-26-2013, 10:01 AM   #2
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,499

Rep: Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489
Quote:
When I get to #chroot /mnt I get an error message
When I try #arch-chroot /mnt I get an error message
You forgot to post the actual error message(s) you got.
 
Old 09-26-2013, 10:28 AM   #3
ubume2
Member
 
Registered: Oct 2006
Distribution: Ubuntu
Posts: 65

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by yancek View Post
You forgot to post the actual error message(s) you got.
Sorry.
#chroot /mnt
error
chroot:failed to run command /bin/zsh:no such file or directory

#arch-chroot /mnt
error
mount proc is already mounted or mnt/proc busy
proc is already on /proc
proc is already on /mnt/proc
 
Old 09-26-2013, 11:18 AM   #4
Lennie
Member
 
Registered: Aug 2012
Location: Sweden
Distribution: LFS, built with pacman
Posts: 374

Rep: Reputation: 85
Ubuntu doesn't have zsh, it has dash as default shell. So you need to tell chroot what shell to use.
Code:
chroot /mnt /bin/dash
 
Old 09-26-2013, 12:07 PM   #5
ubume2
Member
 
Registered: Oct 2006
Distribution: Ubuntu
Posts: 65

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by Lennie View Post
Ubuntu doesn't have zsh, it has dash as default shell. So you need to tell chroot what shell to use.
Code:
chroot /mnt /bin/dash
I did that and got:

#grub-install /dev/sda ## command not found or,
#grub-mkconfig -o /boot/grub/grub.cfg ## command not found

Last edited by ubume2; 09-26-2013 at 12:21 PM.
 
Old 09-26-2013, 05:46 PM   #6
widget
Senior Member
 
Registered: Oct 2008
Location: S.E. Montana
Distribution: Debian Testing, Stable, Sid and Manjaro, Mageia 3, LMDE
Posts: 2,628

Rep: Reputation: 497Reputation: 497Reputation: 497Reputation: 497Reputation: 497
Quote:
Originally Posted by ubume2 View Post
I did that and got:

#grub-install /dev/sda ## command not found or,
#grub-mkconfig -o /boot/grub/grub.cfg ## command not found
This is probably because you are using bash.

Also because you are not actually specifying a mount point.
Code:
mkdir /mnt/ManjaroNet
mount /dev/sdc5 /mnt/ManjaroNet/
mount -o bind /proc /mnt/ManjaroNet/proc
mount -o bind /dev /mnt/ManjaroNet/dev
mount -o bind /dev/pts /mnt/ManjaroNet/dev/pts
mount -o bind /sys /mnt/ManjaroNet/sys
cp /etc/resolv.conf /mnt/ManjaroNet/etc/resolv.conf
chroot /mnt/ManjaroNet /bin/bash
This is the list of commands I use to chroot to Manjaro from Debian. Manjaro is Arch based. It could be, I am embarrassed to say I haven't checked, that Manjaro and Arch actually do use dash.

But, as you can see I create a mount point.
Then mount the / partition at that mount point.
To activate the chroot environment you must invoke the application "chroot" at the mount point "/mnt/ManjaroNet" using /bin/bash as my shell.

You should not need more than that for a simple grub fix.

2 exceptions.
I never use a /boot. Could be you need to mount it instead of /.

You may be using dash as shell. In which case you would need to invoke "/bin/dash" instead of "/bin/bash".

Chroot is short for CHangeROOT. You are issuing commands from a / system other than the one you are operating from. You have to tell the shell where that root is and that is your "mount point" within your current system.

I have 2 internal drives (5 installs) and 4 externals that are connected sometimes for varying periods of time (20 more installs). Chroot is the only way to run the package upgrades and other maintenance chores. I visit them occasionally to make sure they actually work on their own but not that often.

The Manjaro installs are getting quite a bit of actual boot time because I am curious about them. Looks like I may need an Arch install one of these days. Pretty interesting package management system. Don't know what installer Arch uses but if it is the same as Manjaro the text installer is very very nice. Graphic installer not so much.
 
Old 09-27-2013, 11:13 AM   #7
ubume2
Member
 
Registered: Oct 2006
Distribution: Ubuntu
Posts: 65

Original Poster
Rep: Reputation: 15
I am not able to use the arch iso to recover grub on ubuntu/debian.

After a time consuming effort, I tried all command combinations, and found nothing that works.

I was able to change the permission by chmod on /etc/grub.d/30_os-prober in ubuntu using the iso without going into chroot, but grub-install /dev/sda or grub-mkconfig -o /boot/grub/grub.cfg had no effect. There is no equivalent of update-grub in arch.

I found CrunchBang on a usb stick is a fast recovery tool for debian/ubuntu installs.

Last edited by ubume2; 09-27-2013 at 11:15 AM.
 
Old 09-27-2013, 02:00 PM   #8
Lennie
Member
 
Registered: Aug 2012
Location: Sweden
Distribution: LFS, built with pacman
Posts: 374

Rep: Reputation: 85
I think 'update-grub' in Ubuntu is an alias for 'grub-mkconfig -o /boot/grub/grub.cfg'.
When you chroot you should run commands that exists in the distro you chroot to, it doesn't matter if they exist in the LiveCD you use. 'grub-install' should have worked if you really were in the chroot, because it exists in Ubuntu. When it said 'command not found' for the grub commands, that exist in Ubuntu but not in Arch, the only reason I can see is that you were not inside the chroot, although you thought you were. Arch's LiveCD should work for this.

Edit:
Or something could be wrong with the PATH. In Arch they have moved all binaries to /usr/bin. I don't know what PATH they have on the LiveCD. You can enter the chroot with
Code:
chroot /mnt /bin/bash --login
to get the environment of root on Ubuntu.

Last edited by Lennie; 09-27-2013 at 02:11 PM. Reason: Add some more
 
Old 09-28-2013, 09:30 AM   #9
ubume2
Member
 
Registered: Oct 2006
Distribution: Ubuntu
Posts: 65

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by Lennie View Post
Edit:
Or something could be wrong with the PATH. In Arch they have moved all binaries to /usr/bin. I don't know what PATH they have on the LiveCD. You can enter the chroot with
Code:
chroot /mnt /bin/bash --login
to get the environment of root on Ubuntu.
Yes, possibly a path problem. I used #chroot /mnt /bin/bash --login, and it worked. I did get an error message,(something about arch iso) but I ignored it.

I had disabled the 30_os-prober and updated grub in Ubuntu, then booted into the arch iso.
Once getting into ubuntu's root environment I was able to change 30_os-prober by sudo chmod +x /etc/grub.d/30_os-prober and then update the grub by sudo update-grub, and rebooted successfully into the updated grub menu.

I am certain now that I can use arch iso as a rescue cd/usb for ubuntu/debian.

Thanks Lennie!

Last edited by ubume2; 09-28-2013 at 09:34 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Arch Linux Installation Problems - arch-chroot, Grub2 Ronky Linux - Newbie 3 01-08-2013 05:22 PM
booting remastersys iso using grub2 anandogc Linux - Software 5 08-27-2010 07:39 AM
Anyone tried grub2 to boot of an iso? niravshah Linux - Newbie 12 08-03-2010 09:53 AM
Mount ISO as specific device (ie: /dev/sda1) with GRUB2 to boot KNOPPIX live cd iso BLuFeNiX Linux - General 2 12-23-2009 01:31 AM
Grub2 and iso boot ---- Again niravshah Linux - Newbie 6 09-18-2009 03:32 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu

All times are GMT -5. The time now is 04:01 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration