[Tex/LaTex] After recent update of MikTeX, ! Package totpages Error: Can’t use both, lastpage and totpages

lastpage

\documentclass[12pt, a4paper]{article}
\usepackage{amsmath}
\usepackage{adjustbox} % uses graphicx
\usepackage[top=1.8cm,bottom=1.8cm,left=0.88cm,right=0.88cm]{geometry}


\usepackage{fancyhdr}
\usepackage{lastpage}

%\usepackage[
%   type={CC},
%   modifier={by-nc-nd},
%   version={4.0}
%]{doclicense}
%%
% \usepackage{doclicense}

\usepackage{lipsum}

\usepackage{hyperref}
\pdfsuppressptexinfo=-1
%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{qrcode}
%\usepackage{background}
\usepackage{multicol} % cover page multicol

\begin{document}


% \doclicenseImage

\cleardoublepage
\pagestyle{fancy}
\lipsum[1-5]

\end{document}

enter image description here

It was working fine when I installed and updated up to 17th Sep 2020.
Not sure which package casued it, but after the most recent update, if I add (put it back)\usepackage{doclicense}, I got this error now.

Best Answer

Same issue here after a recent upgrade in Debian Bullseye.

Before:

\documentclass{report}
\usepackage{lastpage}
\usepackage{hyperxmp}
\begin{document}
  This is page~\thepage{} of~\pageref{LastPage}.
\end{document}

Which gave the error:

! Package totpages Error: Can't use both, lastpage and totpages.

See the totpages package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              
                                                  
l.35 \begin{document}

I replaced the lastpage dependency with totpages and changed the corresponding \pageref{LastPage} to \pageref{TotPages}. After:

\documentclass{report}
\usepackage{totpages}
\usepackage{hyperxmp}
\begin{document}
  This is page~\thepage{} of~\pageref{TotPages}.
\end{document}

This also works with an unnumbered title page. The totpages package claims it's meant to be used for the actual total number of pages, not the last page's number for which the lastpage package is meant, but this way it can do that anyway and it resolves the dependency conflict.

Result:
"This is page 1 of 1."