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: 711
Location: Moscow, Id.

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

Your fix should not cause any problems, they are supposed to be executable. Since I copy the files with cpio from your system, I can't see how those files did not get the correct permissions set unless your system has them wrong.

What file system are you running on /? What is the permissions on /bin/bb and /sbin/lvm?
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 5:04 pm    Post subject: Reply with quote

Wow. Really fast reply :)

Here are the requested Infos:

Filesystems:
Code:

morpheus ~ # mount
/dev/mapper/gentoo-system on / type ext3 (rw,noatime)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec)
udev on /dev type tmpfs (rw,nosuid)
devpts on /dev/pts type devpts (rw,nosuid,noexec)
/dev/hde1 on /boot type ext2 (rw,noatime)
/dev/mapper/gentoo-portage on /usr/portage type ext2 (rw,noatime)
/dev/mapper/gentoo-data on /mnt/data type ext3 (rw,noatime)
/dev/mapper/gentoo-media on /mnt/media type ext3 (rw,noatime)
shm on /dev/shm type tmpfs (rw,noexec,nosuid,nodev)
usbfs on /proc/bus/usb type usbfs (rw,noexec,nosuid,devmode=0664,devgid=85)


Files:
Code:

morpheus ~ # ls /sbin/lvm -la
-r-xr-xr-x 1 root root 1352628 Jan 26 18:13 /sbin/lvm
morpheus ~ # ls /bin/busybox* -la
-rwxr-xr-x 1 root root 1059140 Jan 26 17:49 /bin/busybox
lrwxrwxrwx 1 root root       2 Jan 26 17:49 /bin/busybox.static -> bb
morpheus ~ # ls /bin/bb -la
-rwxr-xr-x 1 root root 1757020 Jan 26 17:49 /bin/bb


cpio:
Code:

morpheus ~ # cpio --version
cpio (GNU cpio) 2.7



The last big emerge was bootstrapping my system and do an emerge -e system && emerge -e world in the middle of january.

Bye.

[EDIT] I've tried the script step-by-step. The cpio command gives an error
Code:

cpio: cannot link /bin/bb to /mnt/initrd-image/bin/bb: Invalid cross-device link

and google tell me it has something to do with different filesystems (ex3/ex2). But this is the point where the execution bit is gone.
Back to top
View user's profile Send private message
Raffi
l33t
l33t


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

PostPosted: Fri Feb 02, 2007 5:42 pm    Post subject: Reply with quote

I'm using 2.6-r5 of cpio. I wonder if the syntax changed. What does your info page say that -L does?
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 6:00 pm    Post subject: Reply with quote

cpio options:
Code:

`-p, --pass-through'
     Run in copy-pass mode.  *Note Copy-pass mode::.

`-d, --make-directories'
     Create leading directories where needed.

`-m, --preserve-modification-time'
     Retain previous file modification times when creating files.

`-L, --dereference'
     Copy the file that a symbolic link points to, rather than the
     symbolic link itself.

Seems reasonable to me.
Back to top
View user's profile Send private message
Raffi
l33t
l33t


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

PostPosted: Fri Feb 02, 2007 6:08 pm    Post subject: Reply with quote

That's what mine says.

Have you tried playing around with cpio? Does the following give an error?

Code:

echo /bin/bb | cpio -pvdm /tmp
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 10:32 pm    Post subject: Reply with quote

Nothing changed with different options of cpio.

The error I noticed in my previous post edit comes from "-l" instead of "-L" :oops:

Every file or directory created by
Code:
echo /bin/bb | cpio -pvdm /tmp

has got only user rights set. rwx for dirs and rw for files.
Code:
morpheus initrd-image # echo /bin/bb | cpio -pdmLv /mnt/initrd-image
/mnt/initrd-image/bin/bb
3432 blocks
morpheus initrd-image # mkdir sbin
morpheus initrd-image # echo /sbin/lvm | cpio -pdmLv /mnt/initrd-image
/mnt/initrd-image/sbin/lvm
2642 blocks
morpheus initrd-image # ls * -la
bin:
total 1726
drwx------ 2 root root    1024 Feb  2 23:28 .
drwxr-xr-x 5 root root    1024 Feb  2 23:29 ..
-rw------- 1 root root 1757020 Feb  2 23:28 bb

sbin:
total 1330
drwxr-xr-x 2 root root    1024 Feb  2 23:29 .
drwxr-xr-x 5 root root    1024 Feb  2 23:29 ..
-rw------- 1 root root 1352628 Feb  2 23:29 lvm

At the moment, changing the rights with chmod works for me.
Back to top
View user's profile Send private message
Raffi
l33t
l33t


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

PostPosted: Fri Feb 02, 2007 10:40 pm    Post subject: Reply with quote

That's very strange. It is acting like you are not copying into an ext2 file system.

Can you try to create a loopback ext2 filesytem by hand and see what happens when you copy to it using cpio? How are you looking at the files in the initrd that my script created?
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 10:52 pm    Post subject: Reply with quote

I've tried in different ways, even copying in the same ext3 filesystem gives the same results.

This way, I'm looking in the created initrd image:
Code:
morpheus mnt # mount -o loop /boot/initrd-lvm2-2.6.19-gentoo-r4 /mnt/initrd-image
morpheus mnt # ls initrd-image/ -la
total 35
drwxr-xr-x 10 root root  1024 Jan 29 17:59 .
drwxr-xr-x  7 root root  4096 Feb  2 23:28 ..
drwxr-xr-x  2 root root  4096 Jan 29 17:59 bin
drwxr-xr-x  2 root root  2048 Jan 29 17:58 dev
-rw-r--r--  1 root root 16896 Jan 29 17:58 dev.cpio
drwxr-xr-x  3 root root  1024 Jan 29 17:59 etc
drwxr-xr-x  2 root root  1024 Jan 29 17:58 lib
drwxr-xr-x  2 root root  1024 Jan 29 17:58 proc
drwxr-xr-x  2 root root  1024 Jan 29 17:58 rootvol
drwxr-xr-x  2 root root  1024 Jan 29 17:59 sbin
drwxr-xr-x  2 root root  1024 Jan 29 17:58 var
morpheus mnt # ls initrd-image/sbin/* -la
-r-xr-xr-x 1 root root    3810 Jan 29 17:59 initrd-image/sbin/init
-rw------- 1 root root 1352628 Jan 29 17:58 initrd-image/sbin/lvm
Back to top
View user's profile Send private message
Raffi
l33t
l33t


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

PostPosted: Fri Feb 02, 2007 11:46 pm    Post subject: Reply with quote

Sounds like either your kernel or your mkext2 command is doing something funny. What kernel version? What ext utils version.
Back to top
View user's profile Send private message
/root
n00b
n00b


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

PostPosted: Sat Feb 03, 2007 12:11 am    Post subject: Reply with quote

Current kernel version and e2fsprogs:
Code:

morpheus ~ # equery b mke2fs
[ Searching for file(s) mke2fs in *... ]
sys-fs/e2fsprogs-1.39-r1 (/sbin/mke2fs)
morpheus ~ # uname -r
2.6.19-ck2-r4

Also tried kernel 2.6.19-gentoo-r4 with almost same config as 2.6.19-ck2-r3 (initial kernel, no "execute" problems while building initrd image) but slightly changes in device driver section -> video for linux, character device, i2c.
Back to top
View user's profile Send private message
Raffi
l33t
l33t


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

PostPosted: Sat Feb 03, 2007 12:24 am    Post subject: Reply with quote

I'm running sys-fs/e2fsprogs-1.39.


I'm also using a vanilla 2.6.19.2 on one machine and a suspend2 sources (not sure which version) on another. This is really strange, you do seem to have a permissions problem when you copy files. It also looks like you might be running an ~arch version of everything. If you have verified that creating a initrd ext2 loopback by and and maybe even trying it straight on a ramdisk /dev/ram0 gives you problems just copying files and trying to preserve permission, I would suggest starting a new thread on that.
Back to top
View user's profile Send private message
/root
n00b
n00b


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

PostPosted: Sat Feb 03, 2007 1:31 am    Post subject: Reply with quote

I've opened a thread in "Other things Gentoo" on the cpio problem in general.
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 Feb 05, 2007 3:46 pm    Post subject: Reply with quote

/root wrote:
I've opened a thread in "Other things Gentoo" on the cpio problem in general.

Problem solved.

Downgrading to cpio 2.6-r5 does the trick.
Code:
morpheus initrd-image # echo /bin/bb | cpio -dpmL /mnt/initrd-image/
3432 blocks
morpheus initrd-image # ls bin/* -la
-rwxr-xr-x 1 root root 1757020 Jan 26 17:49 bin/bb
morpheus initrd-image # cpio --version
cpio (GNU cpio) 2.6
Back to top
View user's profile Send private message
Raffi
l33t
l33t


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

PostPosted: Thu Feb 22, 2007 7:24 pm    Post subject: Reply with quote

I just noticed that my laptop stopped being able to hibernate. Turns out when I upgraded to the latest hibernate-scripts (1.94-r3) the sanity checking decided my system was not setup to hibernate. The new scripts don't detect this setup because we purposefully avoided all of the normal ways of telling the kernel about our resume device (since the kernel would not understand them until we finish setting things up)The fix is to add the line

Code:

SuspendDevice /dev/vg/swap


to your hibernate.conf. This tells the script not to worry about not finding a resume device in the normal places. I have edit my original howto to add this detail.
Back to top
View user's profile Send private message
Raffi
l33t
l33t


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

PostPosted: Wed Feb 28, 2007 6:08 pm    Post subject: Word to the wise Reply with quote

If you ever have the resume fail because it did not see your hibernated data in your swap partition (as opposed to seeing and rejecting it) you will want to be sure to invalidate the hibernated image before your next reboot. At least if you value your disks staying in an uncorrupted state.

If your image was not detected (as opposed to rejected) your swap will probably not activate since it will contain the hibernate image instead of a valid swap signature. In this case, a simple mkswap will take care of the problem and prevent what happened to me.

I was trying to bring my script up to date to deal with changes to the kernel and the hibernate scripts and when I thought I had it, I hibernated my laptop. The next reboot showed that I had not successfully dealt with the change from /proc to /sys in activating the resume. The machine booted up all the way ignoring my hibernate images and not activating my swap. I did not pay attention, fixed my script and rebooted with the intent of hibernating from a clean boot. I knew I was not going to be happy when instead of a clean boot, it resumed from the previous hibernate.

Fortunately, a reiserfsck --rebuild-tree from the lvm2 rescue on a couple of my logical volumes got me up far enough to be able to start the emerge -e world. It could have been worse.

Anyway, I updated my script and it should correctly deal with using /sys as well as /proc for resuming and it my earlier post about updating the .conf file for the hibernate script should deal with those changes as well.
Back to top
View user's profile Send private message
weedy
Apprentice
Apprentice


Joined: 24 Jun 2005
Posts: 237

PostPosted: Fri Mar 09, 2007 6:56 am    Post subject: Reply with quote

with all these permission problems why not use rsync to copy the files?
Back to top
View user's profile Send private message
Raffi
l33t
l33t


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

PostPosted: Fri Mar 09, 2007 1:04 pm    Post subject: Reply with quote

The only difference between cpio and rsync is on directories and this is only on the timestamp. I could have used rsync, but I'm an old unix guy from way back before such new fangled tools. :)
Back to top
View user's profile Send private message
Raffi
l33t
l33t


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

PostPosted: Tue Apr 17, 2007 3:41 pm    Post subject: Reply with quote

Looks like the broken version of cpio has made it to portage stable. I have reported the bug. If it is not fixed soon, I will post a workaround.
Back to top
View user's profile Send private message
Raffi
l33t
l33t


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

PostPosted: Wed Apr 18, 2007 8:20 pm    Post subject: Reply with quote

From bugzilla

fixed in 2.7-r2

http://bugs.gentoo.org/show_bug.cgi?id=174921
Back to top
View user's profile Send private message
lkraav
Tux's lil' helper
Tux's lil' helper


Joined: 13 Oct 2004
Posts: 120
Location: Estonia

PostPosted: Thu Jul 12, 2007 9:27 am    Post subject: Reply with quote

hi raffi

thanks for the great script, i have converted regular setups into raid1+lvm2 setups running in no time.
my question is, do you know if adding LUKS support for mounting the root filesystem inside LVM2 volume suitable to be integrated in your script?

i am running the setup described here http://gentoo-wiki.com/SECURITY_System_Encryption_DM-Crypt_with_LUKS#Initramfs.27s_init on one machine,
it works well also. is it possible to bring these two scripts together?
Back to top
View user's profile Send private message
Raffi
l33t
l33t


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

PostPosted: Thu Jul 12, 2007 12:38 pm    Post subject: Reply with quote

lkraav wrote:

my question is, do you know if adding LUKS support for mounting the root filesystem inside LVM2 volume suitable to be integrated in your script?


Until your post, I had not heard of LUKS. A quick look through the howto seems like it would not be too hard to integrate into the lvm script. Since I don't have any current plans to encrypt my system, it is unlikely that I will get to it any time soon, but if you want to do it, I will be happy to try an help.
Back to top
View user's profile Send private message
lkraav
Tux's lil' helper
Tux's lil' helper


Joined: 13 Oct 2004
Posts: 120
Location: Estonia

PostPosted: Thu Jul 12, 2007 12:45 pm    Post subject: Reply with quote

thanks for your reply. the problem is, i would have to really start digging into both scripts without being the author. i think either of you guys could get the result in half or less time and effort. perhaps you have a virtual (vmware or other) machine you could experiment without tampering with your own system?

while encrypting the root filesystem usually isnt crucial anyway, i still think it would make for a coherent approach to designing a system, such as this:

raid1 -> lvm2 -> luks (swap, root, secure-data) -> ext/xfs/reiser...

i'll go ahead and start taking a look at both scripts to start.
Back to top
View user's profile Send private message
Raffi
l33t
l33t


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

PostPosted: Thu Jul 12, 2007 1:55 pm    Post subject: Reply with quote

lkraav wrote:
thanks for your reply. the problem is, i would have to really start digging into both scripts without being the author. i think either of you guys could get the result in half or less time and effort. perhaps you have a virtual (vmware or other) machine you could experiment without tampering with your own system?


I'm certain that you are correct on the speed part. However, I see the above as a reason for you to dig in and do it. In open source, everyone gives a little and we all gain a lot :) . Since I would not be using that system, just setting up a test system, I would not be in a good position to maintain the code nor would my motivation be as high as it should be to produce the best result. You will find by digging in, that you will gain a much fuller understanding of all the processes involved and will be in a position to help others gain that understanding.

The combined script is different enough from both my script and the luks script that it really should be its own howto. Once you get a working script, posting it as a new topic will generate some interest that will allow you to refine the script over time. As I said before, I will be happy to help you with the script, but I think you should take ownership of it.

lkraav wrote:

while encrypting the root filesystem usually isnt crucial anyway, i still think it would make for a coherent approach to designing a system, such as this:

raid1 -> lvm2 -> luks (swap, root, secure-data) -> ext/xfs/reiser...

i'll go ahead and start taking a look at both scripts to start.

I agree and am looking forward to your final product. It may even convince me to dive into encrypting my system :) .
Back to top
View user's profile Send private message
dexxxter
n00b
n00b


Joined: 19 Jul 2006
Posts: 18

PostPosted: Sun Jul 22, 2007 9:00 am    Post subject: Reply with quote

Hi!
I'm currently trying to make gentoo boot from root partition, located on LV over RAID mirror, but during boot i get following message:

initrd: Mounting /proc
initrd: Remounting / read/write
Starting RAID device /dev/md6
/sbin/init: /sbin/init: 78: /sbin/mdadm: Permission denied

...later...

*** Entering LVM2 rescue shell. Exit shell to continue booting. ***

/ $ mdadm
/bin/ash: mdadm: Permission denied
/ $ ls -la /sbin
drwxr-xr-x 2 0 0 1024 Jul 22 07:22 .
drwxr-xr-x 10 0 0 1024 Jul 22 07:22 ..
-r-xr-xr-x 1 0 0 3811 Jul 22 07:22 init
-rwxr-xr-x 1 0 0 1362680 Jul 22 07:22 lvm
-rwsr-xr-x 1 0 0 177352 Jul 22 07:22 mdadm

Chmoding mdadm to 0777, 0755, 4755 (as above) with no result.

Any Ideas why it doesn't start md-devices?

initrd was created with:
lvm2create_initrd.sh -M gentoo -c /etc/lvm/lvm.conf -r /dev/md6 -R /etc/mdadm.conf 2.6.20-gentoo-r7

kernel compiled with
CONFIG_MD=y
CONFIG_BLK_DEV_MD=y
CONFIG_MD_LINEAR=y
CONFIG_MD_RAID0=y
CONFIG_MD_RAID1=y
CONFIG_MD_RAID10=y
CONFIG_MD_RAID456=y
CONFIG_MD_RAID5_RESHAPE=y
# CONFIG_MD_MULTIPATH is not set
# CONFIG_MD_FAULTY is not set
CONFIG_BLK_DEV_DM=y
# CONFIG_DM_DEBUG is not set
CONFIG_DM_CRYPT=y
CONFIG_DM_SNAPSHOT=y
CONFIG_DM_MIRROR=y
# CONFIG_DM_ZERO is not set
# CONFIG_DM_MULTIPATH is not set
CONFIG_BLK_DEV_DM_BBR=m

Disk layout:
/dev/sda(b)1 -> /dev/md0 (raid1) -> /boot
/dev/sda(b)2 -> extended
/dev/sda3 -> current '/'
/dev/sda(b)4 -> /dev/md4 (raid0) -> swap
/dev/sda(b)5 -> /dev/md5 (raid0) -> LVM VG stripe
/dev/sda(b)6 -> /dev/md6 (raid1) -> LVM VG mirror

grub.conf:
title=GeNtOoOoOo LVM (2.6.20-7)
root (hd0,0)
kernel /kernel-genkernel-x86_64-2.6.20-gentoo-r7 root=/dev/ram0 lvm2root=/dev/mirror/root ramdisk_size=5456
initrd /initrd-lvm2-2.6.20-gentoo-r7.gz

also tried to add dodmraid dolvm2 to kernel options.
Back to top
View user's profile Send private message
Raffi
l33t
l33t


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

PostPosted: Sun Jul 22, 2007 12:56 pm    Post subject: Reply with quote

dexxxter wrote:
Hi!
I'm currently trying to make gentoo boot from root partition, located on LV over RAID mirror, but during boot i get following message:

initrd: Mounting /proc
initrd: Remounting / read/write
Starting RAID device /dev/md6
/sbin/init: /sbin/init: 78: /sbin/mdadm: Permission denied



There is a good chance you are running a broken version of cpio on the machine you created your initrd. What version are you running? Try upgrading, I'm using version 2.8
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 3 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