{"id":753,"date":"2021-10-24T13:36:12","date_gmt":"2021-10-24T12:36:12","guid":{"rendered":"https:\/\/blog.thomarite.uk\/?p=753"},"modified":"2021-10-24T20:46:52","modified_gmt":"2021-10-24T19:46:52","slug":"reinstalling-debian","status":"publish","type":"post","link":"https:\/\/blog.thomarite.uk\/index.php\/2021\/10\/24\/reinstalling-debian\/","title":{"rendered":"Reinstalling Debian"},"content":{"rendered":"\n<p>Two weeks ago I started having an issue regarding &#8220;duplicate file trigger&#8221; with some packages related to gtk-2.0 when I was doing my routine &#8220;aptitude update\/ dist-upgrade&#8221;.  I use Debian Testing and I have seen in the past weird things with packages but then got fixed. I understand I am in &#8220;testing&#8221; so these things may happen. Somehow, I tried to take a look If I could understand the problem and fix it. Searching didnt give much info. I found quite <a href=\"https:\/\/bugs.launchpad.net\/ubuntu\/+source\/dpkg\/+bug\/1017031\">old<\/a> entries about the issue but nothing really clarifying why I ended there. I assume that I am not the only one having these problems in the Debian community so it should be &#8220;easier&#8221; to find info from more experience people than me. But most of the cases, I rely on old data.<\/p>\n\n\n\n<p>Somehow I &#8220;fixed&#8221; that issue but I didnt dig enough to understand what it is this thing about &#8220;triggers&#8221;. So I messed around with &#8220;\/var\/lib\/dpkg\/triggers\/File&#8221; but I did a rookie mistake. I didnt do a backup of the file&#8230;. (how difficult is to type &#8220;cp File File-backup&#8221;). I remember that I had to remove several entries and they related to i386 architecture&#8230;.<\/p>\n\n\n\n<p>Well, then after a couple of days, I had a different issue. Not sure if this was triggered by my &#8220;triggers fix&#8221;.<\/p>\n\n\n\n<p>Somehow I had some packages failing to install due to missing dependencies. It was mainly related to &#8220;python3&#8221;. So last Saturday I decided to go deep into it&#8230; And I made things worse. When you &#8220;aptitude purge&#8221; a package, you know the package and dependencies will be removed (if they are not used). While I was trying to solve my &#8220;death by dependencies&#8221; I deleted many packages that I was sure I needed. Again, I should have stopped or at least take notes of all those packages. At the end, I ended with &#8220;just&#8221; one issue. I couldnt install python3&#8230;. no idea why. In this path of destruction, I removed most of my X11 setup, so no graphic UI for me&#8230; But I didnt notice until too late. I tried to reinstall as many packages as possible and still python3 was failing. I have pyenv and I have used python3 so not sure why\/how was broken. I reached a point that with so many changes, I had to reboot&#8230;. It is not the first time and after spending hours trying to fix something, that you are sure it is fixed, is still not fixed, then your reboot, and it is fixed. So I risked it, I knew that this would be fixed or would blow up big time. The later happened. And again, rookie mistake, I should have refreshed my hard drive backup, just in case you can&#8217;t access the laptop. But as my SSD looked healthy, the thought didnt cross my mind&#8230;<\/p>\n\n\n\n<p>Reboot, got me stuck in &#8220;lightdm can&#8217;t start&#8221;&#8230;.. and I couldnt login&#8230;. I was impatient.  As later I learnt, I should wait a bit (long) for a time out and I would have seen my prompth.<\/p>\n\n\n\n<p>I tried to get into rescue mode \/ single-user mode, and had to get by root. So I had a bit of access and I tried to run aptitude again&#8230;. I didnt have Internet access. Something I give for granted, when you login into your graphic UI, you have your nice network-manager that logs into your wifi. I always thought I was something simple like when you log into wired Internet access&#8230; I was totally wrong.<\/p>\n\n\n\n<p>I was lucky that I had Internet in my mobile phone and that helped me a lot to move forwards with each issue. Without that, I would be still writing on paper.<\/p>\n\n\n\n<p>So after a bit of struggling, I learned how to connect to a wifi via CLI. Some I was quite happy with that. I used this <a href=\"https:\/\/linuxcommando.blogspot.com\/2013\/10\/how-to-connect-to-wpawpa2-wifi-network.html\">link<\/a>. Thanks to the author!<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>1) Find out the wireless device name.\n# iw dev\nphy#0\n\tUnnamed\/non-netdev interface\n\t\twdev 0x5\n\t\taddr 60:57:18:00:9d:8a\n\t\ttype P2P-device\n\t\ttxpower 0.00 dBm\n\tInterface wlp2s0\n\t\tifindex 2\n.....\n\n2) Check status of wireless interface.\n# ip link show wlp2s0\n2: wlp2s0: (BROADCAST,MULTICAST) mtu 1500 qdisc noop state DOWN mode DEFAULT qlen 1000\n    link\/ether aa:aa:aa:aa:aa:aa brd ff:ff:ff:ff:ff:ff\n\n3) Bring up interface if you dont see \"UP\"\n# sudo ip link set wlp2s0 up  \n\n# ip link show wlp2s0\n2: wlp2s0: (NO-CARRIER,BROADCAST,MULTICAST,UP) mtu 1500 qdisc mq state DOWN mode DEFAULT qlen 1000\n    link\/ether aa:aa:aa:aa:aa:aa brd ff:ff:ff:ff:ff:ff\n\n4) Check the connection status.\n# iw wlp2s0 link\nNot connected.\n\n5) Scan to find your local wifi. You need to search for the SSID that you want to connect. This can be a long sentence...\n# iw wlp2s0 scan\n....\nBSS bb:bb:bb:bb:bb:bb(on wlp2s0) -- associated\n\tlast seen: 136826.740s &#91;boottime]\n\tTSF: 10582137299 usec (0d, 02:56:22)\n\tfreq: 5620\n\tbeacon interval: 100 TUs\n\tcapability: ESS Privacy SpectrumMgmt APSD (0x0911)\n\tsignal: -76.00 dBm\n\tlast seen: 12 ms ago\n\tInformation elements from Probe Response frame:\n\tSSID: ZZZZZZ PROVIDER SPEED PRODUCT 10Ghz\n\tSupported rates: 6.0* 9.0 12.0* 18.0 24.0* 36.0 48.0 54.0 \n\tDS Parameter set: channel 124\n\tHT capabilities:\n\t\tCapabilities: 0x0f\n\t\t\tRX LDPC\n\t\t\tHT20\/HT40\n\t\t\tSM Power Save disabled\n\t\t\tNo RX STBC\n\t\t\tMax AMSDU length: 3839 bytes\n\t\t\tNo DSSS\/CCK HT40\n\t\tMaximum RX AMPDU length 65535 bytes (exponent: 0x003)\n\t\tMinimum RX AMPDU time spacing: 4 usec (0x05)\n\t\tHT RX MCS rate indexes supported: 0-15, 32\n\t\tHT TX MCS rate indexes are undefined\n\tHT operation:\n\t\t * primary channel: 124\n\t\t * secondary channel offset: above\n\t\t * STA channel width: any\n\t\t * RIFS: 0\n\t\t * HT protection: no\n\t\t * non-GF present: 1\n\t\t * OBSS non-GF present: 0\n\t\t * dual beacon: 0\n\t\t * dual CTS protection: 0\n\t\t * STBC beacon: 0\n\t\t * L-SIG TXOP Prot: 0\n\t\t * PCO active: 0\n\t\t * PCO phase: 0\n\tRSN:\t * Version: 1\n\t\t * Group cipher: CCMP\n\t\t * Pairwise ciphers: CCMP\n\t\t * Authentication suites: PSK\n\t\t * Capabilities: 1-PTKSA-RC 1-GTKSA-RC (0x0000)\n......\n\tWPS:\t * Version: 1.0\n\t\t * Wi-Fi Protected Setup State: 2 (Configured)\n\t\t * Response Type: 3 (AP)\n\t\t * UUID: bc329e00-1dd8-11b2-8601-38549b39bdd4\n\t\t * Manufacturer: ABCD\n\t\t * Model: ABCD GateWay\n\t\t * Model Number: V1.0\n\t\t * Serial Number: 12345678\n\t\t * Primary Device Type: ABABABAB\n\t\t * Device name: ABCD AP\n\t\t * Config methods: PBC, Keypad\n\t\t * RF Bands: 0x2\n\t\t * Version2: 2.0\n.....\n\nAs the blog mentions, the two important things here are SSID and RSN\/WPS. I dont think it is common these days to find WEP Wifi. Connecting to a WEP it is far much easier.\n\n\n6) Connect to WPA\/WPA2 WiFi network: Generate wpa_supplicant config file\nGenerate a configuration file for wpa_supplicant that contains the pre-shared key (\"passphrase\") for the WiFi network.\n\n# wpa_passphrase \"ZZZZZZ PROVIDER SPEED PRODUCT 10Ghz\" &gt;&gt; \/etc\/wpa_supplicant.conf \n...type in the passphrase and hit enter...\n\nwpa_passphrase takes the SSID as the single argument. You must type in the passphrase for the WiFi network after you run the command. Using that information, wpa_passphrase will output the necessary configuration statements to the standard output. Those statements are appended to the wpa_supplicant configuration file located at \/etc\/wpa_supplicant.conf.\n\n# cat \/etc\/wpa_supplicant.conf \n# reading passphrase from stdin\nnetwork=\n\tssid=\"ZZZZZZ PROVIDER SPEED PRODUCT 10Ghz\"\n\t#psk=\"mytest123\"\n\tpsk=aaaaaasuperlongkeybbbbbbbbbbbbbbbbbbb\n}\n\n\n7) Connect using wpa_supplicant config file.\n# sudo wpa_supplicant -B -D wext -i wlp2s0 -c \/etc\/wpa_supplicant.conf\n\n-B means run wpa_supplicant in the background.\n-D specifies the wireless driver. wext is the generic driver.\n-c specifies the path for the configuration file.\n\n\n8) Verify you are attached to your Wifi SSID\n# iw wlp2s0 link\nConnected to bb:bb:bb:bb:bb:bb (on wlp2s0)\n\tSSID: ZZZZZZ PROVIDER SPEED PRODUCT 10Ghz\n\tfreq: 2412\n\tRX: 63825 bytes (471 packets)\n\tTX: 1344 bytes (12 packets)\n\tsignal: -27 dBm\n\ttx bitrate: 6.5 MBit\/s MCS 0\n\n\tbss flags:\tshort-slot-time\n\tdtim period:\t0\n\tbeacon int:\t100\n\n9) Obtain IP address by DHCP and verify IP\n# dhclient wlp2s0\n#\n# ip addr show wlp2s0\n2: wlp2s0:  mtu 1500 qdisc mq state UP qlen 1000\n    link\/ether aa:aa:aa:aa:aa:aa brd ff:ff:ff:ff:ff:ff\n    inet 192.168.1.3\/24 brd 192.168.1.255 scope global wlp2s0\n    inet6 zzz\/64 scope link \n       valid_lft forever preferred_lft forever\n\n10) Check routing \/ Add default if needed:\n# ip route show\n192.168.1.0\/24 dev wlp2s0  proto kernel  scope link  src 192.168.1.3 \n\nThe above routing table contains only 1 rule which redirects all traffic destined for the local subnet (192.168.1.x) to the wlp2s0 interface. You may want to add a default routing rule to pass all other traffic through wlp2s0 as well.\n\n# ip route add default via 192.168.1.254 dev wlp2s0\n# ip route show\ndefault via 192.168.1.254 dev wlp2s0 \n192.168.1.0\/24 dev wlp2s0  proto kernel  scope link  src 192.168.1.3 \n\n11) Check external connecitivity\n# ping 8.8.8.8\n<\/code><\/pre>\n\n\n\n<p>After being able to get Internet access I carried on troubleshooting. I was stuck with python3 issue  and now ligthdm not starting up&#8230; Using this <a href=\"https:\/\/www.debugpoint.com\/2021\/03\/failed-to-start-lightdm\/\">link<\/a>, I could see lightdm was complaining about an issue with Xorg. So then I checked the logs of Xorg.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;    34.050] (II) LoadModule: \"glx\"\n&#91;    34.050] (II) Loading \/usr\/lib\/xorg\/modules\/extensions\/libglx.so\n&#91;    34.050] (EE) Failed to load \/usr\/lib\/xorg\/modules\/extensions\/libglx.so: libGL.so.1: cannot open shared object file: No such file or directory\n&#91;    34.050] (EE) Failed to load module \"glx\" (loader failed, 0)\n<\/code><\/pre>\n\n\n\n<p>I searched for info about that error.  I followed several pages like <a href=\"https:\/\/exerror.com\/importerror-libgl-so-1-cannot-open-shared-object-file-no-such-file-or-directory\/\">this<\/a> and <a href=\"https:\/\/stackoverflow.com\/questions\/55313610\/importerror-libgl-so-1-cannot-open-shared-object-file-no-such-file-or-directo\">this<\/a>, I installed an reinstalled the packages mentioned, but not way could fix that &#8220;glx&#8221;.<\/p>\n\n\n\n<p>After sometime, I decided to work on the &#8220;python3&#8221; issue. I tried to follow some advice like <a href=\"https:\/\/itectec.com\/ubuntu\/ubuntu-broken-python-dependencies-after-trying-to-re-install\/\">this<\/a>. Again I tried to purge as many packets as I could and reinstall everything python related. Same result, I couldn&#8217;t install python3. And weird enough, my wifi used to be disconnected whenever removed python so I had reboot and attach to the wifi a couple of times. And as well, I managed to &#8220;lock&#8221; my wifi card too, so bizarre!!! I think I followed something from <a href=\"https:\/\/bbs.archlinux.org\/viewtopic.php?pid=1324810#p1324810\">here<\/a> to unlock.<\/p>\n\n\n\n<p>So I reached a point where I was totally stuck. I couldnt fix the Xorg issue and turn up the graphic desktop environment and python3 was very broken. I decided to reinstall, I was getting nowhere. I made full backup of my homedir and most of the system folders and take some logs about the current config of my system and packages currently installed so I could help me to setup the new environment quicker.<\/p>\n\n\n\n<p>So I downloaded a netinstall iso for Debian testing.  Thanks to my mobile, I managed to find the link and I &#8220;wget&#8221; it via my cli. Then I needed to install that iso in a USB so the Debian documentation was quite easy&#8230;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># cp debian-testing-amd64-netinst.iso \/dev\/sdb1\n# sync<\/code><\/pre>\n\n\n\n<p>Ok, it was time to boot up the usb and resintall&#8230;. not that easy&#8230;. my laptop was not able to see the usb at boot time&#8230;.. I checked the BIOS and USB was allowed as boot device&#8230;. Back to the shell, I could mount the USB, fdisk showed the partition had the flag enabled for booting.<\/p>\n\n\n\n<p>I decided to find another method. I was pretty sure that in the past when creating a boot USB I had to use &#8220;dd&#8221;&#8230; so following this <a href=\"https:\/\/www.pragmaticlinux.com\/2021\/03\/create-a-bootable-usb-drive-from-a-linux-iso-image\/\">link<\/a>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># dd if=debian-testing-amd64-netinst.iso of=\/dev\/sdb1 bs=4M conv=fdatasync status=progress<\/code><\/pre>\n\n\n\n<p>The I tried to boot again, and worked!!!<\/p>\n\n\n\n<p>So started the reinstall process. I chose to use the whole disk and the trigger a process to overwrite my whole disk&#8230;. I had to leave the laptop overnight because the process was superslow! I didnt know how to skip it&#8230;.<\/p>\n\n\n\n<p>Something I still haven&#8217;t learned is <strong>how to scroll up\/down in the tty <\/strong>!!!  During the whole troubleshooting time, it was quite frustrating because using &#8220;less&#8221; didnt work always with all my commands&#8230; I tried to find some answers like <a href=\"https:\/\/stackoverflow.com\/questions\/15255070\/how-do-you-scroll-up-down-on-the-console-of-a-linux-vm\">this<\/a> but no joy.<\/p>\n\n\n\n<p>Next night I follow up. Obviously the installation process didnt detect my wifi card (non-free drivers my love) and I dont have a RJ45 port&#8230; so I had to use my usb-rj45 adaptor and long rj45 cable to get back to the internet and complete the installation&#8230;<\/p>\n\n\n\n<p>Once the process finished, you end up with a very basic system&#8230; no wifi, no Xorg, just pure CLI environment.<\/p>\n\n\n\n<p>So started trying to install some packages I use more often and get my wifi card detected and working. As I had my backup, I could update my apt\/sources.list file and get the repositories I needed.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>  104  vim \/etc\/apt\/sources.list\n  105  aptitude update \n  106  aptitude dist-upgrade \n  108  aptitude install firmware-iwlwifi \n  109  lsmod | grep iw\n  110  iw list\n  116  reboot\n<\/code><\/pre>\n\n\n\n<p>I installed &#8220;lightdm&#8221; as my display manager. I finally managed to see it again! I logged in and nothing happend. I forgot to install my lightweith desktop environment&#8230; lxde.<\/p>\n\n\n\n<p>So finally, I was back to my graphic environment. But again I forgot to install the network-manager to get my Internet connectivity sorted as I was using the CLI technique before.<\/p>\n\n\n\n<p>One final issue was the sound card, I could see videos online but didnt have sound so I was pretty sure I was missing something again, &#8220;alsa-utils&#8221; and  then with &#8220;pavucontrol&#8221; I noticed the output devices were muted.<\/p>\n\n\n\n<p>So finally got basic functionality. I haven&#8217;t moved all my data yet as I need to create my ZFS partition so I will need a bit more tinkering in the coming days.<\/p>\n\n\n\n<p>This is the list of installed packages so far:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>aptitude install lightdm\naptitude install sudo\naptitude install gedit\naptitude install tcpdump\naptitude install nmap\naptitude install terminator\naptitude install gkrellm\naptitude install keepass2\naptitude install firefox-esr\naptitude install vagrant\naptitude install mutt\naptitude install screen\naptitude install tmux\naptitude install wpasupplicant \naptitude install iw\naptitude install minicom\naptitude install lxde\naptitude install pavucontrol\naptitude install libreoffice\naptitude install lstopo\naptitude install apt-file\naptitude install hwloc\naptitude install parted\naptitude install ristretto \naptitude install network-manager-gnome \naptitude install net-tools\naptitude install vim\naptitude install git\naptitude install tig\naptitude install firmware-iwlwifi \naptitude install qemu\naptitude install alsa-tools-gui \naptitude install alsa-utils \naptitude install brightnessctl \naptitude install zfs-dkms \naptitude install gkrellm-volume <\/code><\/pre>\n\n\n\n<p>Things I want to learn:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>How to setup a &#8220;timeshift&#8221; (like Apple) for backup in Debian<\/li><li>How to scroll in linux terminal tty<\/li><li>Send emails with mutt using gmail (and with attachments) so I dont need GUI.<\/li><\/ul>\n\n\n\n<p>Things I need to setup<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Have a USB ready with a Debian Testing ISO<\/li><li>How to backup my Android mobile phone and erase contents if I lose it.<\/li><li>Ideally I should rebuild my laptop more frequently so I should have a PXE-like process. Maybe having some kind of manifest in my git repo. Maybe I overthinking it.<\/li><\/ul>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Two weeks ago I started having an issue regarding &#8220;duplicate file trigger&#8221; with some packages related to gtk-2.0 when I was doing my routine &#8220;aptitude update\/ dist-upgrade&#8221;. I use Debian Testing and I have seen in the past weird things with packages but then got fixed. I understand I am in &#8220;testing&#8221; so these things &hellip; <a href=\"https:\/\/blog.thomarite.uk\/index.php\/2021\/10\/24\/reinstalling-debian\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Reinstalling Debian&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-753","post","type-post","status-publish","format-standard","hentry","category-unix"],"_links":{"self":[{"href":"https:\/\/blog.thomarite.uk\/index.php\/wp-json\/wp\/v2\/posts\/753","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.thomarite.uk\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.thomarite.uk\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.thomarite.uk\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.thomarite.uk\/index.php\/wp-json\/wp\/v2\/comments?post=753"}],"version-history":[{"count":3,"href":"https:\/\/blog.thomarite.uk\/index.php\/wp-json\/wp\/v2\/posts\/753\/revisions"}],"predecessor-version":[{"id":756,"href":"https:\/\/blog.thomarite.uk\/index.php\/wp-json\/wp\/v2\/posts\/753\/revisions\/756"}],"wp:attachment":[{"href":"https:\/\/blog.thomarite.uk\/index.php\/wp-json\/wp\/v2\/media?parent=753"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.thomarite.uk\/index.php\/wp-json\/wp\/v2\/categories?post=753"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.thomarite.uk\/index.php\/wp-json\/wp\/v2\/tags?post=753"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}