docker

Dockerfile FROM gentoo/portage:latest as portage FROM gentoo/stage3-amd64:latest COPY --from=portage /var/db/repos/gentoo /var/db/repos/gentoo ENV ACCEPT_KEYWORDS="~amd64" \ EMERGE_DEFAULT_OPTS="--jobs=4 --quiet" \ FEATURES="-sandbox -usersandbox -ipc-sandbox -network-sandbox -mount-sandbox -pid-sandbox" \ MAKEOPTS="-j4" \ USE="" RUN emerge dev-vcs/git app-portage/repoman dev-util/pkgcheck \ && rm -rf /var/cache/distfiles/* Building the image From inside the my_build directory, we’ll use the docker build command, passing the -t flag to “tag” the new image with a name, which in this case will be my_image. The . indicates that the Dockerfile is in the current directory, along with so-called “context” — that is, the rest of the files that may be in that location: ...

VirtualBox

Shrink a vdi VirtualBox disk image Run defrag in the guest (Windows only) Nullify free space: With a Linux Guest run this: cat /dev/zero > zero.fill;sync;sleep 1;sync;rm -f zero.fill With a Windows Guest, download SDelete from Sysinternals and run this: sdelete.exe c: -z Shutdown the guest VM Now run VBoxManage’s modifymedium command: On Linux: vboxmanage modifymedium disk /path/to/thedisk.vdi --compact Source: https://superuser.com/questions/529149/how-to-compact-virtualboxs-vdi-file-size Repack Windows DVD mkisofs \ -iso-level 4 \ -l \ -R \ -UDF \ -D \ -b boot/etfsboot.com \ -no-emul-boot \ -boot-load-size 8 \ -hide boot.catalog \ -eltorito-alt-boot \ -eltorito-platform efi \ -no-emul-boot \ -b efi/microsoft/boot/efisys.bin \ -o /tmp/test.iso .

Creating a new GPG key

Usefull options for .gnupg/gpg.conf # Suppress the initial copyright message no-greeting # Assume that command line arguments are given as UTF-8 strings utf8-strings # Always show long ID's and fingerprints keyid-format 0xlong with-fingerprint # Set what trust model GnuPG should follow trust-model tofu+pgp # The default key to sign with. If this option is not used, the default key is # the first key found in the secret keyring default-key 0xA06B003FC160B788 Create key and disable AEAD gpg --full-gen-key ... gpg --expert --edit-key 0xA06B003FC160B788 gpg> showpref gpg> setpref AES256 AES192 AES SHA512 SHA384 SHA256 SHA224 ZLIB BZIP2 ZIP See: https://wiki.archlinux.org/title/GnuPG#Disable_unsupported_AEAD_mechanism ...

git

clean up git git reflog expire --expire=1.minute refs/heads/master git fsck --unreachable git prune git gc git maintenance run A simple way to create git repository on a server machine connecting via ssh Create a working copy repository First, create a new local git repository and add all files within this folder. cd ˜/workshop git init git add . git commit -m "initial repository creation" Create the bare repository Then we have to create a bare repository on the server side. Let’s assume the user ralfwehner is the repository admin user on server side. For this step i will show two alternative ways: ...

Using Xephyr

$ Xephyr -ac -screen 800x600 -reset :1 & -ac : Disables access control restrictions and allows to forward the session -screen : sets the resolution of the new X session. Set it according to your need. -:1 : This specifies that the new X session is display number “1“. Your current Display is most probably “0“ -reset: Resets the X server when the last X client is closed. The Xephyr should start and you will get a blank new window. The $DISPLAY environment variable tells the X client to which X server it should send its output to. Thus, $DISPLAY controls in which X server an X application pops up. As you must have figured it out, by default, $DISPLAY is set to “:0“. ...

Unzipping a problematic archive

Nice little tip for unzipping problematic archives (.zip) from AskUbuntu.com. I downloaded a .zip archive and could not for the life of me unzip. I tried gunzip and unzip – both failed with the following errors: Gunzip $ gunzip foo.gzip gzip: foo.gzip: unknown suffix -- ignored Unzip $ unzip foo.zip Archive: foo.zip End-of-central-directory signature not found. Either this file is not a zipfile, or it constitutes one disk of a multi-part archive. In the latter case the central directory and zipfile comment will be found on the last disk(s) of this archive. unzip: cannot find zipfile directory in one of foo.zip or foo.zip.zip, and cannot find foo.zip.ZIP, period. A similar question was posted on the forum AskUbuntu.com, and one suggestion was to use jar (the Java archive tool). Although the commenter on the forum did not give the reason why to use it, another comment suggested that the trick worked. I made a copy of my .zip archive and ran it: ...

Config

Boot Kernel Command Line On boot systemd activates (by default), the target unit default.target whose job is to activate services and other units by pulling them in via dependencies. To override the unit to activate, systemd parses its own kernel command line arguments via the systemd.unit= command line option. This may be used to temporarily boot into a different boot unit. The classical run-levels are replaced as following: systemd.unit=rescue.target is a special target unit for setting up the base system and a rescue shell (similar to run level 1) systemd.unit=emergency.target, is very similar to passing init=/bin/sh but with the option to boot the full system from there systemd.unit=multi-user.target for setting up a non-graphical multi-user system systemd.unit=graphical.target for setting up a graphical login screen For details about these special systemd boot units, view the man systemd.special page. ...

Commands

replace symlinks for i in *; do link=$(readlink $i) && rm $i && mv $link $i; done permissions find /home/user -type d -print0 | xargs -0 chmod 0775 find /home/user -type f -print0 | xargs -0 chmod 0664 clean up dconf For a single key: dconf reset "/path/to/the/key" Must not end with a /. For a whole path: dconf reset -f "/path/to/the/path/" Must end with a /. If you do this while having dconf-editor opened, it will likely crash. ...

systemd-nspawn

Downloading the Stage Tarball: mkdir /var/lib/machines/gentoo-stage3-amd64 && cd /var/lib/machines/gentoo-stage3-amd64 wget https://gentoo.osuosl.org/releases/amd64/autobuilds/current-stage3-amd64-systemd/stage3-amd64-systemd-*.tar.xz tar xpvf stage3-*.tar.xz --xattrs-include='*.*' --numeric-owner Config file: gentoo-stage3-amd64.nspawn [Exec] Boot=1 PrivateUsers=off [Files] BindReadOnly=/var/db/repos BindReadOnly=/usr/src Bind=/var/cache/distfiles Bind=/var/cache/binpkgs Bind=/var/tmp/portage Set password: systemd-nspawn --settings=no -D /var/lib/machines/gentoo-stage3-amd64 passwd exit Boot and update: systemd-nspawn --machine=gentoo-stage3-amd64 emerge --metadata emerge --deep --newuse --update --ask --jobs 4 @system emerge app-shells/bash-completion systemctl poweroff make.conf PORTAGE_TMPDIR="/var/tmp" ACCEPT_LICENSE="* -@EULA" MAKEOPTS="-j8 -l9" EMERGE_DEFAULT_OPTS="--with-bdeps=y --ask --jobs=8 --load-average=9 --verbose --getbinpkg" chroot mount --types proc /proc /mnt/gentoo/proc mount --rbind /sys /mnt/gentoo/sys mount --make-rslave /mnt/gentoo/sys mount --rbind /dev /mnt/gentoo/dev mount --make-rslave /mnt/gentoo/dev chroot /mnt/gentoo /bin/bash env-update source /etc/profile export PS1="(chroot) $PS1" to install/update grub: mount /boot in chroot! ...