Hi Stefan Thanks a lot for the description and the fix. Please try the new attached version to see if that works for you.
On Sat, Aug 01, 2009 at 12:50:52AM +0200, Stefan Tomanek wrote:
> Package: vserver-debiantools
> Version: 0.6.3
> Severity: normal
> File: /usr/sbin/newvserver
> Tags: patch
>
> When installing a new vserver with newvserver, the script copies the
> file /etc/resolv.conf from the host to the installation directory.
> It tries to replace the loopback address "127.0.0.1" in that file with
> the real address of the server, however it fails to identify this address
> in some situations.
>
> These lines (561ff) are used to obtain the ip address:
>
> # grab DNS servers from the host-server for `resolv.conf'
> HOST_IP=$(ip -o addr show dev $INTERFACE primary scope global | \
> sed -n 's;.*inet \([^/]*\)/.*;\1;p' | head -1)
>
> The code failes to correctly extract the address when it is run on a host
> configured with a pointopoint connection (/32), since "ip addr" does not show
> a "/" at the position expected:
>
> ste...@zirkel:~$ ip -o addr show dev eth0 primary scope global
> 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state
> UNKNOWN qlen 1000\ link/ether 00:24:21:57:33:76 brd ff:ff:ff:ff:ff:ff
> 2: eth0 inet 188.40.44.137 peer 188.40.44.129/32 brd 188.40.255.255 scope
> global eth0
>
> As you can see, the prefix length does not appear directly at the configured
> address,
> but at the peer address. Using newvserver on such a system results in a
> rather strange
> /etc/resolv.conf:
>
> nameserver 188.40.44.137 peer 188.40.44.129
>
> I propose replacing the ip/sed-call with the following call:
>
> HOST_IP=$(ip -4 -o addr show primary scope global dev "$INTERFACE"| \
> awk '$3 == "inet" {split($4,i,"/"); print i[1]; exit}')
>
> The scripts supplied by XEN do have the same issue, see #437127 for
> more details (http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=437127)
Good to know that I'm not alone. :-)
Best regards,
// Ola
> Sincerly
> Stefan Tomanek
>
> -- System Information:
> Debian Release: 5.0.2
> APT prefers stable
> APT policy: (990, 'stable')
> Architecture: amd64 (x86_64)
>
> Kernel: Linux 2.6.26-2-vserver-amd64 (SMP w/8 CPU cores)
> Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
> Shell: /bin/sh linked to /bin/bash
>
> Versions of packages vserver-debiantools depends on:
> ii binutils 2.18.1~cvs20080103-7 The GNU assembler, linker and
> bina
> ii debootstrap 1.0.10lenny1 Bootstrap a basic Debian system
> ii iproute 20080725-2 networking and traffic control
> too
> ii rsync 3.0.6-1~bpo50+1 fast remote file copy program
> (lik
> ii util-vserver 0.30.216~r2772-6 user-space tools for
> Linux-VServer
>
> Versions of packages vserver-debiantools recommends:
> ii dnsutils 1:9.5.1.dfsg.P3-1 Clients provided with BIND
>
> vserver-debiantools suggests no packages.
>
> -- no debconf information
>
> --
> [email protected]
> GPG available and welcome
> http://stefans.datenbruch.de/
--
--------------------- Ola Lundqvist ---------------------------
/ [email protected] Annebergsslingan 37 \
| [email protected] 654 65 KARLSTAD |
| http://inguza.com/ +46 (0)70-332 1551 |
\ gpg/f.p.: 7090 A92B 18FE 7994 0C36 4FE4 18A1 B1CF 0FE5 3DD9 /
---------------------------------------------------------------
newvserver.sh
Description: Bourne shell script

