# Upgrading Wi-Fi packages...whilst connecting to Wi-Fi

**URL:** <https://dietpi.com/forum/t/upgrading-wi-fi-packages-whilst-connecting-to-wi-fi/20647>\
**Category:** Troubleshooting\
**Tags:** wifi\
**Created:** [3 July 2024 07:11 UTC](https://dietpi.com/forum/t/upgrading-wi-fi-packages-whilst-connecting-to-wi-fi/20647 "2024-07-03T07:11:08Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jason\_a69](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/j/d07c76/32.png) [@jason\_a69](https://dietpi.com/forum/u/jason_a69)\
**Post date:** [3 July 2024 07:11 UTC](https://dietpi.com/forum/t/upgrading-wi-fi-packages-whilst-connecting-to-wi-fi/20647/1 "2024-07-03T07:11:09Z")

</div>

I am trying to update the packages on a Pi Zero which is located an awful long way from where I am so I would prefer that this didn’t fail!

These are the 2 packages

```auto
libglib2.0-0/oldstable 2.66.8-1+deb11u4 armhf [upgradable from: 2.66.8-1+deb11u3]
wpasupplicant/oldstable 2:2.9.0-21+deb11u1 armhf [upgradable from: 2:2.9.0-21]

```

As I am connected to Wi-Fi I can understand if this cannot be completed, is there a way to download the packages manually and then install them in a script when the box reboots?

Any advice is welcome.

Thanks

Jason

---

<div class="post-metadata">

**Author:** ![Jappe](https://dietpi.com/forum/user_avatar/dietpi.com/jappe/32/1788_2.png) [@Jappe](https://dietpi.com/forum/u/Jappe)\
**Post date:** [3 July 2024 07:47 UTC](https://dietpi.com/forum/t/upgrading-wi-fi-packages-whilst-connecting-to-wi-fi/20647/2 "2024-07-03T07:47:36Z")

</div>

# TLDR;

- download the packages without installing them
- verify that the packages are correctly downloaded
- write a script which installs the packages
- config crontab to run the script on boot
- reboot

(assuming you do this as `root` user)

# 1. download the packages

```sh
apt-get update
apt-get install --download-only libglib2.0-0 wpasupplicant

```

# 2. Verify

```sh
ls /var/cache/apt/archives/libglib2.0-0* /var/cache/apt/archives/wpasupplicant*

```

You should see an output for both files.

# 3. create the script:

`nano ~/update_script.sh`  
Creates the script in home directory of `root`.

Content of the script:

```sh
#!/bin/bash

# Install the downloaded packages
dpkg -i /var/cache/apt/archives/libglib2.0-0*.deb
dpkg -i /var/cache/apt/archages/wpasupplicant*.deb

# Remove the script from the crontab
(crontab -l | grep -v 'update_script.sh') | crontab -

# Delete the script
rm -- "$0"

```

Save and close nano.

# 4. Make it executable

```sh
chmod +x ~/update_script.sh

```

# 5. Add it to crontab

`crontab -e`

Add the line:

```sh
@reboot /root/update_script.sh

```

# 6. reboot

```sh
reboot

```

To test the part with the script, crontab and reboot, you could just create a dummy script which creates a file somewhere or something similiar you can verify.

I make no guarantee that it will work 🫠

---

<div class="post-metadata">

**Author:** ![jason\_a69](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/j/d07c76/32.png) [@jason\_a69](https://dietpi.com/forum/u/jason_a69)\
**Post date:** [3 July 2024 07:54 UTC](https://dietpi.com/forum/t/upgrading-wi-fi-packages-whilst-connecting-to-wi-fi/20647/3 "2024-07-03T07:54:55Z")

</div>

Thank you very much!

I will give it a go later and provide feedback.

---

<div class="post-metadata">

**Author:** ![jason\_a69](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/j/d07c76/32.png) [@jason\_a69](https://dietpi.com/forum/u/jason_a69)\
**Post date:** [3 July 2024 08:32 UTC](https://dietpi.com/forum/t/upgrading-wi-fi-packages-whilst-connecting-to-wi-fi/20647/4 "2024-07-03T08:32:38Z")

</div>

I made a couple of tweeks

- I copied the 2 .deb files from /var/cache/apt/archives to /root
- I put logging in the script because it failed the first time because no PATH was defined and I did not know why. The logging pointed that out.
- I removed the last 5 lines which removes update\_script.sh from crontab (I did it manually after the script had run successfully)

So my script looks like this

```auto
#!/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

# Install the downloaded packages
dpkg -i /root/libglib2.0-0*.deb >> /root/update_script.log 2>&1
dpkg -i /root/wpasupplicant*.deb >> /root/update_script.log 2>&1

```

Thanks very much once again.

---

<div class="post-metadata">

**Author:** ![Joulinar](https://dietpi.com/forum/user_avatar/dietpi.com/joulinar/32/57_2.png) [@Joulinar](https://dietpi.com/forum/u/Joulinar)\
**Post date:** [3 July 2024 09:48 UTC](https://dietpi.com/forum/t/upgrading-wi-fi-packages-whilst-connecting-to-wi-fi/20647/5 "2024-07-03T09:48:34Z")

</div>

Another option might be using `screen` tool. This should keep alive the session even if disconnected [Debian -- Details of package screen in bookworm](https://packages.debian.org/bookworm/screen)

---

<div class="post-metadata">

**Author:** ![system](https://dietpi.com/forum/uploads/default/original/1X/7e1021de2213860bce185915ce2c1786e56490ec.png) [@system](https://dietpi.com/forum/u/system)\
**Post date:** [1 October 2024 09:49 UTC](https://dietpi.com/forum/t/upgrading-wi-fi-packages-whilst-connecting-to-wi-fi/20647/6 "2024-10-01T09:49:14Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
