个人工具

UbuntuHelp:UbuntuLTSP/LocalAppsResolvConf

来自Ubuntu中文

跳转至: 导航, 搜索
This page is specific to Ubuntu versions 9.04

If you find this information applicable to additional versions/releases, please edit this page and modify this header to reflect that. Please also include any necessary modifications for this information to apply to the additional versions.


Repairing permissions for /etc/resolv.conf file in chroot

There is a bug that affects name resolution from within the client chroot. This affects applications that are run locally on the thin client. The resolver configuration file /etc/resolv.conf is not created properly due to broken permissions. Bug: https://bugs.launchpad.net/ubuntu/+source/ltsp/+bug/347957 Here is a workaround for that bug that applies for both setup types - one or two network interfaces on the server. These terminal commands are specific to GNOME, but can be amended to work on KDE as well. At the time of this writing (August 29, 2009) only GNOME and KDE have been successfully tested for this procedure. 1. The first step is to create the script that will set up the proper permissions. An easy way to do this is to open an instance of Nautilus (the GNOME filemanager) as the "root" user. Open a terminal window and copy and paste the following code:

sudo nautilus

A nautilus window should appear with a message warning you that you are accessing the system as root. Navigate to the following folder: /opt/ltsp/i386/etc/init.d Open any file in the folder that ends in ".sh" Click File -> "Save as" and name this file "chmod-resolv.sh" Now delete all the text in the file and replace it with the two lines of code below.

  1. ! /bin/sh

chmod 644 /etc/resolv.conf Save the file and close the nautilus window. 1a. Make sure the script is owned by root and executable by copying and pasting the following code into the terminal window

sudo chown root:root /opt/ltsp/i386/etc/init.d/chmod-resolv.sh
sudo chmod 755 /opt/ltsp/i386/etc/init.d/chmod-resolv.sh

2. Now you need to add three lines to the lts.conf file located in the i386 folder at /var/lib/tftpboot/ltsp/i386/lts.conf

sudo gedit /var/lib/tftpboot/ltsp/i386/lts.conf

If you don't have an lts.conf file yet you can create one by opening an instance of nautilus as root, navigating to /var/lib/tftpboot/ltsp/i386. Then by right clicking in the folder and selecting "new file" you can create a blank file and name it "lts.conf" Copy and paste the code below into your lts.conf file:

SEARCH_DOMAIN = ubuntu-ltsp5 || Change this for your own network
DNS_SERVER = 192.168.1.1  || Change this for your own network
RCFILE_01=/etc/init.d/chmod-resolv.sh

If you don't know your Search Domain or your DNS Server you can find both listed in /etc/resolv.conf 3. Now you need to rebuild the client image

sudo ltsp-update-image

4. To verify that the fix has been applied, boot a thin client, connect to its shell (ex: via SSH or from the unlocked root account), and verify that the mode and content are correct

ls -al /etc/resolv.conf

should return: -rw-r--r-- 1 root root 43 2002-01-13 17:13 /etc/resolv.conf

cat /etc/resolv.conf

should return: search ubuntu-ltsp5 nameserver 192.168.1.1