Author Topic: chroot update?  (Read 964 times)

Offline Aradalf

  • Sr. Member
  • ****
  • Posts: 474
chroot update?
« on: January 20, 2011, 07:32:36 PM »
This is a follow-up to a question I asked of Old-Polack in an old thread, in reply to a post he had made.

Here is the post that Old-Polack had made. He said:
Only the PASS server is receiving upgrade packages at this time, as ibiblio is still down. I just upgraded to KDE 4.5.5 on my MiniMe installation, then did an upgrade of my full KDE installation by mounting that partition and doing a chroot to the mount point directory. Both went off without a hitch. (Fetched 639MB in 1h5m2s (164kB/s))


I would like to ask how an update to a separate pclinuxos install on a separate partition can be done from a different partition, via the use of chroot. It would be extremely useful to me.

Offline Old-Polack

  • Administrator
  • Super Villain
  • *****
  • Posts: 11532
  • ----IOFLU----
Re: chroot update?
« Reply #1 on: January 20, 2011, 09:06:05 PM »
Aradalf:

First thing you need is to have the non running system be complete, which means you have to bind mount the /proc and /sys directories of the running system, to the corresponding empty directories of the mounted partition. I use /mnt/here for temporary mounts, and also I label my partitions, so as root the commands used are in this order;

[root@fatman ~]# mount LABEL=kde2010 /mnt/here

[root@fatman ~]# mount -o bind /proc /mnt/here/proc

[root@fatman ~]# mount -o bind /sys /mnt/here/sys

[root@fatman ~]# chroot /mnt/here

The prompt will change to denote you are in the / partition of the chroot environment;

[root@fatman /]#

To be sure the network connection is usable, from within the chroot environment;

[root@fatman /]# service network start

[root@fatman /]# apt-get update

Wait for the package lists to d/l;

[root@fatman /]# apt-get dist-upgrade

You get a list of what will be upgraded, uninstalled, new installed, and how much extra disk space will be required, and asked if you wish to proceed. Y/n With Y(es) as the default, just press the Enter key.

Wait for the job to complete. When done, enter

[root@fatman /]# exit

The prompt will again change, to denote leaving the chroot environment;

[root@fatman ~]#

[root@fatman ~]# umount /mnt/here/sys

[root@fatman ~]# umount /mnt/here/proc

[root@fatman ~]# umount /mnt/here

Done.
Old-Polack

Of what use be there for joy, if not for the sharing thereof?



Lest we forget...

Offline Aradalf

  • Sr. Member
  • ****
  • Posts: 474
Re: chroot update?
« Reply #2 on: January 20, 2011, 09:31:28 PM »
Thanks for those easy-to-follow instructions old-polack. Unfortunately I can't try them immediately, and report beck on any errors that may occur. I have never used chroot before.

Offline Old-Polack

  • Administrator
  • Super Villain
  • *****
  • Posts: 11532
  • ----IOFLU----
Re: chroot update?
« Reply #3 on: January 20, 2011, 09:53:34 PM »
Thanks for those easy-to-follow instructions old-polack. Unfortunately I can't try them immediately, and report beck on any errors that may occur. I have never used chroot before.

FYI, chroot stands for change root. When used as shown, the running kernel simply uses the mounted partition as if it were the / partition of the running system. Any applications called will be those from the chroot environment, any directories navigated to in the normal manner will be those of the chroot environment.

You can do anything in the chroot environment you could do if you had actually booted to that partition. If you've borked a kernel, you can install a new one, or fix a broken initrd image, if the partition won't boot itself. It's a very handy tool.  ;)
Old-Polack

Of what use be there for joy, if not for the sharing thereof?



Lest we forget...