Suramya's Blog : Welcome to my crazy life…

June 26, 2022

Learning Bash by playing bashcrawl

Filed under: Linux/Unix Related,Tech Related — Suramya @ 9:19 PM

If you have been wanting to learn how to use a Linux/Unix commandline but find most of the tutorials too boring and dry, then I suggest you check out bashcrawl. It is a D&D type text based adventure that is actually quite fun to play. If you just want to try it out and don’t mind losing your progress then you can play it online by visiting here. Once you click Wait a few seconds to a minute until the launcher appears and then click on the Terminal icon to start.

It is pitch black in these catacombs.
You have a magickal spell that lists all items in a room.
To see in the dark, type: ls
To move around, type: cd
Try looking around this room.
Then move into one of the next rooms.


$ ls
$ cd cellar

Remember to cast “ls“ when you get into the next room!

Thanks to Hack a Day for the link.

– Suramya

April 28, 2022

Microsoft finds a Linux flaw that grants root access to untrusted users

Filed under: Computer Security,Linux/Unix Related,Tech Related — Suramya @ 11:30 AM

Now that is not a heading I thought I would ever write… I mean 20 years ago imagining that Microsoft would be working with Linux to the point where it would find and report a bug in Linux was unimaginable. For the longest time MS considered Linux to be a massive danger to it’s operations which is why former Microsoft CEO Steve Ballmer famously branded Linux “a cancer that attaches itself in an intellectual property sense to everything it touches” back in 2001. However that has now changed and Windows now has a Windows Subsystem for Linux (wsl) that allows users to run Linux programs from within Windows seamlessly.

This particular flaw which is tracked as CVE-2022-29799 and CVE-2022-29800 combine threats including directory traversal, symlink race, and time-of-check time-of-use (TOCTOU) race condition to gain root access. It was found when a Microsoft researcher Jonathan Bar Or was examining the code for a component known as “_run_hooks_for_state”. The flow to exploit would look something like the following (Thanks ARS Technica for the walkthrough):

Prepare a directory ”/tmp/nimbuspwn” and plant a symlink ”/tmp/nimbuspwn/poc.d“ to point to “/sbin”. The “/sbin” directory was chosen specifically because it has many executables owned by root that do not block if run without additional arguments. This will abuse the symlink race issue we mentioned earlier.
For every executable filename under “/sbin” owned by root, plant the same filename under “/tmp/nimbuspwn”. For example, if “/sbin/vgs” is executable and owned by root, plant an executable file “/tmp/nimbuspwn/vgs” with the desired payload. This will help the attacker win the race condition imposed by the TOCTOU vulnerability.
Send a signal with the OperationalState “../../../tmp/nimbuspwn/poc”. This abuses the directory traversal vulnerability and escapes the script directory.
The networkd-dispatcher signal handler kicks in and builds the script list from the directory “/etc/networkd-dispatcher/../../../tmp/nimbuspwn/poc.d”, which is really the symlink (“/tmp/nimbuspwn/poc.d”), which points to “/sbin”. Therefore, it creates a list composed of many executables owned by root.
Quickly change the symlink “/tmp/nimbuspwn/poc.d” to point to “/tmp/nimbuspwn”. This abuses the TOCTOU race condition vulnerability—the script path changes without networkd-dispatcher being aware.
The dispatcher starts running files that were initially under “/sbin” but in truth under the “/tmp/nimbuspwn” directory. Since the dispatcher “believes” those files are owned by root, it executes them blindly with subprocess.Popen as root. Therefore, our attacker has successfully exploited the vulnerability.

The vulnerability has been patched in the networkd-dispatcher and users running vulnerable systems should patch immediately.

Source: Microsoft finds Linux desktop flaw that gives root to untrusted users

– Suramya

April 18, 2022

Oracle releases a ‘free’ version of Oracle Solaris 11.4 for opensource developers and non-production personal use

Filed under: Linux/Unix Related,My Thoughts — Suramya @ 2:59 AM

Last month Oracle released a ‘free’ version of Oracle Solaris 11.4 for opensource developers and non-production personal use. The key point to note is that this doesn’t mean that there is a free/opensource version of the OS now available because unlike the Open Solaris project (that was released in 2008 but was discontinued) this build is a similar to a beta release and contains pre-release builds of a particular SRU (which I think means a release version). To me it sounds like they want the opensource community to perform free testing for their releases while getting some positive publicity.

I don’t think I will be trying it out because I don’t really trust Oracle. They are notorious for their bad takes and really aggressive enforcement of their IP rights. Plus their history with opensource projects has been bumpy and you never know when they will change their mind and go in a different direction.

My first experience with Unix/Linux was SunOS 4.1 followed by Solaris 5. I even had a Sparc machine at one point but it got lost during one of the many moves I made over the years. I loved the OS and since I couldn’t run it on my machines I started using Linux which was a great alternative. When OpenSolaris was released I received installation CDs to try it out, unfortunately life got in the way and I never really tested it out (other than the initial install). It was disappointing when the project went defunct & shutdown. I took a look at the OpenSolaris Wikipage and it looks like none of the derivative projects that were supposed to take over really went anywhere. So that sucks.

I don’t think that Unix does anything that Linux can’t do and even then if you want to run Unix on your machines I would recommend you go for FreeBSD instead of this ‘free’ version.

Thanks to HackaDay: Solaris Might Be Free If You Want It for the initial link.

– Suramya

April 16, 2022

Debian Project leader talks about How Debian is doing on the mailing list

Filed under: Linux/Unix Related — Suramya @ 5:28 AM

I use Debian as my primary OS and have been doing so since 2002 onwards. I switched from Redhat to Debian because RH8 was an attempt to make the OS easier for new users which meant that a lot of functionality was no longer exposed to the user without having to jump through hoops and I just didn’t like the new look and feel anymore. After looking at the available options I switched to Debian 3.0 that had released earlier that year. It worked great for the most part for me and I have been using it since. I did explore Mint and Ubuntu for a bit in the middle but have mostly been using Debian for my home systems. (Work wise most companies I have been with have been on RHEL, CentOS and Fedora).

After running for such a long time and with the constant changes over the past few years, it is obvious to wonder how the Debian project is doing and recently Jonathan Carter who is the current Debian Project Leader sent an email giving a high level overview of the current status, what went well, the current challenges and future scope. It is an interesting read and you should check it out here: Question to all candidates: how is Debian doing?.

Some of the points I found interesting are listed below:

  • The project has managed to release every 2 years since 2005
  • The finances are also really good, with over $1m in available funds
  • Debian gained secureboot support
  • The project
  • Consumer computing products are going to continue being more locked down and this is causing problems with the installers

There are more points but as Jonathan put it “I think Debian is doing ok. It’s not doing great, but it is ok. “. For me it works as I want it & how I want it so I am happy with it and it is good to know that the project is stable and will continue to be around for a while.

– Suramya

April 12, 2022

How not to ask for help on Online Forums

Filed under: Linux/Unix Related,My Thoughts — Suramya @ 1:12 AM

It is quite normal to be stuck while exploring a new operating system, or a new programming language or anything new to be honest and one of the great advantages we have now is the ability to go online & search for answers on the Internet and if you are unable to find a fix then you can request for help on forums. There are forums specific to all sorts of niche areas and some of them are quite active. I doubt that it will be a surprise to many that I am part of multiple Linux Forums and in this post I am going to talk about a specific post on one of them that is a masterclass on how not to ask questions/how not to ask for help/how to ensure your questions are never answered.

Let’s start with the post, then we can dig into each line of this gem (The first line is the subject of the post and the rest are the contents).

Linux is bad
Dear Linux users,

Here is the top 3 reasons, I think Linux is bad:
1- Hard.
2- NVIDIA drivers.
3- I don't know how to write shell scripts.

My friend told me that I don't need to, the community is very helpful.
So I thought I should test them and see if they can help me finish my simple shell homework.

Sorry for the bait. I will switch to Linux if I get help, but you probably don't care.
Hopefully there is a weirdo who will think this is fun.

I have a hard time believing this is not some troll posting crap just to get a rise out of people but if that is not the case then this goes out of it’s way to ensure people react badly to the request, so without further ado lets dig in.

Here is the top 3 reasons, I think Linux is bad:
1- Hard.
2- NVIDIA drivers.
3- I don't know how to write shell scripts.

Ok, not a great start. You are posting on a linux forum stating that it is bad because you find it hard, and don’t know how to write shell scripts. (I will partially give them the point about NVIDIA drivers because historically they have been a pain.) How is it Linux’s fault that you don’t know how to write shell scripts? Did you honestly believe that the creator of the OS should have come to your house to teach you shell scripting so that you don’t find it ‘hard’? There are multiple resources online that teach shell scripting, including some great courses on Udemy, YouTube, Coursera etc etc. All you have to do is be willing to put in the effort.

To the other point about Linux being hard, it is not. It is different than Windows and does things differently, that doesn’t make it hard. It’s just what you are used to, I use Linux for my primary OS and when I have to troubleshoot my wife’s Windows 11 laptop there is usually a lot of cursing involved. When I started with Linux it was the other way round, for the longest time I kept trying to do things the ‘Windows way’ and it didn’t always work. However, once you take time and explore the system the flexibility it gives you is fantastic. Don’t like the Desktop UI, change to a different one, don’t like the file manager, use a different one etc etc.

My friend told me that I don't need to, the community is very helpful.
So I thought I should test them and see if they can help me finish my simple shell homework.

Umm, who do you think you are that you need to test the community. Plus ‘testing’ by having them do your homework is not testing. This is called negging, where you give backhanded compliments and generally making comments that express indifference toward another person (in this case an Operating System) in an attempt to get them to go out of their way to impress you/do things for you. It is a tactic used by pickup artists to get women by putting them down so that they would go out with them/sleep with them to gain their approval. Sorry, that only works with emotionally distressed folks and not folks on a technical forum. We have no need to gain your approval.

Someone on the forum had the perfect answer for this: “The community is helpful, but you seem to have put more effort into trying to get someone else to do your homework for you, than into actually doing it yourself. We aren’t going to do your homework for you (and if you bothered to check the LQ Rules and “Question Guidelines” you’d see that), but we will help you if you’re stuck. “

Sorry for the bait. I will switch to Linux if I get help, but you probably don't care.

Yes we don’t care and why should we care that you swtich to Linux? Do you think you are someone important? This person needs to realize that they are not the center of the universe and that it is irrelevant to others if they decide to switch to Linux or not. Honestly speaking I don’t care if you use Linux or not. Linux users (for the most part) are no longer the anti-Microsoft zealots who will try to force you to use Linux. In my opinion you should use it if you like it, if you feel Windows or Mac works better for you, use that.

Hopefully there is a weirdo who will think this is fun.

What a way to encourage people to help you! As calling people names is sure to make them want to help you… Right? No? How is that possible??? I thought I was the center of the universe and all the lesser people would fall over themselves to help me as they should feel honored that I am allowing them to help me.

Nope, it doesn’t work that way. It only works like that in movies (and maybe in some of the schools/colleges) where the Jocks/popular kids are treated like divine beings and others fall over themselves to help them so that they can bask in the glory of having interacted with the cool kids. Real life doesn’t work like that and most places you will be laughed out if you try to do this nonsense at work.

If you want help it helps to be humble, talk about what you have already tried, what specific portion is giving you problems and stow the attitude.

Interestingly enough people on the forum still gave hints on how they could approach the problem and pointed them to resources that can help if they put in the effort.

What do you think? Is it ok to post for help like this? Would you answer this person if you came across the post?

Original forum post in all it’s glory: linux is bad for reference.

– Suramya

January 21, 2022

nerd-dictation: A fantastic Open Source speech to text software for Linux

After a long time of searching I finally found a speech to text software for Linux that actually works well enough that I can use it for dictating without having to jump through too many hoops to configure and use. The software is called nerd-dictation and is an open source software. It is fairly easy to setup as compared to the other voice-to-text systems that are available but still not at a stage where a non-tech savvy person would be able to install it easily. (There is effort ongoing to fix that)

The steps to install are fairly simple and documented below for reference:

  • pip3 install vosk
  • git clone
  • cd nerd-dictation
  • wget
  • unzip
  • mv vosk-model-small-en-us-0.15 model

nerd-dictation allows you to dictate text into any software or editor which is open so I can dictate into a word document or a blog post or even the command prompt. Previously I have used tried using software like which actually works quite well but doesn’t allow you to edit the text as you’re typing, so you basically dictate the whole thing and the system gives you the transcription after you are done. So, you have to go back and edit/correct the transcript which can be a pain for long dictations. This software works more like Microsoft dictate which is built into Word. Unfortunately my word install on Linux using Crossover doesn’t allow me to use the built in dictate function and I have no desire to boot into windows just so that I can dictate a document.

This downloads the software in the current directory. I set it up on /usr/local but it is up to you where you want it. In addition, I would recommend that you install one of the larger dictionaries/models which makes the voice recognition a lot more accurate. However, do keep in mind that the larger models use up a lot more memory so you need to ensure that your computer has enough memory to support the larger models. The smaller ones can run on systems as small as a raspberry pi, so depending on your system configuration you can choose. The models are available here.

The software does have some quirks, like when you are talking and you pause it will take it as a start of a new sentence and for some reason it doesn’t put a space after the last word. So unless you’re careful you need to go back and add spaces to all the sentences that you have dictated, which can get annoying. (I started manually pressing space everytime I paused to add the space). Another issue is that it doesn’t automatically capitalize the words when you dictate such as those at the beginning of the sentence or the word ‘I’. This requires you to go back and edit, but that being said it still works a lot better than the other software that I have used so far on Linux. For Windows system Dragon Voice Dictation works quite well but is expensive. I tested it out by typing out this post using it and for the most part it does work it worked quite well.

Running the software again requires you to run commands on the commandline, but I configured shortcut keys to start and stop the dictation which makes it very convenient to use. Instructions on how to configure custom shortcut keys are available here. If you don’t want to do that, then you can start the transcription by issuing the following command (assuming the software is installed in /usr/local/nerd-dictation):

/usr/local/nerd-dictation/nerd-dictation begin --vosk-model-dir=/usr/local/nerd-dictation/model  --continuous

This starts the software and tells it that we are going to dictate for a long time. More details on the options available are available on the project site. To stop the software you should run the following command:

/usr/local/nerd-dictation/nerd-dictation end

I suggest you try this if you are looking for a speech-to-text software for Linux. Well this is all for now. Will post more later.

Thanks to Hacker News: Nerd-dictation, hackable speech to text on Linux for the link.

– Suramya

May 30, 2021

You can now run GUI Linux Apps on Windows 10 natively

Filed under: Computer Software,Linux/Unix Related,Tech Related — Suramya @ 10:17 PM

With the latest update of Windows Subsystem for Linux (WSL), you can now run Linux GUI applications on Windows natively. This is pretty impressive considering Steve Ballmer famously branded Linux “a cancer that attaches itself in an intellectual property sense to everything it touches” back in 2001. In just 20 years, Microsoft has changed it’s stance and started adding more Linux functionality to it’s operating system.

Arguably, one of the biggest, and surely the most exciting update to the Windows 10 WSL, Microsoft has been working on WSLg for quite a while and in fact first demoed it at last year’s conference, before releasing the preview in April… Microsoft recommends running WSLg after enabling support for virtual GPU (vGPU) for WSL, in order to take advantage of 3D acceleration within the Linux apps…. WSLg also supports audio and microphone devices, which means the graphical Linux apps will also be able to record and play audio.

Keeping in line with its developer slant, Microsoft also announced that since WSLg can now help Linux apps leverage the graphics hardware on the Windows machine, the subsystem can be used to efficiently run Linux AI and ML workloads… If WSLg developers are to be believed, the update is expected to be generally available alongside the upcoming release of Windows.

The feature is still only available in Windows 10 Preview Builds but is expected to be released for general use in the near future.

I would love to see the reverse being developed. The ability to install and run Windows applications on Linux natively / officially. There is Wine/Crossover but they don’t support 100% of the applications yet. It would be cool if MicroSoft contributes to either of the tools to allow people to run windows software on Linux.

I personally use Crossover to run the Office Suite and it works great for me (For the most part). The latest version supports Office 365 and most of it works fine except for Excel which still has a bit of a problem with large files but works otherwise. Which is why I also have Office 2007 also installed where Excel works without issues even with large files.

Compatibility with MS Office suite is why a lot of users don’t want to switch from Windows to Linux or Mac. OpenOffice/LibreOffice is great but the UI sucks and the files are not 100% compatible (atleast the last time I tried it, it wasn’t) so the files might not look the same as you expected when you share them with Office users.

Source: Microsoft doubles down on Windows Subsystem for Linux

– Suramya

May 14, 2021

NTFS has a massive performance hit on Linux compared to ext4

Filed under: Computer Software,Linux/Unix Related,My Thoughts,Tech Related — Suramya @ 12:47 PM

NTFS has long been a nemesis of Linux. I remember in the 2000’s getting NTFS working on linux required so much effort and config changes that I stopped using it on my systems as FAT32 was more than sufficient for my needs at that time. Initially the driver was very unstable and it was recommended that you only use it for Read operations rather than Read/Write as there was a high probability of data corruption. That has changed over the years and the driver is stable. However, there is a massive performance hit when using NTFS vs ext4 on a Linux machine and I saw this when I tried using a NTFS partition on my laptop instead of ext4.

I have a 1 TB drive on my laptop along with a SSD. I dual boot the laptop (need it for my classes) between Windows & Debian and wanted to have all my files available on both OS’s. When I last tried this, ext support on Windows was not that great (and I didn’t feel like searching for options) so I decided to format the drive to NTFS so that I would have access to the files on both OS. The formatting took ages and once the drive was ready I was able to copy my files from the desktop to the laptop. While the files were being copied I noticed very high CPU usage on the laptop and the UI was lagging randomly. Since I was busy with other stuff I let it be and ignored it.

Yesterday I was trying to move files around on the laptop so that the root partition had enough space to do an upgrade and I again noticed that file copy and most of the disk operations were taking way longer than I expected. For example there would be a second of delay when I tried listing the directory when it had a lot of files. So, I decided to test it out. My data on the Laptop is an exact copy of the files on the Desktop. I timed the commands on the desktop with the same command on the laptop and there was a significant difference.

My desktop is obviously a lot more powerful than the laptop so I decided to try an experiment where I would run a command on the NTFS drive, then format the drive to ext4 and run the same command. (after copying all the files back). When I did this I saw that there was a massive difference in the time it took to run the command. On ext4 the command took less than 1 second (0.107s) whereas it took almost 34 seconds (33.997s) on NTFS parition. The screenshot for both commands are below:

du -hs command on a ext4 partition

du -hs command on a NTFS partition

That’s a ridiculous amount of difference between the two. So I obviously have to switch back to ext4 which brought us back in a full circle – I still needed to be able to access my files from Windows as well as from Linux. Decided to go a search on the Internet for options and found out that Windows 10 now lets you mount Linux ext4 filesystems in WSL 2. I haven’t tried it yet but I will test over the next few days once I am done with some of my assignments. If there is something interesting I will blog about it in the near future.

As of now, I am back to using ext4 on the laptop and the OS performance is a lot better.

Well this all for now. Will post more later.

– Suramya

May 11, 2021

Stop hating on people because they don’t use the same tools as you

Filed under: Linux/Unix Related,My Thoughts — Suramya @ 6:31 PM

Recently there was an idiot on twitter who kept harassing a lady (@insiderPhd) to tell her that she was not a real hacker because she didn’t use vi. The screen shot of the original post is at the bottom of the post. The quote I really found interesting is “It’s not that you ‘can’t use’ vim’, it is that you haven’t taken ANY time to learn it. If you can learn API hacking tools, you can learn vim. Don’t be lazy!”. How is not learning vim/vi being lazy. I didn’t learn it for a long time because I didn’t need to. Then Matt convinced me that I need to know it and his reasoning was that if a system goes down and you have to boot into recovery mode or are working on an embedded system the only editor you can be sure will be available is vi and that made sense to me. It did take me a while to get comfortable with it but I still prefer a GUI based editor like EditPlus on Windows or kWrite on linux. Does that mean that I am not a ‘hacker’? If so then so be it. I am comfortable with what/who I am and I don’t need you to validate me. Unfortunately, for newcomers into the field this can be discouraging so please stop doing that. Plus, we need to call out these idiots who think they are the sole authority on how is a hacker or a techie or a geek or whatever.

I really don’t understand these guys and it is always a guy who is trying to gatekeep and tell others that they are the sole authority to decide who is a hacker or who is not. Who is in and who is not. I have much better things to worry about than trying to get approval from some jackass who thinks their way is the only way. Remember the famous “infinite diversity in infinite combinations” quote? It means that there is more than one way to do it.

We have a lot of old-timers who are scared of the new generation and their new-fangled ideas. This is because they stopped learning and are now scared that they will be replaced. In one of my previous companies, I was responsible for creating a system that replaced a legacy system with a user friendly web based system. It worked great (if I say so myself) but one of the senior engineers I was working with did everything they could to sabotage the project because they were comfortable with the old system and didn’t want to change. Plus it was job security because hardly anyone else understood the system so they were always needed. My feeling is that if you need to prevent upgrades because you think you would loose your job because only you know the system then understand that the company is already looking for ways to replace you. Single points of failures are a big issue for a company.

Now, coming back to the original point about tools. I really don’t get why people get so worked up over a simple tool. This whole religious war over vi vs emacs or Windows vs Linux or Android vs iPhone and so on is just silly. It is ok to have a preference, I for example prefer using vi, Linux and Android phones. But that is because those tools work for me and I am comfortable with them. There are aspects of iPhone that I don’t like because of the design philosophy behind it. I have spent hours debating which phone is better and I will continue to do so. That being said, it doesn’t mean that people who don’t use an Android phones are non-technical or uneducated or whatever. End of the day a phone is a tool, it needs to do what I want it to do and respect my freedom to do what I want with it.

It doesn’t matter if I use vi to code or I use an IDE that helps me code. It matters what I do with it, what program I am writing. I can never remember syntax’s for functions, even for languages I have been using for decades. Does that mean I can’t program? of-course not. That’s what google and the reference books are there for. In my 10th Board exam, during my computer science viva I was asked to give the syntax for the locate command and I mixed up the rows & columns parameters and inverted them. My teacher scolded me and told me how can I believe you coded this program if you can’t even tell me the syntax, so I told her that I can always look up the syntax when I am coding and the important part is that I need to know when to use the command, not what the syntax is. There was pin-drop silence after I told her that. I did get full marks so I guess I made sense. But the point is that tools are there to help you. You need to figure out how to use them effectively.

I use Linux on all my machines but Jani and my parents use Windows because that is what works for them. It doesn’t mean that they are scum or unintelligent or whatever, (these are actual terms I have hear people use about folks who use Windows) it is just that for them it doesn’t matter. It is not what is important to them.

Too many people try to use the tools you use as a criteria to like you or hate you and to me that is a sad way to live your life.

I learn a lot from others who are different from me because they have a different view point. If everyone in the world was the same imagine how boring it would be? I am not a singer, but others are and they create great music so does that make them better or worse than me? It doesn’t. They are just different and that is good. We need that diversity.

We all need to stop focusing on the differences and start focusing on how we all love the same stuff.

Original post on Twitter, ranting on how someone is not a hacker because they don’t use vim

– Suramya

April 8, 2021

Moving a Windows install to another drive on the same computer shouldn’t be this hard

Filed under: Computer Software,Linux/Unix Related,My Thoughts,Tech Related — Suramya @ 11:27 PM

I recently bought a new SSD drive for my Laptop because even after upgrading everything else (except the CPU) the system was still slow and looking at the process use I could see that it was waiting for disk read/write for the most part and that was causing the slowness. Once I got the new drive, I had to move the existing OS installs from the old disk to the new one. I have three operating systems (OS) on the disk: Windows, Debian and Kali. I need the windows OS for my classes (my proctored exams have to be taken on a windows machine) and others are for my tinkering and general use computing. The disk layout on the old drive was as follows:

root@Wyrm:~# fdisk -l
Disk /dev/sda: 931.51 GiB, 1000204886016 bytes, 1953525168 sectors
Disk model: ST1000LM024 HN-M
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x0f04ad34

Device     Boot     Start       End   Sectors   Size Id Type
/dev/sda1  *         2048   1126399   1124352   549M  7 HPFS/NTFS/exFAT
/dev/sda2         1126400 102402047 101275648  48.3G  7 HPFS/NTFS/exFAT
/dev/sda3       102402048 135956479  33554432    16G 82 Linux swap / Solaris
/dev/sda4       135956480 468862127 332905648 158.7G  5 Extended
/dev/sda5       135958528 175017985  39059458  18.6G 83 Linux
/dev/sda6       175022080 237936641  62914562    30G 83 Linux
/dev/sda7       237940736 468862127 230921392   675G 83 Linux

I partitioned the new disk as a copy of the old drive, except for the data partition which was smaller as the disk was smaller. I used dd to clone each partition on to the corresponding new partition using the following command: (where sdb was the new drive).

dd if=/dev/sda1 of=/dev/sdb1 bs=2k

Once I copied the partitions over, all I had to do was refresh the GRUB boot loader config using the following command:


After the config was updated, I was able to boot into Linux from both my Debian and Kali partitions on the new drive. However, that didn’t work for Windows. It gave be a screen-full of random characters like what you see when you try to open a binary file in a text editor and refused to boot. Thankfully I had not deleted the old windows partition so I was able to try a few more things, but *nothing* worked. Windows would just refuse to boot from the new drive. The only solution I found that could have potentially worked was a Paid software that supposedly allows you to clone your windows install on new disks/computers. Since I didn’t want to spend money on something I should have been able to do for free, I didn’t try it.

In the end after wasting a lot of time on this, I was tired of trying various things so just decided to reinstall windows on the new drive. It wasn’t a major loss because I didn’t have much data on Windows but I still dislike the fact that I had to do so just to put in a new drive. Imagine the hoops I would have had to jump if I wanted to move to a new computer. Actually I don’t have to imagine, I did jump thorough them when I moved my install from my old laptop to this one.

My linux install on the laptop is an exact clone of my desktop install. I used dd to create an image of my Linux install on the desktop and then wrote the image on the laptop. It worked perfectly fine at the first try. All I had to change was the hostname so that my DHCP server didn’t have a nervous breakdown but other than that everything worked without a single problem. Even the graphics drivers auto adjusted on the new machine. Imagine if we could do the same thing for a Windows install.

– Suramya

« Newer PostsOlder Posts »

Powered by WordPress