Comment 2 for bug 243105

Agostino Russo (ago) wrote :

<cjwatson> // IsMounted - Returns true if the mount point is mounted /*{{{*/
<cjwatson> // ---------------------------------------------------------------------
<cjwatson> /* This is a simple algorithm that should always work, we stat the mount point
<cjwatson> and the '..' file in the mount point and see if they are on the same device.
<cjwatson> By definition if they are the same then it is not mounted. This should
<cjwatson> account for symlinked mount points as well. */
<cjwatson> if /cdrom is bind-mounted from the same device then that algorithm would fail
<cjwatson> though I don't see why a symlink to something on the same device would be any better
<cjwatson> so, while this looks like a plausible guess, it could do with some verification
<cjwatson> oh, hmm now, apt is running in the live CD root filesystem not in /target
<cjwatson> maybe it just needs to be configured to use /target/cdrom
<cjwatson> you might try something like
<cjwatson> I'm not entirely sure that will work but it makes a twisted kind of sense

Paste from cjwatson at Thu, 26 Jun 2008 07:03:31 +0100

=== modified file 'scripts/'
--- scripts/ 2008-04-23 21:25:05 +0000
+++ scripts/ 2008-06-26 11:07:52 +0000
@@ -954,6 +954,13 @@
+ # Configure python-apt separately. Leaving it at /cdrom normally
+ # works, but can lead to problems if /cdrom is bind-mounted from a
+ # directory on the same device.
+ apt_pkg.Config.Set("APT::CDROM::NoMount", "true")
+ apt_pkg.Config.Set("Acquire::cdrom::mount", "/target/cdrom")
+ apt_pkg.Config.Set("Acquire::cdrom::/target/cdrom/::Mount", "true")
+ apt_pkg.Config.Set("Acquire::cdrom::/target/cdrom/::UMount", "true")

         dbfilter = apt_setup.AptSetup(None, self.db)
         ret = dbfilter.run_command(auto_process=True)