[Vserver] lvremove: Can't remove open logical volume

2006-09-15 Thread Mehdi Bennani
Hello,
I am setting up a host with LVM volumes for each vserver.
I made scripts for vserver creation which include on-the-fly Logical Volume creation, formating and mount, that works pretty well.
Things are getting worse when I try to delete a Logical Volume after having the vserver stopped and its partition umounted:
I randomly get this error:
Can't remove open logical volume
Here are basic examples of the scripts:
CREATIONusage:vcreate [name]
#!/bin/bashlvcreate -L5000 -n$1 vg0mkreiserfs -f /dev/vg0/$1mkdir /vservers/$1mount /dev/vg0/$1 /vservers/$1vserver $1 build -m skeleton 


DELETIONusage:vdelete [name]
#!/bin/bashvserver $1 stoplsof /vservers/$1umount -f /vservers/$1lvremove -f /dev/vg0/$1
The Logical Volume seems actually umounted because cat /proc/mounts doesn't mention it, but *something* is still using it and I cannot figure out what.
A reboot of the host corrects the problem but I can't reboot the whole system each time I need to delete a vserver.
I have found a log chat at http://irc.13thfloor.at/LOG/2006-04/LOG_2006-04-22.txt
 where someone was experiencing exaclty the same problem but no solution was found at the moment. 
Thanks in advance for any help or ideas!
Regards,
Mehdi Bennani

=system info==
vserver:~# vserver-infoVersions: Kernel: 2.6.12lvs VS-API: 0x00020001 util-vserver: 0.30.210; Jun 11 2006, 14:57:10
Features: CC: gcc, gcc (GCC) 3.3.5 (Debian 1:3.3.5-13) CXX: g++, g++ (GCC) 3.3.5 (Debian 1:3.3.5-13) CPPFLAGS: '' CFLAGS: '-Wall -g -O2 -std=c99 -Wall -pedantic -W' 
 CXXFLAGS: '-g -O2 -ansi -Wall -pedantic -W -fmessage-length=0' build/host: i386-pc-linux-gnu/i386-pc-linux-gnu Use dietlibc: yes Build C++ programs: yes
 Build C99 programs: yes Available APIs: compat,v11,fscompat,v13,net,oldproc,olduts ext2fs Source: e2fsprogs syscall(2) invocation: alternative vserver(2) syscall#: 273/glibc 

Paths: prefix: /usr sysconf-Directory: /etc cfg-Directory: /etc/vservers initrd-Directory: $(sysconfdir)/init.d pkgstate-Directory: /var/run/vservers 
 vserver-Rootdir: /var/lib/vservers
___
Vserver mailing list
Vserver@list.linux-vserver.org
http://list.linux-vserver.org/mailman/listinfo/vserver


Re: [Vserver] lvremove: Can't remove open logical volume

2006-09-15 Thread Christian Affolter

Hi!


I am setting up a host with LVM volumes for each vserver.

I made scripts for vserver creation which include on-the-fly Logical 
Volume creation, formating and mount, that works pretty well.


Things are getting worse when I try to delete a Logical Volume after 
having the vserver stopped and its partition umounted:


I randomly get this error:

Can't remove open logical volume

Because it's probably still mounted in your other active namespaces...



The Logical Volume seems actually umounted because cat /proc/mounts 
doesn't mention it, but *something* is still using it and I cannot 
figure out what.


A reboot of the host corrects the problem but I can't reboot the whole 
system each time I need to delete a vserver.

Try to unmount your volume for each active name space:
vnamespace -e [namespace of context xid] umount /your/lvm/volume


Hope this helps.

regards,
Chris


___
Vserver mailing list
Vserver@list.linux-vserver.org
http://list.linux-vserver.org/mailman/listinfo/vserver


Re: [Vserver] lvremove: Can't remove open logical volume

2006-09-15 Thread Rik Bobbaers

 Try to unmount your volume for each active name space:
 vnamespace -e [namespace of context xid] umount /your/lvm/volume

i scripted it like this:
gandalf:~# cat /usr/local/bin/unmount_vserver
#!/bin/sh
if [ -n $1 ]
then
  for i in `ls -1 /proc/virtual | egrep -v 'info|status'`; do 
vnamespace -e $i umount $1; done

  exit 0;
fi
exit 1;

you just do unmount_vserver /vservers/bleh
and it makes sure it's unmounted in all namespaces.

it doesn't do much checking, but you get the picture, feel free to add 
more sanity/safety checks ;)


greetz,

--
harry
aka Rik Bobbaers

K.U.Leuven - LUDIT  -=- Tel: +32 485 52 71 50
[EMAIL PROTECTED] -=- http://harry.ulyssis.org

Work hard and do your best, it'll make it easier for the rest
-- Garfield

Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm

___
Vserver mailing list
Vserver@list.linux-vserver.org
http://list.linux-vserver.org/mailman/listinfo/vserver


Re: [Vserver] lvremove: Can't remove open logical volume

2006-09-15 Thread Mehdi Bennani
Hi,


 Try to unmount your volume for each active name space: vnamespace -e [namespace of context xid] umount /your/lvm/volume


Thanks a lot, but my lv's are the root of each vserver so I have to stop them before umounting, then the namespace is no longer in use and I get:
vnamespace: vc_enter_namespace(): No such process


Obviously if I try it before stopping the vserver, I get:umount: /vservers/vtest3: device is busy

Regards,


Mehdi

___
Vserver mailing list
Vserver@list.linux-vserver.org
http://list.linux-vserver.org/mailman/listinfo/vserver


[Vserver] advanced routing per vps

2006-09-15 Thread Rik Bobbaers

heya all,

since yesterday , i found it necessary to do my routing per vserver.
so what did i do: (i put everything in /usr/local btw ;))

gandalf:~# cat /usr/local/etc/vservers/.defaults/scripts/pre-start
#!/bin/sh

HOSTNAME=$2

IF=`cat /usr/local/etc/vservers/${HOSTNAME}/interfaces/0/dev`
IP=`cat /usr/local/etc/vservers/${HOSTNAME}/interfaces/0/ip`
NETMASK=`cat /usr/local/etc/vservers/${HOSTNAME}/interfaces/0/prefix`
# this is the case on all our networks... might not work for you ;)
GW=`ipcalc -n $IP $NETMASK |grep HostMax:| awk '{print $2}'`
NETWORK=`ipcalc -n $IP $NETMASK |grep Network:| awk '{print $2}'`

ip route add $NETWORK dev $IF table $IF-net
ip route add default via $GW dev $IF table $IF-net
ip rule add from $IP/32 table $IF-net pref 1000
EOF

gandalf:~# cat /usr/local/etc/vservers/.defaults/scripts/post-stop
#!/bin/sh

HOSTNAME=$2

IF=`cat /usr/local/etc/vservers/${HOSTNAME}/interfaces/0/dev`
IP=`cat /usr/local/etc/vservers/${HOSTNAME}/interfaces/0/ip`

ip rule del from $IP/32 table $IF-net pref 1000
EOF

now... i NEED to have all the interfaces in /etc/iproute2/rt_tables to 
make this work (no problem, a routing table per VLAN suits me fine ;))


i also have to make sure the interfaces are all up @ boot (no problem, 
since:

gandalf:~# cat /etc/network/interfaces
# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)

auto lo
iface lo inet loopback

auto eth0.49
iface eth0.49 inet manual
pre-up ifconfig eth0 hw ether 00:15:BA:DC:0D:ED
up ifconfig eth0.49 0.0.0.0 up
auto eth0.164
iface eth0.164 inet manual
pre-up ifconfig eth0 hw ether 00:15:BA:DC:0D:ED
up ifconfig eth0.164 0.0.0.0 up

auto eth1
iface eth1 inet static
address 192.168.28.30
netmask 255.255.254.0
broadcast 192.168.29.255
gateway 192.168.29.254
post-up route add -net 192.168.30.0 netmask 255.255.255.0 gw 
192.168.29.253
pre-down route del -net 192.168.30.0 netmask 255.255.255.0 gw 
192.168.29.253


auto eth2.94
iface eth2.94 inet static
address 134.58.241.34
netmask 255.255.255.0
broadcast 134.58.241.255
auto eth2.95
iface eth2.95 inet manual
up ifconfig eth2.95 0.0.0.0 up

(the static ip on eth2.94 is for allowing nfs in a vps... it seems 
impossible to make the source address for nfs the same as the vps 
address... but that's another problem ;))


i use vlans, so i have to set every vlan UP @ boottime and all guests 
novlandev.


now my questions:
1. the device i have to use for my hosts is: eth2.94, so i put that in 
dev. if i boot my machine, i don't have eth2 up, because the host itself 
doesn't need to have an ip address on that network. if i want to start a 
 vps on eth2.94, and let vserver create the vlan for me, it doesn't 
work if eth2 isn't up... why is that? can't vserver check if eth2 is up, 
and if it's not, then set it up? what's the reason for that?


sollution: bring up eth2 at boottime without an address and all works 
fine. but this gets us to the next problem...


2. the vps sets up the vlan nicely, sets up networking, scripts make 
sure routing is done fine. but when i set up 2 hosts on the same vlan, 
and i shut down 1 of those vps'es, it REMOVES the vlan dev, and the 
other vps lose their network, while it's still in use!!!


sollution: put a novlandev in each hosts config. BUT (here we go again) 
that means i have to do the vlan config myself again. (not that it's a 
problem, since you can see my interfaces file now).


3. how hard is it to implement a use count or so for those kind of 
things? just check if there are other vps'es using the vlan dev. if 
noone uses it, THEN bring it down. if there are vps'es using the vlan: 
leave it alone. that way, the last vps using the vlan will disable it, 
the first one needing it, will start it.

for ip addresses, we have net.ipv4.conf.all.promote_secondaries=1
something alike for vlan devs would be nice ;)

4. totally different now... the way i start my advanced routing, it 
allways says (except the first time off course):

RTNETLINK answers: File exists
RTNETLINK answers: File exists
(normal, the route to that network exists)
That's the reason i can't delete the routing for the network when i stop 
the vps... others may still need it. and if it allready exists, it's ok 
by me, so that error is just fine.

does anyone have a clean sollution for that?

that's about it for the moment, i think...

just to be clear: it all works fine now... so there is not really a 
problem, just some practical questions!


greetz,

--
harry
aka Rik Bobbaers

K.U.Leuven - LUDIT  -=- Tel: +32 485 52 71 50
[EMAIL PROTECTED] -=- http://harry.ulyssis.org

Work hard and do your best, it'll make it easier for the rest
-- Garfield

Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm

___
Vserver mailing list
Vserver@list.linux-vserver.org
http://list.linux-vserver.org/mailman/listinfo/vserver


Re: [Vserver] lvremove: Can't remove open logical volume

2006-09-15 Thread Christian Affolter

  Try to unmount your volume for each active name space:
  vnamespace -e [namespace of context xid] umount /your/lvm/volume
 
 
Thanks a lot, but my lv's are the root of each vserver so I have to stop 
them before umounting, then the namespace is no longer in use and I get:

vnamespace: vc_enter_namespace(): No such process

You will have to unmount the lvms in all the _remaining_ name spaces...

Use vserver-stat to list all running vservers (active name spaces) and 
perform vnamespace -e [xid] umount for each one.


___
Vserver mailing list
Vserver@list.linux-vserver.org
http://list.linux-vserver.org/mailman/listinfo/vserver


Re: [Vserver] lvremove: Can't remove open logical volume

2006-09-15 Thread Rik Bobbaers

Mehdi Bennani wrote:


Hi,
Thanks a lot, but my lv's are the root of each vserver so I have to stop 
them before umounting, then the namespace is no longer in use and I get:

vnamespace: vc_enter_namespace(): No such process
 
 
Obviously if I try it before stopping the vserver, I get:

umount: /vservers/vtest3: device is busy


if you stop a vserver, the namespace is gone. so that's never the 
problem. but the OTHER running virtual servers still have the dir 
mounted in its namespace. that's why my script loops over all the 
running namespaces, and unmounts them there.


i just adapted my script to:
gandalf:/var/log# cat /usr/local/bin/unmount_vserver
#!/bin/sh
if [ -n $1 ]
then
  for i in `ls -1 /proc/virtual | egrep -v 'info|status'`; do 
vnamespace -e $i umount $1; done

  umount $1
  exit 0;
fi
exit 1;
EOF

if you use this, you can safely remove the logical volume without having 
that problem.

ps. i have the same setup as you... 1 LV per vserver :)

greetz

--
harry
aka Rik Bobbaers

K.U.Leuven - LUDIT  -=- Tel: +32 485 52 71 50
[EMAIL PROTECTED] -=- http://harry.ulyssis.org

Work hard and do your best, it'll make it easier for the rest
-- Garfield

Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm

___
Vserver mailing list
Vserver@list.linux-vserver.org
http://list.linux-vserver.org/mailman/listinfo/vserver


Re: [Vserver] lvremove: Can't remove open logical volume

2006-09-15 Thread Xavier Montagutelli
On Friday 15 September 2006 11:38, Rik Bobbaers wrote:
 Mehdi Bennani wrote:
  Hi,
  Thanks a lot, but my lv's are the root of each vserver so I have to stop
  them before umounting, then the namespace is no longer in use and I get:
  vnamespace: vc_enter_namespace(): No such process
 
 
  Obviously if I try it before stopping the vserver, I get:
  umount: /vservers/vtest3: device is busy

 if you stop a vserver, the namespace is gone. so that's never the
 problem. but the OTHER running virtual servers still have the dir
 mounted in its namespace. that's why my script loops over all the
 running namespaces, and unmounts them there.
[..]

The first time I encountered this, it took me hours to find the trick ... To 
avoid this sort of problem, there's a patch against util-vserver, called 
namespace cleanup.

You can see this message posted by Daniel Hokka Zakrisson : 
http://archives.linux-vserver.org/200607/0139.html . His web site has this 
patch and some others. The debian package integrates it with others.

Is there any plan to integrate it into the next official version of 
util-vserver ? IMHO, it would be usefull.

PS : thanks to the team who took time to renew the web site !

-- 
Xavier Montagutelli  Tel : +33 (0)5 55 45 77 20
Service Commun Informatique  Fax : +33 (0)5 55 45 75 95
Universite de Limoges
123, avenue Albert Thomas
87060 Limoges cedex
___
Vserver mailing list
Vserver@list.linux-vserver.org
http://list.linux-vserver.org/mailman/listinfo/vserver


Re: [Vserver] ip count

2006-09-15 Thread Chuck
On Friday 15 September 2006 12:21, Bruno wrote:


great. thanks.. makes life lots more simple.

 On Friday 15 September 2006 01:45, Chuck wrote:
  On Thursday 14 September 2006 16:07, Herbert Poetzl wrote:
 
  ok... one quick question... if the host has this patch, must the guest 
have
  it if the guest will not be using more than 1 ip or must all guests match
  the kernel in this patch regardless?  i guess a better way to ask is...
  with the host patched, can i patch only the guests needing more than 16 ip
  addys or must i patch every guest? planning whether i would have to
  provided the template patched or not.
 
 This patch just defines the maximum number of IP addresses that can be 
 assigned to a guest. As the kernel is host-side and guest are pure 
 userspace, guest are not affected at all be the maximum number of IPs it can 
 have. (it's not the guest which selects its IPs anyhow)
 The guest should be able to run correctly in each case.
 
 Bruno
 
 
   On Thu, Sep 14, 2006 at 12:44:30PM -0400, Chuck wrote:
On Thursday 14 September 2006 12:18, Bruno wrote:
   
   
oh .. to complete the explanation on our systems a guest would never
address more than a single /24 but with the limitation that has to be
divided among a gazillion guests instead..
  
   last time I checked, a /24 (or class C network) had 256
   addresses (with 254 usable for ips) not a gazillion :)
  
   this aside, we will add it soon, but you can (for now)
   just apply one of the 64address patches, to kernel and
   tools, as I doubt it will cause much overhead ...
  
   HTH,
   Herbert
  
 On Thursday 14 September 2006 16:27, Chuck wrote:
  someone mentioned the possibility of getting a setup on current
  vserver code that would take a /24 network and not have much if
  any slowdown.. has this ever been realized?

 I did some coding in that direction, but patch is not finished yet.
 Hopefully I will get some more time after next week do continue
 coding on it.

 My direction is assigning address elements to guests, either single
 addresses or groups of addresses as range or mask. When there
 is more than a single such item, on additional is created that
 itentifies the complete range contaning the addresses of a guest.
 Thus two guests with 20 IPs spread over two different /24 networks
 wil be seen as a single range for most check wether IP is part of
 the guest's address-space. Only on match of that outer boundary
 checking of the idividual addresses or the guest is done. Mostly
 missing is the handling of broadcast...

 Bruno
 ___
 Vserver mailing list
 Vserver@list.linux-vserver.org
 http://list.linux-vserver.org/mailman/listinfo/vserver
   
--
   
Chuck
   
...and the hordes of M$*ft users descended upon me in their anger,
and asked 'Why do you not get the viruses or the BlueScreensOfDeath
or insecure system troubles and slowness or pay through the nose
for an OS as *we* do?!!', and I answered...'I use Linux'. 
The Book of John, chapter 1, page 1, and end of book
   
   
___
Vserver mailing list
Vserver@list.linux-vserver.org
http://list.linux-vserver.org/mailman/listinfo/vserver
 ___
 Vserver mailing list
 Vserver@list.linux-vserver.org
 http://list.linux-vserver.org/mailman/listinfo/vserver
 

-- 

Chuck

...and the hordes of M$*ft users descended upon me in their anger,
and asked 'Why do you not get the viruses or the BlueScreensOfDeath
or insecure system troubles and slowness or pay through the nose 
for an OS as *we* do?!!', and I answered...'I use Linux'. 
The Book of John, chapter 1, page 1, and end of book


___
Vserver mailing list
Vserver@list.linux-vserver.org
http://list.linux-vserver.org/mailman/listinfo/vserver


[Vserver] Bug linux-2.6.17.13 ?

2006-09-15 Thread vserver
Hello all

I'm new member on this mailing-list but i use linux-vserver since 2 years.

I've a problem today with kernel-2.6.17.13
patch-2.6.17.13-vs2.1.1-rc34.diff but I am not sure that is in connection
with the patch :

My config :
- debian-3.1 stable + sources backports.
- preceding core : linux-2.6.17.11 patch-2.6.17.11-vs2.1.1-rc29.diff : works
fine with 3 virtual servers.
- hardware : Pentium 805D - 2Go DDRII - MotherBoard : MSI 945P Neo2
- util-vserver-0.30.210
- Compilation without problem BUT just before i can login these messages
appears and are repeated :

Sep 15 09:50:02 srvweb kernel: CPU:1
Sep 15 09:50:02 srvweb kernel: EIP:0060:[]Not tainted VLI
Sep 15 09:50:02 srvweb kernel: EFLAGS: 00010286   (2.6.17.13-vs2.1.1-rc34
#1)
Sep 15 09:50:02 srvweb kernel: EIP is at rest_init+0x3feffd68/0x2f
Sep 15 09:50:02 srvweb kernel: eax: f7636d00   ebx: f73cdf64   ecx: 0003
edx: f7636ed8
Sep 15 09:50:02 srvweb kernel: esi:    edi: f7636d00   ebp: c210d4c0
esp: f73cdedc
Sep 15 09:50:02 srvweb kernel: ds: 007b   es: 007b   ss: 0068
Sep 15 09:50:02 srvweb kernel: Process ps (pid: 1982[#1],
threadinfo=f73cc000 task=c2146580)
Sep 15 09:50:02 srvweb kernel: Stack: c015b5b4 f74f4738 f73cdf64 
c015b615  f73cdf64 f73cdf04
Sep 15 09:50:02 srvweb kernel:f73cc000 c015b68d f74f0090 c210d4c0
f73cdf24 0004 f7be1880 0001
Sep 15 09:50:02 srvweb kernel:0001  c0332600 f7be1880
0041 c0332600 c01858cb f6ff4000
Sep 15 09:50:02 srvweb kernel: Call Trace:
Sep 15 09:50:02 srvweb kernel:  c015b5b4 generic_fillattr+0xd4/0x10e
c015b615 vfs_getattr+0x27/0x75
Sep 15 09:50:02 srvweb kernel:  c015b68d vfs_stat_fd+0x2a/0x3c  c01858cb
show_tty_driver+0x146/0x14f
Sep 15 09:50:02 srvweb kernel:  c01c52b7 copy_to_user+0x33/0x3b
c018144d proc_delete_inode+0x0/0x84
Sep 15 09:50:02 srvweb kernel:  c015bc30 sys_stat64+0xf/0x23  c010269f
sysenter_past_esp+0x54/0x75
Sep 15 09:50:02 srvweb kernel: Code:  Bad EIP value.
Sep 15 09:50:02 srvweb kernel: EIP: [] rest_init+0x3feffd68/0x2f
SS:ESP 0068:f73cdedc
Sep 15 09:50:04 srvweb kernel:  1BUG: unable to handle kernel NULL pointer
dereference at virtual address 
Sep 15 09:50:04 srvweb kernel:  printing eip:
Sep 15 09:50:04 srvweb kernel: 
Sep 15 09:50:04 srvweb kernel: *pde = 
Sep 15 09:50:04 srvweb kernel: Oops:  [#2]
Sep 15 09:50:04 srvweb kernel: PREEMPT SMP
Sep 15 09:50:04 srvweb kernel: Modules linked in: ipt_iprange iptable_filter
ip_tables x_tables dm_mod w83627ehf i2c_isa dummy ipv6
r8169 rtc

Can anybody helps ?
Thanks by advance and excuse me but i'm not very fluent in english :-)

Patrick



___
Vserver mailing list
Vserver@list.linux-vserver.org
http://list.linux-vserver.org/mailman/listinfo/vserver


Re: [Vserver] Bug linux-2.6.17.13 ?

2006-09-15 Thread Daniel Hokka Zakrisson

[EMAIL PROTECTED] wrote:

Hello all

I'm new member on this mailing-list but i use linux-vserver since 2 years.

I've a problem today with kernel-2.6.17.13
patch-2.6.17.13-vs2.1.1-rc34.diff but I am not sure that is in connection
with the patch :


Yep, a test delta slipped in without getting cleaned up. To fix it, you 
could either revert (patch -Rp1) 
http://vserver.13thfloor.at/Experimental/delta-vroot-feat01.diff or add 
http://people.linux-vserver.org/~dhozac/p/k/delta-vroot-hack01.diff to 
your kernel and rebuild.


--
Daniel Hokka Zakrisson
GPG id: 06723412
GPG fingerprint: A455 4DF3 990A 431F FECA  7947 6136 DDA2 0672 3412
___
Vserver mailing list
Vserver@list.linux-vserver.org
http://list.linux-vserver.org/mailman/listinfo/vserver