Commit Graph

22 Commits

Author SHA1 Message Date
Mike Fleetwood ddb334705e Remove support for obsolete devkit-disks automount inhibitor
Back in 2009 devicekit-disks package was renamed to udisks [1].  All
supported distributions use udisks (or more recently udisks2).  None
have the old devkit-disks command.  Therefore remove it from the GParted
shell wrapper.

[1] https://www.freedesktop.org/wiki/Software/DeviceKit-disks/
    "Note
    On December 1st 2009, DeviceKit-disks was renamed to udisks. This
    release is expected to appear in distributions released in the first
    half of 2010."
2018-06-27 20:26:40 +00:00
Mike Fleetwood f38ccd0284 Only when configured, grant root access to the X11 display (#776437)
GParted fails to display when run under Wayland [1][2][3].  This is
because by intentional design Wayland doesn't allow applications with
root privileges access to the display [4].

As an interim workaround make the gparted shell wrapper use xhost to
grant root access to the X11 server if root doesn't already have access,
but only when configured.  Granting root access must be explicitly
enabled when building GParted like this:
    ./configure --enable-xhost-root
It defaults to disabled.  When gpartedbin binary ends the shell wrapper
revokes root access only if it granted such access.

[1] GNOME Bug 776437 - GParted fails to run as root under Wayland
    https://bugzilla.gnome.org/show_bug.cgi?id=776437

[2] Ubuntu Bug 1652282 - GParted does not work in GNOME on Wayland
    https://bugs.launchpad.net/ubuntu/+source/gparted/+bug/1652282

[3] Fedora Bug 1397103 - gparted not working under Wayland
    https://bugzilla.redhat.com/show_bug.cgi?id=1397103

[4] Common Fedora 25 bugs
    Running graphical apps with root privileges (e.g. gparted) does not
    work on Wayland
    https://fedoraproject.org/wiki/Common_F25_bugs#wayland-root-apps

Bug 776437 - GParted fails to run as root under Wayland
2017-09-01 10:14:20 -06:00
Mike Fleetwood 778e21e94c Now install gparted wrapper script into $prefix/bin (#776437)
Now that the gparted script is intended to be run by ordinary users, as
well as root, install it into directory $prefix/bin rather than
$prefix/sbin.

Bug 776437 - GParted fails to run as root under Wayland
2017-09-01 10:14:20 -06:00
Mike Fleetwood a2cc5014c6 Move root privilege escalation into gparted wrapper script (#776437)
Move calling of the privilege escalation program which allows a normal
user to run GParted as root from the desktop file into the gparted
wrapper script.  This is in preparation for further changes needed to
grant root access to the X11 display under Wayland.

Don't introduce yet another script so that there aren't two different
names to run GParted by for normal users and root.  Using the same
gparted name but placing two different scripts at /usr/bin/gparted and
/usr/sbin/gparted is not possible because on Arch Linux /usr/sbin is a
symbolic link to /usr/bin.

    Frequently asked questions, Does Arch follow the FHS?
    https://wiki.archlinux.org/index.php/Frequently_asked_questions#Does_Arch_follow_the_FHS.3F

    "Arch Linux follows the file system hierarchy for operating systems
    using the systemd service manager.  See file-hierarchy(7) for an
    explanation of each directory along with their designations.  In
    particular, /bin, /sbin, and /usr/sbin are symbolic links to
    /usr/bin, and /lib (and /lib64 if applicable) are symbolic links to
    /usr/lib".

Bug 776437 - GParted fails to run as root under Wayland
2017-09-01 10:14:20 -06:00
Curtis Gedak 4acb8e4fbb If available use udisks2-inhibit to prevent automounting (#745349)
In order to prevent potential corruption of newly created file systems,
when available use udisks2-inhibit with gpartedbin execution to prevent
automounting.

Original report:

Xubuntu install fail due partition auto mount defeats Gparted
https://bugs.launchpad.net/ubuntu/+source/thunar/+bug/1078445

Some GNU/Linux distributions use the udisks2 "udisksd" daemon and have
udisks2-inhibit at a known location.  The known location is not in the
default PATH environment variable.

One known distribution that matches this criteria is xubuntu 14.04.

Interestingly neither kubuntu 14.04 nor ubuntu 14.04 appear to have the
udisks2 "udisksd" daemon running and do not suffer from this specific
automounting problem.

Bug 745349 - gparted wrapper script needs updated for udisks2
2015-03-12 11:49:43 +00:00
Mike Fleetwood a255abf343 Prevent GParted starting stopped Linux Software RAID arrays (#709640)
Applying operations or just scanning the partitions in GParted was
causing all stopped Linux Software RAID arrays to be automatically
started.  This is not new with this patch set, but as a result of the
following behaviour which has existed for a long time.  Chain of events
goes likes this:

 1) Gparted calls commit_to_os() to update the kernel with the new
    partition table;
 2) Libparted calls ioctl() BLKPG_DEL_PARTITION on every partition to
    delete every partition from the kernel.  Succeeds on non-busy
    partitions only;
 3) Kernel emits udev partition remove event on every removed partition;
 4) Libparted calls ioctl() BLKPG_ADD_PARTITION on every non-busy
    partition to re-add the partition to the kernel;
 5) Kernel emits udev partition add event on every added partition;
 6) Udev rule:
      SUBSYSTEM=="block", ACTION=="add", ENV{ID_FS_TYPE}=="linux_raid_member", \
              RUN+="/sbin/mdadm -I $tempnode"
    from either /lib/udef/rules.d/64-md-raid.rules or
    .../65-md-incremental.rules incrementally starts the member in a
    Linux Software RAID array.

Fix by temporarily adding blank override rules files which does nothing,
so that when the udev add and remove events for Linux Software RAID
array member partitions fire nothing is done; but only when required.
Note that really old versions of udev don't have rules to incrementally
start array members and some distributions comment out such rules.

Bug #709640 - Linux Swap Suspend and Software RAID partitions not
              recognised
2013-10-19 10:21:09 -06:00
Curtis Gedak 43de8e326a Do not mask virtual file systems when using systemctl (#708378)
This enhancement removes the virtual file systems from the list of file
systems (shown below) to be masked.

The following output was captured using Fedora 19:

$ systemctl list-units --full --all -t mount
UNIT                          LOAD   ACTIVE   SUB     DESCRIPTION
-.mount                       loaded active   mounted /
boot.mount                    loaded active   mounted /boot
dev-hugepages.mount           loaded active   mounted Huge Pages File System
dev-mqueue.mount              loaded active   mounted POSIX Message Queue File System
proc-sys-fs-binfmt_misc.mount loaded inactive dead    Arbitrary Executable File Formats File System
run-user-1000-gvfs.mount      loaded active   mounted /run/user/1000/gvfs
sys-fs-fuse-connections.mount loaded active   mounted FUSE Control File System
sys-kernel-config.mount       loaded active   mounted Configuration File System
sys-kernel-debug.mount        loaded active   mounted Debug File System
tmp.mount                     loaded active   mounted Temporary Directory

LOAD   = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB    = The low-level unit activation state, values depend on unit type.

10 loaded units listed.
To show all installed unit files use 'systemctl list-unit-files'.

Bug #708378 - Advertised new feature: Use systemctl runtime mask to
              prevent automounting (#701676) doesn't work
2013-10-08 11:09:06 +01:00
Curtis Gedak 1562994c6d Change systemctl to also mask /etc/fstab mount entries (#708378)
A mistake was made in the following commit:

Use systemctl runtime mask to prevent automounting (#701676)
4c109df9b5

The intention was to use 'systemctl list-units' rather than
'systemctl list-unit-files' so that auto-generated mount files would
also be masked and hence prevented from auto-mounting.

Now 'systemctl list-units' is used.

Bug #708378 - Advertised new feature: Use systemctl runtime mask to
              prevent automounting (#701676) doesn't work
2013-10-08 11:09:06 +01:00
Curtis Gedak 4c9c70d697 Only permit one instance of GParted to execute at a time
Only one partition editing tool should be in use at any one point
in time.  If more than one is in use concurrently, then data loss
might occur through operations on common partitions or partition
tables.  As such, prevent multiple copies of GParted from running
at the same time.
2013-06-13 21:21:29 +01:00
Curtis Gedak 4c109df9b5 Use systemctl runtime mask to prevent automounting (#701676)
With the beta release of Fedora 19, invoking gparted appears to
automatically mount partitions.  The systemd daemon appears to be
performing the automounting.  Hence use systemctl runtime mask to
prevent this automounting from occurring.

Bug #701676 - gparted doesn't inhibit systemd mounting, leading to
              potential data loss
2013-06-13 21:21:29 +01:00
Curtis Gedak e66a6525f2 Add GPLv2+ license to gparted.in script source file
Note the license text of this file differs slightly from the C++
source code license text to indicate this file is a part of GParted.

See:  https://www.gnu.org/licenses/gpl-howto.html

    For programs that are more than one file, it is better to replace
    “this program” with the name of the program, and begin the
    statement with a line saying “This file is part of NAME”.
2013-05-28 20:53:04 +01:00
Curtis Gedak caa7656829 Ensure graphical error message displayed when run by non-root user
Ubuntu launchpad bug 696937 - Running gparted as non-root user
                              displays no graphical error message
https://bugs.launchpad.net/ubuntu/+source/gparted/+bug/696937
2011-02-27 11:41:40 -07:00
Curtis Gedak 280f532f4a Re-word comment for gparted invocation using udisks and hal-lock 2010-07-21 10:37:58 -06:00
Curtis Gedak f242ccba46 If available use both udisks and hal-lock to prevent auto-mounting 2010-07-21 10:32:06 -06:00
Curtis Gedak 4168794e8e Handle devkit-disks being renamed to udisks on Dec. 1, 2009.
Reference link for devkit-disks being renamed to udisks:
http://www.freedesktop.org/wiki/Software/DeviceKit-disks
2010-06-01 17:04:39 -06:00
Curtis Gedak d9b892a73f Use both devkit-disks and hal-lock if available
During the transition period from HAL to devicekit-disks some
distributions might require both methods to prevent device
auto-mounting.  See Ubuntu launchpad bug link:
https://bugs.launchpad.net/ubuntu/+source/gparted/+bug/428133
2009-10-16 10:57:03 -06:00
Curtis Gedak b1667d4f6d Add support for devicekit-disks device automount prevention 2009-10-15 10:32:29 -06:00
Curtis Gedak c1a51f1402 Fixed typo of "freedeskdesktop" in hal-lock name.
svn path=/trunk/; revision=1063
2009-02-11 22:08:30 +00:00
Curtis Gedak 51a2d0999d Added additional check for hald daemon if hal-lock exists
svn path=/trunk/; revision=874
2008-07-27 15:31:34 +00:00
Curtis Gedak a75a70a9a2 Removed absolute requirement for hal-lock. GParted will now work on systems with or without hal-lock
svn path=/trunk/; revision=849
2008-05-10 15:34:39 +00:00
Curtis Gedak 85191346b3 Fixed problem with command line devices being ignored
svn path=/trunk/; revision=846
2008-05-06 22:54:43 +00:00
Curtis Gedak 605e1f4cdc Fixed bug #324220 with the following changes:
- Removed gparted-disable-automount.fdi handling.
- Renamed gparted binary to gpartedbin to permit a calling script to be named gparted.
- Added new calling script gparted.in to permit using hal-lock to acuiqre device locks to prevent automounting while executing gpartedbin.
- Renamed gparted.desktop.in to gparted.desktop.in.in to permit parsing installdir.

svn path=/trunk/; revision=826
2008-04-21 15:22:00 +00:00