Skip to content

Commit ff25087

Browse files
authored
Fix: Handle the messed-up status of packages on Ubuntu derivatives (#2507)
Pop!_OS supposedly has the 'linux-modules-extra' package, but rejects to install it with a weird error messsage that doesn't even produce a proper exit code. This patch uses a slightly different approach to figuring out if the package is there to be installed. Tested on Pop!_OS 22.04, Ubuntu 24.04 and Debian Bookworm
1 parent a5d794b commit ff25087

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

netsim/install/ubuntu.sh

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,6 @@ $SUDO apt-get upgrade -y $FLAG_APT
1111
# Install missing packages
1212
#
1313
echo "Install missing packages (also a pretty long operation)"
14-
# Add linux-modules-extra for e.g. vrf
15-
# linux-modules-extra-$(uname -r) should exist, but it won't if we're running
16-
# on a kernel that has been purged from the package server; in that case the
17-
# user will likely need to reboot.
18-
EXTRA=""
19-
if apt-cache show linux-modules-extra-$(uname -r) > /dev/null; then
20-
EXTRA="linux-modules-extra-$(uname -r)"
21-
fi
2214
# Added curl, which is not installed by default on Debian - ghostinthenet - 20220417
2315
$SUDO apt-get -y $FLAG_APT install python3 python3-setuptools ifupdown python3-pip curl $EXTRA
2416
echo "Install nice-to-have packages"
@@ -30,3 +22,12 @@ echo "Install Python development and build modules"
3022
$SUDO apt-get -y $FLAG_APT install build-essential python3-dev libffi-dev libssh-dev
3123
echo "Installing XML libraries"
3224
$SUDO apt-get -y $FLAG_APT install libxslt1-dev libssl-dev
25+
# Add linux-modules-extra for e.g. vrf
26+
# linux-modules-extra-$(uname -r) should exist, but it won't if we're running
27+
# on a kernel that has been purged from the package server; in that case the
28+
# user will likely need to reboot.
29+
EXTRA="linux-modules-extra-$(uname -r)"
30+
if [ -n "$(apt-cache search $EXTRA)" ]; then
31+
echo "Installing additional Linux kernel modules"
32+
sudo apt-get -y $FLAG_APT install $EXTRA
33+
fi

0 commit comments

Comments
 (0)