Questions tagged [lock]
Use for questions regarding the mechanism to prevent concurrent access to shared resources by means of lock files or in-memory synchronization primitives. For the mechanism to prevent access to unattended desktop computers, use "screen-lock" instead. For questions regarding the unresponsive computer programs, use "freeze" instead.
144 questions
0
votes
0
answers
90
views
Cannot open LibreOffice files on Samba share concurrently on Debian Linux - File locking issue
We have a Samba file server and use Debian Linux for both server and clients.
Everything works fine. Except for one thing:
If someone opens a LibreOffice document (mainly Calc / *.ods), nobody else ...
0
votes
1
answer
107
views
serial console hang in Linux kernel-5.10.188
I am working on an embedded Linux system (kernel-5.10.188), and use /dev/ttyS2 as serial console and ash in busybox is the login shell.
After logging in to system, I ran top -d 1 in the serial console ...
0
votes
0
answers
43
views
Delayed systemd slock autolock
I've been playing with this autoslock.service file:
[Unit]
Description=Lock the screen on suspend
+Before=sleep.target
[Service]
User=garrett
Environment=DISPLAY=:0
ExecStart=/usr/local/bin/slock
[...
0
votes
0
answers
61
views
Linux kernel locking documentation. PREEMPT_RT caveats section question
In the start of this section we see next mentions:
local_lock on RT
The mapping of local_lock to spinlock_t on PREEMPT_RT kernels has a
few implications. For example, on a non-PREEMPT_RT kernel the
...
0
votes
1
answer
93
views
Distributed locks of file-backed mmap()-ed memory over network block devices
There are various ways to access block devices over a network, like
nbd, alias network block device
iscsi, alias scsi over tcp
or simply we can mmap() files mounted in an nfs or cifs network share.
...
0
votes
1
answer
46
views
Is mmap holding a reference to the OFD specified by POSIX, or a Linux extension, and where is it documented?
I am using Open File Description (OFD) owned locks on Linux (fcntl with command F_OFD_SETLK). After locking a file, I memory mapped it, and closed the file descriptor. Another process tried to lock ...
0
votes
1
answer
75
views
Inhibit scheduled job while package installation is in progress
On a Debian-based system I have a scheduled job (e.g. cron job, or systemd timer/service) which runs every 30 minutes. However, I don’t want that to happen concurrently with packages are being ...
2
votes
1
answer
74
views
How does fnctl provide byte range locks?
fnctl (https://man7.org/linux/man-pages/man2/fcntl.2.html) supports locking a portion of a file (specified by start position and length).
Behind the scenes, what does the algorithm look like?
I'm ...
1
vote
1
answer
86
views
Unix-esque partial-file-locking mechanism
Linux and AFAIK most unixes expose the flock syscall for mandatory file-locking. My experience is admittedly limited with this, however am informed that it is kernel-enforced on the entire resource. ...
0
votes
0
answers
334
views
What's the best way to lock a directory from remove & edits?
I have a few directories that I want to lock. This lock should provide the following:
Disallow anyone (including myself) from removing from that directory without a password
Disallow anyone (...
2
votes
0
answers
478
views
elegant atomic distributed locking from bash/python?
In order to ensure non-concurrent execution of some code by multiple processes on a single node, I can implement advisory locking based on some atomic command (e.g. ln or mkdir) or I can use flock.
...
3
votes
1
answer
168
views
file locking mandated by OS/filesystem rather than opted into by file accessors?
Is there a way to have the OS (specifically, FreeBSD) or filesystem (specifically, ZFS) enforce that all access (or, at least, all non-root access, I guess) to a certain file must be done while the ...
0
votes
1
answer
77
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
948
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 ...
3
votes
3
answers
10k
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 ...