Bibliography style unsrt not working

I am writing a text (whose content I can't fully disclose here) and I am experiencing some issues with citation order, using unsrt as bibliography style. Until a certain point citations are ordered correctly, but since I have added some .tex files, this isn't happening anymore. Any suggestions?

\documentclass[a4paper,12pt,oneside,english,american]{book}
\usepackage[utf8]{inputenc}
\usepackage{listings}
\usepackage{subcaption}
\usepackage[toc,acronym,nonumberlist,acronym,shortcuts]{glossaries}

\usepackage{hyperref}
\usepackage{fancyhdr}
\usepackage{geometry}
\usepackage{pdfpages}
\usepackage{amsthm}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{pgfplots}
\usepackage{makecell}
\usepackage{lscape}
\usepackage{eurosym}

\usepackage[linesnumbered,ruled]{algorithm2e}

\usepackage{tcolorbox}

\tcbuselibrary{theorems}

\newtcbtheorem[number within=section]{mytheo}{Definition}%
{colback=green!5,colframe=green!35!black,fonttitle=\bfseries}{th}

\usepackage{url}

\makeatletter% Set distance from top of page to first float
\setlength{\@fptop}{5pt}
\makeatother
\sloppy

\pagestyle{fancy}
\fancyfoot{}
\renewcommand{\footrulewidth}{0pt}
\cfoot{\thepage}

\usepackage{eso-pic,graphicx}
\makeatletter
\newcommand\BackgroundPicture[2]{
\setlength{\unitlength}{1pt}
\put(0,\strip@pt\paperheight){
\parbox[t][\paperheight]{\paperwidth}{
\vfill
\centering\includegraphics[angle=#2]{#1}
\vfill
}
}
}
\makeatother

\lstset{belowcaptionskip=1\baselineskip,
breaklines=true,
frame=single,
xleftmargin=\parindent,
showstringspaces=false
}

\lstdefinestyle{ccode}{
basicstyle=\footnotesize\ttfamily,
language=C,
morekeywords={uint32_t},
identifierstyle=\color{green!40!black}
}

\lstdefinestyle{pseudocode}{
language=C,
basicstyle=\footnotesize\ttfamily,
morekeywords={uint32_t,not},
escapechar=@,
%keywordstyle=\bfseries\color{green!40!black},
%stringstyle=\color{orange},
}

\AtBeginDocument{
\renewcommand{\subsectionautorefname}{\sectionautorefname}
\renewcommand{\subsubsectionautorefname}{\sectionautorefname}
\renewcommand{\itemautorefname}{step}
}

\newcommand{\var}{\emph}

\makeglossaries

\title{Text Title}
\author{Text Author}
\vspace{3cm}

\begin{document}

\frontmatter

\includepdf[pages=-]{./folder1/document.pdf}

\setcounter{page}{1}

\nocite{*}

\phantomsection
\tableofcontents

\cleardoublepage
\phantomsection
\listoffigures

\cleardoublepage
\phantomsection
\listoftables

%\cleardoublepage
\phantomsection
\printglossaries
\cleardoublepage

\graphicspath{{./figures/}{./measurements/}}

\mainmatter

\input{chapter1/1/chapter.tex}

\input{chapter/2/chapter.tex}

\bibliographystyle{unsrt}
\bibliography{references}

\end{document}

• Phrases such as "this isn't happening anymore" and "not working" are not illuminating. What, exactly, isn't "working"? What kind of output are you getting? What's in the tex files you say you added? Any \cite instructions, by any chance? If the answer is "yes", did you rerun LaTeX, BibTeX, and LaTeX twice more? Do LaTeX and BibTeX issue warning and/or error messages? Please be specific. – Mico Jun 12 at 19:50
• You have posted a large amount of code but almost none of it is related to references or sorting, please remove all unrelated things such as image inclusion and remove \input{chapter/2/chapter.tex} that does not let anyone run the example. the fact that your original document contains private material is not relevant you can change every word to "wibble" in an editor, it will not affect the citation numbers – David Carlisle Jun 12 at 19:52
• Quotes numbering is not sequential anymore. Only a part of them are ordered correctly, while others are ordered from the bottom of the correctly ordered ones; moreover they are not ordered correctly, but in a FIFO order relative to the insertion order in .bib file, not in .tex file. – EagleOne Jun 12 at 19:53
• then most likely you have \cite{*} somewhere that is causing all entries in the bib to be used in order – David Carlisle Jun 12 at 19:54
• side issue hyperref (cite backrefs etc) and glossaries will likely be benefit from reordering packages to the end of preamble – KJO Jun 12 at 20:16