Added some repositories and screwed up grub...

If none of the more specific forums is the right place to ask

Added some repositories and screwed up grub...

Postby WTRXGamer » 2015-07-22 20:37

A while back I added the kali linux repositories to my /etc/apt/sources.list so that I could get that version of aircrack-ng. A few days later the system prompted me for updates via the package installer with software from kali.
After a reboot the debian grub bootloader was replaced with the one from kali, and as I don't actually have the kali OS, the boot hangs if I choose kali, but manages to boot if I select windows.
Using the debian install disk I have used the rescue mode and tried to reinstall grub with the command grub-install, and it appears to work. I have used the command on all three of my partitions which are:
-/dev/sda1 Something to do with the boot, it contains the files BOOTNXT, BOOTSECT.BAK, Boot, Recovery, System Volume Information, and bootmgr
-/dev/sda2 My windows partition
-/dev/sda3 My debian partition

On the debian partition in the /boot folder I found 8 files, a system map, config, initrd.img, and vmlinuz for both debian and kali. I have deleted the kali ones and after a reboot they are not recreated, but it still boots to the kali grub.

It might also be worth noting I have two files in the root directory labeled vmlinuz, and vmlinuz.old I have never installed any other linux distribution, nor have I upgraded debian from an older version, but when I tried to switch around the name, I got the error: "Bareword 'vmlinuz' not allowed while 'strict subs' in use at (user-supplied-code)."

Thank you so much for trying to help me. I know I'm going to feel stupid when I figure this out.

Edit #1: After removing the repositories from /etc/apt/sources.list and running apt-get update it downloaded a couple mebabytes, but after a reboot the kali bootloader is still there.

Edit #2: Just for grins I decided to boot to what grub was calling kali, and viola! My debian environment loaded as it normally does. After some tweaking with Grub Customizer, I reverted everything to my backup, and everything works as it used to. On both my desktop and laptop I have deleted the repository labeled kali/updates in hope that it won't do any distribution related updates, and I have commented out the other repository, so when I need software from it I will have to uncomment it, and apt-get update. Is there and easier way to do that, so that I can still use repositories from other distributions but not allow them to install anything distribution related?
Last edited by WTRXGamer on 2015-07-22 21:05, edited 1 time in total.
WTRXGamer
 
Posts: 12
Joined: 2015-07-22 20:16

Re: Added some repositories and screwed up grub...

Postby Head_on_a_Stick » 2015-07-22 20:56

Code: Select all
# grub-install --recheck /dev/sda

Do not use a partition number.
User avatar
Head_on_a_Stick
 
Posts: 10377
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: Added some repositories and screwed up grub...

Postby dasein » 2015-07-22 20:59

The problem is that you now have something that is neither Kali or Debian. That's what happens when you mix repos.

Depending on exactly what got updated, GRUB may be the least of your worries.
User avatar
dasein
 
Posts: 7775
Joined: 2011-03-04 01:06
Location: Terra Incantationum

Re: Added some repositories and screwed up grub...

Postby WTRXGamer » 2015-07-22 21:11

dasein wrote:The problem is that you now have something that is neither Kali or Debian. That's what happens when you mix repos.

Depending on exactly what got updated, GRUB may be the least of your worries.


Fortunately, after reinstalling grub, I believe the stock debian bootloader was installed, but config changes from the kali update made it appear as it it was the kali bootloader, as once I selected what grub was identifying as kali, it booted to my debian environment normally. Using Grub Customizer, I restored my backup and everything works as it used to. My question now is, how can I (safely) add repositories from other distributions while maintaining debian as the base system? For right now I have removed the kali/updates repository and commented out the main repository. When I want software from the kali one I must now go uncomment it, run apt-get update, install the software I want, comment it again, and run apt-get update.
WTRXGamer
 
Posts: 12
Joined: 2015-07-22 20:16

Re: Added some repositories and screwed up grub...

Postby Head_on_a_Stick » 2015-07-22 21:14

WTRXGamer wrote:
dasein wrote:how can I (safely) add repositories from other distributions while maintaining debian as the base system?

You can't.

Read the bottom link in my signature.

If you want to use Kali, install & run it from a live USB stick.
User avatar
Head_on_a_Stick
 
Posts: 10377
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: Added some repositories and screwed up grub...

Postby dasein » 2015-07-22 21:15

WTRXGamer wrote:...how can I (safely) add repositories from other distributions while maintaining debian as the base system?

viewtopic.php?&t=114130
User avatar
dasein
 
Posts: 7775
Joined: 2011-03-04 01:06
Location: Terra Incantationum

Re: Added some repositories and screwed up grub...

Postby WTRXGamer » 2015-07-22 21:26

dasein wrote:
WTRXGamer wrote:...how can I (safely) add repositories from other distributions while maintaining debian as the base system?

viewtopic.php?&t=114130


Thank you, that post was very helpful. I suppose I'm going on that post as one of the idiots that was dumb enough to mix distributions?
WTRXGamer
 
Posts: 12
Joined: 2015-07-22 20:16

Re: Added some repositories and screwed up grub...

Postby milomak » 2015-07-22 21:41

Head_on_a_Stick wrote:
WTRXGamer wrote:
dasein wrote:how can I (safely) add repositories from other distributions while maintaining debian as the base system?

You can't.

Read the bottom link in my signature.

If you want to use Kali, install & run it from a live USB stick.


i suppose it depends what safe is defined as. if safe is to keep the system as stable then yes i would agree. if safe is that it continues running but not necessarily as stable then yes it is possible.

but of course i would agree with what i think is your sentiment that unless you know what you are doing, you shouldn't veer away from stable.
Desktop: iMac Late-2015 27" 5K Retina (17,1 - 3.3GHz) - MacOS and Windows 10 (Bootcamp)/ Debian Sid (External SSD)
Laptop: Lenovo ideapad Y700 [nVidia Optimus] (64-bit) - Debian Sid, Win10,
Kodi Box: AMD Athlon 5150 APU w/Radeon HD 8400 - Debian Sid
milomak
 
Posts: 1981
Joined: 2009-06-09 22:20

Re: Added some repositories and screwed up grub...

Postby spacex » 2015-07-22 22:05

WTRXGamer wrote:My question now is, how can I (safely) add repositories from other distributions while maintaining debian as the base system?

My answer is that if you have to ask, then you can't.

I know that I sometime tease a few about mixing sources, but the reality is that you need to really really know what you're doing if you are going to attempt something like that. You have to be able to evaluate every single little package you accept into your system, including all the dependencies that come with it. Some packages are fine to accept, some are a little risky, and others are a big no no. So unless you feel you are able to do that, don't attempt it. It's extreme-sport even for the very skilled ones.
spacex
 
Posts: 637
Joined: 2015-01-17 01:27

Re: Added some repositories and screwed up grub...

Postby WTRXGamer » 2015-07-22 22:41

spacex wrote:
WTRXGamer wrote:My question now is, how can I (safely) add repositories from other distributions while maintaining debian as the base system?

My answer is that if you have to ask, then you can't.

I know that I sometime tease a few about mixing sources, but the reality is that you need to really really know what you're doing if you are going to attempt something like that. You have to be able to evaluate every single little package you accept into your system, including all the dependencies that come with it. Some packages are fine to accept, some are a little risky, and others are a big no no. So unless you feel you are able to do that, don't attempt it. It's extreme-sport even for the very skilled ones.


For now, I've sort of made a hacky way around it. I've made a script that uncomments the kali repositories when I need them, but will then recomment them after I'm done. Theoretically, if I'm diligent about commenting them off as soon as I don't need them, and running apt-get update, the software installer shouldn't even know about the kali repositories.
WTRXGamer
 
Posts: 12
Joined: 2015-07-22 20:16

Re: Added some repositories and screwed up grub...

Postby Randicus » 2015-07-22 23:16

The question still remains. Why?

What are the packages you want to bring over?
Are versions of those packages in Debian's repository?
Do you need or want those packages?
If you really need those packages (I do not know why, since Kali is for security industry professionals.), why not use Kali as a live system from USB or disc like it is meant to be used?
Randicus
 
Posts: 2664
Joined: 2011-05-08 09:11

Re: Added some repositories and screwed up grub...

Postby dasein » 2015-07-22 23:39

WTRXGamer wrote:For now, I've sort of made a hacky way around it. I've made a script that uncomments the kali repositories when I need them, but will then recomment them after I'm done. Theoretically, if I'm diligent about commenting them off as soon as I don't need them, and running apt-get update, the software installer shouldn't even know about the kali repositories.

Your "solution" doesn't afford you anything like the protection you imagine it does. And your "theoretical" prediction is based on ignorance, not actual theory.

As has already been pointed out to you, the degree of damage is package-dependent and therefore unpredictable. It only takes one to render your system unusable.

It seems clear that you're determined to break your system. Fine and dandy: after all, it's your machine to break however you want. Just don't come here asking for help when you do. (And keep a recent backup of your personal data at all times. You will need it; the only question is when.)
User avatar
dasein
 
Posts: 7775
Joined: 2011-03-04 01:06
Location: Terra Incantationum

Re: Added some repositories and screwed up grub...

Postby WTRXGamer » 2015-07-23 02:12

Randicus wrote:The question still remains. Why?

What are the packages you want to bring over?
Are versions of those packages in Debian's repository?
Do you need or want those packages?
If you really need those packages (I do not know why, since Kali is for security industry professionals.), why not use Kali as a live system from USB or disc like it is meant to be used?


Honestly, it's completely out of convenience. I'm sure all of the software on the kali repos could be installed manually, but I prefer the apt-get method. I was using kali on a live disc to test various things on my server, but as I learned the software more and more, it got annoying to switch from debian to the live cd every time I wanted to test something.

Specifically, the package I was using was Johnny (the GUI version of John the Ripper), to test the strength of certain passwords with different hash algorithms, but I also used aircrack-ng a couple times to test my phone's hotspot. (I know that aircrack-ng is in the debian repos, but the kali one also includes airodump-ng, where debian's did not.)
WTRXGamer
 
Posts: 12
Joined: 2015-07-22 20:16

Re: Added some repositories and screwed up grub...

Postby WTRXGamer » 2015-07-23 02:32

dasein wrote:Your "solution" doesn't afford you anything like the protection you imagine it does. And your "theoretical" prediction is based on ignorance, not actual theory.


While I would agree with you that my "solution" certainly isn't a guarantee, it has worked thus far (Before my laptop updated, I made the changes), and so long as all data is backed up, no harm can be done.

dasein wrote:As has already been pointed out to you, the degree of damage is package-dependent and therefore unpredictable. It only takes one to render your system unusable.

It seems clear that you're determined to break your system. Fine and dandy: after all, it's your machine to break however you want. Just don't come here asking for help when you do. (And keep a recent backup of your personal data at all times. You will need it; the only question is when.)


I suppose you're right. I really don't know what every single package could do, but I do keep regular backups following the 3-2-1 rule, so worst case scenario I'm out a few hours re-installing the OS and my software. As far as breaking my machine, I understand that this is a very real possibility when I mess with stuff like this, but tinkering with stuff like this is what the community does. Why would open source even matter if making changes were discouraged?
WTRXGamer
 
Posts: 12
Joined: 2015-07-22 20:16

Re: Added some repositories and screwed up grub...

Postby milomak » 2015-07-26 16:27

have you tried building from the kali source?
Desktop: iMac Late-2015 27" 5K Retina (17,1 - 3.3GHz) - MacOS and Windows 10 (Bootcamp)/ Debian Sid (External SSD)
Laptop: Lenovo ideapad Y700 [nVidia Optimus] (64-bit) - Debian Sid, Win10,
Kodi Box: AMD Athlon 5150 APU w/Radeon HD 8400 - Debian Sid
milomak
 
Posts: 1981
Joined: 2009-06-09 22:20

Next

Return to General Questions

Who is online

Users browsing this forum: No registered users and 17 guests

fashionable