Unable to run do-release-upgrade under script(1) because of a need to clear the screen

Bug #1810216 reported by Kevin O'Gorman
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ubuntu-release-upgrader (Ubuntu)
Confirmed
Low
Unassigned

Bug Description

I like to do system updates under script(1) and have a collection of bash aliases to do these things and log the script output. Otherwise all that stuff scrolls by with no chance for me to use it later.

I just tried to update my system to 18.04, and it failed with the following output:
  Checking for a new Ubuntu release
  Get:1 Upgrade tool signature [819 B]
  Get:2 Upgrade tool [1,263 kB]
  Fetched 1,264 kB in 0s (0 B/s)
  authenticate 'bionic.tar.gz' against 'bionic.tar.gz.gpg'
  extracting 'bionic.tar.gz'
  Clear screen capability required.

This seems onerous to me. What's the point of generating output if there's no way to learn from it, refer to it, or remember it?

[Workaround]

As a workaround dropping the TERM=dumb bit does allow the upgrade to proceed and produces the typescript, albeit an ugly one:

script -c 'do-release-upgrade'

ProblemType: Bug
DistroRelease: Ubuntu 16.04
Package: ubuntu-release-upgrader-core 1:16.04.26
ProcVersionSignature: Ubuntu 4.4.0-141.167-generic 4.4.162
Uname: Linux 4.4.0-141-generic x86_64
NonfreeKernelModules: wl
ApportVersion: 2.20.1-0ubuntu2.18
Architecture: amd64
CrashDB: ubuntu
Date: Tue Jan 1 14:18:02 2019
InstallationDate: Installed on 2016-08-08 (876 days ago)
InstallationMedia: Xubuntu 16.04.1 LTS "Xenial Xerus" - Release amd64 (20160719)
PackageArchitecture: all
SourcePackage: ubuntu-release-upgrader
UpgradeStatus: Upgraded to xenial on 2019-01-01 (0 days ago)

Revision history for this message
Kevin O'Gorman (kogorman-pacbell) wrote :
Revision history for this message
Kevin O'Gorman (kogorman-pacbell) wrote :

This is still a problem upgrading to 22.04.
Grrr.

Revision history for this message
Brian Murray (brian-murray) wrote :

Could you provide some more details about how you use script to run the release upgrade process? I was able to start a release upgrade using do-release-upgrade after having started script.

Thinking about it more I think this could be an issue with screen and your screenrc file. The dist-upgrade process will try to run the upgrade inside screen and provides its own screen rc file. One way to test this would be to run 'do-release-upgrade' and then cancel the upgrade process, then switch to /tmp/ubuntu-release-upgrader-$tempname and run 'sudo ./jammy --disable-gnu-screen'. (Apparently, that argument can't be passed through from do-release-upgrade.)

Here's part of my script log where things worked:

Script started on 2022-09-13 11:27:06-07:00 [TERM="xterm-256color" TTY="/dev/pts/0" COLUMNS="80" LINES="24"]
^[]0;bdmurray@clean-focal-amd64: ~^G^[[01;32mbdmurray@clean-focal-amd64^[[00m:^[[01;34m~^[[00m$ do-release-upgrade ^M
^[[?2004l^[[?1l^[>^[[?25h^[[>4;m^[[?1049l^[[23;0;0t^[]0;bdmurray@clean-focal-amd64: ~^G^[[01;32mbdmurray@clean-focal-amd64^[[00m:^[[01;34m~^[[00m$ do-release-upgrade ^M
Checking for a new Ubuntu release^M
^M0% [Working] ^M0% [Connecting to archive.ubuntu.com] ^M0% [Connecting to archive.ubuntu.com (185.125.190.36)] ^M0% [Connected to archive.ubuntu.com (185.125.190.36)] ^M0% [Waiting for headers] ^MGet:1 Upgrade tool signature [819 B] ^M
^M0% [1 0 B/819 B 0%] ^M99% [Working] ^M99% [Waiting for headers] ^MGet:2 Upgrade tool [1,265 kB] ^M
^M0% [2 0 B/1,265 kB 0%] ^M8% [2 111 kB/1,265 kB 8%] ^M76% [2 968 kB/1,265 kB 76%] ^M100% [Working] ^MFetched 1,266 kB in 0s (0 B/s) ^M
authenticate 'jammy.tar.gz' against 'jammy.tar.gz.gpg' ^M
extracting 'jammy.tar.gz'^M
^[[!p^[[?3;4l^[[4l^[>^[[?1049h^[[22;0;0t^[[4l^[[?1h^[=^[[0m^[(B^[[1;24r^[[H^[[2J^[[23B^[[7mscreenrc: log: window required^[[27m ^H^H^M^[[31C^[[1K^[[H^[[H^[[2J
Reading cache^M

Changed in ubuntu-release-upgrader (Ubuntu):
importance: Undecided → Medium
status: New → Incomplete
Revision history for this message
Kevin O'Gorman (kogorman-pacbell) wrote : Re: [Bug 1810216] Re: Unable to run do-release-upgrade under script(1) because of a need to clear the screen
Download full text (4.8 KiB)

The way I use it is a bit complicated, but the key thing is that I set
TERM=dumb and then pipe all output from script(1) (not screen) through tee
and col so that I get readable permanent results in addition to what shows
up on my screen,.

It's particularly problematic in the few updates that actually pop up a GUI
window -- script won't even see that.

On Tue, Sep 13, 2022 at 11:45 AM Brian Murray <email address hidden>
wrote:

> Could you provide some more details about how you use script to run the
> release upgrade process? I was able to start a release upgrade using do-
> release-upgrade after having started script.
>
> Thinking about it more I think this could be an issue with screen and
> your screenrc file. The dist-upgrade process will try to run the upgrade
> inside screen and provides its own screen rc file. One way to test this
> would be to run 'do-release-upgrade' and then cancel the upgrade
> process, then switch to /tmp/ubuntu-release-upgrader-$tempname and run
> 'sudo ./jammy --disable-gnu-screen'. (Apparently, that argument can't be
> passed through from do-release-upgrade.)
>
> Here's part of my script log where things worked:
>
> Script started on 2022-09-13 11:27:06-07:00 [TERM="xterm-256color"
> TTY="/dev/pts/0" COLUMNS="80" LINES="24"]
> ^[]0;bdmurray@clean-focal-amd64: ~^G^[[01;32mbdmurray@clean-focal-amd64^[[00m:^[[01;34m~^[[00m$
> do-release-upgrade ^M
>
> ^[[?2004l^[[?1l^[>^[[?25h^[[>4;m^[[?1049l^[[23;0;0t^[]0;bdmurray@clean-focal-amd64:
> ~^G^[[01;32mbdmurray@clean-focal-amd64^[[00m:^[[01;34m~^[[00m$
> do-release-upgrade ^M
> Checking for a new Ubuntu release^M
> ^M0% [Working]
> ^M0% [Connecting to archive.ubuntu.com]
> ^M0% [Connecting to archive.ubuntu.com (185.125.190.36)]
> ^M0% [Connected to archive.ubuntu.com
> (185.125.190.36)] ^M0% [Waiting for headers]
> ^MGet:1 Upgrade tool
> signature [819 B] ^M
> ^M0% [1 0 B/819 B 0%]
> ^M99% [Working]
> ^M99% [Waiting for headers]
> ^MGet:2 Upgrade tool [1,265 kB]
> ^M
> ^M0% [2 0 B/1,265 kB 0%]
> ^M8% [2 111 kB/1,265 kB 8%]
> ^M76% [2 968 kB/1,265 kB 76%]
> ^M100% [Working]
> ^MFetched 1,266 kB in 0s (0 B/s)
> ^M
> authenticate 'jammy.tar.gz' against 'jammy.tar.gz.gpg' ^M
> extracting 'jammy.tar.gz'^M
> ^[[!p^[[?3;4l^[[4l^[>^[[?1049h^[[22;0;0t^[[4l^[[?1h^[=^[[0m^[(B^[[1;24r^[[H^[[2J^[[23B^[[7mscreenrc:
> log: window required^[[27m ^H^H^M^[[31C^[[1K^[[H^[[H^[[2J
> Reading cache^M
>
>
> ** Changed in: ubuntu-release-upgrader (Ubuntu)
> Importance: Undecided => Medium
>
> ** Changed in: ubuntu-release-upgrader (Ubuntu)
> Status: New => Incomplete
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1810216
>
> Title:
> Unable to run do-release-upgrade under script(1) because of a need to
> clear the screen
>
> Status in ubuntu-release-upgrader package in Ubuntu:
> Incomplet...

Read more...

Revision history for this message
Dan Bungert (dbungert) wrote :

I was able to reproduce this message with

TERM=dumb script -c 'do-release-upgrade'

As a workaround dropping the TERM=dumb bit does allow the upgrade to proceed and produces the typescript, albeit an ugly one.

Changed in ubuntu-release-upgrader (Ubuntu):
status: Incomplete → Confirmed
importance: Medium → Low
Benjamin Drung (bdrung)
description: updated
Dan Bungert (dbungert)
description: updated
Revision history for this message
Nick (foust139) wrote :

I was able to fix this by using the command TERM="xterm-256color" before running the do-release-upgrade command. the procedure needs to be able to prompt screens during the process that TERM=dumb does not allow apparently.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.