Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] lvmetad confusion
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
c00l.wave
Apprentice
Apprentice


Joined: 24 Aug 2003
Posts: 245

PostPosted: Wed Feb 17, 2016 7:22 pm    Post subject: [SOLVED] lvmetad confusion Reply with quote

sys-fs/lvm2 warns on emerge:

Code:
Notice that "use_lvmetad" setting is enabled with USE="udev" in
/etc/lvm/lvm.conf, which will require restart of udev, lvm, and lvmetad
if it was previously disabled.


I didn't use lvmetad before but as it seems it's now required by udev and by looking at the config file it should either be used or must not be used to prevent any errors. So I added it to boot runlevel before I rebooted.

However, when I look at /var/log/rc.log lvmetad started successfully but lvm2 was unable to use it and did what it wasn't supposed to and started my volumes without lvmetad?! (You can ignore the mdadm error status which has always been there unless you can tell me how to fix that minor visual glitch as well ;) )

Code:
 * Starting lvmetad ...
 [ ok ]
 * Starting up RAID devices ...
 * mdadm: /dev/md1 has been started with 2 drives.
mdadm: /dev/md9 has been started with 2 drives.
 [ !! ]
 * Setting up the Logical Volume Manager ...
  /run/lvm/lvmetad.socket: connect failed: No such file or directory
  WARNING: Failed to connect to lvmetad. Falling back to internal scanning.
 [ ok ]
 * Checking local filesystems  ...
/dev/md0: clean, 910325/3932160 files, 5348282/15728624 blocks
/dev/md9: clean, 404/24856 files, 38098/99264 blocks
/dev/mapper/vg00-backup: clean, 1361/22937600 files, 52701900/91750400 blocks
/dev/mapper/vg00-gluster--brick--1: clean, 289813/3276800 files, 9900312/13107200 blocks
 [ ok ]


Running LVM commands no longer produces any error messages about lvmetad not running as it did before the world update, so lvmetad is actually running fine. I just don't feel comfortable with LVM initialization obviously behaving contrary to their config "guidelines"...
_________________
nohup nice -n -20 cp /dev/urandom /dev/null &


Last edited by c00l.wave on Wed Apr 06, 2016 11:47 am; edited 1 time in total
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6228
Location: Room 101

PostPosted: Thu Feb 18, 2016 1:35 am    Post subject: Re: lvmetad confusion Reply with quote

c00l.wave wrote:
I didn't use lvmetad before but as it seems it's now required by udev and by looking at the config file it should either be used or must not be used to prevent any errors. So I added it to boot runlevel before I rebooted.

c00l.wave ... yes, "seems", but most probably not ;)

c00l.wave wrote:
However, when I look at /var/log/rc.log lvmetad started successfully but lvm2 was unable to use it and did what it wasn't supposed to and started my volumes without lvmetad?!

Yes, because /run is tmpfs, so /run/lvm doesn't exist unless you configure it via tmpfiles.d ... hence it doesn't find the socket. That aside, how are you using mdadm and lvm, is your initramfs used ITR, if so you probably don't need to start these, or have lvmetad running. In my case lvm is setup at the initramfs stage, and no further initialisation is needed, and no udev, lvmetad, etc (I don't use mdadm however, but that shouldn't matter).

c00l.wave wrote:
(You can ignore the mdadm error status which has always been there unless you can tell me how to fix that minor visual glitch as well ;) )

That's probably a question for NeddySeagoon, but possibly the RAID is active ... somewhat of a guess.

c00l.wave wrote:
Running LVM commands no longer produces any error messages about lvmetad not running as it did before the world update, so lvmetad is actually running fine. I just don't feel comfortable with LVM initialization obviously behaving contrary to their config "guidelines"...

As I said, I don't have udev, or lvmetad, running and can issue lvm commands ... I don't consider that a miracle, that's what I would consider "expected behaviour", the question being what is it that having these daemons active is supposed to make possible, why would I need a daemon to do something which is working without them doing anything? That's a rhetorical question, the fact being that I don't and mostly likely you don't either.

best ... khay
Back to top
View user's profile Send private message
c00l.wave
Apprentice
Apprentice


Joined: 24 Aug 2003
Posts: 245

PostPosted: Thu Feb 18, 2016 11:57 am    Post subject: Reply with quote

The server boots the full rootfs from mdraid superblock format 0.90 via kernel-side auto-detection to avoid having to use initramfs (I was never a fan of initrd, especially not on Gentoo where I compile my kernel manually anyway). LVM's only PV is the second mdraid RAID1, used for VMs and backups. The server doesn't mount any additional system-related filesystems (such as /var or /usr; it's all on the one rootfs).

AFAIK lvmetad is supposed to act as a "cache" for all LVM-related metadata. Of course all commands work without it as well but at least when IO-heavy operations are running (or a harddisk is having issues) I've had minute-long hangs or even timeouts occuring while using LVM commands, in some cases LVM totally locked up, requiring a hard reset as it wasn't even possible to reboot the system cleanly. So, ever since its announcement a few years ago, lvmetad sounded like a good idea to use to possibly avoid these issues. And indeed, queries like "lvs -v" now instantly report their results instead of taking the short break (~0.5 to 2 seconds) it always did without lvmetad.

If /run isn't available when LVM boots up, I have to ask again if it's safe to ignore the warning or if it's not and I should do something about it? It seems even more odd than before as it's sort of a circular dependency: You need LVM before all filesystems have been mounted but you need the filesystem mounted before LVM starts...?! Either the warning can be safely ignored (which would mean booting works without updating the lvmetad cache which sounds unsafe to do) or the init scripts are wrong (OpenRC; lvm depends on lvmetad) or LVM's default config is wrong (if placing the socket in /run is wrong; it should be something that's available earlier on boot...).
_________________
nohup nice -n -20 cp /dev/urandom /dev/null &
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6228
Location: Room 101

PostPosted: Fri Feb 19, 2016 10:12 pm    Post subject: Reply with quote

c00l.wave wrote:
AFAIK lvmetad is supposed to act as a "cache" for all LVM-related metadata. Of course all commands work without it as well but at least when IO-heavy operations are running (or a harddisk is having issues) I've had minute-long hangs or even timeouts occuring while using LVM commands, in some cases LVM totally locked up, requiring a hard reset as it wasn't even possible to reboot the system cleanly. So, ever since its announcement a few years ago, lvmetad sounded like a good idea to use to possibly avoid these issues. And indeed, queries like "lvs -v" now instantly report their results instead of taking the short break (~0.5 to 2 seconds) it always did without lvmetad.

c00l.wave ... yes, it's a daemon to cache lvm data. I did say I was asking a rhetorical question, and part of that question goes deeper, with the above in mind I might frame it as "what is it about lvm that makes getting its current status, or any data about the status of vg, lv, etc, require caching"? Again, a rhetorical question, but surely this task is not in any order greater than say, fsck. Yes, unlike the partition table it can change, but still it would seem that your "IO-heavy operations", should hardly matter. That was my underlying, though unstated, thinking on the matter. I can see the purpose of caching DNS lookups, or any number of things that, though trivial, occur on a frequent enough basis and so make caching worth while, but logical volumes, surely this access is at such a low premium, and the data infrequently changed, as to make the idea of a caching daemon somewhat ridiculous.

c00l.wave wrote:
If /run isn't available when LVM boots up, I have to ask again if it's safe to ignore the warning or if it's not and I should do something about it? It seems even more odd than before as it's sort of a circular dependency: You need LVM before all filesystems have been mounted but you need the filesystem mounted before LVM starts...?! Either the warning can be safely ignored (which would mean booting works without updating the lvmetad cache which sounds unsafe to do) or the init scripts are wrong (OpenRC; lvm depends on lvmetad) or LVM's default config is wrong (if placing the socket in /run is wrong; it should be something that's available earlier on boot...).

Indeed, a chicken & egg problem, which is why such things get shunted into initramfs (with the "initramfs is the new root" mantra). Is it "safe to ignore"? I can't say, as I said I do all my lvm setup in initramfs, and I don't run lvmetad. I did make a post (can't find it now) about how to avoid the lvmetad init.d dependency, but it seems you're ok with having it running. Anyhow, I can't offer much in the way of a solution ITR, sorry.

best ... khay
Back to top
View user's profile Send private message
toon
n00b
n00b


Joined: 26 Jan 2003
Posts: 67
Location: The Netherlands

PostPosted: Sat Mar 12, 2016 9:30 am    Post subject: Reply with quote

Hi,

I had the same problem with the missing lvmetad socket.
I went under the hood and discovered that the dependency on lvmetad is set by the lvm init script!
Code:
_need_lvmetad()
{
        local lvm_path="$(_get_lvm_path)"
        [ ! -x "${lvm_path}" ] && return 1
        ${lvm_path} dumpconfig global | grep -q 'use_lvmetad=1'
}

depend() {
        before checkfs fsck
        after modules device-mapper
        # We may use lvmetad based on the configuration. If we added lvmetad
        # support while lvm2 is running then we aren't dependent on it. For the
        # more common case, if its disabled in the config we aren't dependent
        # on it.
        config /etc/lvm/lvm.conf
        local _need=
        if service_started; then
                _need=$(service_get_value need)
        else
                if _need_lvmetad; then
                        _need="${_need} lvmetad"
                fi
        fi
        need sysfs ${_need}
}
and further down...
Code:
start_post()
{
        # Save if we needed lvmetad
        if _need_lvmetad; then
                service_set_value need lvmetad
        fi
}
So the init script reads the lvm.conf file to determine the setting of the use_lvmetad parameter.
However, it does so in a clumsy way. Throughout the lvm.conf file a coding style is used where spaces are used around the assignment operator, while the init script checks for a assignment without spaces.
So the init script checks for...
Code:
'use_lvmetad=1'
...while /etc/lvm/lvm.conf contains the line
Code:
'use_lvmetad = 1'

My solution was to remove the spaces around the operator in /etc/lvm/lvm.conf. My system now boots and runs with lvmetad and without any boot-time errors.
Back to top
View user's profile Send private message
c00l.wave
Apprentice
Apprentice


Joined: 24 Aug 2003
Posts: 245

PostPosted: Wed Apr 06, 2016 11:46 am    Post subject: Reply with quote

I've updated the system again and the warning has disappeared. I noticed two changes to the init scripts:
  • lvmetad now appears to check if /run/lvm exists in start_pre
  • lvm had some changes regarding _need_lvmetad as well but still looks the same to me as posted above (an update may have already occurred before)
... and I ran rc-update -u according to the install notices which might have had something to do with it as well (not sure if I missed that step before).

In case the updates happened in response to this thread: Thank you for fixing it! :)

@toon: I also have spaces in my config file but the command getting called is "lvm dumpconfig global" which dumps the active configuration directly from LVM and thus shouldn't contain any spaces around =, at least it works for me.
_________________
nohup nice -n -20 cp /dev/urandom /dev/null &
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
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