On Mon, May 23, 2011 at 01:52:05PM +0100, Roger Leigh wrote:
> There are four possible upgrade/install paths to consider:
> 
> 1) squeeze→wheezy upgrade (normal system)
> 2) squeeze→wheezy upgrade (chroot)
> 3) clean wheezy install (normal system)
> 4) clean wheezy install (chroot)
> 
> With /run being provided by initscripts, we handle (1) and (3)
> just fine.  Initially /run is absent, created on initscripts install,
> and migration completed after reboot.  With (2) we do a best effort
> with symlinks, but don't do a very good job: /run is a symlink to
> /var/run, so the old directories remain in place (we can't safely move
> them).  For (4) we really want the new directory structure with
> compatibility symlinks, rather than a repeat of (2), or else chroots,
> even freshly debootstrapped ones, will never be able to migrate to the
> new hierarchy automatically.  If this was already set up by base-files,
> we wouldn't have a problem, but it's not, so debootstrapping a current
> unstable chroot results in the upgrade cludge we use for (2).

>  3) wheezy install (normal system)
> 
>     base-files provides /run 
>     base-files does not provide /var/run, /var/run does not exist
>     base-files creates /var/run symlink to /run
>     initscripts provides /run
>     [* no tmpfs mounted on /run at this point]
>     initscripts sees /var/run already symlinked, so no action
>     [/var/run→/run]
>     [reboot]
>     tmpfs mounted on /run
>     initscripts sees /var/run already symlinked, so no action
>     [/var/run→/run]
> 
>  4) wheezy install (chroot)
> 
>     base-files provides /run
>     base-files does not provide /var/run, /var/run does not exist
>     base-files creates /var/run symlink to /run
>     initscripts also provides /run
>     initscripts sees /var/run already symlinked, so no action
>     [/var/run→/run]

Hi,

The attached patch corrects the known deficiencies above.  The
debian-installer team have also added in support for /run to
ensure that debootstrap works correctly for chroot environments
and real installs.

The patch makes the package provide /run (it contains a Breaks:
on older initscripts to avoid a repeat of the udev breakage,
without introducing an initscripts dependency, so this works for
both upgrades and fresh installs).

We create /run/lock in the postinst if absent, and then /var/run
and /var/lock as symlinks.  Unlike previous patches, because we
always create /run/lock when we create the /var/lock symlink, it's
always valid, so this is no longer able to cause breakage.  So
base-files always installs a working setup on initial install (it
leaves upgrades to initscripts or systemd).

The change is now in debian-installer, which purges the contents
of /run after install so cruft isn't left behind which would be
obscured by the tmpfs mount on /run after reboot.

So in summary, this should be safe to apply
- we cope with /run being added by the Breaks
- otherwise we only make changes on new installs, and we ensure
  that we always provide valid symlinks.


Regards,
Roger

-- 
  .''`.  Roger Leigh
 : :' :  Debian GNU/Linux             http://people.debian.org/~rleigh/
 `. `'   Printing on GNU/Linux?       http://gutenprint.sourceforge.net/
   `-    GPG Public Key: 0x25BFB848   Please GPG sign your mail.
diff -urN ../base-files-6.3.original/debian/1777-dirs ./debian/1777-dirs
--- ../base-files-6.3.original/debian/1777-dirs	2011-05-25 18:46:08.276544484 +0100
+++ ./debian/1777-dirs	2011-05-25 19:37:07.471912770 +0100
@@ -1,3 +1,2 @@
 tmp
-var/lock
 var/tmp
diff -urN ../base-files-6.3.original/debian/changelog ./debian/changelog
--- ../base-files-6.3.original/debian/changelog	2011-05-25 18:46:08.276544484 +0100
+++ ./debian/changelog	2011-05-26 15:25:05.676769129 +0100
@@ -1,3 +1,24 @@
+base-files (6.4) unstable; urgency=low
+
+  * Provide /run directory.  Closes: #620157.
+  * Do not provide /var/run or /var/lock directories.
+  * For new installations:
+    - /run/lock is created if not present (note that debian-installer
+      will remove it after installation is complete so that it does not
+      leave mess in /run; it will persist in chroot environments).
+      This ensures that the /var/lock symlink will always be valid.
+    - /var/run is symlinked to /run.
+    - /var/lock is symlinked to /run/lock.
+  * For upgrades, initscripts will handle the /var/run and /var/lock
+    migration to /run.
+  * Break initscripts << 2.88dsf-13.3 to ensure that once we provide
+    /run, it is guaranteed to be present and functional.  This is to
+    prevent udev breakage by preventing base-files from being
+    upgraded prior to initscripts on upgrade from squeeze.  This
+    ensures that initscripts must be upgraded first.
+
+ -- Roger Leigh <rle...@debian.org>  Thu, 26 May 2011 15:16:46 +0100
+
 base-files (6.3) unstable; urgency=low
 
   * Dropped /run until everything else is ready for it. In particular,
diff -urN ../base-files-6.3.original/debian/control ./debian/control
--- ../base-files-6.3.original/debian/control	2011-05-25 18:46:08.276544484 +0100
+++ ./debian/control	2011-05-26 15:16:37.342127868 +0100
@@ -11,6 +11,7 @@
 Essential: yes
 Priority: required
 Replaces: base, miscutils, dpkg (<= 1.15.0)
+Breaks: initscripts (<< 2.88dsf-13.3)
 Description: Debian base system miscellaneous files
  This package contains the basic filesystem hierarchy of a Debian system, and
  several important miscellaneous files, such as /etc/debian_version,
diff -urN ../base-files-6.3.original/debian/directory-list ./debian/directory-list
--- ../base-files-6.3.original/debian/directory-list	2011-05-25 18:46:08.276544484 +0100
+++ ./debian/directory-list	2011-05-25 18:47:49.797635835 +0100
@@ -10,6 +10,7 @@
 mnt
 proc
 root
+run
 sbin
 tmp
 usr
@@ -32,8 +33,6 @@
 var/lib/dpkg
 var/lib/misc
 var/local
-var/lock
 var/log
-var/run
 var/spool
 var/tmp
diff -urN ../base-files-6.3.original/debian/postinst.in ./debian/postinst.in
--- ../base-files-6.3.original/debian/postinst.in	2011-05-25 18:46:08.276544484 +0100
+++ ./debian/postinst.in	2011-05-26 15:24:27.508269756 +0100
@@ -41,9 +41,19 @@
   install_directory var/opt   755 root
   install_directory media     755 root
   install_directory var/mail 2775 mail
+  # Note that /run/lock will be later removed by debian-installer on
+  # completion of the install (a tmpfs will be mounted on /run at
+  # reboot).  It will persist in debootstrapped chroots.
+  install_directory run/lock 1777 root
   if [ ! -L /var/spool/mail ]; then
     ln -s ../mail /var/spool/mail
   fi
+  if [ ! -e /var/run ]; then
+    ln -s /run /var/run
+  fi
+  if [ ! -e /var/lock ]; then
+    ln -s /run/lock /var/lock
+  fi
 
   install_local_dir /usr/local
   install_local_dir /usr/local/share

Attachment: signature.asc
Description: Digital signature

Reply via email to