Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 690404 - sys-fs/lvm2-2.02.145-r2 - On shutdown lvm stop fails with message "Line too long (max 255) beginning...."
Summary: sys-fs/lvm2-2.02.145-r2 - On shutdown lvm stop fails with message "Line too l...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Robin Johnson
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-07-21 20:01 UTC by Norman Back
Modified: 2020-04-14 18:34 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Patch for openrc to fix lvm stop issue (lvm2-stop-fix.patch,953 bytes, patch)
2019-07-21 20:01 UTC, Norman Back
Details | Diff
Corrected patch for sys-fs/lvm2-2.02.145-r2 (lvm2-stop-fix-2.02.145-r2.patch,935 bytes, patch)
2019-07-22 10:37 UTC, Norman Back
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Norman Back 2019-07-21 20:01:31 UTC
Created attachment 583970 [details, diff]
Patch for openrc to fix lvm stop issue

When shutting down a system with a large number of VGs /etc/init.d/lvm crashes with the message "Line too long (max 255) beginning...."
Attached is a patch that fixes openrc.
Comment 1 Norman Back 2019-07-22 07:01:47 UTC
Correction:
Attached is a patch that fixes /etc/init.d/lvm from sys-fs/lvm2-2.02.145-r2
Comment 2 Norman Back 2019-07-22 07:02:51 UTC
emerge --info
Portage 2.3.66 (python 2.7.15-final-0, default/linux/amd64/17.1/desktop/plasma, gcc-8.3.0, glibc-2.29-r2, 5.0.21-gentoo x86_64)
=================================================================
System uname: Linux-5.0.21-gentoo-x86_64-AMD_Phenom-tm-_II_X4_965_Processor-with-gentoo-2.6
KiB Mem:    16406896 total,  13295368 free
KiB Swap:   46137328 total,  46137328 free
Timestamp of repository gentoo: Sun, 21 Jul 2019 01:15:01 +0000
Head commit of repository gentoo: 664ec5dec05e7e808b9a633c372b85d24ea153d1
sh bash 4.4_p23-r1
ld GNU ld (Gentoo 2.32 p2) 2.32.0
distcc 3.3.2 x86_64-pc-linux-gnu [disabled]
ccache version 3.6 [disabled]
app-shells/bash:          4.4_p23-r1::gentoo
dev-java/java-config:     2.2.0-r4::gentoo
dev-lang/perl:            5.28.2-r1::gentoo
dev-lang/python:          2.7.15::gentoo, 3.6.5::gentoo
dev-util/ccache:          3.6::gentoo
dev-util/cmake:           3.14.3::gentoo
dev-util/pkgconfig:       0.29.2::gentoo
sys-apps/baselayout:      2.6-r1::gentoo
sys-apps/openrc:          0.41.2::gentoo
sys-apps/sandbox:         2.13::gentoo
sys-devel/autoconf:       2.13-r1::gentoo, 2.69-r4::gentoo
sys-devel/automake:       1.11.6-r3::gentoo, 1.13.4-r2::gentoo, 1.16.1-r1::gentoo
sys-devel/binutils:       2.32-r1::gentoo
sys-devel/gcc:            8.3.0-r1::gentoo
sys-devel/gcc-config:     2.0::gentoo
sys-devel/libtool:        2.4.6-r3::gentoo
sys-devel/make:           4.2.1-r4::gentoo
sys-kernel/linux-headers: 4.14-r1::gentoo (virtual/os-headers)
sys-libs/glibc:           2.29-r2::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://datastoreone/gentoo-portage
    priority: -1000
    sync-rsync-verify-jobs: 1
    sync-rsync-verify-metamanifest: yes
    sync-rsync-extra-opts: 
    sync-rsync-verify-max-age: 24

local
    location: /usr/local/portage
    masters: gentoo
    priority: 0

ikelos
    location: /var/lib/layman/ikelos
    masters: gentoo
    priority: 50

vmware
    location: /var/lib/layman/vmware
    masters: gentoo
    priority: 50

Installed sets: @kernels
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="@FREE"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=amdfam10 -mtune=amdfam10 -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt /usr/share/themes/oxygen-gtk/gtk-2.0"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php7.3/ext-active/ /etc/php/cgi-php7.3/ext-active/ /etc/php/cli-php7.3/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-march=amdfam10 -mtune=amdfam10 -O2 -pipe"
DISTDIR="/mnt/portage.autofs/distfiles"
EMERGE_DEFAULT_OPTS="--with-bdeps=y -j9 --load-average=8 --quiet-build=y"
ENV_UNSET="DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs buildpkg config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch parallel-install pid-sandbox preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://mirror.qubenet.net/mirror/gentoo/ http://mirrors.linuxant.fr/distfiles.gentoo.org/ ftp://mirror.qubenet.net/mirror/gentoo/ http://www.mirrorservice.org/sites/www.ibiblio.org/gentoo/ http://ftp.snt.utwente.nl/pub/os/linux/gentoo ftp://ftp.free.fr/mirrors/ftp.gentoo.org/ http://mirror.leaseweb.com/gentoo/ http://gentoo.modulix.net/gentoo/ http://linux.rz.ruhr-uni-bochum.de/download/gentoo-mirror/ ftp://mirror.bytemark.co.uk/gentoo/"
LANG="en_GB.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="en en_GB"
MAKEOPTS="-j8 --load-average=9"
PKGDIR="/mnt/portage.autofs/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git --exclude=lost+found/"
PORTAGE_TMPDIR="/var/tmp"
USE="X a52 aac accessibility acl acpi activities alsa amarok amd64 amr authdaemond bash-completion berkdb bluetooth bluray branding bzip2 cairo caps cdda cdr cli consolekit crypt cups cxx dbus declarative dri dts dv dvd dvdr dvdread emboss encode exif fam flac fortran gdbm gif glamor gpm gtk iconv icu ieee1394 ipv6 jpeg kde kipi kwallet lcms ldap libnotify libtirpc lm_sensors lock mad mmx mmxext mng mp3 mp4 mpeg multilib mysql ncurses network nls nptl ofx ogg opengl openmp oss pam pango pcre pdf phonon plasma png policykit popcnt ppds pulseaudio qml qt3 qt5 readline samba sasl sdl seccomp semantic-desktop session spell split-usr sse sse2 sse3 sse4a ssl startup-notification svg tcpd thunar tiff truetype udev udisks uk_bleb uk_rt unicode upower usb v4l v4l2 vdpau vorbis widgets wxwidgets x264 xattr xcb xcomposite xinerama xml xv xvid xvmc zlib" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="actions alias auth_basic auth_digest authn_anon authn_dbd authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock dbd deflate dir disk_cache env expires ext_filter file_cache filter headers ident imagemap include info log_config logio mem_cache mime mime_magic negotiation proxy proxy_ajp proxy_balancer proxy_connect proxy_http rewrite setenvif so speling status unique_id userdir usertrack vhost_alias cgi cgid slotmem_shm unixd access_compat authz_core socache_shmcb authn_core" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext popcnt sse sse2 sse3 sse4a" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="efi-32 efi-64 pc multiboot mount" INPUT_DEVICES="evdev" KERNEL="linux" L10N="en en-GB" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" NETBEANS_MODULES="apisupport cnd groovy gsf harness ide identity j2ee java mobility nb php profiler soa visualweb webcommon websvccommon xml" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-2" POSTGRES_TARGETS="postgres10 postgres11" PYTHON_SINGLE_TARGET="python3_6" PYTHON_TARGETS="python2_7 python3_6" QEMU_SOFTMMU_TARGETS="i386 x86_64" QEMU_USER_TARGETS="i386 x86_64" RUBY_TARGETS="ruby24 ruby25" SANE_BACKENDS="hp5590 hp net abaton agfafocus apple artec artec_eplus48u as6e avision bh canon canon630u canon_dr canon_pp cardscan coolscan coolscan2 coolscan3 dc210 dc240 dc25 dell1600n_net dmc epjitsu epson epson2 fujitsu genesys gt68xx hp3500 hp3900 hp4200 hp5400 hpljm1005 hpsj5s hs2p ibm kodak kvs1025 kvs20xx leo lexmark ma1509 magicolor matsushita microtek microtek2 mustek mustek_pp mustek_usb nec niash p5 pie pixma plustek plustek_pp pnm qcam ricoh rts8891 s9036 sceptre sharp sm3600 sm3840 snapscan sp15c st400 stv680 tamarack teco1 teco2 teco3 test u12 umax umax1220u umax_pp xerox_mfp" USERLAND="GNU" VIDEO_CARDS="nvidia" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CC, CPPFLAGS, CTARGET, CXX, INSTALL_MASK, LC_ALL, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 3 Norman Back 2019-07-22 10:37:04 UTC
Created attachment 584000 [details, diff]
Corrected patch for sys-fs/lvm2-2.02.145-r2
Comment 4 Thomas Deutschmann (RETIRED) gentoo-dev 2019-11-29 00:31:47 UTC
Does anyone know why we are passing $VGS to the command at all? When I didn't read source code the wrong way, command will determine all VGs on its own when _no_ VG were passed on command-line, see https://github.com/lvmteam/lvm2/blob/v2_02_186/tools/toollib.c#L2263-L2271

So I would propose to change

> - lvm_commands="${lvm_commands}lvchange --config '${config}' --sysinit -a ln ${VGS}\n"
> + lvm_commands="${lvm_commands}lvchange --config '${config}' --sysinit -a ln\n"

Same for vgchange.

Norman, could you please check if this is working for you?
Comment 5 Norman Back 2019-11-29 09:26:16 UTC
(In reply to Thomas Deutschmann from comment #4)
> Does anyone know why we are passing $VGS to the command at all? When I
> didn't read source code the wrong way, command will determine all VGs on its
> own when _no_ VG were passed on command-line, see
> https://github.com/lvmteam/lvm2/blob/v2_02_186/tools/toollib.c#L2263-L2271
> 
> So I would propose to change
> 
> > - lvm_commands="${lvm_commands}lvchange --config '${config}' --sysinit -a ln ${VGS}\n"
> > + lvm_commands="${lvm_commands}lvchange --config '${config}' --sysinit -a ln\n"
> 
> Same for vgchange.
> 
> Norman, could you please check if this is working for you?

Yes. That fixes it. rc.log now shows:
<<<
 * Shutting down the Logical Volume Manager
 *   Shutting Down LVs & VGs ...
  Logical volume sys_ssd1_6/slash contains a filesystem in use.
  Logical volume sys_ssd1_6/usr contains a filesystem in use.
 * Failed (possibly some LVs still needed for /usr or root)
 [ !! ]
>>>
Comment 6 Norman Back 2019-11-29 09:38:22 UTC
(In reply to Norman Back from comment #5)
> (In reply to Thomas Deutschmann from comment #4)
> > Does anyone know why we are passing $VGS to the command at all? When I
> > didn't read source code the wrong way, command will determine all VGs on its
> > own when _no_ VG were passed on command-line, see
> > https://github.com/lvmteam/lvm2/blob/v2_02_186/tools/toollib.c#L2263-L2271
> > 
> > So I would propose to change
> > 
> > > - lvm_commands="${lvm_commands}lvchange --config '${config}' --sysinit -a ln ${VGS}\n"
> > > + lvm_commands="${lvm_commands}lvchange --config '${config}' --sysinit -a ln\n"
> > 
> > Same for vgchange.
> > 
> > Norman, could you please check if this is working for you?
> 
> Yes. That fixes it. rc.log now shows:
> <<<
>  * Shutting down the Logical Volume Manager
>  *   Shutting Down LVs & VGs ...
>   Logical volume sys_ssd1_6/slash contains a filesystem in use.
>   Logical volume sys_ssd1_6/usr contains a filesystem in use.
>  * Failed (possibly some LVs still needed for /usr or root)
>  [ !! ]
> >>>

I also tried
-lvm_commands="${lvm_commands}vgchange --config '${config}' --sysinit -a ln ${VGS}\n"
+lvm_commands="${lvm_commands}vgchange --config '${config}' --sysinit -a ln\n"

Which also works.

So it might be possible to simplify the line
  VGS=$($lvm_path vgs --config "${config}" -o vg_name --noheadings --nosuffix --rows 2> /dev/null)
so that it just returns true or false.
Comment 7 Norman Back 2019-11-29 10:28:54 UTC
(In reply to Norman Back from comment #6)
> (In reply to Norman Back from comment #5)
> > (In reply to Thomas Deutschmann from comment #4)
> > > Does anyone know why we are passing $VGS to the command at all? When I
> > > didn't read source code the wrong way, command will determine all VGs on its
> > > own when _no_ VG were passed on command-line, see
> > > https://github.com/lvmteam/lvm2/blob/v2_02_186/tools/toollib.c#L2263-L2271
> > > 
> > > So I would propose to change
> > > 
> > > > - lvm_commands="${lvm_commands}lvchange --config '${config}' --sysinit -a ln ${VGS}\n"
> > > > + lvm_commands="${lvm_commands}lvchange --config '${config}' --sysinit -a ln\n"
> > > 
> > > Same for vgchange.
> > > 
> > > Norman, could you please check if this is working for you?
> > 
> > Yes. That fixes it. rc.log now shows:
> > <<<
> >  * Shutting down the Logical Volume Manager
> >  *   Shutting Down LVs & VGs ...
> >   Logical volume sys_ssd1_6/slash contains a filesystem in use.
> >   Logical volume sys_ssd1_6/usr contains a filesystem in use.
> >  * Failed (possibly some LVs still needed for /usr or root)
> >  [ !! ]
> > >>>
> 
> I also tried
> -lvm_commands="${lvm_commands}vgchange --config '${config}' --sysinit -a ln
> ${VGS}\n"
> +lvm_commands="${lvm_commands}vgchange --config '${config}' --sysinit -a
> ln\n"
> 
> Which also works.
> 
> So it might be possible to simplify the line
>   VGS=$($lvm_path vgs --config "${config}" -o vg_name --noheadings
> --nosuffix --rows 2> /dev/null)
> so that it just returns true or false.

I should have added, these tests were done with
sys-fs/lvm2-2.02.186-r2
Comment 8 Thomas Deutschmann (RETIRED) gentoo-dev 2020-04-14 15:08:11 UTC
Hrm, you sure this worked? :)

I am getting

>  * Shutting down the Logical Volume Manager
>  *   Shutting Down LVs & VGs ...
>   No command with matching syntax recognised.  Run 'lvchange --help' for more information.
>   Nearest similar command has syntax:
>  [ ok ]
Comment 9 Thomas Deutschmann (RETIRED) gentoo-dev 2020-04-14 17:09:02 UTC
Forget my previous comment, I mixed lvchange with vgchange.
Comment 10 Larry the Git Cow gentoo-dev 2020-04-14 18:34:48 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=83556863450367f6001774338d77cfca6bb70e8f

commit 83556863450367f6001774338d77cfca6bb70e8f
Author:     Thomas Deutschmann <whissi@gentoo.org>
AuthorDate: 2020-04-14 17:46:32 +0000
Commit:     Thomas Deutschmann <whissi@gentoo.org>
CommitDate: 2020-04-14 18:34:21 +0000

    sys-fs/lvm2: runscript: rework stop()
    
    - Don't use LVM script anymore: If one command within script failed,
      any following command won't run anymore.
    
    - Be verbose when rc_verbose=yes is set.
    
    - Don't pass VGs to vgchange command. This way, LVM will determine VGs
      on its own and we don't risk to hit command limit when system has
      many VGs.
    
    Closes: https://bugs.gentoo.org/690404
    Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>

 sys-fs/lvm2/files/lvm.rc-2.02.187 | 47 ++++++++++++++++++---------------------
 1 file changed, 22 insertions(+), 25 deletions(-)