Score:0

Is it possible to install a previous version of a package with apt?

om flag

Initially on my Ubuntu, I had bash 5.1 but to use bashdb I needed to get a previous version : bash 5.0

To get bash 5.0, I've been to the official website of bash and downloaded the version 5.0 manually since apt would have installed the latest version of bash : version 5.1 that I don't want.

Then I built bash 5.0 myself with make.

The make install command then put bash 5.0 in /usr/local

My question is :

Is it the right way to properly install the previous version of a package ? I think it's a bit inconvenient to install a package manually like that. It's more error-prone as well... Can't apt do it instead ?

muru avatar
us flag
See, it's inconvenient for _you_. Having to maintain multiple versions of a core utility like bash for a single Ubuntu version (while testing it, allowing multiple versions to be installable simultaneously or making sure everything works with either version, etc.) is much more of an inconvenience for the developers who have to do that. So while apt _could_ do it, the default repositories don't have a way for it do so.
muru avatar
us flag
These days with Docker being quite easy to use, there's really not much reason why you can't just run a container with desired version of whichever software you want.
DigitalRomance avatar
om flag
@muru so that means it's not possible to install a previous version of a package with apt ? I thought it was possible with a command like that : `sudo apt install <package>=<version>`. But apparently, it's not.
muru avatar
us flag
I did say it's possible for apt, it's just not possible for the bash package with the default repositories.
DigitalRomance avatar
om flag
So which command do I need to type to download `bash 5.0` with `apt` ? I've tried `sudo apt install bash=5.0` but it didn't work.
cn flag
It is kinda strange a tool would break with a newer version of bash - wouldn't it make more sense to work out why bashdb dosen't work on the default bash and getting that fixed?
Artur Meinild avatar
vn flag
@JourneymanGeek that's because `bashdb` hasn't been updated since 2019 - which seems to be the core issue here..
cn flag
https://sourceforge.net/p/bashdb/bugs/68/ indicates it *should* work and had fixed it in 2021 to with with bash 5.1. Seems safer to try to get it to compile and run over trying to run a custom compiled bash
Score:3
vn flag

Yes, you can use apt to install a previous version of a package that's in the repositories for your Ubuntu version. The last part of that sentence is important.

Please see this existing Q&A as an example on how to fallback (downgrade and hold) to a previous version of containerd because of a regression in the latest version.

In your case with bash, the same logic does not apply, since bash 5.0 is not in the repositories for Ubuntu 22.04.

In this case you have some other options:

  • Update and compile the tool (bashdb) to work with recent versions of bash (preferred - might be possible according to this report)
  • Compile an alternate version of bash yourself
  • Run a container or virtual machine with Ubuntu 20.04 (which has bash 5.0) for the purposes you need

If you have the skills, option 1 would be the best. If this it not the case, I would then recommend option 3, as this seems the most failsafe option.

Adding repositories for Ubuntu 20.04 to your 22.04 installation is NOT RECOMMENDED, as this can lead to unwanted consequences.

Score:0
pr flag

You've to specify "package name"=version

sudo apt-get install <package name>=<version>

Then put "on hold" upgrade of that package to prevent update

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.