udisks | The UDisks project provides a daemon, tools and libraries to access and manipulate disks, storage de | Storage library
kandi X-RAY | udisks Summary
kandi X-RAY | udisks Summary
The UDisks project provides a daemon, tools and libraries to access and manipulate disks, storage devices and technologies. For API stability and intended audience of UDisks, see the API STABILITY and AUDIENCE section of the udisks(8) man page (doc/man/udisks.xml in the tarball and git repository).
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of udisks
udisks Key Features
udisks Examples and Code Snippets
Community Discussions
Trending Discussions on udisks
QUESTION
This was originally a question about why I couldn't download anything to my displaced Downloads folder. The issue solved itself after rebooting the computer a second time (no idea why). I decided to leave it here anyway since it contains useful information to people who want to redirect their files on a mounted volume.
EDIT 2 :I was right at first, there was indeed an issue with my dual boot. The problem was that sometimes, I couldn't write anything on my NTFS partition when I was booted on Ubuntu. The reason for that was that Windows hadn't properly disconnected from the partition. More info about that issue here, but basically it happens when Windows isn't completely turned off before Ubuntu starts. The quick fix is to remove the Windows log file : $ sudo ntfsfix /dev/your-NTFS-partition
(for me it was : $ sudo ntfsfix /dev/sda4
). Then you simply unmount and remount the NTFS volume and you should be able to write in it, no reboot needed.
I made my first dual boot yesterday, following this tutorial. I partitioned my drive in 3 volumes, 1 for Windows 10, 1 for Ubuntu 20.04, and 1 for my files (named Storage), that I mounted at /media/storage. The only thing that I did differently from the walkthrough is that I used symlinks to redirect my downloads and documents folders to the mounted volume instead of changing the paths in /etc/fstab. I used this video to learn how to work with symlinks.
I had an issue with the Trash not working in the mounted volume, that I solved by adding uid=1000 in the mount options in /etc/fstab as advised here (I used udisks). Everything seemed to be working just fine after that.
Issue :This morning I tried to download a file with Google Chrome into the Downloads folder (which is now at /media/storage/Downloads) and I got an error "Failed - insufficient permissions". Same thing happened with Firefox. Both browsers download without issue if I use my home folder to save the file.
I read here that :
As a normal user you don't have the right to write anywhere except your home directory and its subdirectories, /tmp (the directory for temporary files) and the subdirectories of /media/"yourUsername" into which media you've connected to the computer are mounted.
Does this mean that I should have mounted my volume at /media/username/storage instead of /media/storage ? If I changed the mount path now in /etc/fstab, would this fix the issue or just mess everything up? Is there something else I'm missing ? What is the best, most sustainable way to fix this ?
More info (more issues) ?I just realized that I have some lock icons on my symlinks folders. They can't have been there yesterday, because everytime I try to modify anything in there, the system throws an error "Read-only file system". I know that I was able to add and delete files from there yesterday.
Here is the output of /media/storage$ ls -l
:
ANSWER
Answered 2021-Mar-22 at 12:56No idea how or why, but the good old "turn it off and on again" did the trick (EDIT : No it didn't, see EDIT 2 of my question). Why did it not work when I rebooted my computer earlier today ? Mystery. Anyway I will leave this here (and edit the title) since it is a good collection of the issues I had while working out my first dual boot and the methods I used to fix them.
QUESTION
I have an application in which I'm using UDisks to handle some drives and partitions. In my application I have a situation where I have a pointer to a UDisksDrive
that I need to convert to a UDisksObject
pointer through which I can access other interfaces later. I'm quite unclear as to what objects I should unreference and when. In one function, I currently do:
ANSWER
Answered 2020-Feb-24 at 20:25Time to think, research, and a brief chat on IRC has resulted in the following:
Yes, I definitely need to free (unreference) block
before the function returns. Also, g_dbus_interface_get_object()
is the wrong function for this situation. Because I don't care about drive
and just want to returns driveObject
, I need to use g_dbus_interface_dup_object()
instead, which allows the returned pointer to own it's own reference. That makes it so that the caller can free driveObject
safely when it's done with it. So the updated code snippet looks like this:
QUESTION
I've recently installed Ubuntu 19.04
which has Python 3.7
by default. I need to work on multiple projects that use Python 3.6
.
Is there a way to install it on Disco Dingo?
I tried which works on 16.04
ANSWER
Answered 2019-Nov-26 at 19:11QUESTION
I have a embedded device running Linux Angstrom. I need to detect a USB drive. So when a USB drive is inserted, I need to automatically copy data from the USB to internal memory of the embedded device.
To detect the USB, I am using below code:
...ANSWER
Answered 2017-Jul-07 at 08:18One naive approach is the following:
- execute
mount | grep /dev/sda1
- parse the output: if there is no output, that means that
sda1
is not mounted
You may have to adapt the code to your specific platform.
QUESTION
I need to (temporary) mount a device read-only with Python3 and the Udisks2 API. What is the correct GLib.Variant for this?
I've created the below script to test with a USB pen drive. It assumes /dev/sdc1 as this device.
...ANSWER
Answered 2019-Apr-12 at 11:23Use GLib.Variant('a{sv}', {'options': GLib.Variant('s', 'ro')})
to pass the standard ro
option through to mount
.
QUESTION
I'm trying to automatically mount a USB drive on linux. With all default settings it works and the drive is mounted to /run/media/username/drivename.
I tried to change the default mount point to /media/drivename by following the guide linked here: https://wiki.archlinux.org/index.php/Udisks#Mount_to_/media_(udisks2)
I added the file /etc/udev/rules.d/99-udisks2.rules
with the following contents:
ANSWER
Answered 2019-Mar-28 at 16:45For anyone running into a similar issue, I simply created the /media
folder and then rebooted and everything worked. Apparently udisks expected /media
to already exist.
- Put 99-udisks2.rules in
/etc/udev/rules.d/
- run
mkdir /media
(as sudo) - run
reboot
- Profit!
QUESTION
I'm running a python program on a raspberry pi (Linux) which logs data into mongodb (using the pymongo module). I'm having trouble understanding when the mongodb service stops running or why it would ever stop.
Right now, I have my program functions set up so that if they fail to access mongodb (get pymongo connection exceptions), they try to restart the service, wait ten seconds and then re-attempt the operation. These functions are recursive like so:
...ANSWER
Answered 2019-Jan-23 at 06:39This issue has now been solved, when reading my temperature sensor on the raspberry pi using SPI, spi.close() was not being called properly and as a result every spi.open() was resulting in a new spidev file being opened. There's a limit to how many files one process can open, and that limit was being reached in my case in around 6-7 hours, after which the script crashed.
It's also important to note that proper logging was not implemented in this area of the code nor were exceptions properly caught, so the exception "OSError: Too many open files" was not being caught or logged making this a very mysterious issue.
Once the exception was caught, it was an easy fix, by properly adding spi.close() every place where spi was being opened.
You can check how many files your process has opened using:
QUESTION
I'm writing a program for a Raspberry Pi that needs to be notified when the user inserts a USB drive. I'm using Qt's D-Bus support to listen to InterfacesAdded from org.freedesktop.UDisks2, which works fine on my x86 Linux desktop.
Here's my code that sets up the D-Bus signal to my class's slot:
...ANSWER
Answered 2017-Apr-26 at 13:43Depends what distribution you are running on your Pi. If you’re using a distribution which uses systemd, you can run sudo systemctl enable --now udisks2.service
to configure the service to always start.
You might want to extend your code to watch the org.freedesktop.UDisks2
name on D-Bus, since you may want to re-connect the signal when it disappears and reappears. (I don’t know exactly how Qt D-Bus handles this; whether it resolves well-known names to unique names at signal handler registration time, or at signal emission time.)
QUESTION
So I'm trying to get a working code in Python that will eject/unmount all USB flash drives attached to the Pi (Running Raspbian) - so that they can be removed safely. The final code will be run from within the python program.
Additionally, I'd like to eject/unmount the USB flash drive even if it's in use.
I've looked around and can't see how to do this. Thanks.
udisks --detach /media/pi/DOCS/
- 'Blocked device... Resource temporarily available'...
udisks --detach /media/pi/
- 'Blocked device...Resource temporarily available'...
udisks --detach /media/
- 'Blocked device...Resource temporarily available'...
sudo udisks --detach /media/pi/DOCS/
- still blocked...
sudo umount /path/to/devicename
- command not found...
eject /media/pi/DOCS/
- Unable to open '/dev/sda'
(DOCS is the name if my USB flash drive. - though I want to eject all USB flash drives - not just my one)
So I'm going to ask the user in Python to select their USB flash drive from a list, which is pretty easy (just read in the folder) - so I will have the pathway to the USB. I'm still not sure which code can safely disconnect the USB flash drive - Maybe more research is the answer. Thanks for your help so far.
...ANSWER
Answered 2017-Nov-22 at 09:50For udisks --detach
the parameter should be the device, not the mounting point.
For example, if the USB Disk is /dev/sdb
the command would be udisks --detach /dev/sdb
If the command still doesn't work you could try udiskctl power-off -b
which should also work.
QUESTION
I have a Python script that does stuff based on D-Bus events, simplified version of that:
...ANSWER
Answered 2017-Dec-13 at 07:14You could use the glib's g_timeout_add_seconds function that registers a callback function to be executed in GMainloop's context. In python, this function is encapsulated in GObject, and you can try the below example code:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install udisks
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page