Fixing Ubuntu to allow running gparted to format/configure disks

By: ( +David Herron; Date: January 28, 2018

Tags: Ubuntu

Ubuntu is supposed to be a well-tested easy-to-use Linux, so when I wanted to run gparted to format a new drive it was frustrating I had to jump so many hoops to launch the program. Fixing the problem of launching gparted on Ubuntu turned out to be easy, but difficult to first determine what went wrong and the fix.

I was setting up a new Ubuntu system, and had two drives to configure. The Ubuntu installer seems to be capable of formatting/partitioning two drives during system setup, but that section of the installer is extremely confusing.

The system is an Intel NUC where I installed a 128GB M.2 SSD and a 2.5" laptop spinning drive (HDD). In the Ubuntu installer I installed Ubuntu to the SSD, and that set up a small partition on the HDD for /boot/efi. That left a lot of unformatted unallocated space on the HDD, which I wanted to format for the /home partition.

I could have done this to format that partition:

$ sudo fdisk /dev/sda

But that program is user hostile meaning the user interface is obtruse. I thought surely there must be a simple way to attach a drive, format it, add it to the fstab and get on with things. I'm coming from almost 20 years using Mac OS X, and the Disk Utility is a wonderful piece of software.

The recommendation on Ubuntu is using gparted. Once I got it launched, I agree it is very good (though isn't so helpful for setting up LVM configurations). The problem was getting it running in the first place.

One must first install gparted because it isn't installed out of the box. That's just a matter of

$ sudo apt-get install gparted

Once installed there's a desktop icon - for the default Ubuntu user experience, click on that button in the lower-left corner with the grid of dots. That button opens the desktop application launcher listing all the applications. You can scroll through that to find gparted, or else enter gparted in the search box. Once you find the icon, you double-click ... and then find that nothing happens.

Very disappointing.

An error dialog did come up - unable to copy the users Xauthorization file

Running at the command line, I got this:

$ gksudo gparted
Error copying '/home/david/.Xauthority' to '/tmp/libgksu-AGXt21': No such file or directory.

That's a little more precise of an error message. The thing is, there was no .Xauthority file in my home directory. Would it have killed the Ubuntu team to initialize an empty file?

In any case, the application is properly telling me that it cannot copy that file, because the file does not exist. Maybe the application could have been written to initialize an empty file in that case?

$ touch .Xauthority

That's a simple workaround - but shouldn't the system be programmed to automatically do such things?

Once I did that, the output from gksudo gparted was more promising, except it told me cannot open display: 0.0.

That message means an X11 program was not able to open X11 display 0.0. There's a number of possible reasons, and a bit of DuckDuckGo searching came up with this note: ( which referred to this thread:

The bottom line is this note:

The method pkexec uses to grant root (i.e. the user it runs its argument as) access to the real user's X display doesn't work under Wayland, but still using X (i.e. using Xwayland). Xwayland (at least as started by mutter/gnome-shell) is started without the "-auth" option and hence only grants access to the real user (adopting Wayland's security model). Hence there's no Xauthority file to grant access to other users. The workaround is to explicitly allow root to access the user's X display using

This suggestion did the trick:

$ xhost +si:localuser:root

This configures the root user on localhost to be able to open connections to the X11 display. One wonders why Ubuntu did not do this out of the box.

Bottom line is that those two steps - creating an Xauthority file - running xhost to allow root@localhost - together make it possible to start gparted on Ubuntu. I was then able to format my disk. Getting it mounted as /home was another adventure, however.

« Fixing Ubuntu gnome-terminal app to allow copy/paste Google possibly dooms YouTube by explicitly cancelling monetization for channels with low viewership »
2016 Election Acer C720 Ad block AkashaCMS Amazon Amazon Kindle America Amiga Android Anti-Fascism AntiVirus Software Apple Apple Hardware History Apple iPhone Apple iPhone Hardware April 1st Arduino ARM Compilation Astronomy Asynchronous Programming Authoritarianism Automated Social Posting Ayo.JS Bells Law Big Brother Big Finish Bitcoin Mining Black Holes Blade Runner Blockchain Blogger Blogging Books Botnet Botnets Cassette Tapes Cellphones Christopher Eccleston Chrome Chrome Apps Chromebook Chromebooks Chromebox ChromeOS CIA CitiCards Citizen Journalism Civil Liberties Clinton Cluster Computing Command Line Tools Comment Systems Computer Hardware Computer Repair Computers Cross Compilation Crouton Cryptocurrency Curiosity Rover Currencies Cyber Security Cybermen Daleks Darth Vader Data backup Data Storage Database Database Backup Databases David Tenant DDoS Botnet Detect Adblocker Developers Editors Digital Photography Diskless Booting Disqus DIY DIY Repair DNP3 Do it yourself Docker Docker MAMP Docker Swarm Doctor Who Doctor Who Paradox Drobo Drupal Drupal Themes DVD E-Books E-Readers Early Computers Election Hacks Electric Bicycles Electric Vehicles Electron Emdebian Encabulators Energy Efficiency Enterprise Node EPUB ESP8266 Ethical Curation Eurovision Event Driven Asynchronous Express Facebook Fake News Fedora VirtualBox File transfer without iTunes FireFly Fraud Freedom of Speech Gallifrey git GitKraken Gitlab GMAIL Google Google Chrome Google Gnome Google+ Government Spying Great Britain Heat Loss Hibernate Hoax Science Home Automation HTTP Security HTTPS Human ID I2C Protocol Image Analysis Image Conversion Image Processing ImageMagick In-memory Computing InfluxDB Infrared Thermometers Insulation Internet Internet Advertising Internet Law Internet of Things Internet Policy Internet Privacy iOS Devices iPad iPhone iPhone hacking Iron Man Iternet of Things iTunes Java JavaScript JavaScript Injection JDBC John Simms Journalism Joyent Kaspersky Labs Kindle Kindle Marketplace Lets Encrypt LibreOffice Linux Linux Hints Linux Single Board Computers Logging Mac OS Mac OS X Machine Readable ID macOS MacOS X setup Make Money Online MariaDB Mars Matt Lucas MEADS Anti-Missile Mercurial Michele Gomez Micro Apartments Military Hardware Minification Minimized CSS Minimized HTML Minimized JavaScript Missy Mobile Applications MODBUS Mondas Monetary System MongoDB Mongoose Monty Python MQTT Music Player Music Streaming MySQL NanoPi Nardole NASA Net Neutrality Node Web Development Node.js Node.js Database Node.js Testing Node.JS Web Development Node.x North Korea npm NY Times Online advertising Online Community Online Fraud Online Journalism Online Video Open Media Vault Open Source Governance Open Source Licenses Open Source Software OpenAPI OpenVPN Paywalls Personal Flight Peter Capaldi Photography PHP Plex Plex Media Server Political Protest Postal Service Power Control Privacy Production use Public Violence Raspberry Pi Raspberry Pi 3 Raspberry Pi Zero Recycling Refurbished Computers Remote Desktop Republicans Retro Computing Retro-Technology Reviews Right to Repair River Song Robotics Rocket Ships RSS News Readers rsync Russia Russia Troll Factory Russian Hacking SCADA Scheme Science Fiction Search Engine Ranking Season 1 Season 10 Season 11 Security Security Cameras Server-side JavaScript Shell Scripts Silence Simsimi Skype Social Media Social Media Warfare Social Networks Software Development Space Flight Space Ship Reuse Space Ships SpaceX Spear Phishing Spring Spring Boot SQLite3 SSD Drives SSD upgrade SSH SSH Key SSL Swagger Synchronizing Files Telescopes Terrorism The Cybermen The Daleks The Master Time-Series Database Torchwood Total Information Awareness Trump Trump Administration Trump Campaign Ubuntu Udemy UDOO Virtual Private Networks VirtualBox VLC VNC VOIP Web Applications Web Developer Resources Web Development Web Development Tools Web Marketing Website Advertising Weeping Angels WhatsApp Window Insulation Windows Windows Alternatives Wordpress World Wide Web YouTube YouTube Monetization