Results 1 to 10 of 10

Thread: the question is, within the live-cd, how to rewrite the mbr

Hybrid View

  1. #1
    Junior Member
    Join Date
    Jan 2004
    Location
    silver springs florida
    Posts
    4

    the question is, within the live-cd, how to rewrite the mbr

    Please excuss those of us who are still learning the wonderful methods of linux. I am new to linux and am very grateful to this forum and specifically to those who are involved in answering questions like what I am about to ask.
    First of all, Im sorry if I ask things that seem simple for most of you, now that that is out of the way, are you ready? Heres what I am trying to understand:
    The following is from a former post:
    Hello

    I have the same

    Fatal: open /dev/hda: Permission denied

    when I'm trying to run lilo. Let me explain the situation.

    - I successfully install knx(3.2) with knx-hdinstall (btw, very effective !)
    - failed to reboot, because knx hasn't followed (or asked) for some boot
    parameters (in my case, ide0=ata66, ide1=ata66 otherwise boot jam !)
    - rebooting on the live-cd, mounting hdaX rw, adding the correct append
    line.
    - sudo chroot /mnt/hdaX, still ok.
    - lilo -v ... and Fatal: open /dev/hda: Permission denied
    - tried the proposed install-mbr (don't know why it should change smth, but
    as I'm not sure, I try), ok, then again same output of lilo.

    So, the question is, within the live-cd, how to rewrite the mbr ?

    Thanks
    (from: http://www.knoppix.net/forum/viewtop...873&highlight=)
    --------------------------------------------------------------------------

    And what looks like the correct answer:

    happily, i found a solution.

    Here it is for the sake of completness.

    The problem is that chrooting to /mnt/hdaX isolate the pseudo-root, the dev and the proc are not those from the "orignal" working Linux. So obviously lilo won't be able to change the /dev he can't access. So the opposite must be done: bringing on "/" all we need to run the live-cd lilo fct with the lilo.conf config file we want. Note that mine, already located in hdaX, use /vmlinuz and /boot. In the live-cd:


    Code:
    cd /

    rm -f /boot
    rm -f /etc/lilo.conf
    rm -f /vmlinuz

    # easy bc knx added a line in fstab
    mount /mnt/hdaX

    rm -s /mnt/hdaX/boot /boot
    rm -s /mnt/hdaX/etc/lilo.conf /etc/lilo.conf
    rm -s /mnt/hdaX/vmlinuz /vmlinuz

    # this one works.
    lilo -v



    That was just that. :wq
    ---------------------------------------------------------

    My delema as accuratly as I can ask you :
    What does this mean in a non code writing person's format?
    I mean, who has the patience to translate this to a stupid idiot like me?
    I am totally confused and not only need a translation but a complete walk through.
    I really wish to find a way to write the mbr with lilo from the live CD for times when the mbr gets corrupted or otherwise lost.
    What I have been doing is writing the partition table in cfdisk from the live CD ( when I know how the partitions esesentially were originally constructed, so as not to damage any existing files) Then when the partition table is good to go(not formatting of course), I reinstall windows to complete the writting of the rest of the mbr code (the pointing mechanism that points to the OS).
    But what Id prefer to do is just install lilo into the mbr as a boot device by altering the lilo.conf file.
    Who may be up to teaching me this?
    Thanks , steven from florida

  2. #2
    Senior Member registered user
    Join Date
    Mar 2003
    Location
    colorado springs, colorado
    Posts
    1,933
    This works for me everytime:

    1) boot Knoppix,

    2) mount partition that you installed /root to: mount /dev/hda2 /mnt/hda2
    (notice there is no mention of clicking anything )

    3) chroot /mnt/hda2

    4) edit /etc/lilo.conf

    5) lilo

    reboot

  3. #3
    Junior Member
    Join Date
    Jan 2004
    Location
    silver springs florida
    Posts
    4

    really trying

    Thanks rickenbacherus. what do you mean by "that you installed root to"? Do you mean where the OPerating system is installed?
    Dont forget, this would be a system that already existed and has a damaged MBR, that is, no partitons and such. Ill try again , but I sware I have already tryed this and it came back with permission denied.

  4. #4
    Member registered user
    Join Date
    Jan 2004
    Location
    Osnabrück, Germany
    Posts
    95

    Re: really trying

    Quote Originally Posted by djgotee
    Thanks rickenbacherus. what do you mean by "that you installed root to"? Do you mean where the Operating system is installed?
    yup, I think the root-partition is meant here. Did you run lilo as root? if not, try "sudo lilo" or "su" before running lilo!

  5. #5
    Senior Member registered user
    Join Date
    Mar 2003
    Location
    colorado springs, colorado
    Posts
    1,933

    Re: really trying

    Quote Originally Posted by djgotee
    Thanks rickenbacherus. what do you mean by "that you installed root to"? Do you mean where the OPerating system is installed?
    Dont forget, this would be a system that already existed and has a damaged MBR, that is, no partitons and such. Ill try again , but I sware I have already tryed this and it came back with permission denied.
    Yes I do mean /root but keep in mind that Knoppix installs everything to /root. If for example you were trying to reinstall lilo to a bootstrapped Debian install and had your directories on multiple partitions then you would certainly need to mount those partitions in chroot to the proper mount points before you'd get it to work.

  6. #6
    Junior Member
    Join Date
    Jan 2004
    Location
    silver springs florida
    Posts
    4

    what does this mean?

    But Mr Rickenbacherus, do you know what the following means?
    Code:
    cd /

    rm -f /boot
    rm -f /etc/lilo.conf
    rm -f /vmlinuz

    # easy bc knx added a line in fstab
    mount /mnt/hdaX

    rm -s /mnt/hdaX/boot /boot
    rm -s /mnt/hdaX/etc/lilo.conf /etc/lilo.conf
    rm -s /mnt/hdaX/vmlinuz /vmlinuz

    # this one works.
    lilo -v

  7. #7
    Junior Member
    Join Date
    Jan 2004
    Location
    silver springs florida
    Posts
    4
    Oh and also what does this mean: (and does it sound correct to you?)

    The problem is that chrooting to /mnt/hdaX isolate the pseudo-root, the dev and the proc are not those from the "orignal" working Linux. So obviously lilo won't be able to change the /dev he can't access. So the opposite must be done: bringing on "/" all we need to run the live-cd lilo fct with the lilo.conf config file we want. Note that mine, already located in hdaX, use /vmlinuz and /boot. In the live-cd

  8. #8
    Senior Member registered user
    Join Date
    Mar 2003
    Location
    colorado springs, colorado
    Posts
    1,933
    Just do it as i have written and you'll be fine. the rm command is for 'remove' and i would be very careful with it. You could easily render your system unbootable depending on what you rm. You shouldn't need to rm anything to reinstall lilo.

    man rm

  9. #9
    Junior Member
    Join Date
    Feb 2004
    Posts
    1

    What that code does

    There was a serious error in the code snippets above - it should say "ln" instead of "rm" for the second triplet of commands. Here in full corrected and with explanations:

    # These three lines delete files off the ramdisk
    # which knoppix runs from. They are the files
    # which lilo uses to make a boot loader - we are
    # deleting them as we are about to replace them below.
    rm -f /boot
    rm -f /etc/lilo.conf
    rm -f /vmlinuz

    # This mounts the hard drive that has Linux installed
    # already on it - replace X with number of drive.
    mount /mnt/hdaX

    # These copy the files that lilo needs to the ram
    # disk knoppix is running from.
    ln -s /mnt/hdaX/boot /boot
    ln -s /mnt/hdaX/etc/lilo.conf /etc/lilo.conf
    ln -s /mnt/hdaX/vmlinuz /vmlinuz

    # Now lilo will install the boot records for
    # linux on the hard drive.
    # (-v for verbose)
    lilo -v

  10. #10
    Junior Member
    Join Date
    Nov 2004
    Posts
    1

    Use "-o dev" on the mount command to enable lilo

    I found this on http://www2.knightcast.org/~tech/lin...-recovery.html.
    When you mount your partition to be recovered, use "-o dev", like the following:
    mount -o dev /mnt/hdaX

    Then chroot-ing and lilo-ing would succeed, well, at least it did for me.

Similar Threads

  1. Newbie question about live cd
    By Concussion in forum General Support
    Replies: 2
    Last Post: 09-28-2004, 06:53 PM
  2. Newbie question about live cd
    By Concussion in forum General Support
    Replies: 0
    Last Post: 09-28-2004, 04:24 AM
  3. newbie question: HD install with same settings as live CD?
    By elicheez in forum General Support
    Replies: 2
    Last Post: 05-10-2004, 06:40 PM
  4. Grub settings, quick question... really my last question :p
    By mark1221 in forum Hdd Install / Debian / Apt
    Replies: 2
    Last Post: 11-01-2003, 10:32 PM
  5. HowTo write rewrite the MRB using knoppix?
    By desposito in forum Hdd Install / Debian / Apt
    Replies: 2
    Last Post: 07-01-2003, 05:45 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


TP-Link TL-SG105 5-Port Gigabit Ethernet Unmanaged Metal Desktop Network Switch picture

TP-Link TL-SG105 5-Port Gigabit Ethernet Unmanaged Metal Desktop Network Switch

$19.99



NETGEAR GS308EP Essential Series 8-Port Gigabit PoE+ Unmanaged Switch picture

NETGEAR GS308EP Essential Series 8-Port Gigabit PoE+ Unmanaged Switch

$49.99



Cisco WS-C3650-12X48UR-L 48-Port Stackable Layer 3 8x10G SFP+ Port Switch picture

Cisco WS-C3650-12X48UR-L 48-Port Stackable Layer 3 8x10G SFP+ Port Switch

$129.99



TP-Link TL-SG1048 48-Port Gigabit Rackmount Switch New Factory Sealed picture

TP-Link TL-SG1048 48-Port Gigabit Rackmount Switch New Factory Sealed

$199.99



10-Port Gigabit PoE Network Switch with 8 PoE+ Ports with 2 Combo SFP Slots 125W picture

10-Port Gigabit PoE Network Switch with 8 PoE+ Ports with 2 Combo SFP Slots 125W

$39.99



TP-Link TL-SG2210P 10-Port Gigabit Smart Switch w/ 8-Port PoE+ NO AC SKU 25597 picture

TP-Link TL-SG2210P 10-Port Gigabit Smart Switch w/ 8-Port PoE+ NO AC SKU 25597

$36.98



5 Port Gigabit Unmanaged Ethernet Switch, Home Network Hub, Office Ethernet S... picture

5 Port Gigabit Unmanaged Ethernet Switch, Home Network Hub, Office Ethernet S...

$9.64



Arista DCS-7010T-48-R 48P 1GbE 4P 10GbE SFP+ RA Switch with rack mounts picture

Arista DCS-7010T-48-R 48P 1GbE 4P 10GbE SFP+ RA Switch with rack mounts

$69.00



Linksys LGS328MPC 24-Port Managed Gigabit PoE+ Switch with 4 10G SFP+ Uplinks picture

Linksys LGS328MPC 24-Port Managed Gigabit PoE+ Switch with 4 10G SFP+ Uplinks

$224.95



Cisco Catalyst 2960-48TT-L 48-Port Fast Ethernet Managed Rackmount Switch picture

Cisco Catalyst 2960-48TT-L 48-Port Fast Ethernet Managed Rackmount Switch

$46.99