Welcome to the Linux Foundation Forum!

Exercise 34.5: Recovering Using the Install Image on Debian/Ubuntu

Hi,

I'm sorry if I ask even one more question again. But Exercise 34.5 is only explaining the recovery of the packet on RedHat-based systems. Unfortunately I was not able to transfer the commands to Ubuntu and recover the Package from the according image. I can mount the Ubuntu install media in the rescue environment, but cannot find the requested zsh package:
alu@ubuntu-dt-vm:~$ find /media/ -name 'zsh'
alu@ubuntu-dt-vm:~$

What I found is:
alu@ubuntu-dt-vm:/media/alu/Ubuntu 24.04.1 LTS amd64/dists/noble/main/binary-amd64$ ls -lh
total 52K
-r--r--r-- 1 alu alu 52K Aug 27 18:22 Packages.gz

Which I guess is only a reference file or something?

By the way, the image is the full 6.2 GB Ubuntu Desktop 24.04 image.

Thanks,
Urs

Comments

  • Hi Urs,

    In that case you can use 'dpkg -i <package_name.deb>' with the full path, for the associated deb file you are going to install by hand. In the case of Debian, the zsh tool is available as well. The thing is that in the DVD iso for Ubuntu I can't find the zsh tool. But you can mount the iso file and search for ".deb" files, as follows:

    luis@selinuxbox:~$ find /media/cdrom/ -name "*.deb"
    /media/cdrom/pool/main/a/amd64-microcode/amd64-microcode_3.20231019.1ubuntu2_amd64.deb
    /media/cdrom/pool/main/b/b43-fwcutter/b43-fwcutter_1%3a019-11build1_amd64.deb
    /media/cdrom/pool/main/b/bcache-tools/bcache-tools_1.0.8-5build1_amd64.deb
    /media/cdrom/pool/main/b/binutils/binutils_2.42-4ubuntu2_amd64.deb
    /media/cdrom/pool/main/b/binutils/binutils-common_2.42-4ubuntu2_amd64.deb
    /media/cdrom/pool/main/b/binutils/binutils-x86-64-linux-gnu_2.42-4ubuntu2_amd64.deb
    /media/cdrom/pool/main/b/binutils/libbinutils_2.42-4ubuntu2_amd64.deb
    /media/cdrom/pool/main/b/binutils/libctf0_2.42-4ubuntu2_amd64.deb
    /media/cdrom/pool/main/b/binutils/libctf-nobfd0_2.42-4ubuntu2_amd64.deb
    /media/cdrom/pool/main/b/binutils/libgprofng0_2.42-4ubuntu2_amd64.deb

    [...]

    That's on Debian 12. The thing is to find a simple package that doesn't require dependencies to install, but you can try.

    Another way to make this work for Debian/Ubuntu, is to copy the zsh .deb file to the USB stick (and all its dependencies as well), so when you rescue the system, you can have the right packages to install.

    Regards,
    Luis.

  • albiurs
    albiurs Posts: 49

    Hi Luis,

    Thank you very much. With the Debian iso I managed it to install the according zsh packages.

    In calse someone else will have to do that too, or you consider to update this course, these are the steps which I made:

    1. Downloading the latest full Debian iso.
    2. Booting into the Ubuntu install media.
    3. Open the terminal and do as follows.
    ubuntu@ubuntu:~$ lsblk
    NAME                      MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
    loop0                       7:0    0   1.6G  1 loop /rofs
    loop1                       7:1    0   471M  1 loop 
    loop2                       7:2    0 874.4M  1 loop 
    loop3                       7:3    0     4K  1 loop /snap/bare/5
    loop4                       7:4    0 269.8M  1 loop /snap/firefox/4793
    loop5                       7:5    0  10.7M  1 loop /snap/firmware-updater/127
    loop6                       7:6    0 505.1M  1 loop /snap/gnome-42-2204/176
    loop7                       7:7    0  38.8M  1 loop /snap/snapd/21759
    loop8                       7:8    0  74.3M  1 loop /snap/core22/1564
    loop9                       7:9    0   500K  1 loop /snap/snapd-desktop-integration/178
    loop10                      7:10   0 149.6M  1 loop /snap/thunderbird/507
    loop11                      7:11   0 116.8M  1 loop /snap/ubuntu-desktop-bootstrap/237
    loop12                      7:12   0  10.5M  1 loop /snap/snap-store/1173
    loop13                      7:13   0  91.7M  1 loop /snap/gtk-common-themes/1535
    sr0                        11:0    1   5.8G  0 rom  /cdrom
    sr1                        11:1    1   3.7G  0 rom  
    vda                       253:0    0   128G  0 disk 
    ├─vda1                    253:1    0     1M  0 part 
    ├─vda2                    253:2    0     2G  0 part 
    └─vda3                    253:3    0   126G  0 part 
      └─ubuntu--vg-ubuntu--lv 252:0    0   126G  0 lvm  
    ubuntu@ubuntu:~$ cd /mnt
    ubuntu@ubuntu:/mnt$ sudo mkdir sr{0,1} sysimage
    ubuntu@ubuntu:/mnt$ ls
    sr0  sr1  sysimage
    ubuntu@ubuntu:/mnt$ sudo su
    root@ubuntu:/mnt# mount /dev/sr0 /mnt/sr0
    mount: /mnt/sr0: WARNING: source write-protected, mounted read-only.
    root@ubuntu:/mnt# mount /dev/sr1 /mnt/sr1
    mount: /mnt/sr1: WARNING: source write-protected, mounted read-only.
    root@ubuntu:/mnt# vgscan
      Found volume group "ubuntu-vg" using metadata type lvm2
    root@ubuntu:/mnt# vgchange -ay
      1 logical volume(s) in volume group "ubuntu-vg" now active
    root@ubuntu:/mnt# lvs
      LV        VG        Attr       LSize    Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
      ubuntu-lv ubuntu-vg -wi-a----- <126.00g                                                    
    root@ubuntu:/mnt# lvdisplay 
      --- Logical volume ---
      LV Path                /dev/ubuntu-vg/ubuntu-lv
      LV Name                ubuntu-lv
      VG Name                ubuntu-vg
      LV UUID                w50odd-lx32-TSbE-KtHx-tXiO-5nzY-DBx7iB
      LV Write Access        read/write
      LV Creation host, time ubuntu, 2024-10-29 07:36:06 +0000
      LV Status              available
      # open                 0
      LV Size                <126.00 GiB
      Current LE             32255
      Segments               1
      Allocation             inherit
      Read ahead sectors     auto
      - currently set to     256
      Block device           252:0
    
    root@ubuntu:/mnt# mount /dev/ubuntu-vg/ubuntu-lv /mnt/sysimage/
    root@ubuntu:/mnt# ls
    sr0  sr1  sysimage
    root@ubuntu:/mnt# cd sr1
    root@ubuntu:/mnt/sr1# ls
    boot    dists  firmware     isolinux    pool                 README.mirrors.txt
    css     doc    install      md5sum.txt  README.html          README.source
    debian  EFI    install.amd  pics        README.mirrors.html  README.txt
    root@ubuntu:/mnt/sr1# find . -name '*zsh*'
    ./pool/main/z/zsh
    ./pool/main/z/zsh/zsh_5.9-4+b5_amd64.deb
    ./pool/main/z/zsh/zsh-common_5.9-4_all.deb
    root@ubuntu:/mnt/sr1# dpkg --root=/mnt/sysimage/ --install /mnt/sr1/pool/main/z/zsh*.deb
    dpkg: error: cannot access archive '/mnt/sr1/pool/main/z/zsh*.deb': No such file or directory
    root@ubuntu:/mnt/sr1# dpkg --root=/mnt/sysimage/ --install /mnt/sr1/pool/main/z/zsh/zsh*.deb
    Selecting previously unselected package zsh.
    (Reading database ... 211566 files and directories currently installed.)
    Preparing to unpack .../z/zsh/zsh_5.9-4+b5_amd64.deb ...
    Unpacking zsh (5.9-4+b5) ...
    Selecting previously unselected package zsh-common.
    Preparing to unpack .../z/zsh/zsh-common_5.9-4_all.deb ...
    Unpacking zsh-common (5.9-4) ...
    Setting up zsh-common (5.9-4) ...
    Setting up zsh (5.9-4+b5) ...
    Processing triggers for debianutils (5.17build1) ...
    Processing triggers for man-db (2.12.0-4build2) ...
    root@ubuntu:/mnt/sr1#
    
    1. Remove the Ubuntu install media and reboot the system.

    Thanks again, Luis!

    Best wishes,
    Urs

  • Hi Urs, it's a pleasure! I'm glad you were able to do it on Ubuntu/Debian.

    Regards,
    Luis.

Categories

Upcoming Training