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.

« How to set-up a multi-drive SSD/HDD Ubuntu desktop system Fixing Ubuntu gnome-terminal app to allow copy/paste »
2016 Election 2018 Elections Acer C720 Ad block Air Filters Air Quality Air Quality Monitoring AkashaCMS Amazon Amazon Kindle Amazon Web Services America Amiga and Jon Pertwee Android Anti-Fascism AntiVirus Software Apple Apple Hardware History Apple iPhone Apple iPhone Hardware April 1st Arduino ARM Compilation Artificial Intelligence Astronomy Astrophotography Asynchronous Programming Authoritarianism Automated Social Posting AWS DynamoDB AWS Lambda Ayo.JS Bells Law Big Brother Big Data Big Finish Big Science Bitcoin Mining Black Holes Blade Runner Blockchain Blogger Blogging Books Botnets Cassette Tapes Cellphones China China Manufacturing Christopher Eccleston Chrome Chrome Apps Chromebook Chromebox ChromeOS CIA CitiCards Citizen Journalism Civil Liberties Climate Change Clinton Cluster Computing Command Line Tools Comment Systems Computer Accessories Computer Hardware Computer Repair Computers Conservatives Cross Compilation Crouton Cryptocurrency Curiosity Rover Currencies Cyber Security Cybermen Cybersecurity Daleks Darth Vader Data backup Data Formats Data Storage Database Database Backup Databases David Tenant DDoS Botnet Department of Defense Department of Justice Detect Adblocker Developers Editors Digital Nomad Digital Photography Diskless Booting Disqus DIY DIY Repair DNP3 Do it yourself Docker Docker MAMP Docker Swarm Doctor Who Doctor Who Paradox Doctor Who Review Drobo Drupal Drupal Themes DVD E-Books E-Readers Early Computers eGPU Election Hacks Electric Bicycles Electric Vehicles Electron Eliminating Jobs for Human Emdebian Encabulators Energy Efficiency Enterprise Node EPUB ESP8266 Ethical Curation Eurovision Event Driven Asynchronous Express Face Recognition Facebook Fake News Fedora VirtualBox Fifth Doctor File transfer without iTunes FireFly Flash Flickr Fraud Freedom of Speech Front-end Development G Suite Gallifrey Gig Economy git Github GitKraken Gitlab GMAIL Google Google Chrome Google Gnome Google+ Government Spying Great Britain Green Transportation Hate Speech Heat Loss Hibernate High Technology 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 iOS Devices iPad iPhone iPhone hacking Iron Man iShowU Audio Capture iTunes Janet Fielding Java JavaFX JavaScript JavaScript Injection JDBC John Simms Journalism Joyent Kaspersky Labs Kext Kindle Kindle Marketplace Large Hadron Collider Lets Encrypt LibreOffice Linux Linux Hints Linux Single Board Computers Logging Mac Mini Mac OS Mac OS X MacBook Pro Machine Learning Machine Readable ID Macintosh macOS macOS High Sierra macOS Kext MacOS X setup Make Money Online Make Money with Gigs March For Our Lives MariaDB Mars Mass Violence Matt Lucas MEADS Anti-Missile Mercurial MERN Stack Michele Gomez Micro Apartments Microsoft Military AI Military Hardware Minification Minimized CSS Minimized HTML Minimized JavaScript Missy Mobile Applications Mobile Computers MODBUS Mondas Monetary System MongoDB Mongoose Monty Python MQTT Music Player Music Streaming MySQL NanoPi Nardole NASA Net Neutrality Network Attached Storage Node Web Development Node.js Node.js Database Node.js Performance Node.js Testing Node.JS Web Development Node.x North Korea npm NVIDIA NY Times Online advertising Online Community Online Fraud Online Journalism Online Photography Online Video Open Media Vault Open Source Open Source and Patents Open Source Governance Open Source Licenses Open Source Software OpenAPI OpenJDK OpenVPN Palmtop PDA Patrick Troughton PayPal Paywalls Personal Flight Peter Capaldi Peter Davison Phishing Photography PHP Plex Plex Media Server Political Protest Politics Postal Service Power Control President Trump Privacy Private E-mail server Production use Public Violence Raspberry Pi Raspberry Pi 3 Raspberry Pi Zero ReactJS Recaptcha Recycling Refurbished Computers Remote Desktop Removable Storage Republicans Retro Computing Retro-Technology Reviews RFID Rich Internet Applications Right to Repair River Song Robotics Robots Rocket Ships RSS News Readers rsync Russia Russia Troll Factory Russian Hacking Rust SCADA Scheme Science Fiction SD Cards Search Engine Ranking Season 1 Season 10 Season 11 Security Security Cameras Server-side JavaScript Serverless Framework Servers Shell Scripts Silence Simsimi Skype SmugMug Social Media Social Media Networks Social Media Warfare Social Network Management Social Networks Software Development Software Patents Space Flight Space Ship Reuse Space Ships SpaceX Spear Phishing Spring Spring Boot Spy Satellites SQLite3 SSD Drives SSD upgrade SSH SSH Key SSL Stand For Truth Strange Parts Swagger Synchronizing Files Tegan Jovanka Telescopes Terrorism The Cybermen The Daleks The Master Time-Series Database Tom Baker Torchwood Total Information Awareness Trump Trump Administration Trump Campaign Twitter Ubuntu Udemy UDOO US Department of Defense Video editing Virtual Private Networks VirtualBox VLC VNC VOIP Vue.js Walmart Weapons Systems Web Applications Web Developer Resources Web Development Web Development Tools Web Marketing Webpack Website Advertising Weeping Angels WhatsApp William Hartnell Window Insulation Windows Windows Alternatives Wordpress World Wide Web Yahoo YouTube YouTube Monetization