Skip to content

Ubuntu

install

package

https://chatgpt.com/share/5c29bffa-77fa-4399-8c05-82bf52b45153 Package lists in /var/lib/apt/lists/ Package cache in /var/cache/apt/archives/ Status files in /var/lib/dpkg/status

https://chatgpt.com/share/04254bb6-982d-4b57-95ad-80bba922d3e3

apt remove ansible
apt --purge autoremove

prevent kernel upgrade

apt-mark hold $(uname -r)

offiline and local repository

/etc/apt/sources.list
/etc/apt/sources.list.d/
/var/cache/apt/archives/
/usr/share/keyrings/
ls -la /var/cache/apt/archives
apt-get install --download-only abc
sudo dpkg -i *.deb
apt-cache policy
apt-cache policy rocm
apt list --installed

the Ubuntu software repository is organized into four "components" on the basis of the level of support Ubuntu can offer them and whether or not they comply with Ubuntu's Free Software Philosophy. - Main (officially supported software) - Restricted (supported software that is not available under a completely free license) - Universe (community-maintained, i.e. not officially-supported software) - Multiverse (software that is "not free").

deb repo 的 url 組成 - Ubuntu 16.04 建立 APT Mirror site – Mr. 沙先生

deb http://nginx.org/packages/mainline/ubuntu xenial nginx
xenial nginx 從 dists 後的目錄到 binary-amd64, binary-i386, source

dpkg-scanpackages --multiversion . /dev/null | gzip -9c > Packages.gz
dpkg-scanpackages --multiversion . > Packages

pinning file

  • https://chatgpt.com/share/a7e6b06d-e031-4d58-ad5c-e62d7ea394d7

for local repository

/etc/apt/sources.list.d/localrepo.list

deb [trusted=yes] file:/root/install ./

/etc/apt/preferences.d/rocm-pin-600

Package: *
Pin: origin ""
Pin-Priority: 600

apt proxy

/etc/apt/apt.conf.d/proxy.conf

Acquire::http::Proxy "http://<Proxy_Server_IP>:<Port>/";
Acquire::https::Proxy "http://<Proxy_Server_IP>:<Port>/";

Acquire::http::Proxy "http://user:password@proxy.server:port/";
Acquire::https::Proxy "https://user:password@proxy.server:port/";

dns

ISO

Netboot

debootstrap

debootstrap --arch amd64 jammy /tmp/test_ramos http://archive.ubuntu.com/ubuntu/

autoinstall

LiveCD

Test failure

apt install debootstrap mksquashfs grub-efi mtools xorriso
mkdir -p $HOME/live-ubuntu-from-scratch/target
mkdir -p $HOME/live-ubuntu-from-scratch/livecd/{casper,boot/grub,EFI/boot}
debootstrap  --include=linux-image-generic,live-boot --components=main,universe,multiverse --arch=amd64  --variant=minbase jammy $HOME/live-ubuntu-from-scratch/target  http://archive.ubuntu.com/ubuntu

cp $HOME/live-ubuntu-from-scratch/target/boot/vmlinuz-**-**-generic $HOME/live-ubuntu-from-scratch/livecd/casper/vmlinuz
cp $HOME/live-ubuntu-from-scratch/target/boot/initrd.img-**-**-generic $HOME/live-ubuntu-from-scratch/livecd/casper/initrd.img

chroot $HOME/live-ubuntu-from-scratch/target dpkg-query -W --showformat='${Package} ${Version}\n' | sudo tee $HOME/live-ubuntu-from-scratch/livecd/casper/filesystem.manifest

mksquashfs $HOME/live-ubuntu-from-scratch/target \
   $HOME/live-ubuntu-from-scratch/livecd/casper/filesystem.squashfs \
   -noappend -no-duplicates -no-recovery \
   -wildcards \
   -comp xz -b 1M -Xdict-size 100% \
   -e "var/cache/apt/archives/*" \
   -e "root/*" \
   -e "root/.*" \
   -e "tmp/*" \
   -e "tmp/.*" \
   -e "swapfile"


sudo tee $HOME/live-ubuntu-from-scratch/livecd/boot/grub/grub.cfg << EOF
search --set=root --file /casper/vmlinuz
insmod all_video
set timeout=30
menuentry "Ubuntu 22.04 Live" {
   linux /casper/vmlinuz boot=casper nopersistent toram quiet splash --
   initrd /casper/initrd.img
}
EOF
grub-mkstandalone \
  --format=x86_64-efi \
  --output=$HOME/live-ubuntu-from-scratch/livecd/EFI/boot/bootx64.efi \
  --locales="" --fonts="" \
   "boot/grub/grub.cfg=$HOME/live-ubuntu-from-scratch/livecd/boot/grub/grub.cfg"

LC_CTYPE=C bash -s << EOF
dd if=/dev/zero of=efiboot.img bs=1M count=3 && \
mkfs.vfat efiboot.img && \
mmd -i efiboot.img efi efi/boot && \
mcopy -i efiboot.img $HOME/live-ubuntu-from-scratch/livecd/EFI/boot/bootx64.efi ::efi/boot/
EOF

xorriso \
  -as mkisofs \
  -iso-level 3 \
  -full-iso9660-filenames \
  -volid "UBUNTU" \
  -output Ubuntu-22.04-LiveCD-x86_64.iso \
  -no-emul-boot -boot-load-size 4 -boot-info-table \
  --eltorito-catalog boot/grub/boot.cat \
  --grub2-boot-info \
  --grub2-mbr /usr/lib/grub/i386-pc/boot_hybrid.img \
  -eltorito-alt-boot -e EFI/efiboot.img -no-emul-boot -append_partition 2 0xef efiboot.img \
  -graft-points "livecd" "/EFI/efiboot.img=efiboot.img"

Autoinstall ISO

Debug

Ubuntu 24 subiquity apt update failed cdrom - Bug #1963725 “subiquity curtin apt-get update fails” : Bugs : subiquity package : Ubuntu - /cdrom permission - Bug #2080745 “Subiquity curtin apt-get install fails from cdrom ...” : Bugs : subiquity package : Ubuntu - Autoinstall from ISO File - Subiquity apt-get insatll fails from cdrom files - Ask Ubuntu