DaemonForums  

Go Back   DaemonForums > FreeBSD > FreeBSD Installation and Upgrading

FreeBSD Installation and Upgrading Installing and upgrading FreeBSD.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 14th November 2008
PeterSteele PeterSteele is offline
Port Guard
 
Join Date: Jul 2008
Posts: 43
Thanked 0 Times in 0 Posts
Default What are rules about adding commands to mfsroot?

We're doing a scripted sysinstall via a PXE boot server and need to add some commands to the mfsroot image. I've done some quick experiments though and it doesn't seem we can use standard FreeBSD binaries. In looking at the commands that are included in mfsroot by default I see that they are all the same size, so clearly there is something special about them.

I've added a couple of commands that we need but when these are run through the install.cfg "system" command, they fail. However, if I exit from sysinstall and enter a live shell, the commands appear to work fine.

So, is there anyway to add additional FreeBSD commands to the mfsroot image that can be run though install.cfg?
Reply With Quote
  #2   (View Single Post)  
Old 16th November 2008
PeterSteele PeterSteele is offline
Port Guard
 
Join Date: Jul 2008
Posts: 43
Thanked 0 Times in 0 Posts
Default

I've had no success with this. Has no one out there added any commands to the mfsroot image?

And why is it that the new commands won't run through the automated sysinstall but if I open a fixit shell they run fine?
Reply With Quote
  #3   (View Single Post)  
Old 16th November 2008
J65nko J65nko is online now
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 3,140
Thanked 182 Times in 149 Posts
Default

I have never done this with FreeBSD, only something not quite similar with OpenBSD.
Unless sysinstall runs in a chroot, your filesystems could be mounted on something different then "/".
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump
Reply With Quote
  #4   (View Single Post)  
Old 16th November 2008
PeterSteele PeterSteele is offline
Port Guard
 
Join Date: Jul 2008
Posts: 43
Thanked 0 Times in 0 Posts
Default

The ramdisk that's created from mfsroot (/dev/md0) is mounted as root (/), and the CD-ROM (/dev/cd0) as /dist. I have no problem running any of the commands that are provided by default in this image, during the automated sysinstall session. It's just the new commands I add that won't run. But these do run fine if I open a fixit shell, or if I invoke sysinstall manually while in the fixit shell. It's a mystery why these commands won't run during the automated sysinstall.
Reply With Quote
  #5   (View Single Post)  
Old 16th November 2008
bsddaemon bsddaemon is offline
Slack Daemon
 
Join Date: Oct 2008
Posts: 35
Thanked 3 Times in 3 Posts
Default

I remember the fixit root dir is /mnt2, does this make any difference with your added commands?
__________________
...then the God created man...
Reply With Quote
  #6   (View Single Post)  
Old 16th November 2008
J65nko J65nko is online now
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 3,140
Thanked 182 Times in 149 Posts
Default

Could it have something to do with the 'hash' or 'rehash' commands which are sometimes needed in FreeBSD shells.
Remember the classic example where somebody does a successful pkg_add of firefox and then wonders why the invocation firefox & doesn't work
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump
Reply With Quote
  #7   (View Single Post)  
Old 16th November 2008
PeterSteele PeterSteele is offline
Port Guard
 
Join Date: Jul 2008
Posts: 43
Thanked 0 Times in 0 Posts
Default

It's not a case of rehashing. I physically add the new commands to the raw mfsroot image, in an entirely separate session. Then I replace the mfsroot file on the FreeBSD 7.0 CD-ROM and boot the test box with this new CD-ROM. It boots up as it normally does, automatically running sysinstall.

Ordinarily it would leave you in the sysinstall main menu, but I've also created an install.cfg on the CD-ROM, and when sysinstall sees this file, it runs the commands it finds in this file. One of the commands is a request to run a shell script I've created and stored in /stand in the mfsroot ramdisk. This script is supposed to run some commands to perform some preinstall actions I need. The script runs fine, and the commands in the script run fine as well, as long as they are the default mfsroot binaries. None of the binaries I've added (e.g. gmirror) work however, not during the automated sysinstall run. They work fine though in the fixit shell. The new binaries are in /stand the same as the normal binaries, and I fully qualify the paths.

Surely this is something that's allowed, extending the mfsroot image. I must be missing a trick somewhere.
Reply With Quote
  #8   (View Single Post)  
Old 16th November 2008
tingo tingo is offline
Real Name: Torfinn Ingolfsen
Port Guard
 
Join Date: Oct 2008
Location: Oslo, Norway
Posts: 11
Thanked 1 Time in 1 Post
Default

You have of course checked the simple things; are all your binaries executable (you know chmod +x ...)?
Second things: you say they work in a fixit shell: is this with the fixit CD in place? If so, perhaps your binaries uses dynamic libraries? I'm guessing that wouldn't do well in the mfsroot image; all programs mus be statically linked there. Or am I wrong about that?
__________________
Torfinn
Reply With Quote
  #9   (View Single Post)  
Old 17th November 2008
PeterSteele PeterSteele is offline
Port Guard
 
Join Date: Jul 2008
Posts: 43
Thanked 0 Times in 0 Posts
Default

I'm thinking the issue may very well be something to do with shared libraries. The commands I've added are not statically linked--they do reference shared libraries. So the question is do binaries added to mfsroot have to be statically linked, or do I simply have to make sure they can locate the referenced libraries. Maybe I just have to make sure LD_LIBRARY_PATH is set. I'll have to give this a try.
Reply With Quote
Old 17th November 2008
J65nko J65nko is online now
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 3,140
Thanked 182 Times in 149 Posts
Default

Under OpenBSD I use a so-called install.site customization script, which is run by the installer at the end of the OBSD install.
When I add binary packages with the OBSD pkg_add, I first initialize the share library cache with the following
Code:
echo Configure shared library cache with code stolen from "/etc/rc"
echo Assuming you did not override the empty  'shlib_dirs' from '/etc/rc.conf' in '/etc/rc.co
nf.local'

if [ -f /sbin/ldconfig ]; then
        echo 'creating runtime link editor directory cache.'
        if [ -d /usr/local/lib ]; then
                shlib_dirs="/usr/local/lib $shlib_dirs"
        fi
        if [ -d /usr/X11R6/lib ]; then
                shlib_dirs="/usr/X11R6/lib $shlib_dirs"
        fi
        ldconfig $shlib_dirs
fi
BTW You also could print out the the environment with env(1) and see what are the differences.
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump
Reply With Quote
Old 17th November 2008
PeterSteele PeterSteele is offline
Port Guard
 
Join Date: Jul 2008
Posts: 43
Thanked 0 Times in 0 Posts
Default

Unfortunately this represents the old chicken and egg problem. The mfsroot image does not have ldconfig, not even env for that matter. I can use "set" though to give me more or less the same information as "env". It's not as easy to get ldconfig to work, because if I could get ldconfig to work then that would imply I'd have to solution to why gmirror doesn't work....

Last edited by PeterSteele; 17th November 2008 at 04:08 PM.
Reply With Quote
Old 18th November 2008
J65nko J65nko is online now
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 3,140
Thanked 182 Times in 149 Posts
Default

Maybe you should take another strategy. Maybe the one described in http://daemonforums.org/showthread.php?t=1538 ?
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump
Reply With Quote
Old 18th November 2008
PeterSteele PeterSteele is offline
Port Guard
 
Join Date: Jul 2008
Posts: 43
Thanked 0 Times in 0 Posts
Default

Yeah, I've been coming to the same conclusion. A tool like sysinstall is useful, but it's not essential for installing FreeBSD. We may very well have to go with a custom installation process like is described in this thread.

Thanks for the feedback. Looks like I know what I need to do now.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding drives annoys OpenBSD. diw OpenBSD General 4 4th September 2008 02:14 AM
Adding a separate /home JMJ_coder NetBSD General 2 29th August 2008 10:45 AM
Having trouble adding 7.0 to GRUB 0.97 Arenlor FreeBSD General 4 26th June 2008 01:02 AM
Adding multiple lines into file c0mrade Programming 4 7th June 2008 11:03 PM
adding new disk -> wrong node? knasbas OpenBSD General 6 23rd May 2008 03:10 AM


All times are GMT. The time now is 10:09 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick