デスクトップを Ubuntu 21.04 から 21.10 にアップグレードしました。すべて正常に動作しています。満足です。
しかしその後、グラフィカル ログイン画面の背景を別の画像に変更する間違ったプログラムを実行します。
おそらく私が実行するスクリプト: 21.04 中に次のプログラムをダウンロードし、インストールして実行しました。
github.com/thiggy01/gdm-background
gdm-background/gdm-background-helper /
#!/usr/bin/env python3
import distro
import dbus
import dbus.service
from dbus.mainloop.glib import DBusGMainLoop
from gi.repository import GLib
import shutil
from subprocess import call
class GDMBackground(dbus.service.Object):
if distro.id() == 'ubuntu':
default_theme = '/usr/share/gnome-shell/theme/Yaru/gnome-shell-theme.gresource'
elif distro.id() == 'pop':
default_theme = '/usr/share/gnome-shell/theme/Pop/gnome-shell-theme.gresource'
backup_theme = default_theme + '~'
def __init__(self, conn=None, object_path=None, bus_name=None):
dbus.service.Object.__init__(self, conn, object_path, bus_name)
@dbus.service.method('xyz.thiggy01.GDMBackground', in_signature='s', out_signature='b',
sender_keyword='sender', connection_keyword='conn')
def SetImage(self, task, sender=None, conn=None):
action_id = 'xyz.thiggy01.GDMBackground.SetImage'
if self._check_polkit_privilege(sender, conn, action_id):
if task == 'backup':
shutil.copy(self.default_theme, self.backup_theme)
elif task == 'set':
shutil.move("/tmp/gdm3/theme/gnome-shell-theme.gresource", self.default_theme)
return True
else:
return False
@dbus.service.method('xyz.thiggy01.GDMBackground', in_signature='s', out_signature='b',
sender_keyword='sender', connection_keyword='conn')
def RestoreBackup(self, task, sender=None, conn=None):
action_id = 'xyz.thiggy01.GDMBackground.RestoreBackup'
if self._check_polkit_privilege(sender, conn, action_id):
if task == 'restore':
shutil.move(self.backup_theme, self.default_theme)
return True
else:
return False
@dbus.service.method('xyz.thiggy01.GDMBackground', in_signature='s', out_signature='',
sender_keyword='sender', connection_keyword='conn')
def RestartGDM(self, action_id, sender=None, conn=None):
if self._check_polkit_privilege(sender, conn, action_id):
call(['/usr/sbin/service', 'gdm', 'restart'])
def _check_polkit_privilege(self, sender, conn, action_id):
if sender is None and conn is None:
return
self.proxy_dbus = dbus.Interface(conn.get_object('org.freedesktop.DBus',
'/org/freedesktop/DBus/Bus', False), 'org.freedesktop.DBus')
sender_pid = self.proxy_dbus.GetConnectionUnixProcessID(sender)
self.proxy_polkit = dbus.Interface(dbus.SystemBus().get_object(
'org.freedesktop.PolicyKit1', '/org/freedesktop/PolicyKit1/Authority', False),
'org.freedesktop.PolicyKit1.Authority')
try:
(is_auth, is_challenge, details) = self.proxy_polkit.CheckAuthorization(
('unix-process', {'pid': dbus.UInt32(sender_pid, variant_level=1),
'start-time': dbus.UInt64(0, variant_level=1)}),
action_id, {'':''}, dbus.UInt32(1), 'cancel')
if is_auth:
return True
else:
return False
except dbus.DBusException as error:
self.proxy_polkit.CancelCheckAuthorization('cancel')
raise
if __name__ == '__main__':
DBusGMainLoop(set_as_default=True)
bus = dbus.SystemBus()
name = dbus.service.BusName('xyz.thiggy01.GDMBackground', bus)
gdm_background_helper = GDMBackground(name, '/xyz/thiggy01/GDMBackground')
GLib.MainLoop().run()
その後、Ubuntu 21.10 はグラフィカル ログイン画面を読み込むことができなくなります。
画面にエラーがあります: モニターに「ああ、大変! 問題が発生しました」というメッセージが表示され、SAD の顔が表示されます。問題が発生したため、システムを回復できません。システム管理者に問い合わせてください。
リカバリモードを使用して Ubuntu 21.10 を実行し、問題のトラブルシューティングを試みます。次に、ルートに移動して次のコマンドを使用します。
sudo apt install ubuntu-gnome-desktop
systemctl status gdm
systemctl start gdm
全然機能しません。
実行しているプログラム/スクリプトが、Ubuntu 21.04 の GNOME 40 の設定と競合しているのではないかと思います。元の GUI ログイン画面の設定に戻す方法を教えていただけますか。
CTRL-SHIFT-F3 を使用して Ubuntu 21.04 にログインしようとします。次に、次のように入力します。
systemctl status gdm3
gdm.service is active (running)
Starting GNOME Display Manager.....
しかし、エラーメッセージが表示されます:
Gdm: GdmDisplay: Session never registered, failing
Gdm: Child process -2037 was already dead.
答え1
私も同じ問題を抱えていました。まず、リカバリ ルート コンソールにアクセスする必要があります。起動中に左 Shift キーまたは Esc キーを押すと、それが実行できるはずです。https://wiki.ubuntu.com/リカバリモード
何が十分か
lightdm をインストールしましたが、lightdm をインストールして gdm3 に戻す必要があるかどうかわかりません。次の方法が機能するかもしれません:
sudo apt reinstall gdm3 gnome-shell yaru-theme-gnome-shell
sudo service gdm3 restart
私がしたこと
まず、元のファイルを戻すために復元オプションを実行しました。効果はありませんでした。投稿された Python コードではなく、--restore フラグ付きの別のスクリプトを使用しました。どちらも次のように動作するようです。
mv /usr/share/gnome-shell/theme/Yaru/gnome-shell-theme.gresource~ \
/usr/share/gnome-shell/theme/Yaru/gnome-shell-theme.gresource
次にlightdmをインストールしました。
# Should install then show UI to switch from gdm3 to lightdm
sudo apt install lightdm
再起動して動作しましたが、Gnome に再度ログインすると UI に不具合がありました。たとえば、Super キーを押すとアプリの検索ボックスが表示されますが、アイコンはフレームバッファの問題のように重なってちらつきます。また、lightdm の左下隅に Ubuntu バージョン 21.04 が表示されました。まだ 21.10 では lightdm + gnome が適切にサポートされていないと思います。
最後に、gdm3、gnome-shell、yaru テーマを再インストールし、lightdm から gdm に戻しました。
sudo apt reinstall gdm3 gnome-shell yaru-theme-gnome-shell
# Switch back to gdm3
sudo dpkg-reconfigure gdm3
再起動するとすべてが再び機能するようになりましたが、gdm3 のデフォルトの背景画像はそのままです。背景画像を変更するにはハッキングが必要なので非常に面倒ですが、これで解決しました。