nsIProcess doesn't work for some executables

Bug #882125 reported by Christian Holtje
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
firefox (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

Hello!

I'm the author of the Firefox extension "It's All Text!". This extension launches a local editor (like emacs or gvim) with the contents of a textarea to make editing web pages (wikis, etc.) easier.

I have discovered a bug in Ubuntu's firefox: https://github.com/docwhat/itsalltext/issues/18

It appears that the nsIProcess run*() methods fail for *some* binaries.

In the issue I referenced above, the user was able to use /usr/bin/gedit but not /usr/bin/sublime-text-2. It would fail to launch and return an exit code 1.

The user was nice enough to let me screen share with him and we tried runwAsync() (the default), runAsync(), and run() to launch the editor but it failed in all cases.

We then downloaded Firefox from the official site (both the Ubuntu one and the official one were 7.0.1) and nsIProcess then worked.

I am unable to figure out:

* How /usr/bin/gedit and /usr/bin/sublime-text-2 differ that one fails and one succeeds.
* How the Ubuntu Firefox and the Official Firefox differ.

I haven't a clue about what's going on here.

I am unable to reproduce this problem in my VM. I'll ask the user to subscribe to this bug in case you want to ask him additional questions.

Ciao!

Revision history for this message
Chris Coulson (chrisccoulson) wrote :

This is unlikely to be a bug with the Ubuntu specific binaries, as we don't change anything there at all. It's more likely that the reporter set the Firefox apparmor profile to enforce mode, so that accesses to some binaries are blocked (/usr/bin/gedit is one binary which is explicitly enabled in the profile)

Changed in firefox (Ubuntu):
status: New → Incomplete
Revision history for this message
Chris Coulson (chrisccoulson) wrote :

Please ask the person affected to run "apport-collect 882125"

Revision history for this message
Mamed Mamedov (mamed-mamedov) wrote : apport information

AddonCompatCheckDisabled: False
AlsaVersion: Advanced Linux Sound Architecture Driver Version 1.0.24.
ApportVersion: 1.23-0ubuntu3
Architecture: amd64
ArecordDevices:
 **** List of CAPTURE Hardware Devices ****
 card 0: Intel [HDA Intel], device 0: CONEXANT Analog [CONEXANT Analog]
   Subdevices: 1/1
   Subdevice #0: subdevice #0
AudioDevicesInUse:
 USER PID ACCESS COMMAND
 /dev/snd/controlC0: mamedov 2041 F.... pulseaudio
BuildID: 20111008085652
Card0.Amixer.info:
 Card hw:0 'Intel'/'HDA Intel at 0xf0500000 irq 47'
   Mixer name : 'Conexant CX20561 (Hermosa)'
   Components : 'HDA:14f15051,1179ff56,00100000'
   Controls : 14
   Simple ctrls : 7
Channel: release
DistroRelease: Ubuntu 11.10
ForcedLayersAccel: False
IfupdownConfig:
 auto lo
 iface lo inet loopback
InstallationMedia: Ubuntu 9.10 "Karmic Koala" - Release amd64 (20091027)
IpRoute:
 default via 192.168.137.25 dev wlan0 proto static
 169.254.0.0/16 dev wlan0 scope link metric 1000
 192.168.56.0/24 dev vboxnet0 proto kernel scope link src 192.168.56.1
 192.168.137.0/24 dev wlan0 proto kernel scope link src 192.168.137.104 metric 2
Package: firefox 7.0.1+build1+nobinonly-0ubuntu2
PackageArchitecture: amd64
ProcEnviron:
 PATH=(custom, no user)
 LANG=en_US.UTF-8
 SHELL=/bin/bash
ProcVersionSignature: Ubuntu 3.0.0-12.20-generic 3.0.4
Profiles: Profile0 (Default) - LastVersion=7.0.1/20110928134238 (Out of date)
RunningIncompatibleAddons: False
Tags: oneiric running-unity
Uname: Linux 3.0.0-12-generic x86_64
UpgradeStatus: Upgraded to oneiric on 2011-10-14 (12 days ago)
UserGroups: adm admin cdrom davfs2 dialout lpadmin netdev plugdev sambashare users vboxusers
UserJS:
 network.protocol-handler.external.picasa - true
 network.protocol-handler.app.picasa - /usr/bin/picasa
dmi.bios.date: 07/16/2008
dmi.bios.vendor: TOSHIBA
dmi.bios.version: V3.60
dmi.board.name: Satellite A300
dmi.board.vendor: TOSHIBA
dmi.board.version: Not Applicable
dmi.chassis.asset.tag: No Asset Tag
dmi.chassis.type: 10
dmi.chassis.vendor: TOSHIBA
dmi.chassis.version: N/A
dmi.modalias: dmi:bvnTOSHIBA:bvrV3.60:bd07/16/2008:svnTOSHIBA:pnSatelliteA300:pvrPSAJ0E-00V00NRU:rvnTOSHIBA:rnSatelliteA300:rvrNotApplicable:cvnTOSHIBA:ct10:cvrN/A:
dmi.product.name: Satellite A300
dmi.product.version: PSAJ0E-00V00NRU
dmi.sys.vendor: TOSHIBA

tags: added: apport-collected oneiric running-unity
Revision history for this message
Mamed Mamedov (mamed-mamedov) wrote : AlsaDevices.txt

apport information

Revision history for this message
Mamed Mamedov (mamed-mamedov) wrote : AplayDevices.txt

apport information

Revision history for this message
Mamed Mamedov (mamed-mamedov) wrote : BootDmesg.txt

apport information

Revision history for this message
Mamed Mamedov (mamed-mamedov) wrote : CRDA.txt

apport information

Revision history for this message
Mamed Mamedov (mamed-mamedov) wrote : Card0.Amixer.values.txt

apport information

Revision history for this message
Mamed Mamedov (mamed-mamedov) wrote : Card0.Codecs.codec.0.txt

apport information

Revision history for this message
Mamed Mamedov (mamed-mamedov) wrote : CurrentDmesg.txt

apport information

Revision history for this message
Mamed Mamedov (mamed-mamedov) wrote : Dependencies.txt

apport information

Revision history for this message
Mamed Mamedov (mamed-mamedov) wrote : Extensions.txt

apport information

Revision history for this message
Mamed Mamedov (mamed-mamedov) wrote : IpAddr.txt

apport information

Revision history for this message
Mamed Mamedov (mamed-mamedov) wrote : IwConfig.txt

apport information

Revision history for this message
Mamed Mamedov (mamed-mamedov) wrote : Lspci.txt

apport information

Revision history for this message
Mamed Mamedov (mamed-mamedov) wrote : PciMultimedia.txt

apport information

Revision history for this message
Mamed Mamedov (mamed-mamedov) wrote : PciNetwork.txt

apport information

Revision history for this message
Mamed Mamedov (mamed-mamedov) wrote : Prefs.txt

apport information

Revision history for this message
Mamed Mamedov (mamed-mamedov) wrote : ProcCpuinfo.txt

apport information

Revision history for this message
Mamed Mamedov (mamed-mamedov) wrote : PulseSinks.txt

apport information

Revision history for this message
Mamed Mamedov (mamed-mamedov) wrote : PulseSources.txt

apport information

Revision history for this message
Mamed Mamedov (mamed-mamedov) wrote : RfKill.txt

apport information

Revision history for this message
Mamed Mamedov (mamed-mamedov) wrote : Themes.txt

apport information

Revision history for this message
Mamed Mamedov (mamed-mamedov) wrote : WifiSyslog.txt

apport information

Revision history for this message
Chris Coulson (chrisccoulson) wrote :

Could you also please post the output of "sudo aa-status"?

Revision history for this message
Mamed Mamedov (mamed-mamedov) wrote :

apparmor module is loaded.
18 profiles are loaded.
18 profiles are in enforce mode.
   /sbin/dhclient
   /usr/bin/evince
   /usr/bin/evince-previewer
   /usr/bin/evince-thumbnailer
   /usr/lib/NetworkManager/nm-dhcp-client.action
   /usr/lib/connman/scripts/dhclient-script
   /usr/lib/cups/backend/cups-pdf
   /usr/lib/firefox-7.0.1/firefox{,*[^s][^h]}
   /usr/lib/firefox-7.0.1/firefox{,*[^s][^h]}//browser_java
   /usr/lib/firefox-7.0.1/firefox{,*[^s][^h]}//browser_openjdk
   /usr/lib/lightdm/lightdm-guest-session-wrapper
   /usr/lib/telepathy/mission-control-5
   /usr/lib/telepathy/telepathy-*
   /usr/sbin/cupsd
   /usr/sbin/dhcpd3
   /usr/sbin/mysqld-akonadi
   /usr/sbin/tcpdump
   /usr/share/gdm/guest-session/Xsession
0 profiles are in complain mode.
6 processes have profiles defined.
6 processes are in enforce mode.
   /sbin/dhclient (7094)
   /usr/lib/telepathy/mission-control-5 (2397)
   /usr/lib/telepathy/telepathy-* (4975)
   /usr/lib/telepathy/telepathy-* (7101)
   /usr/lib/telepathy/telepathy-* (7102)
   /usr/sbin/cupsd (1210)
0 processes are in complain mode.
0 processes are unconfined but have a profile defined.

Revision history for this message
Chris Coulson (chrisccoulson) wrote :

Thanks. So, this isn't a bug, but is a side-effect of you enabling the Firefox apparmor profile and setting it to enforce mode. If you want to keep using Apparmor, then you will need to add exceptions for executables that you're trying to get Firefox to run. You can do this by editing /etc/apparmor.d/local/usr.bin.firefox (have a look in /etc/apparmor.d/usr.bin.firefox for the syntax)

Changed in firefox (Ubuntu):
status: Incomplete → Invalid
Revision history for this message
Christian Holtje (docwhat) wrote :

Does this explain why the official Firefox works and the Ubuntu one doesn't? I'm unfamiliar with apparmor.

Revision history for this message
Chris Coulson (chrisccoulson) wrote :

Yes. The profile only applies to the install from our archive

Revision history for this message
Chris Coulson (chrisccoulson) wrote :
Revision history for this message
Tom (thomasmca) wrote :

For the benefit of users that might find this thread while trying to get rid of this error, here's how to fix it.

If It's All Text dies with an "exited with a status of 1" error in .deb-based flavors of Linux like Ubuntu, here's how to fix that error.

To see if this will fix your error, run this command:

sudo aa-status

If you get output like "14 profiles are in enforce mode" then these instructions will work for you - continue with the following steps.

Look in the /etc/apparmor.d/ folder for a file called (or starts with) usr.bin.firefox.

Edit that file with your favorite editor using superuser priveleges. You'll need to add a line that points to the editor that you configured It's All Text to use. In my case, that's kate, and the path to kate's binary is /usr/bin/kate.

Using the above path, add one or two lines into the middle of usr.bin.firefox, like this:

# I added this on 2/17/2012 to allow firefox access to the kate binary for the It's All Text addin
  /usr/bin/kate ixr,

The line that starts with # is just a comment. The /usr/bin/kate portion must point to your editor. The ixr portion gives Firefox permission to run your editor. The comma at the end of the line is required.

To make this change be seen by Firefox, either restart your computer, or run this command:

sudo /etc/init.d/apparmor restart

Revision history for this message
Ananth P (ananthp) wrote :

The suggested work around doesn't work for me. (Ubuntu 12.04 Firefox 12.0).

While doing the last step in the work around, that is, sudo /etc/init.d/apparmor restart I noticed the following

 * Reloading AppArmor profiles
Skipping profile in /etc/apparmor.d/disable: usr.bin.firefox
Skipping profile in /etc/apparmor.d/disable: usr.sbin.rsyslogd
                                                                         [ OK ]

Does it mean that the update didn't affect the required files?

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.