LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 08-30-2013, 09:13 AM   #1
Lop3
Member
 
Registered: Aug 2013
Posts: 48

Rep: Reputation: Disabled
Question How to release all locks that the current terminal session is holding?


Question:
How can I make the current terminal window give up all its file & dir locks so I can umount?

Setup:
I've written a PHP CLI script to mount or dismount my TC volumes.
I run the script from the terminal and wait a few seconds for it to finish.
(Just to be clear: The script does not keep running and it does not access anything inside the mounted volume. The problem occurs whether I use the PHP script or type the commands manually. Its just to automate the process of mounting and dismounting volumes.)

Steps to reproduce problem:
(I will just paste the relevant lines so you can see what commands I'm using, there are various validations before and after each command, so don't worry about the variable names)
* Mount a truecrypt volume with tcplay inside a terminal window using these commands
Quote:
sudo mkdir $mountpath
sudo losetup $firstloop $tcpath/$tcfile
sudo tcplay -m $tcmapname -d $loop
* Use the TC volume from other programs, close them all when done. (might be optional)
* Fiddle around with files and dirs inside the mounted volume.
* cd / (so I'm not *in* the mounted volume when I try umount)
* Try umount the TC volume from the same terminal window that I mounted it with.
it complains that the TC volume is in use.
Quote:
sudo umount $mountpath
Workaround:
* CLOSE the terminal window then open a NEW terminal window and give the umount command.

Interesting:
* In the past I tried some command to kill locking processes on that volume, it was really funny. it closed the terminal I entered the command in.
* If I just mount from terminal x, use other terminals or programs, then dismount from terminal x it dismounts cleanly without any error.

First prize:
Some command that makes the current terminal session give up any locks it's holding on any files/dirs. That would be awesome.

OS:
Linux Mint 15 x64 (based on Ubuntu 13.04), Mate 1.6, Main shell: zsh, scripts: PHP or Bash

Last edited by Lop3; 08-30-2013 at 09:27 AM.
 
Old 08-30-2013, 01:42 PM   #2
sgosnell
Senior Member
 
Registered: Jan 2008
Location: Baja Oklahoma
Distribution: Debian Stable and Unstable
Posts: 1,943

Rep: Reputation: 542Reputation: 542Reputation: 542Reputation: 542Reputation: 542Reputation: 542
Have you tried "rm *.lock"? I don't really know how Truecrypt locks things, but the usual way to lock a file is to use a zero-byte file named "something.lock" where "something" is a name the program that wants to lock the file makes up, often the name of the program. That file is usually in the working directory of the program.
 
1 members found this post helpful.
Old 09-11-2013, 10:23 AM   #3
Lop3
Member
 
Registered: Aug 2013
Posts: 48

Original Poster
Rep: Reputation: Disabled
I don't think truecrypt makes .lock files.
For some reason I haven't had an issue lately.
I'll mark this as solved for now.

Thanks
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
make commands keep running after leaving a terminal session or ssh session Danny3031 Programming 18 01-30-2012 11:29 AM
`df -h` locks my ssh session zivota Linux - General 3 05-15-2009 11:03 PM
CGI Session not holding data evannextel Linux - Software 1 01-13-2006 04:04 AM
Lock the current terminal session? kipbenson4 Linux - Newbie 1 08-14-2003 09:04 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 06:01 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration