Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Booting an i686 «generic» gentoo from a portable drive
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
fargred
n00b
n00b


Joined: 19 Oct 2010
Posts: 67

PostPosted: Mon Mar 18, 2013 6:05 pm    Post subject: Booting an i686 «generic» gentoo from a portable drive Reply with quote

I wanted to build an x86 gentoo I would run on (almost) every computer (or at least those ones I have) as a rescue and backup system. I’ve compiled the kernel, but for some reason, it refuses to run well.

First of all, the rescue system is placed on portable hard drive. It connects via USB-2.x. The hardware I testing this rescue system on is a PC (intel i5), with one internal hard drive usually available at boot time as sda (and our precious USB drive as sdb). No any RAIDs. I use grub-0.97 as a loader and tried to boot with or without initrd, both ways come to fail, but for some reason the way without initrd at least get me to the bash login prompt.

This is what enabled in the kernel – http://pastie.org/pastes/6606022/text

Code:
title Rescue Gentoo Linux 3.7.5
root (hd0,0)
kernel /vmlinuz-3.7.5 rootwait root=/dev/sdb2

The lines above get me to the login prompt. But! Root FS stay mounted readonly and I type login name and pass without cursor. It appears only after the command
Code:
mount -n -o remount,rw `sed -nr 's_(\S+)\s+/\s+.*_\1_p' /etc/mtab` /

Then the filesystem remount in rw mode and the cursor appears and starts to blinking normally. Any other options, like those specified in the second example will not allow to remount it well, though.
Code:
title Gentoo Linux 3.7.5
root (hd0,0)
kernel /vmlinuz-3.7.5 rootwait root=/dev/ram0 real_root=LABEL=t_root rootflags=rw,data=journal,barrier=1,errors=remount-ro ipv6.disable=1
initrd /initramfs-genkernel-x86-3.7.5

attaching the external drive…
Code:
[4.61…] scsi: 10:0:0:0: Direct_Access StoreJet Transcend SAJI PQ:0 ANSI: 2 CCS

[4.75…] sd 10:0:0:0: [sdb] Attached SCSI disk

…and just stops booting. No errors thrown. I waited some minutes then did SysRq+W and get
Code:
task
swapper/0    D    c1e968f0    5316     1    0x00000000

I’ve tried to catch that moment during the ‘successful’ boot, and the next lines after ‘Attached SCSI’ were about swap too.

initrd was compiled by genkernel in the directory of the current (and the only present) kernel, but not at the same time as the kernel (kernel was build with old-fashion way via make && make modules…), but later, when I decided that I want to mount root fs by LABEL and, therefore, need initrd. Root filesystem is ext3.

Any thoughts?
Back to top
View user's profile Send private message
tuner23
Tux's lil' helper
Tux's lil' helper


Joined: 18 May 2006
Posts: 82

PostPosted: Tue Mar 19, 2013 7:46 am    Post subject: Reply with quote

Hello,


hmm.. when exactly does the bootup fail? When starting init (right after starting up the kernel), or after that during boot?

If it fails during boot:
for booting without initram, i think
Quote:
/etc/init.d/root
does the trick.
You have to start the service while booting with
Code:
rc-update add root boot


If it fails right after loading the kernel, this could be (the second with initramfs look like this), it looks like the device is not found.

1. The problem with the attached disk can be a race-condition (which device is loaded first), so the devices are not statically assigned to sda/sdb. the order could change, if the conditions of the system (like attaching a usb-disk) changes.
2. Or, as it is a usb-disk, it also could take too much time for the kernel to identify/scan the usb-drives, so when the kernel tries to start the init-process the device isn't already there.

At least i think it is a problem with identifying the root-partition.


Hope that helps..

Antonios.
Back to top
View user's profile Send private message
fargred
n00b
n00b


Joined: 19 Oct 2010
Posts: 67

PostPosted: Tue Mar 19, 2013 5:17 pm    Post subject: Reply with quote

tuner23 wrote:
hmm.. when exactly does the bootup fail? When starting init (right after starting up the kernel), or after that during boot?

It fails a bit before the init starts.
tuner23 wrote:
for booting without initram, i think
Quote:
/etc/init.d/root
does the trick.

ls -l /media/t_root/etc/runlevels/boot/root
lrwxrwxrwx 1 root root 16 Дек 13 09:47 /media/t_root/etc/runlevels/boot/root -> /etc/init.d/root

tuner23 wrote:
If it fails right after loading the kernel, this could be (the second with initramfs look like this), it looks like the device is not found.

1. The problem with the attached disk can be a race-condition (which device is loaded first), so the devices are not statically assigned to sda/sdb. the order could change, if the conditions of the system (like attaching a usb-disk) changes.

I can say that sda is always internal and sdb — external drive.
tuner23 wrote:
2. Or, as it is a usb-disk, it also could take too much time for the kernel to identify/scan the usb-drives, so when the kernel tries to start the init-process the device isn't already there.

I thought about that too, the rootwait option in the first grub section is for waiting the USB drive to appear. The kernel default timeout for waiting is 30 sec AFAIR. Though, I can’t say whether rootwait works during loading kernel to /dev/ram0 and after that, when it must mount the rootfs partition. I’ve read kernel documentation about rootwait option and usb-storage module, but haven’t found any clue.
Back to top
View user's profile Send private message
fargred
n00b
n00b


Joined: 19 Oct 2010
Posts: 67

PostPosted: Tue Mar 19, 2013 5:20 pm    Post subject: Reply with quote

fargred wrote:
tuner23 wrote:
hmm.. when exactly does the bootup fail? When starting init (right after starting up the kernel), or after that during boot?

It fails a bit before the init starts. The kernel does not seem to be fully loaded, however, as you could notice, sysrq commands already work.
tuner23 wrote:
for booting without initram, i think
Quote:
/etc/init.d/root
does the trick.

ls -l /media/t_root/etc/runlevels/boot/root
lrwxrwxrwx 1 root root 16 Дек 13 09:47 /media/t_root/etc/runlevels/boot/root -> /etc/init.d/root

tuner23 wrote:
If it fails right after loading the kernel, this could be (the second with initramfs look like this), it looks like the device is not found.

1. The problem with the attached disk can be a race-condition (which device is loaded first), so the devices are not statically assigned to sda/sdb. the order could change, if the conditions of the system (like attaching a usb-disk) changes.

I can say that sda is always internal and sdb — external drive.
tuner23 wrote:
2. Or, as it is a usb-disk, it also could take too much time for the kernel to identify/scan the usb-drives, so when the kernel tries to start the init-process the device isn't already there.

I thought about that too, the rootwait option in the first grub section is for waiting the USB drive to appear. The kernel default timeout for waiting is 30 sec AFAIR. Though, I can’t say whether rootwait works during loading kernel to /dev/ram0 and after that, when it must mount the rootfs partition. I’ve read kernel documentation about rootwait option and usb-storage module, but haven’t found any clue.
Back to top
View user's profile Send private message
tuner23
Tux's lil' helper
Tux's lil' helper


Joined: 18 May 2006
Posts: 82

PostPosted: Tue Mar 19, 2013 5:51 pm    Post subject: Reply with quote

Hy,

for my system i use sometimes a special init-script inside initramfs to see whats going on.

The trick is to use busybox and use shell-command.

something like:
Code:
#!/bin/busybox sh

export PATH=/bin
umask 0077

mount -t proc none /proc
mount -t sysfs none /sys

sh

umount /proc
umount /sys
exec switch_root /rootfs /sbin/init


Maybe you can try this out..


Greets,
Antonis.
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