[chroot] What happens when upgrading?
Hello
While learning about customizing a live ISO file, there's something I'd like to understand about chrooting and then, upgrading the kernel + applications: 1. It appears that (Ubuntu's) "apt-get upgrade" will not only upgrade applications but will also upgrade the kernel. Is this correct? Can I tell "apt-get upgrade" to upgrade applications and leave the kernel alone, so that "chroot" really means local files only? 2. After chrooting to a directory and running the command above, I'm seeing some discrepancy between the kernel files: Code:
# chroot /mnt/squashfs Thank you. |
Greetingz!
1) Yes, you are correct. Minor updates (and sometimes major ones) are done to the kernel (2.6.31-22.61, 2.6.31-22.62, 2.6.31-22.63, etc) when you run "apt-get upgrade" From the apt-get man page; Quote:
Basically, there's nothing wrong with doing a full "apt-get upgrade" from within a chrooted environment. As long as your chrooted environment happens to be the hard drive you're installing the OS into. Quote:
(Translation: That's usually a lot more trouble than you'd think.) Hope this helps! P.S: "so that "chroot" really means local files only?" Um, I think you would benefit from reading the chroot man page ("man chroot" at the command prompt). The "chroot" command always uses local files...but that doesn't upgraded anything, it just "changes your root". |
Thanks for the information.
The problem I'm trying to solve, is that I need to update the kernel + applications contained in a live ISO file. This is done by mounting the ISO file, extract its files (squashfs) in a directory, chroot to it, update the applications, and save the files in a new ISO file. According to documents like LiveCDCustomization, we just need to chroot to the directory where the squashfs file (ie. the tree that will be used as the live root filesystem) was extracted, and then run "apt-get" to add/remove applications. So apparently, "apt-get" while in chroot actually updates the underlying host instead of restricting itself to the chroot filesystem? Thank you. |
I noticed something, though: To avoid typing "sudo" every time, I simply ran the whole thing as root. Maybe this is not right when using chroot?
I also notice something in the document: In Advanced Customizations > Live CD Kernel: Code:
sudo cp edit/boot/vmlinuz-2.6.15-26-k7 extract-cd/casper/vmlinuz When chrooted in the extracted squashfs, there is no boot/ since the kernel + initrd are at the root of the ISO image, ie. in extract-cd/. So what's the right way to update a kernel within an ISO image? I was thinking of downloading a .deb image, extract vmlinuz from its data.tar.bz2, and somehow recompile a initrd.gz (or .lz, rather). I suspect there are dependencies (configuration files, libraries) that make this a bit less straightforward. Thank you. |
Quote:
Quote:
Here's a nice trick; 1) jump into your chrooted environment NOTE: should be something like "chroot /mnt/sysimage /bin/bash" 2) Type "touch OMGlolWTF" (or some other filename that isn't going to exist elswhere) 3) "Exit" the chrooted environment. 4) Run "updatedb && locate OMGlolWTF" The file OMGlolWTF should pop up in "/mnt/sysimage", and not just plain "/". If for some reason the file DOES pop-up in just plain "/", then you're skipping a step somewhere... |
Thanks for the tip. Sorry for the error: "apt-get ugrade" in chroot does update the chroot, not the underlying host (I added a new driver just to check, and it's not listed when I exit chroot and run "dpkg -l").
I'm taking a further look at updating an ISO file, and I suspect it's going to take a while ;-) I haven't found information on replacing the kernel within the ISO file, though. I doubt it's just a matter of replacing vmlinuz with the one found in the latest kernel .deb package. Most likely, I need to generate a new initrd.gz based on what's living in /lib/modules after the upgrade, update configuration files, etc. Has someone successfully updated the kernel of an existing ISO file and could tell me how it's done? Thank you. |
After further investigation, here's what I see when I mount the live ISO file and chroot to it:
BEFORE apt-get upgrade 0. # uname -r 2.6.31-22-generic (this is the kernel used by the host) Ob. # lsb_release -a Description: Ubuntu 9.10 Codename: karmic 1. No /boot 2. # dpkg-query -W | grep -i linux- linux-generic 2.6.31.20.33 linux-image-2.6.31-20-generic 2.6.31-20.57 linux-image-generic 2.6.31.20.33 (this is data from the local database of installed applications) AFTER apt-get upgrade 1. /boot: System.map-2.6.31-20-generic abi-2.6.31-20-generic config-2.6.31-20-generic initrd.img-2.6.31-20-generic vmcoreinfo-2.6.31-20-generic vmlinuz-2.6.31-20-generic (why no 2.6.31-22?) 2. # dpkg-query -W | grep -i linux- linux-firmware 1.26 linux-generic 2.6.31.20.33 linux-image-2.6.31-20-generic 2.6.31-20.58 linux-image-generic 2.6.31.20.33 3. # apt-cache search linux-image linux-image-2.6.31-22-generic Why doesn't /boot contain the latest kernel image from the Ubuntu repository (2.6.31-22)? Thank you. |
Here's the possible answer:
Code:
# apt-get upgrade Quote:
|
All times are GMT -5. The time now is 01:57 PM. |