§2023-09-14

To restart with a new Portage database in Gentoo, you'll need to perform a few steps. Please note that this process will remove your existing Portage database and start fresh. Make sure you have backups of any important data and configurations before proceeding. Here's how you can do it:

¶ 1. Backup Your Configuration:

# cp -rv /etc/portage /etc/portage_backup
'/etc/portage' -> '/etc/portage_backup'
'/etc/portage/profile' -> '/etc/portage_backup/profile'
'/etc/portage/profile/package.use.force' -> '/etc/portage_backup/profile/package.use.force'
'/etc/portage/make.conf' -> '/etc/portage_backup/make.conf'
'/etc/portage/package.mask' -> '/etc/portage_backup/package.mask'
'/etc/portage/package.use' -> '/etc/portage_backup/package.use'
'/etc/portage/package.accept_keywords' -> '/etc/portage_backup/package.accept_keywords'
'/etc/portage/make.profile' -> '/etc/portage_backup/make.profile'

¶ 2. Remove Existing Portage Database:

# rm -rf /var/db/repos/gentoo

¶ 3. Reinitialize Portage:

# emerge --sync
>>> Syncing repository 'gentoo' into '/var/db/repos/gentoo'...
 * Using keys from /usr/share/openpgp-keys/gentoo-release.asc
 * Refreshing keys via WKD ...                                                                                                                    [ ok ]
>>> Starting rsync with rsync://89.238.71.6/gentoo-portage...
rsync: [Receiver] safe_read failed to read 1 bytes: Connection reset by peer (104)
rsync error: error in rsync protocol data stream (code 12) at io.c(282) [Receiver=3.2.7]
>>> Retrying...


>>> Starting retry 1 of 1 with rsync://[2a00:1828:a00d:ffff::6]/gentoo-portage
rsync: [Receiver] failed to connect to 2a00:1828:a00d:ffff::6 (2a00:1828:a00d:ffff::6): Network is unreachable (101)
rsync error: error in socket IO (code 10) at clientserver.c(139) [Receiver=3.2.7]
>>> Retrying...
!!! Exhausted addresses for rsync.gentoo.org

Action: sync for repo: gentoo, returned code = 1

Fix!!

[gentoo]
location = /var/db/repos/gentoo
sync-type = rsync
sync-uri = rsync://rsync.namerica.gentoo.org/gentoo-portage
auto-sync = yes
priority = 10
# emerge --sync
...
* Manifest timestamp: 2023-09-14 10:10:35 UTC
 * Valid OpenPGP signature found:
 * - primary key: DCD05B71EAB94199527F44ACDB6B8C1F96D8BF6D
 * - subkey: E1D6ABB63BFCFB4BA02FDF1CEC590EEAC9189250
 * - timestamp: 2023-09-14 10:10:35 UTC
 * Verifying /var/db/repos/gentoo/.tmp-unverified-download-quarantine ...                                                                         [ ok ]
=== Sync completed for gentoo

Action: sync for repo: gentoo, returned code = 0

¶ 4. Update @world:

# emerge --update --deep --newuse @world
....

getting wrose and worse, let'start from the beginning!!!

In summary, emerge --update --deep --newuse @world is used to upgrade and update installed packages on your system, while emerge --sync is used to refresh your local Portage tree with the latest package information from the Gentoo repository.

Reinstall Packages: You'll need to reinstall any packages that you had previously installed. This can be done manually or by using a list of packages you had before the reset. For example, if you had a list of packages in a file called packages.txt, you can reinstall them using a loop:

bash Copy code while read -r package; do emerge "$package" done < packages.txt Restore Configuration: If you made any custom configurations in /etc/portage, you can restore them from the backup created in step 1.

bash Copy code cp -r /etc/portage_backup/* /etc/portage/ Rebuild Configuration Files: After restoring your configuration files, you may need to rebuild some configuration files using the etc-update tool.

bash Copy code etc-update Rebuild Dependencies: Some packages may require you to rebuild their dependencies after reinstallation. Use the following command to rebuild any missing dependencies:

bash Copy code revdep-rebuild Update System: Finally, update your system to ensure everything is up-to-date:

bash Copy code emerge --update --deep --newuse @world Clean Up: You can remove any temporary files or logs created during this process.

bash Copy code emerge --depclean After completing these steps, your Gentoo system should have a fresh Portage database, and you should have reinstalled your desired packages. Please exercise caution when performing these actions, as they can have a significant impact on your system.