deleted /tmp the other day

Questions about other topics - please check if your question fits better in another category before posting here
Forum rules
Before you post please read this

deleted /tmp the other day

Postby mfluder on Mon Feb 25, 2013 12:04 pm

So I was going to delete /home/user/tmp the other day and ended up deleting /tmp instead. Yeah, I know. Stupid mistake. I was very busy and I wasn't paying attention when I ran sudo. Of course, I couldn't log in when I tried to reboot. Apparently, /tmp contains encoded login information or something. Thankfully, I had previously taken an image of my drive with clonezilla. Unfortunately, you cannot browse the file structure of saved clonezilla images. I had to load the entire image onto a third hard drive just the get the contents of the /tmp folder. Does anyone out there know how to get specific files off saved clonezilla images without restoring the entire image? I am looking for something similar to Symantec ghost explorer.
Last edited by mfluder on Mon Feb 25, 2013 1:42 pm, edited 1 time in total.
mfluder
Level 2
Level 2
 
Posts: 58
Joined: Wed Feb 06, 2013 9:10 am

Linux Mint is funded by ads and donations.
 

Re: deleted /tmp the other day

Postby xenopeek on Mon Feb 25, 2013 1:23 pm

There are various ways to fix this. Follow the steps till 8 here http://community.linuxmint.com/tutorial/view/339 to get to a basic shell. That may still work. Then you can recreate a /tmp folder with:
Code: Select all
sudo mkdir /tmp
sudo chmod 1777 /tmp

You couldn't have deleted /tmp without being root, so perhaps be a little more careful with using the root account :shock:

If the above doesn't work, there is a slightly more involved version using the Linux Mint installation DVD / USB stick. Do you have one?
User avatar
xenopeek
Level 21
Level 21
 
Posts: 14807
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands

Re: deleted /tmp the other day

Postby mfluder on Mon Feb 25, 2013 1:41 pm

yeah. I ran the command to delete /tmp as root. I wasn't paying attention. So if I simply recreated the /tmp folder, then the contents would automatically be repopulated the next time I tried to login?

I access mint install with both dvd and usb via grub4dos. what is the involved method that you spoke of?
mfluder
Level 2
Level 2
 
Posts: 58
Joined: Wed Feb 06, 2013 9:10 am

Re: deleted /tmp the other day

Postby xenopeek on Mon Feb 25, 2013 1:57 pm

/tmp holds temporary files, that are deleted at next boot. So you just need to create the folder again with the right permissions.

Well, perhaps it is not that hard. Boot from the DVD. Once on the desktop, open a terminal. Usually the root partition of your installation would be on /dev/sda1, but if you aren't sure you can check with:
Code: Select all
sudo fdisk -l

Once you know which partition has the root filesystem of your installation, mount it to /mnt as so:
Code: Select all
sudo mount /dev/sda1 /mnt

Then create the folder as follows:
Code: Select all
sudo mkdir /mnt/tmp
sudo chmod 1777 /mnt/tmp

Then unmount it (no typo):
Code: Select all
sudo umount /mnt

That should do it.
User avatar
xenopeek
Level 21
Level 21
 
Posts: 14807
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands

Re: deleted /tmp the other day

Postby mfluder on Mon Feb 25, 2013 2:01 pm

oh great. I thought I had to replace the contents of /tmp hence the image restoration. Thanks for the info. Hope I don't ever have to go through this again. :D

Any ideas about clonezilla or should I make that a different topic?
mfluder
Level 2
Level 2
 
Posts: 58
Joined: Wed Feb 06, 2013 9:10 am

Re: deleted /tmp the other day

Postby xenopeek on Mon Feb 25, 2013 2:42 pm

Yes, please make a different topic for that. And I'm no clonezilla expert :wink:
User avatar
xenopeek
Level 21
Level 21
 
Posts: 14807
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands

Re: deleted /tmp the other day

Postby mint123 on Mon Feb 25, 2013 6:30 pm

Shouldn't /tmp magically reappear when a program needs to use it? I've read other directories in root work this way.
mint123
Level 3
Level 3
 
Posts: 133
Joined: Mon Jan 31, 2011 4:44 pm

Re: deleted /tmp the other day

Postby xenopeek on Mon Feb 25, 2013 6:45 pm

mint123 wrote:Shouldn't /tmp magically reappear when a program needs to use it? I've read other directories in root work this way.

Possibly, but I'm not going to try it here :)
User avatar
xenopeek
Level 21
Level 21
 
Posts: 14807
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands

Re: deleted /tmp the other day

Postby bjornmu on Mon Feb 25, 2013 6:54 pm

I guess if /tmp is mounted as tmpfs it will since it doesn't exist on disk (well there must be a mount point I think but you can't delete that without unmounting /tmp first). Maybe also if it's a separate partition, but if it's just a normal directory under / then I doubt it will magically appear. Programs that use /tmp will not be prepared for /tmp not existing....
User avatar
bjornmu
Level 3
Level 3
 
Posts: 156
Joined: Wed Dec 19, 2012 2:50 am
Location: Trondheim, Norway

Linux Mint is funded by ads and donations.
 

Return to Other topics

Who is online

Users browsing this forum: No registered users and 2 guests