You are not logged in.

#1 2007-10-12 06:58:44

p_schott
Member
Registered: 2006-11-23
Posts: 54

Upgrade with chroot ?

Basically the question is  : is it possible to safely and properly upgrade Arch using a chroot from another distro ?

I don't remember details, but some times ago, I was booted under Ubuntu and :
- I mounted my Arch Linux partition at /media/Arch
- I chrooted in /media/Arch
- I ran pacman to upgrade the system
- I got some warnings during a mkinitcpio phase (kernel had been updated)

After this I was unable to boot in Arch. Fortunately it still worked with the fallback kernel, so I was able to repair (running again a mkinitcpio as I was booted into Arch).

Now I would like to try again (upgrading Arch from Ubuntu), but I am afraid of messing my system. Is there a way to do this upgrade with chroot properly ?

Offline

#2 2007-10-12 07:36:45

ise
Developer
From: Karlsruhe / Germany
Registered: 2005-10-06
Posts: 404
Website

Re: Upgrade with chroot ?

I have several chroots of different ArchLinux installations here. Updates runs all fine here.
Are you mounting other things into the chroot (e.g. /proc, /dev/, /sys)? The system needs these directories...eventually some more things, I don't know without looking to my chroot mount script.

Last edited by ise (2007-10-12 07:37:01)

Offline

#3 2007-10-12 08:05:43

p_schott
Member
Registered: 2006-11-23
Posts: 54

Re: Upgrade with chroot ?

No I am a totally newbie concerning chroot, and I only did chroot /media/Arch, entered my password, and ran pacman -Syu. So I guess that I missed some crucial steps (like mounting /proc, etc..). If it is not to personal, can you perhaps post your chroot mount script, so that I can study it and adapt it to my case ? If you know about some documentation that could give me some background on chroot and so on, it would also be great.
Anyway, thanks a lot !

Offline

#4 2007-10-12 08:17:57

ise
Developer
From: Karlsruhe / Germany
Registered: 2005-10-06
Posts: 404
Website

Re: Upgrade with chroot ?

p_schott wrote:

If it is not to personal, can you perhaps post your chroot mount script, so that I can study it and adapt it to my case ?

big_smile No, it isn't too personal... You can have it, but I'm at work right now. I can't post it yet. Maybe another dev or user can post his chroot script. Otherwise I will post it in the evening.

For documentation try google... Don't know a documentation at the moment

Offline

#5 2007-10-12 12:27:38

fancris3
Member
Registered: 2007-03-18
Posts: 67

Re: Upgrade with chroot ?

 
        mount --bind /proc /opt/arch32/proc
        mount --bind /proc/bus/usb /opt/arch32/proc/bus/usb
        mount --bind /dev /opt/arch32/dev
        mount --bind /dev/pts /opt/arch32/dev/pts
        mount --bind /dev/shm /opt/arch32/dev/shm
        mount --bind /sys /opt/arch32/sys

change /opt/arch32 in /media/Arch

Arch64_Install_bundled_32bit_system

Last edited by fancris3 (2007-10-12 12:28:37)

Offline

#6 2007-10-12 12:47:37

klixon
Member
From: Nederland
Registered: 2007-01-17
Posts: 525

Re: Upgrade with chroot ?

fancris3 wrote:
 
        mount --bind /proc /opt/arch32/proc
        mount --bind /proc/bus/usb /opt/arch32/proc/bus/usb
        mount --bind /dev /opt/arch32/dev
        mount --bind /dev/pts /opt/arch32/dev/pts
        mount --bind /dev/shm /opt/arch32/dev/shm
        mount --bind /sys /opt/arch32/sys

Why would you bind-mount a directory residing in /proc or /dev when you have /proc and /dev already bind-mounted there??

mount --bind /proc ${chroot}/proc
mount --bind /dev ${chroot}/dev
mount --bind /sys ${chroot}/sys

is sufficient.


Stand back, intruder, or i'll blast you out of space! I am Klixon and I don't want any dealings with you human lifeforms. I'm a cyborg!

Offline

#7 2007-10-13 11:44:55

p_schott
Member
Registered: 2006-11-23
Posts: 54

Re: Upgrade with chroot ?

Ok, I will try this next time I'll have to upgrade from Ubuntu. Thanks !

Offline

#8 2007-10-18 18:47:00

p_schott
Member
Registered: 2006-11-23
Posts: 54

Re: Upgrade with chroot ?

So, after some further investigations, it appears that

#!/bin/bash
export MNT="/media/Arch"
sudo mount "$MNT"
cat /etc/resolv.conf > ~/resolv.conf.tmp
sudo mv resolv.conf.tmp "$MNT"/etc/resolv.conf
sudo mount -t proc   none      "$MNT"/proc
sudo mount -o bind   /dev      "$MNT"/dev
sudo mount -t devpts /dev/pts/ "$MNT"/dev/pts
sudo chroot "$MNT" /bin/bash
sudo umount "$MNT"/dev/pts
sudo umount "$MNT"/dev
sudo umount "$MNT"/proc
sudo umount "$MNT"

works for me . I am not sure about whether mounting /dev/pts is necessary or not, and I have not tried a chrooted kernel upgrade so far.

Offline

#9 2007-10-18 20:58:08

iphitus
Forum Fellow
From: Melbourne, Australia
Registered: 2004-10-09
Posts: 4,927

Re: Upgrade with chroot ?

Should add /sys in there too

mounting /dev/pts is redundant, as it's aready there.

Last edited by iphitus (2007-10-18 20:58:45)

Offline

#10 2007-10-19 16:26:52

p_schott
Member
Registered: 2006-11-23
Posts: 54

Re: Upgrade with chroot ?

OK. Many thanks.

Offline

Board footer

Powered by FluxBB