0

I have a PXE/NFS Server (192.168.1.10), a client PC and a diskless PC. I installed base ubuntu 12.04 to client PC. I wrote this script (update.sh) to work after login to client PC.

SERVER=192.168.1.10
echo "Copying files"
mount $SERVER:/srv/nfs/updatefiles  ~/nfs
cp ~/nfs/file.txt ~/texts/
umount ~/nfs
echo "Reconfigure SSH"
dpkg-reconfigure openssh-server
echo "Completed"

I changed chown and chmod and added permission at the end of the sudoers.

sudo chown root:root ~/updatefiles/update.sh
sudo chmod 700 ~/updatefiles/update.sh
sudo nano /etc/sudoers
- hduser ALL=(ALL) NOPASSWD:/home/hduser/updatefiles/update.sh

I created .bash_profile to invoke this script after login.

sudo nano ~/.bash_profile
- sudo $HOME/updatefiles/update.sh

It works correctly after reboot client PC. Then I created a linux live cd (ubuntu.iso) from client PC with using Relinux (an implement of remastersys). I copied ubuntu.iso to NFS server and booted diskless PC via PXE/NFS. I'm getting this error message after login to diskless PC.

Copying files
mount.nfs: /home/hduser/nfs is busy or already mounted
umount.nfs: /home/hduser/nfs: device is busy
debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable.
Completed

Sometimes NFS mount works and sometimes reconfigure SSH works but mostly I'm getting this error. I added sleep 5 to top of the script to make it work but I got same error message again. It works correctly when I invoke update.sh by hand after login completed. What is causing this error? Thanks for any help.

1 Answer 1

0

I run this script as Radu explained here. It will run mount command every 3 seconds because some processes are keeping files open for writing :

while :; do mount $SERVER:/srv/nfs/updatefiles ~/nfs && break || sleep 3; done

Lazy unmount after everything done:

umount -l ~/nfs

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .