Unable to mount lvmcache root device at boot time
| Affects | Status | Importance | Assigned to | Milestone | |
|---|---|---|---|---|---|
| | initramfs-tools (Ubuntu) |
Medium
|
Unassigned | ||
| | linux (Ubuntu) |
Medium
|
Andy Whitcroft | ||
| | lvm2 (Ubuntu) |
High
|
Unassigned | ||
Bug Description
I'm experimenting with Vivid Vervet on a virtual machine and tried a new LVM feature, lvmcache. I made a cache for the root file system, rebuilt the initrd and rebooted the VM.
At boot time, the system failed to activate the root LV. After some investigation, I found out, it's because the initrd is missing some essential stuff needed for activating a cached LV.
The initrd was missing the dm-cache module. I regenerated the initrd with explicitly listing dm-cache in /etc/initramfs-
As SSDs are becoming more and more common, I think it will be common to use them as cache for root file systems, thus it is mandatory to make sure that an initrd can mount an lvmcached root device when necessary, preferably without /etc/initramfs-
System details:
Linux lvmvm 3.18.0-13-generic #14-Ubuntu SMP Fri Feb 6 09:55:14 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
Distributor ID: Ubuntu
Description: Ubuntu Vivid Vervet (development branch)
Release: 15.04
Codename: vivid
LVM version: 2.02.111(2) (2014-09-01)
Library version: 1.02.90 (2014-09-01)
Driver version: 4.28.0
| Changed in linux (Ubuntu): | |
| status: | New → Incomplete |
| MegaBrutal (qbu6to) wrote : | #2 |
This is an lvm2 bug and I wanted to report it to lvm2, not Linux. I remember that I exactly typed lvm2, I don't know why it was still reported to linux. Could someone help me to sort it out?
| affects: | linux (Ubuntu) → lvm2 (Ubuntu) |
| Changed in lvm2 (Ubuntu): | |
| status: | Incomplete → New |
| tags: | added: vivid |
| description: | updated |
| description: | updated |
| description: | updated |
| Launchpad Janitor (janitor) wrote : | #3 |
Status changed to 'Confirmed' because the bug affects multiple users.
| Changed in lvm2 (Ubuntu): | |
| status: | New → Confirmed |
| Changed in lvm2 (Ubuntu): | |
| importance: | Undecided → High |
| Changed in linux (Ubuntu): | |
| status: | New → Confirmed |
| Changed in initramfs-tools (Ubuntu): | |
| status: | New → Confirmed |
| importance: | Undecided → Medium |
| Changed in linux (Ubuntu): | |
| importance: | Undecided → Medium |
| assignee: | nobody → Andy Whitcroft (apw) |
| milestone: | none → ubuntu-15.03 |
| George Moutsopoulos (gmoutso) wrote : | #4 |
I also tried the instructions in
http://
but still cannot reboot into cached hdd system
removing the cache (lvremove lvcache) every time I fail to boot, by using a rescue usb, gave me some corruption and was just inconvenient to further experiment. so I ended up giving up until someone else succeeds using lvmcache.
My use would be a laptop with a small ssd 24GB drive and I think this would be a cool way to speed up the system. actually it was intended for that and the MS windows system did that before I wiped it out. Setting up the lvm and installing ubuntu was easy, setting up the lvmcache was easy too... but couldn't manage to make it boot :/
| George Moutsopoulos (gmoutso) wrote : | #5 |
MegaBrutal, can you give some instructions. I followed the instructions at
http://
but still couldn't boot
| George Moutsopoulos (gmoutso) wrote : | #6 |
OK, I managed! I had to add more modules
sudo echo "dm_cache" >> /etc/initramfs-
sudo echo "dm_cache_mq" >> /etc/initramfs-
sudo echo "dm_persistent_
sudo echo "dm_bufio" >> /etc/initramfs-
plus, add cache_check as in
http://
Booted!
This is how I set up the lvmcache
sudo vgextend LinuxVG /dev/sdb2
sudo lvcreate -L 10G -n rootCacheLV LinuxVG /dev/sdb2
sudo lvcreate -L 24M -n rootCacheMetaLV LinuxVG /dev/sdb2
sudo lvcreate -L 10G -n homeCacheLV LinuxVG /dev/sdb2
sudo lvcreate -L 24M -n homeCacheMetaLV LinuxVG /dev/sdb2
sudo lvconvert --type cache-pool --poolmetadata LinuxVG/
sudo lvconvert --type cache-pool --poolmetadata LinuxVG/
sudo lvconvert --type cache --cachepool LinuxVG/rootCacheLV LinuxVG/rootLV
sudo lvconvert --type cache --cachepool LinuxVG/homeCacheLV LinuxVG/homeLV
where LinuxVG has the root at rootLV and home at homeLV and sdb2 is an SSD
| Adrian Wilkins (adrian-wilkins) wrote : | #7 |
Thank you George! Your contribution was the final thing I needed to get this to work :
| Paul TREHIOU (paul-trehiou) wrote : | #8 |
I have the same problem with Ubuntu 15.04
The solution of gmoutso worked thanks !
| Changed in linux (Ubuntu): | |
| milestone: | ubuntu-15.03 → ubuntu-15.07 |
| Changed in linux (Ubuntu): | |
| milestone: | ubuntu-15.07 → ubuntu-15.08 |
| Changed in linux (Ubuntu): | |
| milestone: | ubuntu-15.08 → ubuntu-15.09 |
| Changed in linux (Ubuntu): | |
| milestone: | ubuntu-15.09 → ubuntu-15.10 |
| Paul TREHIOU (paul-trehiou) wrote : | #9 |
Is this corrected in the 15.10 ?
| Changed in linux (Ubuntu): | |
| milestone: | ubuntu-15.10 → ubuntu-15.11 |
| Changed in linux (Ubuntu): | |
| milestone: | ubuntu-15.11 → ubuntu-15.12 |
| Changed in linux (Ubuntu): | |
| milestone: | ubuntu-15.12 → ubuntu-16.01 |
| Changed in linux (Ubuntu): | |
| milestone: | ubuntu-16.01 → ubuntu-16.02 |
| Jared Stemen (jstemen) wrote : | #10 |
I'm running Ubuntu 15.10 and I was unable to get gmoutso's solution working.
| Changed in linux (Ubuntu): | |
| milestone: | ubuntu-16.02 → ubuntu-16.03 |
| Jared Stemen (jstemen) wrote : | #11 |
Correction, I was able to get gmoutso's solution to work. I realized that I needed to create a separate boot partition that didn't use lvm caching. In retrospect, this makes a lot of sense.
| Jérôme Poulin (jeromepoulin) wrote : | #12 |
After making my system work again, which took a while since most live media and even the installer don't support LVM cache, I had it working for writeback on my system with the following.
/etc/initramfs-
{{{
#!/bin/sh
PREREQ="lvm2"
prereqs()
{
echo "$PREREQ"
}
case $1 in
prereqs)
prereqs
exit 0
;;
esac
if [ ! -x /sbin/lvm ]; then
exit 0
fi
. /usr/share/
copy_exec /usr/sbin/
copy_exec /usr/sbin/
copy_exec /usr/sbin/
copy_exec /usr/sbin/
copy_exec /usr/sbin/
for x in dm_cache_cleaner dm_cache_smq dm_cache dm_persistent_data dm_bio_prison
do
manual_
done
}}}
| Jérôme Poulin (jeromepoulin) wrote : | #13 |
That new file could be added to the thin-provisioni
I forgot to remove cache_dump, cache_restore and cache_metadata_size which are not needed to boot.
| Astara (astara) wrote : | #14 |
@George:
George Moutsopoulos (gmoutso) wrote on 2015-04-29:
> OK, I managed! I had to add more modules
>
> sudo echo "dm_cache" >> /etc/initramfs-
> sudo echo "dm_cache_mq" >> /etc/initramfs-
> sudo echo "dm_persistent_
> sudo echo "dm_bufio" >> /etc/initramfs-
---
Not exactly related to the original bug, but wanted to address a boo-boo in the above.
sudo echo "string" won't use root's access/permissions to write to the files when using the shell-redirection operators '>' or '>>'. sudo will execute 'echo' with root privs, and that will echo "dm_cache" (et al.), however, that output is redirected by the *SHELL* (running as
"whoever is running the shell") -- usually the user.
To get around this problem (and not saying there might not be any easier ways, as this seemed a bit roundabout to get what I wanted (have root write the output to "wherever"), I used
"dd", as in:
echo "dm_cache"|sudo dd of=destination status=none
or to append:
echo "dm_cache"|sudo dd status=none oflag=append conv=notrunc of=/etc/
or to do all at once:
(echo dm_cache
echo dm_cache_mq
echo dm_persistent_data
echo dm_bufio)|sudo dd status=none oflag=append conv=notrunc of=/initramfs-
I wanted to write a single "char" to a file in /proc/sys/vm (drop_caches).
Perhaps needless to say, I put it in a script file to save on typing. :-)
| RNZ (renoizer) wrote : | #15 |
Same bug in 17.04: configure lvmcache and reboot - system can't map cached device to /dev/mapper/
Fixed by update initramfs with hook in upper comment: https:/
| Johannes Bauer (johannesbauer) wrote : | #16 |
I just ran into this with a cleanly installed 17.04. Figured it out myself, added "copy_exec /usr/sbin/
Can we PLEASE get this bug -- which renders systems UNBOOTABLE after attaching a cache -- fixed, especially since there are good and reasonable patches available already (#12)?


This bug is missing log files that will aid in diagnosing the problem. From a terminal window please run:
apport-collect 1423796
and then change the status of the bug to 'Confirmed'.
If, due to the nature of the issue you have encountered, you are unable to run this command, please add a comment stating that fact and change the bug status to 'Confirmed'.
This change has been made by an automated script, maintained by the Ubuntu Kernel Team.