Questions tagged [lock]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
20 views

Implementation details about pthread mutex and realtime semaphore with regard to signal safety

In the current standard, the sem_post is listed as an async-signal safe function; pthread mutex unlocking (and condition variable signalling) functions on the other hand are not. In my understanding: ...
  • 523
0 votes
0 answers
23 views

Linux pipe/redirect creates file with size `0`; then eventually writes all data to file; how to avoid

I'm having a hard time googling this, so please point to available duplicates (better phrasing of title). I wonder, if I have a long running command redirect into a file, the file gets created ...
  • 141
0 votes
1 answer
36 views

Can a program tell whether I have a file open in an editor?

I have a file that I edit by hand (using emacs in a terminal window). I have a script that then reads the file, checks it for errors, and also modifies it by doing things like sorting lists in ...
5 votes
3 answers
419 views

Lock a bash script based on parameter?

I'm trying to find a way to lock a script based on a parameter given, but was unsuccessful in finding a proper answer. What I'm trying to achieve is prevent another user from running a script based on ...
0 votes
0 answers
12 views

What would be the best approach to lock an application UI?

"Lock an application" meaning make it unresponsive to e. g. mouse and keyboard input. Imagine the whole application greyed out - that kind of effect (I'm only talking about the functionality,...
0 votes
3 answers
947 views

How To enable/disable "Lock Screen" setting from Linux terminal?

Please, do NOT say how to lock screen, i know how to do it. How To enable/disable Lock Screen service from terminal? Looks it's using xflock4 for locking screen. I can enable or disable it in ...
0 votes
1 answer
18 views

How to customize default linux/unix PAM module faillock to lock user in all nodes in a cluster

I have implemented faillock in all nodes in cluster, so If any user failed login attempts three time through ssh he will be locked for certain period.It is working fine on individual node but I wanted ...
0 votes
0 answers
12 views

Interruptible/Pausable/Restartable file locks and descriptors on Linux?

I have this desired use case: unload then reload (a possibly different version of) a file system driver without having first to close processes that have open files on it. To do this, I am imagining ...
0 votes
0 answers
590 views

apt-get autoremove --purge -y seems to be stuck

I'm not entirely sure why this is happening, so it seemed wise to ask here before I interfere with it. I'm attempting to install nasm, but I get the message: Waiting for cache lock: Could not get lock ...
2 votes
0 answers
237 views

Automatically lock my Linux computer when I walk away from it

I would like to lock my Linux (GNOME) machine after I walk away from it. Ideally, it should be a small Bluetooth tag / card that I carry in my pocket with a proximity sensor. Is there some software ...
0 votes
0 answers
43 views

libgnat-7 : Depends: gcc-7-base (= 7.5.0-6ubuntu2) but it is not going to be installed

I'm trying to install libgnat-7 but I get the following errors when I call 'sudo apt install libgnat-7': libgnat-7 : Depends: gcc-7-base (= 7.5.0-6ubuntu2) but it is not going to be installed ...
0 votes
1 answer
499 views

How do I make Linux Mint stop pestering me for passwords all the time?

I run Linux Mint in a VM. Every single time I look at it, it has gone into some sort of "lock screen"-like state where it requires me to enter a password to get back. This is very annoying. ...
0 votes
1 answer
414 views

Does locking in gnome allow background tasks like uplaoding to keep running?

I am uploading things in the back and want to lock the screen, but am not sure if the lock function in gnome locks the screen while allowing that to continue. So far it seems that the computer is not ...
  • 145
2 votes
0 answers
156 views

Debug & analyze pthread_mutex_lock issues

I've being recently facing some hardcore issues with Mutex lock for Linux, notably MySQL, memcache & APCu. Example: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting ...
  • 121
0 votes
0 answers
28 views

System locking up upon shutting down

Today upon shutting down my System I was greeted with loads of errors and informations i do not understand. This happened yesterday also and it didn't seem to continue to shut down "normally"...
  • 13
1 vote
0 answers
33 views

Need utility to measure lock contention and thread Migration Rate

I Know it is trivial question but I searched several days for a utility to measure lock contention and thread migration rate but no luck.
5 votes
1 answer
326 views

Code works in bash, not in zsh -- flock on arbitrary fd

Am new to shell scripting, and it makes me wonder why the following snippet does not work in zsh but does in bash? Is there a zsh equivalent of the same snippet? I get error parse error near `200' ( ...
  • 486
0 votes
1 answer
550 views

Watchdog message about CPU soft lockup in Fedora

I am running Fedora 34 KDE on my ASUS ZenBook Flip 14 with an Intel 11th Gen i7. It seems like every few minutes, I get this error message: watchdog: BUG: soft lockup - CPU#7 stuck for 22s! [swapper/7:...
1 vote
0 answers
197 views

How to specify which display i3-lock starts showing the image on?

I sometimes use a monitor with my laptop. I use i3lock -t -i /path as my locking command and the image I use is of the resolution of my laptop screen. Running this with the monitor connected the puts ...
  • 111
1 vote
1 answer
316 views

laptop keyboard locks up after closing lid

I have a Dell Latitude 5500 and a Dell Latitude 7550. The 5500 has Debian 10 and KDE, and the 7550 has Ubuntu 20.04 with KDE. In both laptops, if I close the lid, when I open it later the built-in ...
  • 641
2 votes
2 answers
5k views

Arch linux: i3wm set lock time out (xss-lock i3lock)

I use arch with i3wm. I have enabled i3lock in my .config/i3/config: exec --no-startup-id xss-lock --transfer-sleep-lock -- i3lock Problem is my computer locks like every 10 minutes. How can I set ...
  • 1,031
0 votes
2 answers
3k views

xautolock configuration in Arch i3

After recently switching to i3 in Arch, I need something to manage power. xautolock seemed to be a good choice. Unfortunately, I need it to do both systemctl suspend and i3lock at the same time, but ...
  • 145
0 votes
0 answers
202 views

Get the lock status of an account on Solaris

I do not have root privileges. I wish to get the lock status of a given account say mwss I'm on Sun Solaris uname -a SunOS myhost 5.11 11.4.27.82.1 sun4v sparc sun4v Below is the output from shadow ...
  • 417
-3 votes
2 answers
655 views

is there a really simple and reliable way to create a unique lock (file) on linux? without using `flock` [closed]

EDIT: I learned how to use flock for exclusive lock and how to not mess with it: https://superuser.com/questions/1619940/flock-is-randomly-failing-on-desktop-pc-but-not-on-notebook-could-be-defectiv/. ...
3 votes
1 answer
1k views

Trying to use xautolock to suspend activity after a certain amount of time

I'm using manjaro (5.8.18-1-MANJARO) and the i3 window manager. I'm trying to lock the screen then suspend activity after given amounts of idle time. I've found that xautolock should suit my needs ...
-1 votes
1 answer
123 views

Locking a file to (over)writing [closed]

I have a poorly designed build script that always overwrites files that it shouldn't; if I edit these files and then run the script, it overwrites their content and, thus, the build fails. How can I &...
  • 965
1 vote
1 answer
1k views

Function Lock. can't disable

I'm using a Feker Machinist 01. On both Manjaro and Linux Mint (both running cinnamon), the function keys are "locked" to those silly laptop features like enabling/disabling wifi, adjusting ...
0 votes
1 answer
440 views

What permission does the "lock" group in /etc/group grant?

I'm running Fedora. $ ls -l /dev/ttyACM0 crw-rw----. 1 root dialout 166, 0 Jul 4 10:50 /dev/ttyACM0 I was not able to access /dev/tty/ACM0 (dynamic usb serial with an Arduino on the other end), ...
5 votes
3 answers
4k views

Handling of stale file locks in Linux and robust usage of flock

I have a script I execute via cron regularly (every few minutes). However the script should not run multiple times in parallel and it sometimes runs a bit longer, thus I wanted to implement some ...
  • 91
0 votes
1 answer
671 views

"sudo apt autoremove" command doesn't work ("/var/cache/debconf/config.dat is locked by another process")

I've tried solutions like editing on panasoniclpd.init file and it doesn't work too. This problem keeps shown whenever I try to update or install from the CLI sudo apt autoremove [sudo] password for ...
0 votes
1 answer
2k views

A VNC server is already running, but no lock file for that

Although there is no X11 lock on display 12, vncserver can not start that display number due to a "VNC server that is running on 12". # rm /tmp/.X12-lock rm: cannot remove ‘/tmp/.X12-lock’: No such ...
  • 1,081
2 votes
3 answers
15k views

Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?

(base) rusiru@rusiru-X556UV:~$ sudo apt-get upgrade Reading packages lists... Done Building dependency tree Reading state information... Done E: The package packettracer needs to be installed, but I ...
0 votes
3 answers
3k views

How to install nfslock daemon

I want to learn the NFS locking mechanism I surfed on net. Using nfslockd or rpc.lockd we can do. But in Debian there is no package. Anyone please help me whether shall we do or not in Debian.
4 votes
2 answers
3k views

zsh: locking failed for ~/.cache/zsh/zsh_history: file exists

I have a bind mount ~/.cache/zsh folder between multiple hosts with rw and defaults when doing mount. When I start both machine and zsh trying to lock zsh_history, it gives error zsh: locking failed ...
  • 1,735
3 votes
1 answer
2k views

Cannot open access to console, the root account is locked after upgrade linux mint kernel

According to pervious question: Halt in Linux mint logo after update and upgrade After changing the GRUB file to: linux /boot/.... ro quiet text When I suspend the OS, I am going to loging page: ...
2 votes
2 answers
4k views

file access blocked by a lock - how to remove?

I am trying to run the "check" function of backup program "restic" on one of the backup repositories it's created. No matter what I do, it crashes due to a fatal "already locked" problem. Here is the ...
1 vote
0 answers
244 views

My SSD has unexpected inconsistencies showing up after some time of usage

I have Ubuntu installed on my Kingston SSD. 4.15.0-55-generic #60-Ubuntu SMP Tue Jul 2 18:22:20 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux The system itself is quite smooth, but I have a major data ...
0 votes
0 answers
353 views

Unable to wake up after locking screen

Just installed Xubuntu 19.04. When I try to lock my screen it does some weird and crashes. Screen turns off and I have to turn the system off manually. Tried xscreensaver and it works just fine, but I ...
2 votes
2 answers
780 views

Lock file naming pattern

Whenever I open a LibreOffice document, LibreOffice creates a lock file along the original file. This file has a naming schema like the following: .~lock.MyDocument.odt# Is this a LibreOffice ...
24 votes
3 answers
4k views

How does this script ensure that only one instance of itself is running?

On 19 Aug 2013, Randal L. Schwartz posted this shell script, which was intended to ensure, on Linux, "that only one instance of [the] script is running, without race conditions or having to clean up ...
user avatar
1 vote
0 answers
212 views

About `page_table_lock` in Linux process address space

I'm reading a tutorial about Linux page table, in the linked page Each process has its own page tables (threads share them). The pgd field of the memory descriptor points to the process's page ...
  • 274
4 votes
2 answers
369 views

Lock Virtual Terminals when resuming

Many screen lockers (mine is i3lock) do not block access to other Virtual Terminals. This means that, if I leave a session opened in some VT, then even when the desktop is locked (for example when ...
  • 396
0 votes
0 answers
405 views

Does pid file work by assuming pid is not usable?

To use a pid file for ensuring singleton running instance of a program, I thought that when a process finishes running the program, it should remove the pid file, until I know it doesn't when reading ...
  • 94.9k
0 votes
2 answers
208 views

Can we tell if a command is being run by a process or not, by looking at the flock lock file alone?

Is util-linux's flock implemented based on flock() in Linux C API? Can we tell if a command is being run by a process or not, by looking at the lock file alone? I found that when a command guarded by ...
  • 94.9k
4 votes
1 answer
812 views

Is pseudo terminals ( unlockpt / TIOCSPTLCK ) a security feature?

After having opened the master part of a pseude-terminal int fd_pseudo_term_master = open("/dev/ptmx",O_RDWR); there is the file /dev/pts/[NUMBER] created, representing the slave part of he ...
-1 votes
1 answer
367 views

Why "a lock file is the best approach if the resource is not a regular file, so using methods for locking files does not apply"?

Thanks to Mark's comment, pointing me to https://en.wikipedia.org/wiki/File_locking#Lock_files which says Shell scripts and other programs often use a strategy similar to the use of file locking: ...
  • 94.9k
1 vote
1 answer
458 views

Allow DPMS to turn off screen with force when the screen is locked?

I discover that command xset dpms 300 which turn off the screen for example after 5 minutes (300s), and it wonderfully doesn't turn off the screen if a youtube video is actually playing even in a ...
1 vote
2 answers
3k views

SELinux - How to avoid it preventing a process from write access on newly created files into folder

I'm hardly trying to correctly use selinux keeping it in enforced mode, but very often I encounter issues with it causing our application to work improperly. Our web application is java backend and ...
  • 2,686
1 vote
1 answer
260 views

Where is official documentation about locking mechanisms for etckeeper, apt, and/or dpkg?

Context: Want to put a lock on etckeeper/apt hook activity during special backup. Objective is to preserve whole package integrity, e.g., wait until any package installation is complete, and then ...
0 votes
2 answers
355 views

Getting Information about locks associated with a process

I am unable to list the locks associated with a process and information about the locks i.e How many threads share this lock etc. Kindly tell my how to extract this information from a process ID. My ...