LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices


Reply
  Search this Thread
Old 01-26-2024, 10:04 PM   #1
MarioLawrence
LQ Newbie
 
Registered: Jan 2024
Location: Richmond, Virginia
Distribution: Kubuntu
Posts: 7

Rep: Reputation: 0
Metadata not being seen after offline usb apt repository creation on kubuntu 20.04.


(TL;DR at bottom of post.)
Preamble:
This post is being made on this forum as I was unsuccessful getting help anywhere else.

On Ubuntu Official, my post didn't even get views, after days of continuous updates.
Kubuntu community forums have been inaccessible to me due to an ongoing issue with their reCAPTCHA server, and my attempts to use their reporting system to inform them of this, encountered the same problem.
I have done my due dilligence in trying to reach out on both Ubuntu official and Kubuntu community.
It's time to move on.
And I have chosen this forum to present my issue to.

To respect the rules of this forum, I have deleted my post on the Ubuntu official forum. And I am perfectly fine with doing this, as no one has even VIEWED my post for days.
At least here, my issue was seen by other people before the thread was closed.
(End preamble.)

Hello everyone, I'm Mario.
I'm trying to create offline usb repositories for Kubuntu 20.04. I will require them because there is no internet access where me and mine will be going.

I attempted to use apt-mirror, following the steps found here: https://www.linuxtechi.com/setup-loc...server-ubuntu/
I modified these steps for focal 20.04
I modified my /etc/apt/sources.list to aim ONLY at the local repo I created on the drive with apt-mirror.

I encountered the following errors when running 'sudo apt update':
Code:
  File not found - /var/www/html/localrepo/dists/focal/main/dep11/icons-48x48.tar (2: No such file or directory) 
Get:7 file:/var/www/html/localrepo/focal/main DEP-11 64x64 Icons [221 kB] 
Ign:7 file:/var/www/html/localrepo/focal/main DEP-11 64x64 Icons 
Reading package lists... Done 
N: Download is performed unsandboxed as root as file '/var/www/html/localrepodists/focal/InRelease' couldn't be accessed by user '_apt'. - pkgAcquire::Run (13: Permission denied) 
E: Failed to fetch file:/var/www/html/localrepo/dists/focal/main/dep11/icons-48x48.tar  File not found - /var/www/html/localrepo/dists/focal/main/dep11/icons-48x48.tar (2: No such file or directory) 
E: Some index files failed to download. They have been ignored, or old ones used instead.
As confirmed on the linuxtechi website, apt-mirror was failing to mirror necessary metadata. I ran the provided workaround configuration script after modifying it for focal (20.04), and my needs.
Code:
#!/bin/bash

cd /var/www/html/ubuntu/archive.ubuntu.com/ubuntu/dists

for dist in jammy jammy-updates jammy-security jammy-backports; do
  for comp in main multiverse universe; do
    for size in 48 64 128; do
    wget  http://archive.ubuntu.com/ubuntu/dists/$dist/$comp/dep11/icons-${size}x${size}@2.tar.gz  -O $dist/$comp/dep11/icons-${size}x${size}@2.tar.gz;
   done
 done
done

cd /var/tmp
for p in "${1:-jammy}"{,-{security,updates,backports}}\
/{main,restricted,universe,multiverse};do >&2 echo "${p}"
wget -q -c -r -np -R "index.html*"\
"http://archive.ubuntu.com/ubuntu/dists/${p}/cnf/Commands-amd64.xz"
wget -q -c -r -np -R "index.html*"\
"http://archive.ubuntu.com/ubuntu/dists/${p}/cnf/Commands-i386.xz"
wget -q -c -r -np -R "index.html*" \
"http://archive.ubuntu.com/ubuntu/dists/${p}/binary-i386/"
done

sudo cp -av archive.ubuntu.com/ubuntu/ /var/www/html/ubuntu/archive.ubuntu.com
Please note, this is not the modified script. It didn't work so I didn't bother keep it.
then went to http://archive.ubuntu.com and downloaded the specific metadata files (the ones that apt said were missing) manually to my repo. It still gave the error that the files could not be found.
I verified my file paths were correct, but the errors persisted.

I completely deleted the repository and decided to build the repo manually; loosely following instructions from here: https://help.ubuntu.com/community/Ap...ine/Repository
This proved successful, because even though it gave the same errors when I ran 'sudo apt update'; I again manually provided the files it said it was missing, and apt seemed to acknowledge the presence of the files and it started syncing metadata correctly.
So I had a working repository, but no deb packages in it. This was expected and intended at that point. I wanted to ensure that apt could properly read metadata and update itself BEFORE committing to another multi-hundred GB download wait time.

I successfully used apt-mirror THIS time, to download pool folder data (the .deb files). I trashed the metadata that apt-mirror pulled, and provided the metadata that I pulled manually from the repo.
It worked perfectly. I did a quick test installing and autoremoving the package 'gufw'. All was well.

With the local repo working, I figured I needed only to copy the repo to the desired usb drive, and then aim '/etc/apt/sources.list' at it.
Code:
## Major bug fix updates produced after the final release of the
## distribution.
#deb http://us.archive.ubuntu.com/ubuntu/ focal-updates main restricted
# deb-src http://us.archive.ubuntu.com/ubuntu/ focal-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
#deb http://us.archive.ubuntu.com/ubuntu/ focal universe
# deb-src http://us.archive.ubuntu.com/ubuntu/ focal universe
#deb http://us.archive.ubuntu.com/ubuntu/ focal-updates universe
# deb-src http://us.archive.ubuntu.com/ubuntu/ focal-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
#deb http://us.archive.ubuntu.com/ubuntu/ focal multiverse
# deb-src http://us.archive.ubuntu.com/ubuntu/ focal multiverse
#deb http://us.archive.ubuntu.com/ubuntu/ focal-updates multiverse
# deb-src http://us.archive.ubuntu.com/ubuntu/ focal-updates multiverse

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
#deb http://us.archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse
# deb-src http://us.archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu focal partner
# deb-src http://archive.canonical.com/ubuntu focal partner

#deb http://security.ubuntu.com/ubuntu focal-security main restricted
# deb-src http://security.ubuntu.com/ubuntu focal-security main restricted
#deb http://security.ubuntu.com/ubuntu focal-security universe
# deb-src http://security.ubuntu.com/ubuntu focal-security universe
#deb http://security.ubuntu.com/ubuntu focal-security multiverse
# deb-src http://security.ubuntu.com/ubuntu focal-security multiverse

# This system was installed using small removable media
# (e.g. netinst, live or single CD). The matching "deb cdrom"
# entries were disabled at the end of the installation process.
# For information about how to configure apt package sources,
# see the sources.list(5) manual.

#deb [arch=amd64  signed-by=/usr/share/keyrings/oracle-virtualbox-2016.gpg]  https://download.virtualbox.org/virtualbox/debian focal contrib

#deb [trusted=yes] file:///var/www/html/localrepo focal main restricted universe multiverse
deb [trusted=yes] file:///media/mario/usbrepo focal main restricted universe multiverse
But again my efforts were frustrated by failure.
The problem with apt not seeing necessary metadata pops back up again.

For example, it says it can't find icons-48x48 tarball.
But I can verify that file IS infact there.
And it SEEMS to say it cannot access and read the InRelease file, but that makes no sense since it all works just fine on the computer.

I attempted to chmod the InRelease file to 755... and then just for s&g's I chmod'd it to 777.
I still get this output when I try to run 'sudo apt update'.
Code:
Get:1 file:/media/mario/usbrepo focal InRelease [265 kB] 
Get:1 file:/media/mario/usbrepo focal InRelease [265 kB] 
Get:2 file:/media/mario/usbrepo focal/main i386 Packages [718 kB] 
Ign:2 file:/media/mario/usbrepo focal/main i386 Packages 
Get:3 file:/media/mario/usbrepo focal/main amd64 Packages [970 kB] 
Ign:3 file:/media/mario/usbrepo focal/main amd64 Packages 
Get:4 file:/media/mario/usbrepo focal/main Translation-en [506 kB] 
Ign:4 file:/media/mario/usbrepo focal/main Translation-en 
Get:5 file:/media/mario/usbrepo focal/main amd64 DEP-11 Metadata [494 kB] 
Ign:5 file:/media/mario/usbrepo focal/main amd64 DEP-11 Metadata 
Get:6 file:/media/mario/usbrepo focal/main DEP-11 48x48 Icons [98.4 kB] 
Ign:6 file:/media/mario/usbrepo focal/main DEP-11 48x48 Icons 
Get:7 file:/media/mario/usbrepo focal/main DEP-11 64x64 Icons [163 kB] 
Ign:7 file:/media/mario/usbrepo focal/main DEP-11 64x64 Icons 
Get:8 file:/media/mario/usbrepo focal/main DEP-11 64x64@2 Icons [15.8 kB] 
Ign:8 file:/media/mario/usbrepo focal/main DEP-11 64x64@2 Icons 
Get:9 file:/media/mario/usbrepo focal/main DEP-11 128x128 Icons [367 kB] 
Ign:9 file:/media/mario/usbrepo focal/main DEP-11 128x128 Icons 
Get:10 file:/media/mario/usbrepo focal/main amd64 c-n-f Metadata [29.5 kB] 
Ign:10 file:/media/mario/usbrepo focal/main amd64 c-n-f Metadata 
Get:11 file:/media/mario/usbrepo focal/restricted amd64 Packages [22.0 kB] 
Ign:11 file:/media/mario/usbrepo focal/restricted amd64 Packages 
Get:12 file:/media/mario/usbrepo focal/restricted i386 Packages [8,112 B] 
Ign:12 file:/media/mario/usbrepo focal/restricted i386 Packages 
Get:13 file:/media/mario/usbrepo focal/restricted Translation-en [6,212 B] 
Ign:13 file:/media/mario/usbrepo focal/restricted Translation-en 
Get:14 file:/media/mario/usbrepo focal/restricted amd64 c-n-f Metadata [392 B] 
Ign:14 file:/media/mario/usbrepo focal/restricted amd64 c-n-f Metadata 
Get:15 file:/media/mario/usbrepo focal/universe amd64 Packages [8,628 kB] 
Ign:15 file:/media/mario/usbrepo focal/universe amd64 Packages 
Get:16 file:/media/mario/usbrepo focal/universe i386 Packages [4,642 kB] 
Ign:16 file:/media/mario/usbrepo focal/universe i386 Packages 
Get:17 file:/media/mario/usbrepo focal/universe Translation-en [5,124 kB] 
Ign:17 file:/media/mario/usbrepo focal/universe Translation-en 
Get:18 file:/media/mario/usbrepo focal/universe amd64 DEP-11 Metadata [3,603 kB] 
Ign:18 file:/media/mario/usbrepo focal/universe amd64 DEP-11 Metadata 
Get:19 file:/media/mario/usbrepo focal/universe DEP-11 48x48 Icons [3,016 kB] 
Ign:19 file:/media/mario/usbrepo focal/universe DEP-11 48x48 Icons 
Get:20 file:/media/mario/usbrepo focal/universe DEP-11 64x64 Icons [7,794 kB] 
Ign:20 file:/media/mario/usbrepo focal/universe DEP-11 64x64 Icons 
Get:21 file:/media/mario/usbrepo focal/universe DEP-11 64x64@2 Icons [44.3 kB] 
Ign:21 file:/media/mario/usbrepo focal/universe DEP-11 64x64@2 Icons 
Get:22 file:/media/mario/usbrepo focal/universe DEP-11 128x128 Icons [14.3 MB] 
Ign:22 file:/media/mario/usbrepo focal/universe DEP-11 128x128 Icons 
Get:23 file:/media/mario/usbrepo focal/universe amd64 c-n-f Metadata [265 kB] 
Ign:23 file:/media/mario/usbrepo focal/universe amd64 c-n-f Metadata 
Get:24 file:/media/mario/usbrepo focal/multiverse amd64 Packages [144 kB] 
Ign:24 file:/media/mario/usbrepo focal/multiverse amd64 Packages 
Get:25 file:/media/mario/usbrepo focal/multiverse i386 Packages [74.7 kB] 
Ign:25 file:/media/mario/usbrepo focal/multiverse i386 Packages 
Get:26 file:/media/mario/usbrepo focal/multiverse Translation-en [104 kB] 
Ign:26 file:/media/mario/usbrepo focal/multiverse Translation-en 
Get:27 file:/media/mario/usbrepo focal/multiverse amd64 DEP-11 Metadata [48.4 kB] 
Ign:27 file:/media/mario/usbrepo focal/multiverse amd64 DEP-11 Metadata 
Get:28 file:/media/mario/usbrepo focal/multiverse DEP-11 48x48 Icons [23.1 kB] 
Ign:28 file:/media/mario/usbrepo focal/multiverse DEP-11 48x48 Icons 
Get:29 file:/media/mario/usbrepo focal/multiverse DEP-11 64x64 Icons [192 kB] 
Ign:29 file:/media/mario/usbrepo focal/multiverse DEP-11 64x64 Icons 
Get:30 file:/media/mario/usbrepo focal/multiverse DEP-11 64x64@2 Icons [214 B] 
Ign:30 file:/media/mario/usbrepo focal/multiverse DEP-11 64x64@2 Icons 
Get:31 file:/media/mario/usbrepo focal/multiverse DEP-11 128x128 Icons [326 kB] 
Ign:31 file:/media/mario/usbrepo focal/multiverse DEP-11 128x128 Icons 
Get:32 file:/media/mario/usbrepo focal/multiverse amd64 c-n-f Metadata [9,136 B] 
Ign:32 file:/media/mario/usbrepo focal/multiverse amd64 c-n-f Metadata 
Get:2 file:/media/mario/usbrepo focal/main i386 Packages [930 kB] 
Ign:2 file:/media/mario/usbrepo focal/main i386 Packages 
Get:3 file:/media/mario/usbrepo focal/main amd64 Packages [1,275 kB] 
Ign:3 file:/media/mario/usbrepo focal/main amd64 Packages 
Get:4 file:/media/mario/usbrepo focal/main Translation-en [506 kB] 
Ign:4 file:/media/mario/usbrepo focal/main Translation-en 
Get:5 file:/media/mario/usbrepo focal/main amd64 DEP-11 Metadata [705 kB] 
Ign:5 file:/media/mario/usbrepo focal/main amd64 DEP-11 Metadata 
Get:6 file:/media/mario/usbrepo focal/main DEP-11 48x48 Icons [154 kB] 
Ign:6 file:/media/mario/usbrepo focal/main DEP-11 48x48 Icons 
Get:7 file:/media/mario/usbrepo focal/main DEP-11 64x64 Icons [221 kB] 
Ign:7 file:/media/mario/usbrepo focal/main DEP-11 64x64 Icons 
Get:8 file:/media/mario/usbrepo focal/main DEP-11 64x64@2 Icons [32.3 kB] 
Ign:8 file:/media/mario/usbrepo focal/main DEP-11 64x64@2 Icons 
Get:9 file:/media/mario/usbrepo focal/main DEP-11 128x128 Icons [435 kB] 
Ign:9 file:/media/mario/usbrepo focal/main DEP-11 128x128 Icons 
Get:10 file:/media/mario/usbrepo focal/main amd64 c-n-f Metadata [111 kB] 
Ign:10 file:/media/mario/usbrepo focal/main amd64 c-n-f Metadata 
Get:11 file:/media/mario/usbrepo focal/restricted amd64 Packages [22.0 kB] 
Ign:11 file:/media/mario/usbrepo focal/restricted amd64 Packages 
Get:12 file:/media/mario/usbrepo focal/restricted i386 Packages [8,112 B] 
Ign:12 file:/media/mario/usbrepo focal/restricted i386 Packages 
Get:13 file:/media/mario/usbrepo focal/restricted Translation-en [6,212 B] 
Get:14 file:/media/mario/usbrepo focal/restricted amd64 c-n-f Metadata [392 B] 
Ign:13 file:/media/mario/usbrepo focal/restricted Translation-en 
Ign:14 file:/media/mario/usbrepo focal/restricted amd64 c-n-f Metadata 
Get:15 file:/media/mario/usbrepo focal/universe amd64 Packages [8,628 kB] 
Ign:15 file:/media/mario/usbrepo focal/universe amd64 Packages 
Get:16 file:/media/mario/usbrepo focal/universe i386 Packages [4,642 kB] 
Ign:16 file:/media/mario/usbrepo focal/universe i386 Packages 
Get:17 file:/media/mario/usbrepo focal/universe Translation-en [5,124 kB] 
Ign:17 file:/media/mario/usbrepo focal/universe Translation-en 
Get:18 file:/media/mario/usbrepo focal/universe amd64 DEP-11 Metadata [3,603 kB] 
Ign:18 file:/media/mario/usbrepo focal/universe amd64 DEP-11 Metadata 
Get:19 file:/media/mario/usbrepo focal/universe DEP-11 48x48 Icons [3,016 kB] 
Ign:19 file:/media/mario/usbrepo focal/universe DEP-11 48x48 Icons 
Get:20 file:/media/mario/usbrepo focal/universe DEP-11 64x64 Icons [7,794 kB] 
Ign:20 file:/media/mario/usbrepo focal/universe DEP-11 64x64 Icons 
Get:21 file:/media/mario/usbrepo focal/universe DEP-11 64x64@2 Icons [44.3 kB] 
Ign:21 file:/media/mario/usbrepo focal/universe DEP-11 64x64@2 Icons 
Get:22 file:/media/mario/usbrepo focal/universe DEP-11 128x128 Icons [14.3 MB] 
Ign:22 file:/media/mario/usbrepo focal/universe DEP-11 128x128 Icons 
Get:23 file:/media/mario/usbrepo focal/universe amd64 c-n-f Metadata [265 kB] 
Ign:23 file:/media/mario/usbrepo focal/universe amd64 c-n-f Metadata 
Get:24 file:/media/mario/usbrepo focal/multiverse amd64 Packages [144 kB] 
Ign:24 file:/media/mario/usbrepo focal/multiverse amd64 Packages 
Get:25 file:/media/mario/usbrepo focal/multiverse i386 Packages [74.7 kB] 
Ign:25 file:/media/mario/usbrepo focal/multiverse i386 Packages 
Get:26 file:/media/mario/usbrepo focal/multiverse Translation-en [104 kB] 
Ign:26 file:/media/mario/usbrepo focal/multiverse Translation-en 
Get:27 file:/media/mario/usbrepo focal/multiverse amd64 DEP-11 Metadata [48.4 kB] 
Ign:27 file:/media/mario/usbrepo focal/multiverse amd64 DEP-11 Metadata 
Get:28 file:/media/mario/usbrepo focal/multiverse DEP-11 48x48 Icons [23.1 kB] 
Ign:28 file:/media/mario/usbrepo focal/multiverse DEP-11 48x48 Icons 
Get:29 file:/media/mario/usbrepo focal/multiverse DEP-11 64x64 Icons [192 kB] 
Ign:29 file:/media/mario/usbrepo focal/multiverse DEP-11 64x64 Icons 
Get:30 file:/media/mario/usbrepo focal/multiverse DEP-11 64x64@2 Icons [214 B] 
Ign:30 file:/media/mario/usbrepo focal/multiverse DEP-11 64x64@2 Icons 
Get:31 file:/media/mario/usbrepo focal/multiverse DEP-11 128x128 Icons [326 kB] 
Ign:31 file:/media/mario/usbrepo focal/multiverse DEP-11 128x128 Icons 
Get:32 file:/media/mario/usbrepo focal/multiverse amd64 c-n-f Metadata [9,136 B] 
Ign:32 file:/media/mario/usbrepo focal/multiverse amd64 c-n-f Metadata 
Get:2 file:/media/mario/usbrepo focal/main i386 Packages [4,216 kB] 
Ign:2 file:/media/mario/usbrepo focal/main i386 Packages 
Get:3 file:/media/mario/usbrepo focal/main amd64 Packages [5,827 kB] 
Ign:3 file:/media/mario/usbrepo focal/main amd64 Packages 
Get:4 file:/media/mario/usbrepo focal/main Translation-en [709 kB] 
Ign:4 file:/media/mario/usbrepo focal/main Translation-en 
Get:5 file:/media/mario/usbrepo focal/main amd64 DEP-11 Metadata [2,125 kB] 
Ign:5 file:/media/mario/usbrepo focal/main amd64 DEP-11 Metadata 
Get:6 file:/media/mario/usbrepo focal/main DEP-11 48x48 Icons [154 kB] 
Err:6 file:/media/mario/usbrepo focal/main DEP-11 48x48 Icons 
  File not found - /media/mario/usbrepo/dists/focal/main/dep11/icons-48x48.tar (2: No such file or directory) 
Get:7 file:/media/mario/usbrepo focal/main DEP-11 64x64 Icons [221 kB] 
Ign:7 file:/media/mario/usbrepo focal/main DEP-11 64x64 Icons 
Reading package lists... Done 
N: Download is  performed unsandboxed as root as file  '/media/mario/usbrepo/dists/focal/InRelease' couldn't be accessed by  user '_apt'. - pkgAcquire::Run (13: Permission denied) 
E: Failed  to fetch  file:/media/mario/usbrepo/dists/focal/main/dep11/icons-48x48.tar  File  not found - /media/mario/usbrepo/dists/focal/main/dep11/icons-48x48.tar  (2: No such file or directory) 
E: Some index files failed to download. They have been ignored, or old ones used instead.
Confounded, I create a new test destination in sources.list. And I copy the repo to it, with its exact folder structure, to my Desktop.
Code:
#deb [trusted=yes] file:///var/www/html/localrepo focal main restricted universe multiverse
#deb [trusted=yes] file:///media/mario/usbrepo focal main restricted universe multiverse
deb [trusted=yes] file:///home/mario/Desktop/testrepo focal main restricted universe multiverse
And it works, flawlessly.
Code:
Get:1 file:/home/mario/Desktop/testrepo focal InRelease [265 kB] 
Get:1 file:/home/mario/Desktop/testrepo focal InRelease [265 kB] 
. . . . . 
Get:28 file:/home/mario/Desktop/testrepo focal/multiverse DEP-11 48x48 Icons [23.1 kB] 
Get:29 file:/home/mario/Desktop/testrepo focal/multiverse DEP-11 64x64 Icons [192 kB] 
Get:30 file:/home/mario/Desktop/testrepo focal/multiverse DEP-11 64x64@2 Icons [214 B] 
Get:31 file:/home/mario/Desktop/testrepo focal/multiverse DEP-11 128x128 Icons [326 kB] 
Get:32 file:/home/mario/Desktop/testrepo focal/multiverse amd64 c-n-f Metadata [9,136 B] 
Reading package lists... Done
Building dependency tree        
Reading state information... Done 
All packages are up to date.
But it fails with the earlier errors when I aim sources.list back to the usb drive.
Code:
Get:1 file:/media/mario/usbrepo focal InRelease [265 kB] 
Get:1 file:/media/mario/usbrepo focal InRelease [265 kB] 
. . . . .
Get:5 file:/media/mario/usbrepo focal/main amd64 DEP-11 Metadata [2,125 kB] 
Ign:5 file:/media/mario/usbrepo focal/main amd64 DEP-11 Metadata 
Get:6 file:/media/mario/usbrepo focal/main DEP-11 48x48 Icons [154 kB] 
Err:6 file:/media/mario/usbrepo focal/main DEP-11 48x48 Icons 
  File not found - /media/mario/usbrepo/dists/focal/main/dep11/icons-48x48.tar (2: No such file or directory) 
Get:7 file:/media/mario/usbrepo focal/main DEP-11 64x64 Icons [221 kB] 
Ign:7 file:/media/mario/usbrepo focal/main DEP-11 64x64 Icons 
Reading package lists... Done 
N: Download is performed unsandboxed as root as file '/media/mario/usbrepo/dists/focal/InRelease' couldn't be accessed by user '_apt
'. - pkgAcquire::Run (13: Permission denied) 
E: Failed to fetch file:/media/mario/usbrepo/dists/focal/main/dep11/icons-48x48.tar  File not found - /media/mario/usbrepo/dists/foc
al/main/dep11/icons-48x48.tar (2: No such file or directory) 
E: Some index files failed to download. They have been ignored, or old ones used instead.
I see a permission denied notification. I have chowned the drive to root:root then I tried mario:mario. I chmoded the drive to 777. It's been reformatted from ext4, to ntfs, to exfat.
Same exact notifaction that denies permission. Same errors claiming that icon files are missing.

What the HELL am I doing wrong??
The filepaths are correct! The god damn repo works! There are NO ownership or control restrictions on ANY of the folders or files within the repo! I have tried a different usb drive. I have tried a different port.
What am I missing???

Does apt simply not work with usb drives? Is this a bug I should report?
What am I doing wrong?

(There are long breaks in the code blocks identified with ". . . . ." this was manually done by me in the forums to remove redundant information and stay within post character limits.)

TL;DR
Local, offline repository works successfully.
Local, offline usb repository does not sync metadata correctly despite being an exact duplicate of the local offline repo. When sources.list is aimed at the usb repo it reports being unable to see files that ARE there.
I have no idea why this is happening.

Last edited by MarioLawrence; 01-29-2024 at 08:57 AM. Reason: TL;DR added.
 
Old 01-29-2024, 01:21 PM   #2
MarioLawrence
LQ Newbie
 
Registered: Jan 2024
Location: Richmond, Virginia
Distribution: Kubuntu
Posts: 7

Original Poster
Rep: Reputation: 0
UPDATE: January 29, 2024

There seems to be consistency with apt being unable to read files that are present on an external device. I figured I would test this theory if the data remains local, but the operating system believes that it's an external device.

I made an .iso file (krepo.iso) of my operational local repository, using mkisofs with the following command. These conditionals ensured that the correct filenames were preserved during .iso creation.
Code:
sudo mkisofs -R -relaxed-filenames -joliet-long -iso-level 3 -l -o /home/mario/Desktop/krepo.iso /var/www/html/localrepo/
I then mounted that .iso to a temp directory on the root directory. Having the OS assume it's a CDROM.
Code:
sudo mount /home/mario/Desktop/krepo.iso /repo/ -oloop
Now I get a different error, but the same KIND of error.
Code:
File not found - /repo/dists/focal/main/binary-i386/Packages (2: No such file or directory)
Get:4 file:/repo focal/main amd64 Packages [5,827 kB]  
Reading package lists... Done                                      
E: Failed to fetch file:/repo/dists/focal/main/binary-i386/Packages  File not found - /repo/dists/focal/main/binary-i386/Packages (2: No such file or directory)
E: Some index files failed to download. They have been ignored, or old ones used instead.
But the files ARE there.
Code:
/repo/dists/focal/main/binary-i386$ ls -l
total 1612
drwxr-xr-x 3 root root   2048 Jan 22 10:58 by-hash
-rw-r--r-- 1 root root 930115 Jan 22 10:58 Packages.gz
-rw-r--r-- 1 root root 717660 Jan 22 10:58 Packages.xz
-rw-r--r-- 1 root root     94 Jan 22 10:58 Release
The only thing that has seemed to change is that I don't seem to get a permissions issue with the InRelease file.

Does anyone have any ideas?

Last edited by MarioLawrence; 01-29-2024 at 01:36 PM.
 
Old 01-30-2024, 09:47 AM   #3
MarioLawrence
LQ Newbie
 
Registered: Jan 2024
Location: Richmond, Virginia
Distribution: Kubuntu
Posts: 7

Original Poster
Rep: Reputation: 0
UPDATE: January 30,2024

I have added an architecture parameter to the deb source in the sources.list.

Code:
deb [arch=amd64 trusted=yes] file:/repo focal main restricted universe multiverse
And apt gave the following output.

Code:
Get:1 file:/repo focal InRelease [265 kB]
Get:1 file:/repo focal InRelease [265 kB]
Ign:1 file:/repo focal InRelease
Get:2 file:/repo focal Release [263 kB]
Get:2 file:/repo focal Release [263 kB]
Ign:2 file:/repo focal Release
Get:3 file:/repo focal/main all Packages
Ign:3 file:/repo focal/main all Packages
. . . . .
Get:39 file:/repo focal/multiverse amd64 Packages [729 kB]
Get:41 file:/repo focal/multiverse Translation-en
Ign:41 file:/repo focal/multiverse Translation-en
Reading package lists... Done    
Building dependency tree       
Reading state information... Done
All packages are up to date.
It's working.
I have no idea WHY this worked... other than, 'Apt is ignoring anything binary-i386 related.'

But the same parameter added to a usb destination does not yield different results. The errors persist.
I will have to test if the .iso can be run off of a usb.

If it CAN be run successfully from a usb... then I'll dare to mark this as solved, and I will request necessary tags be added to it to help future users.

For now, we continue investigating.

I legtimately do not understand why this parameter makes a difference.
You're not going to install packages for an unintended architecture unless the package(s) are misorganized. Apt is only going to aim at packages that match your system's architecture regardless.
And I want it to have the option to pull an i386 dependency if a package needs it.

This... feels like a non-solution.

I need the usb repo to have the same flexibility as a standard network mirror.

Last edited by MarioLawrence; 01-30-2024 at 09:54 AM.
 
Old 01-30-2024, 01:16 PM   #4
MarioLawrence
LQ Newbie
 
Registered: Jan 2024
Location: Richmond, Virginia
Distribution: Kubuntu
Posts: 7

Original Poster
Rep: Reputation: 0
It works.

A properly configured repository turned into an .iso file can be successfully mounted to a predetermined point, and run from an external device like a usb. (Obviously, otherwise Live media installations wouldn't work.)

While I cannot determine why it seems that the .iso format is necessary, nor why the architecture parameter 'arch=amd64' was necessary to get it to work... it appears to be a working solution.

SUMMARY:

- Build your repo using apt-mirror or whatever you prefer.
- Verify your metadata is in order with properly generated InRelease, Release, and Package files.
- Download/Mirror your desired deb files.
- Create an .iso file of your entire repository.
- Place the .iso file IN your desired usb drive. And ensure your permissions allow it to be run.
- Mount the .iso file to your desired directory.
- Target your sources.list to wherever you mounted your .iso file. And ensure the deb line has an appropriate architecture parameter (e.g. amd64, i386, etc.).
- Update apt.

This was two migraines.
I came. I saw. I conquered.

I'll mark this as Solved for now, and provided updates accordingly.
 
Old 02-14-2024, 02:47 PM   #5
MarioLawrence
LQ Newbie
 
Registered: Jan 2024
Location: Richmond, Virginia
Distribution: Kubuntu
Posts: 7

Original Poster
Rep: Reputation: 0
UPDATE: February 14, 2024

I think I've managed to optimize this process a bit.

Building a repo and generating metadata seems to be problematic with apt-mirror. So I tried a 3rd party application called "aptly". Important to note, support for aptly is... limited. And the only evidence it's alive are the occasional commits I see on the aptly-dev github. (Only one person has contributed this year so far, "neolynx". Most others have not touched the project in a year or more, according to their commit page.)
As such, if you want to use aptly to help you create a local usb repository that pretty much any apt-based linux system can use, there are a two minor hurdles to overcome. Aptly, as of the time of this post I used aptly version 1.3 (the version available in Ubuntu official repos) to complete my tasks. Github shows aptly version 1.5 as the latest.
  • Version 1.3 does not have the ability to read and create metadata for z-standard compressed files.
  • Version 1.3 does not have the ability to properly read gpg2 generated keys.
  • Version 1.3 does not have the ability to publish a snapshot with multiple repo components IDENTIFIED (although access to the desired .deb files is STILL there).
  • Version 1.3 does not have the ability to properly ask for your gpg passphrase when publishing your snapshots and repos. (The workaround is to temporarily remove your passphrase, publish your repo/snapshot, and then reapply your passphrase before making your repo/snapshot available for Users.
  • I have NOT tested version 1.5 for these failures.

Let's get started.

Code:
sudo apt update
sudo apt install aptly
Create your mirror.
Code:
aptly mirror create <name> <archive url> <distribution> [<component1> ...]
Example for 64-bit Ubuntu 20.04 assuming you want all components.
Code:
aptly -architectures="amd64" mirror create focal-main http://archive.ubuntu.com/ubuntu focal main restricted universe multiverse
If you, for example, want the full catalog of for focal (focal-updates, focal-security, etc.) then you will swap "focal" in the command above for the desired one. And pick and choose your preferred components. If you're feeling yourself, so to speak, you can open multiple terminals and run each mirror creation concurrently. Please note, this particular command will download over 400GB of data. Additional steps that create and publish snapshots and the .iso creation, will practically DOUBLE that size. These are big boy numbers. Make sure your internet connection and working hard drive are up for handling these tasks.

Then we tell the mirrors to update, and this will be the long part.
Code:
aptly mirror update your-mirror-name
Ubuntu example.
Code:
aptly mirror update focal-main
Once your mirrors are complete you will verify them and then create snapshots.
Verify.
Code:
aptly mirror show <name>
My 20.04 example. You should get something similar to this, that confirms the components you downloaded, and the architectures (assuming you specified any).
Code:
$aptly mirror show focal-main 
Name: focal-main
Archive Root URL: http://archive.ubuntu.com/ubuntu/
Distribution: focal
Components: main, restricted, universe, multiverse
Architectures: amd64
Download Sources: no
Download .udebs: no
Last update: 2024-02-13 16:48:25 UTC
Number of packages: 60252

Information from release file:
Acquire-By-Hash: yes
Architectures: amd64 arm64 armhf i386 ppc64el riscv64 s390x
Codename: focal
Components: main restricted universe multiverse
Date: Thu, 23 Apr 2020 17:33:17 UTC
Description:  Ubuntu Focal 20.04

Label: Ubuntu
Origin: Ubuntu
Suite: focal
Version: 20.04
Then create immutable snapshot.
Code:
aptly snapshot create <name> from mirror <mirror-name>
Example for the 20.04 repo we just downloaded.
Code:
aptly snapshot create focal-main-snapshot from mirror focal-main
At this point you will need to generate a passwordless gpg1 key, and save it to your preferred keychain. (If you are NOT publishing this repository online, or for other people to have access to it then the password on the key is not strictly necessary. This key can be specifically created, and even given it's own keychain specifically for aptly offline-publishing functionality.)
Code:
gpg1 --gen-key
Note "gpg1" and gpg version on output. This is *necessary* for aptly version 1.3.
Code:
$ gpg1 --gen-key
gpg (GnuPG) 1.4.23; Copyright (C) 2015 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Please select what kind of key you want:
   (1) RSA and RSA (default)
   (2) DSA and Elgamal
   (3) DSA (sign only)
   (4) RSA (sign only)
Your selection?
If you know what you're doing, select the one you want. If you don't know what you're doing, press 1 and hit enter.
Then enter 4096 because why the fuck not.
Code:
Your selection? 1
RSA keys may be between 1024 and 4096 bits long.
What keysize do you want? (2048)
Now select the lifetime of the key. For my example, I am selecting 1 day since this key is only being produced for the purposes of this post. Pay attention to what you are doing here now. You will input the NUMBER for how many you want, THEN the letter to specify how many of WHAT you want. Numbers without letters are automatically assumed to be days!!! For example, "3" is 3 DAYS. "3w" is 3 WEEKS. "3m" is 3 MONTHS. "3y" is 3 YEARS.
Code:
Requested keysize is 4096 bits
Please specify how long the key should be valid.
         0 = key does not expire
      <n>  = key expires in n days
      <n>w = key expires in n weeks
      <n>m = key expires in n months
      <n>y = key expires in n years
Key is valid for? (0)
You will verify Yes, by typing y and hitting Enter. Because it defaults to No.
Next you will provide it necessary arbitrary information to facilitate function with other people. Put whatever you want in the requested fields if this key will never be used or requested by others.
(If it will be used by other people and you will be using this in some sort of professional capacity, then I do recommend providing real identifier information so that you can be reached.) Whatever you put in the comments, ensure that it's something to remind you what the key is actually for.
Assuming you followed the prompts you will end up here:
Code:
You selected this USER-ID:
    "Mario Lawrence (Lawrence Industries, Inc. Focal Repository Publishing Key) <mario.lawrence@email.com>"

Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? O
You need a Passphrase to protect your secret key.

Enter passphrase:
At this point simply press Enter. And do NOT enter a passphrase.
GPG will bitch and moan (a little) about no password being a bad idea. Ignore this and just drag a window around real fast to generate some entropy. It should output your key information in short order. We're done with GPG.

Now we can get back to aptly.
You will now publish your snapshot.
Code:
aptly publish snapshot <name> [[<endpoint:>]<prefix>]
Ubuntu example. NOTE. For aptly version 1.3 the following DOES NOT work.
Code:
aptly publish snapshot -architectures="amd64" -distribution="focal" -component="main,restricted,universe,multiverse" focal-main-snapshot
You will not be able to publish all your components properly. I'm uncertain why this is the case. I'm fairly certain I followed aptly's documentation correctly. So, if you can overlook my hubris, I think this is a bug for version 1.3. But you will see however the applications under the additional components are infact still available to apt!
So you will publish with the command as follows, NOT specifying a component.
Code:
aptly publish snapshot -architectures="amd64" -distribution="focal" focal-main-snapshot
This process will take similarly long to creating the mirror.
When it's complete you will navigate to the default aptly folder /home/user/.aptly/public/ and here you will find the structure that apt will invoke when used.

Now we will make this exactly folder structure an .iso file! If you do not have sufficient space on your hard drive for an additional 400+GB of data, then I recommend connecting the usb drive that you intend to turn into the repo. Depending on your distribution, when it's connected it will automount (on ubuntu-based systems this is typically /media/user/).

You will now perform the final step of the creation. Now creating an iso file that respects the folder structure and filenames thankfully isn't too complicated, but required me to look through the documentation very carefully.

Here's the required command:
Code:
mkisofs -R -relaxed-filenames -joliet-long -iso-level 3 -l -o /path/to/your/usb/drive/desired-iso-name.iso /home/user/.aptly/public/
This command should ensure that your exact filename structure is maintained, and it will provide you with continuous progress. See "man mkisofs" for more information.

That's it. You've successfully created an offline usb ubuntu repo!

If you want to test the repo, be sure to backup and modify your /etc/apt/sources.list file. Comment out your other sources and add a line that says...
Code:
deb [arch=amd64 trusted=yes] file:/path/to/your/usb/drive focal main
Save your changes and run apt.
Code:
sudo apt update
You will likely see it complain about the GPG key. This is fine to ignore (unless you plan to publish the repo to others), in which case you can simply apt --add-key. (Which I think going into, is beyond the scope of my intent.)
Thanks guys. I hope this helps someone in the future!

Last edited by MarioLawrence; 02-14-2024 at 03:25 PM. Reason: Horrible typos and continuity issues.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Trouble during creation of an offline usb Apt Kubuntu 20.04 (focal) repository. MarioLawrence Linux - Newbie 1 01-26-2024 12:53 PM
[SOLVED] apt-offline fails to install updates to offline computer with ERROR: Failed to unlink /var/lib/apt/lists/partial/ JoLinuxUser Ubuntu 9 09-12-2019 08:11 AM
yum Error: Cannot retrieve repository metadata (repomd.xml) for repository: base. glowe Linux - Newbie 8 01-13-2016 10:55 PM
Error: Cannot retrieve repository metadata (repomd.xml) for repository: atrpms. stioanid Linux - Software 3 12-13-2008 01:22 AM
Package Kit Error-- "Cannot retrieve repository metadata (repomd.xml) for repository" mbvpixies78 Linux - Newbie 11 08-22-2008 07:20 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu

All times are GMT -5. The time now is 11:38 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration