Question

Locked

Dumb Linux question: chroot and lilo

By CharlieSpencer ·
Dumb question about the following commands, which will be entered in the sequence shown. /dev/sda1 is a flash media card.

NAME:~# mount -t ext3 /dev/sda1 /mnt/sda1
NAME:~# chroot /mnt/sda1
NAME:/# lilo ?v 3 ?C etc/lilo.config

In the lilo command, does etc/lilo.config refer to a file on in the /etc directory on the /mnt/sda1 root or back on the original root /dev/hda1 partition?

This conversation is currently closed to new comments.

8 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Collapse -

Sorry it took so long....

by CaptBilly1Eye In reply to Dumb Linux question: chro ...

I passed your question along to my resident penguin at the office, and this is what he said;

"Line 3 does reference etc/lilo.config? however, the file is not normally called lilo.config (is your friend using a non-standard config file and that is why you are listing it explicitly?). the lilo command will look for config information (by default with no switch specification) to /etc/lilo.conf The command that you have is pointing to etc/lolo.config (it?s missing a forward slash at the beginning of etc and is asking for ?config? to be the extention which may be a file that does not exist)

Overall, it looks like you are trying to make a flashcard bootable? If so, I?m not sure of the steps you will need to take but (for some reason) the steps you are trying don?t feel right to me. The following seems more appropriate for making a CF card bootable:
http://www.heber.co.uk/pdfdownloads/embedded_linux_tips/flash_booting.html

To answer your initial question? because we?re chrooted to the media card (assuming the mount and chroot didn?t fail), the 3rd line is attempting to use /mnt/sda1/etc/lilo.config (although, I?m not sure this is a valid command as there is no leading forward slash after the ?-C? and before the ?etc/lilo.config? so it may not be a valid path)."


Hope this helps.

Collapse -

you got that.

by Jaqui In reply to Sorry it took so long....

It should be /etc/lilo.conf

and yes, it's pointing at the attached flash drive.

a simpler option would be to get something like the installer for a flash drive from Mandriva, which will install the distro onto the drive.

Collapse -

Thanks.

by CharlieSpencer In reply to you got that.

Yes, I'm attempting to make a bootable flash card. I'm adapting an existing documented procedure written by someone who is no longer with the company, and being used on a computer at another location. My point of contact there says, "Well, that's the procedure and it works for us", giving me the impression he knows even less about Linux than I do. I had a more knowledgeable person check that machine and there is no lilo.config file on it, so I suspect the procedure has a typo.

If you're really bored and want the full background story, see:

http://techrepublic.com.com/5208-6230-0.html?forumID=101&threadID=270153

and

http://techrepublic.com.com/5208-6230-0.html?forumID=101&threadID=271142

Collapse -

Okay, dumb follow-up lilo.conf question

by CharlieSpencer In reply to Dumb Linux question: chro ...

NAME:~# chroot /mnt/sda1
NAME:/# lilo ?v 3 ?C /etc/lilo.conf

/mnt/sda1/etc/lilo.conf contains the lines

boot=/dev/hde
disk=/dev/hde

among other parameters. Unfortunately, the lilo command returns:

Reading boot sector from /dev/hde
Fatal: open /dev/hde: No such device or address.

I'm not sure how /dev/hde applies to a flash card. There is such a file, but it's empty. Typically, I'm confused. It seems the procedure I've been given chroot's to the flash media, lilo's to make it bootable, but references a non-existent or 0 byte hard drive device to write to.

Collapse -

that's where

by Jaqui In reply to Okay, dumb follow-up lilo ...

the distro designed to install onto a flash drive makes it easier.

all flash drives are scsi interfaces, so it would have to be referenced as /dev/sd[a/b/c/d]

your earlier example shows it as /dev/sda

the other small issues:
1) can the system you are using actually boot from a usb device?
[ it's a bios thing you know ]
2) is the flash drive one that supports running software from it?
[ U3 device, not all have that capability. ]

Collapse -

More info

by CharlieSpencer In reply to that's where

1) Can the system boot from a USB device?

Yes. I'm attempting to modify an existing process. Right now we have to send the flash media to our Pittsburgh location to have them loaded. We want to do this here in SC. The systems we're booting will boot from flash media already; we're just changing the location of the flash drive configuration.

2) Does the flash drive support running software?

The flash media will be used as a component of a product we produce. It's the same make and model we send to PA.

The are about three differences between the way PA does it and the way I want to do it. First, they do it booting from a Knoppix Live CD. I want to boot from the hard drive but Knoppix' web site recommended against installing Knoppix as bootable on an HD. They recommended Debian so that's what I'm using. Why don't I go with a flash-specific distro? The product is part of a railroad safety system, and I'm not able to tell if the differences between distributions could cause a (potentially life-threatening) problem.

Second, PA says they type the commands in manually. At this end the work will be done by factory floor employees with minimal typing skills. Expecting them to type will be a demo in user frustration. I want to put all the commands in one file and have them run it from a GUI shortcut.

Third, apparently the Knoppix box in PA refers to the flash drive as /dev/hde. I believe it's a laptop with built-in flash media slots; maybe those slots aren't SCSI.

As I understand it after I chroot I've set the file system on the flash drive as my root and I'm seeing it's directory structure; how can I still refer to it as /dev/sda when that's now the root? I've changed /hde to /sda for every other command and reference in the procedure, but it makes no difference in lilo.conf. Whether I use /dev/hde or /dev/sda, I still get:

Reading boot sector from /dev/xxx
Fatal: open /dev/xxx: No such device or address

If I

NAME:~# chroot /mnt/sda1
NAME:/# cd /dev
NAME:/# ls hde*
NAME:/# ls sda*

I get listing for hde and partitions hde1 to 16. I get no listings for sda, so that at least explains why that doesn't work in the lilo.conf, but I don't know why lilo reports "No such device" when /hde is clearly there.

Maybe the word 'Reading' in the error message is what's confusing me, but that makes me think lilo is trying to /dev/hde as a source. Since /hde has a size of zero, I'm unsure what is to be read from it.

Fortunately, this is the last step in the process. If I can lick this one I'll have something I can had to the product test lab and have them see if it works.

Collapse -

ahh, the reference in the chroot

by Jaqui In reply to More info

is because part of setting up the environment is "populating" the /dev and /proc with the appropriate information.

once the new environment is entered, the flash drive is now the only filesystem it sees, and it only accesses what hardware you configured.
[ usually, basic input output and drive systems. ]

copying the commands into a file and making it a shell script is easily done.

I also see where you have a problem with the drive allocation, it really is system dependent so a script would need to handle the variable drive device name.

I don't blame you for being cautious about changes with a safety application.
from my own knowledge of distros, pretty much any distro but the Ubuntu group would be a viable option. Ubuntu's default configuration has a critical flaw vis a vis security, specially for a safety system application.

Back to Hardware Forum
8 total posts (Page 1 of 1)  

Related Discussions

Related Forums