Hooks for read-only /usr
I like to have a read-only /usr filesystem. So I have ...
# cat /etc/apt/apt.conf.d/50readonly-usr DPkg { // Auto re-mounting of a readonly /usr Pre-Invoke {"mount -o remount,rw /usr";}; Post-Invoke {"mount -o remount,ro /usr || true";}; } Unfortunately this works quite badly. During execution of apt, services are stopped and started again, so it is frequently the case that by the time apt runs the Post-invoke hook, processes are holding open files in /usr. This prevents /usr being re-mounted (that's the reason for the "|| true"). Is there a better way to do this? One idea that occurred to me was to have dpkg do this; it could remount /usr read-write before removing the old files and unpacking the new, and mount it read-only after perhaps the package configuration stage (before restarting things). Anyway, is something like this already possible? Thanks, James. -- To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org |
Hooks for read-only /usr
On 06/19/2008 03:12 AM, James Youngman wrote:
I like to have a read-only /usr filesystem. So I have ... # cat /etc/apt/apt.conf.d/50readonly-usr DPkg { // Auto re-mounting of a readonly /usr Pre-Invoke {"mount -o remount,rw /usr";}; Post-Invoke {"mount -o remount,ro /usr || true";}; } Unfortunately this works quite badly. During execution of apt, services are stopped and started again, so it is frequently the case that by the time apt runs the Post-invoke hook, processes are holding open files in /usr. This prevents /usr being re-mounted (that's the reason for the "|| true"). Is there a better way to do this? One idea that occurred to me was to have dpkg do this; it could remount /usr read-write before removing the old files and unpacking the new, and mount it read-only after perhaps the package configuration stage (before restarting things). Anyway, is something like this already possible? Thanks, James. It may be possible. You could use "at" to schedule the remounting of /usr at a later time, e.g. 10 minutes: Post-Invoke { "echo 'mount -o remount,ro /usr' | at now + 10 minutes } You'll have to hope that whatever processes using /usr have finished by the time the mount command executes, and there will be a window during which time /usr will be writable. It's kludgy, but I don't think you'll find a non-kludgy solution for this. Anyway, good luck. -- To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org |
| All times are GMT. The time now is 06:38 AM. |
VBulletin, Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.