Skip to contentSkip to conversation

Question: build and install LVM2 on Centos7

DISCUSSION Leo Yan 2 participants 3 messages Jun 26, 2020 – Jul 1, 2020

lore
Share & tools
lore

Leo Yan

author
#0 lore raw

Hi there,

When built and installed LVM2 (with tag v2_02_187) on Centos7, I used below commands:

  # ./configure --prefix=/usr --includedir=/include --mandir=/share/man \
    --infodir=/share/info --sysconfdir=/etc --localstatedir=/var \
    --disable-silent-rules --sbindir=/sbin --enable-blkid_wiping \
    --enable-cmdlib --enable-dmeventd --enable-dbus-service \
    --enable-lvmlockd-sanlock --enable-lvmpolld --enable-notify-dbus \
    --enable-pkgconfig --enable-readline --enable-udev_rules \
    --enable-udev_sync --with-thin-check=/usr/sbin/thin_check \
    --with-thin-dump=/usr/sbin/thin_dump \
    --with-thin-repair=/usr/sbin/thin_repair \
    --with-cache=internal --with-thin=internal
  # make
  # make install

I found the libs will be installed into /usr/lib/ rather than into /usr/lib64:

  # make V=1 install | grep "\/usr\/lib"
  /usr/bin/install -c -m 555  -D libdevmapper-event-lvm2.so /usr/lib/libdevmapper-event-lvm2.so.2.02                         
  /usr/bin/install -c -m 755 -d /usr/lib
  ln -s -f libdevmapper-event-lvm2.so.2.02 /usr/lib/libdevmapper-event-lvm2.so                                               
  /usr/bin/install -c -m 555  -D libdevmapper-event-lvm2snapshot.so /usr/lib/device-mapper/libdevmapper-event-lvm2snapshot.so
  ln -s -f device-mapper/libdevmapper-event-lvm2snapshot.so /usr/lib/libdevmapper-event-lvm2snapshot.so                      
  /usr/bin/install -c -m 555  -D libdevmapper-event-lvm2raid.so /usr/lib/device-mapper/libdevmapper-event-lvm2raid.so        
  ln -s -f device-mapper/libdevmapper-event-lvm2raid.so /usr/lib/libdevmapper-event-lvm2raid.so                              
  /usr/bin/install -c -m 555  -D libdevmapper-event-lvm2thin.so /usr/lib/device-mapper/libdevmapper-event-lvm2thin.so        
  ln -s -f device-mapper/libdevmapper-event-lvm2thin.so /usr/lib/libdevmapper-event-lvm2thin.so                              
  /usr/bin/install -c -m 555  -D libdevmapper-event-lvm2mirror.so /usr/lib/device-mapper/libdevmapper-event-lvm2mirror.so    
  ln -s -f device-mapper/libdevmapper-event-lvm2mirror.so /usr/lib/libdevmapper-event-lvm2mirror.so                          
  /usr/bin/install -c -m 555  -D libdevmapper-event-lvm2vdo.so /usr/lib/device-mapper/libdevmapper-event-lvm2vdo.so          
  ln -s -f device-mapper/libdevmapper-event-lvm2vdo.so /usr/lib/libdevmapper-event-lvm2vdo.so                                
  /usr/bin/install -c -m 555  -D libdevmapper-event.so /usr/lib/libdevmapper-event.so.1.02                                   

[...]

So at the end, if my Centos7's rootFS is logical volumes, this will lead to booting failure. The reason is at the booting time, the lvm tool (should also include dmeventd) have been updated with myself built binaries, the default lib path should be /usr/lib64 but not the folder /usr/lib, so the upgraded binaries cannot find the appropriate libs. This is why we rescured the system by copying libdevmapper related libs from /usr/lib to /usr/lib64.

I can manually copy libs from /usr/lib to /usr/lib64 for libdevmapper-*, but seems to me this is not the formal way to do. My question is how I can smoothly upgrade self built LVM tools on Centos7?

Thanks,
Leo

#1 lore raw
Quoted 47 lines · Leo Yan

Hi there,

When built and installed LVM2 (with tag v2_02_187) on Centos7, I used below commands:

   # ./configure --prefix=/usr --includedir=/include --mandir=/share/man \
     --infodir=/share/info --sysconfdir=/etc --localstatedir=/var \
     --disable-silent-rules --sbindir=/sbin --enable-blkid_wiping \
     --enable-cmdlib --enable-dmeventd --enable-dbus-service \
     --enable-lvmlockd-sanlock --enable-lvmpolld --enable-notify-dbus \
     --enable-pkgconfig --enable-readline --enable-udev_rules \
     --enable-udev_sync --with-thin-check=/usr/sbin/thin_check \
     --with-thin-dump=/usr/sbin/thin_dump \
     --with-thin-repair=/usr/sbin/thin_repair \
     --with-cache=internal --with-thin=internal
   # make
   # make install

I found the libs will be installed into /usr/lib/ rather than into /usr/lib64:

   # make V=1 install | grep "\/usr\/lib"
   /usr/bin/install -c -m 555  -D libdevmapper-event-lvm2.so /usr/lib/libdevmapper-event-lvm2.so.2.02
   /usr/bin/install -c -m 755 -d /usr/lib
   ln -s -f libdevmapper-event-lvm2.so.2.02 /usr/lib/libdevmapper-event-lvm2.so
   /usr/bin/install -c -m 555  -D libdevmapper-event-lvm2snapshot.so /usr/lib/device-mapper/libdevmapper-event-lvm2snapshot.so
   ln -s -f device-mapper/libdevmapper-event-lvm2snapshot.so /usr/lib/libdevmapper-event-lvm2snapshot.so
   /usr/bin/install -c -m 555  -D libdevmapper-event-lvm2raid.so /usr/lib/device-mapper/libdevmapper-event-lvm2raid.so
   ln -s -f device-mapper/libdevmapper-event-lvm2raid.so /usr/lib/libdevmapper-event-lvm2raid.so
   /usr/bin/install -c -m 555  -D libdevmapper-event-lvm2thin.so /usr/lib/device-mapper/libdevmapper-event-lvm2thin.so
   ln -s -f device-mapper/libdevmapper-event-lvm2thin.so /usr/lib/libdevmapper-event-lvm2thin.so
   /usr/bin/install -c -m 555  -D libdevmapper-event-lvm2mirror.so /usr/lib/device-mapper/libdevmapper-event-lvm2mirror.so
   ln -s -f device-mapper/libdevmapper-event-lvm2mirror.so /usr/lib/libdevmapper-event-lvm2mirror.so
   /usr/bin/install -c -m 555  -D libdevmapper-event-lvm2vdo.so /usr/lib/device-mapper/libdevmapper-event-lvm2vdo.so
   ln -s -f device-mapper/libdevmapper-event-lvm2vdo.so /usr/lib/libdevmapper-event-lvm2vdo.so
   /usr/bin/install -c -m 555  -D libdevmapper-event.so /usr/lib/libdevmapper-event.so.1.02
   [...]

So at the end, if my Centos7's rootFS is logical volumes, this will lead to booting failure. The reason is at the booting time, the lvm tool (should also include dmeventd) have been updated with myself built binaries, the default lib path should be /usr/lib64 but not the folder /usr/lib, so the upgraded binaries cannot find the appropriate libs. This is why we rescured the system by copying libdevmapper related libs from /usr/lib to /usr/lib64.

Quoted 3 lines

I can manually copy libs from /usr/lib to /usr/lib64 for libdevmapper-*, but seems to me this is not the formal way to do. My question is how I can smoothly upgrade self built LVM tools on Centos7?

I think you should just do what rpm macro %configure used in EL7 spec file does. That expands to rather long statement:

./configure --build=x86_64-redhat-linux-gnu --host=x86_64-redhat-linux-gnu --program-prefix= --disable-dependency-tracking --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib64 --libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/var/lib --mandir=/usr/share/man --infodir=/usr/share/info

Quoted 8 lines

Thanks,
Leo

--
lvm-devel mailing list
lvm-devel at redhat.com
https://www.redhat.com/mailman/listinfo/lvm-devel

author
#2 lore raw

Hi Marian,

On Fri, Jun 26, 2020 at 05:15:25PM +0200, Marian Csontos wrote:

[...]

Quoted 9 lines
Quoted 3 lines

I can manually copy libs from /usr/lib to /usr/lib64 for libdevmapper-*, but seems to me this is not the formal way to do. My question is how I can smoothly upgrade self built LVM tools on Centos7?

I think you should just do what rpm macro %configure used in EL7 spec file does. That expands to rather long statement:

Quoted 6 lines

./configure --build=x86_64-redhat-linux-gnu --host=x86_64-redhat-linux-gnu --program-prefix= --disable-dependency-tracking --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib64 --libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/var/lib --mandir=/usr/share/man --infodir=/usr/share/info

Thanks for kindly replying; It's very useful, I tried it and works well. Just note, I also found the macro %configure can be read out with the command 'rpm --eval %configure'.

For the best practice for releasing, I recognized the rpm package might
be a better way to move forward [1]. Will find time to try this as
well.

Thank you for the helping.

Leo

[1] https://www.thegeekstuff.com/2015/02/rpm-build-package-example/