date int64 1,220B 1,719B | question_description stringlengths 28 29.9k | accepted_answer stringlengths 12 26.4k | question_title stringlengths 14 159 |
|---|---|---|---|
1,394,641,957,000 |
Is it possible to export a block device such as a DVD or CDROM and make it so that it's mountable on another computer as a block device?
NOTE: I'm not interested in doing this using NFS or Samba, I actually want the optical drive to show up as a optical drive on a remote computer.
|
I think you might be able to accomplish what you want using network block devices (NBD). Looking at the wikipedia page on the subject there is mention of a tool called nbd. It's comprised of a client and server component.
Example
In this scenario I'm setting up a CDROM on my Fedora 19 laptop (server) and I'm sharing it out to an Ubuntu 12.10 system (client).
installing
$ apt-cache search ^nbd-
nbd-client - Network Block Device protocol - client
nbd-server - Network Block Device protocol - server
$ sudo apt-get install nbd-server nbd-client
sharing a CD
Now back on the server (Fedodra 19) I do a similar thing using its package manager YUM. Once complete I pop a CD in and run this command to share it out as a block device:
$ sudo nbd-server 2000 /dev/sr0
** (process:29516): WARNING **: Specifying an export on the command line is deprecated.
** (process:29516): WARNING **: Please use a configuration file instead.
$
A quick check to see if it's running:
$ ps -eaf | grep nbd
root 29517 1 0 12:02 ? 00:00:00 nbd-server 2000 /dev/sr0
root 29519 29071 0 12:02 pts/6 00:00:00 grep --color=auto nbd
Mounting the CD
Now back on the Ubuntu client we need to connect to the nbd-server using nbd-client like so. NOTE: the name of the nbd-server is greeneggs in this example.
$ sudo nbd-client greeneggs 2000 /dev/nbd0
Negotiation: ..size = 643MB
bs=1024, sz=674983936 bytes
(On some systems - e.g. Fedora - one has to modprobe nbd first.)
We can confirm that there's now a block device on the Ubuntu system using lsblk:
$ sudo lsblk -l
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 465.8G 0 disk
sda1 8:1 0 243M 0 part /boot
sda2 8:2 0 1K 0 part
sda5 8:5 0 465.5G 0 part
ubuntu-root (dm-0) 252:0 0 461.7G 0 lvm /
ubuntu-swap_1 (dm-1) 252:1 0 3.8G 0 lvm [SWAP]
sr0 11:0 1 654.8M 0 rom
nbd0 43:0 0 643M 1 disk
nbd0p1 43:1 0 643M 1 part
And now we mount it:
$ sudo mount /dev/nbd0p1 /mnt/
mount: block device /dev/nbd0p1 is write-protected, mounting read-only
$
did it work?
The suspense is killing me, and we have liftoff:
$ sudo ls /mnt/
EFI GPL isolinux LiveOS
There's the contents of a LiveCD of CentOS that I mounted in the Fedora 19 laptop and was able to mount it as a block device of the network on Ubuntu.
| How can I mount a block device from one computer to another via the network as a block device? |
1,394,641,957,000 |
How can I convert a .cue / .bin (cdr track) image into a single .iso file?
I have
Fedora 16 (x86-64)
Linux 3.1.9-1.fc16.x86_64 #1 SMP Fri Jan 13 16:37:42 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
|
You should look at bchunk, which is specifically meant for this type of conversion. You should be able to install it with sudo yum install bchunk, but I'm only 95% sure it's in the standard repo. bchunk will create an ISO from any data tracks, and CDR for any CD audio. If you want everything in one ISO bchunk is not appropriate.
The syntax is like this,
bchunk IMAGE.bin IMAGE.cue IMAGE.iso
To create a single ISO with all the tracks in one take a look at bin2iso. bin2iso is most likely not included in your standard repo. Although RPMs do exist unofficially online. I prefer PowerISO over bin2iso, as bin2iso is fairly non-updated.
bin2iso <cuefile>
You could also do the conversion using PowerISO.
It is commercial software, but the linux version is freeware. Sometimes if I have problems with the Free Software for different image conversions, I give PowerISO a go.
| How can I convert a .cue / .bin ( with cdr tracks) image into a single .iso file? |
1,394,641,957,000 |
I have an ISO file, which I burned to a CD. Now how can I check if the CD is correctly created? I would like a command that calculate the hash sum that I can use to check with the hash sum I calculate on the ISO file. Ideally the command should:
Work regardless of the ISO file: that is, I don't want to keep a list of hash sum for each file in the disc, or remember the number of blocks whatever
Be relatively short: a one-line command is great, a chain of commands which is two line long is OK, a script that span one page is not
Be fairly efficient: for example, dd the disc back to a file then run md5sum on the file is unacceptable
If there is no answer that cannot satisfy all I will appreciate the nearest match too. Even better if you can tell me why it is not so straight-forward.
|
The basic problem is that we want to take the md5sum of the exact same information that was on the ISO originally. When you write the ISO to a CD, there is likely blank space on the end of the disk, which inevitably changes the md5sum. Thus, the the very shortest way:
md5sum /dev/cdrom
doesn't work. What does work (and is common in online documentation) is only reading the exact number of bytes from the device and then doing the md5sum. If you know the number of bytes you can do something like:
dd if=/dev/cdrom bs=1 count=xxxxxxxx | md5sum
where 'xxxxx' is the size of the iso in bytes.
If you don't know the number of bytes off hand, but have the iso on your disk still, you can get them using ls by doing the something like the following (taken from here):
dd if=/dev/cdrom | head -c `stat --format=%s file.iso` | md5sum
There are many other one-line constructions that should work. Notice that in each case we are using dd to read the bytes from the disk, but we aren't piping these to a file, rather, we are handing them to md5sum straight away.
Possible speed improvements can be made by doing some calculations to use a bigger block size (the bs= in the dd command).
| Calculate md5sum of a CD/DVD |
1,394,641,957,000 |
I have CDs for Age of Empire III and I would like to play it in a Windows 10 VM. Is this possible? I know how to insert virtual CDs (i.e., ISO files) into a VirtualBox VM (via the "Storage" settings), but physical CDs are a different story. The best solution I can think of is to add where I've mounted the CDs on my Linux system to the system via shared folders.
|
Yes you can, but you need to have DVD passthrough active.
Go to VirtualBox's Machine > Settings > Storage > Enable Passthrough for the DVD drive.
To allow an external DVD drive to be recognized by a VirtualBox Virtual Machine (VM) it must be configured in such a way that "passthrough" is enabled.
Enabling Passthrough allows the underlying operating system to pass the required commands through to the device that is connected to the Virtual Machine as opposed to the host operating system instance.
http://www.tempusfugit.ca/techwatch.ca/passthrough.html
| Is it possible to insert a physical CD into a VirtualBox machine? |
1,394,641,957,000 |
Up until Fedora 14 I was successfully using cdctl to enable/disable the CD/DVD eject button on my laptop (Thinkpad T410). Sadly it has stopped working now.
I've consulted the methods discussed in these 2 questions:
disable cd/dvd button on linux laptop (ubuntu)
Disable the DVD eject button on a Thinkpad running Linux
None of which have worked for me. So I turn back to cdctl to see if we can't fix what's broken with it, since it's worked for so long.
Debugging the issue
So starting with cdctl switches I notice that most things seem to work just fine.
Examples
These things work.
ejects the drive
$ cdctl -e
list capabilities
$ cdctl -k
Tray close : 1
Tray open : 1
Can disable eject : 1
Selectable spin speed : 1
Is a jukebox : 0
Is multisession capable: 1
Can read the MCN (UPC) : 1
Can report media change: 1
Can play audio discs : 1
Can do a hard reset : 1
Can report drive status: 1
According to that list cdctl even thinks that it can enable/disable the eject button.
Can disable eject : 1
So I continue on with debugging the issue.
Debugging cdctl
So I figure lets do an strace on cdctl to see if it can shed some light on what's going on.
$ strace cdctl -o1
...
brk(0) = 0x1371000
open("/dev/cdrom", O_RDONLY|O_NONBLOCK) = -1 ENOENT (No such file or directory)
open("/dev/cd", O_RDONLY|O_NONBLOCK) = -1 ENOENT (No such file or directory)
open("/dev/scd0", O_RDONLY|O_NONBLOCK) = -1 ENOENT (No such file or directory)
open("/dev/sr0", O_RDONLY|O_NONBLOCK) = 3
ioctl(3, CDROM_LOCKDOOR, 0x1) = 0
close(3) = 0
exit_group(0) = ?
+++ exited with 0 +++
Curiously it seems like cdctl thinks it's disabling the button.
$ strace cdctl -o1
ioctl(3, CDROM_LOCKDOOR, 0x1) = 0
$ strace cdctl -o0
ioctl(3, CDROM_LOCKDOOR, 0) = 0
NOTE: If I understand this right, the return of a 0 means it was successful.
One thing that caught my eye here was the list of devices that cdctl is attempting to interact with. So I thought "what if I try these devices with eject"?
eject command
One of the other commands I used to use years ago was the eject command to interact with the CD/DVD device. I noticed that this command also now has a similar named switch:
$ eject --help
-i, --manualeject <on|off> toggle manual eject protection on/off
Example
$ eject -i 1 /dev/sr0
eject: CD-Drive may NOT be ejected with device button
$ eject -i 0 /dev/sr0
eject: CD-Drive may be ejected with device button
So eject too thinks that it's disabling the button, yet it isn't either. Using strace here I see the same system calls:
$ strace eject -i 1 /dev/sr0 |& grep ioctl
ioctl(3, CDROM_LOCKDOOR, 0x1) = 0
$ strace eject -i 0 /dev/sr0 |& grep ioctl
ioctl(3, CDROM_LOCKDOOR, 0) = 0
So now I'm wondering if UDEV or something else is potentially blocking or taking ownership of device?
Thoughts?
|
Thanks to @Affix's answer which gave me the right direction to head, I've figured out the solution to the problem.
The problem is definitely caused by UDEV as you've guessed. The issue is this line that is in most UDEV files related to the cdrom drive.
Example
On Fedora 19 there is the following file, /usr/lib/udev/rules.d/60-cdrom_id.rules. In this file is the following line which is co-opting the eject button for CD/DVD devices.
ENV{DISK_EJECT_REQUEST}=="?*", RUN+="cdrom_id --eject-media $devnode", GOTO="cdrom_end"
You can work around the issue and disable UDEV's ability to co-opt the eject button by doing the following:
Make a copy of the file 60-cdrom_id.rules
$ sudo cp /usr/lib/udev/rules.d/60-cdrom_id.rules /etc/udev/rules.d/.
Edit this copied version of the file and comment out the line containing the string, DISK_EJECT_REQUEST.
$ sudoedit /etc/udev/rules.d/60-cdrom_id.rules
Save the file and the change should be noticeable immediately!
The above solution fixes the problem for both eject and cdctl. So now the following commands work as expected:
lock the drive
$ eject -i on /dev/sr0
eject: CD-Drive may NOT be ejected with device button
-or-
$ cdctl -o1
unlock the drive
$ eject -i off /dev/sr0
eject: CD-Drive may be ejected with device button
-or-
$ cdctl -o0
| How can I disable the button of my CD/DVD drive? |
1,394,641,957,000 |
Hey my iso file won't accept device files so I was wondering how I could mount a cdrw with an iso9660 filesystem as read write to copy device files to the cdrw.
|
You can't mount iso9660 read-write, the filesystem is laid out for reading only (there is no space for files to grow, for example). I don't know if you can create such a filesystem with device nodes either. What are you trying to do? If you want to create a custom LiveCD, look at the tools your favorite distribution uses to do that.
| How to mount iso9660 filesystem as read write |
1,394,641,957,000 |
I attempted to install Debian through a CD, with the initial .exe working fine. However, when I rebooted and went through the installation procedure, my system could not tell that there was a disk there (or the media was unreadable). Now whenever I boot up my computer, I get the choice between continuing on to windows or to complete my installation. How do I remove that choice? Do I have to go through BIOS or are the files on my Windows partition?
|
Although, via msconfig I couldn't find the "continue with the installation" partition in my disk as a start up thread, nor with disk management, the solution is really simple:
Open command prompt: cmd
Type bcdedit (as Marcos suggested)
You will find the booting partitions (this term doesn't really exist)
Spot the partition that says "Continue with installation" as a description
Copy its {identifier} (yeah, that long number)
Finally, type bcdedit /delete {identifier}, where in the place of identifier you have to put the identifier you selected. (Make sure to keep the identifier between braces {..} ).
This worked for me in Windows 7 so I guess it can do the job in most of the systems.
| Removing Debian Installation Prompt |
1,394,641,957,000 |
Writing CDs with cdrecord and making images with genisoimage is no problem.
I want to write DVDs in a similar manner, first creating an image, then burning it to disk. This is quite beneficial, since I can inspect the image before burning it to disk.
Now, all I've seen, is how to use the growisofs command to burn something to DVD, but all how-to's were using ISO9660 for DVDs. But I want to burn UDF images. Before I can burn them, I need to make them, but how do I create UDF images?
Also, If you could explain, or link on how to burn BluRay, that would be great, too.
All tools must be command line, as I need to work with it, where GUI is no option.
|
There are in fact two ways of generating a UDF filesystem image on Linux, depending on your requirements.
Create a UDF/ISO-9660 image with mkisofs
The mkisofs tool has the ability to generate a combined UDF and ISO-9660 bridge filesystem in a single pass. This is a filesystem that stores both a UDF directory and a legacy ISO-9660 directory referring to the same file data (so the data is only stored once). Any modern operating system (Windows XP or newer) will access the UDF data and completely ignore the ISO-9660 information, so to all intents and purposes this is a UDF filesystem.
The advantage of this approach is that you can create the filesystem in one pass, starting with an input directory and ending with a populated filesystem image. This means you can also dump the output directly to growisofs and burn it straight to disk. The possible disadvantage is that there will be a small amount of space wastage due to the legacy ISO-9660 structures, and the resulting filesystem will not be writable (so you can't use it for your DVD-RAM or BD-RE media if you want to be able to modify the data on a mounted disk).
To generate such a filesystem image, you would use a command like:
mkisofs -udf -o myimage.udf -V MyDiskTitle /path/to/input/files
or to burn directly to disk:
growisofs -Z /dev/dvd -udf -V MyDiskTitle /path/to/input/files
Note that to use this option you need a recent version of proper mkisofs, not the abandoned and ancient genisoimage fork that ships with many Linux distributions.
Create a "pure" UDF filesystem with mkudffs
If you absolutely must have a pure UDF filesystem with no ISO-9660 data structures, you can use the mkudffs tool from the udftools package along with a loopback device to generate a local image. This requires more steps than using mkisofs above, but it is the only way to generate both a pure UDF filesystem and one which can be mounted read-write after being burned to random-access media like DVD-RAM or BD-RE.
First, you need to generate a blank file to contain the image. Here the size is given as 650 MB to match a standard CD, this will obviously need to be larger for a DVD/Blu-Ray. See this wikipedia article for the exact sizes of DVD media.
$ truncate -s 650M /tmp/cdimage.udf
Now invoke mkudffs to generate a UDF filesystem in this blank image:
$ mkudffs --media-type=dvdrw /tmp/cdimage.udf
See mkudffs(1) for other possible media types. Both truncate and mkudffs will create sparse files if your filesystem supports them; so the image won't occupy the full size unless you fill it.
Then you can mount your image locally to copy data to it
$ sudo mkdir /media/udfimage
$ sudo mount -t udf -o loop,rw /tmp/cdimage.udf /media/udfimage
After the data has been copied to the image, the process is followed in reverse to unmount the image and detach the loopback device:
$ sudo umount /dev/loop0
| How to create UDF images and burn them to DVD or CDROM? |
1,394,641,957,000 |
I would like to create a ISO file for testing optical drives with the method mentioned here. I want to create an ISO file filled with random data, so I can burn it to a CD, read it back and compare with the original ISO. I think the command bellow will do what I want.
dd if=/dev/urandom of=cd-rom_test.iso bs=2048 count=333000
However, I am unsure of a few things.
First of all what should the block size be? Do ISO images include the header and error correction data that is on a CD? Should the block size be 2048 (without header and error correction) or 2352 (with header and error correction)?
Secondly, a few sites I have come across have sync in the conv option (example here). Which as far as I can see fills the header and error correction information with 0s, which surely isn't right.
|
Since you're writing to a file with dd, the block size will not change the resulting output. Block size only matters when writing to devices.
You're reading from a device that won't ever return short reads, so you don't need to use sync to pad blocks.
In any event, dd does not have read or write access to the error correction data. As with magnetic media, the drive manages that data and you see only the error-corrected blocks.
| Create a Random ISO Image Using dd |
1,394,641,957,000 |
If I:
dd if=/dev/cdrom of=cdrom.iso
then I will always get the exact same, bit-by-bitly same image that is the same as the original CDROM?
Or are there any methods that prevents copying all the bits from the CDROM? Asking for archiving old games on old CDROMS
|
No, dd can be not sufficient. As examples:
If you have a multi-track cd-rom with data and audio track mixed, using dd you will copy only the first data session.
Many old video-games cd (on Play-Station 1) use as copy-protection some fake session on the cd. You have to replicate them to obtain a working cd.
I successfully used cdparanoia to backup quite all my old game cds.
| If I dd a CDROM, then I always get the exact copy of the CDROM? |
1,394,641,957,000 |
So I recently installed Debian 8 and am currently trying to get the software configured with my NVIDIA video card. The official Debian page instructed me to do this:
Add
deb http://http.debian.net/debian/ jessie main contrib non-free
to the /etc/apt/sources.list.
Run
# aptitude update
and then run
# aptitude -r install linux-headers-$(uname -r|sed 's,[^-]*-[^-]*-,,') nvidia-kernel-dkms
I am not sure what I did wrong, because when I run the second command, it displays this message to me:
0 packages upgraded, 16 newly installed, 0 to remove and 0 not upgraded. Need to get 0 B/21.9 MB of archives. After unpacking 80.5 MB will be used. Do you want to continue? [Y/n/?] y
Media change: Please insert the disc labeled 'Debian GNU/Linux 8.1.0 _Jessie _ - Official amd64 kde-CD Binary-1 20150606-14:19' into the drive '/media/cdrom/' and press [Enter].1
I do not possess an optical drive so this creates a great issue for me.
I got the instructions from here.
See “Installation: Debian 8 'Jessie'”
|
There is probably a line in /etc/apt/sources.list (or in one of the files in /etc/apt/sources.lists.d/) starting with
deb cdrom ...
Comment this line out and Debian won’t try to install packages from this disc.
| [Linux Debian 8]: Driver Installation asks me to insert a disc |
1,394,641,957,000 |
How to mount the CD-ROM on Solaris 10 without knowing the CD-ROM device name?
|
You do want to mount a CD read-only with:
mount -F hsfs -o ro /dev/sr0 /cdrom
I have never used any solaris machines with multiple CDs myself, but I assume you can use /dev/sr1 etc. for the other drives.
| How to mount the CD-ROM on Solaris 10? |
1,394,641,957,000 |
My linux system scans my cdrom on boot. Can I disable that feature without removing my cdrom tray?
|
If you are running LVM, or have the LVM tools installed, it will scan for LVM devices during the init sequence. This is controlled by the lvm config file (/etc/lvm/lvm.conf on Debian).
The config file may have a commented-out line to exclude /dev/cdrom from its scan. Check this and uncomment it, or substitute a different device name if you don't have /dev/cdrom.
In the devices section, you want a line like:
filter = [ "r|/dev/cdrom|" ]
| Why does linux scan my cdrom on boot? |
1,394,641,957,000 |
I used to be able to run either commands successfully on my Fedora 14 Thinkpad T410 laptop:
$ wodim --scanbus
$ wodim --devices
However since upgrading to Fedora 19 this no longer seems to work and I'm not sure why. Are there any alternative methods for getting the drives capabilities from wodim?
|
I wasn't able to confirm this is truly a bug or not but this Ubuntu bug would seem to lead credence to this assumption, titled: "wodim doesn't find my DVD writer".
This thread listed a workaround by including the dev= to wodim. This works so long as you know your CD/DVD devices handle.
--scanbus
$ wodim dev=/dev/sr0 --scanbus
scsibus1:
1,0,0 100) 'Optiarc ' 'DVD RW AD-7930H ' '1.D1' Removable CD-ROM
1,1,0 101) *
1,2,0 102) *
1,3,0 103) *
1,4,0 104) *
1,5,0 105) *
1,6,0 106) *
1,7,0 107) *
--devices
$ wodim dev=/dev/sr0 --devices
wodim: Overview of accessible drives (1 found) :
-------------------------------------------------------------------------
0 dev='/dev/sr0' rwrw-- : 'Optiarc' 'DVD RW AD-7930H'
-------------------------------------------------------------------------
An alternative?
As an alternative you can also list the devices in wodim without having to know the device ahead of time by using the -prcap switch.
$ wodim -prcap
wodim: Operation not permitted. Warning: Cannot raise RLIMIT_MEMLOCK limits.
Device was not specified. Trying to find an appropriate drive...
Detected CD-R drive: /dev/sr0
Using /dev/cdrom of unknown capabilities
Device type : Removable CD-ROM
Version : 5
Response Format: 2
Capabilities :
Vendor_info : 'Optiarc '
Identification : 'DVD RW AD-7930H '
Revision : '1.D1'
Device seems to be: Generic mmc2 DVD-R/DVD-RW.
Drive capabilities, per MMC-3 page 2A:
Does read CD-R media
Does write CD-R media
Does read CD-RW media
Does write CD-RW media
Does read DVD-ROM media
Does read DVD-R media
Does write DVD-R media
Does read DVD-RAM media
Does write DVD-RAM media
Does support test writing
...
This 3rd method would seem to be the best option.
| Getting capabilities of my CD/DVD drive when wodim --devices doesn't work |
1,394,641,957,000 |
I am using Ubuntu server as a samba server. The solution I am looking for is whenever the disks are inserted (cd or dvd) they should get auto-mounted to /cdrom directory. Are there any tools for achieving this? I installed ivman, and it is running as a daemon. But it is doing nothing.
EDIT 1: Tried autofs, and it doesn't work as well. There is a bug report on launchpad which suggests that autofs for lucid is broken.
|
Personally I would go the autofs-route. But as you stated autofs might be broken on Lucid (I'm not an Ubuntu-User).
You could also try udev-wrappers or rules. The Arch Linux wiki has something on that. https://wiki.archlinux.org/index.php/Udev#UDisks
| Auto mount cd or dvd on CLI based ubuntu server |
1,394,641,957,000 |
I'm running Debian. I've changed computer, migrating the root partition, a few times. My cdrom drive is listed as /dev/cdrom3. This does sometimes cause some problems. I'd like to rename it to /dev/cdrom0. I was able to rename my ethernet card to eth0, but cannot find instructions on how to do this. Do you have any idea?
Thanks
|
You need to edit the file /etc/udev/rules.d/70-persistent-cd.rules
Simply look for the line that contains the entry SYMLINK+="cdrom3" and rename it to your liking.
To make the changes take effect, I think a simple restart of udev would work (service udev restart) although you might need a reboot.
| Linux: how to rename cdrom drives |
1,394,641,957,000 |
I'm attempting to mount a CD drive (via USB) and read the contents of the CD in the drive. I'm able to mount the drive fine, but I'm unable to read the contents. Here's what I've done:
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sr0 11:0 1 881.6M 0 rom
$ sudo mount -t iso9660 -o ro /dev/sr0 /mnt/cd
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sr0 11:0 1 881.6M 0 rom /mnt/cd
$ ls /mnt/cd/
ls: cannot open directory '/mnt/cd': Permission denied
I've also tried as root, but without any luck. dmesg shows
[1422983.554740] ISO 9660 Extensions: Microsoft Joliet Level 3
[1422983.670987] ISO 9660 Extensions: RRIP_1991A
The CD contains a program to install a software program on windows, if that matters.
Is there a way to debug what might be going on here? Any thoughts on why this appears to mount fine, but I'm not able to read the contents?
Edit
The output of ls -l /mnt is:
drwx------ 7 nobody root 4.0K Jun 22 2016 cd
However, I've also tried
$ sudo ls /mnt/cd
ls: cannot open directory '/mnt/cd': Permission denied
|
ISO 9660 Extensions: RRIP_1991A
This message indicates the CD was created with Rock Ridge extensions, meaning that the files and directories within can have Unix-style user/group IDs and permissions assigned to them. Unless the permissions are set world-readable, you may have trouble reading the CD if it does not happen to have UID/GID numbers matching your system's.
So, you will need to override the UID/GID information. You can do it by adding some mount options:
sudo mount -t iso9660 -o ro,uid=$(id -u),gid=$(id -g) /dev/sr0 /mnt/cd
Note: no spaces before or after the commas!
Before executing the sudo command line, your shell will replace the $( ... ) parts by running the commands inside the parentheses and replacing the expressions with the results of those commands. Only after this is done, the sudo mount ... will execute.
The result will be that those uid= and gid= options will be auto-filled by the actual UID/GID values of your regular non-root user account.
Now, you will be treated as the owner of any files on the CD, and unless the CD has totally insane permissions, you should be able to read everything on it without being root.
| Unable to read CD contents after mounting |
1,394,641,957,000 |
I want to add +x permission executable on my ISO. So I can run it directly on Linux host when clicking my CD-ROM.
I tried sudo chmod 555 tester and then burned it on ISO, but the tester only had read permission on ISO
|
As answered by Vlastimil, the ISO 9660 file system is fairly limited, and several extensions were developed to overcome its shortcomings. E.g. Joliet adds support for Unicode filenames, El Torito allows for bootable CD-ROMs and Rock Ridge enables you to use Unix file permissions on the files.
To be able to use Unix permissions on the CD-ROM files you need to add the Rock Ridge extensions when creating the disk's image. You need to check the settings for the software you are using to build the disk's filesystem, to indicate you want to add this extension (incidentally, you are likely to also find options for adding the Joliet extension for Unicode filenames, or for creating a bootable disk with El Torito).
I'm not a Linux user, but a quick search on mkisofs's manpage shows that this can be done by using the -R or -r switch (they're not equivalent, check the man page). Of course, the extension(s) must also be supported by the mount command, but this should be the case for any modern OS.
You ask specifically about CD-ROMs, but for completeness sake, I'll just add that DVDs are usually authored using the UDF file system, which has native support for Unix permissions.
| Set +x executable permission on a CD-ROM |
1,394,641,957,000 |
My understanding is that Debian and all the software available in the matching online repo (eg: https://packages.debian.org/stable/allpackages) are released together on a series of disc images (alternatively you can just download the first disc and use apt-get to download individual packages), however when I look in http://cdimage.debian.org/debian-cd/7.4.0/amd64/iso-dvd/ there are only 3 dvd images which seems a little on the small side for thousands of applications. Is the entire repo on those discs, or just the most popular applications?
I have already looked at the section on cds here: www.debian.org/CD/faq/#which-cd and it simply talks about how the discs arranged with the the most popular applications first, but doesn't say if all applications are included.
EDIT:
I've been browsing some of the http/ftp mirrors and most of them have 3 iso, but I found some that have more. This one has 10: ftp://debian.mirror.iweb.ca/debian-cd/7.4.0/amd64/iso-dvd/
How many isos is there in total?
|
These DVDs contain all the binary packages in main. See, for example
Where is the CD image with non-free?, which explains why non-free software is not included. For the purposes of this question, we can consider both the non-free and contrib section of the archives to be non-free software. The contrib section corresponds to software that is itself free, but depends on software that is non-free. Therefore the software in the contrib section is not included, since it does not make sense to include it without the software in the non-free section.
The size of the DVD images may appear to be (relatively) small, but bear in mind that Debian binary packages are compressed. Historically gzip has been used, but more recently more efficient compression formats like xz have begun to be used as well. Therefore, these packages will take up much more space once installed to disk.
For the record, I'm copying the text of that FAQ below.
Where is the CD image with non-free?
Debian has a quite strict view with regard to the licenses of
software: Only software that is Free in the sense of the Debian Free
Software Guidelines is allowed into the actual distribution. All the
other, non-free software (for example, software for which source code
is not available) is not supported officially.
The official CDs may freely be used, copied and sold by anyone
anywhere in the world. Packages of the non-free category have
restrictions that conflict with this, so these packages are not placed
on the official CDs.
Sometimes, someone is kind enough to create unofficial non-free CDs.
If you cannot find any links on this website, you can try asking on
the debian-cd mailing list.
EDIT: It looks like there are indeed 10 DVD images. However, some mirrors only make the first 3 available, on the assumption that those will be enough. I have not been able to find an official source for this, but see Steve's Debian CDs/DVDs page.This says
Wheezy (7.4.0) discs:
Wheezy, the latest stable Debian release...!
Wheezy takes a different number of CDs/DVDs/BDs depending on the
architecture. Check the lists at http://cdimage.debian.org/debian-cd/
to see exactly how many, and which packages fit on which disc(s).
As a guide, amd64 or i386 take 10 DVDs each if you want the whole set,
but it's not likely that you will want them all. For most people, a
set of just the first 2 or 3 DVDs is likely to include all the bits
you'll need. All the source fits on 8 DVDs.
You can find a list of the DVD contents at
http://cdimage.debian.org/debian-cd/7.4.0/amd64/list-dvd/
| Are All The Packages Included On The Debian DVD/CD Images Or Just The Most Popular? |
1,394,641,957,000 |
My Laptop a HP Probook 4510s refuses to boot Fedora or Arch Linux CD'S, but will boot and install Debian based stuff, i.e. Debian or Ubuntu.
If I put a Fedora or Arch CD in, it will just stick on BIOS screen and never do anything -- the CAPS lock key flashes and the HDD light constantly flashes at a rapid rate, no keystrokes work, and I have to reboot with the CD/USB out to work normally again. I've tried changing a bunch of BIOS settings, including SATA/IDE resetting to defaults; I tried putting Arch on a memory stick and still nothing; but if I stick the same Arch or Fedora CD/USB in my girlfriend's laptop, they work fine.
How can I boot this laptop to the Fedora installer CD?
|
I found a work around from fedoras forum.
Set your CD drive as the first boot device, power laptop on without disk in, hit esc to get interrupt menu, put fedora disk in, then press enter to continue normal boot, it then booted into the fedora installer for me!
| HP Laptop refused to boot Arch or Fedora CDs but boots Debian based fine |
1,394,641,957,000 |
I have many old (data) CDs.
I want to copy them all to the disk, but the problem is that some of these CDs are no longer readable and it is extremely tiresome to copy the CDs one by one.
Is there some tool to expedite this process?
|
Do you know you can copy an entire disk as an iso file system like this:
cat /dev/sr0 > filename.iso
Other than switching disks in the tray, that makes the software end of aquiring the data pretty painless. You can the write a couple line script to loopback mount all of the iso's and copy all or parts of the data out of them. The software side of "tiresome" should involve one shell command repeated each time you load the tray and about 5 lines of code to extract everything or specific things when you are done.
The hardware part could only be automated with a multi-disk-reader, extra drives, or some kind of loader. Where you looking for a hardware solution?
| Copying many CDs to disk |
1,394,641,957,000 |
I got a couple of old disks I'm trying to copy over to a HDD. Some of the disks worked fine and I was able to copy them using just mount and rsync, however as is it with old disks, some of the disks were failing to mount. I tired using dd to make an image of them and then ran photorec to get the files out. This worked upto some extent. My files were recovered, however I noticed that dd was only copying about half (1.5Gb out of 4.7Gb) disks for some of the drives. This was causing photorec to only recover about half of the video on the disk (Is there some better way to recover these files from the disk?)
I was wondering if some unreadable section was encountered and dd just stopped copying, if so, is it possible to instruct dd to make a copy of the whole 4.7gb disk?
Command I ran: dd if=input of=output
|
Use ddrescue
(In Debian and Ubuntu: use aptto) install the package gddrescue.
Read a good tutorial via the command info ddrescue before starting to recover.
Clone to one drive and write a log file to another drive.
The first step is to use a fast process to clone what is easy to read.
Then a slow process can usually read a lot of what is difficult to read for standard tools.
Then on the cloned/recovered copy you can use several tools for recovery, for example PhotoRec, but also other tools for reading or converting from a DVD should work.
This way I have rescued video clips from really badly scratched DVDs.
ddrescue works well with any kind of damaged drive, HDD, memory card, USB pendrive, DVD or CD disk, also when there are some [physically] bad sectors.
| dd stops copying mid-way through a CD |
1,394,641,957,000 |
There is this CD-RW which I always used to burn distros' CDs. All of a sudden it acts like a normal CD.
When I mount it, it gets mounted this way:
- Proprietary: Root
- Access: Read only
- Group: Root
- Access: Read only
- Other: Read only
I thought I could manually mount it as Read-write. These are the results:
alex@Sargon:~$ sudo mount -o rw '/media/cdrom0'
mount: /dev/sr0 is write-protected, mounting read-only
I read that this "write protection" is something that gets written on the CD-RW in case it gets "finalized" when it gets burned, but that should be possible to get it out just by erasing the CD. Thought, if I try do to that via wodim, this is what happens:
alex@Sargon:~$ wodim --devices
wodim: No such file or directory.
Cannot open SCSI driver!
For possible targets try 'wodim --devices' or 'wodim -scanbus'.
For possible transport specifiers try 'wodim dev=help'.
For IDE/ATAPI devices configuration, see the file README.ATAPI.setup from
the wodim documentation.
Ideas about how to proceed?
EDIT 1 - 6th November 2019
I followed the instructions by @telcoM and got some result.
I was able to install lsscsi and got this output:
alex@Sargon:~$ lsscsi -g
[0:0:0:0] disk ATA ST500LT012-1DG14 SDM1 /dev/sda /dev/sg0
[1:0:0:0] cd/dvd HL-DT-ST DVDRAM GUA0N 1.00 /dev/sr0 /dev/sg1
So wodim was able to get some result. It looks to me like it recognizes it as a proper CD-RW disc:
alex@Sargon:~$ wodim dev=/dev/sg1 --prcap
wodim: Operation not permitted. Warning: Cannot raise RLIMIT_MEMLOCK limits.
Device type : Removable CD-ROM
Version : 5
Response Format: 2
Capabilities :
Vendor_info : 'HL-DT-ST'
Identification : 'DVDRAM GUA0N '
Revision : '1.00'
Device seems to be: Generic mmc2 DVD-R/DVD-RW.
Drive capabilities, per MMC-3 page 2A:
Does read CD-R media
Does write CD-R media
Does read CD-RW media
Does write CD-RW media
Does read DVD-ROM media
Does read DVD-R media
Does write DVD-R media
Does read DVD-RAM media
Does write DVD-RAM media
Does support test writing
Does read Mode 2 Form 1 blocks
Does read Mode 2 Form 2 blocks
Does read digital audio blocks
Does restart non-streamed digital audio reads accurately
Does support Buffer-Underrun-Free recording
Does read multi-session CDs
Does read fixed-packet CD media using Method 2
Does not read CD bar code
Does read R-W subcode information
Does return R-W subcode de-interleaved and error-corrected
Does read raw P-W subcode data from lead in
Does return CD media catalog number
Does return CD ISRC information
Does support C2 error pointers
Does not deliver composite A/V data
Does play audio CDs
Number of volume control levels: 256
Does support individual volume control setting for each channel
Does support independent mute setting for each channel
Does not support digital output on port 1
Does not support digital output on port 2
Loading mechanism type: tray
Does support ejection of CD via START/STOP command
Does not lock media on power up via prevent jumper
Does allow media to be locked in the drive via PREVENT/ALLOW command
Is currently in a media-locked state
Does not support changing side of disk
Does not have load-empty-slot-in-changer feature
Does not support Individual Disk Present feature
Maximum read speed: 4234 kB/s (CD 24x, DVD 3x)
Current read speed: 4234 kB/s (CD 24x, DVD 3x)
Maximum write speed: 1764 kB/s (CD 10x, DVD 1x)
Current write speed: 1764 kB/s (CD 10x, DVD 1x)
Rotational control selected: CLV/PCAV
Buffer size in KB: 512
Copy management revision supported: 1
Number of supported write speeds: 1
Write speed # 0: 1764 kB/s CLV/PCAV (CD 10x, DVD 1x)
Supported CD-RW media types according to MMC-4 feature 0x37:
Does write multi speed CD-RW media
Does write high speed CD-RW media
Does write ultra high speed CD-RW media
Does write ultra high speed+ CD-RW media
Still I'm not sure about what to do at this point.
In the meanwhile I tried to use k3b, which wasn't able to erase the disk too and got this output:
Devices
-----------------------
HL-DT-ST DVDRAM GUA0N 1.00 (/dev/sr0, CD-R, CD-RW, CD-ROM, DVD-ROM, DVD-R, DVD-RW, DVD-R DL, DVD+R, DVD+RW, DVD+R DL) [DVD-ROM, DVD-R Sequential, DVD-R Dual Layer Sequential, DVD-R Dual Layer Jump, DVD-RAM, DVD-RW Restricted Overwrite, DVD-RW Sequential, DVD+RW, DVD+R, DVD+R Dual Layer, CD-ROM, CD-R, CD-RW] [SAO, TAO, RAW, SAO/R96P, SAO/R96R, RAW/R16, RAW/R96P, RAW/R96R, Restricted Overwrite, Layer Jump] [%7]
System
-----------------------
K3b Version: 2.0.3
KDE Version: 4.14.26
QT Version: 4.8.7
Kernel: 4.9.0-11-amd64
Used versions
-----------------------
cdrecord: 1.1.11
cdrecord
-----------------------
scsidev: '/dev/sr0'
devname: '/dev/sr0'
scsibus: -2 target: -2 lun: -2
Linux sg driver version: 3.5.27
Wodim version: 1.1.11
SCSI buffer size: 64512
Beginning DMA speed test. Set CDR_NODMATEST environment variable if device
communication breaks or freezes immediately after that.
TOC Type: 1 = CD-ROM
Driveropts: 'burnfree'
Device type : Removable CD-ROM
Version : 5
Response Format: 2
Capabilities :
Vendor_info : 'HL-DT-ST'
Identification : 'DVDRAM GUA0N '
Revision : '1.00'
Device seems to be: Generic mmc2 DVD-R/DVD-RW.
Current: 0x000A (CD-RW)
Profile: 0x0015 (DVD-R/DL sequential recording)
Profile: 0x0016 (DVD-R/DL layer jump recording)
Profile: 0x002B (DVD+R/DL)
Profile: 0x001B (DVD+R)
Profile: 0x001A (DVD+RW)
Profile: 0x0014 (DVD-RW sequential recording)
Profile: 0x0013 (DVD-RW restricted overwrite)
Profile: 0x0012 (DVD-RAM)
Profile: 0x0011 (DVD-R sequential recording)
Profile: 0x0010 (DVD-ROM)
Profile: 0x000A (CD-RW) (current)
Profile: 0x0009 (CD-R)
Profile: 0x0008 (CD-ROM)
Profile: 0x0002 (Removable disk)
Using generic SCSI-3/mmc CD-R/CD-RW driver (mmc_cdr).
Driver flags : MMC-3 SWABAUDIO BURNFREE
Supported modes: TAO PACKET SAO SAO/R96P SAO/R96R RAW/R16 RAW/R96P RAW/R96R
Drive buf size : 362208 = 353 KB
Speed set to 1764 KB/s
Current Secsize: 2048
ATIP info from disk:
Indicated writing power: 2
Reference speed: 6
Is not unrestricted
Is erasable
Disk sub type: High speed Rewritable (CAV) media (1)
ATIP start of lead in: -11077 (97:34/23)
ATIP start of lead out: 359849 (79:59/74)
1T speed low: 4 1T speed high: 10
2T speed low: 2 2T speed high: 10
power mult factor: 2 6
recommended erase/write power: 5
A1 values: 24 2C DC
A2 values: 14 A4 4A
A3 values: 04 C4 80
Disk type: Phase change
Manuf. index: 11
Manufacturer: Mitsubishi Chemical Corporation
Starting to write CD/DVD at speed 10.0 in real BLANK mode for single session.
Last chance to quit, starting real write in 2 seconds.
1 seconds.
0 seconds. Operation starts.
Performing OPC...
Blanking PMA, TOC, pregap
Errno: 5 (Input/output error), blank unit scsi sendcmd: no error
CDB: A1 01 00 00 00 00 00 00 00 00 00 00
status: 0x2 (CHECK CONDITION)
Sense Bytes: 71 00 03 00 00 00 00 0A 00 00 00 00 51 00 00 00
Sense Key: 0x3 Medium Error, deferred error, Segment 0
Sense Code: 0x51 Qual 0x00 (erase failure) Fru 0x0
Sense flags: Blk 0 (not valid)
cmd finished after 17.009s timeout 9600s
/usr/bin/wodim: Cannot blank disk, aborting.
/usr/bin/wodim: Some drives do not support all blank types.
/usr/bin/wodim: Try again with wodim blank=all.
cdrecord command:
-----------------------
/usr/bin/wodim -v gracetime=2 dev=/dev/sr0 speed=10 -tao driveropts=burnfree blank=fast
I tried to change the permissions with k3bsetup and tried to set the burning group as alex, but it didn't change anything.
EDIT 2 - Later that day...
I tried to erase the disk with wodim as suggested below:
alex@Sargon:~$ wodim dev=/dev/sg1 blank=all -force
Device type : Removable CD-ROM
Version : 5
Response Format: 2
Capabilities :
Vendor_info : 'HL-DT-ST'
Identification : 'DVDRAM GUA0N '
Revision : '1.00'
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
Supported modes: TAO PACKET SAO SAO/R96P SAO/R96R RAW/R16 RAW/R96P RAW/R96R
Speed set to 1764 KB/s
Waiting for drive to calm down.
Starting to write CD/DVD at speed 10.0 in real force BLANK mode for single session.
Last chance to quit, starting real write in 0 seconds. Operation starts.
Errno: 5 (Input/output error), blank unit scsi sendcmd: no error
CDB: A1 00 00 00 00 00 00 00 00 00 00 00
status: 0x2 (CHECK CONDITION)
Sense Bytes: 71 00 03 00 00 00 00 0A 00 00 00 00 51 00 00 00
Sense Key: 0x3 Medium Error, deferred error, Segment 0
Sense Code: 0x51 Qual 0x00 (erase failure) Fru 0x0
Sense flags: Blk 0 (not valid)
cmd finished after 24.064s timeout 9600s
Starting to write CD/DVD at speed 10.0 in real force BLANK mode for single session.
No chance to quit anymore. Operation starts.
Errno: 5 (Input/output error), blank unit scsi sendcmd: no error
CDB: A1 00 00 00 00 00 00 00 00 00 00 00
status: 0x2 (CHECK CONDITION)
Sense Bytes: 71 00 03 00 00 00 00 0A 00 00 00 00 51 00 00 00
Sense Key: 0x3 Medium Error, deferred error, Segment 0
Sense Code: 0x51 Qual 0x00 (erase failure) Fru 0x0
Sense flags: Blk 0 (not valid)
cmd finished after 16.381s timeout 9600s
wodim: Cannot blank disk, aborting.
I tried also with root rights but it goes the same way.
|
After trying with several programs, guis, and even switching to Windows, I wondered if the issue might have been related to the drive.
Aaaaand... it was. I just went to an other PC and was able to erase it in 30 seconds.
Not sure why I can burn but can't erase through this one. Go figure.
Thanks nonetheless to @telcoM for the effort.
| How to properly erase and use a CD-RW |
1,394,641,957,000 |
I want to learn which media my optical device can read and write to?
|
Use lshw!
lshw
lshw -class disk
| How do I get to know my optical drives read and write capabilities? |
1,707,097,001,000 |
When I run cd-info the track list looks like this:
CD-ROM Track List (1 - 1)
#: MSF LSN Type Green? Copy?
1: 00:02:00 000000 data false no
170: 68:17:27 307152 leadout (688 MB raw, 599 MB formatted)
What does LSN mean and what does it stand for?
I checked the man page and Google and found nothing!
|
The LSN is the Logical Sector Number, similar to the Logical Block Address more commonly used on disks.
| What is LSN in the cd-info track list? |
1,707,097,001,000 |
Right now I'm trying to install Battlefield 2 from CD-ROM on my Linux computer (I know Battlefield 2 is a little old now but I couldn't care less). Of course, it needs to be run under Wine, and luckily for me Wine isn't the issue yet. The issue is that once the installer asks for Disk 2 to be inserted, it doesn't get detected. I know pretty confidently that the issue is that the second disk just isn't being recognized as a new disk somewhere in the kernel which causes big problem and that the issue is that the disk isn't being unmounted properly, but I can't unmount the disk properly, since that would require that the installer gets killed. I tried a bunch of AHCI and SCSI tricks, but to no avail. If lsblk can tell the disk is different, there should be a way to tell unaware parts of the system about it, but I'm not sure how. Help pls
|
Wine has a wine eject command to address this. When it's time to switch disks, simply fire up another terminal and wine eject, then plug in the second disk.
It is noteworthy that the appropriate $WINEPREFIX must be set for this command to work properly.
| Hotswapping CDs on Linux |
1,707,097,001,000 |
I have a Linux machine running CentOS7 that does not have a built-in CD drive. I need to copy files from a CD onto the computer, so I'm using a USB CD drive. I cannot get the computer to recognize the device and mount the CD.
The device doesn't show up in /dev, but I've been able to identify the device using sudo lshw -short, with the following output:
/0/100/14/0/8/1 storage Dell DVD+/-RW Drive DW316
Without the -short, the only other interesting info I see is that the device is always listed as -usb UNCLAIMED, regardless of which USB port I use.
I tried mounting the device using the command sudo mount /0/100/14/0/8/1 /mnt but returned the error "Special device does not exist".
I also looked at the info from lsblk and fdisk -l, but there were no changes when plugging or unplugging the CD reader.
What else should I do to mount this CD? I was able to use the CD reader on a Windows machine, so I know the device is working.
|
I stumbled upon the solution in another forum - our security settings had USB devices disabled. I uncommented the following line in /etc/modprobe.d/usb-storage.conf
install usb-storage /bin/true
After editing the file, I rebooted and the CD mounted itself automatically. After copying all of the data over I uncommented the above line and rebooted again to reset back to normal operation.
Side note: I also read that an authorized user should be able to use insmod to enable USB devices temporarily without modifying the /etc file. Anyone know how one would do this?
| Unable to mount USB CD Drive |
1,707,097,001,000 |
I'm running Jessie/sid as my base.
When I type lspci:
00:00.0 Host bridge: Intel Corporation ValleyView SSA-CUnit (rev 0e)
00:02.0 VGA compatible controller: Intel Corporation ValleyView Gen7 (rev 0e)
00:13.0 SATA controller: Intel Corporation ValleyView 6-Port SATA AHCI Controller (rev 0e)
00:14.0 USB controller: Intel Corporation ValleyView USB xHCI Host Controller (rev 0e)
00:1a.0 Encryption controller: Intel Corporation ValleyView SEC (rev 0e)
00:1b.0 Audio device: Intel Corporation ValleyView High Definition Audio Controller (rev 0e)
00:1c.0 PCI bridge: Intel Corporation ValleyView PCI Express Root Port (rev 0e)
00:1c.2 PCI bridge: Intel Corporation ValleyView PCI Express Root Port (rev 0e)
00:1c.3 PCI bridge: Intel Corporation ValleyView PCI Express Root Port (rev 0e)
00:1f.0 ISA bridge: Intel Corporation ValleyView Power Control Unit (rev 0e)
00:1f.3 SMBus: Intel Corporation ValleyView SMBus Controller (rev 0e)
02:00.0 Network controller: Qualcomm Atheros QCA9565 / AR9565 Wireless Network Adapter (rev 01)
03:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 10)
When I type lsusb:
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 007: ID 0cf3:3004 Atheros Communications, Inc.
Bus 001 Device 005: ID 0bda:0129 Realtek Semiconductor Corp. RTS5129 Card Reader Controller
Bus 001 Device 004: ID 0c45:6513 Microdia
Bus 001 Device 003: ID 05e3:0608 Genesys Logic, Inc. USB-2.0 4-Port HUB
Bus 001 Device 002: ID 0458:003a KYE Systems Corp. (Mouse Systems) NetScroll+ Mini Traveler / Genius NetScroll 120
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
I can't figure out which device is the cdrom drive.
cat /proc/sys/dev/cdrom/info is empty of values.
There isn't even an eject button.
uname reads:
Linux DarthVader 3.16.0-38-generic #52~14.04.1-Ubuntu SMP Fri May 8 09:43:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
Any ideas?
|
Disregard, This version of the laptop I purchased does not come with a CDROM.
| CDROM not showing up on Lenovo G50 |
1,707,097,001,000 |
I have a Windows XP CD which I want to install on a USB Drive. However my own CD drive is broken. I have a friend's laptop on which Windows 7 is installed (and no idea if it has a CDROM of not).
Please tell me how to do get the ISO from the CDROM to an USB pendrive?
I am using Debian 7
|
Here is a Windows based tool, ISO to USB. Also you could try using UNetbootin to write an ISO file to a USB thumb drive too. UNetbootin runs on all OSes.
excerpt from UNetbootin website
UNetbootin allows you to create bootable Live USB drives for Ubuntu, Fedora, and other Linux distributions without burning a CD. It runs on Windows, Linux, and Mac OS X. You can either let UNetbootin download one of the many distributions supported out-of-the-box for you, or supply your own Linux .iso file if you've already downloaded one or your preferred distribution isn't on the list.
| Make a bootable CD without ISO file but from a CD |
1,707,097,001,000 |
Is there an equivalent of APTonCD for Fedora? I tried googling and found YUMonCD but wanted to know if there exists some package in the repos.
|
The YUMonCD page you linked to provides RPM packages, why not use those?
| APTonCD equivalent for Fedora |
1,707,097,001,000 |
I need to copy Codonics medical data from CD to ISO.
I insert an CDROM in the CD drive TSSTcorp DVD+-RW TS-H653H of my Dell Precision T1600.
The system detects and mounts the CD when you insert it in Debian.
In copying, dd fails systematically but readom is the only successful differential tool.
However, cp also fails so there must be better differential tools in copying CDs to ISO in commandline, related LinuxJournal's article here.
Workflow
Unmount cdrom
root@masi:/home/masi# unmount /dev/sr0
Run copy command as pseudocode
readom... / cp... / dd... / ...
Successful workflow with readom but some error
Atoponce's command proposal of readom
# http://www.commandlinefu.com/commands/view/1396/create-a-cddvd-iso-image-from-disk.
readom dev=/dev/scd0 f=/path/to/image.iso
Its docs
Create a CD/DVD ISO image from disk.
Many like to use 'dd' for creating CD/DVD iso images. This is bad. Very bad. The reason this is, is 'dd' doesn't have any built-in error checking. So, you don't know if you got all the bits or not. As such, it is not the right tool for the job. Instead, 'reaom' (read optical media) from the wodim package is what you should be using. It has built-in error checking. Similarly, if you want to burn your newly creating ISO, stay away from 'dd', and use:
wodim -v -eject /path/to/image.iso
Workflow
root@masi:/home/masi# umount /dev/sr0
root@masi:/home/masi# readom dev=/dev/sr0 f=/home/masi/Desktop/image.iso
Read speed: 8467 kB/s (CD 48x, DVD 6x).
Write speed: 8467 kB/s (CD 48x, DVD 6x).
Capacity: 35829 Blocks = 71658 kBytes = 69 MBytes = 73 prMB
Sectorsize: 2048 Bytes
Copy from SCSI (3,0,0) disk to file '/home/masi/Desktop/image.iso'
end: 35829
Errno: 5 (Input/output error), read_g1 scsi sendcmd: no error
CDB: 28 00 00 00 8B C0 00 00 35 00
status: 0x2 (CHECK CONDITION)
Sense Bytes: 70 00 03 00 00 00 00 0A 00 00 00 00 11 00 00 00
Sense Key: 0x3 Medium Error, Segment 0
Sense Code: 0x11 Qual 0x00 (unrecovered read error) Fru 0x0
Sense flags: Blk 0 (not valid)
cmd finished after 7.038s timeout 40s
readom: Input/output error. Cannot read source disk
readom: Retrying from sector 35776.
.....................................................~~-~~~+~~~-~~~+~~~-~~~+~~~-~~~+~~~-~~~+~~~-~~~+~~~-~~~+~~~-~~~+~~~-~~~+~~~-~~~+~~~-~~~+~~~-~~~+~~~-~~~+~~~-~~~+~~~-~~~
readom: Input/output error. Error on sector 35828 not corrected. Total of 1 errors.
Time total: 1259.495sec
Read 71552.00 kB at 56.8 kB/sec.
Max corected retry count was 0 (limited to 128).
The following 1 sector(s) could not be read correctly:
35828
Output: seems to be correctly copied CDROM to .iso but not sure why the error.
Tested CDs: 3.
Unsuccessful cp workflow
root@masi:/home/masi# unmount /media/
root@masi:/home/masi# cp /dev/sr0 /home/masi/Desktop/image.iso
cp: error reading ‘/dev/sr0’: Input/output error
cp: failed to extend ‘/home/masi/Desktop/image.iso’: Input/output error
Failed dd attempts so deprecate dd for the task
I get the following message with the command dd if=/dev/cdrom of=/home/masi/Desktop/image.iso in Debian
dd: error reading '/dev/cdrom': Input/output error
143312+0 records in
143312+0 records out
73375744 bytes (73 MB) copied, 37.6356 s, 1.9 MB/s
Other failed copy commands with dd
with bs and conv
# http://crunchbang.org/forums/viewtopic.php?id=23659
dd if=/dev/scd0 of=whatever.iso bs=2048 conv=sync,notrunc
with conv only
dd if=/dev/scd0 of=whatever.iso conv=sync,notrunc
Testing jc___ profiling proposal successfully
root@masi:/home/masi# mkdir /media/cdMP
root@masi:/home/masi# mount /dev/cdrom /media/cdMP/
mount: /dev/sr0 is write-protected, mounting read-only
root@masi:/home/masi# umount /dev/cdrom
root@masi:/home/masi# mount /dev/cdrom /media/cdMP/
mount: /dev/sr0 is write-protected, mounting read-only
root@masi:/home/masi# readom dev=/dev/sr0 -scanbus
Error trying to open /dev/sr0 exclusively (Device or resource busy)... retrying in 1 second.
Error trying to open /dev/sr0 exclusively (Device or resource busy)... retrying in 1 second.
So do instead where non-root works, ensuring that nothing is keeping CDROM busy, and activating filebrowser of the CDROM explicitly
masi@masi:~$ readom dev=/dev/sr0 -scanbus
scsibus3:
3,0,0 300) 'TSSTcorp' 'DVD+-RW TS-H653H' 'D700' Removable CD-ROM
3,1,0 301) *
3,2,0 302) *
3,3,0 303) *
3,4,0 304) *
3,5,0 305) *
3,6,0 306) *
3,7,0 307) *
Testing ThomasSchmitt's proposal
I do unsuccessfully by umounting and xorriso
masi@masi:~$ umount /dev/sr0
masi@masi:~$ xorriso -outdev /dev/sr0 -check_media use=outdev sector_map="$HOME"/cdrom_sector_map data_to="$HOME"/cdrom_copy.iso abort_file="$HOME"/cdrom_copy_abort --
xorriso 1.3.2 : RockRidge filesystem manipulator, libburnia project.
xorriso : NOTE : Disc status unsuitable for writing
Drive current: -outdev '/dev/sr0'
Media current: CD-R
Media status : is written , is closed
Media summary: 1 session, 35829 data blocks, 70.0m data, 0 free
xorriso : UPDATE : 32 blocks read in 7 seconds , 0.1xC
xorriso : UPDATE : 352 blocks read in 9 seconds , 2.8xC
xorriso : UPDATE : 1216 blocks read in 10 seconds , 11.5xC
xorriso : UPDATE : 2784 blocks read in 11 seconds , 20.7xC
xorriso : UPDATE : 4416 blocks read in 12 seconds , 21.4xC
xorriso : UPDATE : 6048 blocks read in 13 seconds , 21.6xC
xorriso : UPDATE : 7712 blocks read in 14 seconds , 21.9xC
xorriso : UPDATE : 9376 blocks read in 15 seconds , 22.1xC
xorriso : UPDATE : 11072 blocks read in 16 seconds , 22.3xC
xorriso : UPDATE : 12768 blocks read in 17 seconds , 22.5xC
xorriso : UPDATE : 14496 blocks read in 18 seconds , 22.7xC
xorriso : UPDATE : 16224 blocks read in 19 seconds , 22.9xC
xorriso : UPDATE : 17984 blocks read in 20 seconds , 23.1xC
xorriso : UPDATE : 19744 blocks read in 21 seconds , 23.3xC
xorriso : UPDATE : 21536 blocks read in 22 seconds , 23.5xC
xorriso : UPDATE : 23328 blocks read in 23 seconds , 23.7xC
xorriso : UPDATE : 25152 blocks read in 24 seconds , 23.9xC
xorriso : UPDATE : 26976 blocks read in 25 seconds , 24.1xC
xorriso : UPDATE : 28832 blocks read in 26 seconds , 24.3xC
xorriso : UPDATE : 30688 blocks read in 27 seconds , 24.5xC
xorriso : UPDATE : 32576 blocks read in 28 seconds , 24.8xC
xorriso : UPDATE : 34464 blocks read in 29 seconds , 25.0xC
libburn : SORRY : SCSI error on read_10(35828,1): [3 11 00] Medium error. Unrecovered read error.
xorriso : UPDATE : 35829 blocks read in 37 seconds , 2.4xC
xorriso : UPDATE : 35829 blocks read in 37 seconds = 13.0xC
Media checks : lba , size , quality
Media region : 0 , 35828 , + good
Media region : 35828 , 1 , - unreadable
xorriso : NOTE : Tolerated problem event of severity 'SORRY'
xorriso : NOTE : -return_with SORRY 32 triggered by problem severity SORRY
Testing the quality of the output
masi@masi:~$ ls /home/masi/
cdrom_copy.iso Desktop Downloads Pictures Templates WolframWorkspaces
cdrom_sector_map Documents Music Public Videos
masi@masi:~$ su
root@masi:/home/masi# mkdir /mnt/iso
root@masi:/home/masi# mount -o loop /home/masi/cdrom_copy.iso /mnt/iso
mount: /dev/loop0 is write-protected, mounting read-only
root@masi:/home/masi# exit
exit
masi@masi:~$ tar cf - /mnt/iso/ | wc
tar: Removing leading `/' from member names
303452 886038 72867840
masi@masi:~$ tar cf - /dev/sr0 | wc
tar: Removing leading `/' from member names
0 3 10240
masi@masi:~$ umount /dev/sr0
masi@masi:~$ tar cf - /dev/sr0 | wc
tar: Removing leading `/' from member names
0 3 10240
It seems that the copied ISO file does to have any errors so it should be a complete duplicate of the CD.
Do for certainty by looking both file trees
masi@masi:~$ su
root@masi:/home/masi# mkdir /mnt/orig_cd
root@masi:/home/masi# mount /dev/sr0 /mnt/orig_cd
mount: /dev/sr0 is write-protected, mounting read-only
root@masi:/home/masi# mount -o loop /home/masi/Desktop/image.iso /mnt/iso
mount: /dev/loop0 is write-protected, mounting read-only
root@masi:/home/masi# diff -q -r /mnt/orig_cd/ /mnt/iso/ | less
Output: no lines in less output meaning complete equivalence; I tested also completely different contents where complete difference so the output is the same as expected output in both cases.
System characteristics
I do dmesg | grep cd returns
cdrom: Uniform CD-ROM driver Revision: 3.20
Volume set (in), Read cd: be 00 00 00 8b f3 00 00 02 00 00 00
Doing lsscsi -s gives
cd/dvd TSSTcorp DVD+-RW TS-H653H D700 /dev/sr0 -
OS: Debian 8.5
Linux kernel: 3.16.0-4-amd64, the one which comes default in Debin 8.5
Hardware: customer Dell PC 2011 (Dell Precision T1600); customer service tag 1CY515J
CD Drive: default of the Dell PC - TSSTcorp DVD+-RW TS-H653H
Test CDs: one full and one blank
Documentation about CDs in Debian: DiskImage
Differential condition: something wrong in CD drive's drivers
Related threads: readom and dd are creating different ISO-Images, Archiving CDs to ISO from the Command Line, "dd" to read CD-ROM and its effects (Re: howto verify burn?), dd command to copy a cd to a hard disk - Input/output error where some looping of I/O, ...
|
I am developer of libburn and work since a year with about the same
system as mentioned here. Kernel 3.16 has a few CD regressions
towards 2.6, but the use case of copying data should work fine.
I rather see bit rot here (readom is unmaintained), user errors
(wrong device files, readom on mounted medium), and the "read-ahead bug"
with CD media written with write type Track-At-Once (i/o error).
The i/o error could have been caused by a poorly readable medium as well.
In detail:
There is no /dev/scd0 on vanilla Debian 8. Only /dev/sr0 and
possibly symbolic links like /dev/cdrom, dev/dvd, ...
So all failures with scd0 are trivially explainable.
The advise to run wodim -scanbus is futile without having /dev/scdX,
as wodim looks only at those addresses.
readom docs are typically copied from readcd and thus reflect
the peculiar view of the author of cdrecord and readcd.
Nevertheless it should work, of course.
For copying from a data CD, a DVD, or a BD medium, dd and cp
are well ok.
There is few use of dd options conv=sync,notrunc here.
conv=sync is indeed dangerous with certain data sources as it will
inject zeros when the data source delivers less than bs bytes per
read operation. (Should never happen with CD and bs=2048.)
"Input/output error" is not caused by the copy program but a message
from the kernel to those programs. It is normally caused by an error
indication of the drive.
In this special case it turned out to be the classic "CD read-ahead bug".
The last one or two blocks of a CD (not of DVD or BD) may stay unreadable
because some drives report one or both Track-At-Once run-out blocks as
part of the payload data, which they are not.
In most cases dd and cp on kernel 3.16 deliver all payload blocks
before they abort by i/o error.
For older kernels or unlucky situations, there is
the mkisofs tradition to add 300 kB of padding when ISOs get produced.
If some of these 300 KB are not delivered by the kernel, then this does
not damage the content of files in the ISO.
If the i/o error had happened before the last two blocks of a CD, then
it would more likely have been caused by poorly readable medium. In this
case the advice would be to look in dmesg output or /var/log/messages
for reports like:
Aug 29 15:51:12 NN kernel: [9852911.947547] sr 2:0:0:0: [sr0] Unhandled sense code
Aug 29 15:51:12 NN kernel: [9852911.947549] sr 2:0:0:0: [sr0]
Aug 29 15:51:12 NN kernel: [9852911.947550] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
Aug 29 15:51:12 NN kernel: [9852911.947551] sr 2:0:0:0: [sr0]
Aug 29 15:51:12 NN kernel: [9852911.947552] Sense Key : Medium Error [current]
Aug 29 15:51:12 NN kernel: [9852911.947554] Info fld=0x710
Aug 29 15:51:12 NN kernel: [9852911.947554] sr 2:0:0:0: [sr0]
Aug 29 15:51:12 NN kernel: [9852911.947555] Add. Sense: Unrecovered read error
Aug 29 15:51:12 NN kernel: [9852911.947556] sr 2:0:0:0: [sr0] CDB:
Aug 29 15:51:12 NN kernel: [9852911.947557] Read(10): 28 00 00 00 06 f8 00 00 40 00
This was a classic medium error. No software problem.
Not even a drive problem on the first hand.
"(Device or resource busy)" error comes from the attempt to open
a device file with open(2) flag O_EXCL in its non-portable role for
Linux devices. See here for open() peculiarities on CD burner device files.
mount(8) has the device open with that flag. Well behaved burn programs
should use the flag too and thus learn when they try to use a mounted or
burning drive.
readom uses it in order to avoid spoiling ongoing burn runs.
So for readom or burn programs one has to first unmount the medium.
The advise to unmount before copying is not mandatory with dd and cp.
Answer to question about libburn based data reading:
One could try a dd_rescue-ish command of xorriso
xorriso -outdev /dev/sr0 -check_media use=outdev sector_map="$HOME"/cdrom_sector_map data_to="$HOME"/cdrom_copy.iso abort_file="$HOME"/cdrom_copy_abort --
The copy should emerge as file ~/cdrom_copy.iso.
Read errors will be reported and copy attempts will go on with the next
block. The file ~/cdrom_sector_map will record the pattern of failed
and successful reads. Another read run will load it and then try only
those blocks which were not yet copied successfully.
A successful run should end by a message like
Media checks : lba , size , quality
Media region : 0 , 359062 , + good
A run with remaining bad blocks would have "Media region" lines with
"-" characters in the quality column. "+" indicates successfully read
intervals of blocks. "0" indicates blocks which were not tried yet.
(Between tracks they may stay that way. A CD-ROM is supposed to
have only one track.)
CD Track-At-Once run-out blocks cause "-" quality. If this occurs only at
one of the last two blocks of a CD, then most likely all payload blocks
have been copied to ~/cdrom_copy.iso.
If you want to abort this quite stubborn program run then it is better
to do in another shell:
touch "$HOME"/cdrom_copy_abort
If you kill the process instead, then the sector map will not be
written and the next run will re-read already copied blocks.
After full success or with only the last one or two blocks missing
you should next test whether no files in the copied ISO point to
missing block addresses.
As superuser (or via sudo):
mkdir /mnt/iso
mount -o loop ...your.users.home.../cdrom_copy.iso /mnt/iso
which should report this note but no further error messages:
mount: /dev/loop0 is write-protected, mounting read-only
As normal user let tar read all file and consume the output by wc:
tar cf - /mnt/iso | wc
which should report no i/o error but only a warning and finally three numbers
tar: Removing leading `/' from member names
1343012 7725571 331386880
If the CD is readable enough to be mountable, then compare the files
of cdrom_copy.iso and the CD by creating another mount directory and
mount /dev/sr0:
mkdir /mnt/orig_cd
mount /dev/sr0 /mnt/orig_cd
and then compare both file trees. Pipe the output into less so that in
case of many differences it does not flood your terminal
diff -q -r /mnt/orig_cd /mnt/iso 2>&1 | less
Empty output indicates no differences.
Try with mounting a different CD and you should get lots of messages like
Only in /mnt/iso: ...some_name...
...
Only in /mnt/orig_cd: ...some_other_name...
If files with same relative path in both trees have different content
you will see messages like
Files /mnt/cd_orig/...some_file... and /mnt/iso/...some_file... differ
When all is ok, then remove file ~/cdrom_sector_map so that it cannot
keep xorriso from reading blocks from the next CD to which you have to
apply this whole procedure.
| How to copy CDROM to ISO in Debian 8.x? |
1,707,097,001,000 |
I need a full Linux distribution for a non-profit activist organisation that can fit on a business card CD.
If that's not possible, there is a business card DVD option too with up to 400 MB capacity.
But I would really prefer CD over DVD if such spartan Linux distribution under 50 MB exist.
|
Sounds like you're looking for DSL http://www.damnsmalllinux.org/
| Full Linux distro under 50 MB for a business card CD |
1,707,097,001,000 |
I have a CD-R/RW DVD+/-R/RW drive. How can determine its available burning speeds (e.g. 2x, 4x, etc.) using the command line, so that I can add options such as -speed= to programs such as growisofs?
I've tried dvd+rw-mediainfo /dev/sr0, but it doesn't list the possible speeds.
|
xorriso -outdev /dev/sr0 -list_speeds
The result depends on the inserted medium.
| How can I list my optical drive's possible burning speeds using the command line? |
1,707,097,001,000 |
Code and outputs
sudo apt-get install xfsprogs
[sudo] password for masi:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
libreadline5
Suggested packages:
xfsdump attr quota
The following NEW packages will be installed:
libreadline5 xfsprogs
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/853 kB of archives.
After this operation, 3,963 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Media change: please insert the disc labeled
'Debian GNU/Linux 8 _Jessie_ - Official Snapshot amd64 LIVE/INSTALL Binary 20150606-15:28'
in the drive '/media/cdrom/' and press enter
where the last row indicates the request of CD.
This is the second time today.
I installed apt-file to my system and put sbin to my PATH after which this has occurred.
I think this may be a problem with sources in /etc/apt/sources.list.
I run sudo apt-get update but it does not solve the problem, as described here.
No support of XFS in Debian?
I am following this answer and I type
mkfs.x[tab]
mkfs.bfs mkfs.ext3 mkfs.fat mkfs.minix mkfs.vfat
mkfs.cramfs mkfs.ext4 mkfs.hfs mkfs.msdos
mkfs.ext2 mkfs.ext4dev mkfs.hfsplus mkfs.ntfs
so this insertion of CD seems to be Debian's way of saying NO.
Why is Debian 8.1 asking for the installation media requests in Debian apt-get?
|
Delete or comment (#) the cdrom line(s) in /etc/apt/sources.list and look at files in /etc/apt/sources.list.d and run
apt-get update
| Why am I getting CD requests in Debian APT-GET? |
1,707,097,001,000 |
I'm using Ubuntu 13.04. I want to take an ISO copy of XP installation CD but when I insert CD it's seen as empty CD. Is there any way to access the content of CD?
|
From what you have posted, this sounds more like a hardware issue than a software one. It is likely that the drive isn't reading the disc because either the CD is dirty/scratched, the lens in the drive is dirty and/or the drive is near the end of its life. For the drive, you would tend to first notice issues with copied and/or scratched discs.
Another possibility for a copied disc is that there was an error when burning (or it simply wasn't formatted correctly).
Either way, I would suggest trying the disc in another drive. If it reads ok, at least you can rule out that it is completely corrupted.
Otherwise you could try:
Clean the disc - ideally with something made of soft cotton.
Clean the drive lens - ideally gently with a soft cotton bud and iso-propyl alcohol, although this may require dismantling the drive. You can get lens cleaning kits, though often they aren't that effective.
| contents of xp cd is not visible [closed] |
1,707,097,001,000 |
So, it's that time of year when I need to make a backup disk of some files on a Windows machine, and I want to use UDF so that I can add to it later. It's refusing to let me create any CDs or DVDs since it says the disk is empty and needs formatting, and then won't let me format them...
And yes, the disks have never been used (yet) and are un-scratched and so on. It also won't let me edit some disks that I know were made with Windows' own utility for this (Live Filesystem, which is basically UDF as well), so I'm just going to squint at that and move on. (Interestingly, I can open & modify those in Linux...)
So, I went over to my Linux (Ubuntu 18.04) machine and tried to make a UDF-formatted disk with mkudffs (since multisession disks work correctly with absolutely NOTHING, apparently, at least not anymore [I made one once around the Ubuntu 14.04 days, but they haven't actually been editable since, and it's expensive to test]) and it's superior anyway.
I ran the command
mkudffs --media-type=dvd /dev/sr0
and it dumps an error message "Device is read-only" (I don't have the exact wording, but that was all it said). Running the command as root didn't help, and I know for a fact that this has worked before.
Interestingly, the "copy files to disk and burn" thing built into Nautilus worked just fine. Of course, checking the "Leave disk open for future additions" option didn't actually do anything (no surprise there), but it DID burn the files I had on hand.
Now, for next time, what exactly is wrong that it won't let me UDF-format my darn CDs or DVDs?!
[I have not tested with one of my DVD-RWs, but I have tried both CD and DVD just now (with the appropriate media-type flags) and got the same error. They are a bit old, but they are apparently still writable, it's just that for some reason mkudffs in particular is having issues with them.]
|
Via mkudffs you can format only block device with r/w access. So only DVD-RW, DVD-RAM, BD-RE. With support of packet writing pktcdvd.ko kernel module and pktsetup utility you can map CD-RW media to compatible r/w block device too. But prior usage of CD-RW media you need to first format it via cdrwtool utility. cdrwtool is also responsible for formatting CD-RW media to UDF, so use it instead of mkudffs.
Recordable discs (CD-R, DVD-R, BD-R) are not supported by Linux kernel for write operation directly via block device. So writing any data to them needs to be done via burning software. And therefore mkudffs cannot format them to UDF. But you can create UDF image and then burn it to recordable disc.
| Can't create UDF disk in Linux with mkudffs |
1,707,097,001,000 |
I have a WH16NS40 DVD drive that I want to use on my Debian 12 virtual machine.
The drive is inside a Vantec NexStar DX2 USB 3.0 external enclosure, which connects to the DVD drive via a standard SATA cable.
I had it working and was able to read and write ISOs to discs from my Debian 12 workstation, but when I plugged it into my hypervisor (Proxmox) and passed the USB device through to the VM, it does not show up as sr0 in lsblk and is not in /dev for sr0. The USB part does show up though, as shown below.
lsusb
Bus 002 Device 002: ID 152d:0578 JMicron Technology Corp. / JMicron USA Technology Corp. JMS578 SATA 6Gb/s
lshw
*-usb
description: Mass storage device
product: USB to ATA/ATAPI Bridge
vendor: JMicron
physical id: 1
bus info: usb@2:1
version: 4.15
serial: 0123456789ABCDEF
capabilities: usb-2.10 scsi
configuration: driver=usb-storage maxpower=30mA speed=480Mbit/s
dmesg output:
[ 1.418561] usb 2-1: New USB device found, idVendor=152d, idProduct=0578, bcdDevice= 4.15
[ 1.418564] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 1.418565] usb 2-1: Product: USB to ATA/ATAPI Bridge
[ 1.418566] usb 2-1: Manufacturer: JMicron
[ 1.418566] usb 2-1: SerialNumber: 0123456789ABCDEF
[ 1.422595] usb-storage 2-1:1.0: USB Mass Storage device detected
[ 1.422697] usb-storage 2-1:1.0: Quirks match for vid 152d pid 0578: 1000000
[ 1.422734] scsi host3: usb-storage 2-1:1.0
[ 1.422797] usbcore: registered new interface driver usb-storage
[ 1.423715] usbcore: registered new interface driver uas
Even before I put a disc in the drive, it was present in my workstation as /dev/sr0. But not here.
My workstation is running KDE desktop, are there packages that come with KDE that make detecting these USB enclosures more accurate?
How can I force the OS to consider this USB device a CDROM device and assign it as sr0?
Thanks in advance!
|
Just solved my issue, turns out I had USBGUARD running on the host. Allowing the USB enclosure on the host allowed the passthrough to operate and the VM now sees the DVD drive.
Saw Device is not authorized for usage in dmesg on the host.
Then ran usbguard list-devices
And the USB to SATA device was number 16
usbguard allow-device -p 16
Hopefully this will help others avoid such a simple mistake!
| Making USB to SATA DVD drive show up as sr0 in Debian |
1,707,097,001,000 |
Under Linux, is there any way to get a yes/no answer to whether or a CD/DVD drive contains a disc which isn't mounted but which can be mounted or written to?
|
You can use blkid to get the info of a possible mounted block device:
blkid
It will output something like:
/dev/sr0: UUID="2013-05-31-23-04-19-00" LABEL="Blah" TYPE="iso9660" PTTYPE="dos"
[root@arch32-vm ~]# echo $?
0
If empty will output 2.
| How to determine if an unmounted CD/DVD is in the drive? |
1,707,097,001,000 |
I am wondering if there is way to get the state of the CD drive in the command line if there is an audio cd inserted. Can you play a track on the CD and then get back somehow from the system the 'playing' status? Is there any record of the state of the audio cd in the system? (playing/stopped/idle/paused/etc)
|
Today, nobody tells the CD-Rom to play a CD but rather to read a CD and to send the read data to the audio interface of the computer.
When a CD is actually read, you cannot send/execute another SCSI command to the same drive, so there is no way to tell what you like.
What you can to is to call cdrecord -minfo to get the state of the currently inserted medium and to call cdrecord -toc to get the table of content.
| Is there a way to get the status of the audio CD (idle/playing)? |
1,394,674,674,000 |
On my Debian system I've customized my Gnome (Shell) keyboard shortcuts, via System Settings > Keyboard > Shortcuts.
Where do I find the file with these settings so that I can copy the file onto a flash drive for backup and then use it to replace the keyboard shortcuts on other Gnome systems?
|
Gnome 3 uses DCONF to store the preferences in a single binary file: ~/.config/dconf/user.
As per the Gnome docs, it is recommended to save only the settings that you need and restore them with either dconf or gsettings. However, gsettings is only able to restore the value(s) for one single key at a time (plus, the value must be quoted) and that makes it a bit awkward for this kind of task. Which leaves us with dconf.
So, in this particular case, save the current settings for gnome-shell keyboard shortcuts1:
dconf dump /org/gnome/shell/keybindings/ > bkp
Here's a bkp sample:
[/]
toggle-message-tray=['<Super>m']
open-application-menu=['<Super>F1']
toggle-application-view=['<Control>F1']
focus-active-notification=['<Super>n']
toggle-recording=['<Control><Shift><Alt>r']
Load the settings on another system:
dconf load /org/gnome/shell/keybindings/ < bkp
1: WM and Media Keys shortcuts belong to different schemas:
/org/gnome/desktop/wm/keybindings/
/org/gnome/mutter/keybindings/
/org/gnome/mutter/wayland/keybindings/
/org/gnome/settings-daemon/plugins/media-keys/
Note that dconf only dumps non-default values so if you run e.g.
dconf dump /org/gnome/desktop/wm/keybindings/
and don't get any output that means there's no custom WM shortcut defined.
As a side note, dconf-editor is a tool that helps visualizing dconf settings structure, i.e. schema [:path] key value, the type and the default values of any key etc.
For the record, saving the preferences with gsettings:
gsettings list-recursively org.gnome.shell.keybindings > bkp
bkp sample:
org.gnome.shell.keybindings focus-active-notification ['<Super>n']
org.gnome.shell.keybindings open-application-menu ['<Super>F1']
org.gnome.shell.keybindings toggle-application-view ['<Super>a']
org.gnome.shell.keybindings toggle-message-tray ['<Super>m']
org.gnome.shell.keybindings toggle-recording ['<Control><Shift><Alt>r']
Now loading the preferences (as I said, for each line in the backup file you need a separate command and don't forget to quote the values):
gsettings set org.gnome.shell.keybindings focus-active-notification "['<Super>n']"
gsettings set org.gnome.shell.keybindings open-application-menu "['<Super>F1']"
gsettings set org.gnome.shell.keybindings toggle-application-view "['<Super>a']"
gsettings set org.gnome.shell.keybindings toggle-message-tray "['<Super>m']"
gsettings set org.gnome.shell.keybindings toggle-recording "['<Control><Shift><Alt>r']"
| Save custom keyboard shortcuts in Gnome |
1,394,674,674,000 |
I've taken a backup of the file where my dconf database is stored (~/.config/dconf/user which is a binary file), and now I need to move some keys from the backup to the dconf in use.
How can I view the content of the backed up dconf without putting it "in place" and view it with for example dconf-editor?
|
To view the content of that file you could rename it - e.g. test - place it under ~/.config/dconf/ and then have dconf read/dump the settings from that file.
By default, dconf reads the user-db found in $XDG_CONFIG_HOME/dconf/:
A "user-db" line specifies a user database.
These databases are found in $XDG_CONFIG_HOME/dconf/. The name of the file to open in that
directory is exactly as it is written in the profile. This file is
expected to be in the binary dconf database format. Note that
XDG_CONFIG_HOME cannot be set/modified per terminal or session,
because then the writer and reader would be working on different DBs
(the writer is started by DBus and cannot see that variable).
As a result, you would need a custom profile that points to that particular db file - e.g. user-db:test and then instruct dconf to dump the data (using the custom profile) via the DCONF_PROFILE environment variable:
cd
cp /path_to_backup_dconf/user ~/.config/dconf/test
printf %s\\n "user-db:test" > db_profile
DCONF_PROFILE=~/db_profile dconf dump / > old_settings
The result is a file (old_settings) containing the settings from your backed up dconf file, e.g.:
[org/gnome/desktop/interface]
font-name='DejaVu Sans Oblique 10'
document-font-name='DejaVu Sans Oblique 10'
gtk-im-module='gtk-im-context-simple'
clock-show-seconds=true
icon-theme='HighContrast'
monospace-font-name='DejaVu Sans Mono Oblique 10'
[org/gnome/desktop/input-sources]
sources=@a(ss) []
xkb-options=@as []
[org/gnome/desktop/wm/preferences]
num-workspaces=4
titlebar-font='DejaVu Sans Bold Oblique 10'
.......
You could then remove those files:
rm -f ~/db_profile ~/.config/dconf/test
and load the old settings into the current database:
dconf load / < old_settings
If you want to dump only specific settings just provide the path:
DCONF_PROFILE=~/db_profile dconf dump /org/gnome/desktop/wm/preferences/
[/]
num-workspaces=4
titlebar-font='DejaVu Sans Bold Oblique 10'
but note that for each path you should have a different file and when you load it you should specify the path accordingly:
dconf load /org/gnome/desktop/wm/preferences/ < old_wm_settings
Also note that, due to upstream changes, older dconf databases might contain paths, keys and values that are invalid in newer versions so full compatibility between db-files created by different versions of dconf isn't always guaranteed. In that case, you would have to inspect the resulting old_settings file and manually remove or edit the entries that are invalid before loading it into your current database.
| How can I view the content of a backup of the dconf database file? |
1,394,674,674,000 |
There are certain gsettings keys that can have multiple values (e.g. a key like verbosity could be assigned to one error, info, or debug). I want to be able to list them, but my dconf-editor (0.7.3) can't view them. Is there an existing alternative?
|
The newer version of dconf-editor now lists the options.
In this example, if you click on debug, you'll see a list of other available values. This screenshot is of version 0.10 of the tool.
A screenshoot from v0.19.3, shows options:
| How do I browse for available gsettings options? |
1,394,674,674,000 |
I would like to setup my gnome terminal's background(#002b36) and foreground color in ubuntu 13, using bash script.
I tried gconftool but couldn't succeed.
GCONFTOOL-2(1) User Commands GCONFTOOL-2(1)
NAME
gconftool-2 - GNOME configuration tool
My gnome terminal version is
$ gnome-terminal --version
GNOME Terminal 3.6.1
Currently I'm using ubuntu terminal preferences UI to achieve this.
|
Method #1 - Using dconf
Background
You can use the dconf tool to accomplish this, however it's a mult-step process.
DESCRIPTION
The dconf program can perform various operations on a dconf database,
such as reading or writing individual values or entire directories.
This tool operates directly on the dconf database and does not read
gsettings schema information.Therefore, it cannot perform type and
consistency checks on values. The gsettings(1) utility is an
alternative if such checks are needed.
Usage
$ dconf
error: no command specified
Usage:
dconf COMMAND [ARGS...]
Commands:
help Show this information
read Read the value of a key
list List the contents of a dir
write Change the value of a key
reset Reset the value of a key or dir
update Update the system databases
watch Watch a path for changes
dump Dump an entire subpath to stdout
load Populate a subpath from stdin
Use 'dconf help COMMAND' to get detailed help.
General approach
First you'll need to get a list of your gnome-terminal profiles.
$ dconf list /org/gnome/terminal/legacy/profiles:/
<profile id>
Using this <profile id> you can then get a list of configurable settings
$ dconf list /org/gnome/terminal/legacy/profiles:/<profile id>
background-color
default-size-columns
use-theme-colors
use-custom-default-size
foreground-color
use-system-font
font
You can then read the current colors of either the foreground or background
foreground
$ dconf read /org/gnome/terminal/legacy/profiles:/<profile id>/foreground-color
'rgb(255,255,255)'
background
$ dconf read /org/gnome/terminal/legacy/profiles:/<profile id>/background-color
'rgb(0,0,0)'
You can change the colors as well
foreground
$ dconf write /org/gnome/terminal/legacy/profiles:/<profile id>/foreground-color "'rgb(255,255,255)'"
background
$ dconf write /org/gnome/terminal/legacy/profiles:/<profile id>/background-color "'rgb(0,0,0)'"
Example
Get my profile ID
$ dconf list /org/gnome/terminal/legacy/profiles:/
:b1dcc9dd-5262-4d8d-a863-c897e6d979b9/
Use the profile ID to get a list of settings
$ dconf list /org/gnome/terminal/legacy/profiles:/:b1dcc9dd-5262-4d8d-a863-c897e6d979b9/
background-color
default-size-columns
use-theme-colors
use-custom-default-size
foreground-color
use-system-font
font
Change your background blue
$ dconf write /org/gnome/terminal/legacy/profiles:/:b1dcc9dd-5262-4d8d-a863-c897e6d979b9/background-color "'rgb(0,0,255)'"
A Note on colors
You can use either the notation rgb(R,G,B) when specifying your colors or the hash notation #RRGGBB. In the both notations the arguments are red, green, and blue. The values in the first notation are integers ranging from 0-255 for R, G, or B. In the second notation the values are in hexidecimal ranging from 00 to FF for RR, GG, or BB.
When providing either of these to dconf you need to wrap it properly in double quotes with single quotes nested inside. Otherwise dconf will complain.
"'rgb(0,0,0)'"
"'#FFFFFF'"
etc.
Method #2 - Using gconftool-2
On my Ubuntu 12.04 system I was able to change the colors via the command line as follows.
NOTE: The options are ultimately stored in this file, $HOME/.gconf/apps/gnome-terminal/profiles/Default/%gconf.xml.
General approach
First you'll need to get the tree for gnome-terminal's profile.
$ gconftool-2 --get /apps/gnome-terminal/global/profile_list
[Default]
Using the resulting tree we can find out what attributes are configurable.
$ gconftool-2 -a "/apps/gnome-terminal/profiles/Default" | grep color
bold_color_same_as_fg = true
bold_color = #000000000000
background_color = #FFFFFFFFFFFF
foreground_color = #000000000000
use_theme_colors = false
Get/Set the background_color & foreground_color attributes
$ gconftool-2 --get "/apps/gnome-terminal/profiles/Default/foreground_color"
#000000000000
$ gconftool-2 --set "/apps/gnome-terminal/profiles/Default/background_color" --type string "#000000FFFFFF"
Confirm
$ gconftool-2 -R /apps/gnome-terminal/profiles/Default | grep color
bold_color_same_as_fg = true
bold_color = #000000000000
background_color = #000000FFFFFF
foreground_color = #000000000000
use_theme_colors = true
References
CHANGING TERMINAL PREFERENCES IN GNOME 3
base16-gnome-terminal / base16-tomorrow.light.sh
Is there a way to temporarily change the terminal colour?
| set gnome terminal background/text color from bash script |
1,394,674,674,000 |
Whenever I open any software through Terminal I get following errors and eventually the software opens
dconf-WARNING **: failed to commit changes to dconf: The connection is closed
(gedit:3609): dconf-WARNING **: failed to commit changes to dconf: The connection is closed
(gedit:3609): dconf-WARNING **: failed to commit changes to dconf: The connection is closed
Error creating proxy: The connection is closed (g-io-error-quark, 18)
Error creating proxy: The connection is closed (g-io-error-quark, 18)
Error creating proxy: The connection is closed (g-io-error-quark, 18)
Error creating proxy: The connection is closed (g-io-error-quark, 18)
Error creating proxy: The connection is closed (g-io-error-quark, 18)
What can be the possible issue?
|
I had the same problem, in my case I was running "sudo gedit" from a user account; therefore when it tried to save dconf changes it realized that the user was not root, and thus it raised those errors. I solved it by running gedit as a "root":
sudo -i
gedit &
where sudo -i will login into a user acount.
| dconf-WARNING **: failed to commit changes to dconf: The connection is closed |
1,394,674,674,000 |
Gnome desktop seems configurable in various ways: in "Gnome settings", with gnome-extensions, gnome-tweak-tool, gsettings or dconf-editor.
However, apart from this procedure to change the login screen background, which involves a little bit of glib compiling, I have found no way to customize the appearance of:
the login screen (font, position, color and size of the login boxes)
shield screen aka lock screen aka curtain (font, position, color, format and size of the clock, displayed messages, etc.)
I understand that Gnome philosophy is not to allocate much resource in tweaky-tweak-tweaking-tweakable stuffs. But I am suprised that such basic and harmless properties of these screens seem so difficult to access.
Is there a way I can access and tweak login / shield screen organization properties?
Are they hardcoded or is it just a matter of sneaking into a small curtain.xml or loginscreen.json?
Do I need to get into the sources and compile gnome myself?
|
Ubuntu
I use ubuntu 18.04, (also done this in 17.10) and as of how @cezanee-vahid said, you can find the CSS file here: /usr/share/gnome-shell/theme/gdm3.css and by changing this file you don't need to restart gnome or do anything else, they will be changed by locking computer (or better to say will be reloaded).
so for changing clock size you only need to change font-size and font-weight for .screen-shield-clock-time class.
also for if you want to get ride off that arrows in the bottom of the screen just set 0 for height and width of .screen-shield-arrows Gjs_Arrow CSS selector. setting 0 for font-size of .screen-shield-clock-date will do the same for Date.
Arch
I'm not an Arch or even Arch-based distro user, but after reading ArchWiki about GDM it seems like you need to compile source files for GDM after changing them. also, the gdm3.css file in Arch is named gnome-shell.css
so in conclusion, these spets are needed to change GDM theme in Arch:
extracting the current GDM theme
creating a gnome-shell-theme.gresource.xml file for the selected image files
changing gnome-shell.css file as you wish!
compiling the new GDM theme you have created
replacing files under /usr/share/gnome-shell
restating gdm.service
the ArhcWiki above have explained these steps detailed.
| How do I customize Gnome screen shield / curtain / login screen appearance? |
1,394,674,674,000 |
I am trying to modify the Gnome Shell preferences (in this case the key bindings) using the terminal. I have tried:
gsettings set org.gnome.Terminal.Legacy.Keybindings switch-to-tab-1 '<Alt>1'
But it is giving me an error:
Schema 'org.gnome.Terminal.Legacy.Keybindings' is relocatable (path must be specified)
So I am stuck in there. How can I specify the path? Also, I see the word "Legacy" in there... Is there a better way to do this?
Note: Using Fedora 24 with all upgrades: GNOME Shell 3.20.3, GNOME Terminal 3.20.2.
|
Thanks to @don_crissti's help and the answer they pointed me to.
In order to change Gnome Terminal keybindings a path must be provided for the schema (as it is relocatable). So we need to define both a schema and a path:
GSETTINGS_SCHEMA=org.gnome.Terminal.Legacy.Keybindings
GSETTINGS_PATH=/org/gnome/terminal/legacy/keybindings/
SCHEMA_PATH=$GSETTINGS_SCHEMA:$GSETTINGS_PATH
Then we can easily set our keybindings:
gsettings set $SCHEMA_PATH switch-to-tab-1 '<Primary><Alt>1'
gsettings set $SCHEMA_PATH switch-to-tab-2 '<Primary><Alt>2'
...
gsettings set $SCHEMA_PATH prev-tab '<Primary><Alt>9'
In order to list all the available keybindings (and also to check they are properly set):
gsettings list-recursively | grep Terminal.Legacy.Keybindings
| Configuring Gnome Shell key bindings from the command line |
1,394,674,674,000 |
I'm running Debian Stretch with MATE desktop 1.16.1. Since I have update the package mate-settings-daemon I can't change my background, it shows the wallpaper used for the login screen. I've tried to change it in the usual way through Control Center -> Appearance -> Background but when I select a new wallpaper nothing happens. I've also tried to change some configurations with dconf editor but again with no success.
Here are the packages about MATE desktop that I have in my system:
ii atril 1.16.1-2 amd64 MATE document viewer
ii atril-common 1.16.1-2 all MATE document viewer (common files)
ii caja 1.16.2-2 amd64 file manager for the MATE desktop
ii caja-common 1.16.2-2 all file manager for the MATE desktop (common files)
ii compiz-mate 1:0.9.13.0+16.10.20160818.2-5 amd64 OpenGL window and compositing manager - MATE integration
ii debian-mate-default-settings 1.16.1-1 all Default settings for MATE on Debian
ii engrampa 1.16.0-2 amd64 archive manager for MATE
ii engrampa-common 1.16.0-2 all archive manager for MATE (common files)
ii eom 1.16.0-2 amd64 Eye of MATE graphics viewer program
ii eom-common 1.16.0-2 all Eye of MATE graphics viewer program (common files)
ii gir1.2-mate-panel 1.16.2-1 amd64 GObject introspection data for MATE panel
ii libamd2:amd64 1:4.5.4-1 amd64 approximate minimum degree ordering library for sparse matrices
ii libatrildocument3 1.16.1-2 amd64 MATE document rendering library
ii libatrilview3 1.16.1-2 amd64 MATE document viewing library
ii libcamd2:amd64 1:4.5.4-1 amd64 symmetric approximate minimum degree library for sparse matrices
ii libccolamd2:amd64 1:4.5.4-1 amd64 constrained column approximate library for sparse matrices
ii libcolamd2:amd64 1:4.5.4-1 amd64 column approximate minimum degree ordering library for sparse matrices
ii libmate-desktop-2-17:amd64 1.16.1-1 amd64 Library with common API for various MATE modules (library)
ii libmate-menu2:amd64 1.16.0-2 amd64 implementation of the freedesktop menu specification for MATE (library)
ii libmate-panel-applet-4-1 1.16.2-1 amd64 library for MATE Panel applets
ii libmate-sensors-applet-plugin0 1.16.1-1 amd64 Library for plugins for the mate-sensors-applet package
ii libmate-slab0:amd64 1.16.1-1 amd64 beautification app library
ii libmate-window-settings1:amd64 1.16.1-1 amd64 utilities to configure the MATE desktop (window settings library)
ii libmatedict6 1.16.0-1 amd64 MATE desktop utilities (matedict library)
ii libmatekbd-common 1.16.0-2 all MATE library to manage keyboard configuration (common files)
ii libmatekbd4:amd64 1.16.0-2 amd64 MATE library to manage keyboard configuration
ii libmatemixer-common 1.16.0-2 all Mixer library for MATE Desktop (common files)
ii libmatemixer0:amd64 1.16.0-2 amd64 Mixer library for MATE Desktop
ii libmateweather-common 1.16.1-2 all MateWeather shared library (common files)
ii libmateweather1:amd64 1.16.1-2 amd64 MateWeather shared library
ii marco 1.16.0-1 amd64 lightweight GTK+ window manager for MATE
ii marco-common 1.16.0-1 all lightweight GTK+ window manager for MATE (common files)
ii mate-applet-brisk-menu 0.3.5-0ubuntu1 amd64 Solus Project's Brisk Menu MATE Panel Applet
ii mate-applet-topmenu 0.3-1 amd64 Topmenu applet for the MATE panel
ii mate-applets 1.16.0-1 amd64 Various applets for the MATE panel
ii mate-applets-common 1.16.0-1 all Various applets for the MATE panel (common files)
ii mate-backgrounds 1.16.0-1 all Set of backgrounds packaged with the MATE Desktop Environment
ii mate-control-center 1.16.1-1 amd64 utilities to configure the MATE desktop
ii mate-control-center-common 1.16.1-1 all utilities to configure the MATE desktop (common files)
ii mate-desktop 1.16.1-1 amd64 Library with common API for various MATE modules
ii mate-desktop-common 1.16.1-1 all Library with common API for various MATE modules (common files)
ii mate-desktop-environment 1.16.0+1 all MATE Desktop Environment (metapackage)
ii mate-desktop-environment-core 1.16.0+1 all MATE Desktop Environment (essential components, metapackage)
ii mate-desktop-environment-extras 1.16.0+1 all MATE Desktop Environment (extra components, metapackage)
ii mate-icon-theme 1.16.2-1 all MATE Desktop icon theme
ii mate-icon-theme-faenza 1.16.0+dfsg1-2 all MATE Faenza Desktop icon theme
ii mate-indicator-applet 1.16.0-1 amd64 MATE panel indicator applet
ii mate-indicator-applet-common 1.16.0-1 all MATE panel indicator applet (common files)
ii mate-media 1.16.0-1 amd64 MATE media utilities
ii mate-media-common 1.16.0-1 all MATE media utilities (common files)
ii mate-menu 16.10.1-2 all Advanced MATE menu
ii mate-menus 1.16.0-2 amd64 implementation of the freedesktop menu specification for MATE
ii mate-notification-daemon 1.16.1-1 amd64 daemon to display passive popup notifications
ii mate-notification-daemon-common 1.16.1-1 all daemon to display passive popup notifications (common files)
ii mate-panel 1.16.2-1 amd64 launcher and docking facility for MATE
ii mate-panel-common 1.16.2-1 all launcher and docking facility for MATE (common files)
ii mate-polkit:amd64 1.16.0-2 amd64 MATE authentication agent for PolicyKit-1
ii mate-polkit-common 1.16.0-2 amd64 MATE authentication agent for PolicyKit-1 (common files)
ii mate-power-manager 1.16.2-1 amd64 power management tool for the MATE desktop
ii mate-power-manager-common 1.16.2-1 all power management tool for the MATE desktop (common files)
ii mate-screensaver 1.16.1-1 amd64 MATE screen saver and locker
ii mate-screensaver-common 1.16.1-1 all MATE screen saver and locker (common files)
ii mate-sensors-applet 1.16.1-1 amd64 Display readings from hardware sensors in your MATE panel
ii mate-sensors-applet-common 1.16.1-1 all Display readings from hardware sensors in your MATE panel (common files)
ii mate-session-manager 1.16.1-1 amd64 Session manager of the MATE desktop environment
ii mate-settings-daemon 1.16.2-1 amd64 daemon handling the MATE session settings
ii mate-settings-daemon-common 1.16.2-1 all daemon handling the MATE session settings (common files)
ii mate-system-monitor 1.16.0-2 amd64 Process viewer and system resource monitor for MATE
ii mate-system-monitor-common 1.16.0-2 all Process viewer and system resource monitor for MATE (common files)
ii mate-terminal 1.16.2-1 amd64 MATE terminal emulator application
ii mate-terminal-common 1.16.2-1 all MATE terminal emulator application (common files)
ii mate-themes 3.22.6-1 all Official themes for the MATE desktop
ii mate-tweak 16.10.5-1 all MATE desktop tweak tool
ii mate-user-guide 1.16.0-1 all User documentation for MATE Desktop Environment
ii mate-utils 1.16.0-1 amd64 MATE desktop utilities
ii mate-utils-common 1.16.0-1 all MATE desktop utilities (common files)
ii mozo 1.16.0-1 all easy MATE menu editing tool
ii pluma 1.16.1-1 amd64 official text editor of the MATE desktop environment
ii pluma-common 1.16.1-1 all official text editor of the MATE desktop environment (common files)
ii python-mate-menu 1.16.0-2 amd64 implementation of the freedesktop menu specification for MATE (Python bindings)
ii task-mate-desktop 3.39 all MATE
|
I have the same problem.
A quick workaround could be to use feh:
feh --bg-scale <imagefile.jpg>
| Unable to change background in mate desktop |
1,394,674,674,000 |
GNOME and many window managers such as the Awesome WM use the GSettings settings database, with Dconf as the backend. What is the equivalent of this for KDE?
Also, we can edit GSettiings with the Dconf Editor application or the gsettings command line tool. For example:
gsettings set org.gnome.desktop.wm.preferences button-layout ':minimize,maximize,close'
Has somebody work with KDE's engine? What's its name? What tools are there to modify it (such as dconf-editor and gsettings)?
Finally, we can hack the GSettings engine with gsettings get; how can I do this in KDE?
|
I found the corresponding settings saved in .kde/share/config/kioslaverc.
| DConf equivalent for KDE |
1,394,674,674,000 |
With terminal emulators like gnome-terminal, it is possible to change settings programmatically, from the command line using dconf and gconf.
But I have trouble finding a similar mechanism for xfce4-terminal.
Specifically, how to select colors or a theme (or preset as it is called in the preferences menu).
I tried finding a corresponding option using xfconf-query but there doesn't seem to be one.
|
My changes to RJ-Adam's answer were rejected, thus I give correcting answer:
User specific configuration can be set in
${XDG_CONFIG_HOME:-~/.config}/xfce4/terminal/terminalrc
Which commonly resolves to:
~/.config/xfce4/terminal/terminalrc
Edit that and so xfce4-terminal picks up the changes immediately, if it is running.
You could use sed -i or gawk -i inplace to programmably edit the file and consequently change the settings
See XDG Base Directory Specification for more about which and how configuration settings are read especially concerning system wide configuration which is the base.
| How to programmatically change settings of xfce4-terminal? |
1,394,674,674,000 |
I'm in need to standardize (a default standard desktop configuration for all existent and new users) a GNOME environment starting from an existent configuration of an ad-hoc created user.
What I have is: A user named 'master' with a MATE 1.12.1 desktop environment (running on CentOS7) perfectly configured: menus, background, icons, fonts, double monitor and other amenities.
What I need is: A fast method to copy its GSettings/dconf configuration and make it default / standard for every new / existent user.
Can anybody, please, detail step by step (also in pseudo code) how to do that and what to copy and where?
|
You can set system-wide dconf settings by storing them in a text file under /etc/dconf/db/local.d and running dconf update.
If you've set up things on a user's account, you can print out the settings in text form with the dconf command line utility. dconf dump / prints out all known settings but you should only retain the settings that you modified.
| How to create a default system wide dconf setting starting from just created ad-hoc user config? |
1,394,674,674,000 |
I did as follows:
$ gsettings get org.gnome.desktop.session idle-delay
uint32 300
$ gsettings set org.gnome.desktop.session idle-delay 80
$ gsettings get org.gnome.desktop.session idle-delay
uint32 80
But when I do: dconf dump /org/gnome/, I see as follows:
$ dconf dump /org/gnome/desktop/session
[/]
idle-delay=uint32 60
Observation: dconf dump shows real value, but gsettings shows new value but it is different from the one shown by dconf-editor
After Restarting
$ dconf dump /org/gnome/desktop/session
[/]
idle-delay=uint32 60
$ gsettings get org.gnome.desktop.session idle-delay
uint32 300
Observation: dconf dump shows real value, but gsettings shows default value
Does this mean that gsettings are not working on my system? If so, how can I fix this?
|
I had a similar problem with gsettings not being able to change the desktop background. Then I found this link showing that the anaconda installation changes the path from the original gsettings:
$ which gsettings
/home/rafael/.anaconda3/bin/gsettings
So I moved ~/.anaconda3/bin/gsettings to ~/.anaconda3/bin/gsettings_bkp, and now the original gsettings is being used:
$ which gsettings
/usr/bin/gsettings
| dconf editor value is different from gsettings get value |
1,394,674,674,000 |
I am currently running "Linux Mint 18.3 Sylvia" with the Desktop Environment "xfce4".
Because I have to setup several PCs, I want to write a bash script, that configures the keyboard shortcuts for the system.
I did some research, but none of these articles were what I was searching for. Here for example the author is using Cinnamon as DE, so the given filepath (/org/cinnamon/desktop/keybindings/) does not exist on my system.
In this article the author is using the program dconf-cli. But i don't want to use an external application. I really want to know, where on my system, these shortcuts will be saved.
|
You're looking for $XDG_CONFIG_HOME/xfce4/xfconf/xfce-perchannel-xml/xfce4-keyboard-shortcuts.xml
Replace $XDG_CONFIG_HOME with ~/.config if you don't have it as an environment variable.
You'll find the user configuration files for most XFCE4 applications in that $XDG_CONFIG_HOME/xfce4 folder, so you might want to simply copy that over for your DE configuration to be consistent between devices.
As an aside, the mentioned path /org/cinnamon/desktop/keybindings/ isn't meant to be an actual file on your filesystem.
It's a path stored in the dconf database, which you can find at $XDG_CONFIG_HOME/dconf/user
It's unfortunately not plaintext, and as such not very easy to manipulate without using the dconf command
| Where are the Linux Mint xfce keyboard shortcuts saved? |
1,394,674,674,000 |
I want to disable 'app folders' in the GNOME menu, because I want to have all applications sorted alphabetically. gsettings set org.gnome.desktop.app-folders folder-children [] lets the folders disappear, but after a reboot the app folders were set back to default. How can I make the settings persistent ? What do I have to do ? Or is this just a bug in fedora 24 or in GNOME 3.20 ?
|
It has to be [''] instead of [] - Thanks and reference to the user zdenek from the ask fedora platform who helped me to figure it out and find the solution : How to make app folders settings permanent?
The command is : gsettings set org.gnome.desktop.app-folders folder-children ['']
| How can I disable app folders in the GNOME menu permanently? |
1,394,674,674,000 |
I am currently using Linux Mint 19.03 Cinnamon.
Issue
I launch gnome-calculator with Cal shortcut button and when I press that button, new gnome-calculator window is spawned. I don't want this behaviour.
Expected result
I am expecting the Cal button launches gnome-calculator but if it is already running, when Cal is pressed again, it will reveal the existing window, and so on and so forth.
Current attempt
I've found, using dconf editor that I can customize the desktop.
So far, I've also found the string to execute the gnome-calculator which is:
org.cinnamon.desktop.default-applications.calculator exec 'gnome-calculator'
I use dconf editor such as this one:
So far, what I need is to change the Custom value with the proper command to check the existing calculator window and reveal it.
The question
What is the command (or script too) to focus on existing gnome-calculator window? And if it doesn't exist, simply spawn one.
Thank you in advance.
|
I've found the answer. This problem turns out not a specific DE problem. It's the behavior of the app itself which is gnome-calculator.
I've found two methods(or workarounds) for doing this:
Using wmctrl
So, the basic command is this:
wmctrl -xa gnome-calculator || gnome-calculator
To make it work in dconf command, warp it in shell command and apply it to dconf using terminal such as this:
gsettings set org.cinnamon.desktop.default-applications.calculator exec "sh -c 'wmctrl -xa gnome-calculator || gnome-calculator'"
Using xdotool
With this one,you need to installxdotool.
The command:
xdotool search --class gnome-calculator windowactivate || gnome-calculator
Dconf setting:
gsettings set org.cinnamon.desktop.default-applications.calculator exec "sh -c 'xdotool search --class gnome-calculator windowactivate || gnome-calculator'"
reference:
mattia-b89's comment
askubuntu question
mtwebster's github comment
| How to focus program window instead of spawning new one if it's already open |
1,394,674,674,000 |
When I launch meld with sudo, su, gksu or gksudo I have the following output:
(meld:1666): GLib-GIO-CRITICAL **: g_dbus_proxy_new_sync: assertion 'G_IS_DBUS_CONNECTION (connection)' failed
(meld:1666): GLib-GIO-CRITICAL **: g_dbus_proxy_get_name_owner: assertion 'G_IS_DBUS_PROXY (proxy)' failed
(meld:1666): dconf-WARNING **: failed to commit changes to dconf: Error spawning command line 'dbus-launch --autolaunch=745b249ad9024475816761582a9ee2ca --binary-syntax --close-stderr': Child process exited with code 1
And I am not able to change the settings.
In comparison, I use geany with sudo without any problem, error or warning, and I am able to change the geany's settings.
I use:
meld 3.16.4
dconf 0.26.0
glib2 2.50.3
|
According to this topic: dbus not accessible via kdesu/sudo, but recompiling dbus helps, I have to recompile dbus.
So this is what I did on my Archlinux system
# installs arch build system
sudo pacman -S abs
# download the abs dbus (do it with the root user)
abs core/dbus
# copy the files in my HOME
cp -r /var/abs/core/dbus/ ~/abs
# compile dbus
cd ~/abs/dbus
makepkg -s
# install the compiled package
sudo pacman -U dbus-1.10.16-2-x86_64.pkg.tar.xz
And that fixed the problem!
| Unable to change the settings in meld when I launch it with sudo |
1,394,674,674,000 |
When I install Linux Mint (Mate, Qiana) I like to make Mate panel more wide (or may be "higher").
Default it is near 20 pixels. I make it, for example, 45 pixels. I can easy set it by right button click mouse on the panel.
Now I want to make file with all my preferences that I use to install in Linux. There will be commands for Terminal (command line). And I need help with mate-panel settings.
I found that I can set size of mate-panel in dconf editor:
org - mate - panel - toplevels - bottom
size 45
Question: How to make the same in command line?
NB! This "size" is not simple value. Perhaps it is part of list of values. I can see in dconf in "org - mate - panel - general" value toplevel-id-list is equal 'bottom'. Its description is:
"A list of panel IDs. Each ID identifies an individual toplevel panel. The settings for each of these panels are stored in /apps/panel/toplevels/$(id)".
So must I to edit this list?
|
I don't have a MATE environment to test on but in general, this type of thing can be set using gsettings. Try this:
gsettings set org.mate.panel.toplevel:/org/mate/panel/toplevels/bottom/ size 45
That should set the value you want. For more details, see http://wiki.mate-desktop.org/docs:gsettings.
| How to set size of mate-panel via command line (not via dconf)? |
1,394,674,674,000 |
I am working with gnome 3.28.2 on CentOS 7.6 and have been trying to set global values for certain parameters in the dconf key files as explained here and using the screensaver example here along with locking the settings explained here
I have created a file /etc/dconf/db/local.d/00-configuration_gnome with the following contents
# These work
[org/gnome/desktop/lockdown]
disable-user-switching=true
disable-lock-screen=true
[org/gnome/desktop/screensaver]
user-switch-enabled=false
lock-enabled=false
lock-delay=uint32 0
[org/gnome/desktop/session]
idle-delay=uint32 0
# These do not work/get taken into account
[org/gnome/desktop/interface]
clock-show-seconds=true
[org/gnome/SessionManager]
logout-prompt=false
Certain parameters are taken into account like described in the gnome documentation but others seem to be ignored. I can change the values via the command line with commands such as
gsettings set org.gnome.SessionManager logout-prompt false
followed by
dconf update
but ideally, these values would be set automatically (during installation of the OS for example and not ran in a script during login for each individual account).
Any ideas as to what my problem is? And I would like the logout-prompt=false value to be applied to the gdm user as well. From what I understand it is the account used at the regular login screen but I am having trouble doing that too.
|
If you look at the schema definition (found in /usr/share/glib-2.0/schemas/org.gnome.SessionManager.gschema.xml):
<schemalist gettext-domain="gnome-session-3.0">
<schema id="org.gnome.SessionManager" path="/org/gnome/gnome-session/">
<key name="auto-save-session" type="b">
<default>false</default>
....
You can see that the schema ID is org.gnome.SessionManager, but the path is /org/gnome/gnome-session. That's kinda confusing, but it looks like you need to use the path in the dconf command and the ID in the gsettings command.
$ gsettings get org.gnome.SessionManager logout-prompt
true
$ dconf write /org/gnome/gnome-session/logout-prompt false
$ gsettings get org.gnome.SessionManager logout-prompt
false
So, you'd want your dconf files to have
[org/gnome/gnome-session]
logout-prompt=false
Also, if you want to set the dconf settings for GDM, place them in /etc/dconf/db/gdm.d/ instead.
| Certain parameters in dconf keyfiles not being taken into account/used |
1,394,674,674,000 |
The solution given in Custom global keybindings in cinnamon via gsettings is not working in Linux Mint 20.
I monitored the changes using dconf watch / and the following changes were made while creating the shortcut using GUI:
/org/cinnamon/desktop/keybindings/custom-list
['custom0']
/org/cinnamon/desktop/keybindings/custom-keybindings/custom0/binding
@as []
/org/cinnamon/desktop/keybindings/custom-keybindings/custom0/command
'screen -d -m "/home/blueray/src/Translate/screen_ts.sh"'
/org/cinnamon/desktop/keybindings/custom-keybindings/custom0/name
'capture2text'
/org/cinnamon/desktop/keybindings/custom-keybindings/custom0/binding
['<Super>q']
To set the first line I used:
gsettings set org.cinnamon.desktop.keybindings custom-list "['custom0']"
But when it comes to the second line it throws error:
% gsettings set org.cinnamon.desktop.keybindings.custom-keybindings.custom0 binding "@as []"
No such schema “org.cinnamon.desktop.keybindings.custom-keybindings.custom0”
How can I set custom shortcut in Linux Mint 20 using gsettings (not GUI).
|
You can use the following lines as an example
dconf write /org/cinnamon/desktop/keybindings/custom-list "['custom0']"
dconf write /org/cinnamon/desktop/keybindings/custom-keybindings/custom0/command "'tmux new-session -d "/home/blueray/src/Translate/screen_ts.sh"'"
dconf write /org/cinnamon/desktop/keybindings/custom-keybindings/custom0/name "'capture2text'"
dconf write /org/cinnamon/desktop/keybindings/custom-keybindings/custom0/binding "['<Super>q']"
# xkill keybinding for ctrl + escape
dconf write /org/cinnamon/desktop/keybindings/custom-list "['custom0', 'custom1']"
dconf write /org/cinnamon/desktop/keybindings/custom-keybindings/custom1/command "'xkill'"
dconf write /org/cinnamon/desktop/keybindings/custom-keybindings/custom1/name "'xkill'"
dconf write /org/cinnamon/desktop/keybindings/custom-keybindings/custom1/binding "['<Primary>Escape']"
| Custom keybindings For Linux Mint 20 via gsettings |
1,394,674,674,000 |
As background: Electronics engineer, follow suckless philosophy (where posible), no knowledge about X and and any kind of toolkits (GTK or Qt), using arch linux, cannot stand GNOME.
It bothers me that gtk3 package has dconf and gsettings dependence. I cannot find a compeling explanation of what gsettings is used for (other than manual pages and other internet bits), what are schemas, and what it has to do with GNOME DE.
Mainly I am asking silly questions:
What is the practical usage of gsettings and what ties it to GNOME
DE?
What separates gtk3 rc files from gsettings?
Any ways to avoid, or should I try to avoid gsettings, any
alternatives?
|
Short answer
(as I understand this):
dconf is database system which keeps settings (GVariants) in database files and it is on the bottom layer.
dconf schemas are the files which contain structure of these database files.
gsettings is an API and a toolkit to store and retrieve this settings from and to database.
Long answer
(as explained in Wikipedia):
dconf is a low-level configuration system and settings management tool. Its main purpose is to provide a back end to GSettings on platforms that don't already have configuration storage systems. It depends on GLib. It is part of GNOME 3 and is a replacement for GConf.
dconf database:
One dconf database consists of a single file in binary format, i.e. it is not a text-file. The format is defined as gvdb (GVariant Database file). It is a simple database file format that stores a mapping from strings to GVariant values in a way that is extremely efficient for lookups.
GVariant:
GVariant is a strongly typed value datatype. GVariant is a variant datatype; it can contain one or more values along with information about the type of the values.
A GVariant may contain simple types, like integers, or boolean values; or complex types, like an array of two strings, or a dictionary of key value pairs. A GVariant is also immutable: once it's been created, neither its type nor its content can be modified further. GVariant is useful whenever data needs to be serialized, for example when sending method parameters in DBus, or when saving settings using GSettings.
GVariant is part of GLib.
GSettings:
The GSettings class provides a high-level API for application for storing and retrieving their own settings.
The utility program /usr/bin/gsettings is contained in libglib2.0-bin.
GSettings is part of GIO which is part of GLib (libglib2.0-0).
| GTK3 gsettings usage |
1,394,674,674,000 |
It seems that GNOME 43 removed the ability to adjust the width of the left sidebar in Nautilus (named Files now, apparently?) by dragging the border. Does anyone know a workaround for this? I'd like to make it wider than the default. The org.gnome.nautilus.window-state.sidebar-width property in dconf doesn't do anything anymore, it's mentioned in this old answer from 2013. I also checked out org.gnome.file-roller.ui.sidebar-width in dconf, but that key also appears to be unused.
For these two keys, Dconf Editor shows the message:
"No schema available. A schema is what describes the use of a key, and Dconf Editor can't find one associated with this key. If the application that was using this key has been uninstalled, or if this key is obsolete, you may want to erase it."
This implies to me that the sidebar width used to be adjustable through dconf but not longer is and the keys (or at least org.gnome.nautilus.window-state.sidebar-width) still exist but aren't used anymore.
|
There is an issue thread posted on the Gnome file repo, see
Sidebar too wide, doesn't reflect sidebar items width.
The options you mentioned are no longer available, which is confirmed in the issue thread.
IMHO, there are 2 workarounds so far,
compile the un-merged version e.g. Draft: ui: Use AdwAdaptiveState to manage adaptive UI
rollback to gnome file version 42
| Fedora 37 with GNOME 43 - adjust Files/Nautilus sidebar width |
1,394,674,674,000 |
I'm on Arch Linux + GNOME 3.32 + Wayland
I want the touchpad to be disabled when an external mouse is connected.
I know there's a great extension for this that I've been using for long time, but it is currently (at time of writing) not working with GS 3.32 yet. So, I discovered that it can also be done via dconf:
To do so, I run dconf editor and set /org/gnome/desktop/peripherals/touchpad/send-events to disabled-on-external-mouse
That works perfectly, however it is reset to enabled everytime I restart my GNOME session.
How do I make it persistent?
EDIT: I have found a workaround; see my answer below
|
Ok, as a workaround I added the following to ~/.bashrc file:
dconf write /org/gnome/desktop/peripherals/touchpad/send-events "'disabled-on-external-mouse'"
This is executed at every login and restores the wanted settings
| GNOME: disable touchpad when external mouse is connected (keep dconf setting across sessions) |
1,394,674,674,000 |
I am trying to fix the power button on gnome 3 not shutting down the system and as don_crissti said in this thread (Gnome 3: how to set power button to shutdown instead of suspend?) that options was removed.
He also mentions that you can fix it
if you're willing to patch and rebuild gnome-settings-daemon
so how would I go about doing that?
|
Make a directory build and download patch there, saving it as d.patch.
Follow this script (I have saved whole session, so you know from which directories you should cast these spells).
[user@MACHINE build]$ git clone git://git.gnome.org/gnome-settings-daemon #download GSD source
[user@MACHINE build]$ git clone git://git.gnome.org/libgnome-volume-control #download dependency
[user@MACHINE build]$ cd gnome-settings-daemon/
[user@MACHINE gnome-settings-daemon]$ git checkout GNOME_SETTINGS_DAEMON_3_18_2 #get the version for which the script was prepared
[user@MACHINE gnome-settings-daemon]$ git submodule init #download more dependencies
[user@MACHINE gnome-settings-daemon]$ git config --local submodule.panels/media-keys/gvc.url ../libgnome-volume-control
[user@MACHINE gnome-settings-daemon]$ git submodule update
[user@MACHINE gnome-settings-daemon]$ cd ..
[user@MACHINE build]$ wget https://launchpad.net/ubuntu/+archive/primary/+files/gnome-settings-daemon_3.18.2-0ubuntu2.debian.tar.xz #download Ubuntu patches - that's why I asked you about your OS
[user@MACHINE build]$ tar -xf gnome-settings-daemon_3.18.2-0ubuntu2.debian.tar.xz
[user@MACHINE build]$ cd gnome-settings-daemon/
[user@MACHINE gnome-settings-daemon]$ patch -p1 -i ../debian/patches/64_restore_terminal_keyboard_shortcut_schema.patch #apply Ubuntu patches if you want Ubuntu version of GSD
[user@MACHINE gnome-settings-daemon]$ patch -p1 -i ../debian/patches/ubuntu-lid-close-suspend.patch
[user@MACHINE gnome-settings-daemon]$ patch -p1 -i ../debian/patches/revert_background_dropping.patch
[user@MACHINE gnome-settings-daemon]$ patch -p1 -i ../debian/patches/revert-gsettings-removals.patch
[user@MACHINE gnome-settings-daemon]$ cd ..
[user@MACHINE build]$ mv gnome-settings-daemon gnome-settings-daemon-3.18.2
[user@MACHINE build]$ patch -p0 <d.patch #patch with downloaded patch
[user@MACHINE build]$ cd gnome-settings-daemon-3.18.2/
[user@MACHINE gnome-settings-daemon-3.18.2]$ NOCONFIGURE=1 ./autogen.sh #generate config script - would fail if we wouldn't download those dependencies before
[user@MACHINE gnome-settings-daemon-3.18.2]$ ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --libexecdir=/usr/lib/gnome-settings-daemon --disable-static #configure - will check for dependencies - you might need to download some packages
[user@MACHINE gnome-settings-daemon-3.18.2]$ sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool #see https://bugzilla.gnome.org/show_bug.cgi?id=656231
[user@MACHINE gnome-settings-daemon-3.18.2]$ make
[user@MACHINE gnome-settings-daemon-3.18.2]$ make install
The script was adapted from here. You can see there roughly the dependencies you need for configuring it.
TL;DR
The only magic there is getting all the sources together: git submodules, Ubuntu patches from launchpad and libgnome-volume-control. It would work without applying sed. The whole rest is a standard procedure.
| How to patch and rebuild gnome-settings-daemon? |
1,298,651,148,000 |
How can I clear the DNS cache in DD-WRT on my router?
DD-WRT uses the dnsmasq daemon.
|
According to Flush dnsmasq dns cache:
dnsmasq is a lightweight DNS, TFTP and DHCP server. It is intended to provide coupled DNS and DHCP service to a LAN. Dnsmasq accepts DNS queries and either answers them from a small, local, cache or forwards them to a real, recursive, DNS server. This software is also installed many cheap routers to cache dns queries. Just restart to flush out dns cache:
# stopservice dnsmasq
# startservice dnsmasq
| How to clear DNS cache on DD-WRT |
1,298,651,148,000 |
I have several machines on my LAN. Most of them Ubuntu based. Router has DD-WRT (v3.0-r33675M kongac Release: 11/03/17) firmware.
I have set DHCP to serve network settings for all my computers. Router has been set to use 9.9.9.9 for DNS server.
Now I want to verify my computers are using quad9 for DNS, but I am unable to do so. My computers see only the router and are not aware which DNS it is using.
For example, command (in Ubuntu)
sudo netstat -l --inet -n -v -p | grep :53 | grep -i udp
Gives
udp 0 0 127.0.1.1:53 0.0.0.0:*
So I cannot verify I am using quad9 in this manner.
Router does not recognize this command, so I cannot verify DNS setting that way.
I have tried things in this post in computer and in DD-WRT command line, but none help:
What DNS servers am I using?
How can I properly verify I am using quad9 for DNS?
|
You can use tcpdump to see where the DNS traffic goes:
# tcpdump -i eth0 -n udp port 53 or tcp port 53
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 262144 bytes
16:09:02.961122 IP 192.168.115.15.49623 > 192.168.115.5.53: 6115+ A? www.heise.de. (30)
16:09:02.983664 IP 192.168.115.5.53 > 192.168.115.15.49623: 6115 1/13/14 A 193.99.144.85 (493)
| How do I verify I am using 9.9.9.9 for DNS? |
1,298,651,148,000 |
I've been looking everywhere for this. Does anyone know how to block a specific URL on a DD-WRT router? For example, I want to block website.com/whatever but not website.com, blah.website.com, or website.com/blah. Is there a way to do this, or can you only block the whole domain?
I tried adding the URL in question under Access Restrictions in the DD-WRT configuration but it doesn't seem to have any effect. Here are my settings:
and here is the list of clients:
I can still easily browse to google.com/imghp and google.com/images (which redirects to google.com/imghp) on my main PC with IP address 192.168.1.146.
On this page of the DD-WRT wiki, it says "Under Website Blocking by URL Address, enter in the domain name(s) you wish to block (if any)." This, in addition to posts on the DD-WRT forums, gives me the impression that you can only block domains under Access Restrictions in the DD-WRT setup.
I'm starting to wonder if this problem must be solved using iptables, or possibly by installing a proxy server on the router itself.
EDIT
User goli on the DD-WRT forums had this to say on the matter (link):
There's a Privoxy version that runs on DD-WRT quite well. I just installed it.
Privoxy has a parameter "accept-intercepted-requests 1" that allows to use it as a transparent proxy.
I added a single iptables rule that passes some web traffic requests to the proxy instead of directly routing it:
iptables -t nat -A PREROUTING -i br0 -p tcp --dport 80 -s 192.168.0.128/255.255.255.224 -j DNAT --to 192.168.0.1:8118
Privoxy has so called "actionfiles." Those define what to do when a request URL matches a given regular expression. One of the possible actions is "block."
Since then, I've been working on figuring out how to install Privoxy on the router. It's rather complicated, especially since I don't have enough spare flash memory to install it via SSH using ipkg. (See this question on Super User.)
My second approach is to use the Firmware Modification Kit, which you can read about here. I've had some difficulty flashing a custom build, but once I get it all sorted out I'll post my results here.
|
Unfortunately, the impression I get (from the DD-WRT forums) is that you can only block domains under Access Restrictions in the DD-WRT setup.
I've decided instead to set up a dedicated proxy server with DansGuardian installed on it, which will allow me a fine level of control, and block any requests that don't go through the proxy on the router using iptables in OpenWrt.
| How can I block a specific URL on a DD-WRT router? |
1,298,651,148,000 |
I have an ASUS RT-N16 router that I've flashed with the open-source DD-WRT firmware. According to my ssh login, I'm running:
DD-WRT v24-sp2 mega (c) 2010 NewMedia-NET GmbH
Release: 08/07/10 (SVN revision: 14896)
I'd like to be able to customize the iptables rules, but before I do that, I'd like to see the output of the built-in rules that get configured when manipulating the browser/GUI interface settings. I am aware of the firewall script tab in the browser interface for entering custom firewall rules, but I can't find someplace to see the output.
On a full-blown Linux system, the iptables rules would be stored somewhere like /etc/sysconfig/iptables. Where would I find these on a DD-WRT filesystem? I can do
iptables -L -vn --line-numbers
and see them output, but what I'm looking for is more of what the iptables-save command might output... so that I can incorporate the appropriate rules into my custom script.
I understand that this build does not have an iptables-save command. I don't necessarily want the command itself, just output that it generates. If there was something like /etc/sysconfig/iptables, I wouldn't care about having iptables-save. I've seen that there may be different builds of DD-WRT that give something like iptables-save, but I'm not at the point where I'm ready or willing to flash the router again. Maybe as a last resort.
EDIT:
The usual Linux locations for startup scripts and the like, (e.g., /etc/init.d, /etc/rc, ...) do not seem to have anything useful (at least in the build of DD-WRT that I have installed). For example, taking a look in /etc/init.d:
[/etc/init.d]# ll
-rwxr-xr-x 1 root root 84 Aug 7 2010 rcS
-rwxr-xr-x 1 root root 10 Aug 7 2010 S01dummy
[/etc/init.d]# cat rcS
#!/bin/sh
for i in /etc/init.d/S*; do
$i start 2>&1
done | logger -s -p 6 -t '' &
[/etc/init.d]# cat S01dummy
#!/bin/sh
|
Looking in
/tmp/.ipt
/tmp/.rc_firewall
gives exactly what I was looking for: the iptables rules as they would normally be in a file like /etc/sysconfig/iptables.
I had earlier found this:
dd if=/dev/mem | strings | grep -i iptables
...and fortunately, it works on the pared-down DD-WRT filesystem. It didn't give precisely what I was looking for, but it output quite a bit of info I hadn't been able to pinpoint any other way (or at least not with a single command).
Still have to determine which things are actually in effect by comparing with the output of
iptables -L -vn --line-numbers
iptables -L -vn -t nat --line-numbers
iptables -L -vn -t mangle --line-numbers
I also discovered that the grep command actually does work [my apologies for initially stating that it didn't-- I would've sworn it didn't work the last times I had tried. Mea maxima culpa.] Using grep, I found that the
/lib/services.so
also has a wealth of iptables configuration in it.
| Where is iptables script stored on DD-WRT filesystem? |
1,298,651,148,000 |
I would like to be able to add a parameter to certain URL requests that go through my DD-WRT router. Specifically, I'm trying to figure out how to force safe search in Google, which means I have to append safe=on to any URL requests that begin with *google*.
I've read about running a server on the router that acts as a proxy. Then on that server I could use mod_rewrite or something similar. I've also read about firewall rules using iptables. Both of these are way over my head, but I can't seem to find any real guidance on this.
|
You can't do this in a sane way for Google search queries.
Why? Google is using HTTPS (SSL) everywhere now. All traffic between the endpoints (browser & Google server) is encrypted and checked for integrity.
The only way to read (let alone modify) encrypted traffic is changing it at or beyond on one of the endpoints. Suggestions in the direction of mod_rewrite are all server-side and you probably don't have access at Google's servers. ;)
Workarounds for this like modifying your local DNS forwarder to answer differently and set up a proxy server with SSL MITM won't work either without adding your own fake CA to every browser. Moreover, using Google Chrome, it's way harder to circumvent this as Google has hardcoded fingerprint signatures to check. Refer to some news regarding the DigiNotar in 2011, for example here.
Back to your objective and the only endpoint you can control here. My suggestion would be to find a browser addon/plugin that will fit your needs and enforce it for the user. For example by modifying the file system permissions for the configuration of it to prevent the user from changing it and disallow any new software installations.
| How can I enable URL rewriting on a DD-WRT router? |
1,298,651,148,000 |
I have DD-WRT installed on my router and I would like to be able to restrict the bandwidth both up and down on a certain IP or Mac address. I am happy to get my hands dirty and use console.
I am sure that iptables can do this? If so could someone show me a quick example?
|
Well, unfortunately I haven't found a simple way to do this otherwise I would give you some examples; however, the tc command will do what you need.
Tc is a traffic shaping utility that is built into the Linux kernel. Be prepared, it isn't for the faint of heart. I recommend doing a good bit of reading about the queuing disciplines before starting.
At the least, this should give you somewhere to start:
http://www.dd-wrt.com/wiki/index.php/Tc_command
EDIT:
From that page, this link claims to have a "simple" answer:
http://lartc.org/howto/lartc.ratelimit.single.html
| Restrict bandwidth with DD-WRT |
1,298,651,148,000 |
I'm trying to redirect all traffic on my wifi router to a local webserver using iptables. I'm not sure I have got the command right and also I want to exclude the router IP (172.16.0.1) from the rule to prevent myself from locking myself out from accessing the router.
What I've come up with so far:
iptables -t nat -A PREROUTING -i br0 -p tcp --dport 80 -j DNAT --to 172.16.0.2:80
iptables -t nat -A PREROUTING -i br0 -p tcp --dport 443 -j DNAT --to 172.16.0.2:80
I tested above and it cause me not to be able to access the router again and the redirect is not working. What am I doing wrong, and how can exclude 172.16.0.1 from being redirected to 172.16.0.2?
Setup: 172.16.0.2 is the IP for the webserver 172.16.0.1 is my router (dd-wrt) no internet connection.
Example of what I'm trying to achieve:
User connects to wifi hotspot, trying to access www.siteA.com, gets
redirected to 172.16.0.2 (/index.html)
User connects to wifi hotspot, trying to access www.siteB.com, gets redirected to 172.16.0.2
(/index.html)
User tries to access 172.16.0.1 and no direction takes place
|
All you need is this single rule:
iptables -t nat -I PREROUTING --src 0/0 --dst 172.16.0.2
This will insert into PREROUTING chain (?=-I) of the nat table (-t nat) the rule, that says:
Any incomming (-src 0/0) packets with destination address 172.16.0.2 (--dst 172.16.0.2).
Things to remember are:
To redirect incoming traffic means inserting rules into PREROUTING chain of the nat table. Redirection is done only for specified interface. More in man iptables, search for REDIRECT keyword.
--append PREROUTING --source 172.16.0.1 --jump RETURN
RETURN means stop traversing this chain and resume at the next rule in the previous (calling) chain. If the end of a built-in chain is reached or a rule in a built-in chain with target RETURN is matched, the target specified by the chain policy determines the fate of the packet.
| Using iptables to redirect all traffic to local webserver |
1,298,651,148,000 |
I want to mount my usb drives using UUID or Labels. The busybox provided mount does not support these functions.
I installed mount-utils from entware. However the busybox mount overrides the mount from mount-utils.
I have installed DD-WRT v24 sp2 kongac build:26365 on Netgear r7000.
How do I do this? I need this as I have two different usb drives which I need to mount at specific points to use samba server.
|
If this busybox comes with findfs you can do
mount $(findfs UUID=cb586ec4-e121-437c-83db-e46df501e046) /mnt/dest
mount $(findfs LABEL=foobar) /mnt/dest
Otherwise you'll just have to find room for a better version of busybox I guess? You can download some precompiled ones for various architectures here: http://www.busybox.net/downloads/binaries/latest/
| DD-WRT and mount command |
1,298,651,148,000 |
i have done the following on my Asus WL-520gu
Installed the dd-wrtv24-sp2 mini svn:13064
Updated for usb support
Installed optware package
Activated the transmission client
but i keep getting a permission error for files.
I think it is a user access thing.
How to resolve this issue? Is there any way to ignore user permissions on a drive?
Update:
i think it is due to the permissions of the user under which the transmission daemon is running. Can I change that user to root?
I know where but don't know how /etc/init.d/transmission.
|
Don't change the daemon to run as root. Change the permissions on the folder where your daemon has to write so that it is allowed to do so.
Assuming it's running as user transmission, run something like this as root:
chown transmission /mnt/data/torrents/downloads
chmod u+rw /mnt/data/torrents/downloads
| "Error: permission denied" error from Transmission Client |
1,298,651,148,000 |
I have recently installed DD-WRT on my D-Link DIR-615 router (rev. D3). Everything seems fine but I cannot connect to some (most) FTP servers anymore. Any ideas what can cause this issue?
--
Passive/active doesn't make a difference.
I've discovered something interesting. I've set up a port range forwarding 1024-65535 | Both | 192.168.1.131 for the testing purposes. After that I have enabled or disabled (it doesn't really matters it seems) the UPnP service and it let me connect to FTP but just for a few seconds.
|
This is an old topic, but someone might still find my solution useful: update your firmare. DD-WRT provides updated versions and the last one I could find here http://dd-wrt.com/site/support/other-downloads?path=others%2Feko%2FBrainSlayer-V24-preSP2%2F works. I can finally use FTP.
| FTP issues after installing DD-WRT |
1,298,651,148,000 |
I have a Arch Linux system on my home network and its MAC address is setup in my Linksys running DD-WRT to receive a static lease. However, this system is not getting the static lease from the DD-WRT, but rather a random ip from the dynamic pool. I tried various things, like forcing a lease renewal, but to no avail. How should I go about troubleshooting this problem? Running Arch Linux 201404 with a wired connection. I am new to Arch, but been a long time Debian user, so the Arch ip toolset is not too familiar to me.
|
I did this exact thing this morning.
First, double check that the lease isn't allocated. Go to the Status page and then the LAN page on DD-WRT. Check the lease in the list of DHCP clients. If it's allocated, click the trash can.
I also have my lease set to 5 minutes. If I left it for a whole day, which is the default, I found that if the signal got disrupted, my computer would disconnect and when it reconnected, the lease would still be allocated and so it would take an address from the pool. That messed with my port forwards. Setting it to 5 minutes prevented that.
Then, following from this part of the wiki, you need to find the name and MAC of your wireless NIC:
$ iw dev
Make sure you're using that MAC in your static lease on DD-WRT as the wired one will be different (I've made that mistake before).
Checking the status of your link is done via:
$ iw dev wlan0 link
It will either say Not Connected or give you information about your access point. At this point you don't want to be connected so if you are, issue:
# iw dev wlan0 disconnect
The wiki says that interface activation is not usually necessary, though for me it was. You can check the status with:
# ip link show wlan0
Don't pay attention to the state but look for the word UP inside the <...>.
If it's not up, use:
# ip link set wlan0 up
I'm going to assume that you know your SSID. In which case to connect to the access point, you can use:
# iw dev wlan0 connect your_essid
if it's open or:
# wpa_supplicant -i wlan0 -c /etc/wpa_supplicant.conf
if you're using WPA, after providing the appropriate details in wpa_supplicant.conf.
Now recheck that you're associated with the access point by reissuing:
$ iw dev wlan0 link
Finally, you'll want to obtain an IP address by issuing:
# dhcpcd wlan0
DD-WRT should then match the MAC of your wireless NIC and issue the static lease address to you.
| Arch Linux not picking up static DHCP lease from DD-WRT |
1,298,651,148,000 |
I'm trying to get NFS working properly on a DD-WRT install using OTRW2. I can see and mount the share from the client. But when I do, the mounted folder changes it's owner to root:root and so my normal user does not have write access.
I saw this post by Frater (the original author of the scripts), in which he says that the unfsd service is running as www-data:www-data and that the share should be chowned.
However when I try chowning the /mnt symlink or the /tmp/mnt mount, I receive the following:
root@router:~# sudo chown www-data:www-data /mnt
changing ownership of `/mnt': Operation not permitted
root@router:~# sudo chown www-data:www-data /tmp/mnt
changing ownership of `/tmp/mnt': Operation not permitted
My mounts look like this:
root@router:/opt# mount
rootfs on / type rootfs (rw)
/dev/root on / type squashfs (ro)
none on /dev type devfs (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
ramfs on /tmp type ramfs (rw)
devpts on /dev/pts type devpts (rw)
devpts on /proc/bus/usb type usbfs (rw)
/dev/discs/disc0/part1 on /opt type ext3 (rw,noatime,data=ordered)
/dev/sda3 on /tmp/mnt type vfat rw,noatime,fmask=0022,dmask=0022,codepage=cp437,iocharset=iso8859-1)
I've tried the default exports file as well as this:
root@router:~# cat /opt/etc/exports
# /etc/exports: the access control list for filesystems which may be exported
# to NFS clients. See exports(5).
#
/mnt 192.168.1.0/24(rw,sync,no_subtree_check,all_squash)
# default
#/mnt 192.168.0.0/255.255.0.0(rw,no_root_squash)
On the client I have a directory that starts out as:
drwxr-xr-x 2 kyle users 4096 Feb 16 09:43 NAS
I've tried from the command line:
kyle@client:~$ sudo mount -v -t nfs router:/mnt NAS
mount.nfs: timeout set for Sun Feb 16 14:09:17 2014
mount.nfs: trying text-based options 'vers=4,addr=192.168.1.1,clientaddr=192.168.1.117'
mount.nfs: mount(2): Protocol not supported
mount.nfs: trying text-based options 'addr=192.168.1.1'
mount.nfs: prog 100003, trying vers=3, prot=6
mount.nfs: trying 192.168.1.1 prog 100003 vers 3 prot TCP port 2049
mount.nfs: prog 100005, trying vers=3, prot=17
mount.nfs: trying 192.168.1.1 prog 100005 vers 3 prot UDP port 2049
And with various fstab lines:
# router NAS mounting
router:/mnt /home/kyle/NAS nfs auto 0 0
#router:/mnt /home/kyle/NAS nfs rsize=8192,wsize=8192,timeo=14,intr,_netdev,nfsvers=3 0 0
But the folder always ends up as:
drwxr-xr-x 10 root root 16384 Dec 31 1969 NAS
What do I need to do to make the NFS share writable from the client side?
|
You cannot change permissions on this mount:
/dev/sda3 on /tmp/mnt type vfat rw,noatime,fmask=0022,dmask=0022,codepage=cp437,iocharset=iso8859-1)
Notice the type is VFAT. You can only change permissions using chmod on EXT type permissions, or ones that actually support it.
You can either reformat it as EXT4, mkfs.ext4, or using something like Samba to provide access to it the underlying /tmp/mnt.
| NFS Ownership/Permissions |
1,298,651,148,000 |
I have a D-Link DI-624 rev. D2 Router. It is based around an Atheros AR2316A-001 chipset, and has 8MB RAM.
I opened the device to check for actual parts use in it, and I can confirm, it is indeed the AR2316A-001 chipset with PSC A2V64S40CTP (8MB RAM). I couldn't locate the flash chip, the original firmware is 1MB in size, I don't know if anything larger can be loaded onto the device.
I was wondering, If I could load OpenWrt on it, so I compiled OpenWrt with the AR231x chipset as Target. Now, the compile process yielded those squashfs images:
openwrt-atheros-np25g-squashfs.bin
openwrt-atheros-ubnt2-pico2-squashfs.bin
openwrt-atheros-ubnt2-squashfs.bin
openwrt-atheros-ubnt5-squashfs.bin
openwrt-atheros-wpe53g-squashfs.bin
All those files are around 2.4MB to 2.5MB in size, which is far more, than the firmware available from D-Link (di624revD_firmware_404.bin is around 1MB). I was wondering which file I should try to upload if any.
On the DD-WRT page for supported devices this router is listed, revision C, which uses the same chipset.
The DI-624 has an interesting emergency feature comparable to other D-Link products, like the DIR-600: When holding down the reset button while connecting power to the device, the router goes into an emergency restore mode. Then, when going to 192.168.0.1 with a browser, you can upload another firmware, no matter how badly bricked the router is.
In case anyone succeeded with flashing an alternative OS onto a DI-624, I'd very much like to know how. There was some guy at the OpenWrt forums that claimed he could boot Linux on the DI-624, but he didn't really explain how he did it.
I wasn't sure whether this question belongs here or electronics.SE
|
Until you determine, what type and size of Flash ROM is used in the device, you should not risk flashing it with anything other than dedicated firmware. Atheros chipsets are very common across a wide range of wireless devices and the sole fact of using a particular chip does not guarantee that the entire device will work correctly with your firmware. The chipset is like a coputer CPU + some peripherals, but not necessarily all. And the system storage must be supported.
Edit: If you'd read carefully, you'd see that the page you linked to presents a list of incompatible devices. Since DI-624 is listed there, it is definitely not supported by dd-wrt. This makes it almost certain, that your custom OpenWrt image would not work either.
| D-Link DI-624 H/W ver. D: Flashing OpenWrt |
1,298,651,148,000 |
I have an HP OfficeJet 8600 printer in my office that's around 10 years old but still works perfectly fine. I occasionally use this printer to scan to a samba share hosted on my DD-WRT router. I recently upgraded the software on the router, and I'm redoing everything to make sure it's all up to date and secure as I sometimes scan sensitive documents. The router/network is well secured, but better safe than sorry.
Problem is, this printer never received updates to it's samba client or TLS. TLS isn't a big deal as it's only used for the web interface and I can easily override the minimum version in Firefox. The issue is the samba client -- it's using an old version. What would be the best solution to this problem? edit: it's SMBv1. oof.
I thought of two possible solutions but I would like to ask the community if they have a better solution. I will note that I have a Gentoo server in my house as well as the DD-WRT router.
set up a VM on my server (Alpine probably), that hosts the insecure samba. after scanning it will then automatically move the scanned files to my secure samba share.
is there a way to set the minimum samba version per-user? if so I could create a specific user and share for the printer that uses this login with the old samba version. after scanning it will again move the files to my secure share.
I assume option 1 would be the most secure, but all other suggestions are appreciated. Thanks!
It's a shame that HP didn't support this printer, it's really nice and has served me well for 10 years. Well, what can you do ¯\_(ツ)_/¯
|
I ended up going with the VM route, though I did it a little bit differently than stated. I set up Samba on the VM to allow SMBv1 connections, but limited the IPs that can connect. In my router I set static leases and importantly set the expiration to infinity (aka blank in dd-wrt). This is so that even if someone wanted to try to access the share, they will be unable to unless they spoof the MAC (very very unlikely on a home network).
| Printer stuck on insecure Samba version |
1,298,651,148,000 |
I am trying to configure a secondary network for my IOT stuff. I want to allow only a few device internet access and the rest should be "jailed" to that network. Also, all devices on the IOT network should be able to access my MQTT server that is on my main network.
My setup is as follows:
Firmware: DD-WRT v3.0-r34015M kongac (12/09/17) - More recent versions give me a lot of trouble with wireless connectivity. Wifi keeps dropping off after 10 minutes and the only way to fix it is to restart the router.
Hardware: Netgear R7000
My network is configured such that:
Under Wireless -> Basic Settings:
I've added a VAP
Network Config: Bridged
AP Isolation: Disable
Under Setup -> VLANs
Port 2 = VLAN15 (no bridge assignment)
Under Setup -> Networking
Added new bridge (br2)
Assigned wl02 and vlan15 to br2
Assigned 192.168.7.0/24 to br2
Added DHCP server for br2
Under Setup -> Advanced Routing
Added a route from 192.168.1.0/24 to 192.168.7.0/24 via br2
If I do not add any firewall rules, I am able to access devices on my IOT network from main network and, if I were to connect to my IOT network, I can browse the web.
After doing some searching, I added theses firewall rules (it seems like dd-wrt is always prepending the rules, so DROP needs to be entered first):
iptables -I FORWARD -i br2 -j DROP
iptables -I FORWARD -i br2 -o br0 -d 192.168.1.38 -p tcp --dport 1883 -m state --state NEW -j ACCEPT
iptables -I FORWARD -i br0 -o br2 -m state --state NEW -j ACCEPT
As a result,
IOT -> Internet = DENIED
Main -> IOT = DENIED
IOT -> 192.168.1.38:1883 = DENIED
I am sure that I am missing something with iptables, but not sure what.
Also, is it safe to assume that adding:
iptables -I FORWARD -i br2 -o br0 -s 192.168.7.5 -m state --state NEW -j ACCEPT
will allow 192.168.7.5 access the internet?
Any guidance is greatly appreciated.
Update:
Output of requested commands (with redacted WAN IP):
root@DD-WRT:~# ip -br link
root@DD-WRT:~# ip -4 -br address
root@DD-WRT:~# ip route
default via 73.70.220.1 dev vlan2
X.X.X.X/23 dev vlan2 proto kernel scope link src X.X.X.X
127.0.0.0/8 dev lo scope link
169.254.0.0/16 dev br0 proto kernel scope link src 169.254.255.1
172.16.0.0/24 via 172.16.0.1 dev vlan3
172.16.0.0/24 dev vlan3 proto kernel scope link src 172.16.0.3
192.168.1.0/24 via 192.168.1.1 dev br0 scope link
192.168.1.0/24 dev br0 proto kernel scope link src 192.168.1.1
192.168.7.0/24 via 192.168.7.1 dev br2 scope link
192.168.7.0/24 dev br2 proto kernel scope link src 192.168.7.1
192.168.15.0/24 dev br1 proto kernel scope link src 192.168.15.1
root@DD-WRT:~# ip rule
0: from all lookup local
32766: from all lookup main
32767: from all lookup default
|
First thing: -I means insert at the head, ie prepend. Use -A to append at the end. -A might not actually work as expected if you don't also look at other iptables rules that might have been already put before. So let's keep using -I but with a incremented line number after to choose where to insert and have the rules in the usual order.
Your problem is about handling stateful rules. A conntrack flow is NEW with the first packet. Any reply packet won't be new, but will start the ESTABLISHED state. Your rules only allow NEW states so nothing can work correctly.
Not knowing all the other rules or network settings will lead to probable suboptimal/duplicate rules in this answer, but it should work anyway.
First add generic rules that will allow reply as well as related (eg: for udp errors with icmp or for helper modules like for ftp data) packets, one rule per direction. Those rules won't allow traffic alone because a new flow is always NEW (so not ESTABLISHED or RELATED) by definition. So you will only have to care about NEW states (-m conntrack --ctstate superseded -m state --state so you should rather use it if available, else juste replace all those strings back to -m state --state):
iptables -I FORWARD 1 -i br2 -o br0 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
iptables -I FORWARD 2 -i br0 -o br2 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
Now you can deal with (only) the new flows:
Note that the previous rule and the next rule could be combined in only one rule with all 3 states, or no state check at all since that will always be one of those 3 states (ok, beside INVALID)
iptables -I FORWARD 3 -i br0 -o br2 -m conntrack --ctstate NEW -j ACCEPT
iptables -I FORWARD 4 -i br2 -o br0 -d 192.168.1.38 -p tcp --dport 1883 -m conntrack --ctstate NEW -j ACCEPT
iptables -I FORWARD 5 -i br2 -j DROP
For your last question, I doubt what you wrote would allow Internet access, because internet might probably not be available on br0's interface. It would be available on the interface that has the public IP. This should work without knowing which interface it is, simply by not stating it (run after the previous commands, or reorder numbers accordingly. iptables-save and iptables-restore are your friends):
iptables -I FORWARD 5 -o br2 -d 192.168.7.5 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
iptables -I FORWARD 6 -i br2 -s 192.168.7.5 -m conntrack --ctstate NEW -j ACCEPT
But those missing informations added in the question would have helped for sure: ip -br link; ip -4 -br address; ip route; ip rule (and possibly iptables-save). Then rules could probably be made more generic still without lowering security.
UPDATE: mac match to match a MAC address.
It's possible to match a mac address instead of an IP. This information can only be used as source and makes sense only in the correct network. So -o br2 can't be used to match the MAC. Let's just replace the rule 5 above with a more generic one (which is still ok for security). Using -R to replace the rules 5 and 6 above, please adjust (again: iptables-save is handy):
iptables -R FORWARD 5 -o br2 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
iptables -R FORWARD 6 -i br2 -m mac --mac-source 02:03:04:05:06:07 -m conntrack --ctstate NEW -j ACCEPT
And in the end you get:
iptables -I FORWARD 1 -i br2 -o br0 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
iptables -I FORWARD 2 -i br0 -o br2 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
iptables -I FORWARD 3 -i br0 -o br2 -m conntrack --ctstate NEW -j ACCEPT
iptables -I FORWARD 4 -d 192.168.1.38/32 -i br2 -o br0 -p tcp -m tcp --dport 1883 -m conntrack --ctstate NEW -j ACCEPT
iptables -I FORWARD 5 -o br2 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
iptables -I FORWARD 6 -i br2 -m mac --mac-source 02:03:04:05:06:07 -m conntrack --ctstate NEW -j ACCEPT
iptables -I FORWARD 7 -i br2 -j DROP
Fifth one is a superset of 2nd one only because there should probably be the WAN interface added in the rule but I don't know it.
| dd-wrt: prevent VAP from accessing the internet |
1,298,651,148,000 |
I recently installed DD-WRT on my Netgear R7000 router and want to log DNS queries. So far without much luck.
I'm running DD-WRT v24-sp2 kongac, build 23900M.
syslogd is running and currently writing to /var/log/messages. I also have the firewall logging to the same directory which is working.
I have DHCP and DNSMasq enabled with log-queries as an additional option, but nothing extra is being written to syslog.
The options set in /tmp/dnsmasq.conf are currently set to:
interface=br0
resolv-file=/tmp/resolv.dnsmasq
all-servers
domain=<my domain>
dhcp-leasefile=/tmp/dnsmasq.leases
dhcp-lease-max=57
dhcp-option=lan,3,192.168.1.254
dhcp-authoritative
dhcp-range=lan,192.168.1.100,192.168.1.149,255.255.255.0,1440m
dhcp-host=<host 1>
...
...
stop-dns-rebind
log-queries
Using tcpdump I can see DNS queries being made, but nothing is being logged.
Any pointers will be much appreciated.
|
After some searching and digging, I found that dnsmasq logging was disabled on the firmware image I was using. (source: https://www.dd-wrt.com/phpBB2/viewtopic.php?p=649213)
I upgraded the firmware to 24760M and logging worked.
| DD-WRT DNSMasq logging help |
1,298,651,148,000 |
I bought TL-WR1043ND and flashed it with DD-WRT. Now Im wondering if it's possible to use physical WAN port and wireless client WAN for internet usage and at the same time broadcast SSID for wired and wireless clients to share files?
Here's a quick mockup in Paint:
Network map made in paint http://hostogo.com/image-1EF8_4E70E961.jpg
|
As far as I know, you can't use the wifi as AP and client at the same time, but you can use one usb wifi as client for 2nd WAN link.
| Can I use 2 WANs on DD-WRT? |
1,298,651,148,000 |
Why can't I add any iptables rule?
root@ROUTER:~# iptables -L INPUT -v
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
6934 685K ACCEPT 0 -- any any anywhere anywhere state RELATED,ESTABLISHED
0 0 DROP udp -- ppp0 any anywhere anywhere udp dpt:route
0 0 DROP udp -- br0 any anywhere anywhere udp dpt:route
0 0 ACCEPT udp -- any any anywhere anywhere udp dpt:route
2 120 logaccept tcp -- any any anywhere ROUTER tcp dpt:22
0 0 DROP icmp -- ppp0 any anywhere anywhere
0 0 DROP igmp -- any any anywhere anywhere
5 350 ACCEPT 0 -- lo any anywhere anywhere state NEW
568 35947 logaccept 0 -- br0 any anywhere anywhere state NEW
339 38020 DROP 0 -- any any anywhere anywhere
Then I try to add a rule:
root@ROUTER:~# /usr/sbin/iptables -I INPUT -i ppp0 -m multiport --dport 21,22,23,53,67,80,443 -j DROP
But it didn't got added to the list:
root@ROUTER:~# iptables -L INPUT -v
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
6992 690K ACCEPT 0 -- any any anywhere anywhere state RELATED,ESTABLISHED
0 0 DROP udp -- ppp0 any anywhere anywhere udp dpt:route
0 0 DROP udp -- br0 any anywhere anywhere udp dpt:route
0 0 ACCEPT udp -- any any anywhere anywhere udp dpt:route
2 120 logaccept tcp -- any any anywhere ROUTER tcp dpt:22
0 0 DROP icmp -- ppp0 any anywhere anywhere
0 0 DROP igmp -- any any anywhere anywhere
5 350 ACCEPT 0 -- lo any anywhere anywhere state NEW
569 36007 logaccept 0 -- br0 any anywhere anywhere state NEW
343 38428 DROP 0 -- any any anywhere anywhere
I try to add a rule again:
root@ROUTER:~# /usr/sbin/iptables -I INPUT -i ppp0 --dport 21 -j DROP
And see if there is any changes:
root@ROUTER:~# iptables -L INPUT -v
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
7142 704K ACCEPT 0 -- any any anywhere anywhere state RELATED,ESTABLISHED
0 0 DROP udp -- ppp0 any anywhere anywhere udp dpt:route
0 0 DROP udp -- br0 any anywhere anywhere udp dpt:route
0 0 ACCEPT udp -- any any anywhere anywhere udp dpt:route
2 120 logaccept tcp -- any any anywhere ROUTER tcp dpt:22
0 0 DROP icmp -- ppp0 any anywhere anywhere
0 0 DROP igmp -- any any anywhere anywhere
5 350 ACCEPT 0 -- lo any anywhere anywhere state NEW
574 36309 logaccept 0 -- br0 any anywhere anywhere state NEW
346 38780 DROP 0 -- any any anywhere anywhere
But there isn't.. :D
Version information:
root@ROUTER:~# iptables -V
iptables v1.3.7
WHY?
Firmware: DD-WRT v24-sp2 (08/07/10) std
|
iptables -I INPUT -i ppp0 --dport 21 -j DROP is syntactically wrong (it lacks of protocol specification), therefore we can assume it just silently fails. This one is correct:
iptables -I INPUT -i ppp0 --dport 21 -j DROP -p tcp
so give it a try instead.
| Why can't I add any iptables rule? |
1,298,651,148,000 |
I am wanting to run some scripts which include iptables rules from Apache (running on port 81 on dd-wrt). I can't seem to get these to work because I lack the permissions. I'm hoping someone can point me at something I missed which does not require recompiling Apache.
I am running dd-wrt v3.0-r33525M kongac (10/16/17). I am running an instance of Apache on port 81.
I can't run Apache as root, because there appear to be compile directives/defaults preventing this behavior.
I can't run the scripts SUID (well, I can, but the SUID bit is being ignored because they are scripts).
I could be wrong, but the version of Busybox does not appear to have sudo functionality.
I can run the script from within the GUI running on port 80, but I would really like to build my own simple interface rather then giving more people access to this and having to run commands rather then just click on a link.
I expect I could do something with cron, but that I expect this will require cron to poll for a file, causing a delay which I would really like to avoid. Likewise I postulate I might be able to ssh to localhost and escalate my privs that way, but it would seem insecure and a lot of work.
|
As your system is restricted, there are probably few security implications in simply making the iptables binary setuid root. I don't know dd-wrt but the Linux equivalent would be, as root:
chmod u+s /sbin/iptables
assuming the file belongs to root. If the system supports capabilities, a more secure option might be to set the required capabilities:
setcap CAP_NET_ADMIN,CAP_NET_RAW+ep /sbin/iptables
(more might be needed).
As you said in your comment, since the binary is on a read-only filesystem, you need to use a copy of the file.
| How to run cgi as root in dd-wrt from apache |
1,298,651,148,000 |
I am currenttly refining the Firewall Rules on my DD-WRT Router.
Specifically my question is about this Rule:
iptables -I INPUT -i eth1.10 -d ! 192.168.10.0/28 -j DROP
I was wondering if it was possible to somehow enforce the Rule on an Interface level, so that the interface would only respond on an ICMP Request directly to the eth1.10 (192.168.10.1/28) interface. Without this Rule, eth1 (192.168.1.1/24) is also pingable via eth1.10, which is a security flaw in my eyes.
Edit for Clarifications: The Router is routing between these two subnets. I split the four Ports up on the back of the Router so i can plug my Server into Port 4 of the Router. I then associated Port 4 with eth1.10, eth1 is connected to the other 3 Ports, which are for LAN use. I want to completely isolate the network 192.168.1.0 from 192.168.10.0...
# SwitchPort Setup script
swconfig dev switch0 set enable_vlan 1
swconfig dev switch0 vlan 1 set ports "2 3 4 6"
swconfig dev switch0 vlan 10 set ports "1 6t"
swconfig dev switch0 set apply
vconfig add eth1 10
ifconfig eth1.10 192.168.10.1 netmask 255.255.255.240
|
(I admit I don't understand all the switch settings but that's not relevant to the question.)
Your current rule, in filter/INPUT prevents packets from eth1.10 to reach router's owned IPs other than 192.168.10.0/28, so it indeed has the intended effect of not allowing IPs coming from eth1.10 to access 192.168.1.1.
Why is it needed?
That's because a Linux system with multiple interfaces will consider its IPs as a pool and can use any of its IPs on any of its interfaces. There's no routing (forwarding) involved here. The only method I know of to deal with this is with iptables' filter/INPUT.
How to avoid having to specify IPs in this rule to keep it somewhat generic?
There is a specific iptables-extensions match that can do the trick, but it has to be used twice, within an additional chain for logic glue: addrtype with and without its --limit-iface-in option. So you can replace your rule and have a rule depending on the interface's name only:
iptables -N dropotherlocalips
iptables -A dropotherlocalips -i eth1.10 -m addrtype --dst-type LOCAL --limit-iface-in -j RETURN
iptables -A dropotherlocalips -i eth1.10 -m addrtype --dst-type LOCAL -j DROP
iptables -I INPUT -j dropotherlocalips
The first rule matches a local IP on the same interface only and returns (ie does nothing). The second rule drops any local IP, thus in the end drops local IPs not on the same interface.
Note that if you want this rule to be more generic and work on any side, you can just remove -i eth1.10 in dropotherlocalips:
iptables -A dropotherlocalips -m addrtype --dst-type LOCAL --limit-iface-in -j RETURN
iptables -A dropotherlocalips -m addrtype --dst-type LOCAL -j DROP
this would then in addition prevent eth1's side to ping 192.168.10.1.
I want to completely isolate the network 192.168.1.0 from
192.168.10.0...
You have to (but you already did, didn't you?) also add a filter/FORWARD rule for this, like:
iptables -I FORWARD -i eth1.10 -d 192.168.1.0/24 -j DROP
I don't see here how to avoid stating a LAN in the rule, unless eth1.10 is barred any destination, but then it wouldn't have to be routed at all. Or FORWARD can have a DROP policy and be only allowed routing/forwarding explictly written in rules.
With those rules, 192.168.1.0/24 is completely unavailable at the IP level from eth1.10, including 192.168.1.1.
EXTRA, to be nitpicking: ARP can still let the existence of 192.168.1.1 be known from eth1.10's LAN.
The rules above won't prevent an host behind eth1.10 to know (eg by brute-force scanning) the existence of 192.168.1.1 by way of ARP which is not filtered by iptables. That's still because of Linux considering all its IPs as a pool even when answering ARP (explanation in the default arp_filter setting, but see also below arp_announce and arp_ignore). So using arping from a Linux system in 192.168.10.0/28 (arriving on router's eth1.10) with interface eno1 (please adjust name):
$ ping -c2 192.168.1.1
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
--- 192.168.1.1 ping statistics ---
2 packets transmitted, 0 received, 100% packet loss, time 10ms
$ ip neighbour
192.168.10.1 dev eno1 lladdr b6:f2:aa:82:21:d4 REACHABLE
$ arping -c2 -I eno1 192.168.1.1
ARPING 192.168.1.1 from 192.168.10.10 eno1
Unicast reply from 192.168.1.1 [B6:F2:AA:82:21:D4] 0.552ms
Unicast reply from 192.168.1.1 [B6:F2:AA:82:21:D4] 0.552ms
Sent 2 probes (1 broadcast(s))
$
Since the MAC address is the same, that means 192.168.1.1 is on 192.168.10.1's host: the router.
The minimal setting to avoid this (when there isn't a complex routing configuration requiring arp_filter) would be on the router:
echo 1 > /proc/sys/net/ipv4/conf/eth1.10/arp_ignore=1
(or sysctl -w net.ipv4.conf.eth1/10.arp_ignore=1)
That is from arp_ignore:
1 - reply only if the target IP address is local address configured on the incoming interface
You could alternately use arp_filter=1 (which would be worth only if you're already using ip rule and additional tables, because you'd probably have to anyway) or even filter ARP requests with arptables to prevent this.
| Block ping to interface in different subnet |
1,298,651,148,000 |
So i've seen the WOL scripts and they seem like they could work well when i'm trying to connect from a computer that is outside my router.
Script i'm using:
http://www.dd-wrt.com/wiki/index.php/Useful_Scripts#Web_Server_Wake-up
Now the problem that i see is that when ever i'm home the WOL script will be useless because the initiating computer and the server are on the same subnet so the router will not log the request.
Is there a way to have the router log the requests that are sent between two computers inside its network? I'm not very knowledgeable when it comes to network structure but i don't know if this is possible. Do i need to somehow proxy all my traffic through my router?
For explanation here is what i'm trying to do:
I have my home server that serves up SMB, AFP, HTTP(s), and a few other web applications. I would like the server to be sleeping when its not being accessed period. So if something outside the network requests HTTP access i want the server to wake up. If a computer on the local subnet requests a SMB share i want the server to wake up.
Things to note:
I have an Ubuntu server.
All machines that are on the local network are directly connected to the router. I have one hub that some machines are connected to but all traffic should be going through the router.
EDIT: Just had a thought. What if i put the server in question on a separate VLAN and allowed for communication between the VLAN through the router. Then the traffic would have to go through the firewall and i could log the traffic there. Would anyone know how to set up such a system?
|
Solved it by moving the server in question to a dedicated VLAN and then logging the traffic between it and the rest of the network by using specific iptable rules triggered on some ports.
I will have a full writeup on my site when i finish the project and will update this answer then.
| Use DD-WRT to auto WOL when traffic is on same subnet |
1,298,651,148,000 |
I'm planning on getting a D-Link DIR-600 to be used as a WLAN access point, and for WEP/WPA certificate management.
I know it works with DD-WRT, and OpenWRT, but not Tomato. Now, I've been looking what firmware I can put on that device, prior to getting it. Tomato is my favorite option, but since it doesn't work with the router, I'm getting second thoughts about getting it at all.
If you happen to have a better suggestion for a router, please do so, but I'd like to stay in the same price range as the DIR-600 (around 25€).
|
DD-WRT and OpenWRT are your two best bets for the D-600. They can do most o fwhat Tomato can do, so unless you need something specific to Tomato, this router should be fine.
| What firmware works with a D-Link DIR-600? |
1,460,253,961,000 |
I have been trying to create a bootable debian (jessie/8.4) image for the past 2 days, and as far as I can tell I have the procedure right, but I can not get the filesystem right. I am relatively sure that I am doing something wrong here, missing something with mounting or /etc/fstab (there isn't one in my image). I was hoping someone with some experience would be able to help me out/show me what I am missing.
Here are the errors I see as I'm booting into qemu-system-x86:
As text and then as the actual screenshots:
Errors:
fsck: error 2 (No such file or directory) while executing fsck.ext2 for /dev/sda1
fsck exited with status code 8
[FAILED] Failed to start Load/Save Random Seed
See `systemctl status systemd-random-seed.service` for details.
[FAILED] Failed to start Various fixups to make systemd work better on Debian.
See `systemctl status debian-fixup.service` for details.
...
[FAILED] Failed to start Update UTMP about System Boot/Shutdown.
See `systemctl status systemd-update-utmp.service` for details.
[DEPEND] Dependency failed for Update UTMP about System Runlevel Changes.
Here are the instructions I've written up for myself / steps I've taken:
cd ~
mkdir debootstrap
cd debootstrap/
# get newest
wget http://ftp.debian.org/debian/pool/main/d/debootstrap/debootstrap_1.0.80_all.deb
ar -x debootstrap_1.0.80_all.deb
zcat /root/debootstrap/data.tar.gz | tar xv
apt-get install parted
# 1.5Gbytes
dd if=/dev/zero of=1445.img bs=1024 count=1 seek=1536k
parted -s 1445.img -- mklabel msdos mkpart primary 1m 1.5g toggle 1 boot
losetup --show -f 1445.img
# prints out `/dev/loopX`, enter this on the next lin
partprobe /dev/loop0
# only have to make the filesytem once --> if you are troubleshooting steps, do not redo this line
mkfs -t ext2 /dev/loop0p1
mount /dev/loop0p1 /mnt
debootstrap --verbose --components=main,contrib,non-free \
--include=firmware-realtek,linux-image-amd64,grub-pc,ssh,vim \
--exclude=nano \
--arch amd64 jessie /mnt http://ftp.us.debian.org/debian
source for information on using --components
Ensure that the kernel is installed, it should appear in /boot within the chroot, that is /mnt/boot with the following files:
initrd.img-3.16.0-4-amd64
vmlinuz-3.16.0-4-amd64
config-3.16.0-4-amd64
System.map-3.16.0-4-amd64
install grub
grub-install --boot-directory=/mnt/boot --modules=part_msdos /dev/loop0
Set up APT
copy over the apt sources
cp /etc/apt/sources.list /mnt/etc/apt/sources.list
ensure the cdrom source is commented out
add the line:
deb http://ftp.debian.org/debian stable-backports main contrib non-free
Setup a chroot
mount --bind /dev/pts /mnt/dev/pts
mount --bind /proc /mnt/proc
mount --bind /sys /mnt/sys
mount --bind /dev /mnt/dev
# if you want your pushprofilesettings
cp ~/.bashrc /mnt/root/
cp ~/.vimrc /mnt/root/
# chroot -- enter the system as if it were thy own
chroot /mnt /bin/bash
export HOME=/root
export LC_ALL=C
export LANG=C.UTF-8
export TERM=xterm-256color
mount from man mount:
--bind Remount a subtree somewhere else (its contents are available in both places).
-t <type> Mount of filesystem type, with this, mount will attempt to auto determine
setup serial/console access
edit /etc/default/grub:
Set GRUB_CMDLINE_LINUX="" to:
GRUB_CMDLINE_LINUX="console=tty0 console=ttyS0,115200n8"
Uncomment GRUB_TERMINAL=console
Beneath, add the line:
GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1"
Make the grub config - This MUST be done in a non-systemd-nspawn shell (that means chroot)
grub-mkconfig -o /boot/grub/grub.cfg
Exit chroot
exit
Clean up for chroot'ed
umount /mnt/sys
umount /mnt/dev
umount /mnt/dev/pts
umount /mnt/proc
Can check for additional mounts with: mount | grep /mnt and then unmount them with umount
Enter systemd-nspawn
systemd-nspawn -D /mnt
# not you are in a special container
Set the password for root with passwd
In /etc/ssh/sshd_config comment out PermitRootLogin without-password to read #PermitRootLogin without-password and insert PermitRootLogin yes beneath it
Now enable ssh on startup
systemctl enable ssh
clean up
# this is needed to clean up both chroot and systemd-nspawn -D /mnt
# once this is run you can not do systemd-nspawn either so wait until you are entirely done
exit
umount /mnt
losetup -d /dev/loop0
Check for additional mounts with: mount | grep /mnt If ANYTHING is returned, unmount them with umount
Recover (only necessary in ERROR)
If you broke something, or need to retry, RE-MOUNT / SETUP CHROOT on existing .img:
losetup --show -f 1445.img
# prints out `/dev/loopX`, enter this on the next lin
partprobe /dev/loop0
mount /dev/loop0p1 /mnt
testing img
qemu-system-x86_64 -hda 1445.img -m 1024 -vnc :0
|
Kept at it and figured it out, relatively straight forward from here, but not just a matter of setting up /etc/fstab, here is the rest:
not necessary but a good idea to clean things up
apt-get autoclean
set up /etc/fstab - check with mount to ensure you are on the right filesystem type
echo "/dev/sda1 / ext4 defaults,errors=remount-ro 0 1" > /etc/fstab
this will rebuild the initramfs and allow it to boot clean
update-initramfs -u -k all
Do that and the machine boots clean, tested in QEMU and then I am running it right now on hardware.
| Creating bootable Debian image with debootstrap |
1,460,253,961,000 |
In the past years I used debootstrap to install my desktop Debian (daily usage) and I'm planning to use it once again, but until now I just used debootstrap default options, this time instead I'd like to install a minimal system.
I did some search but so far found nothing I didn't already knew, most articles say bare minimal but then they just use default options too, instead I'd like to know if there are exclude options to trim it down and still get a working system.
I plan to look into debootstrap but thought to ask here before, maybe somebody already did or know about and may save me some time.
edit
A minimal Debian is composed by the packages with priority required and important
dpkg-query -f '${binary:Package} ${Priority}\n' -W \
| grep -w 'required\|important'
The minbase option still install some extra, optional, standard, but very few, eventually some of those and some important could be removed (or not installed at all, I think --exclude should work but haven't checked)
The shell deboostrap's sub-script for sid is /usr/share/debootstrap/scripts/sid, easy to (backup and) customize.
After the installation a lot of disk space is taken from downloaded .deb, apt-get clean, apt-get autoclean should free some.
Some space is taken from locales, docs, man pages, dpkg-reconfigure locales and the package localepurge should help.
|
I use the option --variant=minbase which seems to be fairly minimal (about 150MB).
No text editor, but essential GNU tools, package manager, and networking functionnalities with iproute2.
| the most minimal Debian/sid installed with debootstrap? |
1,460,253,961,000 |
If I run debootstrap in with sudo I get the following output:
I: Retrieving InRelease
I: Failed to retrieve InRelease
I: Retrieving Release
E: Failed getting release file http://de.archive.ubuntu.com/ubuntu/dists/xenial/Release
If I run the command directly as root, all seems well and the chroot will be built perfectly.
On my local machine I'm also able to build the chroot with sudo. The difference is the configured proxy. I guess that debootstrap doesn't use the proxy if I run it with sudo?
|
sudo sets up only a limited environment and you might for instance miss the http_proxy env variable that gets initiated by your login shell.
You might try to run sudo with the -i option as that will simulate a login session which might load a more complete environment that includes proxy settings or modify /etc/sudoers to stop suppressing the proxy environment vars with :
#/etc/sudoers
Defaults env_keep += "http_proxy https_proxy ftp_proxy"
| Failed getting release file while running debootstrap with sudo |
1,460,253,961,000 |
I want to download Debian system using debootstrap (creating chroot environment) and when I run debootstrap stable ./dir $debian_ftp, debootstrap says:
E: debootstrap can only run as root
Why can't debootstrap be run without root permissions?
|
You need to be able to create a chroot when you use debootstrap. Plus if you plan on partitioning, or doing any mounts, etc. you will need root permissions.
If you check out the debootstrap manpage you should be able to use debootstrap with the --variant=fakechroot option to use fakechroot, which installs the packages without root privileges. An example in your case would be something along the lines of this:
debootstrap --variant=fakechroot stable ./dir $debian_ftp
Please read the Wiki for more information on how to use debootstrap.
| Why debootstrap can only run as root? |
1,460,253,961,000 |
I'm working on a script to create a fully encrypted washable system from debootstrap. It's doing some good, but the initramfs image that comes out does not pick up the cryptroot properly. After booting the image with qemu, I'm dropped to a busybox shell and I have to unlock the luks encryption manually with cryptsetup:
cryptsetup luksOpen /dev/sda1 system
/scripts/local-premount/flashback
exit
(flashback does some btrfs snapshoting magic to forget changes made on every boot)
After this, boot in qemu continues normally and I am then able to generate a good initramfs image. I copy this to the btrfs @root.base subvolume and all is well from then on.
I need help with figuring out why the cryptsetup/cryptroot part is not being picked up in the chroot environment by update-initramfs:
echo "CRYPTSETUP=y" >> /usr/share/initramfs-tools/conf-hooks.d/cryptsetup
echo "export CRYPTSETUP=y" >> /usr/share/initramfs-tools/conf-hooks.d/cryptsetup
update-initramfs -ut
I have tried many things, I write a good fstab and crypttab and even tried to explicitly set cryptdevice in grub.cfg. Refer to the specific version of the script.
Here's how I create the fstab and crypttab:
export partuuid=$(blkid $partition | sed -re 's/.*: UUID="([^"]+)".*/\1/')
export decruuid=$(blkid /dev/mapper/$decrypted | sed -re 's/.*: UUID="([^"]+)".*/\1/')
echo "Adding flashback with uuid $partuuid"
echo "system UUID=$partuuid none luks" >> "$rootmount/etc/crypttab"
echo "UUID=$decruuid / btrfs [email protected] 0 0" >> "$rootmount/etc/fstab"
echo "UUID=$decruuid /home btrfs subvol=@home 0 0" >> "$rootmount/etc/fstab"
The question in principle is: How do you generate a functioning initramfs image in an encrypted chroot of a debootstrapped debian?
Thanks a bunch
|
Using /etc/initramfs-tools/conf.d/cryptsetup is deprecated in stretch.
The new preferred method is to set "CRYPTSETUP=y" in /etc/cryptsetup-initramfs/conf-hook.
In buster and later, this configuration parameter appears to be redundant, as the default behaviour seems to be to configure cryptsetup in initramfs IFF the initramfs-cryptsetup package is installed.
| Initramfs in debootstrap chroot of fully encrypted system |
1,460,253,961,000 |
The hoster I am using provides a Debian 8.10 (kernel 4.9.85) as a rescue system. In the past I've been using that to bootstrap Ubuntu using debootstrap from here.
I am using a few preparational steps auch as installing apt-cacher-ng which is the reason for the localhost:3142 in the URL I am using (http://localhost:3142/us.archive.ubuntu.com/ubuntu/) and ubuntu-archive-keyring.
The debootstrap invocation is as follows:
LANG=C debootstrap --keep-debootstrap-dir --verbose --include=ubuntu-server,bash-completion,sudo,lshw,tmux,unzip,pciutils,usbutils,openssh-server,unattended-upgrades,linux-image-generic,cron --variant=minbase --arch=$(dpkg --print-architecture) bionic /target http://localhost:3142/us.archive.ubuntu.com/ubuntu/
(I added the --verbose only in the hope to see if anything is going wrong, to no avail.)
Now what's strange about the debootstrap run is that with this new version I end up seeing only the steps Retrieving, Validating and Extracting (for a subset of the packages) but nothing about these packages being set up.
So I thought to myself "alright, I did this with xenial, so let's try that again" and it gives me the same routine.
+ debootstrap --keep-debootstrap-dir --verbose --include=ubuntu-server,bash-completion,sudo,lshw,tmux,unzip,pciutils,usbutils,openssh-server,unattended-upgrades,linux-image-generic,cron --variant=minbase --arch=
amd64 xenial /target http://localhost:3142/us.archive.ubuntu.com/ubuntu/
I: Retrieving InRelease
I: Checking Release signature
I: Valid Release signature (key id 790BC7277767219C42C86F933B4FE6ACC0B21F32)
I: Retrieving Packages
I: Validating Packages
I: Resolving dependencies of required packages...
I: Resolving dependencies of base packages...
I: Found additional base dependencies: acpid apport apt-utils at bcache-tools btrfs-tools busybox-initramfs byobu ca-certificates cloud-guest-utils cloud-initramfs-copymods cloud-initramfs-dyn-netconf cpio crda
cryptsetup cryptsetup-bin curl dh-python distro-info-data dmeventd dmsetup ethtool fonts-ubuntu-font-family-console gawk gcc-5-base gettext-base gir1.2-glib-2.0 git git-man gnupg gpgv grub-legacy-ec2 ifenslave i
fupdown initramfs-tools initramfs-tools-bin initramfs-tools-core iproute2 iso-codes iw klibc-utils kmod libapt-inst2.0 libapt-pkg5.0 libasn1-8-heimdal libasprintf0v5 libbsd0 libcurl3-gnutls libdbus-1-3 libdbus-g
lib-1-2 libdevmapper-event1.02.1 libdrm2 libdumbnet1 libedit2 liberror-perl libevent-2.0-5 libexpat1 libffi6 libfuse2 libgdbm3 libgirepository-1.0-1 libglib2.0-0 libgmp10 libgnutls30 libgpm2 libgssapi-krb5-2 lib
gssapi3-heimdal libhcrypto4-heimdal libheimbase1-heimdal libheimntlm0-heimdal libhogweed4 libhx509-5-heimdal libicu55 libidn11 libk5crypto3 libkeyutils1 libklibc libkrb5-26-heimdal libkrb5-3 libkrb5support0 libl
dap-2.4-2 liblvm2app2.2 liblvm2cmd2.02 liblz4-1 liblzo2-2 libmnl0 libmpdec2 libmpfr4 libmspack0 libnettle6 libnewt0.52 libnl-3-200 libnl-genl-3-200 libp11-kit0 libpci3 libperl5.22 libplymouth4 libpng12-0 libpopt
0 libpython-stdlib libpython2.7-minimal libpython2.7-stdlib libpython3-stdlib libpython3.5-minimal libpython3.5-stdlib libreadline5 libreadline6 libroken18-heimdal librtmp1 libsasl2-2 libsasl2-modules-db libsigs
egv2 libslang2 libsqlite3-0 libssl1.0.0 libstdc++6 libtasn1-6 libusb-0.1-4 libusb-1.0-0 libutempter0 libwind0-heimdal libwrap0 linux-base linux-firmware linux-image-4.4.0-21-generic linux-image-extra-4.4.0-21-ge
neric lsb-release lvm2 mdadm mime-support open-iscsi open-vm-tools openssh-client openssh-sftp-server openssl overlayroot patch perl perl-modules-5.22 plymouth python python-apt-common python-minimal python2.7 p
ython2.7-minimal python3 python3-apport python3-apt python3-chardet python3-dbus python3-debian python3-gi python3-minimal python3-newt python3-pkg-resources python3-problem-report python3-pycurl python3-six pyt
hon3-software-properties python3.5 python3.5-minimal readline-common screen software-properties-common sosreport ubuntu-cloudimage-keyring ubuntu-keyring ucf udev update-notifier-common vim vim-common vim-runtim
e vlan wireless-regdb xfsprogs xz-utils
I: Checking component main on http://localhost:3142/us.archive.ubuntu.com/ubuntu...
I: Retrieving acpid 1:2.0.26-1ubuntu2
I: Validating acpid 1:2.0.26-1ubuntu2
[...]
I: Chosen extractor for .deb packages: dpkg-deb
I: Extracting adduser...
I: Extracting base-files...
I: Extracting base-passwd...
[...]
I: Extracting zlib1g...
The reason this is odd is because in the past the setup stage worked without a hitch. But now it just gets silently skipped?! An older debootstrap version won't do, because those don't know about Bionic Beaver (Ubuntu 18.04).
There were two things I thought could be an issue:
the kernel version discrepancy: 4.15 in Ubuntu 18.04 versus 4.9.85 in Debian 8.10.
the libc version discrepancy: 2.27-3ubuntu1 versus 2.19-18+deb8u10.
... but in either case I'd expect some kind of error message from debootstrap. Also for xenial (Ubuntu 16.04) I shouldn't have to expect the same discrepancies. But I don't see any errors, instead the vital setup step gets skipped and attempting to chroot into /target with command /bin/bash just gives
# LANG=en_US.UTF-8 chroot /target /bin/bash
groups: cannot find name for group ID 0
I have no name!@rescue:/#
Digging a bit turns up no /etc/passwd and so on. /dev, /proc and /sys are bind-mounted into /target.
How can I troubleshoot this issue in order to successfully bootstrap a Ubuntu from said Debian rescue system? The architecture matches host and target, so what's preventing the setup step from being run?
NB: I cannot boot into a more recent kernel. Or rather the only way of achieving something like that would be by installing some kind of local rescue system first.
The software I am using
$ debootstrap --version
debootstrap 1.0.95ubuntu1
$ uname -a
Linux rescue 4.9.85 #2 SMP Thu Mar 1 08:06:18 CET 2018 x86_64 GNU/Linux
I also installed ubuntu-archive-keyring.
What else I tried
I also tried passing --foreign to debootstrap, which should cause the behavior I am seeing, but should also leave an executable /debootstrap/debootstrap which I can then invoke with --second-stage. However, while it exhibits the exact same behavior I am seeing without the --foreign command line switch, there is no /debootstrap/debootstrap in the target file system to complete the bootstrapping.
Furthermore I tried to use debootstrap from jessie-backports by installing it this way: apt-get install -t jessie-backports debootstrap (it identifies as debootstrap 1.0.89~bpo8+1). And then linking /usr/share/debootstrap/scripts/bionic to /usr/share/debootstrap/scripts/gutsy.
|
Alright I figured it out. The invocation of debootstrap did indeed indicate failure by returning an exit code of 1. I missed that because of how I was chaining several commands and using subshells.
Once I had figured that out, I had to find what issue debootstrap was encountering. It wasn't obvious from the /debootstrap/debootstrap.log (inside the target), although in hindsight it is. So I needed introspection on debootstrap. In order to do that invoked the /usr/sbin/debootstrap shell script explicitly via /bin/sh -x (to turn on tracing) and the output can actually be seen inside /debootstrap/debootstrap.log (inside the target). In my case the problem was mknod as shown by this trace entry and the output:
+ mknod -m 666 /target/dev/null c 1 3
mknod: '/target/dev/null': File exists
which in turn was caused by me mounting /dev, /proc and /sys into the target up front (something that had worked in the past!).
In new debootstrap versions this seems to fail unconditionally. The respective function calling mknod is setup_devices_simple from /usr/share/debootstrap/functions.
One notable change I saw from comparing the debootstrap scripts for 1.0.59 and 1.0.89~bpo8+1 (and subsequent versions) was that the invocation of the function setup_devices moved from function second_stage_install into function first_stage_install (of the gutsy script). This function calls setup_devices_simple unless doing variant fakechroot or running on a "foreign" kernel and therefore causes mknod to be invoked quite a bit earlier than before.
The reason why this didn't fail before, it seems, is because in the past the devices where kept inside a .tgz file and unpacked into place, whereas now debootstrap uses mkdnod directly.
| Having a bit of trouble debootstrapping a Ubuntu (18.04) via Debian 8.10 |
1,460,253,961,000 |
I'm trying to use debootstrap to create a Debian Squeeze chroot (from Debian Squeeze (stable)), so I can install some no-longer-supported software. But I get an error:
$ sudo debootstrap --keyring=/usr/share/keyrings/debian-archive-keyring.gpg squeeze /srv/basket/ http://archive.debian.org/debian/
I: Retrieving InRelease
I: Retrieving Release
I: Checking Release signature
E: Release signed by unknown key (key id 64481591B98321F9)
$
The key exists, it's just expired:
$ gpg --search-keys 64481591B98321F9
gpg: data source: https://18.9.60.141:443
(1) Squeeze Stable Release Key <[email protected]>
4096 bit RSA key 64481591B98321F9, created: 2010-08-07, expires: 2017-08-05 (expired)
Keys 1-1 of 1 for "64481591B98321F9". Enter number(s), N)ext, or Q)uit >
I can proceed by turning off gpg checking with --no-check-gpg, but is there a way to tell debootstrap to use the expired key? Or, what is the best way to proceed with as much security as possible?
|
If you give debootstrap the right keyring, it will use the expired key:
sudo debootstrap --keyring=/usr/share/keyrings/debian-archive-removed-keys.gpg squeeze /srv/basket/ http://archive.debian.org/debian/
An expired key can be used to verify signatures made before it expired.
| How can I use an expired key with debootstrap? |
1,460,253,961,000 |
Is there a way to list the packages that debootstrap is going to download? Also, is there a way to tell debootstrap to download a user-specified list of packages?
|
For the first, you use --print-debs, which shows you a list of packages that are going to be downloaded for a specific target. The second, you can use --include/--exclude switches for this task:
--include=alpha,beta
Comma separated list of packages which will be added to download
and extract lists.
--exclude=alpha,beta
Comma separated list of packages which will be removed from
download and extract lists. WARNING: you can and probably will
exclude essential packages, be careful using this option.
Notice that this is akin to "install base plus packages" or "install base minus packages". The base packages are always installed.
| Listing and specifying packages in debootstrap |
1,460,253,961,000 |
From my understanding, the debootstrap program with the minbase option only installs packages with "essential priority" (and possibly apt). Is there a web resource which lists all packages with different priority levels? All I really need is a list for priority levels of essential, required, important, and standard and I do not need optional and extra.
|
I’m not aware of anything giving the information you’re after, on the web. (Arguably it should be added to the package pages.) You can however get the information you’re after by querying the UDD, for example using the unofficial, publicly-accessible UDD mirror:
$ psql --host=udd-mirror.debian.net --user=udd-mirror udd --password
will connect to the server, then
udd=> select distinct package, version, section, priority from packages where essential = 'yes' and release = 'stretch';
will list all essential packages from Stretch (the distinct is useful because binary packages are listed per architecture), and
udd=> select distinct package, version, section, priority, essential from packages where priority in ('required', 'important', 'standard') and release = 'stretch' order by priority, essential, package;
will list all required, important, and standard packages, with the priority information.
There is also a detailed list of all the current contents of minbase, on the Buster priority requalification page.
| List of Debian packages with essential priority |
1,460,253,961,000 |
i want to install a specific version of Ubuntu or Debian, In ubuntu i want to debootstrap the specific version 16.04.0, and i'm using this code:
debootstrap --arch=amd64 --variant=buildd xenial "/home/ubuntu/Documents/myrootfilesystemdir" http://archive.ubuntu.com/ubuntu/
But unfortunately, after finish the debootstrap second stage, the version installed is 16.04.6.
Now in debian, the same situation, i need to install debian stretch 9.0.0, using this code:
debootstrap --arch amd64 --foreign stretch "/home/ubuntu/Documents/myrootfilesystemdir" http://ftp.se.debian.org/debian
And the version after the second stage of bootstrap is 9.9.0.
Exist any way to debootstrap specific version for example:
debootstrap --arch amd64 --foreign stretch --version 9.0.0
Or another alternative to bootstrap to install a specific version when i build a root filesystem?
Or Which configuration file of bootstrap i have to edit to specify the version that i want to install?
Or another alternative to debootstrap package, for build a root filesystems?
Note: I need to work in the initial version releases ej: 9.0.0 in debian and 16.04.0 in ubuntu, to not leave the support for the initial versions, for example if i work in a last release(ubuntu 16.04.6) the support will be incompatible with a the previus versions until the initial version 16.04.0, thats why i need keep a range 16.04.0+ (16.04.0 to 16.04.6).
|
Debian doesn’t maintain old point releases in an installable form in its main archives, and I don’t think Ubuntu does either; a new network-based install of either will install the current point release.
However, at least for Debian, you can use snapshots to install an older point release. See this Super User Q&A for details: you can extract the appropriate timestamp from the Jigdo files of whatever point-release you’re after, and use the result as the archive for debootstrap:
$ wget -q -O - https://cdimage.debian.org/mirror/cdimage/archive/9.0.0/amd64/jigdo-bd/debian-9.0.0-amd64-BD-1.jigdo | gunzip | awk -F= '/snapshot.debian.org/ {print $2}'
http://snapshot.debian.org/archive/debian/20170617T130639Z/
| How to Debootstrap specific version in Ubuntu or Debian? |
1,460,253,961,000 |
From https://manpages.debian.org/wheezy/multistrap/multistrap.1:
--no-auth - allow the use of unauthenticated repositories. Same as noauth=true
What I understand from this definition is that multistrap won't try to authenticate, so unsafe software might be installed.
However it doesn't seem to be the case: Setting noauth=true throws the following error:
Get:1 http://ftp.uk.debian.org/debian buster InRelease [122 kB]
Err:1 http://ftp.uk.debian.org/debian buster InRelease
The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 04EE7237B7D453EC NO_PUBKEY 648ACFD622F3D138 NO_PUBKEY DCC9EFBF77E11517
Reading package lists... Done
W: GPG error: http://ftp.uk.debian.org/debian buster InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 04EE7237B7D453EC NO_PUBKEY 648ACFD622F3D138 NO_PUBKEY DCC9EFBF77E11517
E: The repository 'http://ftp.uk.debian.org/debian buster InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
apt update failed. Exit value: 100
Interesting part is, setting noauth=false fixes the problem.
What does noauth cause exactly?
|
Your understanding is correct. However, there is a bug in multistrap so that it does not correctly configure apt to install packages unauthenticated. A description of the problem and a patch to fix it are available in debian bug report #908451 (https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=908451).
More info on noauth=false (i.e, do authenticate):
The keyring packages need to be installable on the host system. Configure /etc/apt/sources and apt-key of the host accordingly before invoking multistrap.
The keyring debian packages need to install the keys into /usr/share/keyrings/, from where multistrap will copy them to /etc/apt/trusted.gpg.d/ where they are actually used by apt-key. Keyring packages that install their keys only to /etc/apt/trusted.gpg.d/ cannot be used by multistrap.
Specify each keyring package only once, even if the same keyring applies to multiple repositories. Multistrap will otherwise cause an error with an unhelpful error message, at least until debian bug #870166 is fixed.
| What exactly does the "noauth" property mean in multistrap config? |
1,460,253,961,000 |
Does cdebootstrap provide any advantages to debootstrap? What is the difference between the two other than the implementation language?
|
debootstrap and cdebootstrap offer largely similar sets of functionalities; they can install Debian and certain derivatives, in one of three flavours (standard, i.e. a base Debian installation; minimal, i.e. only apt and essential packages; and build-oriented, i.e. build-essential and its dependencies). They both also support foreign installations, i.e. installations with a different architecture than the host architecture (using QEMU for emulation).
The differences are the implementation language, the configuration language, and the supported derivatives (Kali for cdebootstrap, Tanglu for debootstrap; both support Ubuntu). The configuration language is the most significant difference for users; I find the cdebootstrap setup simpler, but the debootstrap setup has the advantage of being more explicit (with full package lists).
| cdebootstrap vs debootstrap: what is the difference? |
1,460,253,961,000 |
I'm using debootstrap to create a rootfs for a device that I want to then write to an image file. To calculate the size needed from my rootfs, I do the following:
local SIZE_NEEDED=$(du -sb $CHROOT_DIR|awk '{print $1}')
SIZE_NEEDED=$(($SIZE_NEEDED / 1048576 + 50)) # in MB + 50 MB space
dd if=/dev/zero of=$ROOTFS_IMAGE bs=1M count=$SIZE_NEEDED
As you can see I'm leaving 50MB of padding beyond what dd calculates I need.
I then create the loopback device, create a partition table and filesystem:
LO_DEVICE=$(losetup --show -f $ROOTFS_IMAGE)
parted $LO_DEVICE mktable msdos mkpart primary ext4 0% 100%
partprobe $LO_DEVICE
local LO_ROOTFS_PARTITION="${LO_DEVICE}p1"
mkfs.ext4 -O ^64bit $LO_ROOTFS_PARTITION
It seems parted attempts to do some sector alignment (?) as the partition doesn't quite take up the whole virtual disk, but close enough.
I then mount the new partition and start writing files. But then I run out of disk space right near the end!
mount $LO_ROOTFS_PARTITION $LO_MOUNT_POINT
cp -rp $CHROOT_DIR/* $LO_MOUNT_POINT
.....
cp: cannot create directory '/root/buildimage/rootfs_mount/var': No space left on device
I suspect this is some block size conversion issue or maybe difference between MiB and MB? Because up to a certain image size, it seems that I have enough headroom with the 50MB of padding. (I want some free space in the image by default, but not a lot.) The image size isn't off by a factor-of-two so there's some creep or overhead that gets magnified as the image size gets larger and I'm not sure where it's coming from.
For context, here's the last one I did that doesn't fit:
# du -sb build/rootfs
489889774 build/rootfs
Ok, 489MB/1024**2 + 50MB = 517MB image size. So dd looked like:
# dd if=/dev/zero of=build/rootfs.img size=1M count=517
517+0 records in
517+0 records out
542113792 bytes (542 MB, 517 MiB) copied, 2.02757 s, 267 MB/s
Confirmed on disk it looks slightly larger:
# du -sb build/rootfs.img
542113792 build/rootfs.img
The partition looks like:
# parted /dev/loop0 print
Model: Loopback device (loopback)
Disk /dev/loop0: 542MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1 1049kB 542MB 541MB primary ext4
and mounted filesystem:
# df -h /dev/loop0p1
Filesystem Size Used Avail Use% Mounted on
/dev/loop0p1 492M 482M 0 100% /root/buildimage/build/rootfs_mount
So maybe there is overhead in the ext4 filesystem, possibly for superblocks/ journal/ etc? How can I account for that in my size calculation?
EDIT:
Looking into ext4 overhead such as this ServerFault question.
Also looking into mkfs.ext4 options such as -m (reserved) and various journaling and inode options. In general if I know there's a 5% overhead coming from the filesystem, I can factor that in easily enough.
EDIT #2:
Thinking that du might be under-reporting actual on-disk size requirements (e.g. a 10-byte file still takes up a 4k block, right?) I tried a few other options:
# du -sb build/rootfs # This is what I was using
489889774 build/rootfs
# du -sm build/rootfs # bigger
527 build/rootfs
# du -sk build/rootfs # bigger-est
539088 build/rootfs
Furthermore, the manpage for -b notes that it's an alias for --apparent-size which can be smaller than "actual disk usage." So that may be (most) of where my math was wrong.
|
Possibly the simplest solution is to heavily overprovision the space initially, copy all the files, then use resize2fs -M to reduce the size to the minimum this utility can manage. Here's an example:
dir=/home/meuh/some/dir
rm -f /tmp/image
size=$(du -sb $dir/ | awk '{print $1*2}')
truncate -s $size /tmp/image
mkfs.ext4 -m 0 -O ^64bit /tmp/image
sudo mount /tmp/image /mnt/loop
sudo chown $USER /mnt/loop
rsync -a $dir/ /mnt/loop
sync
df /mnt/loop
sudo umount /mnt/loop
e2fsck -f /tmp/image
resize2fs -M /tmp/image
newsize=$(e2fsck -n /tmp/image | awk -F/ '/blocks$/{print $NF*1024}')
truncate -s $newsize /tmp/image
sudo mount /tmp/image /mnt/loop
df /mnt/loop
diff -r $dir/ /mnt/loop
sudo umount /mnt/loop
Some excerpts from the output for an example directory:
+ size=13354874
Creating filesystem with 13040 1k blocks and 3264 inodes
+ df /mnt/loop
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/loop1 11599 7124 4215 63% /mnt/loop
+ resize2fs -M /tmp/image
Resizing the filesystem on /tmp/image to 8832 (1k) blocks.
+ newsize=9043968
+ truncate -s 9043968 /tmp/image
+ df /mnt/loop
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/loop1 7391 7124 91 99% /mnt/loop
| How to calculate the correct size of a loopback device filesystem image for debootstrap? |
1,460,253,961,000 |
I have written a shell script which debootstraps a Debian system into a directory, chroots in there, sets everything up (passwords and SSH keys and so on), and generates a bootable image file from it.
A few additional packages are defined in debootstraps --include option. One of them is locales.
When the image is booted, trying to run certain programs e.g. tmux results in following error message:
tmux: invalid LC_ALL, LC_CTYPE or LANG
Right now I'm solving this manually by running dpkg-reconfigure locales in every booted image. How can I automate this already at debootstrap or chroot stage, so that the image is correct from the beginning?
|
In the chroot: configure /etc/locale.gen to your liking, then run locale-gen.
| How to add locales to a chrooted system programmatically? |
1,460,253,961,000 |
Every now and then I'm debootstraping debian into a local directory. Until 3 hours ago it worked fine, however, now I get this error message:
Command
debootstrap --include linux-image-4.9.0-3-amd64,sudo,openssh-server,hdparm,net-tools,udhcpc stretch /tmp/generate-image/mount
Output
I: Retrieving InRelease
I: Retrieving Release
I: Retrieving Release.gpg
I: Checking Release signature
I: Valid Release signature (key id 067E3C456BAE240ACEE88F6FEF0F382A1A7B6500)
I: Retrieving Packages
I: Validating Packages
I: Resolving dependencies of required packages...
I: Resolving dependencies of base packages...
I: Found additional required dependencies: libaudit-common libaudit1 libbz2-1.0 libcap-ng0 libdb5.3 libdebconfclient0 libgcrypt20 libgpg-error0 liblz4-1 libncursesw5 libsemanage-common libsemanage1 libsystemd0 libudev1 libustr-1.0-1
I: Found additional base dependencies: busybox dmsetup gnupg-agent libapparmor1 libassuan0 libbsd0 libcap2 libcryptsetup4 libdevmapper1.02.1 libdns-export162 libedit2 libelf1 libfastjson4 libffi6 libgmp10 libgnutls30 libgssapi-krb5-2 libhogweed4 libidn11 libidn2-0 libip4tc0 libip6tc0 libiptc0 libisc-export160 libk5crypto3 libkeyutils1 libkrb5-3 libkrb5support0 libksba8 liblocale-gettext-perl liblognorm5 libmnl0 libncurses5 libnetfilter-conntrack3 libnettle6 libnfnetlink0 libnpth0 libp11-kit0 libpsl5 libseccomp2 libsqlite3-0 libtasn1-6 libtext-charwidth-perl libtext-iconv-perl libtext-wrapi18n-perl libunistring0 libwrap0 libxtables12 openssh-client openssh-sftp-server pinentry-curses ucf xxd
I: Checking component main on http://deb.debian.org/debian...
E: Couldn't find these debs: linux-image-4.9.0-3-amd64
Until a few hours ago, output was like this:
I: Retrieving InRelease
I: Retrieving Release
I: Retrieving Release.gpg
I: Checking Release signature
I: Valid Release signature (key id 067E3C456BAE240ACEE88F6FEF0F382A1A7B6500)
I: Retrieving Packages
I: Validating Packages
I: Resolving dependencies of required packages...
I: Resolving dependencies of base packages...
I: Found additional required dependencies: libaudit-common libaudit1 libbz2-1.0 libcap-ng0 libdb5.3 libdebconfclient0 libgcrypt20 libgpg-error0 liblz4-1 libncursesw5 libsemanage-common libsemanage1 libsystemd0 libudev1 libustr-1.0-1
I: Found additional base dependencies: busybox dmsetup gnupg-agent initramfs-tools initramfs-tools-core klibc-utils libapparmor1 libassuan0 libbsd0 libcap2 libcryptsetup4 libdevmapper1.02.1 libdns-export162 libedit2 libelf1 libfastjson4 libffi6 libgmp10 libgnutls30 libgssapi-krb5-2 libhogweed4 libidn11 libidn2-0 libip4tc0 libip6tc0 libiptc0 libisc-export160 libk5crypto3 libkeyutils1 libklibc libkrb5-3 libkrb5support0 libksba8 liblocale-gettext-perl liblognorm5 libmnl0 libncurses5 libnetfilter-conntrack3 libnettle6 libnfnetlink0 libnpth0 libp11-kit0 libpsl5 libseccomp2 libsqlite3-0 libtasn1-6 libtext-charwidth-perl libtext-iconv-perl libtext-wrapi18n-perl libunistring0 libwrap0 libxtables12 linux-base openssh-client openssh-sftp-server pinentry-curses ucf xxd
I: Checking component main on http://deb.debian.org/debian...
I: Retrieving libacl1 2.2.52-3+b1
I: Validating libacl1 2.2.52-3+b1
I: Retrieving adduser 3.115
... and so on
At first I though that this package is perhaps discontinued. However, after running apt-get update, apt-cache search linux-image-4.9.0-3-amd64 still finds this package, so it should still be available.
On a debian website, it prints a red [security] notice next to the package name. What does it mean? Could this be the reason? How can I continue to debootstrap Debian?
|
The stable kernel is now linux-image-4.9.0-4-amd64, you need to specify that instead.
Better yet, tell debootstrap to include linux-image-amd64 instead of a specific version, that way you’ll always get the current stable kernel and you won’t run into such issues.
(The sudden disappearance of the old package is related to the release of Debian 9.2 today.)
| Couldn't find these debs: linux-image-4.9.0-3-amd64 |
1,460,253,961,000 |
I need to set the arch option in debootstrap. So I did some research and read the manual.
After reading the manual I see that the section on the options simply says
--arch=ARCH
Implying that I should know the correct syntax for the architecture I need.
I don't. I need 64 bit architecture.
I know that "i386" can be used for 32bit architecture.
What should I set the --arch option to if I want 64 bit architecture?
Or more generally what would the range of options be?
I could guess (but don't know and can't determine) that potentially the range or arch options depends on the OS being booted. In my case its a version of ubuntu that I know should work in 64bit. So the question becomes how would I determine the 64bit architecture option syntax?
I could further guess (but again don't know and can't determine) that the option syntaxes are actually supplied by the booted OS and if I knew where to look I could figure it out. In which case, where would I look?
|
The possible values are the codenames of the architectures supported by the target operating system. For Ubuntu, check the architectures for which the C library is built: for 64-bit x86, the appropriate value is amd64.
On systems with dpkg,
dpkg --print-architecture
will show the current architecture (which is the default architecture for debootstrap).
debootstrap is also capable of installing a system for any supported architecture, not only the host system’s architecture; see its --foreign option. If necessary it can use Qemu to emulate the target architecture.
| What are the possible options for the --arch option in debootstrap? |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.