My nightly Ubuntu upgrades failed and apt ended up in a somewhat broken state due to the crystal1.12
upgrade (if I recall correctly, this also happened between 1.10 and 1.11, but I’m not 100% sure).
The culprit seems to be:
dpkg: error processing archive /var/cache/apt/archives/crystal1.12_1.12.0-1+2.1_amd64.deb (--unpack):
trying to overwrite '/usr/bin/crystal', which is also in package crystal1.11 1.11.2-1+1.1
The apt-get update and upgrade:
$ apt-get update
..
Get:7 http://download.opensuse.org/repositories/devel:/languages:/crystal/xUbuntu_22.04 InRelease [1,544 B]
..
Fetched 237 kB in 1s (222 kB/s)
Reading package lists... Done
$ apt-get dist-upgrade
Reading package lists...
Building dependency tree...
Reading state information...
Calculating upgrade...
The following package was automatically installed and is no longer required:
crystal1.11
Use 'apt autoremove' to remove it.
The following NEW packages will be installed:
crystal1.12
The following packages will be upgraded:
crystal
1 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 34.7 MB of archives.
After this operation, 136 MB of additional disk space will be used.
Get:1 http://download.opensuse.org/repositories/devel:/languages:/crystal/xUbuntu_22.04 crystal 1.12.0-1+1.1 [1,088 B]
Get:2 http://download.opensuse.org/repositories/devel:/languages:/crystal/xUbuntu_22.04 crystal1.12 1.12.0-1+2.1 [34.7 MB]
debconf: unable to initialize frontend: Dialog
debconf: (TERM is not set, so the dialog frontend is not usable.)
debconf: falling back to frontend: Readline
debconf: unable to initialize frontend: Readline
debconf: (This frontend requires a controlling tty.)
debconf: falling back to frontend: Teletype
dpkg-preconfigure: unable to re-open stdin:
Fetched 34.7 MB in 1s (29.9 MB/s)
[615B blob data]
Preparing to unpack .../crystal_1.12.0-1+1.1_all.deb ...
Unpacking crystal (1.12.0-1+1.1) over (1.11.0-1+1.1) ...
Selecting previously unselected package crystal1.12.
Preparing to unpack .../crystal1.12_1.12.0-1+2.1_amd64.deb ...
Unpacking crystal1.12 (1.12.0-1+2.1) ...
dpkg: error processing archive /var/cache/apt/archives/crystal1.12_1.12.0-1+2.1_amd64.deb (--unpack):
trying to overwrite '/usr/bin/crystal', which is also in package crystal1.11 1.11.2-1+1.1
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
/var/cache/apt/archives/crystal1.12_1.12.0-1+2.1_amd64.deb
needrestart is being skipped since dpkg has failed
E: Sub-process /usr/bin/dpkg returned an error code (1)
A couple of different commands that didn’t work out:
$ apt-get upgrade
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
crystal : Depends: crystal1.12 but it is not installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
$ apt --fix-broken install
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Correcting dependencies... Done
The following package was automatically installed and is no longer required:
crystal1.11
Use 'apt autoremove' to remove it.
The following additional packages will be installed:
crystal1.12
The following NEW packages will be installed:
crystal1.12
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
Need to get 0 B/34.7 MB of archives.
After this operation, 136 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 147898 files and directories currently installed.)
Preparing to unpack .../crystal1.12_1.12.0-1+2.1_amd64.deb ...
Unpacking crystal1.12 (1.12.0-1+2.1) ...
dpkg: error processing archive /var/cache/apt/archives/crystal1.12_1.12.0-1+2.1_amd64.deb (--unpack):
trying to overwrite '/usr/bin/crystal', which is also in package crystal1.11 1.11.2-1+1.1
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
/var/cache/apt/archives/crystal1.12_1.12.0-1+2.1_amd64.deb
needrestart is being skipped since dpkg has failed
E: Sub-process /usr/bin/dpkg returned an error code (1)
$ apt-get remove --purge crystal1.11
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
crystal : Depends: crystal1.12 but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
Removing both crystal
and crystal1.11
and then a reinstall did the trick:
$ apt-get remove --purge crystal crystal1.11
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
libpcre16-3 libpcre2-16-0 libpcre2-32-0 libpcre2-dev libpcre2-posix3 libpcre3-dev libpcre32-3 libpcrecpp0v5
Use 'apt autoremove' to remove them.
The following packages will be REMOVED:
crystal* crystal1.11*
0 upgraded, 0 newly installed, 2 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 136 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 147898 files and directories currently installed.)
Removing crystal (1.12.0-1+1.1) ...
Removing crystal1.11 (1.11.2-1+1.1) ...
Processing triggers for man-db (2.10.2-1) ...
Scanning processes...
Scanning linux images...
..
$ apt-get install crystal
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
crystal1.12
The following NEW packages will be installed:
crystal crystal1.12
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/34.7 MB of archives.
After this operation, 136 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 146254 files and directories currently installed.)
Preparing to unpack .../crystal1.12_1.12.0-1+2.1_amd64.deb ...
Unpacking crystal1.12 (1.12.0-1+2.1) ...
Selecting previously unselected package crystal.
Preparing to unpack .../crystal_1.12.0-1+1.1_all.deb ...
Unpacking crystal (1.12.0-1+1.1) ...
Setting up crystal1.12 (1.12.0-1+2.1) ...
Setting up crystal (1.12.0-1+1.1) ...
Processing triggers for man-db (2.10.2-1) ...
Scanning processes...
Scanning linux images...
..
$ crystal --version
Crystal 1.12.0 [aee9ab69e] (2024-04-09)
LLVM: 15.0.7
Default target: x86_64-unknown-linux-gnu
Although not a major issue, it would be nice if these upgrades didn’t require manual intervention