27

I have Ubuntu 12.04 LTS and I tried to upgrade to Ubuntu 12.10. When I clicked in the Update Manager Upgrade a message box apeared:

Cannot run the upgrade. This usually is caused by a system where /tmp is mounted noexec. Please remount without noexec and run the upgrade again.

I tried to make /tmp executable in Terminal with the following command:

mount -o remount,exec /tmp /var/tmp

I pressed Enter and I got the following message from Terminal:

mount: only root can do that

What should I do now to make /tmp executable and upgrade the OS?

Zanna
  • 72,312
zbarni
  • 467

5 Answers5

39

You need to have root privileges. For this, put sudo in front of the command:

sudo mount -o remount,exec /tmp

When you are asked for a password, just enter your usual user password.

Zanna
  • 72,312
Radu Rădeanu
  • 174,089
  • 51
  • 332
  • 407
5

It shows that your /tmp is mounted as noexec, so try to mount it with exec option in order to make your upgrade work.

exec / noexec - Permit/Prevent the execution of binaries from the filesystem.

Open the /etc/fstab file as root, for example run

sudoedit /etc/fstab

Change the below line (/tmp entry on fstab for mine looks like this) from

tmpfs /tmp tmpfs defaults,noatime,mode=1777,nosuid,size=512M,noexec 0 0

to

tmpfs /tmp tmpfs defaults,noatime,mode=1777,nosuid,size=512M,exec 0 0

Or, if your line looks different, just remove and replace noexec in the fourth column with exec.

Save that file and then restart your system. Now try to upgrade again.

Zanna
  • 72,312
Avinash Raj
  • 80,446
4

Would you try this command? In my case, this worked.

sudo mount -t tmpfs -o exec tmpfs /tmp

and then, check if it worked.

mount
edwinksl
  • 24,109
Ons
  • 41
1

Privileges and permissions in linux can be confusing. I recommend reading this before you start using sudo. Once you understand the difference between root, sudo, and normal user, you'll have a much better grasp of why this error happened (and *nix in general). See also the man pages for chown and chmod.

-1

Other answers tell you how to make /tmp executable temporarily. To persist this setting:

  1. Edit /etc/systemd/system/tmp.mount (sudo systemctl edit tmp.mount --full).
  2. Find the line with mount options (like Options=mode=1777,relatime,nodev,nosuid,noexec).
  3. Delete the noexec option.

From now on, your /tmp will be executable even after restarts!

madhead
  • 722