Mailinglist Archive: opensuse (882 mails)

< Previous Next >
Re: [opensuse] opensuse chroot install from another os that have zypper installed
  • From: "Carlos E. R." <robin.listas@xxxxxxxxxxxxxx>
  • Date: Mon, 13 Dec 2010 15:50:47 +0100 (CET)
  • Message-id: <alpine.LNX.2.00.1012131534240.23056@xxxxxxxxxxxxxxxxx>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1



On Monday, 2010-12-13 at 08:07 +0100, Roger Oberholtzer wrote:

On Fri, 2010-12-10 at 17:55 +0100, Carlos E. R. wrote:

What I have done often is "zypper dup" of one installation chrooted on
another. Both opensuse, typically one stable, the duped one factory. I
haven't done this yet on the current factory version.

Interesting. How do you do that?

Well, the "host" is running a stable opensuse version; I mount the partition
running factory, chroot it, and run zypper dup inside. Basically that's it.

I did a small script, so that I don't forget the details. This is the version I used for 11.2 factory:

(some things are in Spanish; if that's a problem I'll translate, but I think it is only some names)

+++·························
#!/bin/bash

function Mensaje()
{
echo
cat /otros/test_a/etc/SuSE-release
echo
echo " Copy paste the next line to activate prompt change:"
echo
echo "export PS1=$'\\[\E[1m\E[31m\\]Tirith_chrooted_on_\\h:\\w #
\\[\E(B\E[m\\]'"
echo "export PBL_SKIP_BOOT_TEST=1"
# http://en.opensuse.org/Libzypp/Failover
echo "export ZYPP_ARIA2C=1"
echo "cd"
echo
}

function Comprobar()
{
mount | grep bind | grep "/otros/test_a/" && TEST=TRUE || TEST=FALSE
mount | grep "/otros/test_a/boot" || TEST=FALSE
grep boot /otros/test_a/etc/mtab || echo "******* mtab mal"
}


echo "Factory test partition A"
echo

case "$1" in
bind)
mount /otros/test_a/
mount /otros/test_a/boot

# mtab should have:
# /dev/sda9 / reiserfs rw,acl,user_xattr 0 0
# /dev/hda8 /boot ext2 rw,noatime,nodiratime,acl,user_xattr 0 0


mount --bind /proc /otros/test_a/proc
mount --bind /sys /otros/test_a/sys
mount --bind /dev /otros/test_a/dev

#cp -f /etc/resolv.conf /otros/test_a/etc/resolv.conf
Mensaje
echo jstar /etc/mtab
echo o
echo cp /etc/mtab.chroot /etc/mtab
echo
chroot /otros/test_a/ /bin/bash --login
;;


2nd)
Mensaje
chroot /otros/test_a/ /bin/bash --login
;;
test)
echo "Mounted?"
mount | grep bind
;;
out)
umount /otros/test_a/proc
umount /otros/test_a/sys
umount /otros/test_a/dev
;;
*) echo "bind | 2nd | out | test"
Comprobar
echo
test $TEST == TRUE && echo "System was mounted previously" || echo
"No, system was not (fully) mounted previously"

;;
esac ·························++-

The problem there is the contents of mtab; I had to edit it manually each time so that the contents were correct, because some install scripts (kernel) do checkings there


Now, the version I used for 11.3 factory in my laptop:


+++·························
#!/bin/bash

function Mensaje()
{
echo
cat /other/etc/SuSE-release
echo
echo " Copy paste the next line to activate prompt change:"
echo
echo "export PS1=$'\\[\E[1m\E[31m\\]Anor_chrooted_on_\\h:\\w #
\\[\E(B\E[m\\]'"
echo "export PBL_SKIP_BOOT_TEST=1"
# http://en.opensuse.org/Libzypp/Failover
echo "export ZYPP_ARIA2C=1"
echo "cd"
echo }

function Comprobar()
{
mount | grep bind | grep "/other/" && TEST=TRUE || TEST=FALSE
# grep boot /other/etc/mtab || echo "******* mtab mal"
}


echo "Factory test partition"
echo

case "$1" in
bind)
mount /other/

# mtab debería tener
:
# /dev/sda9 / reiserfs rw,acl,user_xattr 0 0
# /dev/hda8 /boot ext2 rw,noatime,nodiratime,acl,user_xattr 0 0


mount --bind /proc /other/proc
mount --bind /sys /other/sys
mount --bind /dev /other/dev
mount --bind /var/run/dbus /other/var/run/dbus
#mount --bind /home/_var_fctry_pckgs
/other/home/_var_fctry_pckgs
mount --bind /home/_var_fctry_pckgs/packages
/other/var/cache/zypp/packages

#cp -f /etc/resolv.conf /other/etc/resolv.conf
Mensaje
echo jstar /etc/mtab
echo o
echo cp /etc/mtab.chroot /etc/mtab
echo
chroot /other/ /bin/bash --login
;;

2nd)
Mensaje
chroot /other/ /bin/bash --login
;;
test)
echo "Mounted? Check for 'binded' /proc /sys and /dev:"
mount | grep bind
;;
out)
umount /other/proc
umount /other/sys
umount /other/dev
umount /other/var/run/dbus
umount /other/var/cache/zypp/packages
;;
*) echo "bind | 2nd | out | test"
Comprobar
echo
test $TEST == TRUE && echo "System was mounted previously" || echo
"No, system was not (fully) mounted previously"

;;
esac ·························---


There are two differences: one, that I have to bind mount /var/run/dbus, or zypper doesn't run.

The other detail is that, this being a very small partition, I can't afford
to download all packages first, but I want to; so I mount bind the location
for the download to a directory in the /home of the "host".

You can run other things inside the chrooted console, but some fail; notably yast.


As I said, I haven't tested 11.4 yet.

- -- Cheers,
Carlos E. R.
(from 11.2 x86_64 "Emerald" at Telcontar)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.12 (GNU/Linux)

iEYEARECAAYFAk0GMtAACgkQtTMYHG2NR9XtswCeOd1RKoX9bYu5Iuk9d4fOt730
vegAoIM9eEMyqtGH0dG9Acg02tgjpxCU
=EsKA
-----END PGP SIGNATURE-----
< Previous Next >
Follow Ups