Comment 14 for bug 1423796

Revision history for this message
Astara (astara) wrote :

@George:
George Moutsopoulos (gmoutso) wrote on 2015-04-29:
> OK, I managed! I had to add more modules
>
> sudo echo "dm_cache" >> /etc/initramfs-tools/modules
> sudo echo "dm_cache_mq" >> /etc/initramfs-tools/modules
> sudo echo "dm_persistent_data" >> /etc/initramfs-tools/modules
> sudo echo "dm_bufio" >> /etc/initramfs-tools/module
---
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/initramfs-tools/modules

 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-tools/modules

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. :-)