This could be considered offlist but i couldn''t think of anywhere else to ask this question. I took a centos image from http://jailtime.org/ for xen, and mounted it using loop back interface. mount -o loop centos.img /mnt/disk Now i did a chroot to /mnt/disk and executed hostname -v xyz.test.com and exited from it. The hostname changed inside the image, however it also changed for the host machine. I am confused here, after doing a chroot, shouldn''t the hostname change only inside the chrooted image ? and not on the host machine ? Any help would be appreciated. -- regards, Anand _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Charles Duffy
2006-Jan-05 21:06 UTC
[Xen-users] Re: changing hostname in a chroot [was: changing settings]
Anand wrote:> mount -o loop centos.img /mnt/disk > > Now i did a chroot to /mnt/disk and executed hostname -v xyz.test.com > <http://xyz.test.com> and exited from it. > > The hostname changed inside the image, however it also changed for the > host machine. I am confused here, after doing a chroot, shouldn''t the > hostname change only inside the chrooted image ? and not on the host > machine ? Any help would be appreciated.The hostname command doesn''t make any changes to the disk; rather, it only tells the running system what its hostname is. Since you''re using the same system (the same kernel) whether or not you''re in the chroot, running hostname inside a chroot is going to have the same impact as running hostname outside your chroot. If you want to actually change the hostname for your CentOS image, find the configuration files in /etc used by CentOS to store the hostname, and change those with the editor of your choice. _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Anand
2006-Jan-05 21:14 UTC
Re: [Xen-users] Re: changing hostname in a chroot [was: changing settings]
Thanks for the clarification. I will edit the files. On 1/6/06, Charles Duffy <cduffy@spamcop.net> wrote:> > Anand wrote: > > mount -o loop centos.img /mnt/disk > > > > Now i did a chroot to /mnt/disk and executed hostname -v xyz.test.com > > <http://xyz.test.com> and exited from it. > > > > The hostname changed inside the image, however it also changed for the > > host machine. I am confused here, after doing a chroot, shouldn''t the > > hostname change only inside the chrooted image ? and not on the host > > machine ? Any help would be appreciated. > > The hostname command doesn''t make any changes to the disk; rather, it > only tells the running system what its hostname is. > > Since you''re using the same system (the same kernel) whether or not > you''re in the chroot, running hostname inside a chroot is going to have > the same impact as running hostname outside your chroot. > > If you want to actually change the hostname for your CentOS image, find > the configuration files in /etc used by CentOS to store the hostname, > and change those with the editor of your choice. >-- regards, Anand _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users