Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Hand-assembling an operating system - gentoo noob advice req
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
sampeckinpah
n00b
n00b


Joined: 07 Dec 2011
Posts: 7

PostPosted: Wed Dec 07, 2011 6:50 pm    Post subject: Hand-assembling an operating system - gentoo noob advice req Reply with quote

Boot process:
BIOS (included on yr computer, configured by you) --> bootloader [locates kernel, invokes kernel with kernel parameters and parent thread reference (typically init) ] --> init --> rest of GNU

OS build process:
Acquire OS building tools (ubuntu live CD in this case)
Launch OS building tools (booting from CD)
Configure volume (partitioning, etc)
Copy system files (e.g. stage1, kernel)
Configure build environment (using bash script)
Compile
Configure initialization
Configure user environment
Configure boot loader



Dear sirs:

About once a year I take a shot at building a gentoo system on old hardware. I admit that i haven't gotten one working yet. It's a rewarding experience though because each time I try I end up learning something new about linux (GNU?) and each time I usually get a little closer.

This time around I am so close! Typically what I'll do is I'll jump on IRC and get advice (of varying degrees of helpfulness) from various peeps.

But this time I want to try to fix to get it running myself because, let's face it! I'm going to have to admit it myself, so I might as well build it myself. I'll learn more that way anyway.

So first of all I need to define --EXACTLY-- what it is that I'm trying to do. I think that this is where a lot of gentoo noobs go wrong -- they want to find a cookbook that will just tell them step by step how to hand-roll an OS. Which almost certainly won't work, almost by definition. At least, this is where I've gone wrong in the past.

What I'm going to try to do is document my understanding of what I'm trying to accomplish (see diagram above), and if anyone thinks that I'm doing it wrong, they're welcome to chime in. This could help a lot.

I'm currently stuck in the process of configuring GRUB. I fixed a partition error that was giving me a NO BOOTABLE MEDIUM FOUND sort of error, and now my system boots to a curser and just sort of hangs.

How does one begin to troubleshoot GRUB?


Additional notes:
AMDx86_64 vbox

What I've tried:
Various tutorials (including the gentoo install procedure)
Searching online forums (including this one and stackoverflow)
IRC


By the way I already know that I'm an idiot, although it doesn't bother me if people point this out. My hope is to become a well-behaved, well-informed idiot. Please feel free to critique either. I promise I won't use the fact that I'm an idiot to avoid work, thinking, misbehavior or other obligations.
Back to top
View user's profile Send private message
John R. Graham
Administrator
Administrator


Joined: 08 Mar 2005
Posts: 10590
Location: Somewhere over Atlanta, Georgia

PostPosted: Wed Dec 07, 2011 6:58 pm    Post subject: Reply with quote

Hi, sampeckinpah. Welcome to Gentoo! :)

That list you presented isn't wholly consistent with the way you install Gentoo. Stage1 installs, for instance have been deprecated for nearly half a decade.

The best documentation to follow for a beginner is the official Gentoo Handbook. Troubleshooting anything, including grub, is almost impossible unless you tell us what step you're attempting and what results (i.e., detailed messages) you're getting.

What guide are you following at present?

Meet us half way and we'll help you get there. :wink:

- John
_________________
I can confirm that I have received between 0 and 499 National Security Letters.
Back to top
View user's profile Send private message
sampeckinpah
n00b
n00b


Joined: 07 Dec 2011
Posts: 7

PostPosted: Wed Dec 07, 2011 7:05 pm    Post subject: Reply with quote

John R. Graham wrote:
Hi, sampeckinpah. Welcome to Gentoo! :)

That list you presented isn't wholly consistent with the way you install Gentoo. The best documentation to follow for a beginner is the official Gentoo Handbook. Troubleshooting anything, including grub, is almost impossible unless you tell us what step you're attempting and what results (i.e., detailed messages) you're getting.

Meet us half way and we'll help you get there. :wink:

- John


Not a problem sir. We have a deal. I'll take another crack at is using yr guide.


EDIT: Made it to step 4. ping wasn't working so I tried net-setup script, but it didn't produce any error messages and didn't work. Elected to reboot into Ubuntu live disk. Networking now works.

EDIT: Used similar partitioning scheme to the example, put ext2 on /dev/sda1. Rebooting to format ext3 on /dev/sda3

EDIT: ubuntu choked on the new partitions. Rebooted into gentoo. Mounted partitions and swapon. Now on step 5.

EDIT: Got networking by using ifconfig on eth0 in gentoo minimal. Go figure! chose stage 3 and decompressed, as well as portage. Skipping compiler flags for now since I don't *really* know what I'm doing and I need to see a working system so that I can get geeky with these later. Now on Step 6.


Last edited by sampeckinpah on Wed Dec 07, 2011 8:50 pm; edited 1 time in total
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54391
Location: 56N 3W

PostPosted: Wed Dec 07, 2011 8:15 pm    Post subject: Reply with quote

sampeckinpah,

Boots to a cursor only or to Grub> and a cursor?
The former means something is broken and grub did not find all of itself.
The latter means grub loaded ok but could not find /boot/grub/grub.conf to know what to do next. This has been known to be due to a missing symbolic link in /boot/grub that points menu.lst -> grub.conf thats menu.Lowercase L not menu.numeral 1.

You say you have an AMD64 install. What profile did you choose and how did you emerge grub?

Useful information for us will be the output of
Code:
fdisk -l
annoteded with your partition mount points.
Code:
ls -l /boot
ls -l /boot/grub

and
Code:
emerge --info
output.

Grub doesn't usually give problems at this stage.

Don't start over - thats not how you fix Gentoo. That just gives you the opportunity to not make the same mistake again. You will learn much more by fixing it when its broken, than by just followlng the handbook and have it JustWork. You can get back into the chroot and continue from where you left off at any time.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
John R. Graham
Administrator
Administrator


Joined: 08 Mar 2005
Posts: 10590
Location: Somewhere over Atlanta, Georgia

PostPosted: Wed Dec 07, 2011 10:23 pm    Post subject: Reply with quote

Hi, sampeckinpah. Edits may conserve server resources but they don't tell your friendly forum helpers that there's new information on the thread. Use new posts if you want to get our attention. :wink:

There's pretty good information on the Safe CFLAGS site that will help you chose a good starting value for CFLAGS that matches your current CPU.

- John
_________________
I can confirm that I have received between 0 and 499 National Security Letters.
Back to top
View user's profile Send private message
sampeckinpah
n00b
n00b


Joined: 07 Dec 2011
Posts: 7

PostPosted: Thu Dec 08, 2011 7:28 pm    Post subject: Reply with quote

NeddySeagoon wrote:
sampeckinpah,

...

Don't start over - thats not how you fix Gentoo. That just gives you the opportunity to not make the same mistake again. You will learn much more by fixing it when its broken, than by just followlng the handbook and have it JustWork. You can get back into the chroot and continue from where you left off at any time.


Agreed. Unfortunately I followed up on someone else's suggestion to start over but no real harm done -- I'm still learning stuff.

John R. Graham wrote:
Hi, sampeckinpah. Edits may conserve server resources but they don't tell your friendly forum helpers that there's new information on the thread. Use new posts if you want to get our attention. :wink:

There's pretty good information on the Safe CFLAGS site that will help you chose a good starting value for CFLAGS that matches your current CPU.

- John


No problem! I'll make sure that important points get their own post! Otherwise I'm just taking notes.

Based on your recommendation I disabled bluetooth and then set

FLAGS="-march=core2 -mtune=generic -O2 -pipe"



Status: Just set my locale to English and ran locale-gen. Now on Step 7!

UPDATE: system froze after an unsuccessful emerge of gentoo-sources. Rebooted. chroot. Emerged against and went fine, heh.

EDIT: emerged vim to help preserve my sanity.


Last edited by sampeckinpah on Thu Dec 08, 2011 8:45 pm; edited 1 time in total
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54391
Location: 56N 3W

PostPosted: Thu Dec 08, 2011 8:01 pm    Post subject: Reply with quote

sampeckinpah,

Hmm, no harm done -march=core2 implies -mtune=core2 too. Think about it.
-march=core2 tells gcc to use any and all the instructions that a core2 CPU knows about. If you do that, which would you want to schedule the instruction execution order for anything other than a core2?
Nothing less than a core2 CPU can run the resulting code. (Later CPUs with a superset of the core2 instruction set will).

Its normal to drop the -mtune when you give -march
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
sampeckinpah
n00b
n00b


Joined: 07 Dec 2011
Posts: 7

PostPosted: Fri Dec 09, 2011 9:03 pm    Post subject: Reply with quote

NeddySeagoon wrote:
sampeckinpah,

Hmm, no harm done -march=core2 implies -mtune=core2 too. Think about it.
-march=core2 tells gcc to use any and all the instructions that a core2 CPU knows about. If you do that, which would you want to schedule the instruction execution order for anything other than a core2?
Nothing less than a core2 CPU can run the resulting code. (Later CPUs with a superset of the core2 instruction set will).

Its normal to drop the -mtune when you give -march


Cool. I already built the kernel twice so I'll fix that next time that I decide to recompile. Now that you've explained it, that's sort of intuitive.

Okay so I declined to configure any additional kernel modules, but I did update the system time using ntp as well as setting eth0 to go up at boot and grab a DHCP lease.

Now on Step 9, Installing necessary system tools!


Update: Chose syslog-ng and vixie-cron
Back to top
View user's profile Send private message
sampeckinpah
n00b
n00b


Joined: 07 Dec 2011
Posts: 7

PostPosted: Fri Dec 09, 2011 9:49 pm    Post subject: Reply with quote

OK, so I actually need help at this point.

I'm glad that I followed the guide because I was missing a TON of stuff that would have created lots of further problems.
I installed GRUB and rebooted. Choose option 1 on the grub menu. Some familiar linux looking scripts start to run.

Code:

md:  Scanned 0 and added 0 devices
md: autorun ...
md: ...autorun DONE
RAMDISK: Couldn't find valid RAM disk image starting at 0.
UDF-fs: No partition found (1)
(swapper,1,0):ocfs2_fill_super:1039 ERROR: superblock prove failed!
(swapper,1,0):ocfs_fill_super_1:1233 ERROR: status =-22
GFS2: gfs2 mount does not exist
List of all paritions:
1600 4194302 hdc driver: ide-cdrom
No filesystem could mount root, tried  reiserfs ext3 ext2 ext4 squashfs vfat is09660 udf xfs ocfs2 gfs2 gfs2meta
Kernel panic - not syncing: VFS:  Unable to mount root fs on unkown-block(1,0)
Pid: 1, comm: swapper Not tainted 3.0.6-gentoo #1
Call Trace:

...


and then follows with about 9 lines of address/hex pairs that look like a stack dump to me or something.

I'm going to log off in a few and take a break for the weekend. In the mean time I'm going Bing some of those error messages, as well look at any boot logs that I can find, and make sure that the kernel is able to support ext3 and knows how to mount root, heh.

Anything else I should try? Thanks for the encouragement, and this is the --FURTHEST-- I've made it so far. I'll be back online Monday to try to sort this out. So close!

note: Edited for writing style.


Last edited by sampeckinpah on Fri Dec 09, 2011 11:11 pm; edited 1 time in total
Back to top
View user's profile Send private message
Spidey
Apprentice
Apprentice


Joined: 07 Sep 2006
Posts: 269

PostPosted: Fri Dec 09, 2011 10:14 pm    Post subject: Reply with quote

It seems your GRUB configuration isn't passing the right root parameter to the kernel.
Please, post your hard disk configuration (partitions list) and your /boot/grub/grub.conf.
Back to top
View user's profile Send private message
whiteghost
Guru
Guru


Joined: 26 Jul 2009
Posts: 374
Location: north dakota

PostPosted: Fri Dec 09, 2011 10:20 pm    Post subject: Reply with quote

recommended- use your 64 bit ubuntu livecd or sysrescuecd for graphical interface, firefox, ease of posting messages on this

forum when installing, chrooting into gentoo.

don't worry about use flags now, profile will select what you need.

your kernel is not right, certainly not unusual at this point. for help with kernel watch this video

http://vimeo.com/7733701

and pappys seeds here

http://kernel-seeds.org/

please post

/etc/fstab

/etc/make.conf

/boot/grub/grub.conf

output of lspci -n
_________________
www.informationclearinghouse.info
May you re-discover what the poor in 18th century France discovered, that rich people's heads can be mechanically separated from their shoulders if they refuse to listen to reason.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54391
Location: 56N 3W

PostPosted: Sat Dec 10, 2011 4:38 pm    Post subject: Reply with quote

sampeckinpah,

A few things ...

The contents of /etc/make.conf apply to all of your intsalled software except for the kernel. When you emerge a kernel, you get the sources in /usr/src. You then use the kernels own configure and build system, so make.conf is not consulted.

Your panic message is important for the things is does not say, as well as the things it does.

Code:
List of all paritions:
1600 4194302 hdc driver: ide-cdrom
No filesystem could mount root,
Notice that under the List of all paritions: none are listed. Also notice that hdc driver: ide-cdrom is shown.

Firstly, this shows that the kernel cannot see any of your partitions, secondly it shows you are using the old depreciated IDE drivers in your kernel.
These drivers are depreciated to the point of no longer being supported.

You need to move to libata, I like this guide but I'm biased :)
In your case, you may not know the drivers you need in the <*> Serial ATA and Parallel ATA drivers ---> menu.
Run
Code:
lspci -k
before you get into the chroot and make a note of the drivers in use for your IDE/SATA devices. Once into the
Code:
make menuconfig
you can search for them by pressing the / key.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
sampeckinpah
n00b
n00b


Joined: 07 Dec 2011
Posts: 7

PostPosted: Mon Dec 12, 2011 9:22 pm    Post subject: Reply with quote

Spidey wrote:
It seems your GRUB configuration isn't passing the right root parameter to the kernel.
Please, post your hard disk configuration (partitions list) and your /boot/grub/grub.conf.



Ok. Rebooted using ubuntu-64. Remounted. chroot. env-update. Then

Code:

> df


Filesystem            Size  Used Avail Use% Mounted on
sysfs                 7.4G  2.8G  4.3G  39% /sys
udev                  2.9G  4.0K  2.9G   1% /dev
tmpfs                 7.4G  2.8G  4.3G  39% /
df: `/mnt/cdrom': No such file or directory
df: `/mnt/livecd': No such file or directory
df: `/mnt/livecd/lib64/rc/init.d': No such file or directory
df: `/sys/fs/fuse/connections': No such file or directory
df: `/dev/shm': No such file or directory
df: `/mnt/livecd/lib64/firmware': No such file or directory
df: `/mnt/livecd/usr/portage': No such file or directory
df: `/proc/bus/usb': No such file or directory
/dev/sda3             7.4G  2.8G  4.3G  39% /
udev                  2.9G  4.0K  2.9G   1% /dev
df: `/dev/shm': No such file or directory
/dev/sda1              31M  9.1M   21M  31% /boot



and then grub.conf

Code:

# This is a sample grub.conf for use with Genkernel, per the Gentoo handbook
# http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=1&chap=10#doc_chap2
# If you are not using Genkernel and you need help creating this file, you
# should consult the handbook. Alternatively, consult the grub.conf.sample that
# is included with the Grub documentation.

default 0
timeout 30
#splashimage=(hd0,0)/boot/grub/splash.xpm.gz

title Gentoo Linux 2.6.24-r5
root (hd0,0)
kernel /boot/kernel-genkernel-x86_64-3.0.6-gentoo root=/dev/ram0 real_root=/dev/sda3
#initrd /boot/initramfs-genkernel-x86-2.6.24-gentoo-r5

# vim:ft=conf:
initrd /boot/kernel-genkernel-x86_64-3.0.6-gentoo
# This is a sample grub.conf for use with Genkernel, per the Gentoo handbook
# http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=1&chap=10#doc_chap2
# If you are not using Genkernel and you need help creating this file, you
# should consult the handbook. Alternatively, consult the grub.conf.sample that
# is included with the Grub documentation.

default 0
timeout 30
#splashimage=(hd0,0)/boot/grub/splash.xpm.gz

title Gentoo Linux 2.6.24-r5
root (hd0,0)
kernel /boot/kernel-genkernel-x86_64-3.0.6-gentoo root=/dev/ram0 real_root=/dev/sda3
#initrd /boot/initramfs-genkernel-x86-2.6.24-gentoo-r5

# vim:ft=conf:
initrd /boot/kernel-genkernel-x86_64-3.0.6-gentoo




whiteghost wrote:
recommended- use your 64 bit ubuntu livecd or sysrescuecd for graphical interface, firefox, ease of posting messages on this

forum when installing, chrooting into gentoo.

don't worry about use flags now, profile will select what you need.

your kernel is not right, certainly not unusual at this point. for help with kernel watch this video

http://vimeo.com/7733701

and pappys seeds here

.
.
.




Started reading about pappy's seeds and will continue reading. He's got a reasonable idea -- provide me with a general purpose kernel that I can mod to suite my needs. Additionally you asked for fstab:

Code:

# /etc/fstab: static file system information.
#
# noatime turns off atimes for increased performance (atimes normally aren't
# needed); notail increases performance of ReiserFS (at the expense of storage
# efficiency).  It's safe to drop the noatime options if you want and to
# switch between notail / tail freely.
#
# The root filesystem should have a pass number of either 0 or 1.
# All other filesystems should have a pass number of 0 or greater than 1.
#
# See the manpage fstab(5) for more information.
#

# <fs>         <mountpoint>   <type>      <opts>      <dump/pass>

# NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.
/dev/BOOT      /boot      ext2      noauto,noatime   1 2
/dev/ROOT      /      ext3      noatime      0 1
/dev/SWAP      none      swap      sw      0 0
/dev/cdrom      /mnt/cdrom   auto      noauto,ro   0 0
/dev/fd0      /mnt/floppy   auto      noauto      0 0



and make.conf

Code:

# These settings were set by the catalyst build script that automatically
# built this stage.
# Please consult /usr/share/portage/config/make.conf.example for a more
# detailed example.
CFLAGS="-O2 -pipe -mtune=generic -march=core2"
CXXFLAGS="${CFLAGS}"
# WARNING: Changing your CHOST is not something that should be done lightly.
# Please consult http://www.gentoo.org/doc/en/change-chost.xml before changing.
CHOST="x86_64-pc-linux-gnu"
# These are the USE flags that were used in addition to what is provided by the
# profile used for building.
USE="mmx sse sse2 -bluetooth:"



NeddySeagoon wrote:
sampeckinpah,


Run
Code:
lspci -k
before you get into the chroot and make a note of the drivers in use for your IDE/SATA devices. Once into the
Code:
make menuconfig
you can search for them by pressing the / key.





lspci is no where to be found on my system, and emerge couldn't find it either.

Okay, so I'll read a bit more about the kernel seeds and try to get lspci working.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54391
Location: 56N 3W

PostPosted: Mon Dec 12, 2011 9:58 pm    Post subject: Reply with quote

sampeckinpah,

In some random order.

lspci is provided by pciutils ... emerge pciutils

It looks like /dev/sda1 is boot and /dev/sda3 is / (root)

Code:
kernel /boot/kernel-genkernel-x86_64-3.0.6-gentoo root=/dev/ram0 real_root=/dev/sda3
needs an initrd to work.
real_root is passed to the initrd to tell it where your root filesystem is.
Genkernel made kernels need an initrd, unless you have made your hardware support built in, in which case
Code:
kernel /boot/kernel-genkernel-x86_64-3.0.6-gentoo root=/dev/sda3
is what you need.

Code:
/dev/BOOT      /boot      ext2      noauto,noatime   1 2
/dev/ROOT      /      ext3      noatime      0 1
/dev/SWAP      none      swap      sw      0 0
Only 8/10 for following the handbook. The words in uppercase need to be replacedith your actual partitions.
This isn't your problem yet but if you solve the other problem(s) you will get a read only root.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
whiteghost
Guru
Guru


Joined: 26 Jul 2009
Posts: 374
Location: north dakota

PostPosted: Tue Dec 13, 2011 4:33 am    Post subject: Reply with quote

regarding make.conf,
Quote:
-march=cpu-type
Generate instructions for the machine type cpu-type. The choices for cpu-type are the same as for -mtune. Moreover, specifying -march=cpu-type implies -mtune=cpu-type.
-mcpu=cpu-type


http://gcc.gnu.org/onlinedocs/gcc/i386-and-x86_002d64-Options.html

so i would remove -mtune=generic, and ':' typo after bluetooth
_________________
www.informationclearinghouse.info
May you re-discover what the poor in 18th century France discovered, that rich people's heads can be mechanically separated from their shoulders if they refuse to listen to reason.
Back to top
View user's profile Send private message
res0r9lm
n00b
n00b


Joined: 30 Jul 2004
Posts: 56

PostPosted: Tue Dec 13, 2011 9:25 am    Post subject: Reply with quote

I would use -march=native
Back to top
View user's profile Send private message
sampeckinpah
n00b
n00b


Joined: 07 Dec 2011
Posts: 7

PostPosted: Tue Dec 13, 2011 6:10 pm    Post subject: Reply with quote

NeddySeagoon wrote:
sampeckinpah,

...

Only 8/10 for following the handbook. The words in uppercase need to be replacedith your actual partitions.
This isn't your problem yet but if you solve the other problem(s) you will get a read only root.


Sorry dude! Fixed that as well as grub.conf and pciutils.



whiteghost wrote:
regarding make.conf,
Quote:
-march=cpu-type
Generate instructions for the machine type cpu-type. The choices for cpu-type are the same as for -mtune. Moreover, specifying -march=cpu-type implies -mtune=cpu-type.
-mcpu=cpu-type


http://gcc.gnu.org/onlinedocs/gcc/i386-and-x86_002d64-Options.html

so i would remove -mtune=generic, and ':' typo after bluetooth


Fixed, thank you! emerged gcc just to try it out!

res0r9lm wrote:
I would use -march=native


Ok, fixed and emerging bash for kicks.


Tested bash. bash works. rebooted


ZOMFG IT WORKS! iT WORKS! i'M IN BASH IN MY NEW gentoo. OMFG this is amazing.


Thank you all. Thank you so much.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum