[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: using debian debootstrap and chroot to login to other distro on neighbouring partition etc



On Thu, Feb 04, 2016 at 10:55:26PM +0000, Michael Fothergill wrote:
> Dear Folks,
> 
> I am asking a general question about using chroot etc.
> 
> On my AMD box here I am running Debian stretch.  But I also have ubuntu
> installed on the same disk and I think a third linux distribution installed
> on a second hard drive.
> 
> If I wanted to mount e.g. the partition with ubuntu on it and then use the
> chroot to run  that OS inside the debian environment what would be the best
> way to do that?
> 
> Do I need to rename some of the mount points etc?
> 
> Comments and guidance appreciated.
> 

I'm not sure debootstrap is what you are looking for here.  If you just 
want to chroot into your Ubuntu,on the same disk, these are the steps:

1. Make a mount point, say /mnt/ubuntu;

2. Mount the partition Ubuntu is on, e.g., <mount /dev/sda3 /mnt/ubuntu>;

3. Change directory to /mnt/ubuntu;

4. <mount -t proc proc proc/>;

5. <mount --rbind /sys sys/>;

6. <mount --rbind /dev dev/>;

7. <mount --rbind /run run/>;

8. <cp /etc/resolv.conf etc/resolv.conf>;

9. <chroot /mnt/ubuntu /bin/bash>;

10. <source /etc/profile>;

11. <source ~/.bashrc>;

12. <export PS1="(chroot) $PS1"

Of course, you will need to determine certain things up front and modify for
your particular needs, i.e., which partition Ubuntu is currently residing on,
whether you need network access, etc. Some of these commands will need to
be customized/omitted based upon those needs.


Reply to: