LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-05-2019, 04:42 PM   #16
jackoat
LQ Newbie
 
Registered: Jan 2019
Posts: 14

Original Poster
Rep: Reputation: Disabled

I have modified the "installScript" file and it seems to have worked with one exception. It copied the proper files to the proper partitions after it formatted and partitioned the drive, but upon attempting to boot, im shown a GNU GRUB terminal. I believe something is wrong with the part of the "installScript" when it puts GRUB on to "sda1". Any ideas why it would go to the terminal instead of booting?

Here is the section of the "installScript" when it adds GRUB to the partition.

Quote:
#set the root device correctly in /etc/grub.conf
#couldn't use $primarypart here because / needs to be escaped as below
sed "/root=/s/ROOT-DEVICE/\/dev\/${deviceName}1/" $primarymnt/etc/grub.conf >$primarymnt/etc/grub.conf.tmp
mv -f $primarymnt/etc/grub.conf.tmp $primarymnt/etc/grub.conf

echo "Installing bootloader"
chroot $primarymnt /sbin/grub --batch --device-map=/dev/null >/dev/null <<EOF
device (hd0) ${device}
root (hd0,0)
setup (hd0)
quit
EOF

sync

umount $secondarymnt >/dev/null 2>&1
umount $primarymnt >/dev/null 2>&1

exit 0
 
Old 01-05-2019, 05:24 PM   #17
michaelk
Moderator
 
Registered: Aug 2002
Posts: 19,419

Rep: Reputation: 3103Reputation: 3103Reputation: 3103Reputation: 3103Reputation: 3103Reputation: 3103Reputation: 3103Reputation: 3103Reputation: 3103Reputation: 3103Reputation: 3103
The script should create a grub.conf file in the /etc directory of the root partition on the drive. There should be a menu.lst soft link in the /boot/grub directory that points to /etc/grub.conf. grub is installed to the Master Boot Record (its a bit more complicated) of the drive and during the boot process reads the grub.conf file. Typically if the menu.lst file can not be found it drops to its command line interface although there could be other errors/reasons.

Basically the part of the script posted does the following: the chroot command switches the environment from whatever is currently running to that of the hard drive which is necessary to run the grub command. The grub command installs the bootloader stuff to the MBR and the system on sda1.

Verify that /etc/grub.conf exists and contains the grub menu and that/boot/grub/menu.lst link exists.

You might have to manually run the chroot command just to see what errors if any are displayed. You need to mount the partitions just like the script first.
 
Old 01-05-2019, 11:08 PM   #18
jackoat
LQ Newbie
 
Registered: Jan 2019
Posts: 14

Original Poster
Rep: Reputation: Disabled
I ran the commands manually and it appears that there is no issue. In my case the commands were:

Quote:
sudo -s
sed "root=/s/ROOT-DEVICE/\dev\/sda1/" /mnt/cvu/etc/grub.conf >/mnt/cvu/etc/grub.conf.tmp
mv -f /mnt/cvu/etc/grub.conf.tmp /mnt/etc/grub.conf

chroot /mnt/cvu /sbin/grub --batch --device-map=/dev/null >/dev/null <<EOF
device (hd0) sda
root (hd0,0)
setup (hd0)
quit
EOF


Both of the mentioned files ("grub.conf", "menu.lst") are present. The content of the "grub.conf" file is:

Quote:
default=0
timeout=1
title CJLinux 1.0
root=(hd0,0)
# ROOT-DEVICE will be replace at install time
kernel=/boot/bzImage ro root=/dev/sda1 quiet

Im not sure as to what is happening. I can provide any needed info.
 
Old 01-06-2019, 08:52 AM   #19
michaelk
Moderator
 
Registered: Aug 2002
Posts: 19,419

Rep: Reputation: 3103Reputation: 3103Reputation: 3103Reputation: 3103Reputation: 3103Reputation: 3103Reputation: 3103Reputation: 3103Reputation: 3103Reputation: 3103Reputation: 3103
Code:
chroot /mnt/cvu /sbin/grub --batch --device-map=/dev/null >/dev/null <<EOF
device (hd0) sda
root (hd0,0)
setup (hd0)
quit
EOF
Make sure the BIOS is configured for ATA versus ACHI mode and change the line from
device (hd0) sda
to
device (hd0) hda

In addition the kernel line in the grub.conf
kernel=/boot/bzImage ro root=/dev/sda1 quiet
should be
kernel=/boot/bzImage ro root=/dev/hda1 quiet

Rerun those lines but my confidence isn't high. Another idea would be to see if the server application runs from a chroot environment. You would need to mount partition 2 per the fstab and enable swap.
 
Old 01-06-2019, 10:54 AM   #20
jackoat
LQ Newbie
 
Registered: Jan 2019
Posts: 14

Original Poster
Rep: Reputation: Disabled
Tried changing "AHCI" to "IDE" and "sda" to "hda", still no luck. I tried chroot and also, no luck. Upon attempting to boot after doing this I no longer get a GNU GRUB screen, but a simple message saying "Missing Operating system. DISK BOOT FAILURE, INSERT SYSTEM DISK AND PRESS ENTER"

I also tried using Boot-Repair-Disk and it also, did not work.
 
Old 01-06-2019, 12:31 PM   #21
michaelk
Moderator
 
Registered: Aug 2002
Posts: 19,419

Rep: Reputation: 3103Reputation: 3103Reputation: 3103Reputation: 3103Reputation: 3103Reputation: 3103Reputation: 3103Reputation: 3103Reputation: 3103Reputation: 3103Reputation: 3103
Buggers...
Well, it was just a WAG. With seeing the grub command line at least it was installing to the hard drive MBR. I don't know what grub version the system is using an the only other thing that may not be right is
Code:
chroot /mnt/cvu /sbin/grub --batch --device-map=/dev/null >/dev/null <<EOF
device (hd0) sda
root (hd0,0)
setup (hd0)
quit
EOF
device (hd0) sda
should be
device (hd0)/dev/sda
or
device (hd0) /dev/hda
 
Old 01-06-2019, 03:28 PM   #22
jackoat
LQ Newbie
 
Registered: Jan 2019
Posts: 14

Original Poster
Rep: Reputation: Disabled
Tried changing "device (hd0) sda" to "device (hd0) /dev/sda" and "device (hd0) /dev/hda" with no prevail. I also tried toggling ACHI Mode and it did not help. Im not sure what to do.

Could I install another distro of linux to the drive and replace the files for that installation with the ones from the recovery disk?
 
Old 01-06-2019, 03:51 PM   #23
michaelk
Moderator
 
Registered: Aug 2002
Posts: 19,419

Rep: Reputation: 3103Reputation: 3103Reputation: 3103Reputation: 3103Reputation: 3103Reputation: 3103Reputation: 3103Reputation: 3103Reputation: 3103Reputation: 3103Reputation: 3103
Maybe you can install plop to boot the system.
https://www.plop.at/en/bootmanagers.html

If you understand how the Carrier software works it might be possible to install it on another distribution. Just replacing the files will not work.
 
Old 01-06-2019, 07:40 PM   #24
jackoat
LQ Newbie
 
Registered: Jan 2019
Posts: 14

Original Poster
Rep: Reputation: Disabled
So after some investigation, I think the issue is the "initrd.img" file is missing. If this would cause it to not boot, how can I generate the "initrd.img"?

Also, when I look for the /bin/bash in sda1, i cannot seem to find it.

UPDATE:

After further investigation I believe it was designed to use "LiLo", as there is a "LiLo.conf" file and a "COPYRIGHT" file that mentions "LInux LOader"

The LiLo.conf file contains:

Quote:
default=CJLinux
boot=
map=/boot/System.map
install=/boot/boot.b
compact
lba32

image=/boot/bzImage
label=CJLinux
read-only
root=
append="quiet"

Last edited by jackoat; 01-06-2019 at 08:37 PM.
 
Old 01-06-2019, 08:36 PM   #25
michaelk
Moderator
 
Registered: Aug 2002
Posts: 19,419

Rep: Reputation: 3103Reputation: 3103Reputation: 3103Reputation: 3103Reputation: 3103Reputation: 3103Reputation: 3103Reputation: 3103Reputation: 3103Reputation: 3103Reputation: 3103
The system might not have bash only sh.

Since it is a specialized operating system there might not be an initrd. If the kernel is compiled with all the necessary modules an initrd is not required.
 
Old 01-06-2019, 11:52 PM   #26
jackoat
LQ Newbie
 
Registered: Jan 2019
Posts: 14

Original Poster
Rep: Reputation: Disabled
Ok, So I think im almost there. I have LiLo booting the partition now but im still getting the error "Kernel panic- not syncing: VFS: Unable to mount root fs on (8,1)'

When I run "lilo -C lilo.conf" from the chroot environment this is the output:

Quote:
Warning: '/proc/partitions' does not exist, disk scan bypassed
Added CJLinux *
It at least attempts to boot now, but the Kernel panic is still happening. Still cannot find a "initrd.img" file, which seems to be the source of this issue according to a little searching. Any Ideas?

Last edited by jackoat; 01-06-2019 at 11:57 PM.
 
Old 01-07-2019, 04:02 AM   #27
mrmazda
Senior Member
 
Registered: Aug 2016
Location: USA
Distribution: openSUSE, Debian, Knoppix, Mageia, Fedora, others
Posts: 2,103

Rep: Reputation: 662Reputation: 662Reputation: 662Reputation: 662Reputation: 662Reputation: 662
Quote:
Originally Posted by jackoat View Post
Ok, So I think im almost there. I have LiLo booting the partition now but im still getting the error "Kernel panic- not syncing: VFS: Unable to mount root fs on (8,1)'
(8,1) means sda1 (as expected on an AOpen MP45-DU). hda1 would be (3,1). hdb1 would be (3,65), while sdb1 would be (8,17). I booted a 2007 2.16 kernel system using the old IDE driver to check. Key here is root fs not mounting.

Quote:
It at least attempts to boot now, but the Kernel panic is still happening. Still cannot find a "initrd.img" file, which seems to be the source of this issue according to a little searching. Any Ideas?
When root FS is not mounted, there will be nothing in /boot or no /boot at all, depending on whether /boot is on a separate filesystem. Neither /boot/initrd.img nor /initrd.img would be found in a normal file search, but if lilo found a kernel, it should also have found an initrd - if one exists.
 
Old 01-07-2019, 03:14 PM   #28
jackoat
LQ Newbie
 
Registered: Jan 2019
Posts: 14

Original Poster
Rep: Reputation: Disabled
Could I use mkinitramfs to create the missing initrd file?
 
Old 01-07-2019, 06:01 PM   #29
jefro
Moderator
 
Registered: Mar 2008
Posts: 19,423

Rep: Reputation: 2998Reputation: 2998Reputation: 2998Reputation: 2998Reputation: 2998Reputation: 2998Reputation: 2998Reputation: 2998Reputation: 2998Reputation: 2998Reputation: 2998
Just a thought. How bad was the old drive?

Since it was lilo or syslinux you shouldn't have had grub?? (did I miss something?)

Last edited by jefro; 01-07-2019 at 06:02 PM.
 
Old 01-07-2019, 07:17 PM   #30
jackoat
LQ Newbie
 
Registered: Jan 2019
Posts: 14

Original Poster
Rep: Reputation: Disabled
The old drive still boots up but has many errors and never fully starts the program it runs.

And I believe it uses LiLo, not grub.


Also, not sure if its any use but I checked the /etc/fstab file and this is what is in it:

Code:
/dev/sda1    /            ext3    remount,defaults,noauto,ro    1  1
/dev/sda2    /mnt/data    ext3    defaults,rw                   0  2
/dev/sda3    none         swap    defaults                      0  0
/proc        /proc        proc    defaults                      0  0
/sys         /sys         sysfs   defaults                      0  0

Last edited by jackoat; 01-07-2019 at 07:19 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
I'm so lost trying to run Linux on an iMac off a recovery disk (Parted Magic recovery disk) 2KoNFuSSeD Linux - Newbie 2 12-22-2015 04:33 AM
GRUB - booting windows from hdb, when hdb is bootable drive lapsio Linux - Newbie 5 09-09-2012 10:52 AM
Clone with dd if=/dev/hda of=/dev/hdb question wrc1944 Linux - Hardware 2 11-28-2004 10:10 AM
can't boot anymore /dev/hdb -> /dev/hde broxtor Linux - Hardware 4 11-13-2004 11:55 AM
How can I boot either one of my hard drives /dev/hda or /dev/hdb, I have RH9 and FC2 omogunkristi Linux - General 1 06-21-2004 06:11 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:25 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration