6

I think something generated millions of files or folders in my /tmp on Ubuntu 18.04, as I'm unable to run ls /tmp or even rm -rf /tmp/*. So I tried rebooting, but now my machine's stuck at the step:

A start job is running for Create Volatile Files and Directories

I let it run for 10 hours, and it's still going, so it's likely swapping to disk and will never complete. What do I do? How do I clear my /tmp folder if I can't even boot the system?

Edit: I appended "systemd.debug-shell=1 systemd.show_status=false" so I could get to a shell. Then I killed the systemd-tmpfiles process and then ran mkdir /empty; time rsync -a --delete /empty/ /tmp/ to do a fast delete as suggested here. However, after 30 minutes, it's still running.

Cerin
  • 3,497
  • 17
  • 57
  • 72

1 Answers1

9

You can boot in single user mode, move the tmp folder, create a new clean one, set the permissions and reboot. Then you can do whatever needs to be done with the old tmp.

in the single user session do:

mv /tmp /old.tmp
mkdir /tmp
chmod 1777 /tmp

and reboot.

Eduardo Trápani
  • 1,140
  • 6
  • 10
  • 4
    Even in single-user mode, it still hangs at the "Create Volatile Files and Directories" step. – Cerin Oct 11 '19 at 00:06
  • I used my boot flags, and then your method worked. Thanks. – Cerin Oct 11 '19 at 00:35
  • 1
    @Cerin Could you specify what boot flags do you mean? See also https://askubuntu.com/questions/1209478/boot-stuck-at-ubuntu-logo?noredirect=1#comment2030672_1209478. – Melebius Feb 10 '20 at 18:21
  • 2
    I had exactly the same problem but the single user mode didn't help. So I entered using the recovery mode(changing the ro flag with rw to be able to modify the file system, I did that doing some steps similar to the linked answer in Eduardo's answer). Once on recovery mode I just run the 'root' option and did what Eduardo said. – Gonzalo Petraglia Jun 16 '20 at 13:08
  • 3
    Same problem but I couldn't get into a sheel as the message "create volatile.." still appeared even in single user or recovery mode. What I did was change ro to rw on grub and append `init=/bin/bash` so it forces a shell. – kR105 Sep 15 '20 at 15:27
  • 1
    before run `mv` command, you should get the write permission by `mount / -o rw,remount`. – VictorLee Apr 15 '22 at 04:03