Dropbear's initramfs scripts mount /dev/pts a second time

Bug #933903 reported by Mike Harris
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
dropbear (Debian)
Fix Released
Unknown
dropbear (Ubuntu)
Fix Released
Undecided
Chris J Arges
Precise
Fix Released
Undecided
Chris J Arges

Bug Description

[Impact]
The dropbear package includes an initramfs script, /usr/share/initramfs-tools/scripts/init-premount/devpts, that mounts devpts a second time, after it's already been mounted by /usr/share/initramfs-tools/init, provided by initramfs-tools.

[Test Case]
Line 23 in /usr/share/initramfs-tools/scripts/init-premount/devpts from dropbear:
mount -t devpts none /dev/pts

Line 25 in /usr/share/initramfs-tools/init from initramfs-tools:
mount -t devpts -o noexec,nosuid,gid=5,mode=0620 devpts /dev/pts || true

The second mount from dropbear fails since /dev/pts is already mounted, but it does change the mount options:

mwharris@mwharris-test:~$ grep pts /proc/mounts
devpts /dev/pts devpts rw,nosuid,noexec,relatime,mode=600,ptmxmode=000 0 0

I'm not sure why dropbear tried to mount devpts a second time, but it seems like the best fix would just be to remove /usr/share/initramfs-tools/scripts/init-premount/devpts from dropbear

I'm on Precise using dropbear_2011.54-1 and initramfs-tools_0.99ubuntu10

[Regression Potential]
Minimal, as this would only remove mounting /dev/pts a second time and is not introducing any extra functionality.

Mike Harris (mwharris-h)
summary: - Dropbear's init scripts mount /dev/pts a second time
+ Dropbear's initramfs scripts mount /dev/pts a second time
Revision history for this message
Chris J Arges (arges) wrote :

This patch would change the debian/initramfs/premount-devpts script to first check if /dev/pts is already mounted. If it is, then we exit the script.

Changed in dropbear (Ubuntu):
assignee: nobody → Chris J Arges (christopherarges)
status: New → Confirmed
Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "dropbear_lp933903_quantal_1.debdiff" of this bug report has been identified as being a patch in the form of a debdiff. The ubuntu-sponsors team has been subscribed to the bug report so that they can review and hopefully sponsor the debdiff. In the event that this is in fact not a patch you can resolve this situation by removing the tag 'patch' from the bug report and editing the attachment so that it is not flagged as a patch. Additionally, if you are member of the ubuntu-sponsors team please also unsubscribe the team from this bug report.

[This is an automated message performed by a Launchpad user owned by Brian Murray. Please contact him regarding any issues with the action taken in this bug report.]

tags: added: patch
Changed in dropbear (Debian):
status: Unknown → New
Revision history for this message
Chris J Arges (arges) wrote :

Here are some test packages to see if this patch fixes the issue:
http://people.canonical.com/~arges/lp933903/

Revision history for this message
Mike Harris (mwharris-h) wrote :

The packages you built fixes it for me. Thanks!

Revision history for this message
Stefano Rivera (stefanor) wrote :

Re-targetted at quantal and uploaded.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package dropbear - 2012.55-1ubuntu1

---------------
dropbear (2012.55-1ubuntu1) quantal; urgency=low

  * If /dev/pts is already mounted, don't re-mount. (LP: #933903)
 -- Chris J Arges <email address hidden> Mon, 04 Jun 2012 12:43:57 +0100

Changed in dropbear (Ubuntu):
status: Confirmed → Fix Released
Revision history for this message
Chris J Arges (arges) wrote :

Thanks for the quick response. Just read that the debbug: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=632656 has a different patch which has not been applied to debian. Not sure if we should be picking up this patch, in case debian goes with the other patch as to not be divergent, or if we should suggest debian pick up this patch. The difference between patches are the following:

--

This is the debian patch which also fixes a space issue with the /proc/filesystems grep. In addition it doesn't rely on mountpoint (although not sure this is a major issue):

+grep -Eq '[[:space:]]devpts$' /proc/filesystems 2>/dev/null || exit 0
+grep -Eq 'devpts[[:space:]]' /proc/mounts 2>/dev/null && exit 0

Here is my patch which was just applied:

+# If /dev/pts is already mounted, don't re-mount it.
+mountpoint -q /dev/pts || exit 0

Revision history for this message
Mike Harris (mwharris-h) wrote :

Can this be released for Precise too?

Chris J Arges (arges)
Changed in dropbear (Ubuntu Precise):
status: New → In Progress
assignee: nobody → Chris J Arges (christopherarges)
Revision history for this message
Chris J Arges (arges) wrote :

Here is the same patch applied to precise.

Revision history for this message
Oliver Grawert (ogra) wrote :

...and uploaded to precise-proposed, please make sure it gets tested and the SRU team gets subscribed to this bug ...

Chris J Arges (arges)
Changed in dropbear (Ubuntu Precise):
milestone: none → ubuntu-12.04.1
Revision history for this message
Mike Harris (mwharris-h) wrote :

I don't see dropbear versino 2011.54-1ubuntu0.12.04.2 in the precise-proposed repo, is it there yet?

description: updated
Revision history for this message
Scott Kitterman (kitterman) wrote : Please test proposed package

Hello Mike, or anyone else affected,

Accepted dropbear into precise-proposed. The package will build now and be available in a few hours. Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users. If this package fixes the bug for you please change the bug tag from verification-needed to verification-done. If it does not, change the tag to verification-failed. In either case details of your testing will help us make a better decision. Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in dropbear (Ubuntu Precise):
status: In Progress → Fix Committed
tags: added: verification-needed
Revision history for this message
Mike Harris (mwharris-h) wrote :

Looks good to me, thanks!

tags: added: verification-done
removed: verification-needed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package dropbear - 2011.54-1ubuntu0.12.04.2

---------------
dropbear (2011.54-1ubuntu0.12.04.2) precise-proposed; urgency=low

  * If /dev/pts is already mounted, don't re-mount. (LP: #933903)
 -- Chris J Arges <email address hidden> Fri, 08 Jun 2012 15:30:28 -0500

Changed in dropbear (Ubuntu Precise):
status: Fix Committed → Fix Released
Revision history for this message
Sven Neuhaus (sven0) wrote :

I am getting an error about mountpoint not being found on Ubuntu 13.10:

 /scripts/init-premount/devpts: line 21 mountpoint not found

When did the mountpoint command disappear?
What package was it part of?

See also bug #1070992

Changed in dropbear (Debian):
status: New → Fix Released
Changed in dropbear (Debian):
status: Fix Released → New
Changed in dropbear (Debian):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.