Skip to content

Ubuntu upgrade 20.04

1. Motivation

Update ubuntu from 18.04.05 to 20.04 as the newer version of FreeCad(>18.05) seems to fix some add-on related error


2. Commandline

2.1 Environment (before)

1
2
3
4
5
6
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.5 LTS
Release:    18.04
Codename:   bionic

2.2 Install update-manager

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
$ sudo apt install update-manager
[sudo] password for tato: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
update-manager is already the newest version (1:18.04.11.13).
The following packages were automatically installed and are no longer required:
  libboost-python1.65.1 libboost-signals1.65.1 libcoin80v5 libjs-sphinxdoc
  libjs-underscore libpyside2-5.11 libqt4-designer libqtassistantclient4
  libsbc1 libshiboken2-5.11 libsoqt4-20 linux-hwe-5.4-headers-5.4.0-65
  linux-hwe-5.4-headers-5.4.0-67 pyside-tools
  python-backports.functools-lru-cache python-collada python-cycler
  python-dateutil python-matplotlib python-olefile python-pil python-pivy
  python-ply python-pyparsing python-pyside2.qtcore python-pyside2.qtgui
  python-pyside2.qtopengl python-pyside2.qtwidgets python-qt4 python-qt4-gl
  python-sip python-subprocess32 python-tz
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.
tato@ubuntu2:/usr/lib/freecad/Mod/AddonManager$ sudo apt dist-upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages were automatically installed and are no longer required:
  freecad-runtime libboost-python1.65.1 libboost-signals1.65.1 libcoin80v5
  libjs-sphinxdoc libjs-underscore libpyside2-5.11 libqt4-designer
  libqtassistantclient4 libsbc1 libshiboken2-5.11 libsoqt4-20
  linux-hwe-5.4-headers-5.4.0-65 linux-hwe-5.4-headers-5.4.0-67 pyside-tools
  python-backports.functools-lru-cache python-collada python-cycler
  python-dateutil python-matplotlib python-olefile python-pil python-pivy
  python-ply python-pyparsing python-pyside2.qtcore python-pyside2.qtgui
  python-pyside2.qtopengl python-pyside2.qtwidgets python-qt4 python-qt4-gl
  python-sip python-subprocess32 python-tz python3-pyside2uic
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
  libfreecad-python3-0.18 libocct-data-exchange-7.3 libocct-foundation-7.3
  libocct-modeling-algorithms-7.3 libocct-modeling-data-7.3 libocct-ocaf-7.3
  libocct-visualization-7.3
The following NEW packages will be installed:
  libfreecad-python3-0.19 libocct-data-exchange-7.5 libocct-foundation-7.5
  libocct-modeling-algorithms-7.5 libocct-modeling-data-7.5 libocct-ocaf-7.5
  libocct-visualization-7.5 python3-ply
The following packages will be upgraded:
  freecad-common freecad-python3
2 upgraded, 8 newly installed, 7 to remove and 0 not upgraded.
Need to get 48.7 MB/65.3 MB of archives.
After this operation, 94.9 MB of additional disk space will be used.

Then conlsole asked if I continue.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
Do you want to continue? [Y/n] Y
Get:1 http://jp.archive.ubuntu.com/ubuntu bionic/main amd64 python3-ply all 3.11-1 [46.6 kB]
Get:2 http://ppa.launchpad.net/freecad-maintainers/freecad-stable/ubuntu bionic/main amd64 freecad-python3 amd64 2:0.19+dfsg1~202103010521~ubuntu18.04.1 [47.9 kB]
Get:3 http://ppa.launchpad.net/freecad-maintainers/freecad-stable/ubuntu bionic/main amd64 libocct-foundation-7.5 amd64 1:7.5.1+dfsg1-0~202102252047~ubuntu18.04.1 [1,344 kB]
Get:4 http://ppa.launchpad.net/freecad-maintainers/freecad-stable/ubuntu bionic/main amd64 libocct-modeling-data-7.5 amd64 1:7.5.1+dfsg1-0~202102252047~ubuntu18.04.1 [2,633 kB]
Get:5 http://ppa.launchpad.net/freecad-maintainers/freecad-stable/ubuntu bionic/main amd64 libocct-modeling-algorithms-7.5 amd64 1:7.5.1+dfsg1-0~202102252047~ubuntu18.04.1 [7,920 kB]
Get:6 http://ppa.launchpad.net/freecad-maintainers/freecad-stable/ubuntu bionic/main amd64 libocct-visualization-7.5 amd64 1:7.5.1+dfsg1-0~202102252047~ubuntu18.04.1 [1,982 kB]
Get:7 http://ppa.launchpad.net/freecad-maintainers/freecad-stable/ubuntu bionic/main amd64 libocct-ocaf-7.5 amd64 1:7.5.1+dfsg1-0~202102252047~ubuntu18.04.1 [1,194 kB]
Get:8 http://ppa.launchpad.net/freecad-maintainers/freecad-stable/ubuntu bionic/main amd64 libocct-data-exchange-7.5 amd64 1:7.5.1+dfsg1-0~202102252047~ubuntu18.04.1 [4,099 kB]
Get:9 http://ppa.launchpad.net/freecad-maintainers/freecad-stable/ubuntu bionic/main amd64 libfreecad-python3-0.19 amd64 2:0.19+dfsg1~202103010521~ubuntu18.04.1 [29.4 MB]
Fetched 48.7 MB in 22s (2,246 kB/s)                                            
(Reading database ... 325956 files and directories currently installed.)
Preparing to unpack .../freecad-common_2%3a0.19+dfsg1~202103010521~ubuntu18.04.1_all.deb ...
Unpacking freecad-common (2:0.19+dfsg1~202103010521~ubuntu18.04.1) over (2:0.18.4+dfsg1~201911060029~ubuntu18.04.1) ...
dpkg: error processing archive /var/cache/apt/archives/freecad-common_2%3a0.19+dfsg1~202103010521~ubuntu18.04.1_all.deb (--unpack):
 trying to overwrite '/usr/share/freecad/Ext/PySide/QtCore.py', which is also in package freecad-runtime 2:0.18.4+dfsg1~201911060029~ubuntu18.04.1
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Selecting previously unselected package python3-ply.
Preparing to unpack .../python3-ply_3.11-1_all.deb ...
Unpacking python3-ply (3.11-1) ...
Preparing to unpack .../freecad-python3_2%3a0.19+dfsg1~202103010521~ubuntu18.04.1_amd64.deb ...
Unpacking freecad-python3 (2:0.19+dfsg1~202103010521~ubuntu18.04.1) over (2:0.18.4+dfsg1~201911060029~ubuntu18.04.1) ...
Errors were encountered while processing:
 /var/cache/apt/archives/freecad-common_2%3a0.19+dfsg1~202103010521~ubuntu18.04.1_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

However, terminated by error :

1
2
3
> Errors were encountered while processing:
> /var/cache/apt/archives/freecad-common_2%3a0.19+dfsg1~202103010521~ubuntu18.04.1_all.deb
> E: Sub-process /usr/bin/dpkg returned an error code (1)

This is fixed by removing python2 (Ref. reddit forum)

1
2
3
4
$ sudo apt remove python2
$ sudo apt auto-remove
...
$ sudo apt install update-manager

2.3 Distribution upgrade

1
2
3
4
$ sudo apt dist-upgrade
...
Do you want to continue? [Y/n] y
...

Then, do-release-upgrade

1
2
3
4
5
6
7
8
9
$ sudo do-release-upgrade -d
...
Do you want to continue? [y/N] y
...
To continue please press [ENTER]
...
Do you want to start the upgrade? 
...
 Continue [yN]  Details [d] y

And follow GUI instruction by “package configuration”. Just follow default selection.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
Configuration file '/etc/cloud/cloud.cfg'
 ==> Modified (by you or by a script) since installation.
 ==> Package distributor has shipped an updated version.
   What would you like to do about it ?  Your options are:
    Y or I  : install the package maintainer's version
    N or O  : keep your currently-installed version
      D     : show the differences between the versions
      Z     : start a shell to examine the situation
 The default action is to keep your current version.
*** cloud.cfg (Y/I/N/O/D/Z) [default=N] ? 
...
 Continue [yN]  Details [d] y

Then restart Ubuntu.

1
2
3
4
5
6
Restart required 

To finish the upgrade, a restart is required. 
If you select 'y' the system will be restarted. 

Continue [yN] y

2.4. Environment (after)

1
2
3
4
5
6
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.2 LTS
Release:    20.04
Codename:   focal

3. Re-install python virtual environment and pip

After upgrade ubuntu to 20.04, pip returns error

1
2
3
4
5
$ pip
Traceback (most recent call last):
  File "/home/tato/env1/bin/pip", line 7, in <module>
    from pip import main
ModuleNotFoundError: No module named 'pip'

This was not resolved only by re-install pip.

1
2
3
$ sudo apt-get remove python3-pip
$ sudo apt-get update
$ sudo apt-get install python3-pip

By above command, pip was installed successsfully, but I could not use it on python virtual environment.

1
2
3
4
5
6
7
8
$ source ~/env1/bin/activate
(env1) $ python --version
Python 3.8.5
(env1) $ pip
Traceback (most recent call last):
  File "/home/tato/env1/bin/pip", line 7, in <module>
    from pip import main
ModuleNotFoundError: No module named 'pip'

I re-created by virtual environment.

backuup former virtual environment.

1
mv ~/env1/ ~/bk_env1/

Create virtual environment and switched to

1
2
3
$ python3 -m venv ~/env1
$ source ~/env1/bin/activate
(env1) $

Then pip is activated under virtual environment.

1
2
3
4
5
6
7
8
9
(env1) $ pip
Usage:   
  pip <command> [options]
...

# And use pip like
(env1) $ cd ~/repo/fabcloud/fabacademy
(env1) $ pip install -r requirements.txt
(env1) $ mkdocs serve

4. Re-install Freecad

4.1. apt install

During investigation on upgrading error, I removed freecad that depends on python2 related libraries ($ sudo apt remove freecad, $ sudo apt remove freecad-common etc.). After upgrade Ubuntu to 20.04 installation, I re-installed freecad.

1
$ sudo apt install freecad
1
2
$ which freecad
/usr/bin/freecad
1
freecad -v

This shows `FreeCAD 0.18.4 Revision: ~

4.2. snap install

Through snap, freecad 0.19 is installed.

1
2
3
$ sudo snap install freecad
[sudo] password for tato: 
freecad 0.19 from Jean-Marie Verdun (vejmarie) installed
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
$ snap list
Name                  Version                     Rev    Tracking         Publisher          Notes
arduino               1.8.13                      56     latest/stable    merlijn-sebrechts  -
core                  16-2.49.2                   10958  latest/stable    canonical✓         core
core18                20210309                    1997   latest/stable    canonical✓         base
core20                20210319                    975    latest/stable    canonical✓         base
freecad               0.19                        22     latest/stable    vejmarie           -
gnome-3-28-1804       3.28.0-19-g98f9e67.98f9e67  145    latest/stable/…  canonical✓         -
gnome-3-34-1804       0+git.3556cb3               66     latest/stable    canonical✓         -
gnome-calculator      3.38.2+git3.1d166209        884    latest/stable/…  canonical✓         -
gnome-characters      v3.34.0+git30.16311a5       708    latest/stable/…  canonical✓         -
gnome-logs            3.36.0                      103    latest/stable/…  canonical✓         -
gnome-system-monitor  3.38.0-17-g38c1ce1d62       157    latest/stable/…  canonical✓         -
gtk-common-themes     0.1-52-gb92ac40             1515   latest/stable/…  canonical✓         -
spotify               1.1.55.498.gf9a83c60        46     latest/stable    spotify✓           -

References


Last update: April 30, 2021