Hi,

Le 09/11/2019 à 00:32, Christopher Gregory via blfs-support a écrit :
> 
> 
>> Sent: Thursday, November 07, 2019 at 4:54 PM
>> From: "Christopher Gregory via blfs-support" 
>> <blfs-support@lists.linuxfromscratch.org>
>> To: blfs-support@lists.linuxfromscratch.org
>> Cc: "Christopher Gregory" <christopher.greg...@mail.com>
>> Subject: Re: [blfs-support] Best approach for lvm2
>>
>>
>>
>>> Sent: Thursday, November 07, 2019 at 7:49 AM
>>> From: "Christopher Gregory via blfs-support" 
>>> <blfs-support@lists.linuxfromscratch.org>
>>> To: blfs-support@lists.linuxfromscratch.org
>>> Cc: "Christopher Gregory" <christopher.greg...@mail.com>
>>> Subject: Re: [blfs-support] Best approach for lvm2
>>>
>>>
>>>
>>>> Sent: Thursday, November 07, 2019 at 4:59 AM
>>>> From: "Pierre Labastie via blfs-support" 
>>>> <blfs-support@lists.linuxfromscratch.org>
>>>> To: blfs-support@lists.linuxfromscratch.org
>>>> Cc: "Pierre Labastie" <pierre.labas...@neuf.fr>
>>>> Subject: Re: [blfs-support] Best approach for lvm2
>>>>
>>>> On 06/11/2019 16:16, Christopher Gregory via blfs-support wrote:
>>>>>
>>>>>> Sent: Wednesday, November 06, 2019 at 11:11 AM
>>>>>> From: "Pierre Labastie via blfs-support" 
>>>>>> <blfs-support@lists.linuxfromscratch.org>
>>>>>> To: blfs-support@lists.linuxfromscratch.org
>>>>>> Cc: "Pierre Labastie" <pierre.labas...@neuf.fr>
>>>>>> Subject: Re: [blfs-support] Best approach for lvm2
>>>>>>
>>>>>> Le 05/11/2019 à 19:54, Christopher Gregory via blfs-support a écrit :
>>>>>>>
>>>>>> << [...]
>>>>>>> Hello Pierre,
>>>>>>>
>>>>>>> The nightmare continues.  I have now installed debian buster and it 
>>>>>>> detected the lfs installation the same way fedora does with os-prober:
>>>>>>>
>>>>>>> menuentry 'Linux From Scratch (20191025-systemd) (on 
>>>>>>> /dev/mapper/rootvg-root)' --class linuxfromscratch --class gnu-linux 
>>>>>>> --class gnu --class os $menuentry_id_option 
>>>>>>> 'osprober-gnulinux-simple-4155330c-5db1-4113-834f-afefb2d2570e' {
>>>>>>>          insmod lvm
>>>>>>>          insmod part_gpt
>>>>>>>          insmod ext2
>>>>>>>          set root='lvm/rootvg-root'
>>>>>>>          if [ x$feature_platform_search_hint = xy ]; then
>>>>>>>            search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 
>>>>>>> --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  
>>>>>>> 099738b6-ac51-455f-9d60-fac5d900ba8b
>>>>>>>          else
>>>>>>>            search --no-floppy --fs-uuid --set=root 
>>>>>>> 099738b6-ac51-455f-9d60-fac5d900ba8b
>>>>>>>          fi
>>>>>>>          linux /vmlinuz-5.3.6-lfs-20191025-systemd 
>>>>>>> root=/dev/mapper/rootvg-root
>>>>>>>          initrd /initrd.img-no-kmods
>>>>>>>
>>>>>>> I added insmod lvm and changed the set root= line.  This gives me 
>>>>>>> again, the initrd shell with the error that the device that was suppose 
>>>>>>> to contain the root file system does not exist.  For some reason it is 
>>>>>>> proving impossible for me to get it to work.  I have no idea why.
>>>>>>>
>>>>>>> Regards,
>>>>>>>
>>>>>>> Christopher.
>>>>>>>
>>>>>> Well, not sure. Try removing the lines from "if" to "fi" (it may set 
>>>>>> root to
>>>>>> something else I am not sure about), and insert /boot before /vmlinuz and
>>>>>> /initrd.img.
>>>>>>
>>>>>> Pierre
>>>>>> -- 
>>>>>> http://lists.linuxfromscratch.org/listinfo/blfs-support
>>>>>> FAQ: http://www.linuxfromscratch.org/blfs/faq.html
>>>>>> Unsubscribe: See the above information page
>>>>>>
>>>>> Hello Pierre,
>>>>>
>>>>> I have made some progress in this nightmare.  I have found a few things:
>>>>>
>>>>> 1) The initramfs script that is in the book is a bit too simplistic for 
>>>>> actually being able to fix anything with regards to lvm.  It needs to 
>>>>> have the lvm tools actually added to it.  lvm is needed, as vgscan and a 
>>>>> few of the other tools are needed and are indeed missing.  It needs the 
>>>>> more command added, as you are unable to read all the screen contents if 
>>>>> you use ls.
>>>>>
>>>>> 2) The reason that it complains about the device not existing, is because 
>>>>> it really does not.  In /dev/mapper from within the intiramfs shell, 
>>>>> there is only control there, none of the rootvg-root swap home entries 
>>>>> are present.  These are simlinks to dm-6 etc that are actually the images 
>>>>> of the created devices.  From extensive research, other distros such as 
>>>>> ubuntu have encountered the exact same issue after they have upgraded 
>>>>> lvm2.  They have narrowed it down to an issue with vgscan itself.  The 
>>>>> tools are needed to investigate it further.  I am going to add those 
>>>>> tools and attempt the work around so that I can perhaps solve it myself 
>>>>> and provide the information, so that it could be added to the book.
>>>>>
>>>>> 3) In order to solve the linux image not found issue, after a lot of 
>>>>> messing around in the shell, and based on the ubuntu work arounds, I have 
>>>>> had to add (hd0,msdos1) in front of both the vmlinuz line and initrd 
>>>>> lines.  I am about to do another test, now that I have found them and set 
>>>>> root=/dev/mapper/rootvg-root on the vmlinuz line and see if that fixes 
>>>>> it, as they said in that ubuntu thread that this is needed to actually 
>>>>> activate the vg images.
>>>>
>>>> Ah sorry, things which look obvious to me (not because I am smart, but 
>>>> because I have been using that for ages) may not be obvious to others... 
>>>> If you want lvm support in the initramfs, you need lvm2 accessible from 
>>>> where you generate the initramfs!
>>>> Note that it is not vgscan, which adds the symllinks , but "vgchange -a 
>>>> y", which is in the initramfs init code.
>>>>
>>>> There are several places in mkinitramfs where "if [ -x /sbin/lvm ]" is 
>>>> tested. If it is not there, no lvm support...
>>>>
>>>> Actually, there is some misleading text: "The scripts will allow 
>>>> specifying a rootfs via partition UUID or partition LABEL or a rootfs on 
>>>> an LVM logical volume". But it does not tell that installing lvm is 
>>>> needed for that. I think I should add some precision (after "Required 
>>>> runtime dependency").
>>>>
>>>> Pierre
>>>>
>>>> -- 
>>>> http://lists.linuxfromscratch.org/listinfo/blfs-support
>>>> FAQ: http://www.linuxfromscratch.org/blfs/faq.html
>>>> Unsubscribe: See the above information page
>>>>
>>>
>>> Hello Pierre,
>>>
>>> I wish it was as simple as running the initramfs creation script on a host 
>>> that is running lvm2, but this is sadly not the case.  I have re-run the 
>>> script on Fedora 31, and after being dumped in the initramfs shell, lvm has 
>>> not been copied into the shell, so there is no vgchange executable present. 
>>>  I am attempting to add it to the creation script, but I do not think I am 
>>> going to be successful.  It seems that it is meant to be copied from this 
>>> line:
>>>
>>> # Add lvm if present
>>> if [ -x /sbin/lvm ] ; then sbinfiles="$sbinfiles lvm dmsetup"; fi
>>>
>>> for f in $sbinfiles ; do
>>>   ldd /sbin/$f | sed "s/\t//" | cut -d " " -f1 >> $unsorted
>>>   copy $f sbin
>>> done
>>>
>>> Also as I have already mentioned there are a number of complaints in the 
>>> existing script about a missing operand after it is trying to copy the 
>>> /tmp/workingdirectory/lib
>>>
>>> Would you be able to give any other pointers as to how I should get the lvm 
>>> into the init, as I really do need it, as the symlinks are not created 
>>> which is causing the failure.
>>>
>>> Regards,
>>>
>>> Christopher.
>>> -- 
>>> http://lists.linuxfromscratch.org/listinfo/blfs-support
>>> FAQ: http://www.linuxfromscratch.org/blfs/faq.html
>>> Unsubscribe: See the above information page
>>>
>>
>> Hello Pierre,
>>
>> I have managed to make some progress on this, but the nightmare is far from 
>> over.  I built a new kernel and initramfs in chroot.  I booted my new lfs 
>> installation, and I got dropped to the shell as it could not find 
>> /dev/mapper/rootvg-root.  
>>
>> I then went into dev, and to my delight there is now vgchange etc in there.  
>> I proceeded with vgchange -ay and it activated and listed both debian and 
>> fedora, but NOT lfs.  
>> 0What is going on here?  What have I missed.  I know darn well the 
>> rootvg-root rootvg-opt rootvg-tmp rootvg-home rootvg-swap exist, as I 
>> mounted them as mount /dev/mapper/rootvg-root etc when I installed lfs with 
>> jhalfs.
>>
>> Do I have to recreate them again from the initrd shell, and if I did so 
>> would I not loose the data on them?
>>
>> Regards,
>>
>> Christopher.
>> -- 
>> http://lists.linuxfromscratch.org/listinfo/blfs-support
>> FAQ: http://www.linuxfromscratch.org/blfs/faq.html
>> Unsubscribe: See the above information page
>>
> 
> Hello Pierre,
> 
> I guess I will never know what exactly was the issue regarding that 
> installation, though I suspect it was due to following an inaccurate guide on 
> the net.
> 
> I have just done a clean install, and have used three of my 4 internal 
> drives.  After the lfs install, I logged in via chroot set my root password, 
> and then I installed the mkinitramfs scripts, installed lvm2 then created the 
> initramfs image.  I then rebooted and selected the newly installed lfs, fully 
> expecting to be dropped into a shell as was the case before.  I was delighted 
> when the boot up was successful.

Glad it worked!

> 
> The only irritation was that when I created the pv's following the 
> instructions in the book, it proceeded to wipe out my bios_grub partition,

Quite unexpected! pvcreate works with what you pass to it on the command line.
If you pass partitions, it uses that. If you pass a full volume (that's
possible), it of course wipes out the partition layout on this volume. But
that's not in the book. In this case "man pvcreate" is your friend :).

> making it impossible to install grub on that drive.  I guess I missed 
> something that would have prevented this from happening.  I chalk the other 
> install up to a learning experience.
> 
> I now know that moving forward I will never have to worry about running out 
> of space on a partition again.  This seems to me to be the most efficient way 
> to utilize disk space.  When I learn how, it will also be a great way to take 
> a snapshot of the installed os.  At least I have a couple of hard drives to 
> store it on.

Agreed about the "efficient way". But maybe not the "most" or the "best": I've
never used it, but btrfs seems to allow roughly the same things, and it has
support in the kernel, so no need for an initramfs.

> 
> With this learning curve, and the fact that it worked to my advantage that 
> you had missed in the book stating that the script had to be run on a system 
> with lvm already installed, it caused me to do something that I have not done 
> since first starting with linuxfromscratch, and that is totally wiping 
> everything and starting from scratch.  I really am greatfull to you for that, 
> as I hate changing things that are working.

Sorry anyway (have to remember to modify the book, actually). But hopefully
your experience will allow a better writing to go into the book (about lvm in
intramfs and using full volumes in pvcreate)

> 
> Now I have to work out if I can install a second os on the same drives in 
> some of the spare space, without destroying what I already have.

Hopefully doable. Let us know. TIA.

Regards,
Pierre
-- 
http://lists.linuxfromscratch.org/listinfo/blfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Reply via email to