The small linux problem thread

Thanks for the pointers, I should have been more clear, I just can’t boot DBAN and I’m running dd from live Zorin USB I had handy, so /dev/sda is unmonted with no partition prior to dd start.

There is a full thread on superuser why DBAN doesn’t boot from USB on some systems and how to handle it, but this just looked like less of a hassle if you guys concur it’s safe enough.

Running what you did, just a bare ssh-agent, will not set the environment variables for you. And so, no other commands know that the ssh-agent is running or where to find it.

You need to run eval $(ssh-agent) which will take the output of the command and eval it, which means that the shell will execute the output. Or use back-ticks instead of $(command). I just couldn’t type them because the Mark-Down here has no way to escape the back-ticks.

2 Likes

Hm that explains why the GitHub tutorial is what it is, but it actually worked without eval. I just ssh-add mykey again and git picked it up just fine, could push with no issues. That could be down to some default config in Fedora though, I don’t know…

I still wanna get the automatic thing working though (just wanted to have that pushed out).

Oh, dd overwrite three times should destroy the data for 99.999999% of the population and not many will be able to access the previous data after that except for specialized IT phorensics. Why anyone would want to take your specific harddrive and search for previous data, a very task-intensive and laborious process, is beyond me.

I still recommend replacing HDD to SSD though, but that’s just me. :slight_smile:

1 Like

The $HOME/.ssh/config file doesn’t get read by ssh-agent, AFAIK. Instead it gets used by commands like ssh, scp, sftp, rsync, etc. The magic won’t happen until you run ssh github. Then ssh-add -l should show something.

@zlynx has a point about how you incorrectly invoked ssh-agent, but if there was no agent running, and with SSH_AUTH_SOCK set in your shell, pointing to the right one, ssh-add -l would have errored, so I guess your system started it for you, elsewhere.

3 Likes

Hm I was afraid that that was going to be the case :confused: Although I don’t think I can actually (really) SSH into Github, I just tried it and it seems to try loading the key, but it’s telling me the file doesn’t exist even though it clearly does (including correct permissions) and is pointing to the right one :confused: And adding it manually does work as well, so I’m not sure why it’s not finding it…

[[email protected]]~% ls -l $HOME/.ssh
total 20
-rw-r--r--. 1 tarulia tarulia  125 Jun 10 08:15 config
-rw-------. 1 tarulia tarulia  951 Sep 11  2015 github_private
-rw-rw-r--. 1 tarulia tarulia 1574 Apr 18 15:15 known_hosts
-rw-------. 1 tarulia tarulia  869 Jun 10  2015 ssh_private_key.ppk
-rw-r--r--. 1 tarulia tarulia  294 Jun 10  2015 ssh_public_key
[[email protected]]~% cat .ssh/config 
Host github
  Hostname github.com
  IdentityFile $HOME/.ssh/github_private
  AddKeysToAgent yes
  User git
  Compression yes
[[email protected]]~% ssh github      
no such identity: $HOME/.ssh/github_private: No such file or directory
[email protected]: Permission denied (publickey).
[[email protected]]~% ssh-add $HOME/.ssh/github_private 
Enter passphrase for /home/tarulia/.ssh/github_private: 
Identity added: /home/tarulia/.ssh/github_private (/home/tarulia/.ssh/github_private)

Could it be because of the passphrase? But I thought it should just ask for that at that point :thinking:

And yes I know $HOME was unnecessary to specify, I just used it because it was in the error message to see what happens :smiley:

That seems to be the case, I didn’t manually invoke the agent since the last restart but I’m still getting something back:

[[email protected]]~% echo $SSH_AUTH_SOCK
/tmp/ssh-k8SrNgD58hay/agent.1750

So yeah I guess that is started somewhere else already.

1 Like

So I have a script wrapper that I use for… wait for it… running scripts.

I added a feature to it over the last week so it prints possible command completions. I want to use ? for this, but zsh is seeing it as globbing unless I quote or escape it. Is there anyway around this without disabling globbing altogether?

Screen Shot 2021-06-10 at 13.51.42

-h, --help will be something else, so can’t use that as a replacement. I like using ? in network cli so thought I’d use it.

2 Likes

I’m making a zero’s out partition that’s gonna take awhile, how do I get this stuck context menu from steam to go away without rebooting

Edit, apparently you just drag and drop any maximized window

1 Like

Yeah I was just going to say that it looked like some artifact that got stuck when repainting the screen.

1 Like

Looks like it’s just not expanding the variable. You can try replacing $HOME with ~ or just the actual path: /home/tarulia.

1 Like

Ok, this one is new to me. So I’m sitting in Gnome, with a Bluetooth mouse connected.

All of a sudden, all windows are unresponsive - except the currently active one. The mouse pointer works, I can click fine inside the current window with no problems, but, as soon as I try to click outside the current window, neither click nor mouse position registers for that window.

I have narrowed it down to either Bluetooth or hardware fault; If I connect another mouse (USB) the error is still visible. If I then disconnect the BT mouse, however, the error disappears and I have once again normal behaviour with the USB mouse.

Anyone around that has experience with this? The mouse worked perfectly for 6 months until now.

Well… duh, I should have thought of that :facepalm: brain lag is strong in this one :slight_smile:

BUT - The good news: it works with SSH

[[email protected]]~/Development/obs-studio.spec% ssh github
Enter passphrase for key '/home/tarulia/.ssh/github_private': 
PTY allocation request failed on channel 0
Hi mihawk90! You've successfully authenticated, but GitHub does not provide shell access.
Connection to github.com closed.

However, it didn’t work with Git right away, it wasn’t loading the key. When I tried ssh github.com instead of just ssh github I realised that I was getting the same error (i.e. not loading the key), so I figured it wasn’t finding the config because of however Git calls ssh.

I had to change the Host line to Host github.com instead for it to load the key, and that worked. If this were a target with shell-access I’d use Host github github.com so I could use ssh github for shorter shell access and still have Git work. I guess there’s also a Git config that would let me use a different name but since this is for GitHub only, it doesn’t matter.

So this is what it looks like working:

Host github github.com
  Hostname github.com
  IdentityFile /home/tarulia/.ssh/github_private
  AddKeysToAgent yes
  User git
  Compression yes

Long story short: It finally works! So thank you for the persistent help :slight_smile:

1 Like

ansible playbooks

1 Like

Learned something today.

To get the total amount of memory that’s attached to the machine you need to use lsmem

GNOME, free cat /proc/meminfo only show you the total amount of memory that is usable. This is not the same amount that actually attached to the machine.

So if you need to know how much memory is physically attached to the box lsmem | grep "online memory" or if you want it in bytes lsmem -b | grep "online memory"

There ya go… now you know how to get all the memory on a linux machine before you download more RAM from the internet so it runs faster.

2 Likes

what
huh

image

Eh, not the same scope. The wrapper could generate or run a playbook, although I haven’t done that yet.

1 Like

I thought about writing another playbook to run the aforementioned playbooks, but I decided not to…

Although… I might write a playbook to loop my wrapper script that runs my other playbooks.

1 Like

Hi fellow users,

I have a udev automation issue and I am wrecking my brain for a week now but probably just missing the obvious.
I have a USB device that I want to pass through to a guest running on KVM. There are a few tutorials how to do that, so I’ve followed those. Basically I created the rule in /etc/udev/rules.d/90-libvirt-usb.rules containing

ACTION=="add", ENV{PRODUCT}="1cf1/30/100", RUN+="/usr/bin/virsh attach-device guest /etc/libvirt/devices/usbtopass.xml"
ACTION=="remove", ENV{PRODUCT}="1cf1/30/100", RUN+="/usr/bin/virsh detach-device guest /etc/libvirt/devices/usbtopass.xml"

The command to run works when run manually. However when I plug the device in, a loop is triggered. It seems that attaching a device to a guest will basically remove it from the host, thus triggering the detach command.

What am I missing?

The host OS is Ubuntu 20.04.2 LTS currently on kernel 5.4.0-73 .

Can you post some udevadm output so we can decypher whats going on.

What’s interesting to us?

look for the event that gets fired when:

a) You connect the usb device
b) you pass trough the usb device
c) you actually disconnect the usb device

Without that we cannot easily make out how to distinguish the events you need to listen on for the passtrough to work.

look for a way to filter the passtrough event and the actual disconnect event so you can prevent the event being fired when you passtrough with virsh

Some possible quickfixes, but i have not tested them at all (So with a grain of salt):

  • make the virsh commands take place in the current domain with --current
  • Why are you not use the vendor id and product id. try using that
  • have you tried restarting udev/ the host device
  • Try setting the managed flag of the device to no. this is located inside your .xml config

Hi,

Thanks for the quickfix hints, unfortunately non of them worked yet.

Here’s the shortest output of udevadm monitor I could grab when plugging in and then unplugging the usb device (it is a Zigbee dongle BTW). The output is without the -p flag. If that helps, I can paste, it will be long though.

KERNEL[1074243.061858] add      /devices/pci0000:00/0000:00:14.0/usb1/1-7 (usb)
KERNEL[1074243.063148] add      /devices/pci0000:00/0000:00:14.0/usb1/1-7/1-7:1.0 (usb)
KERNEL[1074243.064677] add      /devices/pci0000:00/0000:00:14.0/usb1/1-7/1-7:1.0/tty/ttyACM0 (tty)
KERNEL[1074243.064785] bind     /devices/pci0000:00/0000:00:14.0/usb1/1-7/1-7:1.0 (usb)
KERNEL[1074243.064866] add      /devices/pci0000:00/0000:00:14.0/usb1/1-7/1-7:1.1 (usb)
KERNEL[1074243.064945] bind     /devices/pci0000:00/0000:00:14.0/usb1/1-7/1-7:1.1 (usb)
KERNEL[1074243.065028] bind     /devices/pci0000:00/0000:00:14.0/usb1/1-7 (usb)
UDEV  [1074243.428675] add      /devices/pci0000:00/0000:00:14.0/usb1/1-7 (usb)
KERNEL[1074243.603952] remove   /devices/pci0000:00/0000:00:14.0/usb1/1-7/1-7:1.0/tty/ttyACM0 (tty)
KERNEL[1074243.603994] unbind   /devices/pci0000:00/0000:00:14.0/usb1/1-7/1-7:1.1 (usb)
KERNEL[1074243.604011] unbind   /devices/pci0000:00/0000:00:14.0/usb1/1-7/1-7:1.0 (usb)
UDEV  [1074243.608028] add      /devices/pci0000:00/0000:00:14.0/usb1/1-7/1-7:1.0 (usb)
UDEV  [1074243.611896] add      /devices/pci0000:00/0000:00:14.0/usb1/1-7/1-7:1.1 (usb)
UDEV  [1074243.613898] bind     /devices/pci0000:00/0000:00:14.0/usb1/1-7/1-7:1.1 (usb)
UDEV  [1074243.628120] add      /devices/pci0000:00/0000:00:14.0/usb1/1-7/1-7:1.0/tty/ttyACM0 (tty)
UDEV  [1074243.630188] bind     /devices/pci0000:00/0000:00:14.0/usb1/1-7/1-7:1.0 (usb)
UDEV  [1074243.634596] bind     /devices/pci0000:00/0000:00:14.0/usb1/1-7 (usb)
UDEV  [1074243.636168] unbind   /devices/pci0000:00/0000:00:14.0/usb1/1-7/1-7:1.1 (usb)
KERNEL[1074243.929706] bind     /devices/pci0000:00/0000:00:14.0/usb1/1-7/1-7:1.1 (usb)
KERNEL[1074243.929809] add      /devices/pci0000:00/0000:00:14.0/usb1/1-7/1-7:1.0/tty/ttyACM0 (tty)
KERNEL[1074243.929888] bind     /devices/pci0000:00/0000:00:14.0/usb1/1-7/1-7:1.0 (usb)
UDEV  [1074243.933926] bind     /devices/pci0000:00/0000:00:14.0/usb1/1-7/1-7:1.1 (usb)
KERNEL[1074244.033814] remove   /devices/pci0000:00/0000:00:14.0/usb1/1-7/1-7:1.0/tty/ttyACM0 (tty)
KERNEL[1074244.033843] unbind   /devices/pci0000:00/0000:00:14.0/usb1/1-7/1-7:1.1 (usb)
KERNEL[1074244.033860] unbind   /devices/pci0000:00/0000:00:14.0/usb1/1-7/1-7:1.0 (usb)
KERNEL[1074244.033881] remove   /devices/pci0000:00/0000:00:14.0/usb1/1-7/1-7:1.0 (usb)
KERNEL[1074244.033901] remove   /devices/pci0000:00/0000:00:14.0/usb1/1-7/1-7:1.1 (usb)
KERNEL[1074244.034229] unbind   /devices/pci0000:00/0000:00:14.0/usb1/1-7 (usb)
KERNEL[1074244.034265] remove   /devices/pci0000:00/0000:00:14.0/usb1/1-7 (usb)
UDEV  [1074244.034985] unbind   /devices/pci0000:00/0000:00:14.0/usb1/1-7/1-7:1.1 (usb)
UDEV  [1074244.095311] remove   /devices/pci0000:00/0000:00:14.0/usb1/1-7/1-7:1.0/tty/ttyACM0 (tty)
UDEV  [1074244.095819] remove   /devices/pci0000:00/0000:00:14.0/usb1/1-7/1-7:1.1 (usb)
UDEV  [1074244.096216] unbind   /devices/pci0000:00/0000:00:14.0/usb1/1-7/1-7:1.0 (usb)
UDEV  [1074244.114338] add      /devices/pci0000:00/0000:00:14.0/usb1/1-7/1-7:1.0/tty/ttyACM0 (tty)
UDEV  [1074244.180546] bind     /devices/pci0000:00/0000:00:14.0/usb1/1-7/1-7:1.0 (usb)
UDEV  [1074244.226680] remove   /devices/pci0000:00/0000:00:14.0/usb1/1-7/1-7:1.0/tty/ttyACM0 (tty)
UDEV  [1074244.228833] unbind   /devices/pci0000:00/0000:00:14.0/usb1/1-7/1-7:1.0 (usb)
UDEV  [1074244.247283] remove   /devices/pci0000:00/0000:00:14.0/usb1/1-7/1-7:1.0 (usb)
UDEV  [1074244.248670] unbind   /devices/pci0000:00/0000:00:14.0/usb1/1-7 (usb)
UDEV  [1074244.266398] remove   /devices/pci0000:00/0000:00:14.0/usb1/1-7 (usb)

I’ve been eyeballing the output of udevadm monitor -p but I don’t seem to see what differentiates the passthrough event from the others.

I’m not that familiar with udev, but I have quite some dev experience. Am I correctly assuming that udev events have a sequence and the addition events increase in specificity along the way the system identifies the device. Thus my approach would have to be to capture an add event before the device gets bound to the host so there are no removes? And/or to make the remove rule so specific that it does not trigger when the passthrough happens?

Thanks in advance