Any Pro Tips for zypper dup?

I’m wondering what the best practices are for running zypper dup. I’ve seen some recommend only running it with the screen command, with -vv, and/or not run it in Konsole.

What is the safest way to zypper dup?

Thanks in advance!

Here’s a recent discussion about this very thing:

Thank you!
This is probably a dumb question, but do I need to detach the process in the screen command to get the failsafe effect, or can I watch it run?

You can watch it run.

I typically use:

screen -L

for my “zypper dup”. With the “-L” option, it leaves a log of the session in “screenlog.0”.

If the GUI crashes, then I go to a terminal and do:

tail -f screenlog.0

That way, I can see if it is still running or has finished.

2 Likes

As @nrickert said, you can watch it run. The reason I use it (or tmux, which I’m learning to see if I like it better) is that in the event that the GUI shuts down for some reason but the system keeps running, the update will continue to run, and I can reattach to the session if that happens - even from a remote system if things appear to be completely seized up at the desktop itself.

1 Like

Out of curiosity I tried screen under GNOME and KDE and in both cases logging out of GUI kills screen. I did not test “crashing” GUI.

I just tested this on TW - I ran screen and left it running, logged out and back in, and then started a terminal and ran screen -r -d to reconnect - the session was still there, and it was prompting me to continue the zypper dup that I had started.

Seems to work fine here - it didn’t kill the session, as I expected.

Which desktop?

bor@tw:~> screen -ls
There is a screen on:
	3151.pts-0.tw	(Dead ???)
Remove dead screens with 'screen -wipe'.
1 Socket in /run/uscreens/S-bor.
bor@tw:~> screen -r -d
There is a screen on:
	3151.pts-0.tw	(Dead ???)
Remove dead screens with 'screen -wipe'.
There is no screen to be detached.
bor@tw:~> 

There is no custom systemd-logind configuration.

I tested on GNOME, and I tested both screen and tmux. Both behaved as I have previously experienced and expected - I logged out and back in and was able to reattach to both programs.

I also have no custom systemd-logind configuration. The system I tested on is a barebones install that I use for testing (runs in VMware).

Do you use gnome-terminal?

Yes, that’s the terminal I use.

Can you show systemd-cgls with screen running?

CGroup /:
-.slice
├─user.slice
│ └─user-1000.slice
│   ├─user@1000.service …
│   │ ├─session.slice
│   │ │ ├─gvfs-goa-volume-monitor.service
│   │ │ │ └─2168 /usr/libexec/gvfs/gvfs-goa-volume-monitor
│   │ │ ├─org.gnome.SettingsDaemon.MediaKeys.service
│   │ │ │ └─1960 /usr/libexec/gsd-media-keys
│   │ │ ├─org.gnome.SettingsDaemon.Smartcard.service
│   │ │ │ └─1993 /usr/libexec/gsd-smartcard
│   │ │ ├─xdg-permission-store.service
│   │ │ │ └─1904 /usr/libexec/xdg-permission-store
│   │ │ ├─org.gnome.SettingsDaemon.Datetime.service
│   │ │ │ └─1943 /usr/libexec/gsd-datetime
│   │ │ ├─xdg-document-portal.service
│   │ │ │ ├─2285 /usr/libexec/xdg-document-portal
│   │ │ │ └─2295 fusermount3 -o rw,nosuid,nodev,fsname=portal,auto_unmount,subt…
│   │ │ ├─org.gnome.SettingsDaemon.Housekeeping.service
│   │ │ │ └─1945 /usr/libexec/gsd-housekeeping
│   │ │ ├─xdg-desktop-portal.service
│   │ │ │ └─2275 /usr/libexec/xdg-desktop-portal
│   │ │ ├─org.gnome.SettingsDaemon.Keyboard.service
│   │ │ │ └─1946 /usr/libexec/gsd-keyboard
│   │ │ ├─org.gnome.SettingsDaemon.A11ySettings.service
│   │ │ │ └─1934 /usr/libexec/gsd-a11y-settings
│   │ │ ├─wireplumber.service
│   │ │ │ └─2244 /usr/bin/wireplumber
│   │ │ ├─pulseaudio.service
│   │ │ │ ├─2245 /usr/bin/pulseaudio --daemonize=no --log-target=journal
│   │ │ │ └─2279 /usr/libexec/pulse/gsettings-helper
│   │ │ ├─org.gnome.SettingsDaemon.Wacom.service
│   │ │ │ └─2018 /usr/libexec/gsd-wacom
│   │ │ ├─gvfs-daemon.service
│   │ │ │ ├─1826 /usr/libexec/gvfs/gvfsd
│   │ │ │ └─1832 /usr/libexec/gvfs/gvfsd-fuse /run/user/1000/gvfs -f
│   │ │ ├─gvfs-udisks2-volume-monitor.service
│   │ │ │ └─2162 /usr/libexec/gvfs/gvfs-udisks2-volume-monitor
│   │ │ ├─org.gnome.SettingsDaemon.Sharing.service
│   │ │ │ └─1982 /usr/libexec/gsd-sharing
│   │ │ ├─org.gnome.SettingsDaemon.Color.service
│   │ │ │ └─1941 /usr/libexec/gsd-color
│   │ │ ├─org.gnome.SettingsDaemon.ScreensaverProxy.service
│   │ │ │ └─1974 /usr/libexec/gsd-screensaver-proxy
│   │ │ ├─org.gnome.SettingsDaemon.PrintNotifications.service
│   │ │ │ ├─1965 /usr/libexec/gsd-print-notifications
│   │ │ │ └─2198 /usr/libexec/gsd-printer
│   │ │ ├─org.gnome.SettingsDaemon.Power.service
│   │ │ │ └─1962 /usr/libexec/gsd-power
│   │ │ ├─org.gnome.Shell@wayland.service
│   │ │ │ ├─1804 /usr/bin/gnome-shell
│   │ │ │ ├─2153 /usr/bin/Xwayland :0 -rootless -noreset -accessx -core -auth /…
│   │ │ │ └─2359 /usr/libexec/mutter-x11-frames
│   │ │ ├─org.gnome.SettingsDaemon.XSettings.service
│   │ │ │ └─2330 /usr/libexec/gsd-xsettings
│   │ │ ├─gvfs-gphoto2-volume-monitor.service
│   │ │ │ └─2193 /usr/libexec/gvfs/gvfs-gphoto2-volume-monitor
│   │ │ ├─at-spi-dbus-bus.service
│   │ │ │ ├─1867 /usr/libexec/at-spi2/at-spi-bus-launcher
│   │ │ │ ├─1874 /usr/bin/dbus-daemon --config-file=/usr/share/defaults/at-spi2…
│   │ │ │ └─1879 /usr/libexec/at-spi2/at-spi2-registryd --use-gnome-session
│   │ │ ├─org.gnome.SettingsDaemon.UsbProtection.service
│   │ │ │ └─2012 /usr/libexec/gsd-usb-protection
│   │ │ ├─org.gnome.SettingsDaemon.Sound.service
│   │ │ │ └─1996 /usr/libexec/gsd-sound
│   │ │ ├─pipewire.service
│   │ │ │ └─2243 /usr/bin/pipewire
│   │ │ ├─dbus.service
│   │ │ │ ├─1544 /usr/bin/dbus-daemon --session --address=systemd: --nofork --n…
│   │ │ │ ├─1907 /usr/libexec/gnome-shell/gnome-shell-calendar-server
│   │ │ │ ├─1929 /usr/bin/gjs -m /usr/share/gnome-shell/org.gnome.Shell.Notific…
│   │ │ │ ├─2098 /usr/bin/gjs -m /usr/share/gnome-shell/org.gnome.ScreenSaver
│   │ │ │ ├─2113 /usr/libexec/goa-daemon
│   │ │ │ └─2141 /usr/libexec/goa-identity-service
│   │ │ ├─org.gnome.SettingsDaemon.Rfkill.service
│   │ │ │ └─1967 /usr/libexec/gsd-rfkill
│   │ │ ├─gvfs-mtp-volume-monitor.service
│   │ │ │ └─2185 /usr/libexec/gvfs/gvfs-mtp-volume-monitor
│   │ │ └─gvfs-afc-volume-monitor.service
│   │ │   └─2175 /usr/libexec/gvfs/gvfs-afc-volume-monitor
│   │ ├─app.slice
│   │ │ ├─evolution-calendar-factory.service
│   │ │ │ └─2157 /usr/libexec/evolution-data-server/evolution-calendar-factory
│   │ │ ├─xdg-desktop-portal-gnome.service
│   │ │ │ └─2309 /usr/libexec/xdg-desktop-portal-gnome
│   │ │ ├─app-gnome\x2dsession\x2dmanager.slice
│   │ │ │ └─gnome-session-manager@gnome.service
│   │ │ │   ├─1772 /usr/libexec/gnome-session-binary --systemd-service --sessio…
│   │ │ │   ├─1790 /usr/bin/gnome-keyring-daemon --start --components=ssh
│   │ │ │   └─2060 /usr/bin/vmtoolsd -n vmusr --blockFd 3 --uinputFd 4
│   │ │ ├─evolution-source-registry.service
│   │ │ │ └─1918 /usr/libexec/evolution-data-server/evolution-source-registry
│   │ │ ├─app-gnome-org.gnome.Software-1966.scope
│   │ │ │ └─1966 /usr/bin/gnome-software --gapplication-service
│   │ │ ├─app-org.gnome.Terminal.slice
│   │ │ │ ├─vte-spawn-eb064f52-2bec-40d3-9a53-e05b5f1e0fb8.scope
│   │ │ │ │ ├─2406 bash
│   │ │ │ │ ├─2430 screen
│   │ │ │ │ ├─2431 SCREEN
│   │ │ │ │ ├─2432 /bin/bash
│   │ │ │ │ └─2467 systemd-cgls
│   │ │ │ └─gnome-terminal-server.service
│   │ │ │   └─2399 /usr/libexec/gnome-terminal-server
│   │ │ ├─app-gnome-org.gnome.Evolution\x2dalarm\x2dnotify-2016.scope
│   │ │ │ └─2016 /usr/libexec/evolution-data-server/evolution-data-server/evolu…
│   │ │ ├─gnome-session-monitor.service
│   │ │ │ └─1762 /usr/libexec/gnome-session-ctl --monitor
│   │ │ ├─xdg-desktop-portal-gtk.service
│   │ │ │ └─2353 /usr/libexec/xdg-desktop-portal-gtk
│   │ │ ├─app-gnome-org.gnome.SettingsDaemon.DiskUtilityNotify-2002.scope
│   │ │ │ └─2002 /usr/libexec/gsd-disk-utility-notify
│   │ │ └─evolution-addressbook-factory.service
│   │ │   └─2186 /usr/libexec/evolution-data-server/evolution-addressbook-facto…
│   │ └─init.scope
│   │   ├─1384 /usr/lib/systemd/systemd --user
│   │   └─1388 (sd-pam)
│   └─session-1.scope
│     ├─1333 gdm-session-worker [pam/gdm-autologin]
│     ├─1528 /usr/libexec/gdm/gdm-wayland-session /usr/bin/gnome-session
│     └─1620 /usr/libexec/gnome-session-binary
├─init.scope
│ └─1 /usr/lib/systemd/systemd --switched-root --system --deserialize=48
└─system.slice
  ├─irqbalance.service
  │ └─996 /usr/sbin/irqbalance
  ├─haveged.service
  │ └─822 /usr/sbin/haveged -w 1024 -v 0 -F
  ├─systemd-udevd.service …
  │ └─udev
  │   └─652 /usr/lib/systemd/systemd-udevd
  ├─cron.service
  │ └─1734 /usr/sbin/cron -n
  ├─vgauthd.service
  │ └─1003 /usr/bin/VGAuthService -s
  ├─polkit.service
  │ └─1000 /usr/libexec/polkit-1/polkitd --no-debug
  ├─rtkit-daemon.service
  │ └─1852 /usr/libexec/rtkit/rtkit-daemon
  ├─chronyd.service
  │ └─1276 /usr/sbin/chronyd
  ├─bluetooth.service
  │ └─993 /usr/libexec/bluetooth/bluetoothd
  ├─auditd.service
  │ └─987 /sbin/auditd
  ├─accounts-daemon.service
  │ └─1278 /usr/libexec/accounts-daemon
  ├─wpa_supplicant.service
  │ └─2278 /usr/sbin/wpa_supplicant -c /etc/wpa_supplicant/wpa_supplicant.conf …
  ├─ModemManager.service
  │ └─1121 /usr/sbin/ModemManager
  ├─systemd-journald.service
  │ └─614 /usr/lib/systemd/systemd-journald
  ├─power-profiles-daemon.service
  │ └─2249 /usr/libexec/power-profiles-daemon
  ├─sshd.service
  │ └─1249 sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups
  ├─display-manager.service
  │ └─1243 /usr/sbin/gdm
  ├─fwupd.service
  │ └─2377 /usr/libexec/fwupd/fwupd
  ├─colord.service
  │ └─1880 /usr/libexec/colord
  ├─NetworkManager.service
  │ └─1185 /usr/sbin/NetworkManager --no-daemon
  ├─systemd-hostnamed.service
  │ └─1089 /usr/lib/systemd/systemd-hostnamed
  ├─firewalld.service
  │ └─1122 /usr/bin/python3 /usr/sbin/firewalld --nofork --nopid
  ├─vmtoolsd.service
  │ └─1092 /usr/bin/vmtoolsd
  ├─nscd.service
  │ └─1015 /usr/sbin/nscd
  ├─vmblock-fuse.service
  │ └─1016 /usr/bin/vmware-vmblock-fuse -o subtype=vmware-vmblock,default_permi…
  ├─postfix.service
  │ ├─1685 /usr/lib/postfix/bin//master -w
  │ ├─1688 pickup -l -t fifo -u
  │ └─1689 qmgr -l -t fifo -u
  ├─cups.service
  │ └─1205 /usr/sbin/cupsd -l
  ├─geoclue.service
  │ └─2247 /usr/libexec/geoclue
  ├─upower.service
  │ └─1930 /usr/libexec/upower/upowerd
  ├─udisks2.service
  │ └─2049 /usr/libexec/udisks2/udisksd
  ├─systemd-localed.service
  │ └─2266 /usr/lib/systemd/systemd-localed
  ├─dbus.service
  │ └─994 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile…
  ├─system-getty.slice
  │ └─getty@tty1.service
  │   └─2462 /sbin/agetty -o -p -- \u --noclear - linux
  ├─avahi-daemon.service
  │ └─992 avahi-daemon: running [linux.local]
  └─systemd-logind.service
    └─1055 /usr/lib/systemd/systemd-logind

Run from within screen itself.

Well …

Jun 25 18:59:12 tw systemd[3768]: Reached target Exit the Session.
Jun 25 18:59:12 tw systemd[1]: user@1001.service: Killing process 5010 (screen) with signal SIGKILL.
Jun 25 18:59:12 tw systemd[1]: user@1001.service: Killing process 5011 (bash) with signal SIGKILL.
Jun 25 18:59:12 tw systemd[1]: user@1001.service: Deactivated successfully.

That is something I do expect. I am really curious what happens in your case. Do you have any other session of your user active? Is lingering enabled for your user?

That system is running a stock TW installation with no customization at all. It’s a single-user environment, with no other user sessions active.

jhenderson@localhost:~> loginctl list-users
 UID USER       LINGER STATE 
1000 jhenderson no     active

1 users listed.
jhenderson@localhost:~> 

Looks like lingering is not enabled.

Which log are you looking at?

That does not show the sessions. Plain loginctl does.

journalctl -b of course.

How long did you wait before logging in again? In my experience there is some delay before systemd user instance is killed. Check before and after login - was systemd user instance restarted?

bor@tw:~> loginctl list-users
 UID USER LINGER STATE 
1001 bor  yes    active

1 users listed.
bor@tw:~> screen -ls
There is a screen on:
	6729.pts-0.tw	(Detached)
1 Socket in /run/uscreens/S-bor.
bor@tw:~> ps -fp 6729
UID        PID  PPID  C STIME TTY          TIME CMD
bor       6729  5587  0 19:13 ?        00:00:00 SCREEN
bor@tw:~> ps -fp 5587
UID        PID  PPID  C STIME TTY          TIME CMD
bor       5587     1  0 18:59 ?        00:00:00 /usr/lib/systemd/systemd --user
bor@tw:~>

screen survives because it becomes a child of systemd user instance which remains running.

It could be that I didn’t wait long enough. I did duplicate what you’re seeing by switching between Wayland (which is what that install defaulted to) to Xorg.

I should’ve been clearer - I wasn’t showing the user sessions with the loginctl list-users command, but the linger state. I was just stating that there’s only one user session, the session logged into the GUI itself.

jhenderson@localhost:~> loginctl
SESSION  UID USER       SEAT  TTY  STATE  IDLE SINCE
     11 1000 jhenderson seat0 tty2 active no   -    

1 sessions listed.

(Just for completeness and confirmation of what I was trying to say)

Leaving it for about 10 seconds confirms your results. It seems the proper way to do this is to enable linger on the user, and then use screen/tmux to execute the commands.

BTW, disabling linger and then killing the wayland session with kill -9 results in screen also being terminated.

As expected, having linger enabled for the user leaves it running (both with a regular logout and killing the wayland session with the kill command)

Please pardon my screen ignorance, but could you explain the advantage of this over reattaching the session? I’m afraid I don’t understand.

Just to summarize:

  • Enable linger (loginctl enable-linger)
  • Use screen
  • Log in as root
  • run zypper ref && zypper dup

Am I missing anything?

Also, for another dumb question: if the concern is the GUI crashing, is there any advantage to using one of the CTRL+ALT+Fx terminals rather than Konsole? Would they be immune to GUI crashes?

Thanks again everyone!