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 read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
mfluder

deleted /tmp the other day

Post by mfluder »

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 LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
xenopeek
Level 25
Level 25
Posts: 29507
Joined: Wed Jul 06, 2011 3:58 am

Re: deleted /tmp the other day

Post by xenopeek »

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?
Image
mfluder

Re: deleted /tmp the other day

Post by mfluder »

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?
User avatar
xenopeek
Level 25
Level 25
Posts: 29507
Joined: Wed Jul 06, 2011 3:58 am

Re: deleted /tmp the other day

Post by xenopeek »

/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.
Image
mfluder

Re: deleted /tmp the other day

Post by mfluder »

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?
User avatar
xenopeek
Level 25
Level 25
Posts: 29507
Joined: Wed Jul 06, 2011 3:58 am

Re: deleted /tmp the other day

Post by xenopeek »

Yes, please make a different topic for that. And I'm no clonezilla expert :wink:
Image
mint123

Re: deleted /tmp the other day

Post by mint123 »

Shouldn't /tmp magically reappear when a program needs to use it? I've read other directories in root work this way.
User avatar
xenopeek
Level 25
Level 25
Posts: 29507
Joined: Wed Jul 06, 2011 3:58 am

Re: deleted /tmp the other day

Post by xenopeek »

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 :)
Image
User avatar
bjornmu
Level 3
Level 3
Posts: 189
Joined: Wed Dec 19, 2012 2:50 am
Location: Trondheim, Norway

Re: deleted /tmp the other day

Post by bjornmu »

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....
Locked

Return to “Other topics”