[opensuse] chroot of a JeOS openSYSTE 15.1 install
I am doing a little experimenting with running openSUSE in a chroot jail. I'm basically after a compiler environment. I have been doing this with a couple versions of openSUSE and it works quite well. I have just tried setting this up in a slightly different way, and I have encountered a strange thing. I want to be sure I have not overlooked anything. I have unpacked the contents of the JeOS KVM image for 15.1 (current download) to a directory. I am unpacking it this way because I do not really need the cow file. I'm just after a minimal install to get things going. The chroot directory is exactly the tree in the cow file. Just in a directory instead of a cow file. I can chroot into the directory and do lots of things (having first mounted the system's /dev, /proc and /sys folders, and copying the system's /etc/resolv.conf). I can install software with zypper (the stuff I will need to be able to compile things). Here is the strange thing: If I add a package with zypper, it installs fine. zypper continues to know that the package is installed. The package functions as expected. If I ask rpm about the package, it does not think it is installed. Why would the two programs not have the same idea about what is installed? I have never installed software into a chroot directory that contains a complete openSUSE install. So maybe this is how it has always been. I'm not sure where to start looking. I guess I can stick to using zypper and skip looking at rpm. But something worries me about this. A problem waiting to happen. -- Roger Oberholtzer -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 07/05/2020 10.52, Roger Oberholtzer wrote:
I am doing a little experimenting with running openSUSE in a chroot jail. I'm basically after a compiler environment. I have been doing this with a couple versions of openSUSE and it works quite well.
I have just tried setting this up in a slightly different way, and I have encountered a strange thing. I want to be sure I have not overlooked anything.
I have unpacked the contents of the JeOS KVM image for 15.1 (current download) to a directory. I am unpacking it this way because I do not really need the cow file. I'm just after a minimal install to get things going. The chroot directory is exactly the tree in the cow file. Just in a directory instead of a cow file.
I can chroot into the directory and do lots of things (having first mounted the system's /dev, /proc and /sys folders, and copying the system's /etc/resolv.conf).
I can install software with zypper (the stuff I will need to be able to compile things). Here is the strange thing:
If I add a package with zypper, it installs fine. zypper continues to know that the package is installed. The package functions as expected. If I ask rpm about the package, it does not think it is installed.
Why would the two programs not have the same idea about what is installed? I have never installed software into a chroot directory that contains a complete openSUSE install. So maybe this is how it has always been.
I'm not sure where to start looking.
I guess I can stick to using zypper and skip looking at rpm. But something worries me about this. A problem waiting to happen.
I don't fully understand what you are doing (I don't know what is Jeos). But I have done something that is perhaps similar: For example, running Leap in one partitition, update factory that is on another partition, by chrooting to it after bind mounted /dev, /proc, /sys. And then I have used successfully zypper. I don't remember having problems with rpm. That would point to the tools looking at the wrong directory. Sometimes I had to edit some files in the chrooted "environment" to do things like accessing internet. mtab, too. -- Cheers / Saludos, Carlos E. R. (from 15.1 x86_64 at Telcontar)
On Thu, May 7, 2020 at 11:06 AM Carlos E. R. <robin.listas@telefonica.net> wrote:
I don't fully understand what you are doing (I don't know what is Jeos). But I have done something that is perhaps similar: For example, running Leap in one partitition, update factory that is on another partition, by chrooting to it after bind mounted /dev, /proc, /sys. And then I have used successfully zypper. I don't remember having problems with rpm. That would point to the tools looking at the wrong directory.
JeOS is a version of openSUSE that is "Just Enough OS". Sort of the bare minimum to have openSUSE. It is usually used in specialized environments where a desktop, games and other doodads are not needed. I have chosen it because it is small. In fact it is still much more than what I want. But it is a solid base. You can download various versions of it from where you download openSUSE.Or even build your own variation using KIWI. I am not booting this install. It is simply an environment that I can compile in. So it has all the correct libraries and such. That is why I only need to chroot in to it. The kernel is not a factor. As to accessing things like the internet, that works perfectly. In fact, most everything just works. Except the mystery of rpm and zypper not agreeing about what is installed. rpm seems not to see what zypper added. -- Roger Oberholtzer -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Roger Oberholtzer wrote:
Except the mystery of rpm and zypper not agreeing about what is installed. rpm seems not to see what zypper added.
Maybe something to experiment with - download a package, install with zypper, then try the same with rpm ? What about vice versa - does zypper recognise what you've installed with rpm ? -- Per Jessen, Zürich (18.2°C) http://www.dns24.ch/ - free dynamic DNS, made in Switzerland. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Roger Oberholtzer wrote:
I can chroot into the directory and do lots of things (having first mounted the system's /dev, /proc and /sys folders, and copying the system's /etc/resolv.conf).
Except the jeOS part, this sounds exactly like what I do when I boot an emergency system over PXE.
I can install software with zypper (the stuff I will need to be able to compile things). Here is the strange thing:
If I add a package with zypper, it installs fine. zypper continues to know that the package is installed. The package functions as expected. If I ask rpm about the package, it does not think it is installed.
That's certainly novel :-)
Why would the two programs not have the same idea about what is installed? I have never installed software into a chroot directory that contains a complete openSUSE install. So maybe this is how it has always been.
I don't remember if I've ever installed anything when running an emergency system, but I probably have - seems to me it ought to just work. -- Per Jessen, Zürich (18.1°C) http://www.cloudsuisse.com/ - your owncloud, hosted in Switzerland. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 07/05/2020 13.43, Per Jessen wrote:
Roger Oberholtzer wrote:
Why would the two programs not have the same idea about what is installed? I have never installed software into a chroot directory that contains a complete openSUSE install. So maybe this is how it has always been.
I don't remember if I've ever installed anything when running an emergency system, but I probably have - seems to me it ought to just work.
I have. I typically use rpm, zypper and yast - the later, to manipulate the boot. -- Cheers / Saludos, Carlos E. R. (from 15.1 x86_64 at Telcontar)
Carlos E. R. wrote:
On 07/05/2020 13.43, Per Jessen wrote:
Roger Oberholtzer wrote:
Why would the two programs not have the same idea about what is installed? I have never installed software into a chroot directory that contains a complete openSUSE install. So maybe this is how it has always been.
I don't remember if I've ever installed anything when running an emergency system, but I probably have - seems to me it ought to just work.
I have. I typically use rpm, zypper and yast - the later, to manipulate the boot.
I'm not sure if I have, I usually limit those boot-ups to the bare minimum - fix boot loader or initrd, then reboot. -- Per Jessen, Zürich (21.5°C) http://www.hostsuisse.com/ - virtual servers, made in Switzerland. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 07/05/2020 19.25, Per Jessen wrote:
Carlos E. R. wrote:
On 07/05/2020 13.43, Per Jessen wrote:
Roger Oberholtzer wrote:
Why would the two programs not have the same idea about what is installed? I have never installed software into a chroot directory that contains a complete openSUSE install. So maybe this is how it has always been.
I don't remember if I've ever installed anything when running an emergency system, but I probably have - seems to me it ought to just work.
I have. I typically use rpm, zypper and yast - the later, to manipulate the boot.
I'm not sure if I have, I usually limit those boot-ups to the bare minimum - fix boot loader or initrd, then reboot.
I migrated this system from an Intel+Nvidia machine to a new AMD+ATI machine. Plus a BIOS+MBR to UEFI+GPT boot. It took some effort. The system disk was SSD, now it is M2 (hdparm hangs measuring speed). I cloned the system from one disk to another, then carried over the large storage rotating rusts. Then I had to install grub (secure) to make it boot. That was the hard part. -- Cheers / Saludos, Carlos E. R. (from 15.1 x86_64 at Telcontar)
Roger Oberholtzer wrote:
I am doing a little experimenting with running openSUSE in a chroot jail. I'm basically after a compiler environment. I have been doing this with a couple versions of openSUSE and it works quite well.
Maybe consider using a container? lxc or some such. Not that it'll do anything any better, maybe just easier to manage? As for compiler environments, I use a qemu setup for compiling e.g. a kernel for my ARM boards. I have not really looked at how it is done, but it seems to me it must be something similar. Just thinking out loud. -- Per Jessen, Zürich (21.3°C) http://www.hostsuisse.com/ - virtual servers, made in Switzerland. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
07.05.2020 11:52, Roger Oberholtzer пишет:
I am doing a little experimenting with running openSUSE in a chroot jail. I'm basically after a compiler environment. I have been doing this with a couple versions of openSUSE and it works quite well.
I have just tried setting this up in a slightly different way, and I have encountered a strange thing. I want to be sure I have not overlooked anything.
I have unpacked the contents of the JeOS KVM image for 15.1 (current download) to a directory.
As you did not bother to tell what image you used I assume it is openSUSE-Leap-15.1-JeOS.x86_64-kvm-and-xen.qcow2 (the only image with "kvm" in its name). This image is not archive so you cannot "unpack" it. You need to explain what you actually did.
I am unpacking it this way because I do not really need the cow file. I'm just after a minimal install to get things going. The chroot directory is exactly the tree in the cow file. Just in a directory instead of a cow file.
I can chroot into the directory and do lots of things (having first mounted the system's /dev, /proc and /sys folders, and copying the system's /etc/resolv.conf).
I can install software with zypper (the stuff I will need to be able to compile things). Here is the strange thing:
If I add a package with zypper, it installs fine. zypper continues to know that the package is installed. The package functions as expected. If I ask rpm about the package, it does not think it is installed.
That certainly works as expected if I present qcow2 image as disk and mount third partition which is root of openSUSE including all subvolumes. You need to provide complete steps (starting with image name) what you did if you expect someone to look into it.
Why would the two programs not have the same idea about what is installed? I have never installed software into a chroot directory that contains a complete openSUSE install. So maybe this is how it has always been.
I'm not sure where to start looking.
I guess I can stick to using zypper and skip looking at rpm. But something worries me about this. A problem waiting to happen.
-- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On Thu, May 7, 2020 at 7:47 PM Andrei Borzenkov <arvidjaar@gmail.com> wrote:
07.05.2020 11:52, Roger Oberholtzer пишет:
I am doing a little experimenting with running openSUSE in a chroot jail. I'm basically after a compiler environment. I have been doing this with a couple versions of openSUSE and it works quite well.
I have just tried setting this up in a slightly different way, and I have encountered a strange thing. I want to be sure I have not overlooked anything.
I have unpacked the contents of the JeOS KVM image for 15.1 (current download) to a directory.
As you did not bother to tell what image you used I assume it is openSUSE-Leap-15.1-JeOS.x86_64-kvm-and-xen.qcow2 (the only image with "kvm" in its name). This image is not archive so you cannot "unpack" it. You need to explain what you actually did.
Sorry about that. I thought that there is only one current JeOS KVM image for 15.1 available in the main openSUSE download page. But yes, that is the image. I do not boot it. That's the point of my exercise. It can be unpacked. See https://gist.github.com/shamil/62935d9b456a6f9877b5 I can compile in this tree (adding the needed rpms). And access the network and mounted file systems in the chroot jail. I have a suspicion that my problem is because the JeOS is configured with btrfs. I have usually done this with ext4-based trees where everything is just there. I suspect that it is this that I am not doing (from the JeOS /etc/fstab): LABEL=ROOT /var btrfs defaults,subvol=@/var 0 0 Still, there is a /var directory in the tree. /var/lib/rpm/Packages in unchanged (same date as when the JeOS image was built). Wouldn't the zypper install have updated it? Note that it is not accessed as a cow. It has been copied out to a tree somewhere.
That certainly works as expected if I present qcow2 image as disk and mount third partition which is root of openSUSE including all subvolumes. You need to provide complete steps (starting with image name) what you did if you expect someone to look into it.
I did not mount the subvolumes. I suspect this is what is the cause. I'm not even sure how to do that in this context. I think I will make my own JeOS in kiwi, and use ext4 so there are no subvolumes. That may have other advantages. FYI, my generic script for this (that I use al the time) is below. It takes the directory with the tree as the only argument. #!/bin/sh export BUSER=$USER cd $1 export g=`pwd` mount --bind /dev $g/dev mount --bind /proc $g/proc mount --bind /sys $g/sys mount --bind /home/$BUSER/source.18.00 $g/home/$BUSER/source.18.00 mount --bind /home/$BUSER/rst $g/home/$BUSER/rst cp -p $g/etc/resolv.conf $g/etc/resolv.conf.keep cp /etc/resolv.conf $g/etc/resolv.conf HOME=/home/$BUSER PS1="jail $1 \w> " chroot --userspec=$BUSER $g su -m $BUSER umount $g/dev/ umount $g/proc/ umount $g/sys/ umount $g/home/$BUSER/source.18.00 umount $g/home/$BUSER/rst cp -p $g/etc/resolv.conf.keep $g/etc/resolv.conf -- Roger Oberholtzer -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On Thu, May 7, 2020 at 9:08 PM Roger Oberholtzer <roger.oberholtzer@gmail.com> wrote: I built my own mini distro (based on 15.1) with KIWI. I used an option I did not know about. It makes a tar archive of the distro. I unpacked it and did my thing. No complaints. zypper and rpm play nice together. I can now make a distro that contains all the compiler tools and libraries I need. All ready to go. And the rules to make my distro can be checked in to our source revision system. Like all for all the other openSUSE-based installers we also make. A nice thing is that I can also remove all the boot and other things I do not need. Just a release-specific build environment. I think the btrfs subvolume thing was the issue. Yeah for openSUSE and KIWI!! -- Roger Oberholtzer -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
07.05.2020 22:08, Roger Oberholtzer пишет:
On Thu, May 7, 2020 at 7:47 PM Andrei Borzenkov <arvidjaar@gmail.com> wrote:
07.05.2020 11:52, Roger Oberholtzer пишет:
I am doing a little experimenting with running openSUSE in a chroot jail. I'm basically after a compiler environment. I have been doing this with a couple versions of openSUSE and it works quite well.
I have just tried setting this up in a slightly different way, and I have encountered a strange thing. I want to be sure I have not overlooked anything.
I have unpacked the contents of the JeOS KVM image for 15.1 (current download) to a directory.
As you did not bother to tell what image you used I assume it is openSUSE-Leap-15.1-JeOS.x86_64-kvm-and-xen.qcow2 (the only image with "kvm" in its name). This image is not archive so you cannot "unpack" it. You need to explain what you actually did.
Sorry about that. I thought that there is only one current JeOS KVM image for 15.1 available in the main openSUSE download page. But yes, that is the image. I do not boot it. That's the point of my exercise.
It can be unpacked. See https://gist.github.com/shamil/62935d9b456a6f9877b5
I can compile in this tree (adding the needed rpms). And access the network and mounted file systems in the chroot jail.
I have a suspicion that my problem is because the JeOS is configured with btrfs. I have usually done this with ext4-based trees where everything is just there.
There is no problem to use btrfs as long as you use it correctly.
I suspect that it is this that I am not doing (from the JeOS /etc/fstab):
LABEL=ROOT /var btrfs defaults,subvol=@/var 0 0
Yes.
Still, there is a /var directory in the tree. /var/lib/rpm/Packages in unchanged (same date as when the JeOS image was built). Wouldn't the
It is impossible if you did not mount /var.
zypper install have updated it? Note that it is not accessed as a cow. It has been copied out to a tree somewhere.
Traditionally RPM database was kept in /var/lib/rpm. SUSE initiated relocation of database to /usr/lib/sysimage/rpm to facilitate snapshot integration. /var/lib/rpm is kept as compatibility link. If /var is not mounted, there is no /var/lib/rpm link present. When you call rpm directly it does not matter, because it looks at /usr/lib/sysimage/rpm. But zypper in 15.1 still has hardcoded /var/lib/rpm as database location. So when you call zypper in these conditions (/var not mounted) it creates empty RPM database in *directory* /var/lib/rpm, which is completely unrelated to actual RPM database in /usr/lib/sysimage/rpm.
That certainly works as expected if I present qcow2 image as disk and mount third partition which is root of openSUSE including all subvolumes. You need to provide complete steps (starting with image name) what you did if you expect someone to look into it.
I did not mount the subvolumes. I suspect this is what is the cause. I'm not even sure how to do that in this context.
chroot mount -a -t btrfs works for me. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
participants (4)
-
Andrei Borzenkov
-
Carlos E. R.
-
Per Jessen
-
Roger Oberholtzer