this post was submitted on 18 Aug 2024
4 points (100.0% liked)

linux4noobs

973 readers
24 users here now

linux4noobs


Noob Friendly, Expert Enabling

Whether you're a seasoned pro or the noobiest of noobs, you've found the right place for Linux support and information. With a dedication to supporting free and open source software, this community aims to ensure Linux fits your needs and works for you. From troubleshooting to tutorials, practical tips, news and more, all aspects of Linux are warmly welcomed. Join a community of like-minded enthusiasts and professionals driving Linux's ongoing evolution.


Seeking Support?

Community Rules

founded 1 year ago
MODERATORS
 

I'm having an issue trying to burn a music CD for use in my (very old, I know I know) car. I'm running FedoraKDE (40) and Brasero, a Liteon brand external optical DVDRW drive, CD-R (TDK brand), and a Framework 16.

The issue I'm having seems to be that the blank disks(maybe?) aren't recognized automatically by Fedora, when I pop a full commercially released CD in it'll play/rip, but with a blank disk nothing happens, and I don't know where to "save" the "image" of this album I'm creating in Brasero to get it on the disk.

Someone on a random linux forum told some other guy to run cdrecord -checkdrive which says my drive is at /dev/sr0 with a blank disk, but that's as far as I've gotten. Do I choose sr0 as the place to save it? It says "something something overwrite" when I try which makes me wary, it seems it wants to overwrite "sr0" itself and either bork my drive or install, but maybe?

I'm positive it's just something simple I'm missing, any help would be greatly appreciated and I can answer questions and run commands if needed (but I don't actually have WIFI rn, so I'll have to have the package for said command already.)

Thanks in advance.

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 1 points 1 month ago (13 children)

I did a bit of googling and it seems like "Brasero" had widespread popularity. I found this:https://documentation.suse.com/sles/12-SP5/html/SLES-all/cha-gnome-burn.html, but can't test it because I haven't had a disk drive in at least a decade. Since this is forum meant for noobs, please let me know if you need guidance on how to install Brasero and I would be happy to help. From there, it has a GUI and should be quite familiar to anyone who used Winamp, itunes, or windows media player back in the day.

[–] [email protected] 1 points 1 month ago* (last edited 3 weeks ago) (12 children)

Thank you for your assistance. The issue isn't "how to install brasero" however.

As per the documentation, it says

1. Select Project › New Project › New Audio Project.

2.    Drag and drop the individual audio tracks to the project directory. The audio data must be in WAV or Ogg Vorbis format. Determine the sequence of the tracks by moving them up or down in the project directory.

3.    Click Burn. A dialog opens.

4.    Specify a drive to write to.

 5.   Click Properties to adjust burning speed and other preferences. When burning audio CDs, choose a lower burning speed to reduce the risk of burn errors.

6.    Click Burn.

My issue is during 4. The dialog pops up just as you'd expect. Where do I choose to save the file? It defaults to being open on /home/, however I think if I save it there, the files will not be on my disk, they'll be in my home dir. Where is the disk?

[–] [email protected] 1 points 1 month ago (1 children)

Aha! I understand now. So, on Linux, everything is a file. Even Disk Drives, CDs, flash drives, etc. I think this may be the root of your confusion. Instead of new drive D:// popping up somewhat parallel to your C:// file system (as it would in Windows), it shows up inside your existing file system.

You were on the right path before. The cdrecord command you ran seems to have correctly told you the location of the CD in your file system (/dev/sr0) . I imagine this changes with distro and hardware, but I'm not sure because my CD burning days predate my Linux days. If you want to make sure that this is indeed the correct place to save the file, then run the command again with the CD removed. If it disappears, then you've got it.

The closest thing I've done is install raspberry OS to a flash drive, which often shows up as /dev/sd0, so it seems like you were very much on the right track. The /dev folder means "device", so most hardware peripherals will have some kind of presence here.

[–] [email protected] 1 points 1 month ago (1 children)

Yes that is indeed what I seek, thank you!

Well so it seems it is on /dev/sr0, because I have found some help on burning the disk through CLI with cdrecord itself, and sox to convert the files to .cdr format. The disk is now "burning" (well, it sounds like it! We'll see if it plays here shortly), but I would like to find out how to use brasero to do it.

For now though I can write a script to convert all the files in a given dir to .cdr and then auto burn them to the disk if this works though which ain't too shabby.

[–] [email protected] 0 points 1 month ago (1 children)

It looks like Brasero would handle all of that kind of Media Management stuff for you, so try it out before you reinvent the wheel.

[–] [email protected] 0 points 1 month ago (1 children)

Well that's the thing, I still haven't figured out how to make brasero actually do anything, but I have already written and tested my first version of my script and it's burning my second disk now. On this test I've figured out another line I need to add to improve it (and make it clean up the .cdr files after itself.) So, unless I can find someone with better instructions on brasero than "just do it" it seems I'm stuck with reinvention.

Incidentally, is it better for me to call sudo inside the script for cdrecord -v or should I not use it inside and instead run sudo myscript for the whole thing?

[–] [email protected] 0 points 1 month ago (1 children)

I think Ideally you should be able to run it as you instead of root or sudo. I'm assuming you are needing sudo since you don't have access to the burner as your user.

Do an "ls -lah" on your cd burner. I think you said it was /dev/sr0 so "ls -lah /dev/sr0" and see if it is owned by root:root or hopefully root:disk or something like that. The format is "user:group" so I'm hoping it is owned by a group that you can simply add your user to.

If it is owned by another group, you can just run "sudo usermod -aG disk user" replace disk with the group that shows on the ls command and user with your user.

If that burner is owned by root:root, there is a way to change that. But that gets very complicated. And I'm not sure its worth the effort for you unless you are wanting to learn more. Point 4.3 here: https://wiki.archlinux.org/title/Udev

In which case to directly answer your question, I'd personally prefer to sudo the script instead of adding sudo in the script. But at the end of the day, I don't think it matters too much for this specific use case.

[–] [email protected] 0 points 1 month ago* (last edited 1 month ago) (1 children)

Looks like root, I think. It says

brw-rw----+ 1 root cdrom 11, 0 Aug 18 14:13 /dev/sr0

no ":" though oddly, so maybe I can run

sudo usermod -aG cdrom $USER?

Edit: looks like it throws the same error as not sudoing, wodim no write mode specified blah blah. It did add me to the cdrom group though. Although now it won't work with sudo, how do I remove myself from the cdrom group?

Edit again: Wait, I got it working with another disk, the one I was just trying may have been too big to fit on the disk but throwing the same error as when I didn't use sudo. Burning this one with sudo, will test again without when it finishes. Thankfully I have a stack of these disks lol I can do this all day.

Ok, still need sudo. Without sudo it just exits without writing to the disk. I guess what I thought was warnings is just standard incomprehensible readout, but yeah without sudo (or if the files are too big for the disk) it just exits and finishes out my script removing the .cdr files.

[–] [email protected] 0 points 1 month ago (1 children)

My bad thought it was printed as "user:group" and not "user group".

When you add yourself to a group you need to either log out and log back in or reboot in order for it to take effect. So maybe next time you log in try it without sudo again.

[–] [email protected] 0 points 1 month ago* (last edited 1 month ago) (1 children)

Oh cool thanks I'll log out and try again. Ran into another issue in my script I'm trying to work around now though: I disconnected and reconnected the drive, now it's /dev/sr1!

So, I guess I need to have my script run cdrecord -checkdrive, and then take that answer as a variable $CDROM and pump it back into cdrecord -v dev=/dev/$CDROM -audio yadda yadda.

This is getting a liiitle above my head lmao.

Edit: logged out and in, no dice, still sudo. Now to figure out this checkdrive issue...

[–] [email protected] 0 points 1 month ago (1 children)

Ahhh, so apparently in the man page for cdrecord it mentions it needs to be ran as root since it uses "real time scheduling" to write. So even if you have proper permissions to use the cd burner, you still need root to run it. I made a bad assumption that you were having to use root since you didn't have permissions as your use to write to it.

If you don't need to parse the output of "cdrecord -checkdrive" then setting that var is pretty trivial.

CDROM=$(cdrecord -checkdrive)

If that outputs more than just the string you need, that gets a little headachey. Grep/awk/sed/sort/uniq/regex are all very powerful and esoteric.

That being said, the man page also mentions that most users will not have to specify "dev" at all as it should figure it out automatically. So you might be ok with axing the "dev" part of the command instead of feeding it the device path.

[–] [email protected] 1 points 1 month ago* (last edited 1 month ago) (1 children)

AH! Oh well no harm no foul, I can run my script as root, I trust me!

Cdrecord -checkdrive does output a whole mess of stuff:

Device was not specified. Trying to find an appropriate drive...
Detected CD-R drive: /dev/sr0
Device type    : Removable CD-ROM
Version        : 0
Response Format: 2
Capabilities   : 
Vendor_info    : 'Slimtype'
Identification : 'eNAU108   8     '
Revision       : 'XL0A'
Device seems to be: Generic mmc2 DVD-R/DVD-RW.
Using generic SCSI-3/mmc   CD-R/CD-RW driver (mmc_cdr).
Driver flags   : MMC-3 SWABAUDIO BURNFREE FORCESPEED 
Supported modes: TAO PACKET SAO SAO/R96P SAO/R96R RAW/R16 RAW/R96P RAW/R96R

And the only part I need is the part that says /dev/sr0/.

I will try deleting the /dev/ part entirely though and see what happens (probably tomorrow evening). If it works that'll be perfect. Thanks!

Edit: No dice, dev=/dev/sr0 is needed in my case.

[–] [email protected] 2 points 1 month ago (1 children)

This is a very goofy workaround for you that doesn't actually check what the device is. Only checks if /dev/sr0 exists and if yes, use that if no then use /dev/sr1. Better solution below this block. But leaving it because I kind of like it's jankiness.

if [ -e /dev/sr0]; then
    DEVICE="/dev/sr0"
else
    DEVICE="/dev/sr1"
fi

Not elegant and a little janky but works.

This will work better. We are taking the output of -checkdrive, searching for "Detected" and sending that to awk. We are telling awk to split that line into columns based on this character ":" and to print the second column. That should give you an output of " /dev/sr0" with a space in front.

DEVICE=$(cdrecord -checkdrive | grep Detected | awk -F ":" '{print $2}')

That should work. But if you absolutely must kill the whitespace for some reason we can add trim to the end like so

DEVICE=$(cdrecord -checkdrive | grep Detected | awk -F ":" '{print $2}' | tr -d ' ')

There might be a more elegant solution by using the output of "cdrecord -scanbus" instead. No clue though since I don't have the hardware to verify from here. Hope that helps!

[–] [email protected] 1 points 1 month ago

This looks like it'll work perfectly, thank you! When I get home from work I'll play around with -scanbus and see if it works out first, then I'll try with the space and if no dice I'll try without the space!

I'm also going to try k3b and see how that works as another poster was saying, but at this point I think I prefer the script lmao!

load more comments (10 replies)
load more comments (10 replies)