Mount From a Post-Install Script...
Autoinstall gurus, I'm trying to mount an NFS share from a post-install script and it's failing with the error "mount: only root can do that". I threw a call to id in the script and it reports "uid=0(root) gid=0(root)", so I'm a little baffled. The mount can be performed manually during the install or after completion with no problem. Here's the relevant part of my XML configuration file (server IP faked): -------------------- <![CDATA[#!/bin/sh mkdir /mnt/resources id mount 1.2.3.4:/autoinst/SuSE9.0 /mnt/resources for MYSCRIPT in /mnt/resources/scripts/generic/A*; do $MYSCRIPT done > /var/adm/autoinstall/logs/generic.log 2>&1 umount /mnt/resources]]> -------------------- Does anybody have an idea what the issue could be? I need it to happen after the RPM installs. I suppose I could throw this in a one-time rc script, but I'd like to understand the underlying issue... Thanks, Roy
On Thursday 03 June 2004 03:37, Roy Butler wrote:
I'm trying to mount an NFS share from a post-install script and it's failing with the error "mount: only root can do that". I threw a call ... I need it to happen after the RPM installs. I suppose I could throw this in a one-time rc script, but I'd like to understand the underlying issue...
http access is possible though, I've done that with SuSE Linux 9.0, and installed a few extra rpms that way (post-scripts). I downloaded the rpms using wget. Cheers, Leen
Hi! What I do is: <![CDATA[#!/bin/sh mount 1.2.3.4:/local_x86 /usr/local rpm -iv /usr/local/SOFTWARE/suse90/*.rpm umount 1.2.3.4:/local_x86 ]]> And it works. Does your mkdir really work? Perhaps /mnt is already mounted by autoyast at that time. Have you tried mounting to another directory? Regards, Andreas On Wed, 2 Jun 2004, Roy Butler wrote:
Autoinstall gurus,
I'm trying to mount an NFS share from a post-install script and it's failing with the error "mount: only root can do that". I threw a call to id in the script and it reports "uid=0(root) gid=0(root)", so I'm a little baffled. The mount can be performed manually during the install or after completion with no problem. Here's the relevant part of my XML configuration file (server IP faked):
--------------------
<![CDATA[#!/bin/sh
mkdir /mnt/resources
id
mount 1.2.3.4:/autoinst/SuSE9.0 /mnt/resources
for MYSCRIPT in /mnt/resources/scripts/generic/A*; do $MYSCRIPT done > /var/adm/autoinstall/logs/generic.log 2>&1
umount /mnt/resources]]>
--------------------
Does anybody have an idea what the issue could be? I need it to happen after the RPM installs. I suppose I could throw this in a one-time rc script, but I'd like to understand the underlying issue...
Thanks, Roy
-- Andreas Vetter Universitaet Wuerzburg, Theoretische Physik 1 Am Hubland, 97074 Wuerzburg, Deutschland / Germany
Andreas, The mkdir doesn't complain and /mnt/resources exists later, but I'll give it a shot under a non-/mnt directory (along with "-t nfs"). I'm thinking it has something strange to do with autoinstall's environment or the security mechanism's possibly changing underneath itself during the run of YaST2.firstboot... Thanks, Roy Andreas Vetter wrote:
Hi!
What I do is:
<![CDATA[#!/bin/sh mount 1.2.3.4:/local_x86 /usr/local rpm -iv /usr/local/SOFTWARE/suse90/*.rpm umount 1.2.3.4:/local_x86 ]]>
And it works. Does your mkdir really work? Perhaps /mnt is already mounted by autoyast at that time. Have you tried mounting to another directory?
Regards, Andreas
On Wed, 2 Jun 2004, Roy Butler wrote:
Autoinstall gurus,
I'm trying to mount an NFS share from a post-install script and it's failing with the error "mount: only root can do that". I threw a call to id in the script and it reports "uid=0(root) gid=0(root)", so I'm a little baffled. The mount can be performed manually during the install or after completion with no problem. Here's the relevant part of my XML configuration file (server IP faked):
--------------------
<![CDATA[#!/bin/sh
mkdir /mnt/resources
id
mount 1.2.3.4:/autoinst/SuSE9.0 /mnt/resources
for MYSCRIPT in /mnt/resources/scripts/generic/A*; do $MYSCRIPT done > /var/adm/autoinstall/logs/generic.log 2>&1
umount /mnt/resources]]>
--------------------
Does anybody have an idea what the issue could be? I need it to happen after the RPM installs. I suppose I could throw this in a one-time rc script, but I'd like to understand the underlying issue...
Thanks, Roy
On Thursday 03 June 2004 18:55, Roy Butler wrote:
The mkdir doesn't complain and /mnt/resources exists later, but I'll give it a shot under a non-/mnt directory (along with "-t nfs").
I'm thinking it has something strange to do with autoinstall's environment or the security mechanism's possibly changing underneath itself during the run of YaST2.firstboot...
Be creative in you script, try to generate some debugging output. Afterwards, have a look in /var/adm/autoinstall/logs, and perhaps /var/log/{YaST2,messages,warn}. Cheers, Leen
Leen, Yeah, that describes the process and where I've been looking. Roy Leendert Meyer wrote:
On Thursday 03 June 2004 18:55, Roy Butler wrote:
The mkdir doesn't complain and /mnt/resources exists later, but I'll give it a shot under a non-/mnt directory (along with "-t nfs").
I'm thinking it has something strange to do with autoinstall's environment or the security mechanism's possibly changing underneath itself during the run of YaST2.firstboot...
Be creative in you script, try to generate some debugging output. Afterwards, have a look in /var/adm/autoinstall/logs, and perhaps /var/log/{YaST2,messages,warn}.
Cheers,
Leen
On Thursday 03 June 2004 22:06, Roy Butler wrote:
Leen,
Yeah, that describes the process and where I've been looking.
I could have known, I overlooked the 'id'... ;) what about (needs wget on the client): cd /usr/local/mnt wget http://1234/scripts.tar.bz2 tar xvfj scripts.tar.bz2 for A in ... You only need to create a tarball, and expose it on your webserver. But I guess nfs is easier because you don't have to create a tarball? or cd /usr/local/mnt/scripts wget -O- http://1.2.3.4/scriptlocs.txt | wget -i- chmod +x * for A in ... The file scriptlocs.txt contains the URL's of the script and needs to be up-to-date. or rsync might be another option, it can download a directory with attributes conserved. You can choose to import over ssh (need to sneak in an ssh key first though...), or over the rsync port (man rsync). Cheers, Leen
Leen, I just went with creating an autoinstall post-script which creates a number of one-time-running, self-deleting, high-numbered /etc/init.d/rc3.d S scripts that run following AutoYaST's work after the first reboot. It's sort of like what I'm familiar with from our Solaris JumpStart configuration, so I'm already just about done. :) Thanks, Roy Leendert Meyer wrote:
On Thursday 03 June 2004 22:06, Roy Butler wrote:
Leen,
Yeah, that describes the process and where I've been looking.
I could have known, I overlooked the 'id'... ;)
what about (needs wget on the client):
cd /usr/local/mnt wget http://1234/scripts.tar.bz2 tar xvfj scripts.tar.bz2 for A in ...
You only need to create a tarball, and expose it on your webserver. But I guess nfs is easier because you don't have to create a tarball?
or
cd /usr/local/mnt/scripts wget -O- http://1.2.3.4/scriptlocs.txt | wget -i- chmod +x * for A in ...
The file scriptlocs.txt contains the URL's of the script and needs to be up-to-date.
or
rsync might be another option, it can download a directory with attributes conserved. You can choose to import over ssh (need to sneak in an ssh key first though...), or over the rsync port (man rsync).
Cheers,
Leen
-- Roy Butler - MIST Development Environment Jet Propulsion Laboratory email: roy.butler@jpl.nasa.gov phone: 818-354-8825
Roy Butler wrote:
Leen,
I just went with creating an autoinstall post-script which creates a number of one-time-running, self-deleting, high-numbered /etc/init.d/rc3.d S scripts that run following AutoYaST's work after the first reboot. It's sort of like what I'm familiar with from our Solaris JumpStart configuration, so I'm already just about done. :)
This is a new feature in SLES9 btw ;-) We have added a new type of scripts which is run during the boot process. Anas
Thanks, Roy
Leendert Meyer wrote:
On Thursday 03 June 2004 22:06, Roy Butler wrote:
Leen,
Yeah, that describes the process and where I've been looking.
I could have known, I overlooked the 'id'... ;)
what about (needs wget on the client):
cd /usr/local/mnt wget http://1234/scripts.tar.bz2 tar xvfj scripts.tar.bz2 for A in ...
You only need to create a tarball, and expose it on your webserver. But I guess nfs is easier because you don't have to create a tarball?
or
cd /usr/local/mnt/scripts wget -O- http://1.2.3.4/scriptlocs.txt | wget -i- chmod +x * for A in ...
The file scriptlocs.txt contains the URL's of the script and needs to be up-to-date.
or
rsync might be another option, it can download a directory with attributes conserved. You can choose to import over ssh (need to sneak in an ssh key first though...), or over the rsync port (man rsync).
Cheers,
Leen
Everyone, The mount command is still complaining. Here's the extended relevant section of my XML file (including the additions and a slightly changed server share): --------------- <post-scripts config:type="list"> <script> <filename>start-generic</filename> <interpreter>shell</interpreter> <source> <![CDATA[#!/bin/sh /bin/mkdir -p /usr/local/mnt/resources /usr/bin/id /bin/mount -t nfs 1.2.3.4:/export/install/SuSE9.0 /usr/local/mnt/resources for MYSCRIPT in /usr/local/mnt/resources/scripts/generic/A*; do $MYSCRIPT done > /var/adm/autoinstall/logs/generic.log 2>&1 /bin/umount /usr/local/mnt/resources]]> </source> </script> </post-scripts> --------------- and here's the ouput from /var/adm/autoinstall/logs/start-generic.log: --------------- + /bin/mkdir -p /usr/local/mnt/resources + /usr/bin/id uid=0(root) gid=0(root) + /bin/mount -t nfs 1.2.3.4:/export/install/SuSE9.0 /usr/local/mnt/resources mount: only root can do that + /bin/umount /usr/local/mnt/resources umount: /usr/local/mnt/resources is not mounted (according to mtab) --------------- and /var/adm/autoinstall/logs/generic.log: --------------- + '/usr/local/mnt/resources/scripts/generic/A*' /var/adm/autoinstall/scripts/start-generic: line 10: /usr/local/mnt/resources/scripts/generic/A*: No such file or directory --------------- I know how to do this in rc scripts and I'm not a purist, so I'm moving on (to an rc script). :) Maybe I failed to notice something in the docs or I've missed the same typo 10 times in a row, but this script works fine run manually post-install so there may be more to it... Thanks everyone for your ideas! Roy Roy Butler wrote:
Andreas,
The mkdir doesn't complain and /mnt/resources exists later, but I'll give it a shot under a non-/mnt directory (along with "-t nfs").
I'm thinking it has something strange to do with autoinstall's environment or the security mechanism's possibly changing underneath itself during the run of YaST2.firstboot...
Thanks, Roy
Andreas Vetter wrote:
Hi!
What I do is:
<![CDATA[#!/bin/sh mount 1.2.3.4:/local_x86 /usr/local rpm -iv /usr/local/SOFTWARE/suse90/*.rpm umount 1.2.3.4:/local_x86 ]]>
And it works. Does your mkdir really work? Perhaps /mnt is already mounted by autoyast at that time. Have you tried mounting to another directory?
Regards, Andreas
On Wed, 2 Jun 2004, Roy Butler wrote:
Autoinstall gurus,
I'm trying to mount an NFS share from a post-install script and it's failing with the error "mount: only root can do that". I threw a call to id in the script and it reports "uid=0(root) gid=0(root)", so I'm a little baffled. The mount can be performed manually during the install or after completion with no problem. Here's the relevant part of my XML configuration file (server IP faked):
--------------------
<![CDATA[#!/bin/sh
mkdir /mnt/resources
id
mount 1.2.3.4:/autoinst/SuSE9.0 /mnt/resources
for MYSCRIPT in /mnt/resources/scripts/generic/A*; do $MYSCRIPT done > /var/adm/autoinstall/logs/generic.log 2>&1
umount /mnt/resources]]>
--------------------
Does anybody have an idea what the issue could be? I need it to happen after the RPM installs. I suppose I could throw this in a one-time rc script, but I'd like to understand the underlying issue...
Thanks, Roy
Hi, This has been reported once in the past, but I was never able to reproduce it. Some debug info would be really helpful so we can fix it if it is a bug somewhere.. Anas Roy Butler wrote:
Autoinstall gurus,
I'm trying to mount an NFS share from a post-install script and it's failing with the error "mount: only root can do that". I threw a call to id in the script and it reports "uid=0(root) gid=0(root)", so I'm a little baffled. The mount can be performed manually during the install or after completion with no problem. Here's the relevant part of my XML configuration file (server IP faked):
--------------------
<![CDATA[#!/bin/sh
mkdir /mnt/resources
id
mount 1.2.3.4:/autoinst/SuSE9.0 /mnt/resources
for MYSCRIPT in /mnt/resources/scripts/generic/A*; do $MYSCRIPT done > /var/adm/autoinstall/logs/generic.log 2>&1
umount /mnt/resources]]>
--------------------
Does anybody have an idea what the issue could be? I need it to happen after the RPM installs. I suppose I could throw this in a one-time rc script, but I'd like to understand the underlying issue...
Thanks, Roy
Hi Anas, In my autoinstall post-script (shell) for SuSE 9 Intel, both of the following resulted in "mount: only root can do that": mount 1.2.3.4:/autoinst/SuSE9.0 /mnt/resources mount -t nfs 1.2.3.4:/autoinst/SuSE9.0 /usr/local/mnt/ The local directories had been created. The file server (Solaris 8 SPARC) definitely was available; a similar share gets used during the install for the root disk and RPMs. I could do all of this fine at the post-script time, by switching to a VT and typing it. So, I threw in a call to id, which verified I was root:root. Near the end, I spelled out the full paths to everything, which had no effect. The last thing I tried just for kicks before going to rc scripts, was to wrap the call to mount in su, which resulted in "/bin/su: cannot set groups: Operation not permitted": su - root -c "mount -t nfs 1.2.3.4:/autoinst/SuSE9.0 /usr/local/mnt/" If it matters, I'm booting the client off of a standard CD1, with a "hostip=... netmask=... gateway=... install=nfs... autoyast=tftp..." and I've customized the root disk to include iptables, which gets initialized in a autoinstall pre-script (shell) to only allow access between between the two systems involved. Since this environment goes away with the reboot preceding post-scripts (if I remember correctly), I'm guessing it's irrelevant, but that's the whole picture. That's all I have. Hope it helps. If I made a mistake, I hope it wasn't too obvious. :) I'm going fine now with the rc scripts... Roy Anas Nashif wrote:
Hi, This has been reported once in the past, but I was never able to reproduce it. Some debug info would be really helpful so we can fix it if it is a bug somewhere..
Anas
Roy Butler wrote:
Autoinstall gurus,
I'm trying to mount an NFS share from a post-install script and it's failing with the error "mount: only root can do that". I threw a call to id in the script and it reports "uid=0(root) gid=0(root)", so I'm a little baffled. The mount can be performed manually during the install or after completion with no problem. Here's the relevant part of my XML configuration file (server IP faked):
--------------------
<![CDATA[#!/bin/sh
mkdir /mnt/resources
id
mount 1.2.3.4:/autoinst/SuSE9.0 /mnt/resources
for MYSCRIPT in /mnt/resources/scripts/generic/A*; do $MYSCRIPT done > /var/adm/autoinstall/logs/generic.log 2>&1
umount /mnt/resources]]>
--------------------
Does anybody have an idea what the issue could be? I need it to happen after the RPM installs. I suppose I could throw this in a one-time rc script, but I'd like to understand the underlying issue...
Thanks, Roy
-- Roy Butler - MIST Development Environment Jet Propulsion Laboratory email: roy.butler@jpl.nasa.gov phone: 818-354-8825
participants (4)
-
Anas Nashif
-
Andreas Vetter
-
Leendert Meyer
-
Roy Butler