Bug#611569: apt-cdrom doesn't work on GNU/kFreeBSD

2011-02-01 Thread Robert Millan
2011/1/31 Michael Vogt m...@debian.org:
 Thanks for your bugreport. On systems where libudev is availalbe we
 dlopen() it nowdays to figure out the right mount point. On systems
 where that is not the case apt will just rely on /etc/fstab to find
 the mountpoint. Could you please check if that has a correct entry?

apt-cdrom expects an entry with /cdrom mountpoint, but fstab (on
installed system) provides /media/cdrom0.  If I modify it, then apt-cdrom
is able to mount the CD.

Does this mean fstab is incorrect? Then it'd be a bug in D-I.

-- 
Robert Millan



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#611569: apt-cdrom doesn't work on GNU/kFreeBSD

2011-02-01 Thread Michael Vogt
On Tue, Feb 01, 2011 at 02:37:36PM +0100, Robert Millan wrote:
 2011/1/31 Michael Vogt m...@debian.org:
  Thanks for your bugreport. On systems where libudev is availalbe we
  dlopen() it nowdays to figure out the right mount point. On systems
  where that is not the case apt will just rely on /etc/fstab to find
  the mountpoint. Could you please check if that has a correct entry?
 
 apt-cdrom expects an entry with /cdrom mountpoint, but fstab (on
 installed system) provides /media/cdrom0.  If I modify it, then apt-cdrom
 is able to mount the CD.
 
 Does this mean fstab is incorrect? Then it'd be a bug in D-I.

That is a problem with apt then, I attached a patch that should fix
it and will upload that tonight. I guess the libudev support shadowed
this problem on the other arches.

Cheers,
 Michael
=== modified file 'apt-pkg/cdrom.cc'
--- apt-pkg/cdrom.cc	2010-08-02 19:02:01 +
+++ apt-pkg/cdrom.cc	2011-02-01 14:34:01 +
@@ -198,7 +198,7 @@
// a symlink gets a big penalty
struct stat Buf;
string statPath = flNotFile(Path);
-   string cdromPath = _config-FindDir(Acquire::cdrom::mount,/cdrom/);
+   string cdromPath = _config-FindDir(Acquire::cdrom::mount);
while(statPath != cdromPath  statPath != ./) {
   statPath.resize(statPath.size()-1);  // remove the trailing '/'
   if (lstat(statPath.c_str(),Buf) == 0) {
@@ -509,7 +509,7 @@
stringstream msg;
 
// Startup
-   string CDROM = _config-FindDir(Acquire::cdrom::mount,/cdrom/);
+   string CDROM = _config-FindDir(Acquire::cdrom::mount);
if (CDROM[0] == '.')
   CDROM= SafeGetCWD() + '/' + CDROM;
 

=== modified file 'apt-pkg/init.cc'
--- apt-pkg/init.cc	2010-09-04 08:46:36 +
+++ apt-pkg/init.cc	2011-02-01 14:34:53 +
@@ -52,7 +52,7 @@
Cnf.Set(Dir::State::lists,lists/);
Cnf.Set(Dir::State::cdroms,cdroms.list);
Cnf.Set(Dir::State::mirrors,mirrors/);
-   
+
// Cache
Cnf.Set(Dir::Cache,var/cache/apt/);
Cnf.Set(Dir::Cache::archives,archives/);
@@ -88,6 +88,9 @@
// Translation
Cnf.Set(APT::Acquire::Translation, environment);
 
+   // Default cdrom mount point
+   Cnf.Set(Acquire::cdrom::mount, /media/cdrom/);
+
bool Res = true;

// Read an alternate config file

=== modified file 'methods/cdrom.cc'
--- methods/cdrom.cc	2010-02-17 21:40:05 +
+++ methods/cdrom.cc	2011-02-01 14:33:47 +
@@ -220,7 +220,7 @@
}
 
bool AutoDetect = _config-FindB(Acquire::cdrom::AutoDetect, true);
-   CDROM = _config-FindDir(Acquire::cdrom::mount,/cdrom/);
+   CDROM = _config-FindDir(Acquire::cdrom::mount);
if (Debug)
   clog  Looking for CDROM at   CDROM  endl;
 



Bug#611569: apt-cdrom doesn't work on GNU/kFreeBSD

2011-02-01 Thread Joey Hess
Michael Vogt wrote:
 That is a problem with apt then, I attached a patch that should fix
 it and will upload that tonight. I guess the libudev support shadowed
 this problem on the other arches.

d-i installs a 00CDMountPoint apt config file containing:

Acquire::cdrom {
  mount /media/cdrom;
}
Dir::Media::MountPath /media/cdrom;

This is left behind in the installed system BTW. I don't like that, but
we've been working around apt's lack of FHS adherence for quite a while.

So I doubt that your patch will help, it only seems to set the same
Acquire::cdrom setting that we already have. (BTW, the reason we set
Dir::Media::MountPath too is that apparenly apt doesn't consistently
read from the [former] one.)

Looking at the syslog, apt says it's going to use /media/cdrom as
the moint point but then mount seems to be run with /cdrom.
Screenshot of this weirdness attached.


I see that the generated fstab on kFreeBSD contains:

/dev/cd0/media/cdrom0   cd9660  ro,auto 0   0

Why is the mount point different? I don't know yet. If I correct this
to use /media/cdrom0, then apt-cdrom add works in d-i with no further
changes.

FWIW, this seems close to RC for d-i kFreeBSD, since it makes most
of the CD images useless (they still work, but most of the bits on the CD
are not used since it falls back to a mirror), and introduces a error
dialog into the installation process when installing with most of the CD
images.


(In a sense, my fix for #609334 in apt-setup 1:0.53 has exposed this
bug. Previously, apt-setup just ignored CDs entirely on kFreeBSD.
(It's somewhat amazing nobody ever noticed that, but then I only noticed
because I was reading the code...) My fix made it try, and now fail to
use them.)

-- 
see shy jo


signature.asc
Description: Digital signature


Bug#611569: apt-cdrom doesn't work on GNU/kFreeBSD

2011-02-01 Thread Michael Vogt
On Tue, Feb 01, 2011 at 12:26:02PM -0400, Joey Hess wrote:
 Michael Vogt wrote:
  That is a problem with apt then, I attached a patch that should fix
  it and will upload that tonight. I guess the libudev support shadowed
  this problem on the other arches.
 
 d-i installs a 00CDMountPoint apt config file containing:
 
 Acquire::cdrom {
   mount /media/cdrom;
 }
 Dir::Media::MountPath /media/cdrom;
 
 This is left behind in the installed system BTW. I don't like that, but
 we've been working around apt's lack of FHS adherence for quite a while.

Sounds like one more reason to fix it in apt and ensure it points to
/media/cdrom 
 
 So I doubt that your patch will help, it only seems to set the same
 Acquire::cdrom setting that we already have. (BTW, the reason we set
 Dir::Media::MountPath too is that apparenly apt doesn't consistently
 read from the [former] one.)

This is a bit confusing indeed. The Acquire::cdrom::mount is the mount
point used when libudev is not available. The Dir::Media::MountPath is
used when libudev is availabe, it does not need fstab then, it will
mount all cdroms it finds and check if the signature match. This
should probably simply be merged.
 
 Looking at the syslog, apt says it's going to use /media/cdrom as
 the moint point but then mount seems to be run with /cdrom.
 Screenshot of this weirdness attached.

I don't have a screenshot here. But I'm downloading a image now in
order to reproduce.
 
 I see that the generated fstab on kFreeBSD contains:
 
 /dev/cd0  /media/cdrom0   cd9660  ro,auto 0   0
 
 Why is the mount point different? I don't know yet. If I correct this
 to use /media/cdrom0, then apt-cdrom add works in d-i with no further
 changes.

Would it make sense to add a /media/cdrom symlink? And then the admin
can adjust it if he/she has multiple cdroms? Ideally we would use a
dynamic solution but because of the lack of a portable one apt uses
dlopen() on libudev instead of depending on it.

 FWIW, this seems close to RC for d-i kFreeBSD, since it makes most
 of the CD images useless (they still work, but most of the bits on the CD
 are not used since it falls back to a mirror), and introduces a error
 dialog into the installation process when installing with most of the CD
 images.

I agree, its a important issues on kfreebsd.

Cheers,
 Michael






-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#611569: apt-cdrom doesn't work on GNU/kFreeBSD

2011-02-01 Thread Joey Hess
I wrote:
 Looking at the syslog, apt says it's going to use /media/cdrom as
 the moint point but then mount seems to be run with /cdrom.
 Screenshot of this weirdness attached.

That was a red herring, apt was not using /cdrom. (d-i does)
Forgotten screenshot attached anyway.

 I see that the generated fstab on kFreeBSD contains:
 
 /dev/cd0  /media/cdrom0   cd9660  ro,auto 0   0
 
 Why is the mount point different? I don't know yet. If I correct this
 to use /media/cdrom0, then apt-cdrom add works in d-i with no further
  /media/cdrom -- correction: removing the 0 works..
 changes.

/media/cdrom is a symlink to /media/cdrom0. Seems that that
configuring apt to use the /media/cdrom symlink, while the fstab has
/media/cdrom0 works on Linux, but somehow not on kFreeBSD.

Aha! On Linux, mount /media/cdrom will follow the symlink and mount
/media/cdrom0 as configured in fstab. On kfreeBSD, mount does not have
those smarts, it seems.

The underlying problem on kFreeBSD is that mount /media/cdrom fails.
If mount on kFreeBSD cannot handle a symlinked mount point, then d-i
should not configure the mount points like that. (It also sets up /media/usb
as a symlink to /media/usb0.) That will fix apt-cdrom as well as allowing
users to hand-mount removable media as they probably expect to be able to.

I propose the attached patch to partman-target. I have tested it,
and it works.

-- 
see shy jo
attachment: cdrom.pngcommit a7d3da962eae2d8d950984c780fa8d6d911acb48
Author: Joey Hess j...@kitenet.net
Date:   Tue Feb 1 13:58:50 2011 -0400

Fix cdrom mountpoint setup on kFreeBSD

On kFreeBSD, mount does not follow symlinks in the mountpoint, so the way
mount points were set up for removable media caused problems. So on that OS
only, rather than making /media/cdrom - /media/cdrom0, and putting
/media/cdrom0 in /etc/fstab, instead make /media/cdrom a directory, and put
/media/cdrom in /etc/fstab. This way¸  mount /media/cdrom, mount
/media/usb etc all work, and so does apt-setup add.  Closes: #611569

(Note that additional CD devices will be set up as /media/cdrom1, etc, same
as before. This leads to the minor inconsistency on kFreeBSD that mount
/media/cdrom1 is needed for the second CD, while mount /media/cdrom0
won't work for the first, but I don't see a way to avoid that.)

diff --git a/debian/changelog b/debian/changelog
index 1a71ffa..666c8bf 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,9 +1,24 @@
 partman-target (72) UNRELEASED; urgency=low
 
+  [ Christian Perrier ]
   * Point users to blkid instead of non-existing vol_id (on the
 installed system) in /etc/fstab file header
 Closes: #608996
 
+  [ Joey Hess ]
+  * On kFreeBSD, mount does not follow symlinks in the mountpoint, so
+the way mount points were set up for removable media caused problems.
+So on that OS only, rather than making /media/cdrom - /media/cdrom0,
+and putting /media/cdrom0 in /etc/fstab, instead make /media/cdrom
+a directory, and put /media/cdrom in /etc/fstab. This way¸ 
+mount /media/cdrom, mount /media/usb etc all work, and so does
+apt-setup add.  Closes: #611569
+(Note that additional CD devices will be set up as /media/cdrom1, etc,
+same as before. This leads to the minor inconsistency on kFreeBSD that
+mount /media/cdrom1 is needed for the second CD, while
+mount /media/cdrom0 won't work for the first, but I don't
+see a way to avoid that.)
+
  -- Christian Perrier bubu...@debian.org  Wed, 05 Jan 2011 19:28:49 +0100
 
 partman-target (71) unstable; urgency=low
diff --git a/finish.d/fstab_removable_media_entries 
b/finish.d/fstab_removable_media_entries
index 41f36dd..d0dd60f 100755
--- a/finish.d/fstab_removable_media_entries
+++ b/finish.d/fstab_removable_media_entries
@@ -33,13 +33,20 @@ populate_media () {
options=$3
shift; shift; shift
mkdir -p /target$MEDIA
-   if [ $1 ]; then
+   symlink_to_0=1
+   if [ `udpkg --print-os` = kfreebsd ]; then
+   symlink_to_0=
+   fi
+   if [ $1 ]  [ $symlink_to_0 ] ; then
rm_dir_or_link /target$MEDIA/$category
ln -s ${category}0 /target$MEDIA/$category
fi
number=0
while [ $1 ]; do
mount_point=$MEDIA/$category$number
+   if [ ! $symlink_to_0 ]  [ $number = 0 ]; then
+   mount_point=$MEDIA/$category
+   fi
addfstab $1 $mount_point $fs $options 0 0
rm_dir_or_link /target$mount_point
mkdir -p /target$mount_point


signature.asc
Description: Digital signature


Bug#611569: apt-cdrom doesn't work on GNU/kFreeBSD

2011-02-01 Thread Joey Hess
Michael Vogt wrote:
 On Tue, Feb 01, 2011 at 12:26:02PM -0400, Joey Hess wrote:
  Michael Vogt wrote:
   That is a problem with apt then, I attached a patch that should fix
   it and will upload that tonight. I guess the libudev support shadowed
   this problem on the other arches.
  
  d-i installs a 00CDMountPoint apt config file containing:
  
  Acquire::cdrom {
mount /media/cdrom;
  }
  Dir::Media::MountPath /media/cdrom;
  
  This is left behind in the installed system BTW. I don't like that, but
  we've been working around apt's lack of FHS adherence for quite a while.
 
 Sounds like one more reason to fix it in apt and ensure it points to
 /media/cdrom 

I agree that that should be fixed in apt -- but it won't fix this bug,
nor is it probably approptiate for squeeze. 

Please let me know when apt is fixed, and we can then remove the
workaround from d-i.

  Why is the mount point different? I don't know yet. If I correct this
  to use /media/cdrom0, then apt-cdrom add works in d-i with no further
  changes.
 
 Would it make sense to add a /media/cdrom symlink? And then the admin
 can adjust it if he/she has multiple cdroms? Ideally we would use a
 dynamic solution but because of the lack of a portable one apt uses
 dlopen() on libudev instead of depending on it.

It makes sense to me, but apparently not to FreeBSD's mount program.
Which is probably also a bug in that peice of code too, that should be
fixed. I'm not sure which package that is.

-- 
see shy jo


signature.asc
Description: Digital signature


Bug#611569: apt-cdrom doesn't work on GNU/kFreeBSD

2011-02-01 Thread Lennart Sorensen
On Tue, Feb 01, 2011 at 06:38:38PM +0100, Michael Vogt wrote:
 On Tue, Feb 01, 2011 at 12:26:02PM -0400, Joey Hess wrote:
  Michael Vogt wrote:
   That is a problem with apt then, I attached a patch that should fix
   it and will upload that tonight. I guess the libudev support shadowed
   this problem on the other arches.
  
  d-i installs a 00CDMountPoint apt config file containing:
  
  Acquire::cdrom {
mount /media/cdrom;
  }
  Dir::Media::MountPath /media/cdrom;
  
  This is left behind in the installed system BTW. I don't like that, but
  we've been working around apt's lack of FHS adherence for quite a while.
 
 Sounds like one more reason to fix it in apt and ensure it points to
 /media/cdrom 

How about older Debian installs where it was /cdrom?  Do you want to
break those?  Having d-i change the config of new apt installs is fine,
but changing what the default in apt is will break older systems which
don't have /media/cdrom in fstab.

  So I doubt that your patch will help, it only seems to set the same
  Acquire::cdrom setting that we already have. (BTW, the reason we set
  Dir::Media::MountPath too is that apparenly apt doesn't consistently
  read from the [former] one.)
 
 This is a bit confusing indeed. The Acquire::cdrom::mount is the mount
 point used when libudev is not available. The Dir::Media::MountPath is
 used when libudev is availabe, it does not need fstab then, it will
 mount all cdroms it finds and check if the signature match. This
 should probably simply be merged.
  
  Looking at the syslog, apt says it's going to use /media/cdrom as
  the moint point but then mount seems to be run with /cdrom.
  Screenshot of this weirdness attached.
 
 I don't have a screenshot here. But I'm downloading a image now in
 order to reproduce.
  
  I see that the generated fstab on kFreeBSD contains:
  
  /dev/cd0/media/cdrom0   cd9660  ro,auto 0   0
  
  Why is the mount point different? I don't know yet. If I correct this
  to use /media/cdrom0, then apt-cdrom add works in d-i with no further
  changes.
 
 Would it make sense to add a /media/cdrom symlink? And then the admin
 can adjust it if he/she has multiple cdroms? Ideally we would use a
 dynamic solution but because of the lack of a portable one apt uses
 dlopen() on libudev instead of depending on it.
 
  FWIW, this seems close to RC for d-i kFreeBSD, since it makes most
  of the CD images useless (they still work, but most of the bits on the CD
  are not used since it falls back to a mirror), and introduces a error
  dialog into the installation process when installing with most of the CD
  images.
 
 I agree, its a important issues on kfreebsd.

-- 
Len Sorensen



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#611569: apt-cdrom doesn't work on GNU/kFreeBSD

2011-01-31 Thread Michael Vogt
On Sun, Jan 30, 2011 at 08:15:13PM +0100, Robert Millan wrote:
 Package: apt
 Version: 0.8.10
 Severity: important
 User: debian-...@lists.debian.org
 Usertags: kfreebsd
 
 $ sudo apt-cdrom add
 Using CD-ROM mount point /media/cdrom/
 Unmounting CD-ROM
 Waiting for disc...
 Please insert a Disc in the drive and press enter
 Mounting CD-ROM...
 E: Failed to mount the cdrom.
 
 Note: It does work, however, if /media/cdrom/ was previously mounted
 manually.
[..]

Thanks for your bugreport. On systems where libudev is availalbe we
dlopen() it nowdays to figure out the right mount point. On systems
where that is not the case apt will just rely on /etc/fstab to find
the mountpoint. Could you please check if that has a correct entry?

If it is correct, could you please run:
$ sudo apt-cdrom add -o Debug::aptcdrom=true
and attach the output (and the fstab)?

Thanks,
 Michael




-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#611569: apt-cdrom doesn't work on GNU/kFreeBSD

2011-01-30 Thread Robert Millan
Package: apt
Version: 0.8.10
Severity: important
User: debian-...@lists.debian.org
Usertags: kfreebsd

$ sudo apt-cdrom add
Using CD-ROM mount point /media/cdrom/
Unmounting CD-ROM
Waiting for disc...
Please insert a Disc in the drive and press enter
Mounting CD-ROM...
E: Failed to mount the cdrom.

Note: It does work, however, if /media/cdrom/ was previously mounted
manually.

-- System Information:
Debian Release: squeeze/sid
  APT prefers testing
  APT policy: (500, 'testing'), (1, 'experimental')
Architecture: kfreebsd-amd64 (x86_64)

Kernel: GNU/kFreeBSD
Locale: LANG=ca_AD.UTF-8, LC_CTYPE=ca_AD.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#611569: apt-cdrom doesn't work on GNU/kFreeBSD

2011-01-30 Thread Joey Hess
Robert Millan wrote:
 Package: apt
 Version: 0.8.10
 Severity: important
 User: debian-...@lists.debian.org
 Usertags: kfreebsd
 
 $ sudo apt-cdrom add
 Using CD-ROM mount point /media/cdrom/
 Unmounting CD-ROM
 Waiting for disc...
 Please insert a Disc in the drive and press enter
 Mounting CD-ROM...
 E: Failed to mount the cdrom.
 
 Note: It does work, however, if /media/cdrom/ was previously mounted
 manually.

This probably explains why d-i has been reported to not use the CD for
packages after debootstrap. (Instead configuring apt to use a mirror.)

-- 
see shy jo


signature.asc
Description: Digital signature