Why does it take so much time to initialize mlocate database?
While I was trying to install xubuntu-desktop on wsl2(Ubuntu 20.04) on windows 10.
It got stuck at
Initializing mlocate database; this may take some time...
after waiting for a long time(left it for a whole night, as I heard this process takes a lot of time as it parses through every path present on the system)
I closed the process and ran:
sudo dpkg --configure -a
again it's stuck at the same point.
My question is:
- How to resolve it?
- Why does it take so much time?
Any help will be appreciated.
Thanks in advance!
I installed ubuntu lts 20 on wsl2 on Windows 10 via Microsoft Store. It didn't came with locate installed, so I installed it. While installing, it got stuck for a long time at 60% when updating its database for the first time. Thought it went into some problem and Google it (and found this thread).
Turns out it eventually finished installing after like 15 min. When I used the command for the first time, I got a surprise: it actually parsed all my hard drive into its database, including all Windows stuff, even things I can't access normally through Windows.
So I think the reason the mlocate installation took so long while stuck at 60% was because with was also indexing Windows files.
Well, if you waited a whole night, then it may be a real problem with the installation. I would suggest to install another distro on your wsl or, at least, don't install locate on it.
Searching Google for this issue, I found this gist which states the following:
[...] add
/mnt
toPRUNEPATHS
in/etc/updatedb.conf
in order to avoid indexing Windows files.
This is related to this previous answer:
[...] think the reason the mlocate installation took so long while stuck at 60% was because with was also indexing Windows files.
When I followed that gist instructions, it worked perfectly for me.