Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Install Gentoo on USB stick.
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
n0ns
n00b
n00b


Joined: 02 Aug 2007
Posts: 13

PostPosted: Tue Sep 09, 2008 5:21 pm    Post subject: Install Gentoo on USB stick. Reply with quote

I received new OCZ Rally2 16GB drive.
Since it's big and pretty fast for USB, i'm wondering:
Is it possible to install Gentoo system on it ?
And I'm not talking about Live USB, there are plenty of manuals for this.
The problem with them, You can not boot and make permanent changes.
I spent some time in searching for the answer and have not found it.

The result should be "Live USB" like system that is able to boot from almost every computer, but fully editable from within the drive.
Lets say you can run emerge <program> and the program will be installed permanently on the USB.
Or emerge --sync && emerge -u world will update the system installed on USB stick.

Any help or ideas where to start will be appreciated. :roll:
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


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

PostPosted: Tue Sep 09, 2008 6:12 pm    Post subject: Reply with quote

n0ns,

You can do a normal Gentoo install to a 16Gb FLASH drive. The only reason not to is the write wear caused by all the writes during the build process.
Sure, you have wear levelling but this is applied only to unallocated sectors. Do not use a jourmalled filesystem, the journal writes increase the wear and slow everything down too. ext2 will be fine.

If you make on image on a conventional hard drive then move it over to USB, ad hoc builds will be ok.

You need to add filesystem mounting by UUID to make it completely portable to systems capable of booting from USB.
_________________
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
n0ns
n00b
n00b


Joined: 02 Aug 2007
Posts: 13

PostPosted: Tue Sep 09, 2008 6:34 pm    Post subject: Reply with quote

Hm ...
Now I understand why there is nothing about it
It's too simple :)

Thanks a lot NeddySeagoon

So basically i can boot from any Live CD, copy / to USB ext2 ~2-4Gb change mounting and boot configs, install GRUB and the system on flash is ready ?

I think i'll go for Sabayon minimal as base :)

About the wear, i think it is better to update the system on USB (temp workdir may be on HDD) then overwriting the whole image.

Thanks again :)
Back to top
View user's profile Send private message
szczerb
Veteran
Veteran


Joined: 24 Feb 2007
Posts: 1709
Location: Poland => Lodz

PostPosted: Tue Sep 09, 2008 6:54 pm    Post subject: Reply with quote

How do you configure the bootloader and fstab?

We have no idea what device (sda, sdb, sdd and so on) the pendrive will have on a system we stick it in, right?
Back to top
View user's profile Send private message
n0ns
n00b
n00b


Joined: 02 Aug 2007
Posts: 13

PostPosted: Tue Sep 09, 2008 7:24 pm    Post subject: Reply with quote

szczerb wrote:
How do you configure the bootloader and fstab?

We have no idea what device (sda, sdb, sdd and so on) the pendrive will have on a system we stick it in, right?


As NeddySeagoon wrote,
You need to add filesystem mounting by UUID to make it completely portable to systems capable of booting from USB.
Boot parameter should be also specified using UUID
it is something like this:

grub.conf (menu.lst)
Code:

  kernel /boot/vmlinuz-... root=UUID=4a6aed11-42dd-4c82-81ce-8f469e93f210 ro

and

/etc/fstab:
Code:

  UUID=e0164f78-9821-4eaf-bda7-1fd9b43a6f06 / ext3 defaults,errors=remount-ro 0


To find out the UUID of your partition just use the following command:
sudo vol_id -u device
Back to top
View user's profile Send private message
0x0065
n00b
n00b


Joined: 08 Apr 2007
Posts: 49

PostPosted: Sat Oct 04, 2008 12:33 am    Post subject: Grub support for UUID Reply with quote

I'm doing a bootable USB for a relative who isn't terribly tech... ...there are grub patches over in Ubuntu land for using the UUID of a filesystem in grub.conf rather than the 'standard' grub (hd?,?) mappings used to find which partition the kernel and any initrd is on.

That will obviously be the best way to handle a bootable USB key that moves between boxen with different device assignments. I'm not sure if the Ubuntu patch is upstream or in portage yet. I'm just syncing through a slow connection... if not:

https://bugs.launchpad.net/ubuntu/+source/grub/+bug/244141

will tell you what I know so far.
Back to top
View user's profile Send private message
n0ns
n00b
n00b


Joined: 02 Aug 2007
Posts: 13

PostPosted: Sat Oct 04, 2008 2:57 am    Post subject: Reply with quote

Ubuntu problems not always relevant to other distros :)
I had no problem with default Gentoo grub from box x86 and ~x86.
It's simply working.
if you not sure what to do, install sabayon core from sabayon 3.5.
Then, just make some dir in / and copy into that dir :
1. /boot
2. /usr/src
3. /lib/modules
(may be make.conf too)
delete all, but backup folder.
then download and unpack stage3 and portage.
restore (copy back) backed up folders and continue with Gentoo quick installation guide (skip kernel and grub sections).

For xorg.conf you can use vesa driver or generate it on boot depending on HW info if you want 3D.
Back to top
View user's profile Send private message
0x0065
n00b
n00b


Joined: 08 Apr 2007
Posts: 49

PostPosted: Sat Oct 04, 2008 5:55 am    Post subject: Reply with quote

n0ns, I think you'll find that in this case I'm talking about a valuable contribution to the whole community that Ubuntu is making. :)

If we've incorporated their work on this, you wont need to guess what boot disk grub/bios has assigned to your USB key...
It will also make any Grub CD for booting the USB key on systems that don't support USB boot a much more trivial exercise...

If we haven't incorporated their work on this then you will need to understand what the (hd0,0) bits of your grub.conf file mean... :cry:
If you understand what the (hd0,0) bit is doing, then I'll give you the contact details of my non-tech relative & you can explain it to them for me...
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


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

PostPosted: Sat Oct 04, 2008 7:45 am    Post subject: Reply with quote

0x0065,

The grub (hdx,y) is grubs way of finding its way around your filesystem tree.
Grub does not detect your drives, it asks the BIOS what it found, so the (hdx, bit is drive x, counting from 0 in BIOS detection order. Thats the hard bit.

The ,y is the partition number, again counting from 0,

Some BIOSes always call the boot drive, drive 0 (hd0, which means that they change drive numbering when you select a different boot drive. This makes grub difficult to install.

Lastly, the BIOS drive detection order is not always the same as the kernel detection order. In the vast majority of cases it is but its something else that can bite you.
_________________
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
0x0065
n00b
n00b


Joined: 08 Apr 2007
Posts: 49

PostPosted: Sat Oct 04, 2008 9:33 am    Post subject: Reply with quote

It seems the patches aren't in sys-boot/grub-static version 0.97 (r3)
I'm just looking at sys-boot/grub version 0.97-r6.
It says it has a 256byte ext3 inode patch... (^_^) ...but it says it wont compile staticly linked on an amd64 box... (>_<) ...and my laptop still has that xandros stuff on it...

is anyone else readily able to test if:
Code:
title Readily Portable USB Boot Key
 uuid 3c9a1463-c187-47eb-9902-d00f0b84acf9
 kernel /boot/vmlinuz root=UUID=3c9a1463-c187-47eb-9902-d00f0b84acf9
 initrd /boot/initrd.gz
works with gentoo's grub yet?

I might just alienarise the ubuntu one & use that for now...
Back to top
View user's profile Send private message
0x0065
n00b
n00b


Joined: 08 Apr 2007
Posts: 49

PostPosted: Sat Oct 04, 2008 11:44 pm    Post subject: Reply with quote

NeddySeagoon

You have clearly explained the assumed knowledge necessary to understand the problem that Ubuntu have recently solved.
Curiously enough also the assumed knowledge necessary for me to have felt the need to conceived of my initial question.

None the less, I doubt that my sister will find your explanation as to why the screen sometimes goes black with 'some error' after the grub menu any more enlightening than mine. Hence...

...I've got the 386 build of grub-0.97-29ubuntu28 now. I'm just going to alien it into a tgz, take the bits out & put them in their place & re-grub the mbr...
...before making an initrd to find, luksOpen, mount & pivot_root into the main system... (^_^) Perhaps you could tell me where I'm going to stumble with that bit...
...In answer to the first possible stumbling block, I'll be using a gzipped ext filesystem for the initrd, not a cpio archive... ...so pivot_root is the right tool.
...and I've already build the generic x86 cross compiler for busybox...

I intend to try & build enough into the kernel to reliably boot off of a usb key on a broad range of hardware. I've always done rather custom-ish stuff so some advice on this would be greatly appreciated.
I'd like to avoid the need to keep the modules in the initrd & the root filesystem in sync if at all possible. That seems to me to be graphics, motherboard chipsets, disk io, hid & miscellaneous USB built in.

basically I don't want modules in the initrd. Am I dreaming?

please advise.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


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

PostPosted: Sun Oct 05, 2008 3:02 pm    Post subject: Reply with quote

0x0065,

It looks like the UUID patches for grub have been back ported from Grub 2 by some distros.
I'm not on Gentoo just now, so I can't check if Grub 2 is in portage yet.

I think you also need a UUID kernel patch which is not in gentoo-sources.

You will have to be very careful not keeping modules in the initrd and the root filesystem in sync.
The kernel and all its modules must be built with the same major settings and the same gcc version.
You will not be able to update the kernel.

I have never used LUKs, so I don't have any advice there.
_________________
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
0x0065
n00b
n00b


Joined: 08 Apr 2007
Posts: 49

PostPosted: Wed Oct 08, 2008 9:15 pm    Post subject: Reply with quote

NeddySeagoon

Thanks for the tip on the UUID kernel patches.

The ubuntu UUID patch to Grub is separate work from the Grub 2 stuff. It does things that are still wishlist in Grub 2. It borrows bits of the dbus library to scan the system and note the UUID of partitions as it detects them on boot, or so the author states. The Grub 2 stuff that has been implemented is only for the device map file used during re-flashing of the MBR from a full OS, or so the author states.

Perhaps I was unclear about modules in the initrd needing to be in sync. I'm hoping to AVOID ALL modules in the initrd so that there are NO modules in the initrd. Thus syncing of modules is not needed. I'm giving the thing to my sister, so if syncing needs to occur, it probably wont. Then again, kernel updates probably wont occur either... ...certainly not kernel patches.

Anyway, I'll look at the kernel UUID patch thing.
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