en lançant gparted sous root, (avec ou sans un argument /dev/xxx ) j’obtiens un échec avec le message suivant (et via le menu mate, aucun effet visible).
# gparted
Unit tmp.mount does not exist, proceeding anyway.
(gpartedbin:3890): Gtk-WARNING **: 14:41:01.196: cannot open display:
Je voudrais ré-attribuer une carte SD (actuellement appareil photos), auto-montée ainsi : /dev/mmcblk0p1 on /media/laguilde/LUMIX type fuseblk rw,nosuid,nodev,relatime,user_id=0,group_id=0,default_permissions,allow_other,blksize=4096,uhelper=udisks2), la partionner en ext4 ou xfs, et y copier une image «partclone» du système.
L’élément bloquant n’est pas tmp.mount puisqu’il est écrit « proceeding anyway » (je continue quand même) mais « cannot open display ». Ça vient de la façon de lancer une application graphique en tant que root, mais je ne connais pas plus que ça.
Si tu veux reformater une carte SD, il suffit de la démonter et de la formater.
umount /dev/mmcblk0p1 # démontage
mkfs.ext4 /dev/mmcblk0p1 # formatage en ext4
mkfs.xfs /dev/mmcblk0p1 # formatage en XFS
je suis bien d’accord; si j’ai fait cet essai c’est que, lancé sous l’utilisateur, il échoue.
J’aurais effectivement du commencer ma question par là:
$gparted
localuser:root being added to access control list
Error executing command as another user: No authentication agent found.
localuser:root being removed from access control list
[1]- Fini xpdf -g 1920x1080 texlive/TexLivemgr.pdf (wd : /jessie/aide-memoire/LaTeX_et_PDF)
(maintenant, wd : /usr/local/texlive/texmf-local)
[2]+ Fini xpdf -g 1920x1080 ./texmf-dist/doc/latex/tlmgrbasics/tlmgr.pdf
Ci-dessous, un extrait du script /usr/sbin/gparted
…
#
# Interim workaround to allow GParted run by root access to the
# X11 display server under Wayland. If configured with
# './configure --enable-xhost-root', the xhost command is
# available and root has not been granted access to the X11
# display via xhost, then grant access.
#
ENABLE_XHOST_ROOT=no
GRANTED_XHOST_ROOT=no
if test "x$ENABLE_XHOST_ROOT" = 'xyes' && xhost 1> /dev/null 2>&1; then
if ! xhost | grep -qi 'SI:localuser:root$'; then
xhost +SI:localuser:root
GRANTED_XHOST_ROOT=yes
fi
fi
#
# Run gparted as root.
#
pkexec --disable-internal-agent '/usr/sbin/gparted' "$@"
status=$?
#
# Revoke root access to the X11 display, only if we granted it.
#
if test "x$GRANTED_XHOST_ROOT" = 'xyes'; then
xhost -SI:localuser:root
fi
…
Dans lequel on peut voir comment, avec la commande xhost
le compte root peut accéder à l’écran d’un autre compte utilisateur.
Si oui alors utilise sudo pour le lancer, comme n’importe quel application graphique on ne les ouvrent pas en tant que root, mais il devrait y avoir à minima une fenêtre de demande d’autorisation qui s’ouvre lorsque tu le lance en tant que user … du coup je pense que ton installation est pas optimale pour ton utilisation.
Regarde si ce paquet est installé dès fois que : policykit-1-gnome
En résumé, suivant l’extrait du script que j’ai donné dans mon précédent message,
la suite des lignes de commandes,
à lancer depuis le compte root dans un émulateur de terminal de l’interface graphique,
qui vont permettre à gparted d’afficher sa fenêtre
xhost +SI:localuser:root # qui va permettre aux applications lancées par le compte root d'avoir accès au serveur X.
gparted # qui va lancer l'application graphique gparted
xhost -SI:localuser:root # qui va remettre les autorisation d'accès à leur valeur d'origine
Avec ça, vous n’aurez plus le message d’erreur signalant que : cannot open display:
Logiquement, c’est le script /usr/sbin/gparted qui devrait faire ça,
mais ces lignes de commandes n’ont pas été exécutées parce que josephtux a lancé gparted depuis le compte root et que ces lignes de commande sont dans un test if :
if test "x`id -u`" != "x0"; then
…
Gparted aurait pu être lancé depuis une fenêtre d’émulateur de terminal d’un environnement de bureau depuis un compte utilisateur non privilégié, mais en spécifiant le chemin absolu du script :
/usr/sbin/gparted
pkexec aurait ouvert la fenêtre demandant le mot de passe permettant l’accès aux privilèges du compte root, puis la fenêtre de gparted se serait ouverte,
et une fois la fenêtre de gparted fermée, voilà ce qu’il serait resté affiché dans la fenêtre de terminal :
michel@debvirt:~$ /usr/sbin/gparted
localuser:root being added to access control list
Unit tmp.mount does not exist, proceeding anyway.
======================
libparted : 3.2
======================
localuser:root being removed from access control list
michel@debvirt:~$
De toutes façons, deux des lignes de commandes proposées dans le message de PascalHambourg permettront de faire ce formatage de façon beaucoup plus simple.
C’est parce que SI est écrit en lettres minuscules dans la page man de xhost
Sur mon système, je lance la commande xhost sans lui donner de paramètres
michel@debvirt:~$ xhost
access control enabled, only authorized clients can connect
SI:localuser:michel
michel@debvirt:~$
man xhost
…
OPTIONS
…
[+]name The given name (the plus sign is optional) is added to the list allowed to connect to the X server.
The name can be a host name or a complete name (See NAMES for more details).
-name The given name is removed from the list of allowed to connect to the server.
The name can be a host name or a complete name (See NAMES for more details).
Existing connections are not broken, but new connection attempts will be denied.
Note that the current machine is allowed to be removed;
however, further connections (including attempts to add it back) will not be permitted.
Resetting the server (thereby breaking all connections) is the only way to allow local connections again.
...
NAMES
A complete name has the syntax ``family:name'' where the families are as follows:
...
si Server Interpreted
...
The local family specifies all the local connections at once.
However, the server interpreted address "si:localuser:username" can be used to specify a single local user.
(See the Xsecurity(7) manual page for more details.)
man Xsecurity
…
SERVER INTERPRETED ACCESS TYPES
…
localuser Local connection user id
…
Donc :
xhost +SI:localuser:root
Va donner au compte utilisateur root local l’accès au serveur X courant.
(Le serveur X courant est celui qui est indiqué dans la variable DISPLAY)
xhost -SI:localuser:root
Va interdire au compte utilisateur root local l’accès au serveur X courant.
Et dans ce cas, si tu lances depuis le compte root une application qui tenterait d’accéder au serveur X courant, un message d’erreur sera retourné, indiquant :
Oui, j’avais moi aussi cherché pendant un bon moment avant de comprendre,
et je pense qu’il s’agit d’une erreur dans la page man de l’avoir écrit en minuscule,
vu que la commande xhost retourne SI en majuscule,
(même si on peut aussi le spécifier en minuscule dans une ligne de commande.)
Oui, localuser est le type d’entrée
comme c’est spécifié dans le chapitre SERVER INTERPRETED ACCESS TYPES
de la page man de Xsecurity :
…
ACCESS SYSTEM DESCRIPTIONS
…
Server Interpreted
The Server Interpreted method provides two strings to the X server for entry in the access control list.
The first string represents the type of entry, and the second string contains the value of the entry.
These strings are interpreted by the server and different implementations and builds may support different types of entries.
The types supported in the sample implementation are defined in the SERVER INTERPRETED ACCESS TYPES section below.
Entries of this type can be manipulated via xhost.
For example to add a Server Interpreted entry of type localuser with a value of root, the command is xhost +si:localuser:root
…
SERVER INTERPRETED ACCESS TYPES
The sample implementation includes several Server Interpreted mechanisms:
IPv6 IPv6 literal addresses
hostname Network host name
localuser Local connection user id
localgroup Local connection group id
…
@Clochette
gparted ne renvoie pour le moment que l’erreur signalée plus haut:
$gparted
localuser:root being added to access control list
Error executing command as another user: No authentication agent found.
localuser:root being removed from access control list
Je reprendrais cette question un plus tard car je suis trop occupé par d’autres questions urgentes.