Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[HOWTO] lvm2 for root, swap and software suspend2 (edit)
View unanswered posts
View posts from last 24 hours

Goto page Previous  1, 2, 3, 4, 5, 6  Next  
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
Raffi
l33t
l33t


Joined: 17 Mar 2003
Posts: 731
Location: Moscow, Id.

PostPosted: Fri Oct 27, 2006 4:49 am    Post subject: Reply with quote

The only time I have seen the missing rootvol message is when, for some reason, I can't find my lvm. The last time was when I forgot to tell it to add the raid setup on a system that was using raid.

The no init found sounds like you are not getting the ramdisk loaded. What command did you use to build the ramdisk? What kernel were you booted under at the time? What does your grub entry look like?
Back to top
View user's profile Send private message
weedy
Apprentice
Apprentice


Joined: 24 Jun 2005
Posts: 247

PostPosted: Sun Nov 12, 2006 7:26 am    Post subject: Re: Desperate for help!!! Reply with quote

nato.Otan wrote:
sorry I am here again...

:cry: :cry: :cry: :cry: :cry:

I just rebuild system and world and re-compiled the kernel 'cause I wanted new features. Then I rebuild the initrd image with lvm2create_initrd. The kernel boots and when it's done I get this message:

Quote:
VFS: Mounted root (ext2 filesystem) readonly.
Freeing unused kernel memory: 224k freed
Kernel panic - not syncing: Not init found. Try passing ini= option to kernel


I did pass several combinations of options in the kernel including "noapic", because googling had a solution doing this, however it stops all the after kernel boot with that message!!!

Are there general rules for re-compiling the system/world/kernel in order to create the initrd image?

Googling actually didn't yield any meaningful results for this that applies to Gentoo.

Thanks

[EDIT] I just wanted to make sure that it doesn't matter whether lvm2 and busybox aren't compiled with the STATICALLY. You said before that busybox automatically creates a static version of itself.

[EDIT 2] By the way something really weird happened, when I used LiveCD and mounted / I went to check /proc directory and it was completely empty!!! As far as I know that there's been always stuff on /proc directory. I am truly perplexed as to what might've cause this!!!

I got this bug, in the initrd /bin/busybox does not have the execute bit set:
-rw------- 1 root root 1707168 2006-11-11 23:59 busybox
it needs to be at least:
-rwxr-xr-x 1 root root 1707168 2006-11-11 23:59 busybox

I solved this with:
Code:
   cleanup 1
fi

# Make sure files in /sbin are executable.
for file in $TMPMNT/sbin/*
do
   if [ ! -x $file ]; then
      chmod 0755 $file
      echo "$cmd -- INFO Execute bit set for $file"
   fi
done

# Rename bb as busybox to use the gentoo static compiled busybox.
# Also make sure it's executable.

if [ -f $TMPMNT/bin/bb -a ! -f $TMPMNT/bin/busybox ]; then
   mv $TMPMNT/bin/bb $TMPMNT/bin/busybox
   if [ ! -x $TMPMNT/bin/busybox ]; then
      chmod 0755 $TMPMNT/bin/busybox
      echo "$cmd -- INFO Execute bit set for $TMPMNT/bin/busybox"
   fi
fi

echo "$cmd -- creating symlinks to busybox"
any time a programmer gets lazy and takes things for granted bugs like this will come up. god only know how many times i've been bitten because I was lazy :lol:
Back to top
View user's profile Send private message
Raffi
l33t
l33t


Joined: 17 Mar 2003
Posts: 731
Location: Moscow, Id.

PostPosted: Sun Nov 12, 2006 2:51 pm    Post subject: Reply with quote

The error you got sounds like you either named the initrd incorrectly or you did not have /boot mounted when you created it.

What options did you use to rebuild the initrd? Did you have /boot mounted when you did it?

Last time I checked, busybox still builds both a static and dynamic executable.

Since /proc is another (pseudo) filesystem, you will need to have it mounted for anything to be in there.
Back to top
View user's profile Send private message
weedy
Apprentice
Apprentice


Joined: 24 Jun 2005
Posts: 247

PostPosted: Mon Nov 13, 2006 8:02 am    Post subject: Reply with quote

Raffi wrote:
The error you got sounds like you either named the initrd incorrectly or you did not have /boot mounted when you created it.

What options did you use to rebuild the initrd? Did you have /boot mounted when you did it?

Last time I checked, busybox still builds both a static and dynamic executable.

Since /proc is another (pseudo) filesystem, you will need to have it mounted for anything to be in there.

grub is correct, /boot was mounted, and /bin/bb is there. Inside the initrd /bin/busybox (the renamed /bin/bb) did not have the execute bit set, thus theres no awk. So /sbin/init doesn't work. That's why you need the checks added to the script, to make sure all needed executables are infact executable. Once I ran chmod 0755 /path/to/mounted/initrd-lvm2/bin/busybox the box booted with out fail, you can see a copy of the script I use here. It has 2 more edits that allow for proper vmlinuz operation. https://weedy.1.vg/lvm2create_initrd
Back to top
View user's profile Send private message
Raffi
l33t
l33t


Joined: 17 Mar 2003
Posts: 731
Location: Moscow, Id.

PostPosted: Mon Nov 13, 2006 12:46 pm    Post subject: Reply with quote

That's pretty odd. Is your /bin/bb executable? I have not run into any of these problems on the 4 machines I'm running this script on.
Back to top
View user's profile Send private message
weedy
Apprentice
Apprentice


Joined: 24 Jun 2005
Posts: 247

PostPosted: Mon Nov 13, 2006 4:04 pm    Post subject: Reply with quote

Raffi wrote:
That's pretty odd. Is your /bin/bb executable? I have not run into any of these problems on the 4 machines I'm running this script on.
Yes my /bin/bb is fine, i've done lvm2 installs for 6 people (I guess it's only fitting the one that install i get weird bugs would be mine) and mine is the 7th. But as you can see i'm not alone with this. It could be related to time, both our installs are recent. Code changes in cpio?
Back to top
View user's profile Send private message
Raffi
l33t
l33t


Joined: 17 Mar 2003
Posts: 731
Location: Moscow, Id.

PostPosted: Mon Nov 13, 2006 4:07 pm    Post subject: Reply with quote

That's a thought. I will try to find some time to play around with the script today.
Back to top
View user's profile Send private message
Raffi
l33t
l33t


Joined: 17 Mar 2003
Posts: 731
Location: Moscow, Id.

PostPosted: Mon Nov 13, 2006 4:19 pm    Post subject: Reply with quote

I can't see how the execute bit could have changed. Can you send me the following information

ls -l /bin/bb
uname -a
mount | grep ' / '
equery l cpio
Back to top
View user's profile Send private message
weedy
Apprentice
Apprentice


Joined: 24 Jun 2005
Posts: 247

PostPosted: Tue Nov 14, 2006 6:33 am    Post subject: Reply with quote

here you are
Code:
kamo-chan ~ # ls -l /bin/bb
-rwxr-xr-x 1 root root 1731420 Nov 12 20:41 /bin/bb
kamo-chan ~ # uname -a
Linux kamo-chan 2.6.18-gentoo-r2 #7 SMP PREEMPT Mon Nov 13 21:41:30 EST 2006 i686 Intel(R) Pentium(R) 4 CPU 2.60GHz GenuineIntel GNU/Linux
kamo-chan ~ # mount | grep ' / '
/dev/mapper/system-root on / type ext3 (rw,noatime)
kamo-chan ~ # equery l cpio
[ Searching for package 'cpio' in all categories among: ]
 * installed packages
[I--] [ ~] app-arch/cpio-2.7-r1 (0)
Back to top
View user's profile Send private message
Raffi
l33t
l33t


Joined: 17 Mar 2003
Posts: 731
Location: Moscow, Id.

PostPosted: Tue Nov 14, 2006 1:08 pm    Post subject: Reply with quote

The only differences from what I have are you are using ext3 (I'm using reiser) that should not be an issue and you have a different version of cpio (I have cpio-2.6-r5). The cpio version could be the difference. Any way you can drop back to the version I'm using and see if things change?
Back to top
View user's profile Send private message
weedy
Apprentice
Apprentice


Joined: 24 Jun 2005
Posts: 247

PostPosted: Thu Nov 16, 2006 9:07 am    Post subject: Reply with quote

Raffi wrote:
The only differences from what I have are you are using ext3 (I'm using reiser) that should not be an issue and you have a different version of cpio (I have cpio-2.6-r5). The cpio version could be the difference. Any way you can drop back to the version I'm using and see if things change?
arg that sounds like work
Back to top
View user's profile Send private message
nato.Otan
n00b
n00b


Joined: 23 Oct 2006
Posts: 12

PostPosted: Sat Nov 18, 2006 1:27 am    Post subject: Reply with quote

weedy wrote:
Raffi wrote:
The error you got sounds like you either named the initrd incorrectly or you did not have /boot mounted when you created it.

What options did you use to rebuild the initrd? Did you have /boot mounted when you did it?

Last time I checked, busybox still builds both a static and dynamic executable.

Since /proc is another (pseudo) filesystem, you will need to have it mounted for anything to be in there.

grub is correct, /boot was mounted, and /bin/bb is there. Inside the initrd /bin/busybox (the renamed /bin/bb) did not have the execute bit set, thus theres no awk. So /sbin/init doesn't work. That's why you need the checks added to the script, to make sure all needed executables are infact executable. Once I ran chmod 0755 /path/to/mounted/initrd-lvm2/bin/busybox the box booted with out fail, you can see a copy of the script I use here. It has 2 more edits that allow for proper vmlinuz operation. https://weedy.1.vg/lvm2create_initrd


You are a genious, not in a 1000 years I would've figure this out. But your script did the job, I was breathless. Breathless because I spent countless hours chrooting and recompiling in differen fashions: system, world, kernel and what not. After that I though about just doing a re-install until I checked this thread. How in the world did you manage to figured that out?

The odd thing is that first it worked with Raffi's script and after I did some emerges suddenly blacked out. So why at some point Raffi's is fine and at another time is weedy's is the correct one?

Anyways thanks a lot for this.

By the way, busybox HAS to be compiled statically?
Back to top
View user's profile Send private message
Raffi
l33t
l33t


Joined: 17 Mar 2003
Posts: 731
Location: Moscow, Id.

PostPosted: Sat Nov 18, 2006 3:46 am    Post subject: Reply with quote

nato.Otan wrote:

By the way, busybox HAS to be compiled statically?

Yes and no. Yes, because things will work a little smoother that way. No because gentoo already compiles a static version which my script uses.
Back to top
View user's profile Send private message
weedy
Apprentice
Apprentice


Joined: 24 Jun 2005
Posts: 247

PostPosted: Mon Nov 20, 2006 8:29 am    Post subject: Reply with quote

nato.Otan wrote:
weedy wrote:
Raffi wrote:
The error you got sounds like you either named the initrd incorrectly or you did not have /boot mounted when you created it.

What options did you use to rebuild the initrd? Did you have /boot mounted when you did it?

Last time I checked, busybox still builds both a static and dynamic executable.

Since /proc is another (pseudo) filesystem, you will need to have it mounted for anything to be in there.

grub is correct, /boot was mounted, and /bin/bb is there. Inside the initrd /bin/busybox (the renamed /bin/bb) did not have the execute bit set, thus theres no awk. So /sbin/init doesn't work. That's why you need the checks added to the script, to make sure all needed executables are infact executable. Once I ran chmod 0755 /path/to/mounted/initrd-lvm2/bin/busybox the box booted with out fail, you can see a copy of the script I use here. It has 2 more edits that allow for proper vmlinuz operation. https://weedy.1.vg/lvm2create_initrd


You are a genious, not in a 1000 years I would've figure this out. But your script did the job, I was breathless. Breathless because I spent countless hours chrooting and recompiling in differen fashions: system, world, kernel and what not. After that I though about just doing a re-install until I checked this thread. How in the world did you manage to figured that out?

The odd thing is that first it worked with Raffi's script and after I did some emerges suddenly blacked out. So why at some point Raffi's is fine and at another time is weedy's is the correct one?

Anyways thanks a lot for this.

By the way, busybox HAS to be compiled statically?
well when I did the install this time and it didn't work I mounted the initrd and poked around. I have hand crafted initrds before but using Raffi's script is WAAAAAAAAAAAAAAAAAAAAAAAAAAY easier. And since I'm lazy easy == good
Back to top
View user's profile Send private message
synss
Apprentice
Apprentice


Joined: 08 Mar 2006
Posts: 282
Location: Dijon > Berlin > Tokyo > Nürnberg > München

PostPosted: Mon Nov 20, 2006 12:05 pm    Post subject: Reply with quote

I want to tell first that I did not go through this install yet, but I would like to achieve sth similar (that + encryption for another 10 geek points) but,
  • instead of using initrd + tmpfs, would not an initramfs solve the read-write problem and the inode number problem all at once?
  • you can personalized your busybox install and remove everything you do not need, read the ebuild for details on how to do that.
But well anyway, I will sure go through what you have done in details even if I go the initramfs route.
_________________
Compress portage tree
Elog viewer
Autodetect swap
Back to top
View user's profile Send private message
Raffi
l33t
l33t


Joined: 17 Mar 2003
Posts: 731
Location: Moscow, Id.

PostPosted: Mon Nov 20, 2006 12:35 pm    Post subject: Reply with quote

Not sure about the initramfs helping. The reason I used the tmpfs is that it is not a block device and therefor did not break suspend restore when it was written to. My first pass at doing this did include a customized busybox, I just like using what is already there because it is both easier and leaves you with more flexibility.
Back to top
View user's profile Send private message
dougm
n00b
n00b


Joined: 30 Sep 2003
Posts: 64
Location: France

PostPosted: Wed Nov 22, 2006 9:27 am    Post subject: Gentoo patches for lvm2create_initrd committed upstream Reply with quote

I just wanted to let anyone reading this thread here know that I've managed to get Gentoo support into the official LVM2 distribution for lvm2create_initrd. I've updated the LVM2 Root Wiki entry to reflect the changes in "The Second Easiest Way" section. This doesn't require static binaries, it automatically sizes the initial ram disk, and uses busybox by default. The only things you have to make sure to do are to create /initrd in the target root partition, and make sure you support for a large enough image in your kernel.
Back to top
View user's profile Send private message
Raffi
l33t
l33t


Joined: 17 Mar 2003
Posts: 731
Location: Moscow, Id.

PostPosted: Wed Nov 22, 2006 1:02 pm    Post subject: Reply with quote

That's cool. Now we just need to get support for swap suspend into there as well.
Back to top
View user's profile Send private message
/root
n00b
n00b


Joined: 19 Sep 2003
Posts: 49
Location: Saarbrücken / Germany

PostPosted: Fri Jan 12, 2007 5:41 pm    Post subject: Reply with quote

@raffi: First things first: Great Work!

Here is my piece of advice from the work with this script:

Change the devicelist in lvm2create_initrd script to fit your needs (e.g. hde for the first IDE device on a second controller).
Code:
BLOCKDEVICES=${BLOCKDEVICES:-"md hda hdb hdc hdd sda sdb sdc sdd"}

Changes in grub.conf (lvm2root-variable) -> Don't use a trailing slash
Code:
lvm2root=/dev/vg00/lv00

Change root after booting initrd-image -> There must exist an initrd directory in your /-partition

Bye!
Back to top
View user's profile Send private message
Raffi
l33t
l33t


Joined: 17 Mar 2003
Posts: 731
Location: Moscow, Id.

PostPosted: Fri Jan 12, 2007 5:53 pm    Post subject: Reply with quote

/root wrote:

Change the devicelist in lvm2create_initrd script to fit your needs (e.g. hde for the first IDE device on a second controller).
Code:
BLOCKDEVICES=${BLOCKDEVICES:-"md hda hdb hdc hdd sda sdb sdc sdd"}


Good suggestion, I should add a comment in the script to let people know they can edit that for additional hardware.
/root wrote:

Changes in grub.conf (lvm2root-variable) -> Don't use a trailing slash
Code:
lvm2root=/dev/vg00/lv00


I'm confused here, I dont' see a trailing / on anything in my post or my script.
/root wrote:

Change root after booting initrd-image -> There must exist an initrd directory in your /-partition

Yep, I keep running into this. I will look into the best way to address this. Maybe just a reminder from the create initrd script.
Back to top
View user's profile Send private message
/root
n00b
n00b


Joined: 19 Sep 2003
Posts: 49
Location: Saarbrücken / Germany

PostPosted: Mon Jan 15, 2007 8:03 pm    Post subject: Reply with quote

Raffi wrote:
/root wrote:
Changes in grub.conf (lvm2root-variable) -> Don't use a trailing slash
Code:
lvm2root=/dev/vg00/lv00

I'm confused here, I dont' see a trailing / on anything in my post or my script.

That's right, this was my fault. This accident leads to an "File not found"/"Not a directory" error when the script tries to mount the vg to the /rootvol dir which possible leads the user to a wrong direction.

Raffi wrote:
/root wrote:
Change root after booting initrd-image -> There must exist an initrd directory in your /-partition

Yep, I keep running into this. I will look into the best way to address this. Maybe just a reminder from the create initrd script.

A simple
Code:
if ![ -d /initrd ]; then mkdir /initrd; fi
should do the trick in the lvm2create_initrd-script.

Bye.
Back to top
View user's profile Send private message
Raffi
l33t
l33t


Joined: 17 Mar 2003
Posts: 731
Location: Moscow, Id.

PostPosted: Mon Jan 15, 2007 8:37 pm    Post subject: Reply with quote

/root wrote:

A simple
Code:
if ![ -d /initrd ]; then mkdir /initrd; fi
should do the trick in the lvm2create_initrd-script.

My only concern about that solution is that my script mounts the root filesystem read only. I'm not sure what the consequences of mounting it read/write would be.
Back to top
View user's profile Send private message
/root
n00b
n00b


Joined: 19 Sep 2003
Posts: 49
Location: Saarbrücken / Germany

PostPosted: Tue Jan 16, 2007 10:46 pm    Post subject: Reply with quote

Raffi wrote:
/root wrote:

A simple
Code:
if ![ -d /initrd ]; then mkdir /initrd; fi
should do the trick in the lvm2create_initrd-script.

My only concern about that solution is that my script mounts the root filesystem read only. I'm not sure what the consequences of mounting it read/write would be.
Right. But you have to run the script once before booting of from ramdisk to create initrd and so the root-filesystem that resides on the lvm2-partition should be read/write.
Another solution would be mounting the root filesystem somewhere else and call
Code:
pivot_root . /path/that/exist/common/on/all/gentoo/based/systems/and/couldnt/be/accidently/deleted


A simple note after creation of the initrd image should leave the /initrd dir untouched by the user. Maybe he doublechecks the existance of it.

Bye.
Back to top
View user's profile Send private message
Raffi
l33t
l33t


Joined: 17 Mar 2003
Posts: 731
Location: Moscow, Id.

PostPosted: Tue Jan 16, 2007 11:48 pm    Post subject: Reply with quote

I edited the script to add a warning. This seems safest.
Back to top
View user's profile Send private message
/root
n00b
n00b


Joined: 19 Sep 2003
Posts: 49
Location: Saarbrücken / Germany

PostPosted: Fri Feb 02, 2007 4:26 pm    Post subject: Reply with quote

I encountered some odd behaviour of the lvm2create_initrd script.

After changing my kernel and rebuilding the initrd image my installation was unable to boot because the kernel couldn't find the init-script.

After some research on this, I found out, that the executables in the initrd image under /bin and /sbin aren't executable, except /sbin/init

As a workaround I'm mounting the initrd image and do a
Code:
chmod u+x bin/busybox && chmod u+x sbin/lvm

inside the mounted dir.

What kind of change can have this effect? The script have been retained unchanged. 8O

Bye.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Goto page Previous  1, 2, 3, 4, 5, 6  Next
Page 2 of 6

 
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