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?

1
  • 2
    Welcome to Ask Ubuntu! Could you include the output of cat /proc/mounts in your question? To be sure about the configuration on your system.
    – gertvdijk
    Jun 22, 2013 at 14:28

5 Answers 5

38

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.

2
  • 5
    This command doesn't work for me. Instead I get a : "mount: /tmp not mounted or bad option" error
    – Dark Star1
    Apr 14, 2014 at 21:21
  • 1
    It does not work for me either. Aug 3, 2016 at 17:23
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.

0
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
1
  • This worked for me thanks a lot!
    – n1nsa1d00
    Aug 24, 2022 at 9:39
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!

5
  • To the downvoters: I know about potential security implications. /tmp was made noexec for some reasons, probably. I have no intentions to argue with that. I'm just answering the question. If one already decided to make it executable, who we are to judge. And here is a link to the answer is where I found the mention of tmp.mount systemd unit.
    – madhead
    Feb 21, 2022 at 1:10
  • I would be interested to know the context of this - my (Lubuntu 20.04) system has no file /etc/systemd/system/tmp.mount (and certainly the person asking this question before the adoption of systemd by Ubuntu wouldn't either, but there's nothing this site needs more than up-to-date answers, so that isn't a criticism), /tmp isn't mentioned in mount and so does not appear to have its own mount options. What are you running?
    – Zanna
    Feb 21, 2022 at 8:05
  • @Zanna, Ubuntu 20.04
    – madhead
    Feb 21, 2022 at 10:04
  • I just realized I put two identical answers for this question. I'm sorry for that.
    – madhead
    Feb 21, 2022 at 10:06
  • 1
    thanks... interesting... that wasn't a mistake by you - when you post the exact same answer to two different questions, we get a flag (the other question did not have any answers that gave a temporary solution - it's good read the stuff on the page and adjust if re-posting!) - I merged the two questions (which moves answers from one to the other) as they were duplicates, the other one had less detail, and Avinash's answer seemed worth moving over.
    – Zanna
    Feb 21, 2022 at 14:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .