Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Magicmat
Aug 14, 2000

I've got the worst fucking attorneys
Does anybody know of a good music player in Linux that supports WMA and/or M4A or, alternatively, can anybody help me get Amarok running? I'm running Gentoo.

I'm just looking for something easy to use that's better than XMMS. I looked at Audacious, but a) I can't find any info on it supporting WMA, and b) it looks to be a dirty, dirty GTK app, and I'm running KDE. If it's really the bee's knees, I'll go for it, but are there other options? Or, hell, some help with getting Amarok running (see link) would tickle me pink.

Adbot
ADBOT LOVES YOU

Magicmat
Aug 14, 2000

I've got the worst fucking attorneys
Is there any way to convert console colored text into HTML? I have a script which takes the output of an emerge update command and e-mails it to me. It would be super-helpful if the color coding I see on the console could carry over into an e-mail. I searched around, but didn't find any way to do this.

Magicmat
Aug 14, 2000

I've got the worst fucking attorneys
Quick question: I've decided to give Ubuntu a try. I'm trying to install it on the master drive of IDE chain 2, which is recognized as /dev/hdc in the Live CD. My problem is that I also want the bootloader on this drive, too. How can I tell which device to put down in the "Step 7 of 7 -> Advanced -> Device for bootloader installation"?

I have a SATA drive (/dev/sda) and a slave drive on IDE 1 (/dev/hdb) in addition to the /dev/hdc drive. In step 4 of the installation the options are listed as:
[ ] IDE1 Slave (hdb)
[X] IDE2 Master (hdc)
[ ] SCSI2 (0,0,0) (sda)

The main thing is that I don't want it touching the SATA drive. The problem is that the boot device listings are in GRUB form, i.e. hd0 or hd2 or whatever. How do I translate the /dev device listings into GRUB numbered listings?

Magicmat
Aug 14, 2000

I've got the worst fucking attorneys

dfn_doe posted:

I'm a little confused why you want to do it the way your are describing, since that would mean if you wanted to boot linux you'd need to change your bios boot device to hit the drive with grub on it... however.. the grub device to phsyical device mapping is in /boot/grub/device.map, the format is pretty straight forward.
code:
/boot/grub$ cat device.map
(hd0)   /dev/sda
There's no grub subdirectory (or any subdirectories at all) in /boot. Like I mentioned, I'm using the Live CD, so that may change things.

As for why I want to do this: So that, if I decide not to switch over full-time, I can just take out or format the drive and be done with it.

Magicmat
Aug 14, 2000

I've got the worst fucking attorneys

teapot posted:

You still should be able to get your bootloader running -- BIOS won't call it unless you will go into CMOS setup and set it as the boot device. Only one MBR is executed when you boot a computer, and usually it's the first drive.

This should also answer your question about GRUB -- if your drive is NOT bootable (hd0) by default, BIOS counts those devices from 1, so it's disk 2, (hd2). How to explain to your BIOS that you intend to boot from it, is a completely different question -- as I have mentioned, CMOS setup program likely has an option for that.

Usually it's a good idea to overwrite the original MBR on the disk with Windows and tell GRUB that you also have a Windows partition. It will not boot if you simply remove the second drive, however if you will need to get rid of GRUB, just boot from Windows CD in rescue mode and run "fixmbr" -- it will overwrite GRUB MBR bootloader with the default DOS/Windows MBR that simply boots the first bootable partition.
No, I want to leave the Windows drive completely untouched. Absolutely no GRUB loading Windows. The idea here is that, when I feel like Linux I just put in the Linux drive and set the correct boot order in the BIOS. Then, when I want Windows again, I unplug the Linux drive and reset the boot order. I don't want to dual boot because I don't want an extra drive in my system taking up power and creating noise when I absolutely won't be using it, thus why I remove it when I'm not using Linux. Plus, I've had bad luck getting rid of GRUB on a Windows drive before. I don't want to repeat that.

Also, can you rephrase how to find the correct drive? I've re-read your second paragraph a couple of times now and I just can't grok it. Keep in mind I'm using SATA here.

I also changed around my system a bit since my last post, moving the drive I want to install Ubuntu on to a PCI IDE add-on card. Now my drive layout looks like:
IDE1 slave (hdb)
SCSI2 (0,0,0) (sda)
SCSI5 (0,0,0) (sdb) <-- What I want Ubuntu on. Running of a PCI IDE add-on card. System currently booting off the CD.

Magicmat
Aug 14, 2000

I've got the worst fucking attorneys

teapot posted:

In any case if you have the same drives in the same order as when you will be running Linux, and you had to manually tell BIOS that you are booting from the second or third drive, your boot drive will be the last one by the number -- hd2 if you have three drives, hd1 if you have two. Even if you will get it wrong, you still can run the live CD and boot from there. You should even be able to run live CD and boot from the hard drive using CD bootloader, then use your new system to fix its own GRUB configuration.
hdb is a hard drive, not the CD. I have the BIOS boot order set to boot from the CD first, then a hard drive. Inside the hard drive boot order menu, I have it set to boot up off of what is shown above as /dev/sdb. If I understand you correctly, should I have the installer install the bootloader to hd2?

Sorry to keep asking the same question, but I just want to be sure I understand you correctly. Thanks for bearing with me.

Also, I'll have the Windows drive in the machine with Linux running, but not vica-versa (that is, the Linux drive won't be in the machine with Windows running.) I like to keep my computer as quiet and cool as possible, thus why I want to actually unplug the Linux drive when I'm not using it. It's not much trouble to me -- I can unplug the drive and have the case back together in less than a minute, which isn't much considering how few times a week I'll actually perform the operation. However, I still want to read and write the the Windows drive from within Linux, hence why I don't want to just disable it.

Magicmat
Aug 14, 2000

I've got the worst fucking attorneys
Quick question: Is there an easy way to send an AOL IM from a script? I'm looking for something like "echo 'Hewo new yorku!' | sendim -u username -p password -d 1337Hiro". The closest I've found is a bare-bones stateful script, which requires me to log in, send the IM and then log out (though, come to think of it, I don't know if it even provides a log out command.)

Magicmat
Aug 14, 2000

I've got the worst fucking attorneys

GringoGrande posted:

You should be able to do that with pidgin via it's dbus interface. It's kind of under documented, but it shouldn't be that hard to write up something in python or a shell script using purple-send.

edit: purple-remote seems to be what you are looking for.

code:
#!/bin/bash
#send-im <name> <message>
purple-send 'icq:goim?screenname=$1&message=$2
Am I correct in assuming that that would require Pidgin to be running to work? I really need something that exists entirerly in a single command, with no background processes or additional commands to execute.

Magicmat
Aug 14, 2000

I've got the worst fucking attorneys

Scaevolus posted:

AIM isn't really very well suited for one-shot messages.
Yeah, I know. But it is the most convenient for me. If there's not an easy way to do it via script, maybe I'll just fire off an e-mail to a e-mail-to-AOL gateway out there. Or maybe if I get up the motivation, I'll hack something up myself.

Magicmat
Aug 14, 2000

I've got the worst fucking attorneys

teapot posted:

Email is also dependent on a process (your mail server) running somewhere, so I don't see an advantage.
No, not my mail server, my ISP's. I can just use 'mail' to fire off an e-mail using my ISP's SMTP server, rather than running a SMTP server myself, which is what I already use for other notifications. Maybe not Enterprise Quality[tm], but for my personal router, it works.

Magicmat
Aug 14, 2000

I've got the worst fucking attorneys
OK, I hacked up a simple .NET app that runs fine under Mono to send a single IM. It works great except for one thing: I've set $MONO_PATH in /etc/bash/bashrc (Gentoo system) and in /etc/profile (side note: What is the proper way to set an environmental variable for all users? My shell-fu is weak) so that sudo will have the correct $MONO_PATH. And executing "sudo echo $MONO_PATH" does, indeed, produce the desired results. And putting "echo $MONO_PATH" in a bash script also produces the desired results. But putting the command in a bash script and then executing that script as sudo gives me an empty string. What gives? How can I have my bash scripts executed with sudo retain that environmental variable?

Magicmat
Aug 14, 2000

I've got the worst fucking attorneys

teapot posted:

1. sudo sanitizes the environment, and not doing so would be a huge security hole.
2. When it runs shell, shell re-creates the environment by running /etc/profile .
3. "sudo echo $MONO_PATH", being a shell command, is converted to "sudo echo /my/actual/path/to/mono" by the non-privileged shell that runs it.
4. You are not supposed to run anything but administrative utilities by sudo, and certainly not IM scripts.
5. Put your variables assignment in the same shell script that runs everything else. If you have to use sudo, run that script with sudo, however if it accepts arguments most likely it is a security hole.
So the answer is to assign the variable in the script? Got it.

And the IM app certainly is run by an administrative script. Some people have admin scripts which e-mail them when they're done; mine IMs me. Stop making stupid assumptions.

Magicmat
Aug 14, 2000

I've got the worst fucking attorneys

teapot posted:

When you run something as complex and potentially insecure as mono from a script running as root, you are supposed to su to a non-privileged user from your script, having another script with insecure stuff as su argument. That second script will include your environment variables assignment and calls to IM-related utilities.
Hmm, that's actually a pretty good idea. I'll do that, thanks!

Edit: If I were to need to do something like this again, but using only a single command instead of the two I need here, would sudo -u user be acceptable instead of su user? And, inside a script, is the "exit" command the recommended way to exit the su context?

Magicmat fucked around with this message at 13:38 on Sep 28, 2007

Magicmat
Aug 14, 2000

I've got the worst fucking attorneys

teapot posted:

Only if for some reason you are not root when issuing it (different users with different privileges but none of them is root).

It's possible to create a sudoers file that will not allow root to sudo as any other user, however su always works for root.
Why can't I be root? Would that just be bad security practice for some reason? Practically, what is the difference between sudo -u user ./script.sh and su user -c ./script.sh?

quote:

I also forgot to mention that when sudo sanitizes the environment it does not remove all variables, and MONO_PATH is not among ones that it clears (though likely it will be added to that list as security-sensitive, along with PERLLIB and JAVA_TOOL_OPTIONS that serve similar purpose). At least for now you can use
code:
export MONO_PATH
to pass it to sudo.
Wait, I'm not sure I'm understanding you. Do you mean that my original example should have worked? That doing sudo ./script.sh, where script.sh contains "echo $MONO_PATH" should have the correct output? Or do you mean something else?

Magicmat
Aug 14, 2000

I've got the worst fucking attorneys
Quick question, I'm trying to make, by hand, the package open-vmware-tools on Ubuntu. During ./configure it complained about not finding the library liburiparser, so I used synaptic to install liburiparser-dev (which also pulled in liburiparser itself.) However, ./configure still complains about not finding it. The library is installed in /usr/lib/liburiparser.so, which seems fairly standard, and the headers are in /usr/include/uriparser/. I assume it's not finding the headers? Here's the exact error I get:
code:
checking for uriFreeQueryListA in -luriparser... no
configure: error: uriparser library not found or is too old. Please configure without Unity (using --disable-unity) or install the liburiparser devel package.

Magicmat
Aug 14, 2000

I've got the worst fucking attorneys
Edit: Double post

Magicmat
Aug 14, 2000

I've got the worst fucking attorneys

Ashex posted:

tray running ./configure with --help. There should be an option to specify where to look for libraries.
I tried that first, but I couldn't find any obvious ones. I tried setting the CPPFLAGS environmental variable to point to /usr/include/uriparse but then it complains about not finding Uri.h. Here is the output, if you can find a better argument I'm missing.

Edit: Tried --includedir=/usr/include/uriparser with the same results as above.

Edit2: OK, I think I have it figured out. I had to manually install a newer version of uriparser than was included with Ubuntu, and use the --includedir command above. Now it's complaining about other packages, but at least we're making progress.

Magicmat fucked around with this message at 04:30 on Sep 5, 2008

Magicmat
Aug 14, 2000

I've got the worst fucking attorneys
What's the best way to set the MTU on a DHCP'ed interface in Ubuntu 8.10? I tried making my /etc/network/interfaces look like this
code:
auto eth0
iface eth0 inet dhcp
        pre-up /sbin/ifconfig $IFACE mtu 1492
but it didn't work; doing a sudo ifdown eth0 && ifup eth0 resets the MTU to comcast's ridiculous 500-something (which causes all sorts of problems just browsing the net, like GMail not working, Flickr not loading images, etc.)

I also tried adding the line "option interface-mtu 1492" to the end of /etc/dhcp3/dhcpd.conf, but that just gives me an error like "missing 'code' after option declaration" (paraphrasing from memory) and spits out my new line with a carat pointing right before '1492' when I reset the interface.

I've also heard of creating a boot script to run 'ifconfig eth0 mtu 1492', but that doesn't help if the interface gets restarted after boot; dhcpd will set it back to Comcast's dhcp-set mtu.

Edit: And Murphy's law dictates that I solve it minutes after posting, even though I spent a good few hours researching prior. Anyway, I had to remove the keyword 'interface-mtu' from the command 'request' in /etc/dhcp3/dhcpd.conf. That apparently asks the DHCP server to recommend a MTU, which dhcpd gladly takes and overrides all other attempts to manually set MTU. So, don't ask the server for it and dhcpd won't use it.

However, if there's a better way out there, I'd love to hear it.

Magicmat fucked around with this message at 07:50 on Dec 22, 2008

Magicmat
Aug 14, 2000

I've got the worst fucking attorneys
Does anybody know of a good live CD that supports NTFS read/write? I'm trying to save some files of a dieing NTFS drive by offloading them to a working NTFS drive. For dded fun, all I have to boot off of currently is a Ubuntu 7.10 Live CD with no hard drive (though with a 4GB USB stick and I can install a second DVD burner, but if I can get away with only one DVD drive that'd save me some work.)

Magicmat
Aug 14, 2000

I've got the worst fucking attorneys
Awesome, Ubuntu 8.10 worked out-of-the-box perfectly! Score another one for Ubuntu, I guess.

Now for an even better question: I need to run the Samsung hard drive diagnostic utility, esTool. Problem is, it only runs off a DOS boot disk. So how do I create a DOS boot disk from within Linux? I'd prefer to get it running off my USB stick, but I'll settle for burning an entire CD for a 2 MB utility, I guess.

Samsung, as some sort of sick joke, provides two versions of esTool on their page, one for a floppy and one for a CD-ROM. The floppy version is just a zip containing estool.exe; the CD version, however, is zip file containing an ISO. Now, if you were expecting an ISO -- a file format meant to contain an exact replica of a disk -- to be able to be burned to a disk and you're good to go, oh ho ho, jokes on you: the ISO just contains estool.exe and a batch file called run.bat containing only the line "estool.exe" :ughh:

Magicmat
Aug 14, 2000

I've got the worst fucking attorneys
I'm trying to resize a partition using GParted and I'm running into a little trouble.

I just recently expanded my disk from 12 to 15GBs (a virtual disk inside VMWare) and now need to expand the partition to take advantage of that. Problem is, the swap space seems to be sitting between the main partition and the free space, and I can't figure out how to move it (the item is greyed out in GParted when I right click the 'extended' partition or the 'linux-swap' partition inside of it.)

The disk layout was automatically created by Ubuntu when I installed it.

Would it be best to just delete and recreate and swap partition? How could I do that in a way that will make sure Ubuntu doesn't go crazy on next boot because it can't find its swap space or something?

Edit: Never mind, figured it out. I first had to right-click the swap partition and select "Swapoff", then I was able to move and resize it at will.

Magicmat fucked around with this message at 22:43 on Mar 20, 2009

Magicmat
Aug 14, 2000

I've got the worst fucking attorneys
I'm trying to use sed to make a text file with fixed-width line wrapping (i.e., one with newlines every 80 character) into one where the text editor can put in its own soft-breaks.

Since all paragraph breaks use two newlines in a row, I decided to just search for two newlines in a row and replace them with some unique token, then delete all remaining newlines (since they should be just junk linebreaks rather than paragraph breaks we want to preserve) and then return the unique tokens back to paragraph two-newline breaks.

My idea is something like sed -r s/\r\n\r\n/\foobarbaz/g ~/myfile.txt | sed -r s/\r\n//g | sed -r s/foobarbaz/\r\n\r\n/g > ~/myfile.txt. However, I'm having trouble with even the first command, sed -r s/\n\n/\foobarbaz/g ~/myfile.txt. It doesn't seem to detect any newlines.

I tried matching a even a single newline and no luck. I tried matching a carriage, \r, return, no luck. I tried adding the -r option, no luck.

It works when I'm matching fixed text, like 's/console/command line/g', but not \n or \r. Grep will happily print out every line of text when I say grep -r '\r\n' ~/myfile.txt.

What am I doing wrong? I should note here that my text is being copy+past'ed out of my web browser, Opera, into gEdit, and saved to disk, so line endings are in \r\n format, for some reason.

Also, is there a better way to accomplish what I'm trying to do?

Edit: I should mention I'm using either the latest version of Ubuntu, or the version before that, and I'm relatively sure I'm using GNU sed since at the end of its --help output I see "E-mail big reports to: bonzin@gnu.org ."

Magicmat fucked around with this message at 12:41 on Apr 4, 2009

Adbot
ADBOT LOVES YOU

Magicmat
Aug 14, 2000

I've got the worst fucking attorneys

Mario posted:

sed ordinarily works on single lines, so it doesn't see newline characters at all, but you can use the N command to append the next line to the current one, including the newline.

try sed ':a;N;s/\n\([^\n]\)/ \1/g;ta'

:a is a label, N appends the next line, s/\n\([^n]\)/ \1/g replaces a newline with a space if it is not immediately followed by another newline, and finally ta jumps back to the start if it matched something.

code:
I'm trying
to use sed to
make a
text
file

Since all
paragraph breaks
use two newlines
in a
becomes:
code:
I'm trying to use sed to make a text file

Since all paragraph breaks use two newlines in a
OK, I think I've got you, but I have a few questions still. First, why the need for the label and to jump back to the start? I thought /g was supposed to make it global, so why the infinite loop?

Second, why the escaped parenthesis in the regex? i.e., \([^\n]\). I get the need to put the negated character class in parenthesis, to capture it in a numbered capture group, but why escaped? Won't that make it match a literal parenthesis character?

Excuse my dumb questions, but I'm largely ignorant about how sed works, and the documentation is pretty dense at times (and way too sparse at others.)

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply