Proxmox 2.3 don't use mount script

fthouvenin

New Member
May 12, 2013
5
0
1
Paris, France
kheb.fr
Hi !

I am running proxmox 2.3.

Since I installed proxmox on a new server I definitely can't use mount and unmount script on a container and I don't know why. Proxmox just doesn't read those scripts.

Here are the 2 scripts with +x rights :
Code:
[root@prox /etc/vz/conf]$ l total 16K
-rwxr-xr-x 1 root root 180 May  6 03:03 100.mount
-rwxr-xr-x 1 root root 145 May  6 02:44 100.umount
-rwxr-xr-x 1 root root  97 May 11 19:00 103.mount
-rwxr-xr-x 1 root root  89 May 11 18:52 103.umount

I simplified the scripts to the most.

103.mount :
Code:
#!/bin/bash
. /etc/vz/vz.conf
. ${VE_CONFFILE}

mount --bind /mnt/share /var/lib/vz/root/103/mnt

103.umount :
Code:
#!/bin/bash
. /etc/vz/vz.conf
. ${VE_CONFFILE}

umount /var/lib/vz/root/103/mnt/

exit 0

If I restart the contener 103 :
Code:
[root@prox /etc/vz/conf]$ vzctl --verbose restart 103
Restarting container
Stopping container ...
Container was stopped
Container is unmounted
Starting container ...
Container is mounted
Running container script: /etc/vz/dists/scripts/debian-add_ip.sh
Setting CPU units: 1000
Setting CPUs: 1
Running container script: /etc/vz/dists/scripts/debian-set_hostname.sh
Running container script: /etc/vz/dists/scripts/set_dns.sh
Running container script: /etc/vz/dists/scripts/set_ugid_quota.sh
Configure veth devices: veth103.0
Adding interface veth103.0 to bridge vmbr2 on CT0 for CT103
Container start in progress...
[root@prox /etc/vz/conf]$

Here we see that proxmox didn't read the 103.mount.. If I enter in the conterner, the directory "share" is not mounted.

So I tried the command line directly in my shell :
Code:
mount --bind /mnt/share /var/lib/vz/root/103/mnt

... and it works. I also tried "mount -n --bind" and so other things... I'm run out of ideas.

So, if you have any suggestions as to how I can fix this. Thanks!
 
It works perfect here.

Your 103.mount misses and exit code maybe this is why it is failing if the startup command checks the return code (AFAIK a script without returning a exit code will never satisfy [ $? -eq 0 ] && success)
 
what is the output of

# ls -l /etc/vz/conf

Code:
[root@prox ~]$ ls -l /etc/vz/conf
total 20
-rwxr-xr-x 1 root root 180 May  6 03:03 100.mount
-rwxr-xr-x 1 root root 145 May  6 02:44 100.umount
-rwxr-xr-x 1 root root  97 May 11 19:00 103.mount
-rwxr-xr-x 1 root root  89 May 11 18:52 103.umount
-rwxr-xr-x 1 root root 205 May 12 21:30 110.mount
[root@prox ~]$

It works perfect here.

Your 103.mount misses and exit code maybe this is why it is failing if the startup command checks the return code (AFAIK a script without returning a exit code will never satisfy [ $? -eq 0 ] && success)

I also tried this and same problem. :\

Thanks
 
what is the output of

# ls -l /etc/vz/conf

Code:
[root@prox ~]$ ls -l /etc/vz/conf
total 20
-rwxr-xr-x 1 root root 180 May  6 03:03 100.mount
-rwxr-xr-x 1 root root 145 May  6 02:44 100.umount
-rwxr-xr-x 1 root root  97 May 11 19:00 103.mount
-rwxr-xr-x 1 root root  89 May 11 18:52 103.umount
-rwxr-xr-x 1 root root 205 May 12 21:30 110.mount


It works perfect here.

Your 103.mount misses and exit code maybe this is why it is failing if the startup command checks the return code (AFAIK a script without returning a exit code will never satisfy [ $? -eq 0 ] && success)

Yep, I also tried this.... :/

Thanks
 
I think you need to actually stop/shutdown the container for it to pay attention to action scripts on its next boot, a restart as you did wont cut it. Its what Id try anyway.
 
Thanks for your reply Mo_.

I already tried to stop/shutdown/restart and restart the host... same effect.

After a shutdown of container 110 :

Code:
[root@prox ~]$ ls -lh /etc/vz/conf.org/
total 4.0K
-rwxr-xr-x 1 root root 222 May 19 20:06 110.mount
[root@prox ~]$ cat /etc/vz/conf.org/110.mount
#!/bin/bash

. /etc/vz/vz.conf
. ${VE_CONFFILE}

SRC=/home/data/vz/110/files/home/vmail
DST=/home/vmail

if [ ! -e ${VE_ROOT}${DST} ]; then mkdir -p ${VE_ROOT}${DST}; fi
mount -n -t simfs ${SRC} ${VE_ROOT}${DST} -o ${SRC}
[root@prox ~]$ vzctl --verbose start 110
Starting container ...
Container is mounted
Running container script: /etc/vz/dists/scripts/debian-add_ip.sh
Setting CPU units: 1000
Setting CPUs: 2
Running container script: /etc/vz/dists/scripts/debian-set_hostname.sh
Running container script: /etc/vz/dists/scripts/set_dns.sh
Running container script: /etc/vz/dists/scripts/set_ugid_quota.sh
Configure veth devices: veth110.0
Adding interface veth110.0 to bridge vmbr2 on CT0 for CT110
Container start in progress...
[root@prox ~]$ vzctl enter 110
entered into CT 110
dircolors: no SHELL environment variable, and no shell type option given
[root@smtp /]$ ls -lh /home/vmail/
total 0
[root@smtp /]$ ^C
exited from CT 110
[root@prox ~]$ ^C
[root@prox ~]$ ls -lh /home/data/vz/110/files/home/vmail
total 16K
drwx------ 3 3000 3000 4.0K Feb  9 17:55 ********.fr
drwx------ 5 3000 3000 4.0K Feb 11 21:07 ****.fr
drwxr-x--- 3 3000 3000 4.0K Jun 30  2012 sieve
drwx------ 3 3000 3000 4.0K Feb 18 23:25 ****fr
[root@prox ~]$

It's very strange...
 
First, a quick side-note:

It works perfect here.Your 103.mount misses and exit code maybe this is why it is failing if the startup command checks the return code (AFAIK a script without returning a exit code will never satisfy [ $? -eq 0 ] && success)

Every Linux process (as well as processes on any other POSIX-compliant system) will return an exit code, and it actually defaults to 0. The only time you need to specify an exit status is when you need it to be non-zero (and they can only be within the 0-255 range; no negative status codes!). Just FYI.

I just update my installation to Proxmox 3 RC2 and I have exactly the same problem. But I thought it could solve it...

While staying up to date is always a good idea, you seem to have missed this comment:

Directory /etc/vz/conf should be a symlink to /etc/pve/openvz - please can you check that?

Upgrading (by itself) probably won't be able to properly fix this for you. I'm pretty sure you don't have /etc/vz/conf symlinked to /etc/pve/openvz because the latter is where your VM config files would be, and they aren't showing up in the outputs of ls you've posted. The solution here would be to move the scripts over to the /etc/pve/openvz directory, then remove the /etc/vz/conf directory, replacing it with a symlink back to /etc/pve/openvz. Like so:

Code:
mv /etc/vz/conf/* /etc/pve/openvz/
rmdir /etc/vz/conf
ln -s /etc/pve/openvz /etc/vz/conf

That should help, at least, if not solve your problem outright.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!