Is there a way to add a bunch of printers to CUPS via API?
I have CUPS server running in docker and have a list of printers I need to add there with specific drives. CUPS docks do not answer this question
actually, you can add a printer to cups by command, like:
lpadmin -p "printerName" -E -v lpd://192.168.1.2/queue -P driver.ppd
the details of lpadmin cups api, check this out:
https://github.com/apple/cups/blob/master/systemv/lpadmin.c
Related
I'm getting an error while trying to connect raspberry running ubuntu mate to my Google Cloud SQL instance.
These are the step I did to install:
git clone https://github.com/GoogleCloudPlatform/cloudsql-proxy
cd cloudsql-proxy/
sudo sh download_proxy.sh
My instance is configured this way (I deleted some characters in the image and in the code):
I didn't set the network because I'll be using proxy
Then I download into the same folder my JSON key.
wget https://drive.google.com/file/d/my_key.json
And the start the proxy
sudo ./cloud_sql_proxy -instances=be - 21:us-central1:be =tcp:3306 \
-credential_file=./my_key.json &
But I'm getting the error:
pi#pi:~/cloudsql-proxy$ ./cloud_sql_proxy: 1: ./cloud_sql_proxy:
Syntax error: ")" unexpected
I've tried removing the .json and I was getting the same error before without credential, I think that the problem is in the setup.
My dir ls is:
Any help is appreciated :)
download_proxy.sh downloads the proxy compiled for the amd64 architecture of CPU (aka x86_64). Your raspberry Pi has a ARM CPU, so this binary cannot run on your machine.
Google does not provide pre-build ARM versions of the proxy. I don't even know if it is able to build on ARM CPU. If it is possible, this is how you must do it:
Install go, e.g. with apt-get install golang
Setup a GOPATH, as per https://github.com/golang/go/wiki/GOPATH
Run go get github.com/GoogleCloudPlatform/cloudsql-proxy/cmd/cloud_sql_proxy
Run the proxy with $GOPATH/cloud_sql_proxy -instances=...
Ok.
I'm sharing what I did to make it work, as David I don't know what version was I downloading.
I tried to avoid installing Go but it was the only way to get it installed.
sudo apt-get install golang-go
export GOPATH=$HOME/go
go get github.com/GoogleCloudPlatform/cloudsql-proxy/cmd/cloud_sql_proxy
cd $GOPATH/bin
wget your_key.json
sudo ./cloud_sql_proxy -instances=the_full_name_of_the_instance=tcp:3306 -credential_file=./your_key.json &
But I was getting a error because I already have mysql running localy in the same port
So now I'm using a unix soquet
sudo ./cloud_sql_proxy -instances=the_full_name_of_the_instance -credential_file=./your_key.json &
And then it's ready for connections :)
Thanks guys
I found issues with this when compiling SQL-proxy. I did, however, find the instructions here worked great on my raspberry pi 3. Have to make sure to remove all prior installations then reinstall it
wget https://storage.googleapis.com/golang/go1.9.linux-armv6l.tar.gz
sudo tar -C /usr/local -xzf go1.9.linux-armv6l.tar.gz
export PATH=$PATH:/usr/local/go/bin # put into ~/.profile`
After every restart the changes I make to iptables are lost. I know now that I have to save the changes after making them, but every way of saving I tried so far doesn't work.
I tried the following :
/etc/init.d/iptables save (command not found)
/usr/libexec/iptables.init save (command not found)
/sbin/service iptables save (the service supports only basic lsb actions)
I'm just a basic *nix user, so most of my knowledge is based on uncle Google and I cannot find more solutions at the moment. Any help would be appreciated.
I'm on Fedora 22 64-bit.
As Fedora uses firewalld in recent versions, you need to do it with firewalld commands. Take a look here
If you insist to use iptables, you need to install iptables in order to use iptables-save and iptables-restore commands using dnf install iptables .
I want to know how to build grub 2 bootloader from it's source in ubuntu and test it with qemu emulator.
I would also like to change the default background image of grub2 bootloader in the new build?
Is this possible? If yes, how ?
Of course you can.
As shown on the GRUB website, the grub source code is available via git from git.savannah.gnu.org.
Then it is theoretically just a question of
$ ./autogen.sh
$ ./configure
$ make
$ sudo make install
However, depending on your platform, grub's default target platform may or may not be what you want. So you will need to decide which firmware platform you want to use in QEMU, which depending on your architecture can be something like
(pc) BIOS
coreboot
(U)EFI
ieee1275 (open firmware)
u-boot
Your mentioning of Ubuntu matches at least 3 possible options from the above, but I'm going to be boring and assume you mean x86_64/amd64. Since you will be running GRUB under QEMU, it does not really matter which of the two likely platforms ("pc" or "efi") your physical computer is running. So let's live a little and go for the (U)EFI variant.
You will need some prerequisites installed before configuring and building, so
$ sudo apt-get install build-essential autoconf automake
$ sudo apt-get build-dep grub-efi-amd64
So a practical build may look a bit like this:
$ # Next command is optionnal (languages):
$ ./linguas.sh
$ ./autogen.sh
$ # Next parameters are optionnal:
$ ./configure --prefix=$HOME/local --platform=efi
$ make
$ # Next command is optionnal:
$ make check
$ make install
The easiest way to get a functioning GRUB image is probably with the grub-mkstandalone command:
$ $HOME/local/bin/grub-mkstandalone -O x86_64-efi -o mygrub.efi
Note: To install grub on /dev/sda disk (instead of QEMU), use:
$ sudo grub-install /dev/sda
Note: If you don't see GRUB menu when booting, check this question. It involves pressing Shift when booting or editing /etc/default/grub to comment GRUB_HIDDEN_TIMEOUT.
Then you need some kind of UEFI image to run under your QEMU. The default choice for x86 is called OVMF and is part of Tianocore EDK2 - the de facto open source implementation of UEFI. Due to legal technicalities with regards to redistribution of the FAT filesystem driver, many Linux distributions (including Ubuntu) do not include a pre-built one. But have no fear, it is pretty straightforward to build one yourself.
However, I am not going to take this answer further off-topic than I already have, so all I am going to say is have a read through the OVMF README and look through one or two only slightly outdated blog posts about it.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
I installed Fedora 20 a while ago and now decided to install and test Xfce ui.
I installed Desktop Switched gui utility for switching the ui.
Now when I select xfce in the switcher utility and click apply I get the following message.
Your desktop configuration has successfully been updated, but you must
restart the X Window System for the changes to take effect.
I then restart my system by doing a shutdown however my old ui (which I believe is gnome) still shows up. How do I restart the Xwindows system ?
So as I mentioned in the comments I was unable to reproduce your issue. Here is what I did.
a fresh install of Fedora-Live-Desktop-i686-20-1.iso. I created a user during this process.
then updated it with $ sudo yum groups install "Xfce Desktop".
Then I rebooted
When I got the gdm screen. I was able to click on the little gear icon and select Xfce, and everything worked like a top.
Update ( what fixed the issue ):
MistyD > No I changed the start up from session manager during logging on. The next time I restarted my system my old session option was preselected
So now what? Well in the the spirit of:
teach a man/woman to fish you feed him for a lifetime
Note: This the techniques below are non-vendor specific linux configuration advice.
In general when experience window manager configuration issues like this one: and you have two machines: and one works [ workie-box ] and once does not [ no-workie-box ].
I will go through the following debugging process:
Package installation differences
Package Configuration differences
User configuration differences
1: Package installation differences
this situation can arise for a myriad of reasons, however the most common one is the package updates. ( in this case the yum groupinstall ) occurred at different times or while pointed to different package repositories.
$ ssh root#no-workie-box
$ rpm -qa |sort > all_packages_no_workie_box.txt
Now collect the same information on the workie-box
$ ssh root#workie-box
$ rpm -qa |sort > all_packages_workie.txt
Finally copy those two text files to a different machine and diff them. This little technique has saved my bacon many many times.
To round out this topic: what if someone touched something within the package ... how can I know that? With rpm's verify command.
$ rpm -qV gdm
This can also be a super helpful technique.
2. Package Configuration differences
For your issue specifically this is tricky because you have to first choose a display managers. There are several: for example: cdm, tdm, gdm, kdm, lightdm, lxdm, mdm, xdm, SLiM, etc. Mix in with that the fact that different distros package them up and this can turn into the Wild-Wild-West pretty quickly. However here are some helpful rpm specifics
$ rpm -ql gdm |grep bin
/usr/bin/gdm-screenshot
/usr/bin/gdmflexiserver
/usr/sbin/gdm
$ rpm -qcf /usr/sbin/gdm
/etc/gdm/Init/Default
/etc/gdm/PostLogin/Default.sample
/etc/gdm/PostSession/Default
/etc/gdm/PreSession/Default
/etc/gdm/custom.conf
/etc/pam.d/gdm-autologin
/etc/pam.d/gdm-fingerprint
/etc/pam.d/gdm-password
/etc/pam.d/gdm-pin
/etc/pam.d/gdm-smartcard
You now know the pond you are fishing in, and alto of times that is enough to catch some fish. Combine that knowledge with the little tidbit I pointed out in section 1:
$ rpm -qV gdm
and this will put you on-top of anyone else configuration attempts. ( including yours that you forgot about )
3. User configuration differences
This little technique has saved my bacon numerous times while un-spooling some window manager that is not working properly. So here is the deal, linux stands on the shoulders of unix's multi user environment heritage. Because of tenet's of unix in general related to user configuration, linux will store all sorts of configuration information in your home directory. This can become extremely problamatic on an update. As most package upgrade systems will leave your configuration un-touched. I.E. They treat you as the expert... they assume you know what you are doing.. so the packagemanager wont touch user configurations.
# Logged in as a user
$ ls -a1 |grep ^\\.
.
..
.bash_history
.bash_logout
.bash_profile
.bashrc
.cache
.color
.config
.esd_auth
.gnupg
.ICEauthority
.local
.mozilla
.ssh
Look at all of those dot files and directories... Note: there could be plenty more.
Over the years I have used a few techniques to deal with this issue. However my new favorite one is to create a new user from scratch.
Reboot ( - cringe - )
Then log in as that new user. More often than not that will fix the issue. You know that the problem is something to do with your previous user's configuration.
Finally:
The last part of your question was related to restarting X, to re-read in your configuration.
Note: I put a reboot -- cringe -- in the previous section. You will find that salty sys admins take great pride in the fact that they dont reboot there linux machines. This is usually because they deal with servers all the time. I would go a step further and ask why you are running a gui on your server. But alas for the nerdy....
Here is how to re-start an X window session without rebooting.
Ok so the deal is that most likely the window manager, and thus the X session was started by a display-manager. Therefore when you log out of your window manager you are still running X. To force a restart... So here is what you do... Kill all of the display-manager && X processes. They will re-fire.. and re-read in your X configuration.
1: ctrl alt F2
This will take you to a terminal.
2: $ ps -efw
observe the processes, you are looking for X processes
3: $ ps -efw |grep X
these are your X server processes.
You also need to find your desktop manager processes. ( you could have several different ones )
4: $ ps -efw |grep kdm
$ ps -efw |grep gdm
Now: kill all of the X processes and the display manager processes.
5: $ kill -9 #<pid1> #<pid2> #<pid3> #<pid4>
Note: The system will be configured to restart those DISAPLY manager processes, thus restarting X and re-reading in your configuration.
Or you could just reboot -- grin --
I use the Google Compute Engine Web Console to remote into my instance. I can perform root operations using "sudo", but what if I wanted to "su" to root?
I created a user "test", and now want to log-in as "test" -- this doesn't work as I have not yet generated SSH keys. Where do I find these keys for instance creator and/or root as well?
Also, I used a Debian image, but few commands appear to be installed by default. For instance, locate, updatedb, etc are missing? How do I get these?
You asked several questions in a single post; I'll answer them in order.
(1) I use the Google Compute Engine Web Console to remote into my instance. I can perform root operations using "sudo", but what if I wanted to "su" to root?
Use: sudo su -
(2) I created a user "test", and now want to log-in as "test" -- this doesn't work as I have not yet generated SSH keys. Where do I find these keys for instance creator and/or root as well?
You can ssh via gcloud compute ssh or by clicking on the "SSH" button on the web UI, and then run: sudo su test.
(3) Also, I used a Debian image, but few commands appear to be installed by default. For instance, locate, updatedb, etc are missing? How do I get these?
To install missing packages, you'll have to use the standard Debian command apt-get to install the packages, e.g.:
$ sudo apt-get install [name-of-package]
To find a package name using keywords, use:
$ apt-cache search [keyword]
Note: the first thing you want to do on a brand-new instance is to update your package metadata cache by running:
$ sudo apt-get update
https://cloud.google.com/solutions/set-up-postgres
The above link helped me get over a similar issue described above but in the postgres user setup context. Wasn't covered in any of the other posts so thought to share here.